@serifpersia/dango 3.3.5 → 3.3.7

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.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-CXx2EIN7.js → AnimeCard-WlhU88fn.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-C6ehrfYW.js → AnimeInfo-BCLagpbu.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-pgnMg0On.js → AnimeInfoPage-o0U_OXKP.js} +2 -2
  5. package/client/dist/assets/{Asmr-DfA8xB-U.js → Asmr-ieGJ_BcQ.js} +1 -1
  6. package/client/dist/assets/{AsmrResetProgressModal-QUNnEh9C.js → AsmrResetProgressModal-BwaoVski.js} +1 -1
  7. package/client/dist/assets/{AvSyncCalibrator-C1_iBSyL.css → AvSyncCalibrator-BPa6KaGC.css} +1 -1
  8. package/client/dist/assets/AvSyncCalibrator-CXvBuY4l.js +10 -0
  9. package/client/dist/assets/Home-DjLpvsp8.js +1 -0
  10. package/client/dist/assets/Insights-Dc8xLmsr.css +1 -0
  11. package/client/dist/assets/Insights-lQcQoeES.js +1 -0
  12. package/client/dist/assets/LibraryListPage-B2nhFFrc.js +1 -0
  13. package/client/dist/assets/{ListeningList-BzbQwmh0.js → ListeningList-okIpsKCr.js} +1 -1
  14. package/client/dist/assets/{Manga-223panCD.js → Manga-3u9nVNZC.js} +1 -1
  15. package/client/dist/assets/{MangaInfoPage-DBqX-Ord.js → MangaInfoPage-Cat-B487.js} +1 -1
  16. package/client/dist/assets/{MangaReadPage-DuXdVyTd.js → MangaReadPage-CyLRxzvl.js} +1 -1
  17. package/client/dist/assets/{MangaResetProgressModal-6C3iaR6g.js → MangaResetProgressModal-Ch8RjwbO.js} +1 -1
  18. package/client/dist/assets/Mature-pINwl5wj.js +1 -0
  19. package/client/dist/assets/{MediaCard-xfJv6irD.js → MediaCard-DDiYEAm8.js} +1 -1
  20. package/client/dist/assets/{Music-DkIeCRq1.js → Music-B1swlVLI.js} +1 -1
  21. package/client/dist/assets/{OptionListMenu-JQ_--ggT.js → OptionListMenu-CzH2VSPh.js} +1 -1
  22. package/client/dist/assets/Player-SKPWb-o8.js +56 -0
  23. package/client/dist/assets/PlayerSettings-jrmY95-i.js +1 -0
  24. package/client/dist/assets/{QueueOptionsButton-BKNDfpCl.js → QueueOptionsButton-CcVP7Vi6.js} +1 -1
  25. package/client/dist/assets/{QueueRail-Cgljhm64.js → QueueRail-Cj-PU9EV.js} +1 -1
  26. package/client/dist/assets/{Radio-wbxhaiqy.js → Radio-CRlbaxQt.js} +1 -1
  27. package/client/dist/assets/{ReadingList-DNJAx_LW.js → ReadingList-wRtHGNo8.js} +1 -1
  28. package/client/dist/assets/{ResetProgressModal-By-iSYwL.js → ResetProgressModal-BokfoYFB.js} +1 -1
  29. package/client/dist/assets/Search-BOOBeTVA.js +1 -0
  30. package/client/dist/assets/{Settings-BeS0llCE.js → Settings-BgrcswJD.js} +1 -1
  31. package/client/dist/assets/SkeletonGrid-Bge3aRl2.css +1 -0
  32. package/client/dist/assets/SkeletonGrid-C6S7OYHn.js +1 -0
  33. package/client/dist/assets/{Trackers-ACFHfLXZ.js → Trackers-DLcTEJJW.js} +1 -1
  34. package/client/dist/assets/Tv-ByVckozq.js +4 -0
  35. package/client/dist/assets/Tv-C2SWcVzN.css +1 -0
  36. package/client/dist/assets/{TvInfo-fFNHV1RJ.js → TvInfo-fJ9SFMK8.js} +1 -1
  37. package/client/dist/assets/{TvPopup-DYKTHRrD.js → TvPopup-yfH7p0y0.js} +1 -1
  38. package/client/dist/assets/TvSearch-CBNWDByW.js +1 -0
  39. package/client/dist/assets/{TvWatchlist-CTUZAvfa.js → TvWatchlist-BqjZ2-4A.js} +1 -1
  40. package/client/dist/assets/Watchlist-B_Q2hEiJ.js +1 -0
  41. package/client/dist/assets/{hls-Cbou9Eb-.js → hls-kIF7bMpF.js} +1 -1
  42. package/client/dist/assets/{index-CfvzoNYQ.js → index-C65i4HWv.js} +2 -2
  43. package/client/dist/assets/{useAnimeInfoData-D-vEehTG.js → useAnimeInfoData-BKSrS8eN.js} +1 -1
  44. package/client/dist/assets/{useAsmr-B-3EYd-B.js → useAsmr-Byj8Qiwp.js} +1 -1
  45. package/client/dist/assets/{useAsmrPopup-D9BxuTDg.js → useAsmrPopup-CLcWCCXf.js} +1 -1
  46. package/client/dist/assets/{useMangaLibrary-DtRKgk2x.js → useMangaLibrary-U7tUo8nx.js} +1 -1
  47. package/client/dist/assets/{useMangaPopup-BNWJ5pR2.js → useMangaPopup-ZonOP5_c.js} +1 -1
  48. package/client/dist/assets/{useProviders-jxh6fvMH.js → useProviders-CymA42ZB.js} +1 -1
  49. package/client/dist/assets/{useTv-CP4mofvR.js → useTv-CPj6Cf42.js} +1 -1
  50. package/client/dist/assets/{useTvLibrary-DeGkJuvp.js → useTvLibrary-COsyN8yu.js} +1 -1
  51. package/client/dist/index.html +1 -1
  52. package/package.json +2 -2
  53. package/server/dist/controllers/insights.controller.js +5 -1
  54. package/server/dist/controllers/proxy.controller.js +94 -23
  55. package/server/dist/controllers/watchlist.controller.js +42 -0
  56. package/server/dist/lib/discord-roles-sync.service.js +237 -2
  57. package/server/dist/repositories/insights.repository.js +10 -0
  58. package/server/dist/repositories/shows-meta.repository.js +4 -1
  59. package/server/dist/repositories/watchlist.repository.js +1 -0
  60. package/server/dist/routes/insights.routes.js +1 -0
  61. package/server/package.json +1 -1
  62. package/client/dist/assets/AvSyncCalibrator-Bs4iejCG.js +0 -10
  63. package/client/dist/assets/Home-Csx6zT32.js +0 -1
  64. package/client/dist/assets/Insights-DKtoVe6L.css +0 -1
  65. package/client/dist/assets/Insights-MW8oRqeX.js +0 -1
  66. package/client/dist/assets/LibraryListPage-VYaHXgXt.js +0 -1
  67. package/client/dist/assets/Mature-3VlywJMR.js +0 -1
  68. package/client/dist/assets/Player-Czg_D7FN.js +0 -56
  69. package/client/dist/assets/PlayerSettings-KrFECely.js +0 -1
  70. package/client/dist/assets/Search-63TcSgOa.js +0 -1
  71. package/client/dist/assets/SkeletonGrid-CnE_aoEU.js +0 -1
  72. package/client/dist/assets/SkeletonGrid-DhPYefXr.css +0 -1
  73. package/client/dist/assets/Tv-BCmNLUsp.js +0 -4
  74. package/client/dist/assets/Tv-CuEl3Iol.css +0 -1
  75. package/client/dist/assets/TvSearch-CpenLEBz.js +0 -1
  76. package/client/dist/assets/Watchlist-B10pIG1F.js +0 -1
@@ -1 +0,0 @@
1
- import{h as I,d as D,T as p,u as e}from"./vendor-core-8R2fFbyN.js";import{b as x}from"./vendor-query-BXRECSI6.js";import{I as l}from"./vendor-icons-CDMuNDeL.js";import{X as $,d as R,f as T}from"./index-CfvzoNYQ.js";const G="_header_1d4ig_1",M="_fadeIn_1d4ig_1",W="_personaBadge_1d4ig_9",O="_personaInfo_1d4ig_37",V="_personaLabel_1d4ig_42",F="_personaValue_1d4ig_51",Y="_statsGrid_1d4ig_57",P="_slideUpIn_1d4ig_1",A="_statCard_1d4ig_65",H="_statIcon_1d4ig_82",E="_statInfo_1d4ig_98",U="_statValue_1d4ig_103",q="_statLabel_1d4ig_112",z="_wideSection_1d4ig_120",j="_sectionHeader_1d4ig_132",K="_yearSelect_1d4ig_147",Q="_heatmapLayout_1d4ig_176",X="_dayLabels_1d4ig_183",J="_heatmapWrapper_1d4ig_195",Z="_heatmapMonthLabels_1d4ig_201",ee="_heatmapGrid_1d4ig_212",ae="_heatBox_1d4ig_220",te="_hiddenBox_1d4ig_229",se="_level0_1d4ig_240",ne="_level1_1d4ig_243",re="_level2_1d4ig_247",ie="_level3_1d4ig_251",le="_level4_1d4ig_255",oe="_heatmapFooter_1d4ig_260",ce="_heatLegend_1d4ig_267",de="_chartsContainer_1d4ig_277",he="_chartWrapper_1d4ig_285",pe="_hourlyChart_1d4ig_312",ge="_hourlyBarContainer_1d4ig_320",me="_hourlyBar_1d4ig_320",_e="_hourlyLabel_1d4ig_346",ue="_chartSubtext_1d4ig_353",ve="_popScale_1d4ig_365",Ne="_popTrack_1d4ig_369",ye="_popThumb_1d4ig_377",be="_popLabels_1d4ig_389",fe="_popDescription_1d4ig_399",Se="_seasonalChart_1d4ig_414",Ce="_seasonalBarContainer_1d4ig_422",ke="_seasonalBar_1d4ig_422",Le="_seasonalLabel_1d4ig_444",Be="_genreList_1d4ig_452",we="_genreRow_1d4ig_459",Ie="_genreInfo_1d4ig_465",De="_genreName_1d4ig_472",xe="_genreCount_1d4ig_479",$e="_genreBarBg_1d4ig_486",Re="_genreBar_1d4ig_486",Te="_warningSection_1d4ig_499",Ge="_warningHeader_1d4ig_510",Me="_droppedGrid_1d4ig_526",We="_droppedCard_1d4ig_532",Oe="_droppedName_1d4ig_549",Ve="_droppedDate_1d4ig_556",Fe="_genreGrid_1d4ig_597",Ye="_genreCard_1d4ig_609",Pe="_rankBadge_1d4ig_618",Ae="_rankNumber_1d4ig_631",He="_genreTitle_1d4ig_637",Ee="_genreStats_1d4ig_645",Ue="_posterRow_1d4ig_653",qe="_miniPoster_1d4ig_660",ze="_genreCardSkeleton_1d4ig_674",je="_pulse_1d4ig_1",Ke="_skeletonRank_1d4ig_682",Qe="_skeletonTitle_1d4ig_696",Xe="_skeletonStats_1d4ig_709",Je="_skeletonPosters_1d4ig_721",a={header:G,fadeIn:M,personaBadge:W,personaInfo:O,personaLabel:V,personaValue:F,statsGrid:Y,slideUpIn:P,statCard:A,statIcon:H,statInfo:E,statValue:U,statLabel:q,wideSection:z,sectionHeader:j,yearSelect:K,heatmapLayout:Q,dayLabels:X,heatmapWrapper:J,heatmapMonthLabels:Z,heatmapGrid:ee,heatBox:ae,hiddenBox:te,level0:se,level1:ne,level2:re,level3:ie,level4:le,heatmapFooter:oe,heatLegend:ce,chartsContainer:de,chartWrapper:he,hourlyChart:pe,hourlyBarContainer:ge,hourlyBar:me,hourlyLabel:_e,chartSubtext:ue,popScale:ve,popTrack:Ne,popThumb:ye,popLabels:be,popDescription:fe,seasonalChart:Se,seasonalBarContainer:Ce,seasonalBar:ke,seasonalLabel:Le,genreList:Be,genreRow:we,genreInfo:Ie,genreName:De,genreCount:xe,genreBarBg:$e,genreBar:Re,warningSection:Te,warningHeader:Ge,droppedGrid:Me,droppedCard:We,droppedName:Oe,droppedDate:Ve,genreGrid:Fe,genreCard:Ye,rankBadge:Pe,rankNumber:Ae,genreTitle:He,genreStats:Ee,posterRow:Ue,miniPoster:qe,genreCardSkeleton:ze,pulse:je,skeletonRank:Ke,skeletonTitle:Qe,skeletonStats:Xe,skeletonPosters:Je},sa=()=>{I(()=>{document.title="Insights - dango"},[]);const{data:s,isLoading:N,isError:y}=x({queryKey:["insights"],queryFn:async()=>{const t=await fetch("/api/insights");if(!t.ok)throw new Error("Failed to fetch insights");return t.json()}}),{data:b,isLoading:g}=$(),{titlePreference:f}=R(),m=t=>{switch(f){case"nativeName":return t.nativeName||t.name;case"englishName":return t.englishName||t.name;default:return t.name}},[c,S]=D(new Date().getFullYear()),C=p(()=>{if(!s?.activityGrid)return[new Date().getFullYear()];const t=new Set(s.activityGrid.map(n=>parseInt(n.day.split("-")[0])));return t.add(new Date().getFullYear()),Array.from(t).sort((n,r)=>r-n)},[s]),_=p(()=>{if(!s?.activityGrid)return[];const t=new Map(s.activityGrid.map(h=>[h.day,h.count])),n=[],r=new Date(c,0,1),o=new Date(c,11,31),d=r.getDay(),i=new Date(r);for(i.setDate(i.getDate()-d);(i<=o||i.getDay()!==0)&&!(i>o&&i.getDay()===0);){const h=i.getFullYear(),B=String(i.getMonth()+1).padStart(2,"0"),w=String(i.getDate()).padStart(2,"0"),u=`${h}-${B}-${w}`,v=i<r||i>o;n.push({date:u,count:v?0:t.get(u)||0,month:i.getMonth(),isOutOfRange:v}),i.setDate(i.getDate()+1)}return n},[s,c]),k=p(()=>s?.seasonality?.length?Math.max(...s.seasonality.map(t=>t.seconds),1):0,[s]),L=p(()=>s?.hourlyDist?.length?Math.max(...s.hourlyDist.map(t=>t.count),1):0,[s]);return N||g?e("div",{className:a.loading,children:"Analyzing your anime lifestyle..."}):y?e("div",{className:a.error,children:"Could not load insights. Data might be syncing."}):s?e("div",{className:"page-container",children:[e("div",{className:a.header,children:[e("h2",{className:"section-title",children:"Watch Insights"}),e("div",{className:a.personaBadge,children:[e(l,{name:"user-astronaut"}),e("div",{className:a.personaInfo,children:[e("span",{className:a.personaLabel,children:"Your Persona"}),e("span",{className:a.personaValue,children:s.persona})]})]})]}),e("div",{className:a.statsGrid,children:[e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(138, 79, 255, 0.2)",color:"var(--accent)"},children:e(l,{name:"clock"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.totalHours,"h"]}),e("span",{className:a.statLabel,children:"Watch Time"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(167, 139, 250, 0.2)",color:"#a78bfa"},children:e(l,{name:"bookmark"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.totalAnime}),e("span",{className:a.statLabel,children:"Total Anime"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.totalEpisodes}),e("span",{className:a.statLabel,children:"Episodes Watched"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.completionRate,"%"]}),e("span",{className:a.statLabel,children:"Completion Rate"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(45, 212, 191, 0.2)",color:"#2dd4bf"},children:e(l,{name:"tv"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.completedAnime}),e("span",{className:a.statLabel,children:"Completed Shows"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(239, 68, 68, 0.2)",color:"#ef4444"},children:e(l,{name:"fire"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.bingeFactor}),e("span",{className:a.statLabel,children:"Max Daily Binge"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(59, 130, 246, 0.2)",color:"#3b82f6"},children:e(l,{name:"history"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.avgSessionMinutes,"m"]}),e("span",{className:a.statLabel,children:"Avg. Session"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(251, 191, 36, 0.2)",color:"#fbbf24"},children:e(l,{name:"layer-group"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.avgCompletionDays,"d"]}),e("span",{className:a.statLabel,children:"Avg. Speed"})]})]})]}),e("div",{className:a.wideSection,children:[e("div",{className:a.sectionHeader,children:[e("h3",{children:"Activity"}),e("select",{className:a.yearSelect,value:c,onChange:t=>S(Number(t.currentTarget.value)),children:C.map(t=>e("option",{value:t,children:t},t))})]}),e("div",{className:a.heatmapLayout,children:[e("div",{className:a.dayLabels,children:[e("span",{style:{gridRow:2},children:"Mon"}),e("span",{style:{gridRow:4},children:"Wed"}),e("span",{style:{gridRow:6},children:"Fri"})]}),e("div",{className:a.heatmapWrapper,children:[e("div",{className:a.heatmapMonthLabels,children:(()=>{const t=[];let n=-1;return _.forEach((r,o)=>{if(r.month!==n&&!r.isOutOfRange){const d=Math.floor(o/7)+1;d>(t.length>0?t[t.length-1].props.style.gridColumn+2:-1)&&(t.push(e("span",{style:{gridColumn:d,whiteSpace:"nowrap"},children:new Date(0,r.month).toLocaleString("default",{month:"short"})},o)),n=r.month)}}),t})()}),e("div",{className:a.heatmapGrid,children:_.map((t,n)=>{let r=0;return t.count>0&&!t.isOutOfRange&&(r=1),t.count>2&&!t.isOutOfRange&&(r=2),t.count>5&&!t.isOutOfRange&&(r=3),t.count>10&&!t.isOutOfRange&&(r=4),e("div",{className:`${a.heatBox} ${a[`level${r}`]} ${t.isOutOfRange?a.hiddenBox:""}`,title:t.isOutOfRange?"":`${t.count} episodes on ${t.date}`},n)})}),e("div",{className:a.heatmapFooter,children:e("div",{className:a.heatLegend,children:[e("span",{children:"Less"}),e("div",{className:`${a.heatBox} ${a.level0}`}),e("div",{className:`${a.heatBox} ${a.level1}`}),e("div",{className:`${a.heatBox} ${a.level2}`}),e("div",{className:`${a.heatBox} ${a.level3}`}),e("div",{className:`${a.heatBox} ${a.level4}`}),e("span",{children:"More"})]})})]})]})]}),e("div",{className:a.chartsContainer,children:[e("div",{className:a.chartWrapper,children:[e("h3",{children:"Time Distribution (24h)"}),e("div",{className:a.hourlyChart,children:s.hourlyDist?.map((t,n)=>e("div",{className:a.hourlyBarContainer,children:[e("div",{className:a.hourlyBar,style:{height:`${t.count/L*100||2}%`,width:"100%",maxWidth:"12px"},title:`${t.count} watches at ${t.hour}:00`}),e("span",{className:a.hourlyLabel,style:{visibility:n%4===0?"visible":"hidden"},children:t.hour})]},n))}),e("div",{className:a.chartSubtext,children:(()=>{if(!s.hourlyDist?.length)return"Watch more to see your peak hours!";const t=parseInt([...s.hourlyDist].sort((n,r)=>r.count-n.count)[0].hour);return t>=6&&t<19?"You prefer daytime watching ☀️":"You're a confirmed Night Owl 🦉"})()})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Popularity Bias"}),e("div",{className:a.popScale,children:[e("div",{className:a.popTrack,children:e("div",{className:a.popThumb,style:{left:`${Math.max(0,Math.min(100,100-s.popularityScore*10))}%`}})}),e("div",{className:a.popLabels,children:[e("span",{children:"Mainstream"}),e("span",{children:"Underground"})]})]}),e("p",{className:a.popDescription,children:["Your taste score is ",e("strong",{children:[s.popularityScore,"/10"]}),".",s.popularityScore>=5?" You follow the big hits!":" You're a connoisseur of the obscure!"]})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Monthly Activity"}),e("div",{className:a.seasonalChart,children:s.seasonality?.map((t,n)=>e("div",{className:a.seasonalBarContainer,children:[e("div",{className:a.seasonalBar,style:{height:`${t.seconds/k*100||5}%`,width:"100%",maxWidth:"24px"},title:`${Math.round(t.seconds/3600)}h in ${new Date(0,n).toLocaleString("default",{month:"long"})}`}),e("span",{className:a.seasonalLabel,children:new Date(0,n).toLocaleString("default",{month:"short"})})]},n))})]})]}),e("div",{className:a.genreGrid,children:g?Array.from({length:4}).map((t,n)=>e("div",{className:a.genreCardSkeleton,children:[e("div",{className:a.skeletonRank}),e("div",{className:a.skeletonTitle}),e("div",{className:a.skeletonStats}),e("div",{className:a.skeletonPosters})]},n)):b?.map(t=>e("div",{className:a.genreCard,children:[e("div",{className:a.rankBadge,children:e("span",{className:a.rankNumber,children:t.rank})}),e("h3",{className:a.genreTitle,children:t.name}),e("div",{className:a.genreStats,children:[e("span",{children:[t.count," episodes"]}),e("span",{children:[t.meanScore.toFixed(1)," avg score"]}),e("span",{children:t.timeWatched})]}),e("div",{className:a.posterRow,children:t.topShows.map(n=>e("img",{src:T(n.thumbnail),alt:m(n),className:a.miniPoster,title:m(n),loading:"lazy",decoding:"async"},n.id))})]},t.name))}),s.droppedShows?.length>0&&e("div",{className:a.warningSection,children:[e("div",{className:a.warningHeader,children:[e(l,{name:"exclamation-triangle"}),e("h3",{children:"Dusty Watchlist (Inactive 90+ days)"})]}),e("div",{className:a.droppedGrid,children:s.droppedShows.map(t=>e("div",{className:a.droppedCard,children:[e("span",{className:a.droppedName,children:t.name}),e("span",{className:a.droppedDate,children:["Last watched: ",new Date(t.lastActivity).toLocaleDateString()]})]},t.id))})]})]}):null};export{sa as default};
@@ -1 +0,0 @@
1
- import{a as ie,d as f,h as ce,u as e}from"./vendor-core-8R2fFbyN.js";import{I as i}from"./vendor-icons-CDMuNDeL.js";import{S as re}from"./SkeletonGrid-CnE_aoEU.js";import{E as de}from"./ErrorMessage-z4f4WGgP.js";import{w as oe,x as me,M as B,B as q}from"./index-CfvzoNYQ.js";import{s as l}from"./Watchlist.module-XGtVQr1d.js";function fe({headerTitle:G,headerSubtitle:H,filters:O,filterBy:o,filterBasePath:U,continueFilter:V,statusOptions:$,entries:m,total:b,isLoading:h,error:I,page:c,pageSize:z,onPageChange:p,emptyTitle:W,emptyFilteredText:Y,emptyAllText:j,browseLabel:F,browseTarget:J,removeListLabel:A,listNoun:S,skipConfirmKey:w,onBulkStatus:Q,onBulkRemove:x,onStatusChange:X,onRemoveItem:M,renderCard:Z,modals:_}){const R=ie(),[g,T]=f(!1),[s,d]=f(new Set),[t,v]=f(null),[y,k]=f(!1),{data:P}=oe(w),K=me();ce(()=>{d(new Set),T(!1)},[o]);const u=o===V,D=String(P)==="true"||String(P)==="1",L=()=>{T(a=>(a&&d(new Set),!a))},ee=a=>{d(n=>{const r=new Set(n);return r.has(a)?r.delete(a):r.add(a),r})},N=m.map(a=>a.libId),C=N.length>0&&N.every(a=>s.has(a)),ae=()=>{d(a=>{const n=new Set(a);if(C)for(const r of N)n.delete(r);else for(const r of N)n.add(r);return n})},le=a=>{s.size!==0&&(Q([...s],a),d(new Set))},se=()=>{s.size!==0&&(u||D?(x([...s]),d(new Set)):v({ids:[...s]}))},ne=a=>{u||D?M(a.libId):v({ids:[a.libId],title:a.title})},te=()=>{t&&(y&&K.mutate({key:w,value:!0}),t.ids.length===1?M(t.ids[0]):x(t.ids),d(new Set),v(null),k(!1))},E=()=>{v(null),k(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:G}),e("p",{className:l.subtitle,children:H})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:O.map(a=>e("button",{className:`${l.filterBtn} ${o===a?l.active:""}`,onClick:()=>R(`${U}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[o,e("span",{className:l.itemCount,children:["(",b," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:L,children:[e(i,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),b>0&&e("div",{className:l.pagination,children:[e("button",{className:l.pageBtn,onClick:()=>p(Math.max(1,c-1)),disabled:c===1||h,"aria-label":"Previous page",children:e(i,{name:"chevron-left",size:14})}),e("span",{className:l.pageInfo,children:["Page ",e("strong",{children:c})]}),e("button",{className:l.pageBtn,onClick:()=>p(c+1),disabled:m.length<z||h,"aria-label":"Next page",children:e(i,{name:"chevron-right",size:14})})]})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:ae,children:[e("span",{className:`${l.selectAllBox} ${C?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:C?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[s.size," selected"]}),e("div",{className:l.manageSpacer}),!u&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&le(a.currentTarget.value)},disabled:s.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:s.size===0,children:[e(i,{name:"trash",size:13}),e("span",{children:u?"Reset Selected":"Remove Selected"})]})]}),h?e(re,{}):I?e(de,{message:I.message}):m.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:W}),e("p",{className:l.emptyText,children:o!=="All"?Y:j}),e("button",{className:l.emptyBtn,onClick:()=>R(J),children:[e(i,{name:"search",size:14}),e("span",{children:F})]})]}):e("div",{className:l.grid,children:m.map(a=>e("div",{className:`${l.itemWrapper} ${s.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ee(a.libId),title:s.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:s.has(a.libId)?e(i,{name:"check",size:12}):null})}),Z(a),!u&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:n=>X(a.libId,n.currentTarget.value),children:$.map(n=>e("option",{value:n,children:n},n))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:A,"aria-label":A,children:e(i,{name:"trash",size:12})})]})]},a.key))}),b>0&&e("div",{className:l.bottomPagination,children:e("div",{className:l.pagination,children:[e("button",{className:l.pageBtn,onClick:()=>p(Math.max(1,c-1)),disabled:c===1||h,children:[e(i,{name:"chevron-left",size:14}),e("span",{children:"Previous"})]}),e("span",{className:l.pageInfo,children:["Page ",e("strong",{children:c})]}),e("button",{className:l.pageBtn,onClick:()=>p(c+1),disabled:m.length<z||h,children:[e("span",{children:"Next"}),e(i,{name:"chevron-right",size:14})]})]})}),_,e(B,{isOpen:!!t,onClose:E,title:`Remove from ${S}`,children:[e(B.Body,{children:[e("p",{children:t&&t.ids.length===1?`Are you sure you want to remove "${t.title}" from your ${S}?`:`Are you sure you want to remove ${t?.ids.length??0} selected items from your ${S}?`}),e("label",{children:[e("input",{type:"checkbox",checked:y,onChange:a=>k(a.target.checked)}),"Don't ask again"]})]}),e(B.Actions,{children:[e(q,{variant:"secondary",onClick:E,children:"No"}),e(q,{variant:"danger",onClick:te,children:"Yes"})]})]})]})}export{fe as L};
@@ -1 +0,0 @@
1
- import{u as t,a as $e,o as Ge,h as me,d as l,T as he,S as ge}from"./vendor-core-8R2fFbyN.js";import{b as pe}from"./vendor-query-BXRECSI6.js";import{B as L,M as we,q as O,Q as Fe,z as Me}from"./index-CfvzoNYQ.js";import{I as A}from"./vendor-icons-CDMuNDeL.js";import{A as qe}from"./AnimeCard-CXx2EIN7.js";import{S as xe}from"./SkeletonGrid-CnE_aoEU.js";import{E as Ue}from"./ErrorMessage-z4f4WGgP.js";import{u as Ye}from"./useMatureConsent-CT7-KfzG.js";import{u as je}from"./useProviders-jxh6fvMH.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-D-vEehTG.js";import"./QueueOptionsButton-BKNDfpCl.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-xfJv6irD.js";import"./useIsMobile-Dm_b6Ob3.js";const Ke=({isOpen:m,onClose:n,onGrant:q})=>t(we,{isOpen:m,title:"Content Warning",onClose:n,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(L,{variant:"secondary",onClick:n,children:"Go Back"}),t(L,{onClick:q,children:"I'm 18+, Continue"})]})]})}),Qe="_shrinkSelect_130sm_1",Ve="_tightGrid_130sm_7",z={shrinkSelect:Qe,tightGrid:Ve},We=[{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"}],He=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Je=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],Ze={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},Xe=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],ve=m=>m.split("-").map(n=>n&&n[0].toUpperCase()+n.slice(1)).join(" ");function vt(){const m=$e(),[n,q]=Ge(),{hasConsent:x,grant:fe}=Ye();me(()=>{document.title="Mature - dango"},[]);const[i,Se]=l(n.get("provider")||"anilist"),[S,H]=l(n.get("query")||""),[T,U]=l(n.get("query")||""),[d,h]=l(parseInt(n.get("page")||"1",10)||1),[R,Y]=l(()=>{const e=n.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[_,J]=l(n.get("sortBy")||""),[b,be]=l(n.get("status")||""),[B,ye]=l(n.get("season")||"ALL"),[k,Ne]=l(n.get("year")||"ALL"),[g,D]=l(n.get("genre")||n.get("genres")||""),[j,Ce]=l(n.get("order")||"recent"),[K,Ae]=l(n.get("studio")||""),[$,Ie]=l(n.get("studio")||""),[Z,X]=l([]),[Q,Pe]=l(!1),[Ee,ee]=l(null),{options:te}=je(),ae=he(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=he(()=>[...We,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:G}=pe({queryKey:["mature-filters"],queryFn:()=>O("/api/mature/filters"),enabled:x,staleTime:1/0}),c=i==="anilist"||i==="mal",V=c?void 0:G?.providers?.[i],I=V?.browse,P=V?.genres??[],y=V?.orders??[],ne=y.length>0&&!y.includes(j)?y[0]:j,w=!c&&(I?.genre===!0||P.length>0||Z.length>0),p=!c&&(I?.order===!0||y.length>0),N=!c&&I?.studio===!0,ie=!c&&I?.sort===!0,le=c?14:I?.pageSize??14,v=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 s=G?.providers?.[e.provider]?.browse,u=G?.providers?.[e.provider]?.orders??[],o=u.length>0&&!u.includes(e.remoteOrder)?u[0]:e.remoteOrder;(!s||s.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!s||s.genre)&&e.genre&&r.set("genre",e.genre),(!s||s.order)&&o!==(u[0]??"recent")&&r.set("order",o),(!s||s.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}q(r,{replace:!0})},f=(e={})=>({provider:i,query:T,page:d,sort:R,remoteSort:_,status:b,season:B,year:k,genre:g,remoteOrder:j,studio:$,...e}),se=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(d)),e.set("limit",String(le)),i==="anilist"&&(e.set("sortBy",R),b&&e.set("status",b),B!=="ALL"&&e.set("season",B),k!=="ALL"&&e.set("year",k)),i==="mal"?(e.set("sortBy",R),b&&e.set("status",b)):c||(w&&g&&e.set("genre",g),p&&e.set("order",ne),ie&&_&&e.set("sortBy",_),N&&$.trim()&&e.set("studio",$.trim())),e.toString()})(),{data:C,isLoading:Oe,isError:Le,error:Te}=pe({queryKey:["mature-search",se],queryFn:()=>O(`/api/mature/search?${se}`),enabled:x});me(()=>{const e=C?.genres;!c&&P.length===0&&e&&e.length>0&&X(r=>{const s=new Set(r.map(o=>o.slug)),u=[...r];for(const o of e)o.slug&&!s.has(o.slug)&&(s.add(o.slug),u.push(o));return u.length===r.length?r:u})},[C,i,c,P.length]);const F=(C?.data||[]).map(e=>({...e,isAdult:!0})),oe=C?.hasMore??!1,E=()=>{Fe(),h(1);let e=g;!c&&!p&&S.trim()&&(e=""),D(e),N&&Ie(K),U(S),v(f({query:S,page:1,genre:e,studio:N?K:$}))},Re=e=>{Se(e),h(1),J(""),D(""),X([]),e==="mal"?Y("SCORE_DESC"):e==="anilist"&&Y("POPULARITY_DESC"),U(S),v(f({provider:e,page:1,remoteSort:"",genre:"",query:S}))},_e=e=>{D(e),h(1),e&&(H(""),U("")),v(f({genre:e,page:1,query:e?"":T}))},M=e=>{h(e),v(f({page:e})),window.scrollTo({top:0,behavior:"smooth"})},Be=async(e,r)=>{const s=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(s)&&(e.preventDefault(),e.stopPropagation(),!Ee)){ee(s);try{if(i!=="anilist"){let o=!1;try{o=(await O("/api/anilist-status"))?.available===!0}catch{o=!1}if(o){const ue=await O(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);m(`/anime/${ue.id}`);return}const ce=await fetch("/api/mature/allocate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,nativeId:s,title:r.name,thumbnail:r.thumbnail})}),de=await ce.json().catch(()=>null);if(!ce.ok||!de?.id)throw new Error("Allocate failed");m(`/anime/${de.id}`);return}const u=await O(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);m(`/anime/${u.id}`)}catch{Me.error("Could not match this title on AniList")}finally{ee(null)}}},W=new Date().getFullYear(),ke=[{value:"ALL",label:"All Years"},...Array.from({length:W-1980+1},(e,r)=>({value:String(W-r),label:String(W-r)}))],De=P.length>0?P.map(e=>({value:e,label:ve(e)})):Z.map(e=>({value:e.slug,label:e.name}));return x?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(A,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:S,onChange:e=>H(e.target.value),onKeyDown:e=>{e.key==="Enter"&&E()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>Re(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(L,{onClick:E,className:a.searchBtn,children:"Search"}),c&&t("button",{onClick:()=>Pe(!Q),className:`${a.filterToggleBtn} ${Q?a.active:""}`,children:[t(A,{name:"filter"})," Filters"]}),ie&&t("select",{value:_,onChange:e=>{J(e.target.value),h(1),v(f({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${Q?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:R,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:b,onChange:e=>be(e.currentTarget.value),children:He.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(ge,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:B,onChange:e=>ye(e.currentTarget.value),children:Xe.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:k,onChange:e=>Ne(e.currentTarget.value),children:ke.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(L,{onClick:E,className:a.searchBtn,children:"Apply Filters"})})]}),!c&&!!G&&(w||p||N)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${z.tightGrid}`,children:[p&&t("div",{className:`${a.filterItem} ${z.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:ne,onChange:e=>{Ce(e.target.value),h(1),v(f({remoteOrder:e.target.value,page:1}))},children:(y.length>0?y:["recent"]).map(e=>t("option",{value:e,children:Ze[e]||e},e))})]}),w&&t("div",{className:`${a.filterItem} ${z.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:g,onChange:e=>{p?(D(e.target.value),h(1),v(f({genre:e.target.value,page:1}))):_e(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),De.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),N&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:K,onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key==="Enter"&&E()},className:a.searchInput})]})]}),g&&w&&!p&&t("p",{className:a.pageSubtitle,children:["Browsing the ",ve(g)," genre — search text is ignored while a genre is selected."]}),(p||N)&&t("div",{className:a.filterActions,children:t(L,{onClick:E,className:a.searchBtn,children:"Apply Filters"})})]})]}),Le&&t(Ue,{message:Te?.message||"Search failed"}),Oe?t(xe,{count:le}):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(ge,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[C?.total??F.length," result",(C?.total??F.length)===1?"":"s"]}),t("div",{className:a.pagination,children:[t("button",{className:a.pageBtn,disabled:d<=1,onClick:()=>M(d-1),children:[t(A,{name:"chevron-left"})," ",t("span",{children:"Prev"})]}),t("span",{className:a.pageInfo,children:["Page ",t("strong",{children:d})]}),t("button",{className:a.pageBtn,disabled:!oe,onClick:()=>M(d+1),children:[t("span",{children:"Next"})," ",t(A,{name:"chevron-right"})]})]})]}),t("div",{className:a.resultsGrid,children:F.map(e=>t("div",{onClickCapture:r=>Be(r,e),children:t(qe,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:[t("button",{className:a.pageBtn,disabled:d<=1,onClick:()=>M(d-1),children:[t(A,{name:"chevron-left"})," ",t("span",{children:"Prev"})]}),t("span",{className:a.pageInfo,children:["Page ",t("strong",{children:d})]}),t("button",{className:a.pageBtn,disabled:!oe,onClick:()=>M(d+1),children:[t("span",{children:"Next"})," ",t(A,{name:"chevron-right"})]})]})})]})]}):t(Ke,{isOpen:!0,onClose:()=>m("/"),onGrant:fe})}export{vt as default};
@@ -1,56 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-KrFECely.js","assets/vendor-core-8R2fFbyN.js","assets/vendor-icons-CDMuNDeL.js","assets/OptionListMenu-JQ_--ggT.js","assets/AvSyncCalibrator-Bs4iejCG.js","assets/index-CfvzoNYQ.js","assets/vendor-query-BXRECSI6.js","assets/index-CUm1meqr.css","assets/AvSyncCalibrator-C1_iBSyL.css","assets/PlayerSettings-Bj6SsmQ2.css"])))=>i.map(i=>d[i]);
2
- import{g as Dt,h as x,u as r,P as Br,z as Ir,d as q,A as f,q as O,y as Lr,T as ct,n as $r,a as Dr,c as Fr,_ as Or,S as Et}from"./vendor-core-8R2fFbyN.js";import{_ as ur,S as Nt,q as $e,z as Qe,N as Wr,j as Vr,k as Ur,l as Qr,m as qr,d as zr,M as Ae,B as Ze,O as Gr,f as Hr}from"./index-CfvzoNYQ.js";import{u as dr,b as ar,a as Gt}from"./vendor-query-BXRECSI6.js";import{C as Kr,S as jr,U as Yr,a as Jr,p as Ht,s as Xr,l as Zr,u as en,b as tn,c as rn,i as nn,d as ir,f as lr,e as sn,g as on,h as an,r as ln,j as Ue,E as cn,k as un,m as u,n as dn,A as pn,P as mn,o as hn,q as fn}from"./AvSyncCalibrator-Bs4iejCG.js";import{I as W}from"./vendor-icons-CDMuNDeL.js";import{l as vn}from"./hls-Cbou9Eb-.js";import{u as gn}from"./useMatureConsent-CT7-KfzG.js";import{u as bn}from"./useIsMobile-Dm_b6Ob3.js";import{s as et,Q as yn}from"./QueueRail-Cgljhm64.js";import{u as Sn,Q as En}from"./QueueOptionsButton-BKNDfpCl.js";import{u as pr}from"./useProviders-jxh6fvMH.js";import{A as wn}from"./AnimeMetaDetails-BPvv5xIl.js";import{S as kn}from"./SynopsisText-BcpwT5iw.js";import"./vendor-ui-CUDCvRS_.js";const Tn={soft:"Softsub",hard:"Hardsub",mixed:"Mixed"},Cn={direct:"Direct",embed:"Embed",cookie:"Needs cookie"},Mn=["direct","cookie","embed"],Rn="_controlsOverlay_1b7ea_1",_n="_hidden_1b7ea_21",Nn="_topControls_1b7ea_27",xn="_backBtn_1b7ea_47",Pn="_videoTitleInfo_1b7ea_67",An="_animeTitle_1b7ea_73",Bn="_episodeNumber_1b7ea_81",In="_bottomControls_1b7ea_89",Ln="_progressBarContainer_1b7ea_108",$n="_progressBar_1b7ea_108",Dn="_thumb_1b7ea_127",Fn="_scrubbing_1b7ea_142",On="_watchedBar_1b7ea_146",Wn="_bufferedBar_1b7ea_147",Vn="_timeBubble_1b7ea_185",Un="_skipSegment_1b7ea_219",Qn="_op_1b7ea_229",qn="_ed_1b7ea_232",zn="_recap_1b7ea_235",Gn="_bottomControlsRow_1b7ea_239",Hn="_leftControls_1b7ea_247",Kn="_rightControls_1b7ea_248",jn="_controlBtn_1b7ea_255",Yn="_theaterBtn_1b7ea_296",Jn="_nextEpisodeBtn_1b7ea_300",Xn="_active_1b7ea_317",Zn="_timeDisplay_1b7ea_321",es="_skipControls_1b7ea_329",ts="_skipBtn_1b7ea_335",rs="_volumeContainer_1b7ea_376",ns="_volumeSlider_1b7ea_382",ss="_playerPageLayout_1b7ea_440",os="_videoPlayerWrapper_1b7ea_444",as="_playerInfoContainer_1b7ea_449",is="_visible_1b7ea_566",ls="_shortcuts_1b7ea_584",E={controlsOverlay:Rn,hidden:_n,topControls:Nn,backBtn:xn,videoTitleInfo:Pn,animeTitle:An,episodeNumber:Bn,bottomControls:In,progressBarContainer:Ln,progressBar:$n,thumb:Dn,scrubbing:Fn,watchedBar:On,bufferedBar:Wn,timeBubble:Vn,skipSegment:Un,op:Qn,ed:qn,recap:zn,bottomControlsRow:Gn,leftControls:Hn,rightControls:Kn,controlBtn:jn,theaterBtn:Yn,nextEpisodeBtn:Jn,active:Xn,timeDisplay:Zn,skipControls:es,skipBtn:ts,volumeContainer:rs,volumeSlider:ns,playerPageLayout:ss,videoPlayerWrapper:os,playerInfoContainer:as,visible:is,shortcuts:ls},cs=Ir(()=>ur(()=>import("./PlayerSettings-KrFECely.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),us=({player:n,isAutoplayEnabled:v,onAutoplayChange:w,showNextEpisodeButton:K,onNextEpisode:b,videoSources:C,selectedSource:S,selectedLink:P,onSourceChange:R,skipIntervals:ie,animeTitle:ye,episodeNumber:e,isTheaterMode:g,onTheaterModeToggle:V,anime4kEnabled:U,onAnime4kToggle:le,anime4kSupported:z,anime4kProfile:ve,onAnime4kProfileChange:A,anime4kInitializing:$,anime4kError:De,videoDelayEnabled:qe,onVideoDelayToggle:a,videoDelayMs:m,onVideoDelayChange:k,onCalibrateAvSync:Se,fallbackChoice:Fe,onFallbackChoiceChange:Be,children:Ie,overlays:ze,isInteractingExtra:ee=!1,className:Re,hideChrome:l=!1})=>{const{state:o,refs:d,actions:p}=n,{showSettings:B}=o,{setShowSettings:Q,setShowVolumeSlider:j}=p,te=Dt.useRef(null),Ee=Dt.useRef(null);x(()=>{const h=_=>{te.current&&!te.current.contains(_.target)&&Ee.current&&!Ee.current.contains(_.target)&&B&&Q(!1)};return B&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[B,Q]);const we=Dt.useRef(null),Ge=h=>{d.videoRef.current&&(d.videoRef.current.volume=h,d.videoRef.current.muted=h===0,localStorage.setItem("playerVolume",h.toString()))},He=h=>{!d.videoRef.current||isNaN(o.duration)||o.duration===0||(d.videoRef.current.currentTime=h*o.duration,p.sendProgressUpdate(!1,!0))},tt=()=>{d.videoRef.current&&(p.setIsScrubbing(!0),p.wasPlayingBeforeScrub.current=!d.videoRef.current.paused,d.videoRef.current.pause())},G=h=>{!d.videoRef.current||!o.duration||(d.videoRef.current.currentTime=h*o.duration)},Ke=()=>{p.setIsScrubbing(!1),p.wasPlayingBeforeScrub.current&&d.videoRef.current?.play()},ut=h=>{if(!d.videoRef.current)return;p.setActiveSubtitleTrack(h);try{if(h===null||h==="off")localStorage.setItem("playerSubtitlesEnabled","false");else{localStorage.setItem("playerSubtitlesEnabled","true");const I=o.availableSubtitles.find(Y=>Y.label===h||Y.lang===h);I?localStorage.setItem("playerLastSubtitle",Xr(I)):localStorage.setItem("playerLastSubtitle",h)}}catch{}let _=!1;Array.from(d.videoRef.current.textTracks).forEach(I=>{const nt=h!==null&&h!=="off"&&(I.language===h||I.label===h)&&!_;I.mode=nt?"showing":"hidden",nt&&(_=!0)})},re=o.activeSubtitleTrack!==null&&o.activeSubtitleTrack!=="off",pe=()=>{if(!d.videoRef.current)return;if(re){ut("off");return}if(o.availableSubtitles.length===0)return;let h=null;try{h=localStorage.getItem("playerLastSubtitle")}catch{}const _=Ht(o.availableSubtitles,{lastKey:h,enabled:!0});if(_<0)return;const I=o.availableSubtitles[_];ut(I.label||I.lang)},je=()=>o.isMuted||o.volume===0?r(W,{name:"volume-mute"}):o.volume<.5?r(W,{name:"volume-down"}):r(W,{name:"volume-up"}),rt=r("div",{className:`${E.controlsOverlay} ${!o.showControls&&!B&&!o.isScrubbing?E.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:E.topControls,onClick:h=>h.stopPropagation(),children:[r("button",{className:E.backBtn,onClick:h=>{h.stopPropagation(),window.history.back()},title:"Back","aria-label":"Back",children:r(W,{name:"chevron-left"})}),r("div",{className:E.videoTitleInfo,children:[r("span",{className:E.animeTitle,children:ye}),e&&r("span",{className:E.episodeNumber,children:["Episode ",e]})]})]})}),ht=r(Kr,{isPlaying:o.isPlaying,onTogglePlay:p.togglePlay,onSkipBack:()=>p.seek(-10),onSkipForward:()=>p.seek(10)}),ne=r("div",{className:`${E.controlsOverlay} ${!o.showControls&&!B&&!o.isScrubbing?E.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:r("div",{className:E.bottomControls,"data-speed-boost-ignore":"true",onClick:h=>h.stopPropagation(),children:[r(jr,{classes:{container:E.progressBarContainer,scrubbing:E.scrubbing,timeBubble:E.timeBubble,bar:E.progressBar,buffered:E.bufferedBar,watched:E.watchedBar,thumb:E.thumb},videoRef:d.videoRef,duration:o.duration,formatTime:p.formatTime,isScrubbing:o.isScrubbing,onSeek:He,onScrubStart:tt,onScrubMove:G,onScrubEnd:Ke,timeLabelRef:we,children:[o.duration>0&&n.state.currentSkipInterval&&r("div",{className:`${E.skipSegment} ${E[n.state.currentSkipInterval.skip_type]} `,style:{left:`${n.state.currentSkipInterval.start_time/o.duration*100}% `,width:`${(n.state.currentSkipInterval.end_time-n.state.currentSkipInterval.start_time)/o.duration*100}% `}}),ie.map(h=>{const _=h.start_time/o.duration*100,I=(h.end_time-h.start_time)/o.duration*100;return r("div",{className:`${E.skipSegment} ${E[h.skip_type]} `,style:{left:`${_}% `,width:`${I}% `},title:h.skip_type.toUpperCase()},h.skip_id)})]}),r("div",{className:E.bottomControlsRow,children:[r("div",{className:E.leftControls,children:[r("button",{className:E.controlBtn,onClick:p.togglePlay,"aria-label":o.isPlaying?"Pause":"Play",children:o.isPlaying?r(W,{name:"pause"}):r(W,{name:"play"})}),r(Yr,{muted:o.isMuted,volume:o.volume,volumeIcon:je(),buttonClassName:E.controlBtn,onToggleMute:p.toggleMute,onVolumeChange:Ge,onExpandedChange:h=>j(h)}),r("span",{className:E.timeDisplay,ref:we,children:[p.formatTime(0)," / ",p.formatTime(o.duration)]}),o.currentSkipInterval&&!o.isAutoSkipEnabled&&r("button",{className:E.controlBtn,onClick:()=>{d.videoRef.current&&o.currentSkipInterval&&(d.videoRef.current.currentTime=o.currentSkipInterval.end_time,p.setCurrentSkipInterval(null))},children:["Skip ",o.currentSkipInterval.skip_type==="op"?"Opening":"Ending"]})]}),r("div",{className:E.rightControls,children:[r("div",{className:E.skipControls,children:K&&r("button",{className:E.nextEpisodeBtn,onClick:b,title:"Play next episode",children:"Next EP"})}),r("button",{className:`${E.controlBtn} ${re?E.active:""}`,onClick:pe,title:re?"Disable Subtitles":"Enable Subtitles","aria-label":"Toggle Subtitles",children:r(W,{name:"closed-captioning",size:22})}),r("button",{ref:Ee,className:`${E.controlBtn} ${B?E.active:""} `,onClick:()=>Q(!B),"aria-label":"Settings",children:r(W,{name:"cog"})}),r("button",{className:`${E.controlBtn} ${E.theaterBtn} ${g?E.active:""} `,onClick:h=>{h.stopPropagation(),V()},title:g?"Exit Theater Mode":"Theater Mode","aria-label":g?"Exit Theater Mode":"Theater Mode",children:r(W,{name:"tv"})}),r("button",{className:E.controlBtn,onClick:p.toggleFullscreen,"aria-label":o.isFullscreen?"Exit Fullscreen":"Fullscreen",children:o.isFullscreen?r(W,{name:"compress"}):r(W,{name:"expand"})})]})]})]})}),Ye=r(Br,{fallback:null,children:r(cs,{ref:te,isOpen:B,onClose:()=>Q(!1),videoSources:C,currentSource:S,currentLink:P,onSourceChange:R,subtitles:o.availableSubtitles,activeSubtitleTrack:o.activeSubtitleTrack,onSubtitleChange:ut,subtitleSettings:{fontSize:o.subtitleFontSize,position:o.subtitlePosition,bgOpacity:o.subtitleBgOpacity,bgColor:o.subtitleBgColor,textColor:o.subtitleTextColor,edge:o.subtitleEdge,bold:o.subtitleBold},onSubtitleSettingsChange:(h,_)=>{const I=(Y,nt)=>{try{localStorage.setItem(Y,String(nt))}catch{}};switch(h){case"fontSize":p.setSubtitleFontSize(_),I("subtitleFontSize",_);break;case"position":p.setSubtitlePosition(_),I("subtitlePosition",_);break;case"bgOpacity":p.setSubtitleBgOpacity(_),I("subtitleBgOpacity",_);break;case"bgColor":p.setSubtitleBgColor(_),I("subtitleBgColor",_);break;case"textColor":p.setSubtitleTextColor(_),I("subtitleTextColor",_);break;case"edge":p.setSubtitleEdge(_),I("subtitleEdge",_);break;case"bold":p.setSubtitleBold(_),I("subtitleBold",_);break}},useNativeControls:o.useNativeControls,onNativeControlsToggle:p.setUseNativeControls,anime4kEnabled:U,onAnime4kToggle:le,anime4kSupported:z,anime4kProfile:ve,onAnime4kProfileChange:A,anime4kInitializing:$,anime4kError:De,videoDelayEnabled:qe,onVideoDelayToggle:a,videoDelayMs:m,onVideoDelayChange:k,onCalibrateAvSync:Se,isAutoSkipEnabled:o.isAutoSkipEnabled,onAutoSkipChange:h=>{p.setIsAutoSkipEnabled(h);try{localStorage.setItem("autoSkipEnabled",h.toString())}catch{}},isAutoplayEnabled:v,onAutoplayChange:w,fallbackChoice:Fe,onFallbackChoiceChange:Be})});return r(Jr,{player:n,topBar:rt,centerControls:ht,bottomBar:ne,settingsPanel:Ye,overlays:ze,isInteracting:ee,className:Re,chromeDisabled:l,children:Ie})},ds=({count:n=3})=>r("section",{className:et.section,children:[r("div",{className:et.header,children:r("button",{className:et.headerToggle,disabled:!0,children:[r("span",{className:et.title,children:r(Nt,{width:"60px",height:"1.2rem",variant:"text"})}),r(W,{name:"chevron-down",style:{opacity:.3}})]})}),r("div",{className:et.list,children:Array.from({length:n}).map((v,w)=>r("div",{className:et.item,style:{pointerEvents:"none"},children:[r("div",{className:et.dragHandle,style:{opacity:.2},children:r(Nt,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:et.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(Nt,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:et.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)"}})]})]},w))})]}),ps="_sourceSelectionContainer_c5tub_76",ms="_providerSelectContainer_c5tub_89",hs="_providerSelect_c5tub_89",fs="_sourceSelect_c5tub_76",vs="_sourceButtons_c5tub_145",gs="_sourceButton_c5tub_145",bs="_active_c5tub_170",mt={sourceSelectionContainer:ps,providerSelectContainer:ms,providerSelect:hs,sourceSelect:fs,sourceButtons:vs,sourceButton:gs,active:bs},ys=({selectedProvider:n,onProviderChange:v,isAdult:w,options:K})=>{const b=K&&K.length>0?K:[],C=w===void 0?b:b.filter(S=>S.mature===w);return r("div",{className:mt.providerSelectContainer,children:[r("h4",{children:"Provider"}),r("select",{className:mt.providerSelect,value:n,onChange:S=>v(S.target.value),children:Mn.map(S=>{const P=C.filter(R=>(R.tier??"direct")===S);return P.length===0?null:r("optgroup",{label:Cn[S],children:P.map(R=>r("option",{value:R.value,children:R.sub?`${R.label} (${Tn[R.sub]})`:R.label},R.value))},S)})})]})},Ss=({videoSources:n,selectedSource:v,selectedLink:w,onSourceChange:K,onLinkChange:b})=>{const C=Array.isArray(n)?n:[];if(C.length===0)return null;const S=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:C.map((P,R)=>r("button",{className:`${mt.sourceButton} ${v?.sourceName===P.sourceName?mt.active:""} `,onClick:()=>K(P),children:P.sourceName},`${P.sourceName}-${R}`))}),S&&r("select",{className:mt.sourceSelect,"aria-label":"Fallback embed quality",value:w?.link??v.links[0]?.link??"",onChange:P=>{const R=v.links.find(ie=>ie.link===P.target.value);R&&b(R)},children:v.links.map(P=>r("option",{value:P.link,children:P.resolutionStr},P.link))})]})},Es=Dt.memo(Ss,(n,v)=>n.selectedSource?.sourceName===v.selectedSource?.sourceName&&n.selectedLink?.link===v.selectedLink?.link&&n.videoSources===v.videoSources),ws={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}},ks={low:"ModeB",balanced:"ModeA",high:"ModeAA",denoise:"ModeC"},Ts=5,Cs=15e3,Ms=`
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 Rs({videoRef:n,canvasRef:v,profile:w="balanced",delayMs:K=0}){const[b,C]=q(!1),[S,P]=q(!1),[R,ie]=q(!1),[ye,e]=q(null),[g,V]=q(0),U=f(0),le=f(null),z=f(null),ve=f(null),A=f(null),$=f(null),De=f(null),qe=f(null),a=f(null),m=f(null),k=f(!1),Se=f(-1),Fe=f(0),Be=f(K);Be.current=K;const Ie=f([]),ze=f(!1),ee=f(!1),Re=f(!1),l=f(null),o=f(-1),d=f(-1),p=f(!1),B=f(0);x(()=>{async function j(){if(typeof navigator>"u"||!navigator.gpu){C(!1);return}try{const te=await navigator.gpu.requestAdapter();C(!!te)}catch{C(!1)}}j()},[]),x(()=>{if(!S||!b)return;let j=!1;const te=++U.current,Ee=G=>{if(G)try{G.close()}catch{}},we=()=>{for(const G of Ie.current)Ee(G.bitmap);Ie.current=[]},Ge=G=>Math.max(8,Math.min(40,Math.ceil(G/16.7)+4));function He(){m.current!==null&&(cancelAnimationFrame(m.current),m.current=null)}async function tt(){let G=n.current;const Ke=v.current;if(!G||!Ke||U.current!==te)return;const ut=performance.now()+Cs;for(;(!G||G.videoWidth===0)&&performance.now()<ut;){if(await new Promise(Y=>requestAnimationFrame(Y)),j||U.current!==te)return;G=n.current}if(!G||G.videoWidth===0){!j&&U.current===te&&(e("Timed out waiting for video metadata"),ie(!1),P(!1));return}const re=G.videoWidth,pe=G.videoHeight,je=Math.max(re,pe),rt=window.innerWidth,ht=window.innerHeight,ne=Math.max(rt,ht),Ye=je<ne?ne/je:1,h=ws[w],_=je<=480?h.sd:je<=720?h.hd:je<=1080?h.fhd:1,I=Math.min(_,Ye);Ke.width=Math.round(re*I),Ke.height=Math.round(pe*I),ie(!0),e(null),Fe.current=0,Se.current=-1,k.current=!1;try{let Y=function(){j||U.current!==te||(He(),m.current=requestAnimationFrame(()=>{dt()}))};const{ModeA:nt,ModeB:wt,ModeC:st,ModeAA:ot}=await ur(async()=>{const{ModeA:L,ModeB:ce,ModeC:Ne,ModeAA:D}=await import("./index-BOKlZEHq.js").then(ue=>ue.i);return{ModeA:L,ModeB:ce,ModeC:Ne,ModeAA:D}},[]);if(!navigator.gpu)throw new Error("WebGPU not available");const kt=await navigator.gpu.requestAdapter();if(!kt)throw new Error("No GPU adapter found");const M=await kt.requestDevice();if(!M)throw new Error("Failed to get GPU device");const Oe=Ke.getContext("webgpu");if(!Oe)throw new Error("Failed to get WebGPU context");const at=navigator.gpu.getPreferredCanvasFormat();Oe.configure({device:M,format:at,alphaMode:"premultiplied"});const me=M.createTexture({size:[re,pe],format:"rgba16float",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT}),Je=ks[w],ke=Math.round(re*I),Le=Math.round(pe*I),ft=(()=>{switch(Je){case"ModeB":return new wt({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}});case"ModeC":return new st({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}});case"ModeAA":return new ot({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}});default:return new nt({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}})}})(),_e=ft.getOutputTexture(),vt=M.createSampler({magFilter:"linear",minFilter:"linear"}),gt=M.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
- `}),Xe=M.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),Tt=M.createRenderPipeline({layout:M.createPipelineLayout({bindGroupLayouts:[Xe]}),vertex:{module:gt,entryPoint:"vs"},fragment:{module:gt,entryPoint:"fs",targets:[{format:at}]},primitive:{topology:"triangle-list"}}),Ct=M.createBindGroup({layout:Xe,entries:[{binding:0,resource:_e.createView()},{binding:1,resource:vt}]});try{const L=M.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),ce=M.createShaderModule({code:Ms}),Ne=M.createRenderPipeline({layout:M.createPipelineLayout({bindGroupLayouts:[L]}),vertex:{module:ce,entryPoint:"vs"},fragment:{module:ce,entryPoint:"fs",targets:[{format:"rgba16float"}]},primitive:{topology:"triangle-list"}});l.current={pipeline:Ne,layout:L,inputView:me.createView()}}catch{l.current=null}if(U.current!==te){me.destroy(),M.destroy();return}le.current=M,z.current=Oe,ve.current=ft,A.current=me,$.current=_e,De.current=Tt,qe.current=vt,a.current=Xe,ee.current=!1,Re.current=!1;async function Ft(){const L=l.current;if(!L||ee.current)return!1;const ce=n.current;if(!ce)return!1;const Ne=!Re.current;Ne&&M.pushErrorScope("validation");try{const D=M.importExternalTexture({source:ce}),ue=M.createBindGroup({layout:L.layout,entries:[{binding:0,resource:D},{binding:1,resource:vt}]}),Te=M.createCommandEncoder(),T=Te.beginRenderPass({colorAttachments:[{view:L.inputView,loadOp:"load",storeOp:"store"}]});T.setPipeline(L.pipeline),T.setBindGroup(0,ue),T.draw(6),T.end(),M.queue.submit([Te.finish()])}catch{return ee.current=!0,l.current=null,!1}if(Ne){const D=await M.popErrorScope().catch(()=>null);if(D)return console.warn("[anime4k] blit probe failed:",D.message),ee.current=!0,l.current=null,!1;Re.current=!0}return!0}ie(!1);async function dt(){if(j||U.current!==te)return;const L=n.current;if(!L||L.videoWidth===0){Y();return}if(L!==G||L.videoWidth!==re||L.videoHeight!==pe){V(ue=>ue+1);return}if(L.paused||L.ended||document.hidden||L.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){Y();return}const ce=L.getVideoPlaybackQuality().totalVideoFrames;if(ce===d.current){Y();return}if(k.current){Y();return}const Ne=L.currentTime;(L.seeking||o.current>=0&&Math.abs(Ne-o.current)>.5)&&(we(),p.current=!1,B.current=0,d.current=-1),o.current=Ne;const D=Math.max(0,Be.current||0);D>B.current&&(p.current=!1),k.current=!0;try{const ue=performance.now();let Te=null,T=!1;if(D<=0){Ie.current.length>0&&we(),p.current=!1,B.current=0;let Ce=!1;if(!ze.current)try{M.queue.copyExternalImageToTexture({source:L},{texture:me},[re,pe]),d.current=ce,Ce=!0}catch(he){if(he instanceof TypeError)ze.current=!0;else throw he}if(!Ce&&!ee.current&&l.current&&await Ft()&&(d.current=ce,Ce=!0),!Ce){const he=await createImageBitmap(L);d.current=ce,M.queue.copyExternalImageToTexture({source:he},{texture:me},[re,pe]),Ee(he)}}else{const Ce=await createImageBitmap(L);d.current=ce;const he=Ie.current;he.push({bitmap:Ce,capture:ue});const Ot=Ge(D);for(;he.length>Ot;)Ee(he.shift()?.bitmap);let se=-1;for(let ge=he.length-1;ge>=0;ge--)if(ue-he[ge].capture>=D){se=ge;break}if(se!==-1){for(let Ve=0;Ve<se;Ve++)Ee(he.shift()?.bitmap);const ge=he.shift();ge?(Te=ge.bitmap,p.current=!0,B.current=D):(Te=Ce,T=!0)}else if(!p.current)Te=Ce,T=!0;else{const ge=he.shift();Te=ge?ge.bitmap:Ce,ge||(T=!0)}if(!Te){k.current=!1,Y();return}M.queue.copyExternalImageToTexture({source:Te},{texture:me},[re,pe]),T||Ee(Te)}const Mt=M.createCommandEncoder();await ft.pass(Mt);const We=Mt.beginRenderPass({colorAttachments:[{view:Oe.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});We.setPipeline(Tt),We.setBindGroup(0,Ct),We.draw(6),We.end(),M.queue.submit([Mt.finish()]),Se.current=ce,Fe.current=0,M.queue.onSubmittedWorkDone().then(()=>{U.current===te&&(k.current=!1)})}catch(ue){if(k.current=!1,Fe.current+=1,Fe.current>=Ts&&!j&&U.current===te){console.error(ue),e(ue instanceof Error?ue.message:"Render error"),P(!1);return}}Y()}Y()}catch(Y){!j&&U.current===te&&(e(Y instanceof Error?Y.message:"Failed to initialize upscaler"),ie(!1),P(!1))}}return tt(),()=>{j=!0,U.current+=1,He(),we(),A.current&&(A.current.destroy(),A.current=null),$.current&&($.current.destroy(),$.current=null),le.current&&(le.current.destroy(),le.current=null),ve.current=null,De.current=null,qe.current=null,a.current=null,l.current=null,z.current=null,k.current=!1}},[S,b,n,v,w,g]);const Q=O(()=>{P(j=>!j)},[]);return{isWebGPUSupported:b,isEnabled:S,isInitializing:R,error:ye,toggle:Q}}const _s=()=>localStorage.getItem("preferredMode")==="dub"?"dub":"sub",Ns=()=>{const n=localStorage.getItem("preferredProvider");return n&&/^[a-z0-9-]+$/i.test(n)?n:"megaplay"},mr=()=>({showMeta:{},episodes:[],watchedEpisodes:[],watchlistStatus:null,showCombinedDetails:!1,currentMode:_s(),inWatchlist:!1,videoSources:[],selectedSource:null,selectedLink:null,forceNativePlayer:localStorage.getItem("forceNativePlayer")==="true",isAutoplayEnabled:Zr(),showResumeModal:!0,resumeTime:0,resumeDuration:0,skipIntervals:[],selectedProvider:Ns(),loadingShowData:!0,loadingVideo:!1,loadingDetails:!1,error:null,detailsError:null,showCookieModal:!1,cookieProvider:null});mr();function xs(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};case"SET_OVERRIDE_SOURCE":return{...n,selectedSource:v.payload?.source??null,selectedLink:v.payload?.link??null};default:return n}}async function cr(n,v,w,K,b=!1){if(!n||!v)throw new Error("Missing params");try{const[C,S,P,R]=await Promise.all([$e(`/api/video?showId=${n}&episodeNumber=${v}&mode=${w.currentMode}&provider=${w.selectedProvider}`).catch(()=>null),$e(`/api/episode-progress/${n}/${v}`).catch(()=>null),$e("/api/settings?key=preferredSource").catch(()=>null),$e(`/api/skip-times/${n}/${v}`).catch(()=>[])]),ie=P?.value,ye=C?.filter(A=>{const $=A.sourceName.toLowerCase();return w.currentMode==="dub"?$.includes("eng")||$.includes("dub"):$.includes("jpn")||$.includes("sub")||!$.includes("eng")&&!$.includes("dub")})??[],e=ye.length>0?ye:C??[];let g=e.length>0?e[0]:null;if(ie){const A=e.find($=>$.sourceName===ie);A&&(g=A)}const V=g&&g.links.length>0?g.links.sort((A,$)=>(parseInt($.resolutionStr)||0)-(parseInt(A.resolutionStr)||0))[0]:null,U=S?.currentTime||0,le=S?.duration||0,ve=(Array.isArray(R)?R:R?.results||[]).map(A=>({skip_id:A.skip_id||"",skip_type:A.skip_type||"",start_time:A.interval?.start_time??A.start_time??0,end_time:A.interval?.end_time??A.end_time??0})).filter(A=>A.end_time>0);return(!C||C.length===0)&&(b||Qe.error(`No video sources found for ${w.selectedProvider}`)),{videoSources:C,selectedSource:g,selectedLink:V,resumeTime:U,resumeDuration:le,showResumeModal:U>5&&g?.type!=="iframe",skipIntervals:ve,fetchedEpisodeNumber:v}}catch(C){const S=C;if(S.message==="AUTH_REQUIRED")return K({type:"SET_STATE",payload:{showCookieModal:!0,cookieProvider:S.provider}}),{videoSources:[],selectedSource:null,selectedLink:null,resumeTime:0,resumeDuration:0,showResumeModal:!1,skipIntervals:[],fetchedEpisodeNumber:v};throw C}}const Ps=(n,v,w,K)=>{const[b,C]=Lr(xs,w,l=>({...mr(),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}}:{}})),S=dr(),P=f(null),R=f(null),{options:ie}=pr(),ye=ct(()=>ie.filter(l=>(l.kind??"anime")==="anime"),[ie]),e=v||b.initialEpisode,g=f(e);x(()=>{g.current!==e&&(g.current=e,C({type:"SET_STATE",payload:{selectedSource:null,selectedLink:null}}))},[e,C]),x(()=>{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"&&P.current!==n&&(P.current=n,C({type:"SET_PROVIDER",payload:"animepahe"}))},[n,b.selectedProvider]);const{data:V,isLoading:U,error:le}=Sn(n),{data:z}=ar({queryKey:["player-data",n,b.currentMode,b.selectedProvider],queryFn:async()=>{if(!n)throw new Error("No showId");const l=async()=>{try{const Q=await $e(`/api/episodes?showId=${n}&mode=${b.currentMode}&provider=${b.selectedProvider}`);if(Q?.episodes?.length)return Q}catch{}return null},[o,d,p]=await Promise.all([l(),$e(`/api/watchlist/check/${n}`).catch(()=>({inWatchlist:!1})),$e(`/api/watched-episodes/${n}`).catch(()=>[])]),B=o?.episodes?o.episodes.sort((Q,j)=>parseFloat(Q)-parseFloat(j)):[];return{description:o?.description||"",episodes:B,inWatchlist:d.inWatchlist,watchlistStatus:d.status??null,watchedEpisodes:p}},enabled:!!n});x(()=>{!v&&z?.episodes&&z.episodes.length>0&&!v&&C({type:"SET_STATE",payload:{initialEpisode:z.episodes[0]}})},[z,v]),x(()=>{if(V?.isAdult===void 0)return;const o=new Set(ye.filter(d=>d.mature).map(d=>d.value)).has(b.selectedProvider);if(R.current!==n){if(V.isAdult&&!o){R.current=n;const d=ye.find(p=>p.mature);if(!d)return;C({type:"SET_PROVIDER",payload:d.value}),localStorage.setItem("preferredProvider",d.value)}if(!V.isAdult&&o){R.current=n;const d=ye.find(p=>!p.mature);if(!d)return;C({type:"SET_PROVIDER",payload:d.value}),localStorage.setItem("preferredProvider",d.value)}}},[V?.isAdult,b.selectedProvider,n,ye]),x(()=>{if(!n||!/^dango-mt-\d+$/.test(n)||R.current===`temp:${n}`)return;const l=V?.provider;l&&(R.current=`temp:${n}`,l!==b.selectedProvider&&C({type:"SET_PROVIDER",payload:l}))},[n,V,b.selectedProvider]);const{data:ve,isLoading:A,error:$}=ar({queryKey:["video-sources",n,e,b.selectedProvider,b.currentMode],queryFn:()=>cr(n,e,b,C),enabled:!!n&&!!e&&!(b.showMeta?.isAdult===!0&&!K?.hasMatureConsent)}),De=!1,{mutateAsync:qe}=Gt({mutationFn:async({wasIn:l,showMeta:o})=>{const d=l?"/api/watchlist/remove":"/api/watchlist/add",p={id:n,name:o.name||o.names?.romaji,thumbnail:o.thumbnail,nativeName:o.names?.native,englishName:o.names?.english,type:o.type,isAdult:o.isAdult},B=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!B.ok){const Q=await B.json().catch(()=>null);throw new Error(Q?.error||"Failed to update watchlist")}return!l},onSuccess:l=>{Qe.success(l?"Added to watchlist":"Removed from watchlist"),S.invalidateQueries({queryKey:["player-data",n]}),S.invalidateQueries({queryKey:["show-data",n]}),S.invalidateQueries({queryKey:["watchlist"]})},onError:l=>Qe.error(l instanceof Error?l.message:"Failed to update watchlist")}),a=O(async()=>{!n||!V||await qe({wasIn:!!z?.inWatchlist,showMeta:V})},[n,V,z?.inWatchlist,qe]),m=O(async l=>{try{await $e("/api/settings",{method:"POST",body:JSON.stringify({key:"preferredSource",value:l})})}catch(o){console.error(o)}},[]),{mutateAsync:k,isPending:Se}=Gt({mutationFn:async({status:l})=>{if(!n)throw new Error("Missing showId");return await $e("/api/watchlist/status",{method:"POST",body:JSON.stringify({id:n,status:l})}),l},onSuccess:l=>{C({type:"SET_STATE",payload:{inWatchlist:!0,watchlistStatus:l}}),Qe.success(`Moved to ${l}`),S.invalidateQueries({queryKey:["show-data",n]}),S.invalidateQueries({queryKey:["watchlist"]}),S.invalidateQueries({queryKey:["allContinueWatching"]})},onError:()=>Qe.error("Failed to update watchlist status")}),Fe=O(async()=>{await k({status:"Completed"})},[k]),{mutateAsync:Be}=Gt({mutationFn:async({episodeNumber:l,duration:o,showMeta:d,episodes:p})=>{await $e("/api/update-progress",{method:"POST",body:JSON.stringify({showId:n,episodeNumber:l,currentTime:o,duration:o,showName:d.name,showThumbnail:d.thumbnail,nativeName:d.names?.native,englishName:d.names?.english,genres:d.genres?.map(B=>B.name),popularityScore:Wr(d.score??d.stats?.averageScore),type:d.type,status:d.status,episodeCount:p.length,isAdult:d.isAdult}),keepalive:!0})},onSuccess:(l,o)=>{Qe.success(`Episode ${o.episodeNumber} marked as watched`),S.invalidateQueries({queryKey:["player-data",n]}),S.invalidateQueries({queryKey:["show-meta",n]}),S.invalidateQueries({queryKey:["video-sources",n,o.episodeNumber]}),S.invalidateQueries({queryKey:["allContinueWatching"]}),S.invalidateQueries({queryKey:["thisWeekSchedule"]})},onError:()=>Qe.error("Failed to mark episode as watched")}),Ie=O(async(l,o)=>{!n||!V||await Be({episodeNumber:l,duration:o,showMeta:V,episodes:z?.episodes||[]})},[n,V,z?.episodes,Be]),ze=O(async()=>{C({type:"SET_STATE",payload:{showCombinedDetails:!b.showCombinedDetails}})},[b.showCombinedDetails]),ee=ct(()=>{const l=le||$,o=l?l.message:null,d=o==="AUTH_REQUIRED"?null:o,p=ve&&ve.fetchedEpisodeNumber===e?ve:null,B=!!ve&&!p;return{...b,currentEpisode:e,showMeta:{...b.showMeta||{},...V||{}},episodes:z?.episodes||[],watchedEpisodes:z?.watchedEpisodes||[],inWatchlist:!!z?.inWatchlist,watchlistStatus:z?.watchlistStatus??b.watchlistStatus??null,videoSources:p?.videoSources||[],selectedSource:b.selectedSource||p?.selectedSource||null,selectedLink:b.selectedLink||p?.selectedLink||null,resumeTime:p?.resumeTime||0,resumeDuration:p?.resumeDuration||0,showResumeModal:b.showResumeModal&&(p?.showResumeModal??!1),skipIntervals:p?.skipIntervals||[],loadingShowData:U,loadingVideo:A||B,loadingDetails:De,error:d,fetchedEpisodeNumber:p?.fetchedEpisodeNumber}},[b,V,z,ve,U,A,De,le,$,e]),Re=O((l,o)=>{const d=o||n;if(!d||!l||d===n&&l===e)return;const B=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(d)&&b.selectedProvider!=="animepahe"?"animepahe":b.selectedProvider,Q=["video-sources",d,l,B,b.currentMode];S.getQueryState(Q)?.status!=="success"&&S.prefetchQuery({queryKey:Q,queryFn:()=>cr(d,l,{selectedProvider:B,currentMode:b.currentMode},C,!0),staleTime:300*1e3,gcTime:1800*1e3})},[n,e,S,b,C]);return{state:ee,dispatch:C,toggleWatchlist:a,moveToCompleted:Fe,setPreferredSource:m,handleToggleDetails:ze,markEpisodeWatched:Ie,prefetchEpisodeSources:Re,isMarkingWatched:Be.isPending,isUpdatingWatchlistStatus:Se}},Kt="fallbackChoice";function As(){try{const n=localStorage.getItem(Kt);return n==="iframe"||n==="retry"?n:null}catch{return null}}function Bs(n){try{n===null?localStorage.removeItem(Kt):localStorage.setItem(Kt,n)}catch{}}const Xs=()=>{const{id:n,episodeNumber:v}=$r(),w=Dr(),K=dr(),b=Fr(),{hasConsent:C,grant:S}=gn(),{options:P}=pr(),R=ct(()=>P.filter(t=>(t.kind??"anime")==="anime"),[P]),ie=ct(()=>R.map(t=>t.value),[R]),ye=ct(()=>new Set(R.filter(t=>t.mature).map(t=>t.value)),[R]),{state:e,dispatch:g,toggleWatchlist:V,moveToCompleted:U,setPreferredSource:le,handleToggleDetails:z,markEpisodeWatched:ve,prefetchEpisodeSources:A,isMarkingWatched:$,isUpdatingWatchlistStatus:De}=Ps(n,v,b.state||null,{hasMatureConsent:C});x(()=>{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}`;w(t,{replace:!0})}},[n,e.showMeta?.id,v,w]);const qe=ct(()=>{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]),a=en({skipIntervals:e.skipIntervals,showId:n,episodeNumber:e.currentEpisode?.toString(),episodeCount:e.episodes.length||void 0,sourceType:e.selectedSource?.type,showMeta:qe}),{refs:m,actions:k}=a,Se=f(null),Fe=bn(),Be=f(null),Ie=f(null),ze=f(null),ee=f(0),Re=f(e.resumeTime),l=f(e.showResumeModal),[o,d]=q(()=>{try{const t=localStorage.getItem("anime4kProfile");return["low","balanced","high","denoise"].includes(t)?t:"balanced"}catch{return"balanced"}}),[p,B]=q(()=>{try{const t=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(t)&&t>=0&&t<=500)return Math.round(t)}catch{}return 180}),[Q,j]=q(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[te,Ee]=q(!1),[we,Ge]=q(!1),He=f(null),tt=f(null),G=(t,s)=>{try{localStorage.setItem("playerVideoDelayMs",String(t)),localStorage.setItem("playerVideoDelayEnabled",String(s))}catch{}},Ke=t=>{const s=Math.max(0,Math.min(500,Math.round(t)));B(s);try{localStorage.setItem("playerVideoDelayMs",String(s))}catch{}},ut=()=>{He.current={enabled:Q,ms:p},j(!0);try{localStorage.setItem("playerVideoDelayEnabled","true")}catch{}k.setShowSettings(!1),Ee(!0)},re=()=>{const t=He.current;He.current=null,t&&(B(t.ms),j(t.enabled),G(t.ms,t.enabled)),Ge(!1),Ee(!1)},pe=()=>{He.current=null,j(!0),G(p,!0),Ge(!1),Ee(!1)},je=()=>{if(we){Ge(!1);return}const t=m.videoRef.current;t&&!isNaN(t.currentTime)&&(tt.current=t.currentTime),Ge(!0)},rt=Q?p:0,ht=f(null),ne=Rs({videoRef:m.videoRef,canvasRef:Ie,profile:o,delayMs:rt}),Ye=ne.isEnabled&&ne.isWebGPUSupported;tn({videoRef:m.videoRef,canvasRef:ht,delayMs:rt,enabled:Q&&!Ye});const h=Q&&!Ye,_=Ye||h;x(()=>{Re.current=e.resumeTime,l.current=e.showResumeModal},[e.resumeTime,e.showResumeModal]);const[I,Y]=q(null),[nt,wt]=q(!1),[st,ot]=q(!1),[kt,M]=q(!1),Oe=f(!1),[at,me]=q(null),Je=f(!1),ke=f([]),Le=f(!1),[ft,_e]=q(null),[vt,gt]=q(!1),[Xe,Tt]=q(!1),[Ct,Ft]=q(()=>As()??"ask"),dt=O(t=>{Ft(t),Bs(t==="ask"?null:t)},[]),L=f(Ct);L.current=Ct;const ce=f(e.videoSources);ce.current=e.videoSources;const Ne=f(()=>{}),[D,ue]=q(null),Te=f(v);x(()=>{Te.current!==v&&(Te.current=v,ue(null),me(null),Oe.current=!1,Ge(!1),Ee(!1))},[v]),x(()=>{Je.current=!1,ke.current=[],Le.current=!1,_e(null),gt(!1)},[n,e.currentEpisode]),x(()=>{st||(Oe.current=!1)},[st]);const{data:T=[],isLoading:Mt}=Vr(),We=Ur(),Ce=f(We);Ce.current=We;const he=Qr(),Ot=qr(),[se,ge]=q(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});rn(a,!!e.selectedLink&&!se),x(()=>{try{se?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(t){console.error(t)}return()=>{try{document.body.classList.remove("theater-mode")}catch(t){console.error(t)}}},[se]),Or(()=>{if(a.state.isFullscreen||se)return;const t=m.playerContainerRef.current,s=Be.current;if(!t||!s)return;const i=()=>{const N=t.getBoundingClientRect().height;s.style.height=`${N}px`};i();const c=new ResizeObserver(i);return c.observe(t),()=>c.disconnect()},[a.state.isFullscreen,se,m.playerContainerRef]);const Ve=ct(()=>e.episodes.findIndex(t=>t===e.currentEpisode),[e.episodes,e.currentEpisode]),Wt=Ve>0?e.episodes[Ve-1]:null,xe=Ve>=0&&Ve<e.episodes.length-1?e.episodes[Ve+1]:null,Vt=Ve>-1&&Ve<e.episodes.length-1,hr=e.episodes.length>0&&!!e.currentEpisode&&e.episodes[e.episodes.length-1]===e.currentEpisode,fr=String(e.showMeta.status||"").trim().toLowerCase(),vr=["finished","completed","complete","ended"].some(t=>fr.includes(t)),Ut=nn(e.resumeTime,e.resumeDuration)||st,it=hr&&vr&&Ut,jt=e.showResumeModal&&(it||!Ut),xt=Ut&&!it&&T.length===0&&!D&&(e.showResumeModal||st),bt=jt||xt;x(()=>{const t=m.videoRef.current;if(!t)return;let s=!1;for(Se.current&&(Se.current.destroy(),Se.current=null),(e.loadingVideo||e.selectedSource)&&(t.pause(),t.removeAttribute("src"),t.load());t.firstChild;)t.removeChild(t.firstChild);if(we)return t.src="/av-sync-test.mp4",t.play().catch(()=>{k.setShowControls(!0)}),()=>{s=!0};if(!e.selectedSource||!e.selectedLink)return;if(e.selectedSource.type==="iframe"){ee.current=0;return}tt.current!=null?(ee.current=tt.current,tt.current=null):Re.current>5&&!l.current?ee.current=Re.current:l.current&&(ee.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 fe=localStorage.getItem("playerSubtitlesEnabled")!=="false";let Me=null;try{Me=localStorage.getItem("playerLastSubtitle")}catch{}const J=Ht(e.selectedSource.subtitles,{lastKey:Me,enabled:fe}),Pe=J>=0?e.selectedSource.subtitles[J]:null;e.selectedSource.subtitles.forEach(be=>{const X=document.createElement("track");X.kind="subtitles",X.label=be.label,X.srclang=be.lang;const y=be.src??be.url;if(y){let Z=`/api/subtitle-proxy?url=${encodeURIComponent(y)}`;const ae=e.selectedLink?.headers?.Referer,yt=y.includes("anilight.live")?"https://anilight.live/":"",$t=ae||yt;$t&&(Z+=`&referer=${encodeURIComponent($t)}`),X.src=Z}Pe&&be.label===Pe.label&&be.lang===Pe.lang&&(X.default=!0),t.appendChild(X)}),fe||k.setActiveSubtitleTrack("off"),k.setAvailableSubtitles(e.selectedSource.subtitles)}const c=ee.current;ee.current=0;const N=()=>{c>0&&(t.currentTime=c)};t.addEventListener("loadedmetadata",N,{once:!0});const de=!(l.current&&Re.current>5),H=()=>{de&&t.play().catch(()=>{k.setShowControls(!0)})};e.selectedLink.hls?(async()=>{const fe=await vn();if(s)return;if(!fe||!fe.isSupported()){t.src=i,H();return}const Me=document.body.classList.contains("low-end"),J=new fe({maxBufferLength:Me?15:30,maxMaxBufferLength:Me?30:60,maxBufferSize:Me?25*1e3*1e3:60*1e3*1e3,startLevel:-1,enableWorker:!0});Se.current=J,J.on(fe.Events.ERROR,(X,y)=>{y.fatal&&!Je.current&&Ne.current()});const Pe=(e.selectedSource?.subtitles?.length??0)>0,be=()=>{try{Pe&&typeof J.subtitleTrack=="number"&&J.subtitleTrack!==-1&&(J.subtitleTrack=-1)}catch{}};J.on(fe.Events.SUBTITLE_TRACK_SWITCH,(X,y)=>{y?.id!==-1&&be()}),be(),J.loadSource(i),J.attachMedia(t),J.once(fe.Events.MANIFEST_PARSED,()=>{s||H()})})():(t.src=i,H());const F=localStorage.getItem("playerVolume"),oe=localStorage.getItem("playerMuted");return F!==null&&(t.volume=parseFloat(F)),oe!==null&&(t.muted=oe==="true"),()=>{s=!0,t.removeEventListener("loadedmetadata",N),Se.current&&(Se.current.destroy(),Se.current=null)}},[e.selectedSource,e.selectedLink,m.videoRef,k,e.loadingVideo,we]);const Pt=O(t=>{if(Je.current)return;Je.current=!0;const s=t.links[0];le(t.sourceName),g({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s}}),_e(null)},[g,le]),At=O(()=>{const s=ce.current.find(i=>i.type==="iframe");return s?.links?.length?s:null},[]),Bt=O(async()=>{const t=e.showMeta?.isAdult,s=ie.filter(i=>{if(ke.current.includes(i))return!1;const c=ye.has(i);return t===void 0?!0:c===t});gt(!0);try{for(const i of s){ke.current.push(i);let c=null;try{c=await $e(`/api/video?showId=${n}&episodeNumber=${e.currentEpisode}&mode=${e.currentMode}&provider=${i}`)}catch{continue}const N=(c??[]).filter(F=>{const oe=F.sourceName.toLowerCase();return e.currentMode==="dub"?oe.includes("eng")||oe.includes("dub"):oe.includes("jpn")||oe.includes("sub")||!oe.includes("eng")&&!oe.includes("dub")});if((N.length>0?N:c??[]).find(F=>F.type!=="iframe"&&F.links?.length)){ke.current=[e.selectedProvider],Le.current=!1,g({type:"SET_STATE",payload:{selectedProvider:i,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",i),_e(null),Qe.success(`Switched to ${i} (direct stream)`);return}}_e({retryFailed:!0}),Qe.error("No working direct stream found on other providers")}finally{gt(!1)}},[n,e.currentEpisode,e.currentMode,e.showMeta?.isAdult,e.selectedProvider,g,ie,ye]),Yt=O(()=>{if(Je.current||Le.current||e.selectedSource?.type!=="player")return;const t=At();if(!t)return;ke.current.includes(e.selectedProvider)||ke.current.push(e.selectedProvider);const s=L.current;if(s==="iframe"){Pt(t);return}if(s==="retry"){Bt();return}k.setShowControls(!0),_e({retryFailed:!1})},[e.selectedSource,e.selectedProvider,At,Pt,Bt,k]);Ne.current=Yt;const gr=O(()=>{Le.current=!0,_e(null),Tt(!1)},[]),br=O(()=>{Xe&&dt("iframe");const t=At();t?Pt(t):_e(null)},[Xe,dt,At,Pt]),yr=O(()=>{Xe&&dt("retry"),Bt()},[Xe,dt,Bt]),Rt=(t,s,i)=>t.showId===s||!!i&&t.showId===i,It=O(()=>{k.onEnded();const t=T.find(i=>Rt(i,n,e.showMeta?.id)&&i.episodeNumber===e.currentEpisode);if(T.length>0){const i=T.findIndex(N=>Rt(N,n,e.showMeta?.id)&&N.episodeNumber===e.currentEpisode),c=i>=0?T[i+1]||null:T[0];ue({nextItem:c,playedItem:t||null}),me(2)}else t&&Ce.current.mutate({showId:t.showId,episodeNumber:t.episodeNumber});let s=!1;if(e.isAutoplayEnabled&&T.length===0){const i=e.episodes.findIndex(c=>c===e.currentEpisode);if(i>-1&&i<e.episodes.length-1){const c=e.episodes[i+1];K.invalidateQueries({queryKey:["allContinueWatching"]}),w(`/watch/${n}/${c}`),s=!0}}if(!s&&T.length===0&&!D&&!Oe.current){const i=e.episodes.length>0&&!!e.currentEpisode&&e.episodes[e.episodes.length-1]===e.currentEpisode,c=String(e.showMeta.status||"").trim().toLowerCase(),N=["finished","completed","complete","ended"].some(de=>c.includes(de));i&&N&&g({type:"SET_STATE",payload:{showResumeModal:!0}})}},[k,w,T,n,e.showMeta?.id,e.showMeta?.status,e.currentEpisode,e.episodes,e.isAutoplayEnabled,D,g,K]),Qt=O(()=>{if(T.length===0)return;k.onEnded();const t=T.find(c=>Rt(c,n,e.showMeta?.id)&&c.episodeNumber===e.currentEpisode),s=T.findIndex(c=>Rt(c,n,e.showMeta?.id)&&c.episodeNumber===e.currentEpisode),i=s>=0?T[s+1]||null:T[0];t&&We.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),i?w(`/watch/${i.showId}/${i.episodeNumber}`):t&&g({type:"SET_STATE",payload:{showResumeModal:!0}})},[k,w,T,We,n,e.showMeta?.id,e.currentEpisode,g]),_t=O(()=>{xe&&(K.invalidateQueries({queryKey:["allContinueWatching"]}),ot(!1),w(`/watch/${n}/${xe}`)),g({type:"SET_STATE",payload:{showResumeModal:!1}})},[xe,w,n,g,K]),Jt=O(()=>{T.length>0?Qt():xe?_t():Qe.error("No next episode available")},[T.length,Qt,_t,xe]),Sr=()=>{Wt&&w(`/watch/${n}/${Wt}`)};x(()=>{const t=m.videoRef.current;if(!t)return;const s=()=>{we||It()};return t.addEventListener("ended",s),()=>{t&&t.removeEventListener("ended",s)}},[It,m.videoRef,a.state.isFullscreen,we]),x(()=>{const t=s=>{s.origin===window.location.origin&&e.selectedSource?.type==="iframe"&&s.data?.type==="ANI_WEB_MEDIA_ENDED"&&It()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[It,e.selectedSource?.type]),x(()=>{if(!D||at===null)return;if(at<=0){const{nextItem:s,playedItem:i}=D;ue(null),me(null),i&&Ce.current.mutate({showId:i.showId,episodeNumber:i.episodeNumber}),s?w(`/watch/${s.showId}/${s.episodeNumber}`):i&&g({type:"SET_STATE",payload:{showResumeModal:!0}});return}const t=window.setTimeout(()=>{me(s=>s===null?null:s-1)},1e3);return()=>window.clearTimeout(t)},[D,at,w,g]),x(()=>{bt&&a.state.isFullscreen&&a.actions.toggleFullscreen()},[bt,a.state.isFullscreen,a.actions]),x(()=>{bt&&m.videoRef.current&&m.videoRef.current.pause()},[bt,m.videoRef]);const{titlePreference:Lt}=zr(),pt=ct(()=>{if(!e.showMeta||e.loadingShowData)return"Loading...";const{name:t,names:s}=e.showMeta;return Lt==="name"?t||"Loading...":Lt==="nativeName"?s?.native||t||"Loading...":Lt==="englishName"?s?.english||t||"Loading...":t||"Loading..."},[e.showMeta,Lt,e.loadingShowData]);x(()=>{pt&&pt!=="Loading..."&&e.currentEpisode&&(document.title=`► ${pt} Episode ${e.currentEpisode} - dango`)},[pt,e.currentEpisode]),x(()=>{const t=s=>{if(!s.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')&&(["arrowup","arrowdown","arrowleft","arrowright"].includes(s.key.toLowerCase())&&(k.setShowControls(!0),a.actions.inactivityTimer.current&&clearTimeout(a.actions.inactivityTimer.current),a.actions.inactivityTimer.current=window.setTimeout(()=>{k.setShowControls(!1)},1e3)),s.key.toLowerCase()==="n"&&Jt(),s.key.toLowerCase()==="t")){const c=!se;ge(c),localStorage.setItem("playerTheaterMode",c.toString())}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[k,a.actions.inactivityTimer,Jt,se]);const{setAvailableSubtitles:Xt,setActiveSubtitleTrack:qt}=k;x(()=>{const t=m.videoRef.current;if(!t)return;const s=()=>{const i=Array.from(t.textTracks).map(c=>({label:c.label,lang:c.language,src:void 0,mode:c.mode}));Xt(i)};return t.textTracks.addEventListener("addtrack",s),t.textTracks.addEventListener("removetrack",s),s(),()=>{t&&(t.textTracks.removeEventListener("addtrack",s),t.textTracks.removeEventListener("removetrack",s))}},[m.videoRef,Xt]),x(()=>{if(a.state.activeSubtitleTrack===null&&a.state.availableSubtitles.length>0&&localStorage.getItem("playerSubtitlesEnabled")!=="false"){let t=null;try{t=localStorage.getItem("playerLastSubtitle")}catch{}const s=Ht(a.state.availableSubtitles,{lastKey:t,enabled:!0});if(s<0){qt("off");return}const i=a.state.availableSubtitles[s];qt(i.lang||i.label)}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,qt]),x(()=>{const t=m.videoRef.current;if(!t||a.state.availableSubtitles.length===0)return;const s=a.state.activeSubtitleTrack;if(!(localStorage.getItem("playerSubtitlesEnabled")!=="false")||s==="off"||s===null){Array.from(t.textTracks).forEach(N=>{N.mode="hidden"});return}let c=!1;if(Array.from(t.textTracks).forEach(N=>{const H=(N.language===s||N.label===s)&&!c;N.mode=H?"showing":"hidden",H&&(c=!0)}),!c&&t.textTracks.length>0){const N=Array.from(t.textTracks).find(de=>de.language==="en"||de.label==="English")||t.textTracks[0];N&&(N.mode="showing")}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,m.videoRef]);const[Zt,Er]=q(0);x(()=>{const t=m.videoRef.current;if(!t)return;const s=()=>Er(t.clientHeight||0);s();const i=new ResizeObserver(s);return i.observe(t),()=>i.disconnect()},[m.videoRef,e.selectedSource,e.selectedLink]),x(()=>{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:a.state.subtitleFontSize,position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold};s.textContent=ir(i);const c=m.videoRef.current;if(!c)return;const N=lr(a.state.subtitleFontSize,Zt||c.clientHeight||720);s.textContent=ir({...i,fontSize:N});const de=()=>{const y=Number(a.state.subtitlePosition),Z=isNaN(y)?0:Math.max(0,Math.min(100,y));return Math.max(0,Math.min(100,100-Z))},H=(y,Z)=>{try{const ae=y;ae.snapToLines=!1,ae.line=Z}catch{}},F=()=>{const y=N*16,Z=c.videoHeight||c.clientHeight||720,ae=c.videoWidth||c.clientWidth||1280;return{step:y*1.3/Z*100,chars:Math.max(20,Math.floor(ae/(y*.55)))}},oe=y=>{const Z=de(),ae=Array.from(y.activeCues??[]);if(ae.length<=1){ae.forEach(St=>H(St,Z));return}const{step:yt,chars:$t}=F();let sr=Z;for(let St=ae.length-1;St>=0;St--){const xr=String(ae[St].text??"").replace(/<[^>]*>/g,"").split(`
55
- `).reduce((Pr,Ar)=>Pr+Math.max(1,Math.ceil(Ar.length/$t)),0),or=sr-xr*yt;H(ae[St],Math.max(0,or)),sr=or-yt*.4}},fe=y=>{if(!y.cues)return;const Z=de();Array.from(y.cues).forEach(ae=>H(ae,Z)),y.mode==="showing"&&oe(y)},Me=()=>{Array.from(c.textTracks).forEach(fe)};Me();const J=y=>{const Z=y.target;Z.mode==="showing"&&oe(Z)};Array.from(c.textTracks).forEach(y=>{y.addEventListener("cuechange",J)});const Pe=()=>{Array.from(c.textTracks).forEach(y=>{y.removeEventListener("cuechange",J),y.addEventListener("cuechange",J)}),Me()};c.textTracks.addEventListener("addtrack",Pe),c.textTracks.addEventListener("removetrack",Pe);const be=Array.from(c.querySelectorAll("track")),X=()=>{Me()};return be.forEach(y=>{y.addEventListener("load",X)}),()=>{Array.from(c.textTracks).forEach(y=>{y.removeEventListener("cuechange",J)}),c.textTracks.removeEventListener("addtrack",Pe),c.textTracks.removeEventListener("removetrack",Pe),be.forEach(y=>{y.removeEventListener("load",X)})}},[a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,a.state.availableSubtitles,e.selectedSource,e.selectedLink,m.videoRef,Zt]),x(()=>{if(!_)return;const t=m.videoRef.current,s=ze.current;if(!t||!s)return;const i=localStorage.getItem("playerSubtitlesEnabled")!=="false",c=a.state.activeSubtitleTrack;function N(){if(s.innerHTML="",!i||c==="off"||c===null)return;const F=Array.from(t.textTracks).find(X=>X.language===c||X.label===c);if(!F||F.mode!=="showing")return;const oe=rt/1e3;let fe;if(oe>0&&F.cues){const X=t.currentTime-oe;fe=Array.from(F.cues).filter(y=>y.startTime<=X&&X<=y.endTime)}else fe=Array.from(F.activeCues??[]);if(fe.length===0)return;const Me={fontSize:lr(a.state.subtitleFontSize,t.clientHeight||0),position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold},J=sn(Me),Pe=on(t,Me.position),be=Array.from(fe);be.forEach((X,y)=>{const Z=String(X.text??"");if(!an(Z).trim())return;const ae=document.createElement("div"),yt=(be.length-1-y)*1.7;ae.style.cssText=`${J}
56
- bottom: calc(${Pe}px + ${yt}em);`,ae.innerHTML=ln(Z),s.appendChild(ae)})}const de=()=>N(),H=()=>N();return Array.from(t.textTracks).forEach(F=>{F.addEventListener("cuechange",de)}),t.addEventListener("timeupdate",H),N(),()=>{Array.from(t.textTracks).forEach(F=>{F.removeEventListener("cuechange",de)}),t.removeEventListener("timeupdate",H),s.innerHTML=""}},[ne.isEnabled,ne.isWebGPUSupported,a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,m.videoRef,_,rt]),x(()=>{try{localStorage.setItem("anime4kProfile",o)}catch{}},[o]);const wr=()=>{m.videoRef.current&&(m.videoRef.current.currentTime=e.resumeTime,m.videoRef.current.play()),g({type:"SET_STATE",payload:{showResumeModal:!1}})},kr=()=>{m.videoRef.current&&(m.videoRef.current.currentTime=0,m.videoRef.current.play()),g({type:"SET_STATE",payload:{showResumeModal:!1}})},er=O(()=>{it&&(Oe.current=!0),xt&&ot(!1),g({type:"SET_STATE",payload:{showResumeModal:!1}})},[g,it,xt]),Tr=O(()=>{if(ot(!1),m.videoRef.current)try{m.videoRef.current.currentTime=0,m.videoRef.current.play().catch(()=>{})}catch{}g({type:"SET_STATE",payload:{showResumeModal:!1}})},[g,m]),Cr=O(async()=>{try{await U(),g({type:"SET_STATE",payload:{showResumeModal:!1}}),w("/")}catch{}},[U,g,w]),tr=(t,s)=>r("div",{className:t,children:[r("button",{className:`${u.episodeNavBtn} ${u.secondary}`,onClick:Sr,disabled:!Wt,type:"button",children:[r(W,{name:"chevron-left",size:12}),"Prev EP"]}),r("button",{className:`${u.episodeNavBtn} ${u.primary}`,onClick:_t,disabled:!xe,type:"button",children:["Next EP",r(W,{name:"chevron-right",size:12})]}),s==="mobile"&&Fe&&r("button",{className:`${u.episodeNavBtn} ${u.episodePickerBtn}`,onClick:()=>M(!0),type:"button",children:[r(W,{name:"list-ul",size:12}),"Episodes"]})]});x(()=>{st&&(e.showResumeModal||T.length>0||D||Oe.current||it&&g({type:"SET_STATE",payload:{showResumeModal:!0}}))},[st,it,e.showResumeModal,T.length,D,g]);const Mr=t=>{g({type:"SET_STATE",payload:{isAutoplayEnabled:t}}),fn(t)},rr=!!(e.currentEpisode&&e.watchedEpisodes.includes(e.currentEpisode)),Rr=e.selectedProvider!=="megaplay"||e.selectedSource?.type==="iframe",zt=f(A);zt.current=A;const nr=f("");x(()=>{const t=m.videoRef.current;if(wt(!1),ot(!1),!t||e.selectedSource?.type==="iframe")return;const s=()=>{const i=t.duration,c=t.currentTime;if(!i||Number.isNaN(i)){wt(!1),ot(!1);return}const N=c/i;if(i-c<=60){const de=T.findIndex(oe=>Rt(oe,n,e.showMeta?.id)&&oe.episodeNumber===e.currentEpisode),H=T.length>0?de>=0?T[de+1]||null:T[0]:null,F=H?`${H.showId}:${H.episodeNumber}`:Vt?`${n}:${xe}`:"";F&&nr.current!==F&&(nr.current=F,H?zt.current(H.episodeNumber,H.showId):zt.current(xe))}wt(Vt&&N>=.8),ot(c>=Math.max(i*.98,i-10))};return s(),t.addEventListener("timeupdate",s),t.addEventListener("loadedmetadata",s),()=>{t.removeEventListener("timeupdate",s),t.removeEventListener("loadedmetadata",s)}},[m.videoRef,Vt,e.currentEpisode,e.selectedSource,xe,n,T,e.showMeta?.id]);const _r=O(async()=>{if(!n||!e.currentEpisode||!e.showMeta.name||$)return;const t=m.videoRef.current?.duration,s=Math.max(t||0,e.resumeDuration||0,(e.showMeta.lengthMin||0)*60,1);await ve(e.currentEpisode,s)},[n,e.currentEpisode,e.showMeta,e.resumeDuration,ve,$,m.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 lt=e.loadingShowData||e.loadingVideo,Nr=t=>{se&&t.target===t.currentTarget&&(ge(!1),localStorage.setItem("playerTheaterMode","false"))};return e.showMeta?.isAdult===!0&&!C?r("div",{className:Ue.playerPageLayout,children:r(Ae,{isOpen:!0,title:"Content Warning",onClose:()=>w("/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(Ze,{variant:"secondary",onClick:()=>w("/home"),children:"Go Back"}),r(Ze,{onClick:S,children:"I'm 18+, Continue"})]})]})})}):r("div",{className:`${Ue.playerPageLayout} ${se?Ue.theaterMode:""}`,onClick:Nr,children:[r(Ae,{isOpen:jt,onClose:er,title:it?"Show Completed!":"Resume Playback?",width:"sm",children:it?r(Et,{children:[r(Ae.Body,{children:r("p",{children:"Congratulations! You've finished the final episode of this series."})}),r(Ae.Actions,{children:r(Ze,{onClick:Cr,disabled:De,children:De?"Saving...":"Move to Completed"})})]}):r(Et,{children:[r(Ae.Body,{children:r("p",{children:["You were watching at ",r("strong",{children:a.actions.formatTime(e.resumeTime)}),". Would you like to continue?"]})}),r(Ae.Actions,{children:[r(Ze,{variant:"secondary",onClick:kr,children:"Start Over"}),r(Ze,{onClick:wr,children:"Resume"})]})]})}),r(Ae,{isOpen:xt,onClose:er,title:"Episode Completed",width:"sm",children:[r(Ae.Body,{children:r("p",{children:["You've already watched Episode ",r("strong",{children:e.currentEpisode}),".",xe?" Would you like to watch the next episode?":""]})}),r(Ae.Actions,{children:[r(Ze,{variant:"secondary",onClick:Tr,children:"Replay"}),xe&&r(Ze,{onClick:_t,children:`Watch EP ${xe}`})]})]}),r(Ae,{isOpen:!!ft,onClose:gr,title:"Direct stream failed",width:"sm",children:[r(Ae.Body,{children:[r("p",{children:[r("strong",{children:e.selectedProvider}),"'s direct stream failed for this episode."]}),ft?.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:Xe,onChange:t=>Tt(t.target.checked)}),"Remember my choice"]})]}),r(Ae.Actions,{children:[r(Ze,{variant:"secondary",onClick:br,children:"Continue with iframe"}),r(Ze,{onClick:yr,disabled:vt,children:vt?"Searching…":"Try another provider"})]})]}),r(Gr,{isOpen:!!e.showCookieModal,onClose:()=>g({type:"SET_STATE",payload:{showCookieModal:!1}}),onSuccess:()=>{K.invalidateQueries({queryKey:["video-sources",n,e.currentEpisode,e.selectedProvider,e.currentMode]})}}),!se&&r("aside",{ref:Be,className:Ue.episodeSidebar,children:e.loadingShowData?r(cn,{variant:"sidebar"}):r(un,{episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>w(`/watch/${n}/${t}`)})}),r("div",{className:Ue.playerMain,children:[r("div",{className:`${u.videoContainer} ${a.state.isFullscreen?"":Ue.videoPlayerWrapper} ${a.state.isFullscreen?u.fullscreenActive:""}`,style:{...bt?{visibility:"hidden"}:{}},onContextMenu:t=>t.preventDefault(),children:r(us,{player:a,isAutoplayEnabled:e.isAutoplayEnabled,onAutoplayChange:Mr,fallbackChoice:Ct,onFallbackChoiceChange:dt,showNextEpisodeButton:!bt&&nt&&T.length===0,onNextEpisode:_t,videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:(t,s)=>{m.videoRef.current&&!isNaN(m.videoRef.current.currentTime)&&(ee.current=m.videoRef.current.currentTime),le(t.sourceName),g({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},loadingVideo:e.loadingVideo,skipIntervals:e.skipIntervals,animeTitle:pt,episodeNumber:e.currentEpisode,isTheaterMode:se,onTheaterModeToggle:()=>{const t=!se;ge(t),localStorage.setItem("playerTheaterMode",t.toString())},anime4kEnabled:ne.isEnabled,onAnime4kToggle:ne.toggle,anime4kSupported:ne.isWebGPUSupported,anime4kProfile:o,onAnime4kProfileChange:d,anime4kInitializing:ne.isInitializing,anime4kError:ne.error,videoDelayEnabled:Q,onVideoDelayToggle:t=>{j(t);try{localStorage.setItem("playerVideoDelayEnabled",String(t))}catch{}},videoDelayMs:p,onVideoDelayChange:Ke,onCalibrateAvSync:ut,isInteractingExtra:kt||te,className:dn.shellFill,hideChrome:e.selectedSource?.type==="iframe",overlays:r(Et,{children:[a.state.isSpeedBoostActive&&r("div",{className:u.speedBoostBadge,"aria-hidden":"true",children:[r("span",{children:"2x"}),r(W,{name:"forward",size:12})]}),at!==null&&D?.nextItem&&r("div",{className:u.queueCountdown,children:["Queue next in ",at,"s"]})]}),children:[I&&r("div",{className:`${u.skipIndicatorContainer} ${I.side==="left"?u.leftSkip:u.rightSkip} `,children:r("div",{className:u.skipBubble,children:[r("div",{className:u.skipIcon,children:I.side==="left"?r(W,{name:"backward"}):r(W,{name:"forward"})}),r("div",{className:u.skipText,children:"15s"})]})}),lt&&r("div",{className:u.loadingOverlay,children:r("div",{className:u.loadingDots,children:[r("div",{className:u.dot}),r("div",{className:u.dot}),r("div",{className:u.dot})]})}),a.state.isBuffering&&!lt&&e.selectedSource?.type!=="iframe"&&r("div",{className:u.bufferingOverlay,children:r("div",{className:u.bufferingSpinner})}),e.selectedSource?.type==="iframe"?!lt&&r("iframe",{src:e.selectedLink?.link,className:u.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(Et,{children:[!lt&&e.videoSources.length===0&&r("div",{className:u.errorOverlay,children:[r("p",{children:["No sources found for this episode with ",e.selectedProvider,"."]}),r("p",{className:u.errorSubtext,children:"Please try selecting a different provider below."}),r("button",{className:u.retryButton,onClick:()=>window.location.reload(),"data-speed-boost-ignore":"true",style:{marginTop:8},children:"Retry"})]}),!lt&&e.videoSources.length>0&&r("video",{ref:m.videoRef,controls:a.state.useNativeControls,playsInline:!0,"webkit-playsinline":"true",disablePictureInPicture:!0,disableRemotePlayback:!0,onPlay:k.onPlay,onPause:k.onPause,onLoadedMetadata:k.onLoadedMetadata,onTimeUpdate:()=>{we||(k.onTimeUpdate(),D&&m.videoRef.current&&m.videoRef.current.currentTime<m.videoRef.current.duration-1&&(ue(null),me(null)))},onProgress:k.onProgress,onVolumeChange:k.onVolumeChange,onWaiting:k.onWaiting,onPlaying:k.onPlaying,onError:Yt,onContextMenu:t=>t.preventDefault(),className:_?u.videoElementHidden:""}),ne.isWebGPUSupported&&!lt&&e.videoSources.length>0&&r("canvas",{ref:Ie,className:`${u.upscalerCanvas} ${Ye?u.upscalerActive:""}`}),!Ye&&!lt&&e.videoSources.length>0&&r("canvas",{ref:ht,className:`${u.upscalerCanvas} ${h?u.upscalerActive:""}`}),ne.isEnabled&&ne.isWebGPUSupported&&ne.isInitializing&&r("div",{className:u.upscalerStatusBadge,children:"Preparing upscaler…"}),_&&r("div",{ref:ze,className:u.subtitleOverlay}),r(pn,{isOpen:te,ms:p,onChange:Ke,onApply:pe,onClose:re,testClipActive:we,onTestClip:je})]})]})}),!se&&r(mn,{}),!se&&r(Et,{children:[Mt&&T.length===0?r(ds,{count:3}):r(yn,{title:"Queue",items:T,currentShowId:n,currentEpisode:e.currentEpisode,onNextQueue:Qt,onRemove:t=>We.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),onClear:()=>he.mutate(),showClearAll:!0,onReorder:t=>Ot.mutate(t.map(s=>({id:s.id,showId:s.showId,episodeNumber:s.episodeNumber})))}),r("div",{className:u.providerAndEpisodeRow,children:[r(ys,{selectedProvider:e.selectedProvider,isAdult:e.showMeta?.isAdult,options:R,onProviderChange:t=>{Je.current=!1,ke.current=[],Le.current=!1,_e(null),g({type:"SET_STATE",payload:{selectedProvider:t,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",t)}}),tr(`${u.episodeActions} ${u.desktopEpisodeActions}`,"desktop")]}),lt?r("div",{className:u.sourceLoader,children:r("div",{className:u.spinner})}):r(Et,{children:r(Es,{videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:t=>{m.videoRef.current&&!isNaN(m.videoRef.current.currentTime)&&(ee.current=m.videoRef.current.currentTime);const i=(t.links||[]).sort((c,N)=>(parseInt(N.resolutionStr)||0)-(parseInt(c.resolutionStr)||0))[0]||null;le(t.sourceName),g({type:"SET_STATE",payload:{selectedSource:t,selectedLink:i,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},onLinkChange:t=>{e.selectedSource&&(le(e.selectedSource.sourceName),g({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:Hr(e.showMeta.thumbnail||""),alt:pt,loading:"lazy",decoding:"async",onError:t=>{t.target.src="/placeholder.svg"}})}),r("div",{className:Ue.videoTitleSection,children:[r("div",{className:u.titleContainer,children:[r("h1",{children:pt}),r("div",{className:u.scheduleInfo,children:[e.showMeta.status&&r("span",{className:u.status,children:e.showMeta.status}),e.showMeta.nextEpisodeAirDate&&r("span",{className:u.nextEpisode,children:["Next episode: ",e.showMeta.nextEpisodeAirDate]})]})]}),r("div",{className:u.controls,children:[r("button",{className:`${u.watchlistBtn} ${e.inWatchlist?u.inList:""}`,onClick:V,children:[e.inWatchlist?r(W,{name:"check",size:14}):r(W,{name:"plus",size:14}),e.inWatchlist?"In Watchlist":"Add to Watchlist"]}),r(En,{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:`${u.watchlistBtn} ${u.queueBtn}`,activeClassName:u.queueActive}),Rr&&r("button",{className:`${u.watchlistBtn} ${u.markWatchedBtn} ${rr?u.markWatchedDone:""}`,onClick:_r,disabled:$||!e.currentEpisode,children:[r(W,{name:"check",size:14}),$?"Saving...":rr?"Watched":"Mark Watched"]}),r("button",{className:`${u.watchlistBtn} ${u.modeToggleBtn} ${e.currentMode==="dub"?u.modeToggleActive:""}`,onClick:()=>{const t=e.currentMode==="dub"?"sub":"dub";Je.current=!1,ke.current=[],Le.current=!1,_e(null),g({type:"SET_MODE",payload:t}),localStorage.setItem("preferredMode",t)},type:"button","aria-pressed":e.currentMode==="dub",children:e.currentMode==="dub"?"DUB":"SUB"}),r("button",{className:`${u.watchlistBtn} ${u.modeToggleBtn} ${a.state.useNativeControls?u.modeToggleActive:""}`,onClick:()=>{const t=!a.state.useNativeControls;a.actions.setUseNativeControls(t),localStorage.setItem("playerUseNativeControls",t.toString())},type:"button",children:a.state.useNativeControls?"NATIVE: ON":"NATIVE: OFF"})]})]})]}),tr(`${u.episodeActions} ${u.mobileEpisodeActions}`,"mobile"),r("div",{className:u.descriptionSection,children:[r("h3",{children:"Synopsis"}),r(kn,{text:e.showMeta.description?e.showMeta.description.replace(/<[^>]*>?/gm,""):"",emptyText:"No description available."})]}),r("button",{className:u.detailsToggleBtn,onClick:z,children:[e.showCombinedDetails?r(W,{name:"chevron-up"}):r(W,{name:"chevron-down"}),e.showCombinedDetails?"Hide Details":"Show Details"]}),e.showCombinedDetails&&r(wn,{showMeta:e.showMeta,styles:u})]})]})]}),r(hn,{isOpen:kt,onClose:()=>M(!1),episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>{M(!1),w(`/watch/${n}/${t}`)}})]})};export{Xs as default};
@@ -1 +0,0 @@
1
- import{g as I,d as J,T as X,u as e}from"./vendor-core-8R2fFbyN.js";import{I as o}from"./vendor-icons-CDMuNDeL.js";import{S as Y,O as _,a as Z,A as ee}from"./OptionListMenu-JQ_--ggT.js";import"./AvSyncCalibrator-Bs4iejCG.js";import"./index-CfvzoNYQ.js";import"./vendor-query-BXRECSI6.js";const ne="_settingsPanel_y6z3b_1",te="_header_y6z3b_33",ae="_backBtn_y6z3b_56",se="_contentWrapper_y6z3b_76",le="_menuContent_y6z3b_82",ie="_menuItem_y6z3b_89",re="_selected_y6z3b_114",ce="_currentValue_y6z3b_134",oe="_menuNote_y6z3b_141",de="_menuError_y6z3b_150",n={settingsPanel:ne,header:te,backBtn:ae,contentWrapper:se,menuContent:le,menuItem:ie,selected:re,currentValue:ce,menuNote:oe,menuError:de},me=(A,z)=>{const{isOpen:b,onClose:ue,videoSources:he,currentSource:v,currentLink:k,onSourceChange:w,subtitles:$,activeSubtitleTrack:y,onSubtitleChange:P,subtitleSettings:V,onSubtitleSettingsChange:O,useNativeControls:g,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:C,anime4kProfile:i,onAnime4kProfileChange:h,anime4kInitializing:E,anime4kError:f,videoDelayEnabled:N,onVideoDelayToggle:T,videoDelayMs:S,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:d,onAutoSkipChange:L,isAutoplayEnabled:m,onAutoplayChange:M,fallbackChoice:p,onFallbackChoiceChange:W}=A,[a,r]=J("main");I.useEffect(()=>{if(!b){const t=setTimeout(()=>r("main"),300);return()=>clearTimeout(t)}},[b]);const G=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>r("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:k?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>r("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:y||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>r("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),e("button",{className:`${n.menuItem} ${g?n.selected:""}`,onClick:()=>{const t=!g;U(t),localStorage.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),g&&e(o,{name:"check",size:12})]}),C&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),C&&u&&e("button",{className:n.menuItem,onClick:()=>r("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>r("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:N?`${S}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>r("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[d?"Auto-skip On":null,m?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]})]}),j=()=>{const t=v?.links.sort((s,c)=>(parseInt(c.resolutionStr)||0)-(parseInt(s.resolutionStr)||0))||[];return e("div",{className:n.menuContent,children:e(_,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.resolutionStr,label:s.resolutionStr,selected:k?.resolutionStr===s.resolutionStr})),onSelect:s=>{const c=t.find(l=>l.resolutionStr===s);c&&w(v,c)}})})},q=()=>e("div",{className:n.menuContent,children:e(_,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:y==="off"},...$.map(t=>({key:t.label||t.lang,label:t.label,selected:y===(t.label||t.lang)}))],onSelect:t=>P(t)})}),F=()=>e("div",{className:n.menuContent,children:e(Z,{classes:{item:n.menuItem,active:n.selected},values:V,onChange:O})}),Q=X(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const c=navigator.userAgent.toLowerCase();return c.includes("chrome")||c.includes("chromium")||c.includes("edg")}catch{return!0}},[]),R=()=>e("div",{className:n.menuContent,children:[E&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),f&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",f]}),!Q&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${i==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),i==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${i==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),i==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${i==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),i==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${i==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),i==="denoise"&&e(o,{name:"check",size:12})]})]}),H=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>L(!d),"aria-pressed":d,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>M(!m),"aria-pressed":m,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>W(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),K=()=>e("div",{className:n.menuContent,children:e(ee,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:N,delayMs:S,onToggle:T,onDelayChange:D,onCalibrate:x})});return b?e(Y,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>r("main"),panelRef:z,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&G(),a==="quality"&&j(),a==="subtitles"&&q(),a==="subtitle-style"&&F(),a==="upscaler"&&R(),a==="av-sync"&&K(),a==="playback"&&H()]}):null},Ce=I.forwardRef(me);export{Ce as default};
@@ -1 +0,0 @@
1
- import{h as k,o as pe,a as ge,d as o,A as me,g as ve,u as a}from"./vendor-core-8R2fFbyN.js";import{I as d}from"./vendor-icons-CDMuNDeL.js";import{A as fe}from"./AnimeCard-CXx2EIN7.js";import{S as be}from"./SkeletonGrid-CnE_aoEU.js";import{u as Le,r as Ae,P as ee,B as w,Q as ye}from"./index-CfvzoNYQ.js";import{E as Se}from"./ErrorMessage-z4f4WGgP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-D-vEehTG.js";import"./vendor-query-BXRECSI6.js";import"./QueueOptionsButton-BKNDfpCl.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-xfJv6irD.js";import"./useIsMobile-Dm_b6Ob3.js";const Ne=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Ce=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Te=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],Ee=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Ie=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function Me(){k(()=>{document.title="Search - dango"},[]);const[r,ae]=pe(),te=ge(),[m,B]=o(r.get("query")||""),[c,_]=o(parseInt(r.get("page")||"1")),[h,A]=o(r.get("type")||"ALL"),[v,y]=o(r.get("season")||"ALL"),[f,S]=o(r.get("year")||"ALL"),[G,I]=o(r.get("country")||"ALL"),[Y,le]=o(r.get("provider")||"anilist"),[U,P]=o(r.get("sortBy")||"POPULARITY_DESC"),[F,x]=o(r.get("status")||""),[N,ne]=o(!1),[re,M]=o(null);k(()=>{let e=!1;return fetch("/api/anilist-status").then(n=>n.json()).then(n=>{e||M(n.available)}).catch(()=>{e||M(!0)}),()=>{e=!0}},[]);const{lowEndMode:se}=Le(),D=me(null),{data:ie}=Ae(),$=ie?.genres||[],[b,C]=o(()=>{const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),e}),z=new URLSearchParams(r);z.delete("page");const j=z.toString(),{data:L=[],isLoading:g,isError:oe,error:ce}=ee(j,c,14),{data:V}=ee(j,c+1,14),[O,ue]=o(!1),T=ve.useMemo(()=>Y==="anilist"&&h==="ADULT"||O?L:L.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[L,O,Y,h]);k(()=>{B(r.get("query")||""),A(r.get("type")||"ALL"),y(r.get("season")||"ALL"),S(r.get("year")||"ALL"),I(r.get("country")||"ALL"),le(r.get("provider")||"anilist"),P(r.get("sortBy")||"POPULARITY_DESC"),x(r.get("status")||""),_(parseInt(r.get("page")||"1"));const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),C(e)},[r]);const u=(e=1,n={})=>{ye();const s=n.type??h,l=n.status??F,H=n.season??v,q=n.year??f,J=n.country??G,K=n.sort??U,Q=n.genreState??b,he=n.showMature??O,i=new URLSearchParams;m.trim()&&i.set("query",m.trim()),s!=="ALL"&&i.set("type",s),l&&i.set("status",l),H!=="ALL"&&i.set("season",H),q!=="ALL"&&i.set("year",q),J!=="ALL"&&i.set("country",J),K!=="POPULARITY_DESC"&&i.set("sortBy",K);const X=Object.entries(Q).filter(([,p])=>p==="include").map(([p])=>p),Z=Object.entries(Q).filter(([,p])=>p==="exclude").map(([p])=>p);X.length>0&&i.set("genres",X.join(",")),Z.length>0&&i.set("excludeGenres",Z.join(",")),s!=="ADULT"&&!he&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),ae(i),e!==c&&_(e)},E=e=>{if(u(e),D.current){const n=D.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},R=new Date().getFullYear(),de=[{value:"ALL",label:"All Years"},...Array.from({length:R-1980+1},(e,n)=>({value:String(R-n),label:String(R-n)}))],W=L.length>=14&&V&&V.length>0;return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(d,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:m,onInput:e=>B(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&u()})]}),a("div",{className:t.searchActions,children:[a(w,{onClick:()=>u(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${N?t.active:""}`,onClick:()=>ne(!N),children:[a(d,{name:"filter",size:14}),a("span",{children:"Filters"}),N?a(d,{name:"chevron-up",size:12}):a(d,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${N?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:h,onChange:e=>{if(e.currentTarget.value==="ADULT"){te("/mature?provider=mal");return}A(e.currentTarget.value)},children:Ne.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:F,onChange:e=>x(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:v,onChange:e=>y(e.currentTarget.value),children:Ce.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:f,onChange:e=>S(e.currentTarget.value),children:de.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",re===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only — ignored by fallback providers"})]}),a("select",{value:G,onChange:e=>I(e.currentTarget.value),children:Te.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:U,onChange:e=>P(e.currentTarget.value),children:Ee.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),$.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:$.map(e=>a("button",{className:`${t.genreButton} ${t[b[e]||""]}`,onClick:()=>{C(n=>{const s=n[e],l={...n};return s==="include"?l[e]="exclude":s==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(w,{variant:"secondary",onClick:()=>{C({}),A("ALL"),y("ALL"),S("ALL"),I("ALL"),P("POPULARITY_DESC"),x(""),ue(!1),u(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(w,{onClick:()=>u(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),oe&&a(Se,{message:ce?.message||"Error"}),(h!=="ALL"||v!=="ALL"||f!=="ALL"||Object.keys(b).length>0)&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),h!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",h,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),A("ALL"),u(1,{type:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),v!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",v,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),y("ALL"),u(1,{season:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),f!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",f,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),S("ALL"),u(1,{year:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(b).map(([e,n])=>a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,a("button",{onClick:s=>{s.stopPropagation(),s.preventDefault();const l={...b};delete l[e],C(l),u(1,{genreState:l})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),a("div",{className:t.resultsHeader,ref:D,children:[a("h2",{className:t.resultsTitle,children:m?`Search Results for "${m}"`:"Discover Anime"}),T.length>0&&a("div",{className:t.pagination,children:[a("button",{className:t.pageBtn,onClick:()=>E(c-1),disabled:c===1||g,"aria-label":"Previous page",children:a(d,{name:"chevron-left",size:14})}),a("span",{className:t.pageInfo,children:["Page ",a("strong",{children:c})]}),a("button",{className:t.pageBtn,onClick:()=>E(c+1),disabled:!W||g,"aria-label":"Next page",children:a(d,{name:"chevron-right",size:14})})]})]}),a("div",{className:`${t.resultsGrid} ${se?t.lowEnd:""}`,children:g?a(be,{}):T.map(e=>a(fe,{anime:e},e._id))}),!g&&T.length===0&&a("div",{className:t.noResults,children:[a(d,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a("div",{className:t.pagination,children:[a("button",{className:t.pageBtn,onClick:()=>E(c-1),disabled:c===1||g,children:[a(d,{name:"chevron-left",size:14}),a("span",{children:"Previous"})]}),a("span",{className:t.pageInfo,children:["Page ",a("strong",{children:c})]}),a("button",{className:t.pageBtn,onClick:()=>E(c+1),disabled:!W||g,children:[a("span",{children:"Next"}),a(d,{name:"chevron-right",size:14})]})]})})]})}export{Me as default};
@@ -1 +0,0 @@
1
- import{u as e,g as t}from"./vendor-core-8R2fFbyN.js";import{u as l}from"./index-CfvzoNYQ.js";const a="_skeletonCard_1b0hr_1",i="_poster_1b0hr_11",c="_line_1b0hr_20",_="_info_1b0hr_38",d="_short_1b0hr_54",h="_horizontal_1b0hr_60",m="_vertical_1b0hr_78",v="_lowEnd_1b0hr_97",o={skeletonCard:a,poster:i,line:c,"skeleton-wave":"_skeleton-wave_1b0hr_1",info:_,short:d,horizontal:h,vertical:m,lowEnd:v},b=({layout:n="vertical"})=>{const{lowEndMode:r}=l();return e("div",{className:`${o.skeletonCard} ${o[n]} ${r?o.lowEnd:""}`,children:[e("div",{className:o.poster}),e("div",{className:o.info,children:[e("div",{className:o.line}),e("div",{className:`${o.line} ${o.short}`})]})]})},k=({count:n=14,layout:r="vertical"})=>e("div",{className:"grid-container",children:Array.from({length:n}).map((p,s)=>e(b,{layout:r},s))}),E=t.memo(k);export{b as A,E as S};
@@ -1 +0,0 @@
1
- ._skeletonCard_1b0hr_1{display:flex;flex-direction:column;background-color:var(--bg-secondary);border-radius:var(--radius-md);overflow:hidden;height:100%;border:1px solid var(--border-secondary)}._poster_1b0hr_11{width:100%;aspect-ratio:3 / 4;background-color:var(--bg-tertiary);position:relative;overflow:hidden}._poster_1b0hr_11:after,._line_1b0hr_20:after{content:"";position:absolute;inset:0;transform:translate(-100%);background-image:linear-gradient(90deg,#fff0 0,#ffffff0d 20%,#ffffff1f 60%,#fff0);animation:_skeleton-wave_1b0hr_1 1.8s infinite ease-in-out}._info_1b0hr_38{padding:var(--space-3);display:flex;flex-direction:column;gap:var(--space-2);flex-grow:1}._line_1b0hr_20{position:relative;overflow:hidden;height:18px;border-radius:var(--radius-sm);background-color:var(--bg-tertiary)}._line_1b0hr_20._short_1b0hr_54{width:60%;height:14px}@media(max-width:768px){._skeletonCard_1b0hr_1._horizontal_1b0hr_60{flex-direction:row;height:auto;min-height:100px}._skeletonCard_1b0hr_1._horizontal_1b0hr_60 ._poster_1b0hr_11{width:85px;height:100%;aspect-ratio:auto;flex-shrink:0}._skeletonCard_1b0hr_1._horizontal_1b0hr_60 ._info_1b0hr_38{padding:var(--space-2) var(--space-3);justify-content:center}._skeletonCard_1b0hr_1._vertical_1b0hr_78 ._poster_1b0hr_11{width:100%;aspect-ratio:3 / 4}._skeletonCard_1b0hr_1._vertical_1b0hr_78 ._info_1b0hr_38{padding:var(--space-2);align-items:center}._line_1b0hr_20{height:16px}._line_1b0hr_20._short_1b0hr_54{height:12px}}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97{min-height:0}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._poster_1b0hr_11:after,._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._line_1b0hr_20:after{animation:none}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._line_1b0hr_20{opacity:.6}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._info_1b0hr_38{padding:var(--space-3)}
@@ -1,4 +0,0 @@
1
- import{d as b,A as I,h as v,u as t,S as Oe,n as Er,o as Nr,a as wr,T as Ee,q as T}from"./vendor-core-8R2fFbyN.js";import{e as Tn,z as Ir,M as tn,B as _e}from"./index-CfvzoNYQ.js";import{I as A}from"./vendor-icons-CDMuNDeL.js";import{M as Mr,t as Zn,f as wn,d as Br,C as Ar,S as Lr,U as Pr,a as $r,p as In,u as Rr,c as Dr,b as Or,l as Vr,q as Fr,i as xn,v as zr,w as Wr,x as Qn,s as En,e as Ur,g as Hr,h as jr,r as qr,j as st,k as Kr,E as Yr,A as Gr,P as Jr,m as be,o as Qr}from"./AvSyncCalibrator-Bs4iejCG.js";import{O as rn,S as Xr,a as Zr,A as es}from"./OptionListMenu-JQ_--ggT.js";import{u as ts}from"./useMatureConsent-CT7-KfzG.js";import{u as ns}from"./useProviders-jxh6fvMH.js";import{d as rs,g as ss,h as as,f as os,e as is,j as ls,k as cs}from"./useTvLibrary-DeGkJuvp.js";import{l as ds,c as us}from"./hls-Cbou9Eb-.js";import{u as ms}from"./useIsMobile-Dm_b6Ob3.js";import{S as hs}from"./SynopsisText-BcpwT5iw.js";import"./vendor-query-BXRECSI6.js";const ps="_fullscreenFlat_oxcpx_1",gs="_timeDisplay_oxcpx_15",fs="_bottomControls_oxcpx_19",bs="_leftControls_oxcpx_23",vs="_rightControls_oxcpx_24",ys="_controlBtn_oxcpx_28",Ss="_controlsOverlay_oxcpx_47",_s="_hidden_oxcpx_67",Cs="_topControls_oxcpx_73",ks="_backBtn_oxcpx_93",Ts="_videoTitleInfo_oxcpx_113",xs="_animeTitle_oxcpx_119",Es="_episodeLabel_oxcpx_127",Ns="_speedBoostBadge_oxcpx_134",ws="_progressBarContainer_oxcpx_180",Is="_progressBar_oxcpx_180",Ms="_thumb_oxcpx_199",Bs="_bufferedBar_oxcpx_217",As="_watchedBar_oxcpx_227",Ls="_scrubbing_oxcpx_252",Ps="_timeBubble_oxcpx_256",$s="_bottomControlsRow_oxcpx_270",Rs="_active_oxcpx_323",Ds="_settingsPanel_oxcpx_398",Os="_settingsHeader_oxcpx_417",Vs="_settingsBackBtn_oxcpx_425",Fs="_settingsTitle_oxcpx_443",zs="_settingsContent_oxcpx_454",Ws="_currentValue_oxcpx_463",Us="_menuItem_oxcpx_478",Hs="_menuNote_oxcpx_511",a={fullscreenFlat:ps,timeDisplay:gs,bottomControls:fs,leftControls:bs,rightControls:vs,controlBtn:ys,controlsOverlay:Ss,hidden:_s,topControls:Cs,backBtn:ks,videoTitleInfo:Ts,animeTitle:xs,episodeLabel:Es,speedBoostBadge:Ns,progressBarContainer:ws,progressBar:Is,thumb:Ms,bufferedBar:Bs,watchedBar:As,scrubbing:Ls,timeBubble:Ps,bottomControlsRow:$s,active:Rs,settingsPanel:Ds,settingsHeader:Os,settingsBackBtn:Vs,settingsTitle:Fs,settingsContent:zs,currentValue:Ws,menuItem:Us,menuNote:Hs},nn=-1e4,Nn=1e4,Xn=500,js=({classes:h,delayMs:k,onDelayChange:F})=>{const[$,r]=b(null),j=$??k,q=I(F);q.current=F;const B=I(k);B.current=k;const i=I(null);i.current=$,v(()=>{r(null)},[k]),v(()=>()=>{const U=i.current;U!==null&&U!==B.current&&q.current(U)},[]);const re=U=>{B.current=U,i.current=null,q.current(U),r(null)},se=U=>{const f=i.current??B.current,ue=Math.max(nn,Math.min(Nn,f+U));re(ue)};return t(Oe,{children:[t("div",{style:{display:"flex",gap:6,padding:"0.5rem 0.75rem 0.25rem"},children:[t("button",{type:"button",className:h.item,onClick:()=>se(-Xn),"aria-label":"Show subtitles 0.5 seconds earlier",style:{flex:1,justifyContent:"center"},children:t("span",{children:"-0.5s"})}),t("button",{type:"button",className:h.item,onClick:()=>se(Xn),"aria-label":"Show subtitles 0.5 seconds later",style:{flex:1,justifyContent:"center"},children:t("span",{children:"+0.5s"})}),t("button",{type:"button",className:h.item,onClick:()=>re(0),disabled:j===0,"aria-label":"Reset subtitle timing",style:{flex:1,justifyContent:"center"},children:t("span",{children:"Reset"})})]}),t(Mr,{label:"Subtitle timing",display:Zn(j),min:nn,max:Nn,step:100,value:j,percent:(j-nn)/(Nn-nn)*100,onChange:U=>{const f=Math.round(U);i.current=f,r(f)},onCommit:()=>{const U=i.current;U!==null&&re(U)}}),t("div",{className:h.note,children:"Positive delays subtitles (show later). Negative shows them earlier. 0.0s is default."})]})},qs=({classes:h,tracks:k,selected:F,onChange:$})=>t(rn,{classes:h,options:k.map((r,j)=>({key:String(j),label:r.label||r.language,selected:j===F})),onSelect:r=>$(Number(r))}),Ks=({player:h,title:k,episodeLabel:F,audioTracks:$,selectedAudioTrack:r,onAudioTrackChange:j,subtitles:q,selectedSubtitle:B,onSubtitleChange:i,streams:re,qualityIdx:se,onQualityChange:U,onBack:f,children:ue,movyServers:K=[],selectedMovyServer:St="atlanta",onMovyServerSelect:me,isMovySource:Ve=!1,videoDelayEnabled:_t=!1,onVideoDelayToggle:sn,videoDelayMs:Mt=0,onVideoDelayChange:Bt,onCalibrateAvSync:ae,subtitleDelayMs:Ct=0,onSubtitleDelayChange:At})=>{const{state:x,refs:we,actions:E}=h,N=we.videoRef,{subtitleFontSize:Ie,subtitlePosition:Me,subtitleBgOpacity:Ce,subtitleBgColor:Fe,subtitleTextColor:he,subtitleEdge:ze,subtitleBold:X}=x,[C,J]=b(null),Lt=I(null),[We,at]=b(0);v(()=>{const o=N.current;if(!o)return;const c=()=>at(o.clientHeight||0);c();const Ae=new ResizeObserver(c);return Ae.observe(o),()=>Ae.disconnect()},[N,re]);const pe=(o,c)=>{try{localStorage.setItem(o,String(c))}catch{}},an=(o,c)=>{switch(o){case"fontSize":typeof c=="number"&&(E.setSubtitleFontSize(c),pe("subtitleFontSize",c));break;case"position":typeof c=="number"&&(E.setSubtitlePosition(c),pe("subtitlePosition",c));break;case"bgOpacity":typeof c=="number"&&(E.setSubtitleBgOpacity(c),pe("subtitleBgOpacity",c));break;case"bgColor":typeof c=="string"&&(E.setSubtitleBgColor(c),pe("subtitleBgColor",c));break;case"textColor":typeof c=="string"&&(E.setSubtitleTextColor(c),pe("subtitleTextColor",c));break;case"edge":(c==="shadow"||c==="outline"||c==="none")&&(E.setSubtitleEdge(c),pe("subtitleEdge",c));break;case"bold":typeof c=="boolean"&&(E.setSubtitleBold(c),pe("subtitleBold",c));break}};v(()=>{const o="tv-player-subtitle-style";let c=document.getElementById(o);c||(c=document.createElement("style"),c.id=o,document.head.appendChild(c));const Ae={fontSize:Ie,position:Me,bgOpacity:Ce,bgColor:Fe,textColor:he,edge:ze,bold:X},Z=N.current,Wt=wn(Ie,We||Z?.clientHeight||720);if(c.textContent=Br({...Ae,fontSize:Wt}),Z){const Ut=()=>{const w=Number(Me);return isNaN(w)?0:Math.max(0,Math.min(100,w))},Tt=(w,z)=>{try{const d=w;d.snapToLines=!1,d.line=z}catch{}},ln=()=>{const w=Wt*16,z=Z.videoHeight||Z.clientHeight||720,d=Z.videoWidth||Z.clientWidth||1280;return{step:w*1.3/z*100,chars:Math.max(20,Math.floor(d/(w*.55)))}},ct=w=>{const z=Math.max(0,Math.min(100,100-Ut())),d=Array.from(w.activeCues??[]);if(d.length<=1){d.forEach(ye=>Tt(ye,z));return}const{step:Ge,chars:Y}=ln();let xt=z;for(let ye=d.length-1;ye>=0;ye--){const dn=String(d[ye].text??"").replace(/<[^>]*>/g,"").split(`
2
- `).reduce((jt,mt)=>jt+Math.max(1,Math.ceil(mt.length/Y)),0),Ht=xt-dn*Ge;Tt(d[ye],Math.max(0,Ht)),xt=Ht-Ge*.4}},Ke=()=>{const w=Math.max(0,Math.min(100,100-Ut()));Array.from(Z.textTracks).forEach(z=>{z.cues&&(Array.from(z.cues).forEach(d=>Tt(d,w)),z.mode==="showing"&&ct(z))})};Ke();const Q=w=>{const z=w.target;z.mode==="showing"&&ct(z)},dt=()=>{Array.from(Z.textTracks).forEach(w=>{w.removeEventListener("cuechange",Q),w.addEventListener("cuechange",Q)}),Ke()};Array.from(Z.textTracks).forEach(w=>{w.addEventListener("cuechange",Q)}),Z.textTracks.addEventListener("addtrack",dt);const ut=Array.from(Z.querySelectorAll("track")),Ye=()=>Ke();return ut.forEach(w=>w.addEventListener("load",Ye)),()=>{Array.from(Z.textTracks).forEach(w=>{w.removeEventListener("cuechange",Q)}),Z.textTracks.removeEventListener("addtrack",dt),ut.forEach(w=>w.removeEventListener("load",Ye))}}},[Ie,Me,Ce,Fe,he,ze,X,B,q,N,We]);const kt=o=>{const c=N.current;!c||isNaN(x.duration)||x.duration===0||(c.currentTime=o*x.duration)},Ue=()=>{N.current&&(E.setIsScrubbing(!0),E.wasPlayingBeforeScrub.current=!N.current.paused,N.current.pause())},oe=o=>{const c=N.current;c&&x.duration&&(c.currentTime=o*x.duration)},Pt=()=>{E.setIsScrubbing(!1),E.wasPlayingBeforeScrub.current&&N.current?.play().catch(()=>{})},$t=o=>{const c=N.current;c&&(c.volume=o,c.muted=o===0,localStorage.setItem("playerVolume",o.toString()))},Rt=()=>{E.toggleMute()},Be=q.length>0,y=B>=0,u=()=>{J("main"),E.setShowControls(!0)},ie=()=>{if(y){i(-1);return}let o=null;try{o=localStorage.getItem("tvLastSubtitle")}catch{}i(In(q,{lastKey:o,enabled:!0}))},te=()=>{J(null)},Dt=()=>t(Oe,{children:[re.length>1&&t("button",{className:a.menuItem,onClick:()=>J("quality"),children:[t("span",{children:"Quality"}),t("span",{className:a.currentValue,children:re[se]?.quality||"Auto"})]}),Ve&&K.length>0&&t("button",{className:a.menuItem,onClick:()=>J("server"),children:[t("span",{style:{display:"flex",alignItems:"center",gap:6},children:[t(A,{name:"server",size:12})," Movy Server"]}),t("span",{className:a.currentValue,style:{textTransform:"capitalize"},children:St})]}),Be&&t("button",{className:a.menuItem,onClick:()=>J("subtitles"),children:[t("span",{children:"Subtitles"}),t("span",{className:a.currentValue,children:y?q[B]?.label||q[B]?.language:"Off"})]}),Be&&t("button",{className:a.menuItem,onClick:()=>J("subtitle-style"),children:[t("span",{children:"Subtitle Style"}),t("span",{className:a.currentValue,children:[Ie.toFixed(1),"x · ",Me]})]}),Be&&t("button",{className:a.menuItem,onClick:()=>J("subtitle-timing"),children:[t("span",{children:"Subtitle Timing"}),t("span",{className:a.currentValue,children:Zn(Ct)})]}),$.length>0&&t("button",{className:a.menuItem,onClick:()=>J("audio"),children:[t("span",{children:"Audio Track"}),t("span",{className:a.currentValue,children:$[r]?.label||$[r]?.language})]}),t("button",{className:a.menuItem,onClick:()=>J("av-sync"),children:[t("span",{children:"A/V Sync"}),t("span",{className:a.currentValue,children:_t?`${Mt}ms`:"Off"})]})]}),Ot=()=>t(rn,{classes:{item:a.menuItem,active:a.active},options:re.map((o,c)=>({key:String(c),label:o.quality,selected:c===se})),onSelect:o=>U(Number(o))}),He=()=>t(rn,{classes:{item:a.menuItem,active:a.active},options:[{key:"off",label:"Off",selected:!y},...q.map((o,c)=>({key:String(c),label:o.label||o.language,selected:c===B}))],onSelect:o=>i(o==="off"?-1:Number(o))}),Vt=()=>t(Zr,{classes:{item:a.menuItem,active:a.active},values:{fontSize:Ie,position:Me,bgOpacity:Ce,bgColor:Fe,textColor:he,edge:ze,bold:X},onChange:an}),je=()=>t(js,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},delayMs:Ct,onDelayChange:o=>At?.(o)}),ot=()=>t(qs,{classes:{item:a.menuItem,active:a.active},tracks:$,selected:r,onChange:j}),on=()=>t(rn,{classes:{item:a.menuItem,active:a.active},options:K.map(o=>({key:o,label:t("span",{style:{textTransform:"capitalize"},children:o}),selected:St===o})),onSelect:o=>me?.(o)}),it=()=>t(es,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},enabled:_t,delayMs:Mt,onToggle:o=>sn?.(o),onDelayChange:o=>Bt?.(o),onCalibrate:()=>{J(null),ae?.()}}),ve=x.isMuted?t(A,{name:"volume-mute"}):x.volume<.5?t(A,{name:"volume-down"}):t(A,{name:"volume-up"}),qe=t("div",{className:`${a.controlsOverlay} ${!x.showControls&&!C?a.hidden:""}`,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:t("div",{className:a.topControls,onClick:o=>o.stopPropagation(),children:[t("button",{className:a.backBtn,onClick:f,title:"Back","aria-label":"Back",children:t(A,{name:"chevron-left"})}),t("div",{className:a.videoTitleInfo,children:[t("span",{className:a.animeTitle,children:k}),F&&t("span",{className:a.episodeLabel,children:F})]})]})}),lt=t(Ar,{isPlaying:x.isPlaying,onTogglePlay:E.togglePlay,onSkipBack:()=>E.seek(-10),onSkipForward:()=>E.seek(10)}),ge=t("div",{className:`${a.controlsOverlay} ${!x.showControls&&!C?a.hidden:""}`,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:t("div",{className:a.bottomControls,onClick:o=>o.stopPropagation(),children:[t(Lr,{classes:{container:a.progressBarContainer,scrubbing:a.scrubbing,timeBubble:a.timeBubble,bar:a.progressBar,buffered:a.bufferedBar,watched:a.watchedBar,thumb:a.thumb},videoRef:N,duration:x.duration,formatTime:Tn,isScrubbing:x.isScrubbing,buffered:"full",onSeek:kt,onScrubStart:Ue,onScrubMove:oe,onScrubEnd:Pt,timeLabelRef:Lt}),t("div",{className:a.bottomControlsRow,children:[t("div",{className:a.leftControls,children:[t("button",{className:a.controlBtn,onClick:E.togglePlay,"aria-label":x.isPlaying?"Pause":"Play",children:x.isPlaying?t(A,{name:"pause"}):t(A,{name:"play"})}),t(Pr,{muted:x.isMuted,volume:x.volume,volumeIcon:ve,buttonClassName:a.controlBtn,onToggleMute:Rt,onVolumeChange:$t,onExpandedChange:o=>E.setShowVolumeSlider(o)}),t("span",{className:a.timeDisplay,ref:Lt,children:[Tn(0)," / ",Tn(x.duration)]})]}),t("div",{className:a.rightControls,children:[Be&&t("button",{className:`${a.controlBtn} ${y?a.active:""}`,onClick:ie,"aria-label":y?"Turn subtitles off":"Turn subtitles on",children:t(A,{name:"closed-captioning"})}),t("button",{className:`${a.controlBtn} ${C?a.active:""}`,onClick:()=>C?te():u(),"aria-label":"Settings",children:t(A,{name:"cog"})}),t("button",{className:a.controlBtn,onClick:E.toggleFullscreen,"aria-label":x.isFullscreen?"Exit Fullscreen":"Fullscreen",children:x.isFullscreen?t(A,{name:"compress"}):t(A,{name:"expand"})})]})]})]})}),Ft=C?t("div",{"data-speed-boost-ignore":"true",onClick:o=>o.stopPropagation(),children:t(Xr,{classes:{panel:a.settingsPanel,header:a.settingsHeader,backBtn:a.settingsBackBtn,title:a.settingsTitle,content:a.settingsContent},title:C==="main"?"Settings":C==="subtitle-style"?"Subtitle Style":C==="subtitle-timing"?"Subtitle Timing":C==="audio"?"Audio Track":C==="server"?"Movy Server":C==="av-sync"?"A/V Sync":C.charAt(0).toUpperCase()+C.slice(1),onBack:()=>C==="main"?te():J("main"),children:[C==="main"&&Dt(),C==="quality"&&Ot(),C==="subtitles"&&He(),C==="subtitle-style"&&Vt(),C==="subtitle-timing"&&je(),C==="audio"&&ot(),C==="server"&&on(),C==="av-sync"&&it()]})}):null,zt=x.isSpeedBoostActive?t("div",{className:a.speedBoostBadge,"aria-hidden":"true",children:[t("span",{children:"2x"}),t(A,{name:"forward",size:12})]}):null;return t($r,{player:h,topBar:qe,centerControls:lt,bottomBar:ge,settingsPanel:Ft,overlays:zt,isInteracting:!!C,className:x.isFullscreen?a.fullscreenFlat:"",children:ue})};function Ys(h,k,F){const $=()=>{const j=Array.isArray(h.audioTracks)?h.audioTracks.length:0,q=F.getWant(),B=j>0?Math.min(Math.max(0,q),j-1):q;h.audioTrack=B,B!==q&&F.onResolve(B)},r=(j,q)=>{const B=F.getWant(),i=Array.isArray(h.audioTracks)?h.audioTracks.length:0;if(q.id!==B&&B>=0&&B<i){h.audioTrack!==B&&(h.audioTrack=B);return}F.onResolve(q.id)};return h.on(k.MANIFEST_PARSED,$),h.on(k.AUDIO_TRACK_SWITCHED,r),()=>{h.off(k.MANIFEST_PARSED,$),h.off(k.AUDIO_TRACK_SWITCHED,r)}}const Gs="_page_263ma_1",Js="_header_263ma_7",Qs="_pageTitle_263ma_11",Xs="_searchForm_263ma_21",Zs="_searchInput_263ma_27",ea="_searchBtn_263ma_42",ta="_suggestions_263ma_58",na="_suggestionPill_263ma_65",ra="_statusMsg_263ma_81",sa="_error_263ma_87",aa="_textOnly_263ma_91",oa="_spinner_263ma_96",ia="_spin_263ma_96",la="_grid_263ma_110",ca="_skeletonCard_263ma_116",da="_skeletonThumb_263ma_121",ua="_skeletonLine_263ma_127",ma="_shimmer_263ma_134",ha="_backBtn_263ma_154",pa="_meta_263ma_172",ga="_headerActions_263ma_180",fa="_watchlistBtn_263ma_187",ba="_active_263ma_205",va="_year_263ma_215",ya="_rating_263ma_220",Sa="_typeBadge_263ma_229",_a="_tv_263ma_237",Ca="_movie_263ma_242",ka="_tvSeries_263ma_247",Ta="_tvMiniSeries_263ma_252",xa="_overview_263ma_257",Ea="_controls_263ma_264",Na="_controlLabel_263ma_272",wa="_select_263ma_282",Ia="_playerSection_263ma_293",Ma="_video_263ma_297",Ba="_videoHidden_263ma_319",Aa="_delayCanvas_263ma_324",La="_delayCanvasActive_263ma_337",Pa="_subtitleOverlay_263ma_341",$a="_videoIframe_263ma_360",Ra="_retryButton_263ma_368",Da="_sidebarSeason_263ma_383",Oa="_mobileSeasonRow_263ma_399",Va="_sidebarPosterCard_263ma_413",Fa="_sidebarPosterMeta_263ma_428",za="_providerSelectWrap_263ma_445",Wa="_genreRow_263ma_457",Ua="_genreChip_263ma_464",Ha="_metaRow_263ma_474",ja="_detailGrid_263ma_483",qa="_detailItem_263ma_490",Ka="_imdbLink_263ma_512",m={page:Gs,header:Js,pageTitle:Qs,searchForm:Xs,searchInput:Zs,searchBtn:ea,suggestions:ta,suggestionPill:na,statusMsg:ra,error:sa,textOnly:aa,spinner:oa,spin:ia,grid:la,skeletonCard:ca,skeletonThumb:da,skeletonLine:ua,shimmer:ma,backBtn:ha,meta:pa,headerActions:ga,watchlistBtn:fa,active:ba,year:va,rating:ya,typeBadge:Sa,tv:_a,movie:Ca,tvSeries:ka,tvMiniSeries:Ta,overview:xa,controls:Ea,controlLabel:Na,select:wa,playerSection:Ia,video:Ma,videoHidden:Ba,delayCanvas:Aa,delayCanvasActive:La,subtitleOverlay:Pa,videoIframe:$a,retryButton:Ra,sidebarSeason:Da,mobileSeasonRow:Oa,sidebarPosterCard:Va,sidebarPosterMeta:Fa,providerSelectWrap:za,genreRow:Wa,genreChip:Ua,metaRow:Ha,detailGrid:ja,detailItem:qa,imdbLink:Ka},Ya=[],lo=()=>{const{id:h}=Er(),[k]=Nr(),F=wr(),$=k.get("type"),[r,j]=b(null),[q,B]=b(!1),[i,re]=b(()=>parseInt(k.get("s")||"1",10)||1),[se,U]=b([]),[f,ue]=b(()=>parseInt(k.get("e")||"1",10)||1),[K,St]=b(()=>{try{return localStorage.getItem("tvProvider")||""}catch{return""}}),[me,Ve]=b([]),{options:_t,isFallback:sn,isLoading:Mt}=ns(),Bt=Ee(()=>_t.filter(e=>(e.kind??"tv")==="tv").map(e=>({id:e.value,label:e.label,tier:e.tier==="embed"?"embed":"direct",servers:e.servers})),[_t]),ae=sn||Bt.length===0?Ya:Bt,Ct=ae.filter(e=>e.tier==="direct"),At=ae.filter(e=>e.tier==="embed"),[x,we]=b(!1),[E,N]=b(""),[Ie,Me]=b([]),[Ce,Fe]=b(0),[he,ze]=b([]),[X,C]=b(-1),[J,Lt]=b("all"),[We,at]=b(0),[pe,an]=b(""),[kt,Ue]=b(""),[oe,Pt]=b(()=>{try{return localStorage.getItem("movyServer")||""}catch{return""}}),$t=I([]);v(()=>{$t.current=me},[me]);const Rt=I(Ce);v(()=>{Rt.current=Ce},[Ce]);const Be=I(X);v(()=>{Be.current=X},[X]);const y=Rr({skipIntervals:[]}),u=y.refs.videoRef;Dr(y,me.length>0||kt!=="");const ie=I(null),te=I([]),Dt=I(null),Ot=I(null),[He,Vt]=b(()=>{try{const e=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(e)&&e>=0&&e<=500)return Math.round(e)}catch{}return 180}),[je,ot]=b(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[on,it]=b(!1),[ve,qe]=b(!1),lt=I(null),ge=I(null),Ft=(e,n)=>{try{localStorage.setItem("playerVideoDelayMs",String(e)),localStorage.setItem("playerVideoDelayEnabled",String(n))}catch{}},zt=e=>{const n=Math.max(0,Math.min(500,Math.round(e)));Vt(n);try{localStorage.setItem("playerVideoDelayMs",String(n))}catch{}},[o,c]=b(()=>{try{const e=Number(localStorage.getItem("tvSubtitleDelayMs"));if(Number.isFinite(e)&&e>=-1e4&&e<=1e4)return Math.round(e)}catch{}return 0}),Ae=I(o);Ae.current=o;const Z=T(e=>{const n=Math.max(-1e4,Math.min(1e4,Math.round(e)));if(Ae.current!==n){Ae.current=n,c(n);try{localStorage.setItem("tvSubtitleDelayMs",String(n))}catch{}}},[]),Wt=()=>{lt.current={enabled:je,ms:He},ot(!0);try{localStorage.setItem("playerVideoDelayEnabled","true")}catch{}it(!0)},Ut=()=>{const e=lt.current;lt.current=null,e&&(Vt(e.ms),ot(e.enabled),Ft(e.ms,e.enabled)),qe(!1),it(!1)},Tt=()=>{lt.current=null,ot(!0),Ft(He,!0),qe(!1),it(!1)},ln=()=>{if(ve){qe(!1);return}const e=u.current;e&&!isNaN(e.currentTime)&&(ge.current=e.currentTime),qe(!0)},ct=je?He:0;Or({videoRef:u,canvasRef:Dt,delayMs:ct,enabled:je});const Ke=je,Q=Ke||o!==0,dt=I(Q);dt.current=Q;const ut=T(()=>{if(!dt.current)return;const e=u.current;e&&Array.from(e.textTracks).forEach(n=>{n.mode!=="hidden"&&(n.mode="hidden")})},[u]),{hasConsent:Ye,grant:w}=ts(),z=I("");z.current||(z.current=`tv-${Date.now()}-${Math.random().toString(36).slice(2)}`);const d=$==="movie",Ge=h?rs($||"tv",h):"",Y=Ge,xt=ss(),ye=as(),{toggle:cn,bookmarkedIds:dn,pending:Ht}=os(),{data:jt}=is(r?Ge:void 0),mt=jt?!!jt.inLibrary:Ge?dn.has(Ge):!1,er=T(()=>{!r||!h||cn({tmdbId:Number(h),mediaType:$||"tv",title:r.title,poster:r.poster,year:r.year,adult:r.adult})},[r,h,$,cn]),{data:Je,isFetched:Mn}=ls(Y||void 0,i,f),qt=Ee(()=>se.map(e=>e.episode_number).sort((e,n)=>e-n),[se]),Qe=qt.indexOf(f),un=Qe>0?qt[Qe-1]:null,P=Qe>=0&&Qe<qt.length-1?qt[Qe+1]:null,Kt=Ee(()=>(r?.seasons??[]).map(e=>e.season_number).filter(e=>Number.isFinite(e)).sort((e,n)=>e-n),[r]),fe=Ee(()=>{if(d||P!=null)return null;const e=Kt.indexOf(i);return e>=0&&e<Kt.length-1?Kt[e+1]:(r?.number_of_seasons??0)>i?i+1:null},[d,P,Kt,i,r?.number_of_seasons]),Bn=Je?.currentTime??0,An=Je?.duration??0,mn=Je?.completed===!0||Je?.completed===1||xn(Bn,An),[Le,Ne]=b(!1),ke=I(!1);v(()=>{ke.current=!1,Ne(!1)},[Y,i,f]);const[Pe,Yt]=b(!1),[ht,Ln]=b(0),[Xe,Pn]=b(!1),[pt,Ze]=b(!1),[tr,$n]=b(""),[Gt,nr]=b(!1),[rr,hn]=b(!1),sr=ms(),[gt,ar]=b(Vr),or=T(e=>{ar(e),Fr(e)},[]),le=I(!1),et=I(null),pn=I(0),Rn=I(!1),Dn=I(0),ee=I(null),On=I(""),ir=Qn(Bn,An),Et=!le.current&&!ke.current&&(Pe||Le||pt||mn||ir),ft=I(Et);ft.current=Et;const bt=I(!1);v(()=>{bt.current=Xe},[Xe]);const lr=e=>{const n=Math.floor(e/3600),s=Math.floor(e%3600/60),l=Math.floor(e%60);return n>0?`${n}:${String(s).padStart(2,"0")}:${String(l).padStart(2,"0")}`:`${s}:${String(l).padStart(2,"0")}`},$e=T((e,n)=>{if(!Y||!n||n<30)return;const s=xn(e,n),l=s?n:e;Math.abs(l-pn.current)<10&&!s||(pn.current=l,xt.mutate({mediaId:Y,season:i,episode:f,currentTime:Math.floor(l),duration:Math.floor(n),completed:s,title:r?.title??null,poster:r?.poster??null,backdrop:r?.backdrop??null,year:r?.year??null,overview:r?.overview??null,tmdbId:r?.id??null,mediaType:$||"tv",adult:r?.adult?1:0}))},[Y,i,f,xt,r,$]),Te=T((e,n)=>{qe(!1),it(!1);const s=new URLSearchParams(k);s.set("type",k.get("type")||"tv"),s.set("s",String(e)),s.set("e",String(n)),F(`${window.location.pathname}?${s.toString()}`)},[k,F]),cr=T(()=>{if(ve)return;const e=u.current;!e||e.paused||e.ended||(et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{$e(e.currentTime,e.duration||0)},5e3))},[$e,u,ve]),dr=T(()=>{const e=u.current;if(!e||!r)return;et.current&&clearTimeout(et.current),$e(e.currentTime,e.duration||0),Rn.current=!0;const n=zr({seekInduced:Date.now()-Dn.current<Wr,autoplayEnabled:gt,hasNext:!d&&P!=null,isFinal:d||P==null});n==="advance"&&P!=null?(ue(P),Te(i,P)):n==="prompt-next"?(ke.current=!1,le.current=!0,Ne(!0)):n==="prompt-complete"&&($n(d?r.title:`${r.title} — Season ${i}`),Ze(!0),ke.current=!0,le.current=!0)},[d,r,i,P,gt,$e,Te,u]),ur=T(()=>{Rn.current=!1,y.actions.onPlay()},[y.actions]),mr=T(()=>{y.actions.onPause();const e=u.current;e&&!e.ended&&$e(e.currentTime,e.duration||0)},[y.actions,$e,u]),hr=T(()=>{y.actions.onLoadedMetadata();const e=u.current;if(e){try{const n=parseFloat(localStorage.getItem("playerVolume")||"");isNaN(n)||(e.volume=Math.max(0,Math.min(1,n))),e.muted=localStorage.getItem("playerMuted")==="true"}catch{}if(ee.current!=null&&ee.current>0){try{e.currentTime=ee.current}catch{}ee.current=null}}},[y.actions,u]),vt=T(()=>{const e=u.current;if(e&&ee.current!=null&&ee.current>0){try{e.currentTime=ee.current}catch{}ee.current=null}},[u]),pr=T(()=>{ht>0&&(ee.current=ht);const e=u.current;if(e&&ht>0){try{e.currentTime=ht,ee.current=null}catch{}e.play().catch(()=>{})}Yt(!1),le.current=!0},[ht,u]),Vn=T(()=>{ee.current=null;const e=u.current;e&&(e.currentTime=0,e.play().catch(()=>{})),Yt(!1),le.current=!0},[u]),gr=T(()=>{ke.current=!0,Ne(!1),le.current=!0},[]),fr=T(()=>{ke.current=!0,Ne(!1),le.current=!0,ee.current=null;const e=u.current;if(e){try{e.currentTime=0}catch{}e.play().catch(()=>{})}},[u]),br=T(()=>{P!=null&&(ke.current=!0,Ne(!1),le.current=!0,ue(P),Te(i,P))},[P,i,Te]),Fn=T(()=>{fe!=null&&(ke.current=!0,Ne(!1),Ze(!1),le.current=!0,re(fe),ue(1),Te(fe,1))},[fe,Te]),vr=T(async()=>{if(Y)try{await ye.mutateAsync({id:Y,status:"Completed"}),Ze(!1),Ne(!1),F("/")}catch{}},[Y,ye,F]);v(()=>{le.current=!1,Yt(!1),Ln(0),Pn(!1),bt.current=!1,ee.current=null,On.current=`${Y}:${i}:${f}`,pn.current=0},[Y,i,f]),v(()=>{Mn&&(Pn(!0),bt.current=!0)},[Mn,Y,i,f]),v(()=>{if(!Je||le.current)return;const e=Je,n=e.currentTime??0,s=e.duration??0;Qn(n,s)&&(Ln(n),Yt(!0))},[Je,Y,i,f]),v(()=>{if(!(!Xe||le.current||ke.current)&&!(Pe||pt||Le)&&mn){if(d){Ne(!0);return}if(!(!r||Qe<0||se.length===0)){if(P==null&&fe==null){r&&se.length>0&&($n(`${r.title} — Season ${i}`),Ze(!0),ke.current=!0,le.current=!0);return}Ne(!0)}}},[Xe,mn,Pe,pt,Le,d,P,fe,r,Qe,se.length,Y,i,f]),v(()=>{(Pe||Le)&&u.current&&u.current.pause()},[Pe,Le,u]),v(()=>{const e=u.current;return()=>{et.current&&clearTimeout(et.current),e&&!e.ended&&$e(e.currentTime,e.duration||0)}},[$e,u]);const gn=T(e=>{let n=null,s=!0;try{n=localStorage.getItem("tvLastSubtitle"),s=localStorage.getItem("tvSubtitlesEnabled")!=="false"}catch{}return In(e,{lastKey:n,enabled:s})},[]),fn=T(e=>{if(!(e<0))try{localStorage.setItem("tvSubtitlesEnabled","true"),localStorage.setItem("tvSelectedSubtitle",String(e))}catch{}},[]),zn=T(e=>{if(e.length===0)return 0;let n=null;try{n=localStorage.getItem("tvLastAudio")}catch{}if(n){const s=e.findIndex(S=>En(S)===n);if(s>=0)return s;const l=n.indexOf("|||"),p=l>=0?n.slice(0,l):n,R=l>=0?n.slice(l+3):n,g=e.findIndex(S=>S.language===p||S.label===R);if(g>=0)return g}return In(e,{lastKey:null,enabled:!0})},[]),bn=Ee(()=>ae.find(e=>e.id===K),[ae,K]),W=bn?.tier==="embed",ne=Ee(()=>bn?.servers??[],[bn]),{data:Wn}=cs(Y||void 0),Un=Ee(()=>(Wn?.progress??[]).filter(n=>n.season===i&&(n.completed===!0||n.completed===1||xn(n.currentTime,n.duration))).map(n=>String(n.episode)),[Wn,i]),Hn=Ee(()=>se.map(e=>({id:String(e.episode_number),label:`Episode ${e.episode_number}`,sublabel:e.name||void 0,thumbnail:e.still_path?`https://image.tmdb.org/t/p/w185${e.still_path}`:void 0})),[se]),jn=Ee(()=>(r?.genres??[]).map(e=>e.name).slice(0,5),[r]),vn=Ee(()=>[r?.year,r?.status,r?.number_of_seasons?`${r.number_of_seasons} Season${r.number_of_seasons>1?"s":""}`:null,r?.number_of_episodes?`${r.number_of_episodes} Episodes`:null].filter(Boolean),[r]);v(()=>{if(ae.length!==0&&!ae.some(e=>e.id===K)){const e=ae.find(n=>n.tier==="direct")?.id??ae[0].id;St(e);try{localStorage.setItem("tvProvider",e)}catch{}}},[ae,K]),v(()=>{if(ne.length!==0&&!ne.includes(oe)){Pt(ne[0]);try{localStorage.setItem("movyServer",ne[0])}catch{}}},[ne,oe]),v(()=>{if(!h){j(null),Ve([]),N(""),Ue("");return}const e=Number(h),n=$||"tv";B(!0),j(null),Ve([]),N(""),Ue("");const s=parseInt(k.get("s")||"",10),l=parseInt(k.get("e")||"",10);re(isNaN(s)?1:s),ue(isNaN(l)?1:l),at(0),fetch(`/api/tv/details/${n}/${e}`).then(p=>p.json()).then(p=>{j(p),B(!1),p.seasons&&p.seasons.length>0&&isNaN(s)&&re(p.seasons[0].season_number)}).catch(()=>{B(!1)})},[h,$,k]),v(()=>{if(!r||!h)return;if(!(r.seasons!==void 0||r.number_of_seasons!==void 0)){U([]);return}const n=parseInt(k.get("e")||"",10);fetch(`/api/tv/episodes/${h}/${i}`).then(s=>s.json()).then(s=>{if(U(s.episodes||[]),s.episodes?.length>0){const l=!isNaN(n)&&s.episodes.find(p=>p.episode_number===n)?n:s.episodes[0].episode_number;ue(l)}}).catch(()=>{})},[r,h,i,k]),v(()=>{!r||!h||d||fetch(`/api/tv/episodes/${h}/${i}`).then(e=>e.json()).then(e=>{const n=e.episodes||[];U(n),n.length>0&&!n.find(s=>s.episode_number===f)&&ue(n[0].episode_number)}).catch(()=>{})},[i,r,h,d,f]),v(()=>{if(!W||!r||!h)return;fetch(`/api/tv/embed/${K}/${d?"movie":"tv"}/${h}?season=${i}&episode=${f}`).then(n=>n.json()).then(n=>{if(n.url)return Ue(n.url),fetch(`/api/resolve?url=${encodeURIComponent(n.url)}`).then(s=>s.json()).then(s=>{s.finalUrl&&Ue(s.finalUrl)})}).catch(()=>{})},[K,r,h,i,f,d,W]);const Jt=T(async()=>{if(!r||!h||!K||W||r.adult&&!Ye)return;$t.current.length>0?N(""):(we(!0),N(""),Ve([]),at(0),Me([]),ze([]));try{const n=d?"movie":"tv",s=new URLSearchParams({title:r.title||"",year:r.year||"",season:String(i),episode:String(f),totalSeasons:String(r.number_of_seasons||1),imdbId:r.imdb_id||""});ne.length>0&&oe&&s.set("server",oe);const p=await(await fetch(`/api/tv/sources/${K}/${n}/${h}?${s.toString()}`)).json();if(we(!1),!p.valid||!p.sources?.length){N(p.error?`${p.error}`:ne.length>0?`No streams from ${oe}. Try another server.`:"No streams available.");return}Ve(p.sources),Lt("all"),at(0),p.referer&&an(p.referer);const R=p.audioTracks||[];Me(R),Fe(R.length>0?zn(R):0);const g=p.subtitles||[];if(ze(g),g.length>0){const H=gn(g);C(H),fn(H)}else C(-1);fetch(`/api/tv/subtitles/${n}/${h}?season=${i}&episode=${f}`).then(H=>H.json()).then(H=>{const Se=Array.isArray(H.subtitles)?H.subtitles:[];Se.length!==0&&ze(L=>{const M=[...L,...Se.filter(_=>!L.some(D=>D.url===_.url))];if(L.length===0){const _=gn(M);C(_),fn(_)}return M})}).catch(()=>{}),N("")}catch{we(!1),N("Failed to load streams.")}},[r,h,K,i,f,d,W,Ye,ne,oe,gn,fn,zn]),yn=T(e=>{const n=e.toLowerCase();Pt(n);try{localStorage.setItem("movyServer",n)}catch{}N("")},[]),yr=T(e=>{St(e);try{localStorage.setItem("tvProvider",e)}catch{}},[]);v(()=>{K&&r&&!W&&Jt()},[K,r,Jt,W]),v(()=>{if(!u.current||(ie.current&&(ie.current.destroy(),ie.current=null),W))return;let e=!1;if(ve){const g=u.current;return g&&(g.pause(),g.removeAttribute("src"),g.load(),g.src="/av-sync-test.mp4",ft.current||g.play().catch(()=>{})),()=>{e=!0}}const n=J==="all"?me:me.filter(g=>g.type===J),s=n[We]?.url||"";if(!s)return;const l=u.current;if(On.current===`${Y}:${i}:${f}`&&ee.current==null&&!ft.current)try{!l.ended&&l.currentTime>1&&(ee.current=l.currentTime)}catch{}l.pause(),l.removeAttribute("src"),l.load();const p=`/api/tv/stream-proxy?url=${encodeURIComponent(s)}&referer=${encodeURIComponent(pe)}`;n[We]?.type==="hls"?(async()=>{const g=await ds();if(!e)if(g&&g.isSupported()){const S=new g({enableWorker:!0});ie.current=S,S.on(g.Events.ERROR,(L,M)=>{M.fatal&&(N(`Stream failed (${M.details}). Try another source or reload.`),we(!1),S.destroy(),ie.current=null)}),S.loadSource(p),S.attachMedia(l);const H=()=>{let L=!1,M=0;try{L=localStorage.getItem("tvSubtitlesEnabled")==="true";const _=parseInt(localStorage.getItem("tvSelectedSubtitle")||"0",10);!isNaN(_)&&_>=0&&(M=_)}catch{}return{enabled:L,index:M}},Se=()=>{if(typeof S.subtitleTrack!="number")return;if(te.current.length>0){S.subtitleTrack=-1;return}const L=Array.isArray(S.subtitleTracks)?S.subtitleTracks:[];if(L.length===0){S.subtitleTrack=-1;return}const M=H();if(M.enabled){const _=M.index<L.length?M.index:0;S.subtitleTrack=_,C(_),ut()}else S.subtitleTrack=-1};Ys(S,g.Events,{getWant:()=>Rt.current,onResolve:L=>Fe(L)}),S.on(g.Events.MANIFEST_PARSED,()=>{Se(),ge.current!=null&&(l.currentTime=ge.current,ge.current=null),vt(),!ft.current&&bt.current&&l.play().catch(()=>{})}),S.on(g.Events.SUBTITLE_TRACKS_UPDATED,()=>{Se()}),S.on(g.Events.SUBTITLE_TRACK_SWITCH,(L,M)=>{if(te.current.length>0){if(M.id!==-1)try{S.subtitleTrack=-1}catch{}return}const _=Array.isArray(S.subtitleTracks)?S.subtitleTracks:[];if(_.length!==0){if(M.id===-1){const D=H();if(D.enabled){const G=D.index<_.length?D.index:0;S.subtitleTrack=G;return}}C(M.id),ut()}})}else us(l)&&(l.src=p,ge.current!=null&&(l.currentTime=ge.current,ge.current=null),vt(),!ft.current&&bt.current&&l.play().catch(()=>{N("Failed to play stream. Try another source.")}))})():(l.src=p,ge.current!=null&&(l.currentTime=ge.current,ge.current=null),vt(),!ft.current&&bt.current&&l.play().catch(()=>{N("Failed to play stream. Try another source.")}));const R=()=>{const H=l.error?.code===4?"Video source not supported or not found":"Failed to load video stream";N(`${H}. The source may be invalid or expired. Try switching source or reloading.`),we(!1)};return l.addEventListener("error",R),()=>{e=!0,l.removeEventListener("error",R)}},[me,We,J,K,pe,W,u,ve,Y,i,f,vt,ut]),v(()=>{if(!Xe||Pe||Le||pt||Et||W||ve)return;const e=u.current;!e||!e.paused||e.ended||e.readyState<1||(vt(),e.play().catch(()=>{}))},[Xe,Pe,Le,pt,Et,W,ve,vt,u]),v(()=>{const e=ie.current;!e||typeof e.audioTrack!="number"||(e.audioTrack=Ce)},[Ce]),v(()=>{const e=ie.current;!e||typeof e.subtitleTrack!="number"||!Array.isArray(e.subtitleTracks)||e.subtitleTracks.length===0||te.current.length>0||(X>=0?e.subtitleTrack=X:e.subtitleTrack=-1)},[X]),v(()=>{const e=u.current;if(!(!e||W)&&(e.querySelectorAll("track").forEach(n=>n.remove()),te.current=[],he.length!==0&&(he.forEach(n=>{const s=document.createElement("track");s.kind="subtitles",s.label=n.label||n.language||"Unknown",s.srclang=n.language||n.label||"en";const l=`/api/subtitle-proxy?url=${encodeURIComponent(n.url)}&referer=${encodeURIComponent(pe)}`;s.src=l,s.addEventListener("load",()=>{const p=te.current.indexOf(s),R=s.track;if(R&&p>=0){const g=p===Be.current;R.mode=g&&!dt.current?"showing":"hidden"}}),e.appendChild(s),te.current.push(s)}),he.length>0)))try{const n=ie.current;n&&typeof n.subtitleTrack=="number"&&n.subtitleTrack!==-1&&(n.subtitleTrack=-1)}catch{}},[he,pe,W,K,u]),v(()=>{const e=u.current;if(!e||W)return;const n=ie.current;te.current.length>0&&n&&typeof n.subtitleTrack=="number"&&Array.isArray(n.subtitleTracks)&&n.subtitleTracks.length>0&&(n.subtitleTrack=-1);const s=()=>{const R=wn(y.state.subtitleFontSize,e.clientHeight||720),g=Math.max(0,Math.min(100,100-y.state.subtitlePosition)),S=()=>{const _=R*16,D=e.videoHeight||e.clientHeight||720,G=e.videoWidth||e.clientWidth||1280;return{step:_*1.3/D*100,chars:Math.max(20,Math.floor(G/(_*.55)))}},H=(_,D)=>{const G=_;G.snapToLines=!1,G.line=D},Se=_=>{if(!_.cues)return;Array.from(_.cues).forEach(ce=>H(ce,g));const D=Array.from(_.activeCues??[]);if(D.length<=1){D.forEach(ce=>H(ce,g));return}const{step:G,chars:O}=S();let tt=g;for(let ce=D.length-1;ce>=0;ce--){const Re=String(D[ce].text??"").replace(/<[^>]*>/g,"").split(`
3
- `).reduce((Zt,wt)=>Zt+Math.max(1,Math.ceil(wt.length/O)),0);tt=Math.max(0,tt-Re*G),H(D[ce],tt),tt-=G*.4}},L=te.current;if(L.length>0){L.forEach((_,D)=>{const G=_.track;if(!G)return;const O=D===X;G.mode=O&&!Q?"showing":"hidden",O&&!Q&&Se(G)});return}const M=Array.from(e.textTracks);M.length!==0&&M.forEach((_,D)=>{const G=D===X;_.mode=G&&!Q?"showing":"hidden",G&&!Q&&Se(_)})};s();const l=()=>s();e.textTracks.addEventListener("addtrack",l),e.addEventListener("loadedmetadata",s,{once:!0});const p=window.setTimeout(s,600);return()=>{e.textTracks.removeEventListener("addtrack",l),e.removeEventListener("loadedmetadata",s),window.clearTimeout(p)}},[X,he,W,K,u,Q,y.state.subtitleFontSize,y.state.subtitlePosition]),v(()=>{if(!Q)return;const e=u.current,n=Ot.current;if(!e||!n)return;const s=o/1e3,l=ct/1e3,p=new Set;let R=[],g=-1,S=-1,H=-1,Se=-1,L=0,M=0,_=!1;const D=()=>{const V=Be.current;if(V<0)return null;const De=te.current;return De.length>0?De[V]?.track??null:Array.from(e.textTracks)[V]??null},G=(V,De)=>{const de=V.cues;if(!de||de.length===0)return Array.from(V.activeCues??[]);let nt=0,rt=de.length;for(;nt<rt;){const xe=nt+rt>>>1;de[xe].endTime+s<De?nt=xe+1:rt=xe}const It=[];for(let xe=nt;xe<de.length;xe++){const en=de[xe];if(en.startTime+s>De)break;en.endTime+s>=De&&It.push(en)}return It},O=()=>{const V=D(),De=e.currentTime-l,de=V?G(V,De):[],nt=e.clientWidth,rt=e.clientHeight,It=e.videoWidth,xe=e.videoHeight;if(de.length===R.length&&de.every((_n,Cn)=>_n===R[Cn])&&nt===g&&rt===S&&It===H&&xe===Se||(R=de,g=nt,S=rt,H=It,Se=xe,n.textContent="",de.length===0))return;const Gn={fontSize:wn(y.state.subtitleFontSize,rt),position:y.state.subtitlePosition,bgOpacity:y.state.subtitleBgOpacity,bgColor:y.state.subtitleBgColor,textColor:y.state.subtitleTextColor,edge:y.state.subtitleEdge,bold:y.state.subtitleBold},kr=Ur(Gn),Tr=Hr(e,Gn.position);de.forEach((_n,Cn)=>{const Jn=String(_n.text??"");if(!jr(Jn).trim())return;const kn=document.createElement("div"),xr=(de.length-1-Cn)*1.7;kn.style.cssText=`${kr}
4
- bottom: calc(${Tr}px + ${xr}em);`,kn.innerHTML=qr(Jn),n.appendChild(kn)})},tt=()=>{Array.from(e.textTracks).forEach(V=>{p.has(V)||(p.add(V),V.addEventListener("cuechange",O))})},ce=()=>{tt(),O()},Sn=()=>{if(_||M)return;const V=()=>{M=0,!(_||e.paused||e.ended)&&(O(),Sn())};M=window.requestAnimationFrame(V)},Re=e,Zt=()=>{L=0,O(),!_&&Re.requestVideoFrameCallback&&(L=Re.requestVideoFrameCallback(Zt))},wt=()=>{O(),Re.requestVideoFrameCallback?L||(L=Re.requestVideoFrameCallback(Zt)):Sn()};tt(),e.textTracks.addEventListener("addtrack",ce),e.textTracks.addEventListener("removetrack",ce),e.addEventListener("timeupdate",O),e.addEventListener("seeked",O),e.addEventListener("loadedmetadata",O),e.addEventListener("play",wt);const Kn=Array.from(e.querySelectorAll("track"));Kn.forEach(V=>V.addEventListener("load",O));const Yn=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>O());return Yn?.observe(e),O(),wt(),()=>{_=!0,p.forEach(V=>V.removeEventListener("cuechange",O)),e.textTracks.removeEventListener("addtrack",ce),e.textTracks.removeEventListener("removetrack",ce),e.removeEventListener("timeupdate",O),e.removeEventListener("seeked",O),e.removeEventListener("loadedmetadata",O),e.removeEventListener("play",wt),Kn.forEach(V=>V.removeEventListener("load",O)),Yn?.disconnect(),M&&window.cancelAnimationFrame(M),L&&Re.cancelVideoFrameCallback&&Re.cancelVideoFrameCallback(L),n.textContent=""}},[Q,o,X,he,ct,u,y.state.subtitleFontSize,y.state.subtitlePosition,y.state.subtitleBgOpacity,y.state.subtitleBgColor,y.state.subtitleTextColor,y.state.subtitleEdge,y.state.subtitleBold]);const Qt=()=>{j(null),Ve([]),Ue(""),F(-1)},Sr=T(e=>{re(e),ue(1),Te(e,1)},[Te]),Xt=!d&&r?.seasons&&r.seasons.length>1?t("label",{className:m.sidebarSeason,children:[t("span",{children:"Season"}),t("select",{value:i,onChange:e=>Sr(parseInt(e.target.value,10)||1),className:m.select,children:r.seasons.map(e=>t("option",{value:e.season_number,children:["Season ",e.season_number," (",e.episode_count," ep)"]},e.season_number))})]}):null,yt=T(e=>{const n=parseInt(e,10);isNaN(n)||(ue(n),Te(i,n)),hn(!1)},[i,Te]);v(()=>{if(d)return;const e=n=>{n.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||n.key.toLowerCase()==="n"&&(P!=null?yt(String(P)):Ir.error("No next episode available"))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[d,P,yt]);const _r=e=>{Fe(e);try{const s=Ie[e];s&&localStorage.setItem("tvLastAudio",En(s))}catch{}const n=ie.current;n&&n.audioTrack!==void 0&&(n.audioTrack=e)},Cr=e=>{C(e);try{if(e===-1)localStorage.setItem("tvSubtitlesEnabled","false");else{localStorage.setItem("tvSubtitlesEnabled","true"),localStorage.setItem("tvSelectedSubtitle",String(e));const p=he[e];p&&localStorage.setItem("tvLastSubtitle",En(p))}}catch{}const n=u.current,s=ie.current;if(s&&typeof s.subtitleTrack=="number"&&Array.isArray(s.subtitleTracks)&&s.subtitleTracks.length>0&&(s.subtitleTrack=te.current.length>0||e<0?-1:e),!n)return;const l=te.current;if(l.length>0){l.forEach((p,R)=>{const g=p.track;if(!g)return;const S=R===e;g.mode=S&&!Q?"showing":"hidden"});return}Array.from(n.textTracks).forEach((p,R)=>{const g=R===e;p.mode=g&&!Q?"showing":"hidden"})},Nt=T(()=>{if(!r)return;const e=u.current,n=d?"":`S${String(i).padStart(2,"0")}E${String(f).padStart(2,"0")}`;fetch("/api/discord/tv",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r.title,episodeLabel:n,isPlaying:e?!e.paused&&!e.ended:!0,thumbnail:r.poster,currentTime:e?e.currentTime:0,duration:e&&e.duration||0,isAdult:r.adult===!0,sessionId:z.current})}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:z.current})}).catch(()=>{})},[r,d,i,f,u]);v(()=>{if(!r)return;Nt();const e=window.setInterval(()=>{const n=u.current;(!n||!n.paused)&&Nt()},15e3);return()=>window.clearInterval(e)},[Nt,r,u]),v(()=>{if(!r||W||x||E||me.length===0)return;const e=u.current;if(!e)return;const n=()=>Nt();return e.addEventListener("play",n),e.addEventListener("pause",n),e.addEventListener("seeked",n),()=>{e.removeEventListener("play",n),e.removeEventListener("pause",n),e.removeEventListener("seeked",n)}},[r,W,x,E,me,Nt,u]),v(()=>{const e=z.current,n=()=>{const l=JSON.stringify({sessionId:e});navigator.sendBeacon?(navigator.sendBeacon("/api/discord/clear",new Blob([l],{type:"application/json"})),navigator.sendBeacon("/api/discord/heartbeat",new Blob([JSON.stringify({sessionId:e,bye:!0})],{type:"application/json"}))):fetch("/api/discord/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:l,keepalive:!0}).catch(()=>{})},s=()=>n();return window.addEventListener("pagehide",s),window.addEventListener("beforeunload",s),()=>{window.removeEventListener("pagehide",s),window.removeEventListener("beforeunload",s),n()}},[]);const qn=J==="all"?me:me.filter(e=>e.type===J);return v(()=>{if(!r){document.title="TV & Movies - dango";return}document.title=d?`${r.title} - dango`:`${r.title} - Season ${i} Episode ${f} - dango`},[r,d,i,f]),v(()=>{if(!r||d)return;const e=new URLSearchParams(k),n=e.get("s"),s=e.get("e"),l=String(i),p=String(f);n===l&&s===p||(e.set("type",k.get("type")||"tv"),e.set("s",l),e.set("e",p),F(`${window.location.pathname}?${e.toString()}`,{replace:!0}))},[r,d,i,f,k,F]),t("div",{className:st.playerPageLayout,children:[t("aside",{className:st.episodeSidebar,children:r?d?t("div",{className:m.sidebarPosterCard,children:[r.poster&&t("img",{src:`https://image.tmdb.org/t/p/w342${r.poster}`,alt:r.title,loading:"lazy",decoding:"async"}),t("div",{className:m.sidebarPosterMeta,children:[t("strong",{children:r.title}),t("span",{children:r.year})]})]}):t(Kr,{episodes:Hn,currentEpisode:String(f),watchedEpisodes:Un,onEpisodeClick:yt,header:Xt}):d?t("div",{className:m.statusMsg,children:[t(A,{name:"spinner",className:m.spinner})," Loading..."]}):t(Yr,{variant:"sidebar"})}),t("div",{className:st.playerMain,children:[r&&t("div",{className:m.playerSection,onContextMenu:e=>e.preventDefault(),style:r.adult&&!Ye?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:[x&&!W&&t("div",{className:m.statusMsg,children:[t(A,{name:"spinner",className:m.spinner})," Loading stream..."]}),W&&kt?t("iframe",{src:kt,className:m.videoIframe,allow:"autoplay; fullscreen",allowFullScreen:!0}):!W&&!x&&qn.length>0?t(Oe,{children:[E&&t("div",{className:`${m.statusMsg} ${m.error}`,style:{flexDirection:"column",alignItems:"stretch",gap:8},children:[t("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t("span",{style:{flex:1},children:E}),t("button",{className:m.retryButton,onClick:Jt,children:"Retry"})]}),ne.length>0&&t("div",{style:{display:"flex",flexWrap:"wrap",gap:6,alignItems:"center",marginTop:4},children:[t("span",{style:{fontSize:"0.8rem",opacity:.9,fontWeight:600},children:"Servers:"}),ne.map(e=>t("button",{onClick:()=>yn(e),className:m.retryButton,style:{padding:"4px 8px",fontSize:"0.75rem",textTransform:"capitalize",background:oe===e?"var(--accent)":void 0,color:oe===e?"white":void 0},children:e},e))]})]}),t(Ks,{player:y,title:r.title,episodeLabel:d?void 0:`S${i} E${f}`,audioTracks:Ie,selectedAudioTrack:Ce,onAudioTrackChange:_r,subtitles:he,selectedSubtitle:X,onSubtitleChange:Cr,streams:qn,qualityIdx:We,onQualityChange:at,onBack:Qt,movyServers:ne,selectedMovyServer:oe,onMovyServerSelect:yn,isMovySource:ne.length>0,videoDelayEnabled:je,onVideoDelayToggle:e=>{ot(e);try{localStorage.setItem("playerVideoDelayEnabled",String(e))}catch{}},videoDelayMs:He,onVideoDelayChange:zt,onCalibrateAvSync:Wt,subtitleDelayMs:o,onSubtitleDelayChange:Z,children:[t("video",{ref:u,autoPlay:Xe&&!Et,playsInline:!0,disablePictureInPicture:!0,className:`${m.video} ${Ke?m.videoHidden:""}`,onTimeUpdate:cr,onEnded:()=>{ve||dr()},onPlay:ur,onPause:mr,onSeeked:()=>{Dn.current=Date.now()},onLoadedMetadata:hr,onVolumeChange:y.actions.onVolumeChange,onContextMenu:e=>e.preventDefault(),onError:()=>{N("Video failed to load. Try another server or reload."),we(!1)}}),t("canvas",{ref:Dt,className:`${m.delayCanvas} ${Ke?m.delayCanvasActive:""}`}),Q&&t("div",{ref:Ot,className:m.subtitleOverlay}),t(Gr,{isOpen:on,ms:He,onChange:zt,onApply:Tt,onClose:Ut,testClipActive:ve,onTestClip:ln})]})]}):E&&!W?t("div",{className:`${m.statusMsg} ${m.error}`,style:{flexDirection:"column",alignItems:"stretch",gap:8},children:[t("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t("span",{style:{flex:1},children:E}),t("button",{className:m.retryButton,onClick:Jt,children:"Retry"})]}),ne.length>0&&t("div",{style:{display:"flex",flexWrap:"wrap",gap:6,alignItems:"center",marginTop:4},children:[t("span",{style:{fontSize:"0.8rem",opacity:.9,fontWeight:600},children:"Servers:"}),ne.map(e=>t("button",{onClick:()=>yn(e),className:m.retryButton,style:{padding:"4px 8px",fontSize:"0.75rem",textTransform:"capitalize",background:oe===e?"var(--accent)":void 0,color:oe===e?"white":void 0},children:e},e))]})]}):null]}),r&&t(Jr,{showTheater:!1}),Xt&&t("div",{className:m.mobileSeasonRow,children:Xt}),r&&t("div",{className:m.providerSelectWrap,children:t("label",{className:m.controlLabel,children:["Source",t("select",{value:K,onChange:e=>yr(e.target.value),className:m.select,disabled:ae.length===0,children:Mt?t("option",{value:"",children:"Loading…"}):ae.length===0?t("option",{value:"",children:"No providers available"}):t(Oe,{children:[Ct.length>0&&t("optgroup",{label:"Direct HLS",children:Ct.map(e=>t("option",{value:e.id,children:e.label},e.id))}),At.length>0&&t("optgroup",{label:"Embeds",children:At.map(e=>t("option",{value:e.id,children:e.label},e.id))})]})})]})}),r&&t("div",{className:st.playerInfoContainer,children:[t("div",{className:st.playerInfoHeader,children:[t("div",{className:st.playerAnimeCard,children:r.poster&&t("img",{src:`https://image.tmdb.org/t/p/w342${r.poster}`,alt:r.title,loading:"lazy",decoding:"async"})}),t("div",{className:st.videoTitleSection,children:[t("div",{className:be.titleContainer,children:[t("h1",{children:r.title}),t("div",{className:m.meta,children:[t("span",{className:m.year,children:r.year}),r.vote_average!=null&&r.vote_average>0&&t("span",{className:m.rating,children:[t(A,{name:"star",size:12}),Number(r.vote_average).toFixed(1)]}),t("span",{className:`${m.typeBadge} ${m[d?"movie":"tv"]}`,children:d?"Movie":"TV Show"})]}),jn.length>0&&t("div",{className:m.genreRow,children:jn.map(e=>t("span",{className:m.genreChip,children:e},e))}),vn.length>0&&t("div",{className:m.metaRow,children:vn.map((e,n)=>t("span",{children:[e,n<vn.length-1?" · ":""]},`${e}-${n}`))})]}),t("div",{className:be.controls,children:[t("button",{className:`${be.watchlistBtn} ${mt?be.inList:""}`,onClick:er,disabled:Ht,type:"button",children:[mt?t(A,{name:"check",size:14}):t(A,{name:"plus",size:14}),mt?"In Watchlist":"Add to Watchlist"]}),!d&&t(Oe,{children:[t("button",{className:`${be.watchlistBtn}`,onClick:()=>un!=null&&yt(String(un)),disabled:un==null,type:"button",children:[t(A,{name:"chevron-left",size:14}),"Prev EP"]}),t("button",{className:`${be.watchlistBtn}`,onClick:()=>P!=null&&yt(String(P)),disabled:P==null,type:"button",children:["Next EP",t(A,{name:"chevron-right",size:14})]}),!d&&t("button",{className:`${be.watchlistBtn} ${be.modeToggleBtn} ${gt?be.modeToggleActive:""}`,onClick:()=>or(!gt),type:"button","aria-pressed":gt,children:gt?"AUTOPLAY: ON":"AUTOPLAY: OFF"}),sr&&t("button",{className:`${be.watchlistBtn}`,onClick:()=>hn(!0),type:"button",children:[t(A,{name:"list-ul",size:14}),"Episodes"]})]})]})]})]}),t("div",{className:be.descriptionSection,children:[t("h3",{children:"Synopsis"}),t(hs,{text:r.overview,emptyText:"No description available."})]}),t("button",{className:be.detailsToggleBtn,onClick:()=>nr(!Gt),type:"button",children:[Gt?t(A,{name:"chevron-up"}):t(A,{name:"chevron-down"}),Gt?"Hide Details":"Show Details"]}),Gt&&t("div",{className:m.detailGrid,children:[r.first_air_date&&t("div",{className:m.detailItem,children:[t("strong",{children:d?"Release Date":"First Air Date"}),t("span",{children:r.first_air_date})]}),r.last_air_date&&t("div",{className:m.detailItem,children:[t("strong",{children:"Last Air Date"}),t("span",{children:r.last_air_date})]}),r.networks&&r.networks.length>0&&t("div",{className:m.detailItem,children:[t("strong",{children:"Networks"}),t("span",{children:r.networks.map(e=>e.name).join(", ")})]}),r.created_by&&r.created_by.length>0&&t("div",{className:m.detailItem,children:[t("strong",{children:"Created By"}),t("span",{children:r.created_by.map(e=>e.name).join(", ")})]}),r.episode_run_time&&r.episode_run_time.length>0&&t("div",{className:m.detailItem,children:[t("strong",{children:"Episode Runtime"}),t("span",{children:[r.episode_run_time[0]," min"]})]}),r.imdb_id&&t("div",{className:m.detailItem,children:[t("strong",{children:"IMDb"}),t("a",{href:`https://www.imdb.com/title/${r.imdb_id}`,target:"_blank",rel:"noopener noreferrer",className:m.imdbLink,children:"View on IMDb"})]})]})]}),!d&&t(Qr,{isOpen:rr,onClose:()=>hn(!1),episodes:Hn,currentEpisode:String(f),watchedEpisodes:Un,onEpisodeClick:yt,header:Xt}),r?.adult&&!Ye&&t(tn,{isOpen:!0,title:"Content Warning",onClose:Qt,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(_e,{variant:"secondary",onClick:Qt,children:"Go Back"}),t(_e,{onClick:w,children:"I'm 18+, Continue"})]})]})}),t(tn,{isOpen:Pe,onClose:Vn,title:"Resume Watching",children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:["You were at ",t("strong",{children:lr(ht)})]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(_e,{variant:"secondary",onClick:Vn,children:"Start from Beginning"}),t(_e,{onClick:pr,children:"Resume"})]})]})}),t(tn,{isOpen:Le,onClose:gr,title:d?"Movie Completed":"Episode Completed",children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:d?t(Oe,{children:"You've already watched this movie."}):t(Oe,{children:["You've already watched"," ",t("strong",{children:["Season ",i," Episode ",f]}),". Would you like to continue?"]})}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center",flexWrap:"wrap"},children:[t(_e,{variant:"secondary",onClick:fr,children:"Replay"}),P!=null?t(_e,{onClick:br,children:["Watch EP ",P]}):fe!=null?t(_e,{onClick:Fn,children:["Start Season ",fe]}):null]})]})}),t(tn,{isOpen:pt,onClose:()=>Ze(!1),title:d?"Movie Completed!":fe!=null?"Season Complete!":"Show Completed!",children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t(A,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),t("p",{style:{fontSize:"1.1rem",fontWeight:600},children:tr}),t("p",{style:{color:"var(--text-secondary)"},children:d?"You finished this movie!":fe!=null?`You finished Season ${i}.`:"Congratulations! You finished all available episodes."}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center",flexWrap:"wrap"},children:[t(_e,{variant:"secondary",onClick:()=>Ze(!1),children:"Close"}),fe!=null?t(_e,{onClick:Fn,children:["Start Season ",fe]}):t(Oe,{children:[t(_e,{onClick:()=>{Ze(!1),Qt()},children:"Back to Details"}),mt&&t(_e,{onClick:vr,disabled:ye.isPending,children:ye.isPending?"Saving...":"Move to Completed"})]})]})]})}),!r&&t("div",{className:m.statusMsg,children:[t(A,{name:"spinner",className:m.spinner})," Loading..."]})]})]})};export{lo as default};
@@ -1 +0,0 @@
1
- ._fullscreenFlat_oxcpx_1,._fullscreenFlat_oxcpx_1 ._video_oxcpx_2,._fullscreenFlat_oxcpx_1 ._delayCanvas_oxcpx_3,._fullscreenFlat_oxcpx_1 ._subtitleOverlay_oxcpx_4{border-radius:0}@media(max-width:900px)and (orientation:landscape){._fullscreenFlat_oxcpx_1{border-radius:0}}@container (max-width: 26rem){._timeDisplay_oxcpx_15{display:none}._bottomControls_oxcpx_19{padding:.75rem}._leftControls_oxcpx_23,._rightControls_oxcpx_24{gap:.2rem}._controlBtn_oxcpx_28{padding:5px;min-width:2.125rem;min-height:2.125rem}}._video_oxcpx_2{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain;display:block;background:#000;border:none}._controlsOverlay_oxcpx_47{position:absolute;inset:0;opacity:1;transition:opacity .4s cubic-bezier(.4,0,.2,1);z-index:50;pointer-events:none;display:flex;flex-direction:column;justify-content:space-between;background:radial-gradient(circle,transparent 20%,rgba(0,0,0,.4) 100%)}._controlsOverlay_oxcpx_47>*{pointer-events:auto}._controlsOverlay_oxcpx_47._hidden_oxcpx_67{opacity:0;pointer-events:none;cursor:none}._topControls_oxcpx_73{position:absolute;top:0;left:0;right:0;display:flex;align-items:center;gap:var(--space-6);background:linear-gradient(to bottom,rgba(0,0,0,.85) 0%,rgba(0,0,0,.45) 60%,transparent 100%);padding:var(--space-8) var(--space-10);transition:transform .4s cubic-bezier(.2,.8,.2,1);z-index:10;pointer-events:auto}._backBtn_oxcpx_93{background:transparent;border:none;color:#ffffffd9;font-size:1.6rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--transition-fast);padding:8px;border-radius:50%}._backBtn_oxcpx_93:hover{background:#0f0f1199;color:#fff;transform:scale(1.1)}._videoTitleInfo_oxcpx_113{display:flex;flex-direction:column;gap:.25rem}._animeTitle_oxcpx_119{font-size:1.4rem;font-weight:800;color:#fff;letter-spacing:-.01em;text-shadow:0 2px 4px rgba(0,0,0,.5)}._episodeLabel_oxcpx_127{font-size:.85rem;font-weight:600;color:#ffffffbf;text-shadow:0 2px 4px rgba(0,0,0,.5)}._speedBoostBadge_oxcpx_134{position:absolute;top:1.5rem;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.7rem;padding:.65rem 1rem;border:1px solid color-mix(in srgb,var(--accent) 45%,transparent);border-radius:var(--radius-md);background:#121216eb;color:#f5f3ff;font-size:.85rem;font-weight:800;letter-spacing:.06em;z-index:11;pointer-events:none}._speedBoostBadge_oxcpx_134 span{line-height:1}._speedBoostBadge_oxcpx_134 svg{display:block;flex-shrink:0}._bottomControls_oxcpx_19{position:absolute;bottom:0;left:0;right:0;background:linear-gradient(to top,rgba(0,0,0,.85) 0%,rgba(0,0,0,.45) 60%,transparent 100%);padding:clamp(1rem,4cqw,2.5rem) clamp(1rem,4cqw,2.5rem) clamp(.75rem,2.5cqw,1.5rem);z-index:10;pointer-events:auto;transition:transform .4s cubic-bezier(.2,.8,.2,1)}._progressBarContainer_oxcpx_180{width:100%;height:20px;display:flex;align-items:center;cursor:pointer;position:relative;touch-action:pan-y}@media(pointer:coarse){._progressBarContainer_oxcpx_180{height:28px}._progressBarContainer_oxcpx_180 ._progressBar_oxcpx_180{height:6px}._progressBarContainer_oxcpx_180 ._thumb_oxcpx_199{opacity:1}}._progressBar_oxcpx_180{width:100%;height:4px;background:#fff3;border-radius:2px;position:relative;transition:height .15s ease}._progressBarContainer_oxcpx_180:hover ._progressBar_oxcpx_180{height:6px}._bufferedBar_oxcpx_217{position:absolute;top:0;left:0;height:100%;background:#ffffff4d;border-radius:2px;pointer-events:none}._watchedBar_oxcpx_227{position:absolute;top:0;left:0;height:100%;background:var(--accent);border-radius:2px;pointer-events:none}._thumb_oxcpx_199{position:absolute;top:50%;width:12px;height:12px;background:#fff;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 4px #0006;pointer-events:none;opacity:0;transition:opacity .15s ease}._progressBarContainer_oxcpx_180:hover ._thumb_oxcpx_199,._progressBarContainer_oxcpx_180._scrubbing_oxcpx_252 ._thumb_oxcpx_199{opacity:1}._timeBubble_oxcpx_256{position:absolute;bottom:24px;background:#000000d9;color:#fff;padding:4px 8px;border-radius:4px;font-size:.8rem;font-weight:500;transform:translate(-50%);pointer-events:none;white-space:nowrap}._bottomControlsRow_oxcpx_270{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-top:8px}._leftControls_oxcpx_23{display:flex;align-items:center;gap:1rem;gap:clamp(.5rem,2.5cqw,1rem);min-width:0}._rightControls_oxcpx_24{display:flex;align-items:center;gap:.75rem;gap:clamp(.5rem,2cqw,.75rem)}._controlBtn_oxcpx_28{background:transparent;border:none;color:#ffffffd9;font-size:1.1rem;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;border-radius:4px;transition:all var(--transition-fast);min-width:2.125rem;min-height:2.125rem;flex:0 0 auto}@media(pointer:coarse){._controlBtn_oxcpx_28{padding:10px;min-width:2.75rem;min-height:2.75rem}}._controlBtn_oxcpx_28:hover{color:#fff;background:#ffffff1a}._controlBtn_oxcpx_28._active_oxcpx_323{color:var(--accent)}._volumeContainer_oxcpx_327{display:flex;align-items:center;position:relative}._volumeSlider_oxcpx_333{width:0;opacity:0;transform:scaleX(0);transform-origin:left;transition:all .3s cubic-bezier(.4,0,.2,1);cursor:pointer;margin-left:8px;-webkit-appearance:none;appearance:none;background:transparent;height:20px}._volumeContainer_oxcpx_327:hover ._volumeSlider_oxcpx_333,._volumeSlider_oxcpx_333:focus{width:80px;opacity:1;transform:scaleX(1)}._volumeSlider_oxcpx_333::-webkit-slider-runnable-track{width:100%;height:4px;background:linear-gradient(to right,var(--accent) 0%,var(--accent) var(--volume-percent, 0%),rgba(255,255,255,.2) var(--volume-percent, 0%),rgba(255,255,255,.2) 100%);border-radius:4px}._volumeSlider_oxcpx_333::-moz-range-track{width:100%;height:4px;background:#fff3;border-radius:4px}._volumeSlider_oxcpx_333::-moz-range-progress{height:4px;background:var(--accent);border-radius:4px}._volumeSlider_oxcpx_333::-webkit-slider-thumb{-webkit-appearance:none;height:12px;width:12px;border-radius:50%;background:#fff;margin-top:-4px;box-shadow:0 0 5px #00000080}._timeDisplay_oxcpx_15{color:#fffc;font-size:.85rem;font-weight:500;font-variant-numeric:tabular-nums;min-width:100px}._settingsPanel_oxcpx_398{position:absolute;bottom:clamp(6rem,15vh,8rem);right:clamp(1rem,3vw,2rem);background:#141418f2;border:1px solid var(--border-secondary);border-radius:var(--radius-md);width:max-content;min-width:12rem;max-width:min(19rem,calc(100vw - 1.5rem));font-size:.85rem;z-index:60;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);box-shadow:0 8px 32px #00000080;display:flex;flex-direction:column;overflow:hidden}._settingsHeader_oxcpx_417{display:flex;align-items:center;padding:.55rem .75rem;border-bottom:1px solid var(--border-secondary);gap:.625rem}._settingsBackBtn_oxcpx_425{background:transparent;border:none;color:#ffffffd9;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:4px;border-radius:4px;transition:all var(--transition-fast)}._settingsBackBtn_oxcpx_425:hover{background:#ffffff1a;color:#fff}._settingsTitle_oxcpx_443{font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._settingsContent_oxcpx_454{overflow-y:auto;padding:.375rem;display:flex;flex-direction:column;gap:.125rem;max-height:min(56vh,22rem)}._currentValue_oxcpx_463{color:var(--text-tertiary);font-size:.8rem;font-weight:500}._settingsLabel_oxcpx_469{padding:var(--space-2) var(--space-4);font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--text-secondary)}._menuItem_oxcpx_478{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;min-height:2rem;padding:.5rem .75rem;background:transparent;border:none;color:var(--text-primary);font-size:.85rem;cursor:pointer;border-radius:var(--radius-sm);transition:background-color var(--transition-fast);text-align:left;white-space:nowrap}._menuItem_oxcpx_478:hover{background:var(--bg-tertiary)}._menuItem_oxcpx_478._active_oxcpx_323{background:var(--bg-tertiary);color:var(--accent)}._currentValue_oxcpx_463{color:var(--text-secondary);font-size:.85rem}._menuNote_oxcpx_511{padding:.5rem .75rem;font-size:.7rem;line-height:1.5;color:var(--text-tertiary);white-space:normal;overflow-wrap:break-word}._spin_oxcpx_520{animation:_spin_oxcpx_520 1s linear infinite}@keyframes _spin_oxcpx_520{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media(pointer:coarse){._settingsPanel_oxcpx_398{font-size:.9rem;bottom:calc(env(safe-area-inset-bottom,0px) + 7rem);right:max(.75rem,env(safe-area-inset-right,0px))}._menuItem_oxcpx_478{min-height:2.75rem}._settingsContent_oxcpx_454{max-height:52vh}}@media(max-width:480px){._settingsPanel_oxcpx_398{min-width:9rem;max-width:calc(100vw - 2rem);font-size:.75rem;bottom:calc(env(safe-area-inset-bottom,0px) + 6rem)}._settingsHeader_oxcpx_417{padding:.4rem .625rem}._settingsTitle_oxcpx_443{font-size:.64rem}._menuItem_oxcpx_478{min-height:2.25rem;padding:.45rem .625rem;font-size:.75rem;gap:.5rem}._settingsContent_oxcpx_454{max-height:min(40vh,15rem)}}@media(max-height:500px)and (orientation:landscape){._settingsPanel_oxcpx_398{bottom:7.25rem;right:2rem;min-width:10rem;max-width:min(15rem,calc(100vw - 1.5rem));font-size:.8rem}._menuItem_oxcpx_478{min-height:2.5rem;font-size:.8rem}._settingsContent_oxcpx_454{max-height:50vh;overflow-y:auto}}._page_263ma_1{max-width:1200px;margin:0 auto;padding:1.5rem}._header_263ma_7{margin-bottom:1.5rem}._pageTitle_263ma_11{font-size:1.75rem;font-weight:700;margin:0 0 1rem;display:flex;align-items:center;gap:.5rem;color:var(--text-primary)}._searchForm_263ma_21{display:flex;gap:.5rem;max-width:600px}._searchInput_263ma_27{flex:1;padding:.6rem 1rem;border-radius:8px;border:1px solid var(--border-primary);background:var(--bg-elevated);color:var(--text-primary);font-size:.95rem;outline:none}._searchInput_263ma_27:focus{border-color:var(--accent)}._searchBtn_263ma_42{padding:.6rem 1rem;border-radius:8px;border:none;background:var(--accent);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center}._searchBtn_263ma_42:hover{opacity:.9}._suggestions_263ma_58{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:1.5rem}._suggestionPill_263ma_65{padding:.4rem .8rem;border-radius:20px;border:1px solid var(--border-primary);background:var(--bg-elevated);color:var(--text-secondary);cursor:pointer;font-size:.85rem;transition:all .15s ease}._suggestionPill_263ma_65:hover{border-color:var(--accent);color:var(--text-primary)}._statusMsg_263ma_81{padding:1rem;text-align:center;color:var(--text-secondary)}._statusMsg_263ma_81._error_263ma_87{color:#f87171}._statusMsg_263ma_81._textOnly_263ma_91{background:none;padding:.5rem}._spinner_263ma_96{animation:_spin_263ma_96 1s linear infinite;margin-right:.5rem}@keyframes _spin_263ma_96{0%{transform:rotate(0)}to{transform:rotate(360deg)}}._grid_263ma_110{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:1rem}._skeletonCard_263ma_116{border-radius:8px;overflow:hidden}._skeletonThumb_263ma_121{aspect-ratio:2 / 3;background:var(--bg-secondary);border-radius:8px}._skeletonLine_263ma_127{height:12px;background:var(--bg-secondary);border-radius:4px;margin-top:.5rem}._shimmer_263ma_134{background:linear-gradient(90deg,var(--bg-secondary) 25%,var(--bg-elevated) 50%,var(--bg-secondary) 75%);background-size:200% 100%;animation:_shimmer_263ma_134 1.5s infinite}@keyframes _shimmer_263ma_134{0%{background-position:200% 0}to{background-position:-200% 0}}._backBtn_263ma_154{display:inline-flex;align-items:center;gap:.4rem;padding:.4rem .8rem;border-radius:6px;border:1px solid var(--border-primary);background:var(--bg-elevated);color:var(--text-primary);cursor:pointer;font-size:.85rem;margin-bottom:1rem}._backBtn_263ma_154:hover{border-color:var(--accent)}._meta_263ma_172{display:flex;align-items:center;gap:.75rem;margin:.5rem 0;flex-wrap:wrap}._headerActions_263ma_180{display:flex;gap:.5rem;margin:.75rem 0 0;flex-wrap:wrap}._watchlistBtn_263ma_187{display:inline-flex;align-items:center;gap:.4rem;padding:.5rem 1rem;border-radius:6px;border:1px solid var(--border-primary);background:var(--bg-elevated);color:var(--text-primary);cursor:pointer;font-size:.85rem;font-weight:600}._watchlistBtn_263ma_187:hover:not(:disabled){border-color:var(--accent)}._watchlistBtn_263ma_187._active_263ma_205{border-color:var(--color-success);color:var(--color-success)}._watchlistBtn_263ma_187:disabled{opacity:.6;cursor:default}._year_263ma_215{color:var(--text-secondary);font-size:.9rem}._rating_263ma_220{display:inline-flex;align-items:center;gap:4px;color:var(--accent-lighter);font-weight:600;font-size:.9rem}._typeBadge_263ma_229{padding:2px 10px;border-radius:4px;font-size:.75rem;font-weight:600;text-transform:uppercase}._typeBadge_263ma_229._tv_263ma_237{background:color-mix(in srgb,var(--accent) 20%,transparent);color:var(--accent)}._typeBadge_263ma_229._movie_263ma_242{background:color-mix(in srgb,var(--accent-lighter) 20%,transparent);color:var(--accent-lighter)}._typeBadge_263ma_229._tvSeries_263ma_247,._typeBadge_263ma_229._tvMiniSeries_263ma_252{background:color-mix(in srgb,var(--accent) 20%,transparent);color:var(--accent)}._overview_263ma_257{color:var(--text-secondary);line-height:1.6;margin:.5rem 0 0;max-width:800px}._controls_263ma_264{display:flex;flex-wrap:wrap;gap:1rem;margin:1rem 0;align-items:flex-end}._controlLabel_263ma_272{display:flex;flex-direction:column;gap:.3rem;font-size:.8rem;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.05em}._select_263ma_282{padding:.5rem .75rem;border-radius:6px;border:1px solid var(--border-primary);background:var(--bg-elevated);color:var(--text-primary);font-size:.9rem;cursor:pointer;min-width:160px}._playerSection_263ma_293{margin:1.5rem 0;border-radius:0;overflow:hidden;overflow:clip;isolation:isolate;background:#000;position:relative}._video_263ma_297{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain;display:block;background:#000;border:none;border-radius:inherit}._videoHidden_263ma_319{opacity:0;pointer-events:none}._delayCanvas_263ma_324{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;z-index:2;border-radius:inherit}._delayCanvasActive_263ma_337{opacity:1}._subtitleOverlay_263ma_341{position:absolute;top:0;left:0;width:100%;height:100%;z-index:3;pointer-events:none;overflow:hidden;border-radius:inherit}@media(max-width:900px)and (orientation:landscape){._playerSection_263ma_293{margin:0;border-radius:0}}._videoIframe_263ma_360{width:100%;aspect-ratio:16 / 9;min-height:400px;border:none;background:#000}._retryButton_263ma_368{margin-left:8px;padding:4px 10px;border-radius:4px;border:1px solid var(--border-primary);background:var(--bg-elevated);color:var(--text-primary);cursor:pointer;font-size:.8rem}._retryButton_263ma_368:hover{border-color:var(--accent)}._sidebarSeason_263ma_383{display:flex;flex-direction:column;gap:.4rem;font-size:.75rem;font-weight:700;color:var(--text-tertiary);text-transform:uppercase;letter-spacing:.1em;margin-bottom:var(--space-4)}._sidebarSeason_263ma_383 ._select_263ma_282{width:100%}._mobileSeasonRow_263ma_399{display:none}@media(max-width:768px){._mobileSeasonRow_263ma_399{display:block}._mobileSeasonRow_263ma_399 ._sidebarSeason_263ma_383{margin-bottom:0}}._sidebarPosterCard_263ma_413{padding:1rem;display:flex;flex-direction:column;gap:.75rem}._sidebarPosterCard_263ma_413 img{width:100%;border-radius:var(--radius-md);aspect-ratio:2 / 3;object-fit:cover;background:#ffffff0f}._sidebarPosterMeta_263ma_428{display:flex;flex-direction:column;gap:.25rem}._sidebarPosterMeta_263ma_428 strong{color:var(--text-primary);font-size:.95rem;line-height:1.3}._sidebarPosterMeta_263ma_428 span{color:var(--text-secondary);font-size:.85rem}._providerSelectWrap_263ma_445{display:flex;align-items:flex-end;gap:1rem;flex-wrap:wrap;min-width:0}._providerSelectWrap_263ma_445 ._backBtn_263ma_154{margin-bottom:0}._genreRow_263ma_457{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.6rem}._genreChip_263ma_464{padding:.2rem .7rem;border-radius:20px;border:1px solid var(--glass-border);background:#ffffff0d;color:var(--text-secondary);font-size:.78rem;font-weight:600}._metaRow_263ma_474{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.6rem;color:var(--text-secondary);font-size:.9rem}._detailGrid_263ma_483{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:.75rem;margin-top:1rem}._detailItem_263ma_490{display:flex;flex-direction:column;gap:.2rem;padding:.75rem 1rem;border-radius:var(--radius-md);border:1px solid var(--glass-border);background:#ffffff08}._detailItem_263ma_490 strong{font-size:.75rem;text-transform:uppercase;letter-spacing:.06em;color:var(--text-tertiary)}._detailItem_263ma_490 span{color:var(--text-primary);font-size:.9rem}._imdbLink_263ma_512{color:var(--accent-light);font-size:.9rem;text-decoration:none}._imdbLink_263ma_512:hover{text-decoration:underline}