@serifpersia/dango 3.6.5 → 3.6.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.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-JkXG40Es.js → AnimeCard-C3P9zWi9.js} +1 -1
- package/client/dist/assets/{AnimeInfo-2L0UJkbB.js → AnimeInfo-Et6687Tl.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-BDs03vKk.js → AnimeInfoPage-DX4eNnlH.js} +2 -2
- package/client/dist/assets/{Asmr-D2mVKEl9.js → Asmr-CCdEWrFi.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-MQA_bNQM.js → AsmrResetProgressModal-DgEWBJOw.js} +1 -1
- package/client/dist/assets/AvSyncCalibrator-CQ2fjf2E.js +10 -0
- package/client/dist/assets/{Home-DxMBHFmc.js → Home-DUkUTTTy.js} +1 -1
- package/client/dist/assets/{Insights-hmLWsSXY.js → Insights-QCh4xW12.js} +1 -1
- package/client/dist/assets/{LibraryListPage-CWI7hgUh.js → LibraryListPage-BoTxRqHz.js} +1 -1
- package/client/dist/assets/{ListeningList-NOc28KAV.js → ListeningList-DguKjI_t.js} +1 -1
- package/client/dist/assets/{Manga-B5qNhI7v.js → Manga-HydR-L7o.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-D4wIyb-V.js → MangaInfoPage-CBakEI9a.js} +1 -1
- package/client/dist/assets/{MangaReadPage-Ce1VX7-0.js → MangaReadPage-DwAR3iPy.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-P3oY4_14.js → MangaResetProgressModal-DGzl8vsO.js} +1 -1
- package/client/dist/assets/{Mature-D8EwGYQq.js → Mature-Pi0TxKuF.js} +1 -1
- package/client/dist/assets/{MediaCard-Dp8DjyXB.js → MediaCard--cuFxOCS.js} +1 -1
- package/client/dist/assets/{Music-DULtVsAM.js → Music-CQpyXTLH.js} +1 -1
- package/client/dist/assets/{OptionListMenu-fIHdE-nq.js → OptionListMenu-B3D39dGS.js} +1 -1
- package/client/dist/assets/{Player-B8XeOmso.js → Player-CsH4x_I_.js} +6 -6
- package/client/dist/assets/{PlayerSettings-BycNCiCs.js → PlayerSettings-DGxBsi3F.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-T1J37IZT.js → QueueOptionsButton-Djq4Cpex.js} +1 -1
- package/client/dist/assets/{QueueRail-BAwI-apz.js → QueueRail-DOrYgNVX.js} +1 -1
- package/client/dist/assets/{Radio-Bv9DyKtZ.js → Radio-DF6g6odd.js} +1 -1
- package/client/dist/assets/{ReadingList-Cl0CcVp3.js → ReadingList-DwYoBrNk.js} +1 -1
- package/client/dist/assets/{ResetProgressModal--N60WWCB.js → ResetProgressModal-CMF86mX6.js} +1 -1
- package/client/dist/assets/{Search-DvgVDlUR.js → Search-DFkhuk-x.js} +1 -1
- package/client/dist/assets/{Settings-dCz_-bJn.js → Settings-DBB2r0VQ.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-BZHKk1I6.js → SkeletonGrid-DJelJgAv.js} +1 -1
- package/client/dist/assets/{Trackers-C1T5VcPu.js → Trackers-DGYXFhYZ.js} +1 -1
- package/client/dist/assets/{Tv-Dhv_cg4y.js → Tv-C5MDGD2Z.js} +4 -4
- package/client/dist/assets/{TvInfo-DgaLK2H6.js → TvInfo-DrKuK13u.js} +1 -1
- package/client/dist/assets/{TvPopup-DyX7f8kC.js → TvPopup-DtHilRDT.js} +1 -1
- package/client/dist/assets/{TvSearch-Bp0H6kue.js → TvSearch-CzNxdu_w.js} +1 -1
- package/client/dist/assets/{TvWatchlist-ohMtMeKa.js → TvWatchlist-D7p4br6S.js} +1 -1
- package/client/dist/assets/{Watchlist-BbQtzsER.js → Watchlist-DrOzswl2.js} +1 -1
- package/client/dist/assets/{hls-Bi1cjpLZ.js → hls-BGCX7mJy.js} +1 -1
- package/client/dist/assets/{index-BTnhzofk.js → index-CnfZwsds.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-Cvmso3IK.js → useAnimeInfoData-DYXWBPF-.js} +1 -1
- package/client/dist/assets/{useAsmr-CbzGCzmv.js → useAsmr-BbhQ59bk.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-DaREZ9Ie.js → useAsmrPopup-SymV1J-b.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-BVQRhsFh.js → useMangaLibrary-DuesWQaE.js} +1 -1
- package/client/dist/assets/{useMangaPopup-CzsCbndG.js → useMangaPopup-D57OVGUr.js} +1 -1
- package/client/dist/assets/{useProviders-UuUPzft-.js → useProviders-mpQb_dix.js} +1 -1
- package/client/dist/assets/{useTv-CSsbWKH9.js → useTv-DGflCsSI.js} +1 -1
- package/client/dist/assets/{useTvLibrary-a_Y0c2FS.js → useTvLibrary-BqeSmyc4.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/app-hono.js +1 -1
- package/server/dist/hono/proxy.js +105 -227
- package/server/dist/hono/tv.js +33 -2
- package/server/dist/providers/remote-loader.js +12 -3
- package/server/dist/providers/remote-types.js +35 -0
- package/server/dist/server.js +3 -0
- package/server/package.json +1 -1
- package/client/dist/assets/AvSyncCalibrator-DmoH5eRA.js +0 -10
- package/server/dist/utils/megaplay.utils.js +0 -40
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ _A local-first anime web app focused on performance, privacy, and personal libra
|
|
|
6
6
|
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|

|
|
9
|
-
[](https://github.com/serifpersia/dango)
|
|
10
10
|
|
|
11
11
|
[](https://dango-users-badge.ramiserifpersia.workers.dev/?view=status)
|
|
12
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as B,d as P,A as C,u as s,S as T,L as A,N as D}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{u as I}from"./useAnimeInfoData-
|
|
1
|
+
import{T as B,d as P,A as C,u as s,S as T,L as A,N as D}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{u as I}from"./useAnimeInfoData-DYXWBPF-.js";import{d as R,s as z,g as M}from"./index-CnfZwsds.js";import{Q as _}from"./QueueOptionsButton-Djq4Cpex.js";import{p as a,a as x,m as $,M as L}from"./MediaCard--cuFxOCS.js";const O=({showId:e,anchorRect:l,onMouseEnter:v,onMouseLeave:u,onRequestClose:N})=>{const{showMeta:t,loadingMeta:i,inWatchlist:d,toggleWatchlist:f}=I(e),{titlePreference:c}=R(),r=B(()=>t?.name?c==="name"?t.name:c==="nativeName"?t.names?.native||t.name:c==="englishName"&&t.names?.english||t.name:"",[t,c]),[h,g]=P(!1),p=C(!1),b=()=>{p.current=!0,v()},y=()=>{p.current=!1,!h&&u()},w=n=>{g(n),!n&&!p.current&&u()};return s(x,{anchorRect:l,onMouseEnter:b,onMouseLeave:y,onRequestClose:N,children:i?s("div",{className:a.loading,children:[s("div",{className:a.spinner}),s("span",{children:"Fetching details..."})]}):t?s(T,{children:[s("div",{className:a.header,children:s("div",{className:a.title,children:r})}),s("div",{className:a.body,children:[s("div",{className:a.metaRow,children:[t.score&&s("div",{className:a.metaItem,children:[s(o,{name:"star",className:a.scoreIcon,size:14}),s("span",{children:t.score})]}),t.status&&s("div",{className:a.metaItem,children:[s(o,{name:"tv",size:14}),s("span",{children:t.status})]})]}),s("div",{className:a.synopsis,children:t.description?z(t.description):"No synopsis available."}),s("div",{className:a.details,children:[t.nextEpisodeAirDate&&s("div",{className:a.detailItem,children:[s("strong",{children:"Aired:"})," ",t.nextEpisodeAirDate]}),Array.isArray(t.genres)&&t.genres.length>0&&s("div",{className:a.genres,children:t.genres.filter(Boolean).slice(0,4).map(n=>{const E=typeof n=="string"?n:n?.name;return s("span",{className:a.genre,children:E},E)})})]})]}),s("div",{className:a.footer,children:[s("div",{className:a.primaryAction,children:s(A,{to:`/watch/${t?.id||e}`,className:a.watchBtn,children:[s(o,{name:"play",size:14}),"Watch now"]})}),s("div",{className:a.secondaryActions,children:[s("button",{className:`${a.watchlistBtn} ${d?a.active:""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),f()},children:[d?s(o,{name:"check",size:12}):s(o,{name:"plus",size:12}),s("span",{children:d?"Remove":"Watchlist"})]}),s(_,{showId:e,showName:t.name||t.names?.romaji,showThumbnail:t.thumbnail,nativeName:t.names?.native,englishName:t.names?.english,showType:t.type,className:a.watchlistBtn,activeClassName:a.active,align:"left",onMenuOpenChange:w}),s(A,{to:`/anime/${t?.id||e}`,className:a.detailsBtn,children:"Read more"})]})]})]}):s("div",{className:a.loading,children:"Failed to load info."})})},j=D(({anime:e,continueWatching:l=!1,onRemove:v,config:u,layout:N="vertical"})=>{const t=e.currentTime||0,i=e.duration||0,d=.8,f=t>5&&i>5&&t<i*d,c=t>0&&(i<=5||t>=i*d),r=e.episodeNumber,h=l?{pathname:r?`/watch/${e._id}/${r}`:`/watch/${e._id}`,state:{name:e.name,thumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName,type:e.type}}:r?`/watch/${e._id}/${r}`:`/anime/${e._id}`,g=(()=>{if(typeof h=="string")return h.startsWith("/watch/");const m=h.pathname;return typeof m=="string"&&m.startsWith("/watch/")})(),p=l&&r?`EP ${r}`:e.watchedCount!==void 0&&e.watchedCount>0?`EP ${e.watchedCount}`:null,b=[e.airTime,e.aired===!1&&e.nextEpisodeAirDate?`· ${e.nextEpisodeAirDate.split(",")[0]}`:""].filter(Boolean).join(" "),y=e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"),w=s(T,{children:[(e.availableEpisodesDetail?.sub||e.availableEpisodes?.sub)&&s("div",{className:$.metaItem,children:[s(o,{name:"closed-captioning",size:10}),e.availableEpisodesDetail?.sub?.length??e.availableEpisodes?.sub]}),(e.availableEpisodesDetail?.dub||e.availableEpisodes?.dub)&&s("div",{className:$.metaItem,children:[s(o,{name:"microphone",size:10}),e.availableEpisodesDetail?.dub?.length??e.availableEpisodes?.dub]})]});return s(L,{item:{id:e.id||e.showId||e._id,title:e.name,nativeName:e.nativeName,englishName:e.englishName,thumbnail:e.thumbnail,typeBadge:e.type||"TV",chapterBadge:p,airMeta:b||void 0,isAdult:y,notAired:e.aired===!1},linkTo:h,hoverIcon:g?"play":"info",progress:f?{percent:t/i*100,label:`${M(t)} / ${M(i)}`}:c?{percent:100,label:"Watched"}:void 0,showProgress:l,metaRow:w,display:u,layout:N,onRemove:v,showRemoveButton:u?.elements?.poster?.removeButton??(l&&!!v),showInfoButton:!l,enrichedId:e._id,renderPopup:(m,n)=>s(O,{showId:e._id,anchorRect:m,onMouseEnter:n.onMouseEnter,onMouseLeave:n.onMouseLeave,onRequestClose:n.close})})});export{j as A};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as y,a as I,d as T,h as b,T as S,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{u as B}from"./useAnimeInfoData-
|
|
1
|
+
import{o as y,a as I,d as T,h as b,T as S,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{u as B}from"./useAnimeInfoData-DYXWBPF-.js";import{d as w,e as M,f as m,s as x,M as A,B as p}from"./index-CnfZwsds.js";import{A as D}from"./AnimeMetaDetails-BogOi_bM.js";import{S as G}from"./SynopsisText-B3Sa5pRv.js";import{Q as P}from"./QueueOptionsButton-Djq4Cpex.js";import"./vendor-query-BBT5_sHx.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-ui-3qrARCPr.js";const W="_container_1obln_1",O="_heroSection_1obln_11",$="_bannerContainer_1obln_17",U="_banner_1obln_17",j="_bannerOverlay_1obln_37",q="_heroContent_1obln_49",z="_posterContainer_1obln_62",V="_floatIn_1obln_1",Q="_poster_1obln_62",E="_infoGlass_1obln_86",H="_slideUpIn_1obln_1",F="_title_1obln_100",J="_quickMeta_1obln_109",K="_metaItem_1obln_117",L="_iconStar_1obln_126",R="_iconTv_1obln_129",X="_iconType_1obln_132",Y="_iconClock_1obln_135",Z="_genres_1obln_139",ee="_genre_1obln_139",ne="_infoColumns_1obln_165",te="_synopsisSection_1obln_180",oe="_sectionTitleSmall_1obln_188",se="_actions_1obln_210",ae="_watchBtn_1obln_216",ie="_watchlistBtn_1obln_238",le="_active_1obln_258",ce="_detailsToggleBtn_1obln_265",re="_expandedContent_1obln_288",me="_fadeIn_1obln_1",_e="_detailsGridContainer_1obln_293",de="_detailItem_1obln_301",he="_airingValue_1obln_320",be="_loadingDetails_1obln_325",pe="_spinner_1obln_334",ue="_spin_1obln_334",ve="_heroSkeleton_1obln_349",ge="_skeletonBanner_1obln_353",ke="_skeletonPoster_1obln_354",fe="_skeletonTitle_1obln_355",Ne="_skeletonMeta_1obln_356",Ce="_skeletonDesc_1obln_357",ye="_skeletonActions_1obln_358",Ie="_skeletonContent_1obln_391",Te="_skeletonInfo_1obln_405",n={container:W,heroSection:O,bannerContainer:$,banner:U,bannerOverlay:j,heroContent:q,posterContainer:z,floatIn:V,poster:Q,infoGlass:E,slideUpIn:H,title:F,quickMeta:J,metaItem:K,iconStar:L,iconTv:R,iconType:X,iconClock:Y,genres:Z,genre:ee,infoColumns:ne,synopsisSection:te,sectionTitleSmall:oe,actions:se,watchBtn:ae,watchlistBtn:ie,active:le,detailsToggleBtn:ce,expandedContent:re,fadeIn:me,detailsGridContainer:_e,detailItem:de,airingValue:he,loadingDetails:be,spinner:pe,spin:ue,heroSkeleton:ve,skeletonBanner:ge,skeletonPoster:ke,skeletonTitle:fe,skeletonMeta:Ne,skeletonDesc:Ce,skeletonActions:ye,"skeleton-wave":"_skeleton-wave_1obln_1",skeletonContent:Ie,skeletonInfo:Te};function Oe(){const{id:s}=y(),a=I(),{titlePreference:l}=w(),[i,u]=T(!1),{showMeta:t,loadingMeta:v,toggleWatchlist:g,inWatchlist:c}=B(s),{hasConsent:k,grant:f}=M();b(()=>{s&&t?.id&&t.id!==s&&a(`/anime/${t.id}`,{replace:!0})},[s,t,a]),b(()=>{document.title=t?.name?`${t.name} - dango`:"Anime - dango"},[t?.name]);const N=()=>t?.name?l==="name"?t.name:l==="nativeName"?t.names?.native||t.name:l==="englishName"&&t.names?.english||t.name:"",C=()=>{s&&a(`/watch/${s}`)},_=S(()=>t?.bannerImage?m(t.bannerImage):t?.thumbnail?m(t.thumbnail,1200,450):"",[t?.bannerImage,t?.thumbnail]);if(v||!t?.name)return e("div",{className:n.container,children:e("div",{className:n.heroSkeleton,children:[e("div",{className:n.skeletonBanner}),e("div",{className:n.skeletonContent,children:[e("div",{className:n.skeletonPoster}),e("div",{className:n.skeletonInfo,children:[e("div",{className:n.skeletonTitle}),e("div",{className:n.skeletonMeta}),e("div",{className:n.skeletonDesc}),e("div",{className:n.skeletonActions})]})]})]})});const d=t.isAdult===!0&&!k;return e("div",{className:n.container,style:d?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:[e("div",{className:n.heroSection,children:[e("div",{className:n.bannerContainer,children:[e("div",{className:n.banner,style:_?{backgroundImage:`url(${_})`}:void 0}),e("div",{className:n.bannerOverlay})]}),e("div",{className:n.heroContent,children:[e("div",{className:n.posterContainer,children:e("img",{src:m(t.thumbnail||"",320,480),alt:t.name,className:n.poster,decoding:"async"})}),e("div",{className:n.infoGlass,children:[e("div",{className:n.topInfo,children:[e("h1",{className:n.title,children:N()}),e("div",{className:n.quickMeta,children:[t.score&&e("div",{className:n.metaItem,children:[e(o,{name:"star",className:n.iconStar}),e("span",{children:t.score})]}),t.status&&e("div",{className:n.metaItem,children:[e(o,{name:"tv",className:n.iconTv}),e("span",{children:t.status})]}),t.type&&e("div",{className:n.metaItem,children:[e(o,{name:"layer-group",className:n.iconType}),e("span",{children:t.type})]})]}),Array.isArray(t.genres)&&t.genres.length>0&&e("div",{className:n.genres,children:t.genres.filter(Boolean).slice(0,5).map(r=>{const h=typeof r=="string"?r:r?.name;return e("span",{className:n.genre,children:h},h)})})]}),e("div",{className:n.infoColumns,children:[e("div",{className:n.synopsisSection,children:[e("h2",{className:n.sectionTitleSmall,children:"Synopsis"}),e(G,{text:x(t.description),emptyText:"No description available."}),e("button",{className:n.detailsToggleBtn,onClick:()=>{u(!i)},children:[i?e(o,{name:"chevron-up"}):e(o,{name:"chevron-down"}),i?"Hide Details":"Show Details"]})]}),i&&e("div",{className:n.expandedContent,children:e(D,{showMeta:t,styles:n})})]}),e("div",{className:n.actions,children:[e("button",{className:n.watchBtn,onClick:C,children:[e(o,{name:"play",size:14}),"Start Watching"]}),e("button",{className:`${n.watchlistBtn} ${c?n.active:""}`,onClick:g,children:[c?e(o,{name:"check",size:14}):e(o,{name:"plus",size:14}),c?"In Watchlist":"Add to Watchlist"]}),e(P,{showId:s,showName:t.name||t.names?.romaji,showThumbnail:t.thumbnail,nativeName:t.names?.native,englishName:t.names?.english,showType:t.type,className:n.watchlistBtn,activeClassName:n.active})]})]})]})]}),d&&e(A,{isOpen:!0,title:"Content Warning",onClose:()=>a("/"),children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:"This title contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(p,{variant:"secondary",onClick:()=>a("/"),children:"Go Back"}),e(p,{onClick:f,children:"I'm 18+, Continue"})]})]})})]})}export{Oe as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnimeInfo-
|
|
2
|
-
import{Y as r,_ as t}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnimeInfo-Et6687Tl.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/useAnimeInfoData-DYXWBPF-.js","assets/vendor-query-BBT5_sHx.js","assets/index-CnfZwsds.js","assets/index-D0Haw_Zl.css","assets/QueueOptionsButton-Djq4Cpex.js","assets/vendor-ui-3qrARCPr.js","assets/QueueOptionsButton-CM15uQn8.css","assets/AnimeMetaDetails-BogOi_bM.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/useIsMobile-Dvx1uJ82.js","assets/SynopsisText-CYv2W3yR.css","assets/AnimeInfo-BivVqWcB.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Y as r,_ as t}from"./index-CnfZwsds.js";import{u as o,P as e,z as i}from"./vendor-core-DfaOB3Rn.js";import"./vendor-query-BBT5_sHx.js";import"./vendor-icons-DrybRNxP.js";const a=i(()=>t(()=>import("./AnimeInfo-Et6687Tl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])));function p(){return o(e,{fallback:o(r,{}),children:o(a,{})})}export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{T as Ve,u as e,A as _,d as g,h as w,a as Qe,g as _e,q as G,S as O,$ as Je,o as gt,p as ft}from"./vendor-core-DfaOB3Rn.js";import{I as y}from"./vendor-icons-DrybRNxP.js";import{u as bt}from"./vendor-query-BBT5_sHx.js";import{T as ze}from"./ToggleSwitch-CN_ppEc9.js";import{g as we,t as je,P as vt,B as Le,M as Fe,K as B,z as te,Q as yt}from"./index-
|
|
1
|
+
import{T as Ve,u as e,A as _,d as g,h as w,a as Qe,g as _e,q as G,S as O,$ as Je,o as gt,p as ft}from"./vendor-core-DfaOB3Rn.js";import{I as y}from"./vendor-icons-DrybRNxP.js";import{u as bt}from"./vendor-query-BBT5_sHx.js";import{T as ze}from"./ToggleSwitch-CN_ppEc9.js";import{g as we,t as je,P as vt,B as Le,M as Fe,K as B,z as te,Q as yt}from"./index-CnfZwsds.js";import{M as kt}from"./MediaCard--cuFxOCS.js";import{c as Ge,a as Ze,d as wt,e as Xe,f as et,g as Nt,h as Ct,i as St,j as Tt,k as Ye,l as $e}from"./useAsmr-BbhQ59bk.js";import{a as t}from"./Asmr.module-CdWlioTY.js";import{u as At,A as Mt}from"./useAsmrPopup-SymV1J-b.js";import{l as xt}from"./hls-BGCX7mJy.js";import{p as ae}from"./page.module-C1MlZzf3.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./usePopup-DS9jMzp6.js";const Lt=({work:s,onClose:i,onPlay:C,t:f})=>{const{data:c,isLoading:m}=Ge(s.id||null),v=Ze(s),{data:A}=wt(v||void 0),{toggle:k,bookmarkedIds:T}=Xe(),{data:R}=et(v||void 0),I=v?T.has(v):!!A?.inLibrary,N=Ve(()=>(c?.description||s.description||"").split(`
|
|
2
2
|
`).map(o=>{const l=o.indexOf(":");return l===-1?null:{label:o.slice(0,l),value:o.slice(l+1).trim()}}).filter(o=>!!o&&!!o.value),[c?.description,s.description]),b=c?.tracks||[],M=s.thumbnail||c?.images?.[0],S=Ve(()=>{const o=R?.progress??[];return o.length>0?o.reduce((l,x)=>l.updatedAt>=x.updatedAt?l:x):null},[R]),u=S&&S.trackIndex<b.length?S.trackIndex:null;return e("div",{className:t.detailOverlay,onClick:i,children:e("div",{className:t.detailModal,onClick:o=>o.stopPropagation(),children:[e("button",{className:t.detailClose,onClick:i,"aria-label":"Close",children:e(y,{name:"times"})}),e("div",{className:t.detailHeader,children:[M?e("img",{className:t.detailCover,src:M,alt:s.name,decoding:"async"}):e("div",{className:`${t.detailCover} ${t.thumbPlaceholder}`}),e("div",{className:t.detailInfo,children:[e("h2",{className:t.detailTitle,children:f?f(s.name):s.name}),e("p",{className:t.detailRj,children:s.id}),N.map(o=>o.label==="Tags"?e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:"Tags"}),e("span",{className:t.tagChips,children:o.value.split(", ").map(l=>e("span",{className:t.tagChip,children:l},l))})]},o.label):e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:o.label}),o.value]},o.label))]})]}),e("div",{className:t.tracksSection,children:[e("h3",{className:t.tracksHeading,children:m?"Loading tracks…":`Tracks (${b.length})`}),!m&&(b.length>0?e("ul",{className:t.trackList,children:b.map((o,l)=>e("li",{children:e("button",{className:t.trackRow,onClick:()=>C(s,b,l),children:[e(y,{name:"play",className:t.trackIcon}),e("span",{className:t.trackLabel,children:o.resolutionStr}),e("span",{className:t.trackType,children:o.hls?"HLS":"MP3"})]})},o.link))}):e("p",{className:t.noTracks,children:"No audio streams available for this work."}))]}),e("div",{className:t.detailActions,children:[!m&&b.length>0&&e("button",{className:t.playAllBtn,onClick:()=>C(s,b,0),children:[e(y,{name:"play"})," Play from start"]}),!m&&u!==null&&S&&e("button",{className:t.playAllBtn,onClick:()=>C(s,b,u),children:[e(y,{name:"history"})," Resume track ",u+1," ·"," ",we(S.currentTime),S.duration>0?` / ${we(S.duration)}`:""]}),v&&e("button",{className:t.playAllBtn,onClick:()=>k({rjCode:v,title:s.name,thumbnail:s.thumbnail||"",isAdult:!!s.isAdult}),"aria-pressed":I,children:[e(y,{name:I?"check":"plus"})," ",I?"In listening list":"Add to listening list"]})]})]})})},Pt=({title:s,images:i,chapters:C,tracks:f,trackIndex:c,expanded:m,isAdult:v,rjCode:A,t:k,onTrackChange:T,onExpandedChange:R,onClose:I})=>{const N=_(null),b=_(null),[M,S]=g(!1),[u,o]=g(0),[l,x]=g(0),[p,q]=g(0),[L,Z]=g(!0),[F,K]=g(0),[j,ne]=g(new Set),[H,X]=g(!1),[he,$]=g(!0),ee=_("");ee.current||(ee.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`asmr-${Date.now()}-${Math.random().toString(36).slice(2)}`);const[U,Ne]=g(()=>{const a=parseFloat(localStorage.getItem("asmrVolume")||"");return Number.isFinite(a)?a:1}),pe=_(U);w(()=>{pe.current=U},[U]);const ge=Qe(),z=_e.useMemo(()=>A?Nt(A):"",[A]),Ce=Ct(),re=St(),{data:se}=et(z||void 0),[Pe,le]=g(!1),Q=_(""),W=_(null),fe=_(0),Y=_(0),oe=_(0),ie=f[c],V=ie?.link,Se=ie?.hls,be=ie?.resolutionStr||"",ce=i.length>0,de=`${z}:${c}`,ue=_e.useMemo(()=>(se?.progress??[]).find(r=>r.trackIndex===c)??null,[se,c]),n=_({workId:"",trackIndex:0,trackLabel:""}),d=_(se);d.current=se,n.current={workId:z,trackIndex:c,trackLabel:be};const P=G((a,r,h,E=!1)=>{!a.workId||!h||h<10||!E&&Math.abs(r-fe.current)<5||(fe.current=r,Ce.mutate({workId:a.workId,trackIndex:a.trackIndex,trackLabel:a.trackLabel,currentTime:Math.floor(r),duration:Math.floor(h),title:s,thumbnail:i[0]||"",rjCode:a.workId,isAdult:v?1:0}))},[Ce,s,i,v]),me=G((a=!1)=>{W.current&&(clearTimeout(W.current),W.current=null),P(n.current,Y.current,oe.current,a)},[P]),J=_(me);J.current=me;const ve=_(P);ve.current=P;const D=G(()=>{b.current&&(b.current.destroy(),b.current=null)},[]);w(()=>{const a=N.current;if(!a||!V)return;const r={workId:z,trackIndex:c,trackLabel:be},h=()=>{W.current&&(clearTimeout(W.current),W.current=null),ve.current(r,Y.current,oe.current,!0)};o(0),x(0),q(0),S(!1),Y.current=0,oe.current=0,fe.current=0,D();const E=d.current?.progress?.find(xe=>xe.trackIndex===c),Me=E?.currentTime||0,Ie=E?.duration||0,ke=Me>=10&&Ie-Me>=15;if(Se){let xe=!1;return(async()=>{const Be=await xt();if(!xe)if(Be&&Be.isSupported()){const Re=new Be({enableWorker:!0});b.current=Re,Re.loadSource(V),Re.attachMedia(a),ke||a.play().catch(()=>S(!1))}else a.src=V,a.load(),a.volume=pe.current,ke||a.play().catch(()=>S(!1))})(),()=>{xe=!0,D(),a.removeAttribute("src"),h()}}else a.src=V;return a.load(),a.volume=pe.current,ke||a.play().catch(()=>S(!1)),()=>{D(),a.removeAttribute("src"),h()}},[V,Se,D,z,c,be]),w(()=>()=>D(),[D]),w(()=>{const a=()=>{document.visibilityState==="hidden"&&J.current()},r=()=>J.current();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",r),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",r)}},[]),w(()=>{if(!ue||Q.current===de||!(l>0))return;const a=ue.currentTime||0,r=ue.duration||l;if(Q.current=de,!(a>=10&&r-a>=15&&Y.current<a))return;const h=N.current;h&&(h.currentTime=a,Y.current=a,o(a),h.play().catch(()=>{}))},[ue,l,de]),w(()=>{const a=N.current;a&&(a.volume=U)},[U]),w(()=>{if(m)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[m]),w(()=>{K(0)},[i]),w(()=>{m&&$(!0)},[m]),w(()=>{H&&$(!0)},[H]);const Te=G(a=>{if(!s||f.length===0)return;const r=f[c],h=r?`${r.resolutionStr} (${c+1}/${f.length})`:"",E=N.current,Me=E?E.currentTime:0,Ie=E&&E.duration||0,ke=i[0]||"";je.discord.asmrPresence.mutate({title:s,trackLabel:h,isPlaying:a,thumbnail:ke,thumbnails:i,currentTime:Me,duration:Ie,isAdult:!!v,rjCode:A||"",sessionId:ee.current}).catch(()=>{}),je.discord.heartbeat.mutate({sessionId:ee.current}).catch(()=>{})},[s,f,c,i,v,A]);w(()=>{Te(M)},[Te,M,c,s,m]),w(()=>{if(!M)return;const a=window.setInterval(()=>Te(!0),15e3);return()=>window.clearInterval(a)},[M,Te]),w(()=>{const a=ee.current,r=()=>vt(a),h=()=>r(),E=()=>{document.visibilityState==="hidden"&&r()};return window.addEventListener("pagehide",h),window.addEventListener("beforeunload",h),document.addEventListener("visibilitychange",E),()=>{window.removeEventListener("pagehide",h),window.removeEventListener("beforeunload",h),document.removeEventListener("visibilitychange",E),r()}},[]);const Ae=G(a=>{ne(r=>{if(r.has(a))return r;const h=new Set(r);return h.add(a),h})},[]),at=G((a,r)=>{a&&a.complete&&a.naturalWidth>0&&Ae(r)},[Ae]);w(()=>{if(!m)return;const a=r=>{if(r.key==="Escape"){H?X(!1):R(!1);return}!L||i.length<2||(r.key==="ArrowLeft"&&K(h=>Math.max(0,h-1)),r.key==="ArrowRight"&&K(h=>Math.min(i.length-1,h+1)))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[m,L,i.length,H,R]);const nt=()=>{const a=N.current;a&&(a.paused?a.play().catch(()=>{}):a.pause())},rt=a=>{const r=N.current;if(!r||!l)return;const h=parseFloat(a.target.value);r.currentTime=h,o(h)},st=()=>{me(!0),c<f.length-1?T(c+1):le(!0)},lt=a=>{const r=a.currentTarget.currentTime;Y.current=r,o(r),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>J.current(),5e3)},ot=()=>{S(!1),J.current()},it=a=>{const r=a.currentTarget.duration;oe.current=Number.isFinite(r)?r:0,x(a.currentTarget.duration)},ct=G(()=>{z&&re.mutate({rjCode:z,title:s,thumbnail:i[0]||"",status:"Completed",isAdult:!!v,silent:!0}),le(!1),I(),ge("/")},[z,re,s,i,v,I,ge]),dt=C.reduce((a,r,h)=>u>=r.time?h:a,-1),ut=a=>{const r=N.current;r&&(r.currentTime=a,o(a))},De=a=>{const r=N.current;if(!r)return;const h=Number.isFinite(r.currentTime)?r.currentTime:u,E=Math.max(0,Math.min(l||1/0,h+a));r.currentTime=E,o(E),$(!0)},Oe=l?Math.min(100,u/l*100):0,mt=l?Math.min(100,Math.max(Oe,p/l*100)):0,ht=e(O,{children:[e("div",{className:t.playerButtons,children:[e("button",{className:t.playerBtn,onClick:()=>T(Math.max(0,c-1)),disabled:c===0,"aria-label":"Previous track",children:e(y,{name:"step-backward"})}),e("button",{className:`${t.playerBtn} ${t.seekBtn}`,onClick:()=>De(-10),"aria-label":"Seek back 10 seconds",title:"Back 10s",children:[e(y,{name:"undo"}),e("span",{className:t.seekBtnLabel,children:"10"})]}),e("button",{className:`${t.playerBtn} ${t.playBtn}`,onClick:nt,"aria-label":M?"Pause":"Play",children:M?e(y,{name:"pause"}):e(y,{name:"play"})}),e("button",{className:`${t.playerBtn} ${t.seekBtn}`,onClick:()=>De(10),"aria-label":"Seek forward 10 seconds",title:"Forward 10s",children:[e(y,{name:"redo"}),e("span",{className:t.seekBtnLabel,children:"10"})]}),e("button",{className:t.playerBtn,onClick:()=>T(Math.min(f.length-1,c+1)),disabled:c>=f.length-1,"aria-label":"Next track",children:e(y,{name:"step-forward"})})]}),e("div",{className:t.seekRow,children:[e("span",{className:t.timeLabel,children:we(u)}),e("input",{className:t.seekBar,type:"range",min:0,max:l||0,step:.1,value:Math.min(u,l||0),onChange:rt,style:{"--played-percent":`${Oe}%`,"--buffered-percent":`${mt}%`},"aria-label":"Seek"}),e("span",{className:t.timeLabel,children:we(l)})]})]}),He=e(O,{children:[e("button",{className:`${t.playerBtn} ${t.playerToggle}`,onClick:()=>R(!m),"aria-label":m?"Minimize player":"Expand player",title:m?"Minimize to browse":"Expand",children:m?e(y,{name:"chevron-down"}):e(y,{name:"chevron-up"})}),e("div",{className:t.playerInfo,children:[e("p",{className:t.playerTitle,title:s,children:k?k(s):s}),e("p",{className:t.playerTrack,children:[ie?.resolutionStr||"",f.length>1?` (${c+1}/${f.length})`:""]})]}),e("div",{className:t.playerControls,children:ht}),e("div",{className:t.playerRight,children:[U===0?e(y,{name:"volume-mute",className:t.volumeIcon}):U<.5?e(y,{name:"volume-down",className:t.volumeIcon}):e(y,{name:"volume-up",className:t.volumeIcon}),e("input",{className:t.volumeBar,type:"range",min:0,max:1,step:.01,value:U,onChange:a=>{const r=parseFloat(a.target.value);Ne(r),localStorage.setItem("asmrVolume",String(r))},style:{"--volume-percent":`${U*100}%`},"aria-label":"Volume"})]}),e("div",{className:t.playerActions,children:[m&&ce&&e("button",{className:t.playerBtn,onClick:()=>Z(a=>!a),"aria-label":L?"Hide images":"Show images",title:L?"Hide images":"Show images",children:L?e(y,{name:"eye-slash"}):e(y,{name:"image"})}),m&&C.length>0&&e("button",{className:`${t.playerBtn} ${H?t.playerBtnActive:""}`,onClick:()=>X(a=>!a),"aria-label":H?"Hide bookmarks":"Show bookmarks",title:"Timestamps",children:e(y,{name:"list-ol"})}),e("button",{className:t.playerBtn,onClick:I,"aria-label":"Close player",children:e(y,{name:"times"})})]})]}),Ue=e("audio",{ref:N,preload:"metadata",onPlay:()=>S(!0),onPause:ot,onTimeUpdate:lt,onLoadedMetadata:it,onProgress:a=>{const r=a.currentTarget;r.buffered.length>0&&q(r.buffered.end(r.buffered.length-1))},onEnded:st}),qe=e(Fe,{isOpen:Pe,onClose:()=>le(!1),title:"Finished!",children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e(y,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),e("p",{style:{fontSize:"1.1rem",fontWeight:600},children:k?k(s):s}),e("p",{style:{color:"var(--text-secondary)"},children:"You finished this work!"}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(Le,{variant:"secondary",onClick:()=>le(!1),children:"Close"}),e(Le,{onClick:ct,children:"Mark Completed & Back to Home"})]})]})});if(!m)return Je(e(O,{children:[Ue,e("div",{className:t.playerBar,children:He}),qe]}),document.body);const ye=Math.min(F,Math.max(0,i.length-1)),We=i[ye],pt=L&&ce&&!!We&&!j.has(We);return Je(e(O,{children:[Ue,qe,e("div",{className:`${t.npOverlay} ${he?"":t.npOverlayControlsHidden}`,children:[e("div",{className:`${t.npStage} ${!L||!ce?t.npStageBlank:""}`,onClick:()=>$(a=>!a),children:L&&ce&&e(O,{children:[e("div",{className:t.sliderViewport,children:[e("div",{className:t.sliderTrack,style:{transform:`translateX(-${ye*100}%)`},children:i.map(a=>e("div",{className:t.slide,children:e("img",{ref:r=>at(r,a),src:a,alt:`${k?k(s):s} — work image`,loading:"lazy",decoding:"async",draggable:!1,onLoad:()=>Ae(a),onError:()=>Ae(a),className:`${t.slideImg} ${j.has(a)?t.slideImgLoaded:""}`})},a))}),pt&&e("span",{className:t.slideSpinner,"aria-label":"Loading image"})]}),i.length>1&&e(O,{children:[e("button",{className:`${t.npArrow} ${t.npArrowLeft}`,onClick:a=>{a.stopPropagation(),K(r=>Math.max(0,r-1)),$(!0)},disabled:ye===0,"aria-label":"Previous image",children:e(y,{name:"chevron-left"})}),e("button",{className:`${t.npArrow} ${t.npArrowRight}`,onClick:a=>{a.stopPropagation(),K(r=>Math.min(i.length-1,r+1)),$(!0)},disabled:ye===i.length-1,"aria-label":"Next image",children:e(y,{name:"chevron-right"})}),e("span",{className:t.npImageCount,onClick:a=>a.stopPropagation(),children:[ye+1," / ",i.length]})]})]})}),e("div",{className:`${t.playerBar} ${t.playerBarDocked} ${he?"":t.playerBarDockedHidden}`,onClick:a=>a.stopPropagation(),children:[He,H&&e(O,{children:[e("div",{className:t.npBackdrop,onClick:()=>X(!1)}),e("div",{className:t.chapterPanel,children:C.map((a,r)=>e("button",{className:`${t.chapterRow} ${r===dt?t.chapterRowActive:""}`,title:k?k(a.label):a.label,onClick:()=>{ut(a.time),X(!1)},children:[e("span",{className:t.chapterRowTime,children:we(a.time)}),e("span",{className:t.chapterRowLabel,title:k?k(a.label):a.label,children:k?k(a.label):a.label})]},`${a.time}-${r}`))})]})]})]})]}),document.body)},It="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Bt=s=>{try{return JSON.parse(s.detail)}catch{return null}},Rt=({isOpen:s,onClose:i,onSuccess:C})=>{const[f,c]=g(1),[m,v]=g(typeof navigator<"u"?navigator.userAgent:""),[A,k]=g(""),[T,R]=g(!1),[I,N]=g(!1),b=_(null),M=typeof navigator<"u"?navigator.userAgent:"",S=/android/i.test(M),u=/firefox|fxios/i.test(M)&&!S,o=!u&&!S&&/chrome|chromium|edg|brave/i.test(M),l=u||o;w(()=>{s&&(c(1),v(typeof navigator<"u"?navigator.userAgent:""),k(""),R(!1),N(!1))},[s]),w(()=>()=>{b.current&&(window.removeEventListener("dango:jasmr-cookie",b.current),b.current=null)},[]);const x=async()=>{localStorage.setItem("jasmr_ua",m),window.open("https://japaneseasmr.com","_blank","noopener,noreferrer"),c(2)},p=()=>{if(I)return;N(!0);const L=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,Z=window.setTimeout(()=>{N(!1),b.current&&(window.removeEventListener("dango:jasmr-cookie",b.current),b.current=null),te.error("Helper not detected — install it via about:debugging first.")},3e3),F=K=>{const j=Bt(K);if(!(!j||j.requestId!==L))if(window.clearTimeout(Z),window.removeEventListener("dango:jasmr-cookie",F),b.current=null,N(!1),j?.ok&&j.cookie)k(j.cookie),te.success("Cookie extracted from helper!");else if(j?.error==="NO_COOKIE"){const ne=j.debug?.stores?.length??0,H=j.debug?.names??[];te.error(`Helper found no cf_clearance (checked ${ne} stores, saw: ${H.join(", ")||"none"}) — solve the challenge on the JapaneseASMR tab first.`)}else te.error("Helper request failed — try again.")};b.current=F,window.addEventListener("dango:jasmr-cookie",F),window.dispatchEvent(new CustomEvent("dango:get-jasmr-cookie",{detail:{requestId:L}}))},q=async()=>{if(!A.trim()){te.error("Please enter the cf_clearance cookie");return}R(!0);try{localStorage.setItem("jasmr_cookie",A.trim()),te.success("Cookie updated successfully!"),C?.(),i()}catch{te.error("Failed to save cookie")}finally{R(!1)}};return e(Fe,{isOpen:s,onClose:i,title:"JapaneseASMR Verification Required",children:e("div",{className:B.container,children:f===1?e(O,{children:[e("p",{children:["JapaneseASMR is protected by a Cloudflare challenge. Solve it once in your browser and paste the ",e("strong",{children:"cf_clearance"})," cookie so the app can load the site for you."]}),e("div",{className:B.field,children:[e("label",{children:"Your User-Agent (must match the browser you solve the challenge with):"}),e("textarea",{value:m,onChange:L=>v(L.target.value),rows:3,className:B.textarea})]}),e("div",{className:B.actions,children:[e("button",{className:B.secondaryButton,onClick:i,children:"Cancel"}),e("button",{className:B.button,onClick:x,children:"Start Verification (Opens JapaneseASMR)"})]})]}):e(O,{children:[e("p",{children:["1. Solve the challenge on the ",e("strong",{children:"JapaneseASMR tab"})," (keep that tab open).",e("br",{}),"2. Copy the ",e("strong",{children:"cf_clearance"})," cookie value using one of these:",e("br",{}),e("br",{}),e("strong",{children:"Chrome / Edge — DevTools:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Application"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", double-click its ",e("strong",{children:"Value"})," to select it, then copy.",e("br",{}),e("br",{}),e("strong",{children:"Firefox — Storage Inspector:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Storage"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", right-click the value → ",e("strong",{children:"Copy Value"}),".",e("br",{}),e("br",{}),e("strong",{children:"Either browser — extension:"})," open"," ",e("strong",{children:"Cookie Manager"})," while on the JapaneseASMR tab, find"," ",e("strong",{children:"cf_clearance"}),", and copy its value (or use the extension's export).",e("br",{}),e("br",{}),"3. Paste it below. Copy ",e("strong",{children:"only the value"})," — remove any"," ",e("code",{children:"cf_clearance="})," prefix or quotes if they were included."]}),l&&e("div",{className:B.hint,children:[e("strong",{children:"Dango helper (one-time setup):"})," ",u?e(O,{children:["type ",e("code",{children:"about:debugging"})," in the address bar →"," ",e("strong",{children:"This Firefox"})," → ",e("strong",{children:"Load Temporary Add-on"})," ","→ open the ",e("code",{children:"dango-extension/firefox"})," folder and pick"," ",e("code",{children:"manifest.json"}),". (Temporary helpers unload when Firefox closes — repeat after a restart.)"]}):e(O,{children:["type ",e("code",{children:"chrome://extensions"})," in the address bar → enable"," ",e("strong",{children:"Developer mode"})," → ",e("strong",{children:"Load unpacked"})," → open the ",e("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice — expected.)"]})," ","Use this link to download the extension and extract it:"," ",e("a",{href:It,target:"_blank",rel:"noreferrer",className:B.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",e("div",{className:B.actions,children:e("button",{className:B.button,onClick:p,disabled:I,type:"button",children:I?"Extracting…":"Extract cookie from helper"})})]}),e("div",{className:B.field,children:[e("label",{children:"cf_clearance cookie value:"}),e("input",{type:"text",value:A,onChange:L=>k(L.target.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:B.input})]}),e("div",{className:B.actions,children:[e("button",{className:B.secondaryButton,onClick:i,children:"Cancel"}),e("button",{className:B.secondaryButton,onClick:()=>c(1),children:"Back"}),e("button",{className:B.button,onClick:q,disabled:T,children:T?"Saving...":"Submit"})]})]})})})},tt="asmrTranslateCache",$t=10080*60*1e3;function Et(){try{const s=localStorage.getItem(tt);if(!s)return new Map;const i=JSON.parse(s);return new Map(Object.entries(i))}catch{return new Map}}function _t(s){try{const i={};for(const[C,f]of s)i[C]=f;localStorage.setItem(tt,JSON.stringify(i))}catch{}}function Ke(s){return/[\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF]/.test(s)}async function jt(s){const i=s.map(c=>c.trim()).filter(Boolean);if(i.length===0)return new Map;const C=await je.settings.translate.mutate({texts:i,source:"ja",target:"en"}),f=new Map;for(const[c,m]of Object.entries(C.translations||{}))f.set(c,m);for(const c of i)f.has(c)||f.set(c,c);return f}function Ft(s,i){const[C,f]=g(new Map),[c,m]=g(!1),v=_(null),A=s.join("");return w(()=>{const T=A?A.split(""):[];if(!i||T.length===0){f(new Map),m(!1);return}const R=Array.from(new Set(T.map(u=>u.trim()).filter(Boolean).filter(Ke)));if(R.length===0){f(new Map);return}v.current||(v.current=Et());const I=Date.now(),N=new Map,b=[];for(const u of R){const o=v.current.get(u);o&&I-o.ts<$t?N.set(u,o.t):b.push(u)}if(b.length===0){f(N);return}let M=!1;m(!0);const S=[];for(let u=0;u<b.length;u+=15)S.push(b.slice(u,u+15));return(async()=>{const u=new Map;for(const l of S){try{const x=await jt(l);for(const[p,q]of x)u.set(p,q)}catch{}await new Promise(x=>setTimeout(x,120))}if(M)return;if(v.current){for(const[l,x]of u)v.current.set(l,{t:x,ts:Date.now()});_t(v.current)}const o=new Map([...N,...u]);f(o),m(!1)})(),()=>{M=!0}},[i,A]),{t:T=>!i||!T||!Ke(T)?T:C.get(T.trim())||T,map:C,isTranslating:c}}const Dt=[{label:"Date",options:[{value:"latest",label:"Latest"},{value:"oldest",label:"Oldest"}]},{label:"Title",options:[{value:"title_asc",label:"A → Z"},{value:"title_desc",label:"Z → A"}]},{label:"Popular (Views)",options:[{value:"popular_recent",label:"Recent"},{value:"popular_week",label:"Week"},{value:"popular_month",label:"Month"},{value:"popular_6_months",label:"6 Months"},{value:"popular_year",label:"Year"},{value:"popular",label:"All Time"}]},{label:"Most Commented",options:[{value:"comments_week",label:"Week"},{value:"comments_month",label:"Month"},{value:"comments_year",label:"Year"},{value:"comments",label:"All Time"}]},{label:"Other",options:[{value:"random",label:"Random"}]}],Ot=[{value:"",label:"All"},{value:"sfw",label:"SFW / 全年齢"},{value:"r-15",label:"R-15"},{value:"r-18",label:"NSFW / R18"},{value:"yuri",label:"Yuri / Girls love / 百合"},{value:"otokonoko",label:"Otoko no ko / 男の娘"},{value:"futanari",label:"Futanari / フタナリ"},{value:"r-18g",label:"R-18G / グロ"}],Ht=[{value:"sfw",label:"SFW / 全年齢"}],Ee="agreedToViewMature",aa=()=>{const{rj:s}=gt(),i=Qe(),[C,f]=ft(),[c,m]=g(()=>localStorage.getItem(Ee)==="true"),[v,A]=g(!1),[k,T]=g(()=>C.get("q")||""),[R,I]=g(()=>C.get("q")||""),[N,b]=g("latest"),[M,S]=g("sfw"),[u,o]=g(1),[l,x]=g(null),[p,q]=g(null),[L,Z]=g(!0),[F,K]=g(()=>localStorage.getItem("asmrTranslateEN")==="true"),[j,ne]=g(!1),H=bt(),{toggle:X,bookmarkedIds:he}=Xe(),{popup:$,openPopup:ee,scheduleClose:U,cancelClose:Ne,closePopup:pe}=At();w(()=>yt("jasmr",()=>ne(!0)),[]),w(()=>{localStorage.setItem("asmrTranslateEN",String(F))},[F]),w(()=>{const n=()=>m(localStorage.getItem(Ee)==="true");return window.addEventListener("focus",n),window.addEventListener("storage",n),()=>{window.removeEventListener("focus",n),window.removeEventListener("storage",n)}},[]);const ge=c,z=ge?M:"sfw",Ce=ge?Ot:Ht,{data:re,isLoading:se,isError:Pe,isFetching:le}=Tt(R,u,N,z),Q=_e.useMemo(()=>re?.shows??[],[re?.shows]),W=re?.hasNext??!1;w(()=>{if(!s){l&&!p&&x(null);return}const n=s.toUpperCase();if(p&&(p.work.id?.toUpperCase()===n||p.work._id?.toUpperCase()===n)){l&&x(null);return}const d=Q.find(P=>(P.id||P._id)?.toUpperCase()===n);d?(!l||(l.id||l._id)!==(d.id||d._id))&&x(d):(!l||(l.id||l._id)?.toUpperCase()!==n)&&x({_id:n,id:n,name:n})},[s,Q,p,l]);const fe=G(()=>{i("/asmr")},[i]);w(()=>{!s&&p&&q(null)},[s,p]);const{data:Y}=Ge(p&&p.work.id||null),oe=p?[p.work.thumbnail,...Y?.images||[]].filter(Boolean):[],ie=[...Q.map(n=>n.name),l?.name||"",p?.work.name||"",...Y?.chapters?.map(n=>n.label)||[]].filter(Boolean),{t:V}=Ft(ie,F);w(()=>{const n=p?p.work.name:l?l.name:s?s.toUpperCase():"",d=n?F?V(n):n:"",P=d?`${d} - dango`:"dango";document.title=P;try{window.history.replaceState(window.history.state,P,window.location.href)}catch{}},[l,p,s,F,V]);const Se=n=>{n.preventDefault(),I(k),o(1);const d=new URLSearchParams(C);k.trim()?d.set("q",k.trim()):d.delete("q"),d.delete("page"),f(d,{replace:!0})};w(()=>{const n=C.get("q")||"";T(d=>d===n?d:n),I(d=>d===n?d:n),o(1)},[C]);const be=n=>{n.target.checked&&!c&&A(!0)},ce=()=>{localStorage.setItem(Ee,"true"),m(!0),A(!1),o(1)},de=()=>{A(!1)},ue=G((n,d,P)=>{x(null),Z(!0),q({work:n,tracks:d,index:P})},[]);return e("div",{className:`${ae.page} ${p?ae.pageWithPlayer:""}`,children:[!(p&&L)&&e(O,{children:[e("header",{className:ae.header,children:[e("h1",{className:ae.pageTitle,children:[e(y,{name:"headphones"})," ASMR"]}),e("form",{className:ae.searchForm,onSubmit:Se,children:[e("input",{className:ae.searchInput,type:"text",value:k,onChange:n=>T(n.target.value),placeholder:"Search works, circles, CV… (-word excludes)","aria-label":"Search ASMR works"}),e("button",{className:ae.searchBtn,type:"submit","aria-label":"Search",children:e(y,{name:"search"})})]})]}),e("div",{className:t.filterBar,children:[e("label",{className:t.filterLabel,htmlFor:"asmr-sort",children:"Sort"}),e("select",{id:"asmr-sort",className:t.sortSelect,value:N,onChange:n=>{b(n.target.value),o(1)},children:Dt.map(n=>e("optgroup",{label:n.label,children:n.options.map(d=>e("option",{value:d.value,children:d.label},d.value))},n.label))}),e("label",{className:t.filterLabel,htmlFor:"asmr-rating",children:"Type"}),e("select",{id:"asmr-rating",className:t.sortSelect,value:M,onChange:n=>{S(n.target.value),o(1)},children:Ce.map(n=>e("option",{value:n.value,children:n.label},n.value))}),e("div",{className:t.filterTogglesGroup,children:[e("div",{className:t.translateToggleWrap,children:[e("span",{className:t.filterLabel,children:"JP"}),e(ze,{id:"asmr-translate-toggle",isChecked:F,onChange:n=>K(n.target.checked)}),e("span",{className:t.filterLabel,children:"EN"})]}),!c&&e("div",{className:t.matureToggleWrap,children:[e("label",{className:t.matureLabel,htmlFor:"asmr-mature-toggle",children:"Mature"}),e(ze,{id:"asmr-mature-toggle",isChecked:!1,onChange:be})]})]})]}),Pe?e("p",{className:t.statusMsg,children:"Failed to load works. Please try again."}):se&&Q.length===0?e("div",{className:t.grid,"aria-hidden":!0,children:Array.from({length:12}).map((n,d)=>e("div",{className:t.skeletonCard,children:[e("div",{className:`${t.skeletonThumb} ${t.shimmer}`}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"88%"}}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"55%"}})]},d))}):Q.length===0?e("p",{className:t.statusMsg,children:"No works found."}):e(O,{children:[e("div",{className:`${t.grid} ${le?t.fetching:""}`,children:Q.map(n=>{const d=F?{...n,name:V(n.name)}:n,P=Ze(n),me=Ye(P),J=he.has(me),ve=`/asmr/${encodeURIComponent(P)}`;return e("div",{className:t.asmrCardWrap,children:[e(kt,{item:{id:me,title:d.name,thumbnail:n.thumbnail||"",typeBadge:P||void 0,isAdult:$e(n)},linkTo:ve,hoverIcon:"info",layout:"horizontal",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!1,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:D=>ee(D,{rjCode:P,title:d.name,thumbnail:n.thumbnail||"",isAdult:$e(n),rating:n.rating,listenTarget:ve}),onPopupHoverIntent:D=>D?Ne():U(),rawThumbnail:!0}),e("button",{className:`${t.bookmarkBtn} ${J?t.bookmarked:""}`,onClick:D=>{D.preventDefault(),D.stopPropagation(),X({rjCode:P,title:n.name,thumbnail:n.thumbnail||"",isAdult:$e(n)})},title:J?"Remove from listening list":"Add to listening list","aria-label":J?"Remove from listening list":"Add to listening list","aria-pressed":J,children:e(y,{name:J?"check":"plus",size:12})})]},n._id||n.id)})}),e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:u<=1,onClick:()=>o(n=>Math.max(1,n-1)),children:"Previous"}),e("span",{className:t.pageIndicator,children:["Page ",u]}),e("button",{className:t.pageBtn,disabled:!W,onClick:()=>o(n=>n+1),children:"Next"})]})]})]}),l&&e(Lt,{work:l,onClose:fe,onPlay:ue,t:V}),$&&e(Mt,{data:$.data,anchorRect:$.rect,bookmarked:he.has(Ye($.data.rjCode)),onToggleBookmark:()=>X({rjCode:$.data.rjCode,title:$.data.title,thumbnail:$.data.thumbnail||"",isAdult:$.data.isAdult}),onMouseEnter:Ne,onMouseLeave:U,onRequestClose:pe}),j&&e(Rt,{isOpen:j,onClose:()=>ne(!1),onSuccess:()=>{H.invalidateQueries({queryKey:["asmrBrowse"]}),H.invalidateQueries({queryKey:["asmrWork"]})}}),v&&e(Fe,{isOpen:v,title:"Content Warning",onClose:de,children:e("div",{style:{padding:"var(--space-4)",textAlign:"center"},children:[e("p",{children:"This section contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),e("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-secondary)",marginTop:"var(--space-4)"},children:["You can reset this preference at any time in the ",e("strong",{children:"Settings"})," page."]}),e("div",{style:{marginTop:"var(--space-4)",display:"flex",gap:"var(--space-2-5)",justifyContent:"center"},children:[e(Le,{variant:"secondary",onClick:de,children:"Go Back"}),e(Le,{onClick:ce,children:"I'm 18+, Continue"})]})]})}),p&&e(Pt,{title:p.work.name,images:oe,chapters:Y?.chapters||[],tracks:p.tracks,trackIndex:p.index,expanded:L,isAdult:!!p.work.isAdult,rjCode:p.work.id||p.work._id,t:V,onTrackChange:n=>q(d=>d&&{...d,index:n}),onExpandedChange:Z,onClose:()=>{q(null),Z(!0),s&&i("/asmr")}})]})};export{aa as default};
|
package/client/dist/assets/{AsmrResetProgressModal-MQA_bNQM.js → AsmrResetProgressModal-DgEWBJOw.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,u as i}from"./vendor-core-DfaOB3Rn.js";import{R as l}from"./ResetProgressModal
|
|
1
|
+
import{d as a,u as i}from"./vendor-core-DfaOB3Rn.js";import{R as l}from"./ResetProgressModal-CMF86mX6.js";import{s as f,n as R}from"./useAsmr-BbhQ59bk.js";const p=({workId:e,title:m,onClose:o})=>{const[r,s]=a(!1),t=f(),n=R();return i(l,{isOpen:!!e,itemName:m,progressKind:"listening",listLabel:"my listening list",alsoRemove:r,onAlsoRemoveChange:s,onClose:()=>{s(!1),o()},onConfirm:()=>{e&&(t.mutate({workId:e}),r&&n.mutate({id:e}),s(!1),o())}})};export{p as A};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{u as r,A as w,d as k,h as $,q as x,T as pe,$ as At}from"./vendor-core-DfaOB3Rn.js";import{B as re,M as $t,S as ye,h as Ft,R as Rt,t as Xe,P as Dt,g as Ot}from"./index-CnfZwsds.js";import{I as J}from"./vendor-icons-DrybRNxP.js";import{u as qt}from"./vendor-query-BBT5_sHx.js";const Ht="_controls_p5g5s_1",Vt="_titleContainer_p5g5s_9",zt="_scheduleInfo_p5g5s_15",Wt="_status_p5g5s_23",Ut="_nextEpisode_p5g5s_35",Kt="_watchlistBtn_p5g5s_45",jt="_inList_p5g5s_72",Gt="_queueBtn_p5g5s_83",Xt="_queueActive_p5g5s_95",Jt="_modeToggleBtn_p5g5s_101",Qt="_modeToggleActive_p5g5s_108",Yt="_nativeToggleBtn_p5g5s_119",Zt="_nativeToggleActive_p5g5s_132",en="_markWatchedBtn_p5g5s_153",tn="_markWatchedDone_p5g5s_167",nn="_completeSeriesBtn_p5g5s_178",rn="_streamPanel_p5g5s_192",sn="_desktopEpisodeActions_p5g5s_206",on="_sourceSelectionContainer_p5g5s_212",cn="_sourceLoader_p5g5s_213",an="_episodeActions_p5g5s_226",ln="_mobileEpisodeActions_p5g5s_240",un="_episodeNavBtn_p5g5s_244",dn="_primary_p5g5s_274",pn="_secondary_p5g5s_284",fn="_episodePickerBtn_p5g5s_288",mn="_queueCountdown_p5g5s_292",gn="_speedBoostBadge_p5g5s_307",hn="_videoContainer_p5g5s_338",_n="_loadingOverlay_p5g5s_351",vn="_loadingDots_p5g5s_365",yn="_dot_p5g5s_370",bn="_bounce_p5g5s_1",wn="_bufferingOverlay_p5g5s_399",Sn="_bufferingSpinner_p5g5s_408",Cn="_spin_p5g5s_948",kn="_videoIframe_p5g5s_423",En="_videoElementHidden_p5g5s_446",Ln="_upscalerCanvas_p5g5s_451",Tn="_upscalerActive_p5g5s_464",Bn="_upscalerStatusBadge_p5g5s_468",xn="_subtitleOverlay_p5g5s_483",Nn="_controlsOverlay_p5g5s_495",In="_hidden_p5g5s_525",Pn="_centerPlayPause_p5g5s_531",Mn="_bottomControls_p5g5s_563",An="_progressBarContainer_p5g5s_580",$n="_progressBar_p5g5s_580",Fn="_scrubbing_p5g5s_603",Rn="_watchedBar_p5g5s_608",Dn="_bufferedBar_p5g5s_609",On="_thumb_p5g5s_631",qn="_timeBubble_p5g5s_652",Hn="_skipSegment_p5g5s_675",Vn="_op_p5g5s_689",zn="_ed_p5g5s_693",Wn="_recap_p5g5s_697",Un="_bottomControlsRow_p5g5s_701",Kn="_controlBtn_p5g5s_709",jn="_timeDisplay_p5g5s_733",Gn="_leftControls_p5g5s_742",Xn="_rightControls_p5g5s_743",Jn="_middleControls_p5g5s_744",Qn="_skipControls_p5g5s_750",Yn="_skipBtn_p5g5s_756",Zn="_volumeContainer_p5g5s_780",er="_volumeSlider_p5g5s_787",tr="_settingsMenu_p5g5s_865",nr="_slideUp_p5g5s_1",rr="_qualityListInMenu_p5g5s_904",sr="_ccOptionsContainer_p5g5s_905",or="_qualityItemInMenu_p5g5s_913",cr="_ccItem_p5g5s_914",ar="_active_p5g5s_935",ir="_spinner_p5g5s_948",lr="_watchBtn_p5g5s_1007",ur="_errorOverlay_p5g5s_1053",dr="_retryButton_p5g5s_1063",pr="_providerSelectContainer_p5g5s_1098",fr="_providerSelect_p5g5s_1098",mr="_sourceSelect_p5g5s_212",gr="_sourceButtons_p5g5s_1154",hr="_sourceButton_p5g5s_1154",_r="_detailsBox_p5g5s_1186",vr="_detailsToggleBtn_p5g5s_1199",yr="_detailsGridContainer_p5g5s_1222",br="_fadeIn_p5g5s_1",wr="_detailItem_p5g5s_1231",Sr="_animeStatus_p5g5s_1251",Cr="_genresList_p5g5s_1264",kr="_genreTag_p5g5s_1271",Er="_loadingDetails_p5g5s_1289",Lr="_descriptionSection_p5g5s_1296",Tr="_synopsisFlat_p5g5s_1304",Br="_description_p5g5s_1296",xr="_epJumpControls_p5g5s_1345",Nr="_epRangeButtons_p5g5s_1356",Ir="_metaTags_p5g5s_1362",Pr="_epRangeBtn_p5g5s_1369",Mr="_epJumpInputGroup_p5g5s_1384",Ar="_fullscreenActive_p5g5s_1416",$r="_errorSubtext_p5g5s_1460",xo={controls:Ht,titleContainer:Vt,scheduleInfo:zt,status:Wt,nextEpisode:Ut,watchlistBtn:Kt,inList:jt,queueBtn:Gt,queueActive:Xt,modeToggleBtn:Jt,modeToggleActive:Qt,nativeToggleBtn:Yt,nativeToggleActive:Zt,markWatchedBtn:en,markWatchedDone:tn,completeSeriesBtn:nn,streamPanel:rn,desktopEpisodeActions:sn,sourceSelectionContainer:on,sourceLoader:cn,episodeActions:an,mobileEpisodeActions:ln,episodeNavBtn:un,primary:dn,secondary:pn,episodePickerBtn:fn,queueCountdown:mn,speedBoostBadge:gn,videoContainer:hn,loadingOverlay:_n,loadingDots:vn,dot:yn,bounce:bn,bufferingOverlay:wn,bufferingSpinner:Sn,spin:Cn,videoIframe:kn,videoElementHidden:En,upscalerCanvas:Ln,upscalerActive:Tn,upscalerStatusBadge:Bn,subtitleOverlay:xn,controlsOverlay:Nn,hidden:In,centerPlayPause:Pn,bottomControls:Mn,progressBarContainer:An,progressBar:$n,scrubbing:Fn,watchedBar:Rn,bufferedBar:Dn,thumb:On,timeBubble:qn,skipSegment:Hn,op:Vn,ed:zn,recap:Wn,bottomControlsRow:Un,controlBtn:Kn,timeDisplay:jn,leftControls:Gn,rightControls:Xn,middleControls:Jn,skipControls:Qn,skipBtn:Yn,volumeContainer:Zn,volumeSlider:er,settingsMenu:tr,slideUp:nr,qualityListInMenu:rr,ccOptionsContainer:sr,qualityItemInMenu:or,ccItem:cr,active:ar,spinner:ir,watchBtn:lr,errorOverlay:ur,retryButton:dr,providerSelectContainer:pr,providerSelect:fr,sourceSelect:mr,sourceButtons:gr,sourceButton:hr,detailsBox:_r,detailsToggleBtn:vr,detailsGridContainer:yr,fadeIn:br,detailItem:wr,animeStatus:Sr,genresList:Cr,genreTag:kr,loadingDetails:Er,descriptionSection:Lr,synopsisFlat:Tr,description:Br,epJumpControls:xr,epRangeButtons:Nr,metaTags:Ir,epRangeBtn:Pr,epJumpInputGroup:Mr,fullscreenActive:Ar,errorSubtext:$r},Fr="_playerPageLayout_hzfjd_1",Rr="_noSidebar_hzfjd_15",Dr="_episodeSidebar_hzfjd_19",Or="_playerMain_hzfjd_32",qr="_videoPlayerWrapper_hzfjd_40",Hr="_playerInfoHeader_hzfjd_56",Vr="_playerAnimeCard_hzfjd_62",zr="_playerInfoContainer_hzfjd_74",Wr="_infoColumns_hzfjd_86",Ur="_videoTitleSection_hzfjd_114",Kr="_theaterMode_hzfjd_296",jr="_theaterAmbient_hzfjd_330",Gr={playerPageLayout:Fr,noSidebar:Rr,episodeSidebar:Dr,playerMain:Or,videoPlayerWrapper:qr,playerInfoHeader:Hr,playerAnimeCard:Vr,playerInfoContainer:zr,infoColumns:Wr,videoTitleSection:Ur,theaterMode:Kr,theaterAmbient:jr},Xr="_shell_41rxp_1",Jr="_stage_41rxp_37",Qr="_shellFill_41rxp_85",Yr="_shellFullscreen_41rxp_93",Zr="_uiLayer_41rxp_107",es="_volumeWrap_41rxp_118",ts="_volumeSlider_41rxp_124",ce={shell:Xr,stage:Jr,shellFill:Qr,shellFullscreen:Yr,uiLayer:Zr,volumeWrap:es,volumeSlider:ts},ns=.8,rs=5,No=2e3,Ze="autoplayEnabled",ss=(e,n)=>n>0&&e>=n*ns,Io=(e,n)=>e>rs&&!ss(e,n),Po=()=>{try{return localStorage.getItem(Ze)==="true"}catch{return!1}},Mo=e=>{try{localStorage.setItem(Ze,String(e))}catch{}},os=["finished","completed","complete","ended"],Ao=(e,n,t)=>e.length>0&&!!n&&e[e.length-1]===n&&os.some(o=>String(t||"").trim().toLowerCase().includes(o)),$o=e=>e.seekInduced?"none":e.autoplayEnabled&&e.hasNext?"advance":e.hasNext?"prompt-next":e.isFinal?"prompt-complete":"none",cs=e=>(e.language??e.lang??"").toLowerCase(),as=e=>(e.label??"").toLowerCase(),is=e=>`${e.language??e.lang??""}|||${e.label??""}`,ls=e=>cs(e).startsWith("en")||as(e).includes("english");function Fo(e,n){if(e.length===0||n?.enabled===!1)return-1;const t=n?.lastKey??null;if(t){const s=e.findIndex(i=>is(i)===t);if(s>=0)return s}const o=e.findIndex(ls);return o>=0?o:0}const Z={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},xe=(e,n,t)=>Math.max(n,Math.min(t,e)),Ne=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),ke=(e,n,t,o)=>{try{const s=localStorage.getItem(e);if(s===null)return n;const i=parseFloat(s);return Number.isFinite(i)?xe(i,t,o):n}catch{return n}};function us(){let e=Z.edge,n=Z.bgColor,t=Z.textColor,o=Z.bold;try{const s=localStorage.getItem("subtitleEdge");(s==="shadow"||s==="outline"||s==="none")&&(e=s);const i=localStorage.getItem("subtitleBgColor");Ne(i)&&(n=i);const p=localStorage.getItem("subtitleTextColor");Ne(p)&&(t=p);const _=localStorage.getItem("subtitleBold");_!==null&&(o=_==="true")}catch{}return{fontSize:ke("subtitleFontSize",Z.fontSize,.5,10),position:ke("subtitlePosition",Z.position,0,100),bgOpacity:ke("subtitleBgOpacity",Z.bgOpacity,0,1),bgColor:n,textColor:t,edge:e,bold:o}}function et(e,n){const t=`rgba(0, 0, 0, ${xe(n,0,1)})`;if(!Ne(e))return t;const o=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${o}, ${s}, ${i}, ${xe(n,0,1)})`}function tt(e,n){return e==="none"?n<=0?"0 1px 3px rgba(0, 0, 0, 0.9)":"none":e==="outline"?["-1px 0 0 black","1px 0 0 black","0 -1px 0 black","0 1px 0 black","-1px -1px 0 black","1px -1px 0 black","-1px 1px 0 black","1px 1px 0 black","0 0 6px rgba(0, 0, 0, 0.9)"].join(", "):"0 0 4px black, 0 1px 2px rgba(0, 0, 0, 0.8)"}function Ro(e){return`
|
|
2
|
+
video::cue {
|
|
3
|
+
font-size: ${e.fontSize}rem !important;
|
|
4
|
+
color: ${e.textColor} !important;
|
|
5
|
+
background-color: ${et(e.bgColor,e.bgOpacity)} !important;
|
|
6
|
+
font-weight: ${e.bold?"bold":"normal"} !important;
|
|
7
|
+
text-shadow: ${tt(e.edge,e.bgOpacity)} !important;
|
|
8
|
+
}
|
|
9
|
+
`}function Do(e){return[`font-size: ${e.fontSize}rem`,`color: ${e.textColor}`,`background-color: ${et(e.bgColor,e.bgOpacity)}`,`font-weight: ${e.bold?"700":"400"}`,`text-shadow: ${tt(e.edge,e.bgOpacity)}`,"padding: 0.2em 0.5em","border-radius: 0.25em","text-align: center","position: absolute","left: 50%","transform: translateX(-50%)","max-width: 92%","white-space: pre-wrap","overflow-wrap: break-word","line-height: 1.4"].join(`;
|
|
10
|
+
`)+";"}const ds=new Set(["b","i","u","strong","em"]);function Oo(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/<(\/?)([a-zA-Z]+)>/g,(t,o,s)=>ds.has(s.toLowerCase())?`<${o}${s.toLowerCase()}>`:t)}function qo(e){return e.replace(/<[^>]*>/g,"")}const Ho=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],Vo=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function zo(e,n){const t=Number.isFinite(e)?e*16:Z.fontSize*16;return!Number.isFinite(n)||n<=0?t/16:Math.min(t,Math.max(13,n*.07))/16}function Wo(e){const n=Math.abs(e/1e3).toFixed(1);return e>0?`+${n}s`:e<0?`-${n}s`:"0.0s"}function Uo(e,n){const t=e.clientWidth||0,o=e.clientHeight||0,s=e.videoWidth>0&&e.videoHeight>0?e.videoWidth/e.videoHeight:0;let i=o;s>0&&t>0&&o>0&&(i=t/o>s?o:t/s);const p=Math.max(0,(o-i)/2),_=Math.max(0,Math.min(100,Number(n)||0))/100*i;return p+_}const Ko=({isOpen:e,onClose:n,title:t,message:o,resumeLabel:s="Resume",restartLabel:i="Start Over",onResume:p,onRestart:_})=>r($t,{isOpen:e,onClose:n,title:t,width:"sm",children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:o}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(re,{variant:"secondary",onClick:_,children:i}),r(re,{onClick:p,children:s})]})]})}),ps="_centerControls_61n7k_1",fs="_centerSkipBtn_61n7k_15",ms="_centerPlayPause_61n7k_40",gs="_playIconOffset_61n7k_71",de={centerControls:ps,centerSkipBtn:fs,centerPlayPause:ms,playIconOffset:gs},jo=({isPlaying:e,onTogglePlay:n,onSkipBack:t,onSkipForward:o,skipSeconds:s=10})=>r("div",{className:de.centerControls,onClick:i=>i.stopPropagation(),children:[r("button",{className:de.centerSkipBtn,onClick:t,title:`Skip back ${s}s`,"aria-label":`Skip back ${s} seconds`,children:r(J,{name:"replay-10"})}),r("button",{className:de.centerPlayPause,"data-speed-boost-ignore":"true",onClick:n,"aria-label":e?"Pause":"Play",children:e?r(J,{name:"pause"}):r(J,{name:"play",className:de.playIconOffset})}),r("button",{className:de.centerSkipBtn,onClick:o,title:`Skip forward ${s}s`,"aria-label":`Skip forward ${s} seconds`,children:r(J,{name:"forward-10"})})]}),Go=({visible:e,title:n,episode:t,onBack:o,classes:s})=>r("div",{className:`${s.overlay} ${e?"":s.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:s.top,onClick:i=>i.stopPropagation(),children:[r("button",{className:s.backBtn,onClick:i=>{i.stopPropagation(),o()},title:"Back","aria-label":"Back",children:r(J,{name:"chevron-left"})}),r("div",{className:s.titleInfo,children:[r("span",{className:s.title,children:n}),t&&r("span",{className:s.episode,children:t})]})]})}),Xo=({classes:e,videoRef:n,duration:t,formatTime:o,isScrubbing:s,buffered:i="auto",onSeek:p,onScrubStart:_,onScrubMove:a,onScrubEnd:g,timeLabelRef:S,children:u})=>{const E=w(null),b=w(null),l=w(null),v=w(null),C=w(null),f=w(!1),h=w(s);h.current=s;const d=w({onScrubMove:a,onScrubEnd:g});d.current={onScrubMove:a,onScrubEnd:g};const[N,M]=k({time:0,position:null});$(()=>{const m=n.current;if(!m)return;const y=Q=>{const D=Q/t*100||0;b.current&&(b.current.style.width=`${D}%`),l.current&&(l.current.style.left=`${D}%`),S?.current&&(S.current.innerText=`${o(Q)} / ${o(t)}`)},R=()=>{s||y(m.currentTime)},z=()=>{if(i==="auto"&&m.buffered.length>0){const D=m.buffered.end(m.buffered.length-1)/t*100||0;v.current&&(v.current.style.width=`${D}%`)}};return y(m.currentTime),z(),m.addEventListener("timeupdate",R),m.addEventListener("progress",z),()=>{m.removeEventListener("timeupdate",R),m.removeEventListener("progress",z)}},[n,t,s,i,o,S]);const q=m=>{if(!E.current)return 0;const y=E.current.getBoundingClientRect();return Math.min(1,Math.max(0,(m-y.left)/y.width))},j=m=>{const y=m*t,R=y/t*100||0;b.current&&(b.current.style.width=`${R}%`),l.current&&(l.current.style.left=`${R}%`),S?.current&&(S.current.innerText=`${o(y)} / ${o(t)}`);const z=E.current?.getBoundingClientRect();M({time:y,position:z?m*z.width:null})};$(()=>{if(!s){C.current=null;return}const m=R=>{if(C.current!==null&&R.pointerId!==C.current||!t)return;const z=q(R.clientX);d.current.onScrubMove(z);const Q=z*t,D=Q/t*100||0;b.current&&(b.current.style.width=`${D}%`),l.current&&(l.current.style.left=`${D}%`),S?.current&&(S.current.innerText=`${o(Q)} / ${o(t)}`);const ee=E.current?.getBoundingClientRect();M({time:Q,position:ee?z*ee.width:null})},y=R=>{C.current!==null&&R.pointerId!==C.current||(C.current=null,f.current=!0,R.pointerType!=="mouse"&&M({time:0,position:null}),d.current.onScrubEnd())};return document.addEventListener("pointermove",m),document.addEventListener("pointerup",y),document.addEventListener("pointercancel",y),()=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",y),document.removeEventListener("pointercancel",y)}},[s,t,o,S]);const W=m=>{if(m.pointerType==="mouse"&&m.button!==0||!n.current||!t)return;m.preventDefault(),C.current=m.pointerId;try{E.current?.setPointerCapture(m.pointerId)}catch{}h.current||_();const y=q(m.clientX);a(y),j(y)},T=m=>{if(!t||h.current||m.pointerType!=="mouse")return;const y=q(m.clientX);M({time:y*t,position:m.clientX-(E.current?.getBoundingClientRect().left??0)})},U=m=>{if(!(C.current!==null&&m.pointerId!==C.current)&&h.current){C.current=null,f.current=!0,m.pointerType!=="mouse"&&M({time:0,position:null});try{E.current?.hasPointerCapture(m.pointerId)&&E.current.releasePointerCapture(m.pointerId)}catch{}g()}};return r("div",{className:`${e.container} ${s&&e.scrubbing?e.scrubbing:""}`,ref:E,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round((Number(b.current?.style.width?.replace("%",""))||0)*(t||0)/100),tabIndex:0,onClick:m=>{if(f.current){f.current=!1;return}!n.current||isNaN(t)||t===0||p(q(m.clientX))},onPointerDown:W,onPointerMove:T,onPointerUp:U,onPointerCancel:U,onMouseMove:m=>{if(s||!t)return;const y=q(m.clientX);M({time:y*t,position:m.clientX-(E.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{s||M({time:0,position:null})},onKeyDown:m=>{if(!(!n.current||!t)&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){m.preventDefault();const y=(m.key==="ArrowRight"?5:-5)/t,R=n.current.currentTime/t||0;p(Math.min(1,Math.max(0,R+y)))}},children:[N.position!==null&&r("div",{className:e.timeBubble,style:{left:N.position},children:o(N.time)}),r("div",{className:e.bar,children:[r("div",{className:e.buffered,ref:v,style:i==="full"?{width:"100%"}:void 0}),r("div",{className:e.watched,ref:b}),r("div",{className:e.thumb,ref:l,onMouseDown:m=>{m.preventDefault(),n.current&&(h.current||_())}}),u]})]})};function Ee(){try{if(typeof window>"u")return!1;const e=window.matchMedia?.("(pointer: coarse)").matches??!1,t=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return e||t}catch{return!1}}function nt(){const[e,n]=k(Ee);return $(()=>{n(Ee());let t=null;const o=()=>n(Ee());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",o):t.addListener(o)}catch{}return window.addEventListener("touchstart",o,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",o):t.removeListener(o))}catch{}window.removeEventListener("touchstart",o)}},[]),e}const hs=450,Jo=({muted:e,volume:n,volumeIcon:t,buttonClassName:o,sliderClassName:s,onToggleMute:i,onVolumeChange:p,onExpandedChange:_})=>{const a=nt(),[g,S]=k(!1),u=w(null),E=w(!1),b=w(null),l=x(d=>{S(d),_?.(d)},[_]);$(()=>()=>{u.current&&window.clearTimeout(u.current)},[]),$(()=>{if(!g)return;const d=N=>{b.current&&!b.current.contains(N.target)&&l(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[g,l]);const v=e?0:n,C=()=>{E.current=!1,u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{E.current=!0,l(!0)},hs)},f=()=>{u.current&&(window.clearTimeout(u.current),u.current=null)},h=d=>{if(d.stopPropagation(),E.current){E.current=!1;return}if(a){g?i():l(!0);return}i()};return r("div",{ref:b,className:ce.volumeWrap,"data-expanded":g?"true":"false",onContextMenu:d=>d.preventDefault(),children:[r("button",{type:"button",className:o,onClick:h,onPointerDown:C,onPointerUp:f,onPointerLeave:f,onContextMenu:d=>d.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":g,children:t}),r("input",{type:"range",min:"0",max:"1",step:"0.05",value:v,onChange:d=>p(parseFloat(d.target.value)),onClick:d=>d.stopPropagation(),onPointerDown:d=>d.stopPropagation(),onContextMenu:d=>d.preventDefault(),className:`${ce.volumeSlider} ${s??""}`,style:{"--volume-percent":`${v*100}%`},"aria-label":"Volume"})]})},Je=280;function _s(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const Qo=({player:e,topBar:n,centerControls:t,bottomBar:o,settingsPanel:s,overlays:i,isInteracting:p=!1,className:_,chromeDisabled:a=!1,onStageClick:g,children:S})=>{const{state:u,refs:E,actions:b}=e,l=E.playerContainerRef,C=nt()?5e3:3e3,f=w(0),h=w(null),d=w(p);d.current=p;const N=x(()=>{const T=b.inactivityTimer.current;T&&(window.clearTimeout(T),b.inactivityTimer.current=null)},[b]),M=x(()=>{N(),u.isPlaying&&(d.current||u.useNativeControls||(b.inactivityTimer.current=window.setTimeout(()=>{if(d.current)return;b.setShowControls(!1);const T=l.current;T&&u.isFullscreen&&(T.style.cursor="none")},C)))},[b,N,l,C,u.isFullscreen,u.isPlaying,u.useNativeControls]),q=x(()=>{const T=l.current;T&&(T.style.cursor="default"),!u.showControls&&!u.useNativeControls&&b.setShowControls(!0),M()},[b,l,M,u.showControls,u.useNativeControls]);$(()=>{if(u.showControls){if(!u.isPlaying){N();return}if(p||u.isScrubbing||u.showSettings||u.showVolumeSlider){b.setShowControls(!0),N();return}M()}},[b,N,p,M,u.isPlaying,u.isScrubbing,u.showControls,u.showSettings,u.showVolumeSlider]),$(()=>()=>N(),[N]);const j=x(T=>{const U=T.target;if(_s(U))return;g?.();const m=Date.now(),y=m-f.current<Je;if(f.current=m,y){h.current&&(window.clearTimeout(h.current),h.current=null),b.toggleFullscreen();return}h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{h.current=null,b.setShowControls(!u.showControls),u.showControls?M():q()},Je)},[b,g,M,u.showControls,q]);$(()=>()=>{h.current&&window.clearTimeout(h.current)},[]);const W=u.showControls||u.isScrubbing||u.showSettings||u.showVolumeSlider;return r("div",{ref:l,className:`${ce.shell} ${u.isFullscreen?ce.shellFullscreen:""} ${_??""}`,onContextMenu:T=>T.preventDefault(),onPointerMove:T=>{T.pointerType==="mouse"&&q()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&u.isPlaying&&!d.current&&b.setShowControls(!1)},children:[r("div",{className:ce.stage,onClick:j,onContextMenu:T=>T.preventDefault(),children:S}),i,!a&&!u.useNativeControls&&r("div",{className:ce.uiLayer,onContextMenu:T=>T.preventDefault(),children:[r("div",{"data-player-ui":"true",children:n}),W&&t&&r("div",{"data-player-ui":"true",children:t}),r("div",{"data-player-ui":"true",children:o}),s&&r("div",{"data-player-ui":"true",children:s})]})]})},vs="_statusArea_1xccu_1",ys="_toggleBtn_1xccu_20",bs="_shortcuts_1xccu_46",ws="_shortcutGroup_1xccu_56",Ss="_shortcut_1xccu_46",Cs="_key_1xccu_70",ks="_label_1xccu_91",P={statusArea:vs,toggleBtn:ys,shortcuts:bs,shortcutGroup:ws,shortcut:Ss,key:Cs,label:ks},Yo=({showTheater:e=!0})=>{const[n,t]=k(!1);return r("div",{className:P.statusArea,children:[r("button",{type:"button",className:P.toggleBtn,onClick:()=>t(o=>!o),"aria-expanded":n,"aria-controls":"player-shortcuts",children:[r(J,{name:"keyboard",size:14}),r("span",{children:"Keyboard Shortcuts"}),n?r(J,{name:"chevron-up",size:12}):r(J,{name:"chevron-down",size:12})]}),n&&r("div",{id:"player-shortcuts",className:P.shortcuts,children:[r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"↑"}),r("span",{className:P.key,children:"↓"}),r("span",{className:P.label,children:"Volume"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"←"}),r("span",{className:P.key,children:"→"}),r("span",{className:P.label,children:"Seek"})]})]}),r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"Space"}),r("span",{className:P.label,children:"Play/Pause"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"F"}),r("span",{className:P.label,children:"Fullscreen"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"M"}),r("span",{className:P.label,children:"Mute"})]}),e&&r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"T"}),r("span",{className:P.label,children:"Theater"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"N"}),r("span",{className:P.label,children:"Next"})]})]})]})]})},Es="_episodeListContainer_9tyin_1",Ls="_drawerContainer_9tyin_9",Ts="_episodeListHeader_9tyin_14",Bs="_drawerHeader_9tyin_20",xs="_episodeListTitle_9tyin_29",Ns="_rangeSelector_9tyin_41",Is="_rangeButton_9tyin_47",Ps="_active_9tyin_70",Ms="_episodeList_9tyin_1",As="_drawerList_9tyin_89",$s="_episodeItem_9tyin_118",Fs="_watched_9tyin_145",Rs="_episodeThumb_9tyin_167",Ds="_episodeText_9tyin_176",Os="_episodeLabel_9tyin_184",qs="_episodeSub_9tyin_189",A={episodeListContainer:Es,drawerContainer:Ls,episodeListHeader:Ts,drawerHeader:Bs,episodeListTitle:xs,rangeSelector:Ns,rangeButton:Is,active:Ps,episodeList:Ms,drawerList:As,episodeItem:$s,watched:Fs,episodeThumb:Rs,episodeText:Ds,episodeLabel:Os,episodeSub:qs},Hs=({episodes:e,currentEpisode:n,watchedEpisodes:t=[],onEpisodeClick:o,variant:s="sidebar",title:i="Episodes",header:p})=>{const[_,a]=k(0),g=w(null),S=pe(()=>e.map(l=>typeof l=="string"?{id:l,label:`Episode ${l}`}:l),[e]),u=pe(()=>new Set(t),[t]);$(()=>{const l=g.current;if(!l)return;let v=l.parentElement;for(;v;){const h=window.getComputedStyle(v);if((h.overflowY==="auto"||h.overflowY==="scroll")&&v.scrollHeight>v.clientHeight)break;v=v.parentElement}if(!v)return;const C=v.getBoundingClientRect(),f=l.getBoundingClientRect();v.scrollTop+=f.top+f.height/2-(C.top+v.clientHeight/2)},[n,_]);const E=pe(()=>{if(S.length<=100)return[];const l=[];for(let v=0;v<S.length;v+=100){const C=v+1,f=Math.min(v+100,S.length);l.push(`${C}-${f}`)}return l},[S]),b=pe(()=>{if(E.length===0)return S;const l=E[_];if(!l)return S;const[v,C]=l.split("-"),f=parseInt(v,10),h=parseInt(C,10);return S.slice(f-1,h)},[S,E,_]);return r("div",{className:`${A.episodeListContainer} ${s==="drawer"?A.drawerContainer:""}`,children:[r("div",{className:`${A.episodeListHeader} ${s==="drawer"?A.drawerHeader:""}`,children:[p,r("h3",{className:A.episodeListTitle,children:i}),E.length>0&&r("div",{className:A.rangeSelector,children:E.map((l,v)=>r("button",{className:`${A.rangeButton} ${_===v?A.active:""}`,onClick:()=>a(v),children:l},l))})]}),r("div",{className:`${A.episodeList} ${s==="drawer"?A.drawerList:""}`,children:b.map(l=>{const v=l.id===n,C=u.has(l.id)||l.watched===!0;return r("div",{ref:v?g:void 0,className:`${A.episodeItem} ${C?A.watched:""} ${v?A.active:""}`,onClick:()=>o(l.id),children:[l.thumbnail&&r("img",{src:l.thumbnail,alt:"",loading:"lazy",decoding:"async",className:A.episodeThumb}),r("span",{className:A.episodeText,children:[r("span",{className:A.episodeLabel,children:l.label??`Episode ${l.id}`}),l.sublabel&&r("span",{className:A.episodeSub,children:l.sublabel})]})]},l.id)})})]})},Zo=({variant:e="sidebar",count:n=12})=>r("div",{className:`${A.episodeListContainer} ${e==="drawer"?A.drawerContainer:""}`,children:[r("div",{className:`${A.episodeListHeader} ${e==="drawer"?A.drawerHeader:""}`,children:[r("h3",{className:A.episodeListTitle,children:"Episodes"}),r("div",{className:A.rangeSelector,children:[r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"})]})]}),r("div",{className:`${A.episodeList} ${e==="drawer"?A.drawerList:""}`,children:Array.from({length:n}).map((t,o)=>r("div",{className:A.episodeItem,style:{border:"none",background:"transparent"},children:r(ye,{width:"120px",height:"1.2rem",variant:"text"})},o))})]}),Vs="_shell_cys6s_1",zs="_overlay_cys6s_10",Ws="_drawer_cys6s_21",Us="_handle_cys6s_56",Ks="_header_cys6s_64",js="_headerCopy_cys6s_73",Gs="_kicker_cys6s_79",Xs="_title_cys6s_87",Js="_closeBtn_cys6s_94",Qs="_body_cys6s_116",X={shell:Vs,overlay:zs,drawer:Ws,handle:Us,header:Ks,headerCopy:js,kicker:Gs,title:Xs,closeBtn:Js,body:Qs};function ec({isOpen:e,onClose:n,episodes:t,currentEpisode:o,watchedEpisodes:s=[],onEpisodeClick:i,title:p,header:_}){return $(()=>{if(!e)return;const a=S=>{S.key==="Escape"&&n()},g=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",a),()=>{document.body.style.overflow=g,document.removeEventListener("keydown",a)}},[e,n]),e?At(r("div",{className:X.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[r("button",{className:X.overlay,type:"button",onClick:n,"aria-label":"Close episodes"}),r("aside",{className:X.drawer,children:[r("div",{className:X.handle}),r("div",{className:X.header,children:[r("div",{className:X.headerCopy,children:[r("span",{className:X.kicker,children:"Episode picker"}),r("h3",{className:X.title,children:"Choose an episode"})]}),r("button",{className:X.closeBtn,type:"button",onClick:n,"aria-label":"Close",children:r(J,{name:"times"})})]}),r("div",{className:X.body,children:r(Hs,{episodes:t,currentEpisode:o,watchedEpisodes:s,onEpisodeClick:i,variant:"drawer",title:p,header:_})})]})]}),document.body):null}const Ys="_sourceSelectionContainer_c5tub_76",Zs="_providerSelectContainer_c5tub_89",eo="_providerSelect_c5tub_89",to="_sourceSelect_c5tub_76",no="_sourceButtons_c5tub_145",ro="_sourceButton_c5tub_145",so="_active_c5tub_170",tc={sourceSelectionContainer:Ys,providerSelectContainer:Zs,providerSelect:eo,sourceSelect:to,sourceButtons:no,sourceButton:ro,active:so};function Pe(){return document}function rt(e){const n=Pe();if(document.fullscreenElement)return document.fullscreenElement;if(n.webkitFullscreenElement)return n.webkitFullscreenElement;const t=e;return t?.webkitDisplayingFullscreen?t:null}function ae(e){return rt(e)!==null}async function oo(e,n){if(rt(n))return;const t=e;try{if(typeof e.requestFullscreen=="function"){await e.requestFullscreen();return}if(typeof t.webkitRequestFullscreen=="function"){await t.webkitRequestFullscreen();return}if(typeof t.webkitRequestFullScreen=="function"){await t.webkitRequestFullScreen();return}}catch{}const o=n;if(o&&typeof o.webkitEnterFullscreen=="function"){if(o.webkitSupportsFullscreen===!1)return;try{await o.webkitEnterFullscreen()}catch{}}}async function co(e){const n=Pe();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(n.webkitFullscreenElement&&typeof n.webkitExitFullscreen=="function"){await n.webkitExitFullscreen();return}}catch{}const t=e;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof n.webkitCancelFullScreen=="function"?n.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??n.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function ao(e,n){!e&&!n||(ae(n)?await co(n):e&&await oo(e,n))}function io(e,n){const t=()=>{try{n(ae(e()))}catch{}},o=Pe(),s=t;o.addEventListener("fullscreenchange",t),o.addEventListener("webkitfullscreenchange",s),o.addEventListener("webkitbeginfullscreen",s,!0),o.addEventListener("webkitendfullscreen",s,!0);const i=e();return i?.addEventListener("webkitbeginfullscreen",s),i?.addEventListener("webkitendfullscreen",s),()=>{o.removeEventListener("fullscreenchange",t),o.removeEventListener("webkitfullscreenchange",s),o.removeEventListener("webkitbeginfullscreen",s,!0),o.removeEventListener("webkitendfullscreen",s,!0),i?.removeEventListener("webkitbeginfullscreen",s),i?.removeEventListener("webkitendfullscreen",s)}}const nc=({skipIntervals:e,showId:n,episodeNumber:t,episodeCount:o,sourceType:s,showMeta:i})=>{const p=qt(),_=Ft(),a=w(null),g=w(null),S=w(null),u=w(null),E=w(!1),b=w(null),l=w(0),v=w(1),C=w({mouse:!1,keyboard:!1}),f=w(null),h=w(null),d=w(!1),N=w(Math.random().toString(36).substring(2)),[M,q]=k(!1),[j,W]=k(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[T,U]=k(()=>{try{const c=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(c)?1:Math.max(0,Math.min(1,c))}catch{return 1}}),[m,y]=k(!1),[R,z]=k(0),[Q,D]=k(!0),[ee,Me]=k(!1),[st,Ae]=k({time:0,position:null}),[we,ot]=k(localStorage.getItem("autoSkipEnabled")==="true"),[ct,Se]=k(null),[at,it]=k(!1),[te]=k(us),[lt,ut]=k(te.fontSize),[dt,pt]=k(te.position),[ft,mt]=k(te.bgOpacity),[gt,ht]=k(te.bgColor),[_t,vt]=k(te.textColor),[yt,bt]=k(te.edge),[wt,St]=k(te.bold),[Ct,kt]=k([]),[Et,Lt]=k(null),[Tt,Bt]=k(!1),[xt,Nt]=k(!1),[fe,G]=k(!1),[It,me]=k(!1),[Pt,$e]=k(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),ie=w(!1),Ce=w(-1),ge=x(()=>{const c=a.current;return!n||!t||!i?.name?null:{showId:n,episodeNumber:t,episodeCount:o,currentTime:c?c.currentTime:0,duration:c?c.duration:0,showName:i.name,showThumbnail:i.thumbnail,nativeName:i.names?.native,englishName:i.names?.english,genres:Array.isArray(i.genres)?i.genres.map(B=>typeof B=="string"?B:B?.name).filter(Boolean):void 0,popularityScore:i.score,type:i.type,isPlaying:c?!c.paused:!0,sessionId:N.current,isAdult:i.isAdult}},[n,t,o,i]),O=x((c=!1,B=!1)=>{if(ie.current)return!1;const I=ge();if(!I)return!1;const L=a.current;if(!L&&s!=="iframe")return!1;const F=L?L.currentTime>=L.duration*.8:!1;let H=L?L.currentTime:0;if(c&&F&&(H=L?L.duration:0),!B){if(H===0&&!F)return!1;const K=L?Math.abs(H-Ce.current):0;if(!c&&L&&H!==L.duration&&K<5)return!1}return I.currentTime=H,Ce.current=H,c?(async()=>{try{await Xe.progress.updateProgress.mutate(I),p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]}),p.invalidateQueries({queryKey:["thisWeekSchedule"]}),p.invalidateQueries(_.continueWatching.pathFilter())}catch(K){console.error("Failed to update progress:",K)}})():Rt("progress.updateProgress",I).catch(K=>console.error("Failed to update progress:",K)),!0},[ge,s,p,n,t,_.continueWatching]);$(()=>{const c=a.current;c&&(c.volume=T,c.muted=j)},[a,T,j]),$(()=>{const c=()=>{ie.current||O(!0)};window.addEventListener("beforeunload",c);const B=b,I=u;return()=>{window.removeEventListener("beforeunload",c),ie.current||O(!0),B.current&&clearTimeout(B.current),I.current&&clearTimeout(I.current)}},[O]);const he=x(()=>{const c=g.current;c&&ao(c,a.current).catch(B=>{console.error(`Error attempting to toggle full-screen mode: ${B?.message} (${B?.name})`)})},[]),_e=x(()=>{a.current&&(a.current.paused?a.current.play().catch(()=>console.warn("Autoplay was prevented.")):(a.current.pause(),D(!0)))},[D]),se=x(()=>{const c=a.current;if(!c)return;const B=C.current.mouse||C.current.keyboard;c.playbackRate=B?2:v.current},[]),le=x(c=>{C.current.mouse!==c&&(C.current.mouse=c,me(c||C.current.keyboard),se())},[se]),oe=x(c=>{C.current.keyboard!==c&&(C.current.keyboard=c,me(C.current.mouse||c),se())},[se]),ue=x(c=>{a.current&&(a.current.currentTime+=c,b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{O(!1,!0)},1500),D(!0))},[O,D]),ve=x(()=>{if(!a.current)return;const c=!a.current.muted;a.current.muted=c,W(c),localStorage.setItem("playerMuted",String(c)),!c&&a.current.volume===0&&(a.current.volume=.5,U(.5),localStorage.setItem("playerVolume",String(.5))),D(!0)},[D]);$(()=>{const c=()=>a.current,B=io(c,I=>{y(I),I&&D(!0)});return y(ae(c())),B},[D]),$(()=>{const c=I=>{if(!I.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(I.code==="Space"){if(I.preventDefault(),d.current)return;d.current=!0,h.current&&clearTimeout(h.current),h.current=window.setTimeout(()=>{h.current=null,d.current&&oe(!0)},180);return}switch(I.key.toLowerCase()){case"f":he();break;case"m":ve();break;case"arrowright":ue(10);break;case"arrowleft":ue(-10);break;case"arrowup":if(I.preventDefault(),a.current){const F=Math.min(1,a.current.volume+.1);a.current.volume=F,U(F)}break;case"arrowdown":if(I.preventDefault(),a.current){const F=Math.max(0,a.current.volume-.1);a.current.volume=F,U(F)}break}}},B=I=>{if(I.code==="Space"){if(I.preventDefault(),d.current=!1,C.current.keyboard){oe(!1);return}h.current&&(clearTimeout(h.current),h.current=null,_e())}};return document.addEventListener("keydown",c),document.addEventListener("keyup",B),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",B),h.current&&(clearTimeout(h.current),h.current=null),d.current=!1,oe(!1),me(!1)}},[oe,_e,he,ve,ue]),$(()=>{const c=H=>H?!!H.closest('[data-speed-boost-ignore="true"], [data-player-ui="true"], button, input, select, textarea, a, [role="button"], [role="slider"], [contenteditable="true"]'):!0,B=H=>{if(H.button!==0)return;const Y=H.target;if(!Y||c(Y))return;const K=g.current;!K||!K.contains(Y)||(f.current&&clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,le(!0)},180))},I=H=>{const Y=H.target;if(!Y||c(Y))return;const K=g.current;!K||!K.contains(Y)||(f.current&&clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,le(!0)},180))},L=()=>{f.current&&(clearTimeout(f.current),f.current=null),le(!1)},F=()=>{f.current&&(clearTimeout(f.current),f.current=null),d.current=!1,h.current&&(clearTimeout(h.current),h.current=null),oe(!1),le(!1),me(!1)};return document.addEventListener("mousedown",B),document.addEventListener("mouseup",L),document.addEventListener("touchstart",I,{passive:!0}),document.addEventListener("touchend",L),document.addEventListener("touchcancel",L),document.addEventListener("pointerup",L),document.addEventListener("pointercancel",L),window.addEventListener("blur",F),()=>{document.removeEventListener("mousedown",B),document.removeEventListener("mouseup",L),document.removeEventListener("touchstart",I),document.removeEventListener("touchend",L),document.removeEventListener("touchcancel",L),document.removeEventListener("pointerup",L),document.removeEventListener("pointercancel",L),window.removeEventListener("blur",F),f.current&&(clearTimeout(f.current),f.current=null)}},[oe,le]);const Fe=x(()=>{q(!0),G(!1),setTimeout(()=>O(!1,!0),50)},[O]),Re=x(()=>{q(!0),G(!1)},[]),De=x(()=>{const c=a.current;c&&!c.paused&&c.readyState>=3&&!c.seeking||G(!0)},[]),Oe=x(()=>{G(!1)},[]),qe=x(()=>{q(!1),G(!1),D(!0),setTimeout(()=>O(!1,!0),50)},[O]),He=w(!1);He.current=fe,$(()=>{if(!fe)return;let c=a.current?.currentTime??0,B=0;const I=window.setInterval(()=>{const L=a.current;if(!L)return;B+=1;const F=L.currentTime,H=F!==c;if(c=F,!(L.paused||L.seeking)){if(H||L.readyState>=3){G(!1);return}B>=24&&L.readyState>=2&&!L.ended&&G(!1)}},500);return()=>window.clearInterval(I)},[fe]),$(()=>{ie.current=!1,Ce.current=-1,l.current=0,N.current=Math.random().toString(36).substring(2),z(0),G(!1)},[n,t]);const Ve=x(()=>{z(0),G(!1)},[]);$(()=>{const c=N.current;return()=>{Dt(c)}},[n,t]),$(()=>{if(s!=="iframe")return;O(!1,!0);const c=setInterval(()=>{O(!1,!0)},6e4);return()=>clearInterval(c)},[s,O]);const ze=x(()=>{z(a.current?.duration||0),se()},[se]),We=x(()=>{if(a.current){const c=a.current.muted,B=a.current.volume;W(c),U(B),localStorage.setItem("playerMuted",String(c)),localStorage.setItem("playerVolume",String(B))}},[]),Ue=x(()=>{},[]),Ke=x(()=>{const c=a.current;if(!c)return;He.current&&!c.paused&&!c.seeking&&G(!1);const B=c.currentTime||0,I=Date.now();I-l.current>6e4&&O()&&(l.current=I);const L=e.find(F=>B>=F.start_time&&B<F.end_time)||null;Se(F=>F?.skip_id!==L?.skip_id?L:F),we&&L&&!c.paused&&(c.currentTime=L.end_time,Se(null))},[e,we,O]),je=x(()=>{const c=ge();c&&(c.currentTime=c.duration,Xe.progress.updateProgress.mutate(c).then(()=>{p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]})}).catch(B=>console.error("Failed to send final progress:",B)))},[ge,p,n,t]),Ge=x(()=>{ie.current=!0,je()},[je]);$(()=>{const c=()=>{ee&&(Me(!1),Ae({time:0,position:null}),E.current&&a.current?.play(),O(!1,!0))};return ee&&(document.addEventListener("mouseup",c),document.addEventListener("pointerup",c),document.addEventListener("touchend",c),document.addEventListener("pointercancel",c),document.addEventListener("touchcancel",c)),()=>{document.removeEventListener("mouseup",c),document.removeEventListener("pointerup",c),document.removeEventListener("touchend",c),document.removeEventListener("pointercancel",c),document.removeEventListener("touchcancel",c)}},[ee,O]);const Mt=pe(()=>({togglePlay:_e,seek:ue,toggleMute:ve,toggleFullscreen:he,onPlay:Fe,onPause:qe,onLoadedMetadata:ze,formatTime:Ot,onVolumeChange:We,onProgress:Ue,onTimeUpdate:Ke,onEnded:Ge,setShowControls:D,setIsScrubbing:Me,setHoverTime:Ae,setIsAutoSkipEnabled:ot,setCurrentSkipInterval:Se,setShowCCMenu:it,setSubtitleFontSize:ut,setSubtitlePosition:pt,setSubtitleBgOpacity:mt,setSubtitleBgColor:ht,setSubtitleTextColor:vt,setSubtitleEdge:bt,setSubtitleBold:St,setAvailableSubtitles:kt,setActiveSubtitleTrack:Lt,setShowSettings:Bt,setShowVolumeSlider:Nt,wasPlayingBeforeScrub:E,inactivityTimer:u,setIsFullscreen:y,onWaiting:De,onPlaying:Re,onCanPlay:Oe,sendProgressUpdate:O,setUseNativeControls:$e,resetMediaState:Ve}),[_e,ue,ve,he,Fe,qe,ze,We,Ue,Ke,Ge,y,De,Re,Oe,O,$e,Ve]);return{refs:{videoRef:a,playerContainerRef:g,progressBarRef:S},state:{isPlaying:M,isMuted:j,volume:T,isFullscreen:m,duration:R,showControls:Q,isScrubbing:ee,hoverTime:st,isAutoSkipEnabled:we,currentSkipInterval:ct,showCCMenu:at,subtitleFontSize:lt,subtitlePosition:dt,subtitleBgOpacity:ft,subtitleBgColor:gt,subtitleTextColor:_t,subtitleEdge:yt,subtitleBold:wt,availableSubtitles:Ct,activeSubtitleTrack:Et,showSettings:Tt,showVolumeSlider:xt,isBuffering:fe,isSpeedBoostActive:It,useNativeControls:Pt},actions:Mt}};function lo(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function rc(e,n){const{refs:t,actions:o}=e,s=w(n);s.current=n;const i=w(!1),p=w(!1),_=a=>{try{if(a)return a.matches}catch{}try{return window.innerWidth>window.innerHeight}catch{return!1}};$(()=>{if(!lo())return;let a=null;const g=()=>{const S=t.playerContainerRef.current;if(_(a)){if(!s.current||!S||ae(t.videoRef.current)||p.current)return;i.current=!0,o.toggleFullscreen()}else p.current=!1,i.current&&(i.current=!1,ae(t.videoRef.current)&&o.toggleFullscreen())};try{a=window.matchMedia("(orientation: landscape)"),a.addEventListener?a.addEventListener("change",g):a.addListener(g)}catch{}return g(),()=>{try{a&&(a.removeEventListener?a.removeEventListener("change",g):a.removeListener(g))}catch{}}},[o,t.playerContainerRef,t.videoRef,n]),$(()=>{const a=()=>{if(!ae(t.videoRef.current)){i.current=!1;try{window.matchMedia("(orientation: landscape)").matches&&(p.current=!0)}catch{p.current=!0}}};return document.addEventListener("fullscreenchange",a),document.addEventListener("webkitfullscreenchange",a),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("webkitfullscreenchange",a)}},[t.videoRef])}const uo=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function sc({videoRef:e,canvasRef:n,delayMs:t,enabled:o}){const s=w(t);s.current=t;const i=w([]),p=w(-1),_=w(-1),a=w(!1),g=w(0),S=w(null);$(()=>{const u=f=>{if(f)try{f.close()}catch{}},E=()=>{for(const f of i.current)u(f.bitmap);i.current=[]};if(!o){E(),p.current=-1,_.current=-1,a.current=!1,g.current=0;return}let b=!1;const l=()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},v=()=>{b||(l(),S.current=requestAnimationFrame(()=>{C()}))};async function C(){if(b)return;const f=e.current,h=n.current;if(!f||!h||f.videoWidth===0){v();return}if(f.paused||f.ended||document.hidden||f.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){v();return}const d=f.getVideoPlaybackQuality().totalVideoFrames;if(d===p.current){v();return}(f.seeking||_.current>=0&&Math.abs(f.currentTime-_.current)>.5)&&(E(),a.current=!1,g.current=0,p.current=-1),_.current=f.currentTime,(h.width!==f.videoWidth||h.height!==f.videoHeight)&&(h.width=f.videoWidth,h.height=f.videoHeight);const N=Math.max(0,s.current||0);N>g.current&&(a.current=!1);try{const M=await createImageBitmap(f);if(b){u(M);return}p.current=d;const q=performance.now(),j=h.getContext("2d"),W=y=>{j&&j.drawImage(y,0,0,h.width,h.height)};if(N<=0){E(),a.current=!1,g.current=0,W(M),u(M),v();return}const T=i.current;T.push({bitmap:M,capture:q});const U=uo(N);for(;T.length>U;)u(T.shift()?.bitmap);let m=-1;for(let y=T.length-1;y>=0;y--)if(q-T[y].capture>=N){m=y;break}if(m!==-1){for(let R=0;R<m;R++)u(T.shift()?.bitmap);const y=T.shift();y?(W(y.bitmap),u(y.bitmap),a.current=!0,g.current=N):W(M)}else if(!a.current)W(M);else{const y=T.shift();y?(W(y.bitmap),u(y.bitmap)):W(M)}}catch{}v()}return v(),()=>{b=!0,l();for(const f of i.current)try{f.bitmap.close()}catch{}i.current=[]}},[o,e,n])}const Qe=(e,n)=>{try{localStorage.setItem("playerVideoDelayMs",String(e)),localStorage.setItem("playerVideoDelayEnabled",String(n))}catch{}},Ye=e=>{try{localStorage.setItem("playerVideoDelayEnabled",String(e))}catch{}};function oc(e,n){const[t,o]=k(()=>{try{const d=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(d)&&d>=0&&d<=500)return Math.round(d)}catch{}return 180}),[s,i]=k(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[p,_]=k(!1),[a,g]=k(!1),S=w(null),u=w(null),E=d=>{const N=Math.max(0,Math.min(500,Math.round(d)));o(N);try{localStorage.setItem("playerVideoDelayMs",String(N))}catch{}},b=d=>{i(d),Ye(d)},l=x(()=>{g(!1),_(!1)},[]);return{videoDelayMs:t,videoDelayEnabled:s,setDelayEnabled:b,handleVideoDelayChange:E,isCalibrating:p,testClipActive:a,stopCalibration:l,openAvSyncCalibrator:()=>{S.current={enabled:s,ms:t},i(!0),Ye(!0),n?.(),_(!0)},cancelAvSyncCalibrator:()=>{const d=S.current;S.current=null,d&&(o(d.ms),i(d.enabled),Qe(d.ms,d.enabled)),g(!1),_(!1)},applyAvSyncCalibrator:()=>{S.current=null,i(!0),Qe(t,!0),g(!1),_(!1)},toggleTestClip:()=>{if(a){g(!1);return}const d=e.current;d&&!isNaN(d.currentTime)&&(u.current=d.currentTime),g(!0)},calibReturnRef:u,effectiveVideoDelayMs:s?t:0}}function cc(){const[e,n]=k(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});$(()=>{try{e?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(s){console.error(s)}return()=>{try{document.body.classList.remove("theater-mode")}catch(s){console.error(s)}}},[e]);const t=x(()=>{n(s=>{const i=!s;try{localStorage.setItem("playerTheaterMode",i.toString())}catch{}return i})},[]),o=x(s=>{if(e&&s.target===s.currentTarget){n(!1);try{localStorage.setItem("playerTheaterMode","false")}catch{}}},[e]);return{isTheaterMode:e,toggleTheaterMode:t,handleLayoutClick:o}}const ne={enabled:!0,blur:60,saturation:150,brightness:70,opacity:60};function po(){try{const e=localStorage.getItem("playerAmbientLight");if(!e)return ne;const n=JSON.parse(e),t=(o,s,i,p)=>{const _=Number(o);return Number.isFinite(_)?Math.max(i,Math.min(p,_)):s};return{enabled:n.enabled??ne.enabled,blur:t(n.blur,ne.blur,0,120),saturation:t(n.saturation,ne.saturation,0,200),brightness:t(n.brightness,ne.brightness,20,120),opacity:t(n.opacity,ne.opacity,10,100)}}catch{return ne}}function ac(){const[e,n]=k(po),t=x(o=>{n(s=>{const i={...s,...o};try{localStorage.setItem("playerAmbientLight",JSON.stringify(i))}catch{}return i})},[]);return{settings:e,update:t}}const Le=160,Te=90,fo=120,ic=({videoRef:e,active:n,settings:t,className:o})=>{const s=w(null);return $(()=>{if(!n)return;const i=s.current,p=e.current;if(!i||!p)return;const _=i.getContext("2d",{alpha:!1});if(!_)return;let a=0,g=0,S=!1;const u=()=>{if(!(p.readyState<2||!p.videoWidth))try{const l=p.videoWidth,v=p.videoHeight,C=Le/Te,f=l/v;let h=l,d=v,N=0,M=0;f>C?(h=v*C,N=(l-h)/2):(d=l/C,M=(v-d)/2),_.drawImage(p,N,M,h,d,0,0,Le,Te)}catch{}},E=l=>{S||p.paused||(a=requestAnimationFrame(E),!(l-g<fo)&&(g=l,u()))},b=()=>{S||(cancelAnimationFrame(a),g=0,a=requestAnimationFrame(E))};return p.addEventListener("play",b),p.addEventListener("seeked",u),p.addEventListener("loadeddata",u),a=requestAnimationFrame(E),()=>{S=!0,cancelAnimationFrame(a),p.removeEventListener("play",b),p.removeEventListener("seeked",u),p.removeEventListener("loadeddata",u)}},[n,e]),n?r("canvas",{ref:s,width:Le,height:Te,"aria-hidden":"true",className:o??Gr.theaterAmbient,style:{filter:`blur(${t.blur}px) saturate(${t.saturation}%) brightness(${t.brightness}%)`,opacity:t.opacity/100}}):null},mo="_row_1fq55_1",go="_rowHeader_1fq55_9",ho="_rowLabel_1fq55_17",_o="_rowValue_1fq55_28",vo="_slider_1fq55_36",yo="_swatches_1fq55_99",bo="_swatch_1fq55_99",wo="_swatchPicked_1fq55_114",So="_colorInput_1fq55_120",Co="_segmented_1fq55_131",V={row:mo,rowHeader:go,rowLabel:ho,rowValue:_o,slider:vo,swatches:yo,swatch:bo,swatchPicked:wo,colorInput:So,segmented:Co},ko=({label:e,display:n,min:t,max:o,step:s,value:i,percent:p,onChange:_,onCommit:a})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:[r("span",{className:V.rowLabel,children:e}),r("span",{className:V.rowValue,children:n})]}),r("input",{type:"range",className:V.slider,min:t,max:o,step:s,value:i,"aria-label":e,"data-speed-boost-ignore":"true",onInput:g=>_(Number(g.target.value)),onMouseDown:g=>g.stopPropagation(),onPointerDown:g=>g.stopPropagation(),onTouchStart:g=>g.stopPropagation(),onPointerUp:a,onPointerCancel:a,onTouchEnd:a,onKeyUp:a,onBlur:a,style:{"--slider-percent":`${p}%`}})]}),lc=({label:e,colors:n,value:t,onChange:o})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.swatches,children:[n.map(s=>r("button",{type:"button","aria-label":`${e} ${s}`,"aria-pressed":t.toLowerCase()===s.toLowerCase(),onClick:()=>o(s),className:`${V.swatch} ${t.toLowerCase()===s.toLowerCase()?V.swatchPicked:""}`,style:{backgroundColor:s}},s)),r("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:V.colorInput,value:t,"data-speed-boost-ignore":"true",onInput:s=>o(s.target.value),onMouseDown:s=>s.stopPropagation(),onPointerDown:s=>s.stopPropagation(),onTouchStart:s=>s.stopPropagation()})]})]});function uc({label:e,options:n,value:t,onChange:o}){return r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.segmented,role:"group","aria-label":e,children:n.map(s=>r("button",{type:"button","aria-pressed":t===s,onClick:()=>o(s),children:[r("span",{children:s}),t===s&&r(J,{name:"check",size:10})]},s))})]})}const be=10,Ie=500,Be=e=>Math.max(0,Math.min(Ie,Math.round(e))),dc=({isOpen:e,ms:n,onChange:t,onApply:o,onClose:s,testClipActive:i,onTestClip:p})=>e?r("div",{role:"dialog","aria-label":"Calibrate audio video sync","data-speed-boost-ignore":"true",onClick:_=>_.stopPropagation(),style:{position:"absolute",right:8,bottom:112,width:"min(260px, calc(100% - 16px))",maxHeight:"calc(100% - 124px)",overflowY:"auto",overflowX:"hidden",zIndex:60,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:12,borderRadius:"var(--radius-lg)",border:"1px solid var(--glass-border)",background:"rgba(18, 18, 22, 0.95)",boxShadow:"var(--glass-shadow)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxSizing:"border-box"},children:[r("div",{style:{fontSize:"0.8rem",fontWeight:800,color:"var(--text-primary)"},children:"A/V sync"}),r("div",{children:r(re,{size:"sm",variant:"secondary",onClick:p,children:i?"Back to video":"Preview test clip"})}),r("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[r(re,{size:"sm",onClick:()=>t(Be(n-be)),"aria-label":"Decrease delay by 10 milliseconds",children:["− ",be,"ms"]}),r("div",{style:{fontSize:"1.1rem",fontWeight:800,minWidth:64,textAlign:"center"},children:[n,"ms"]}),r(re,{size:"sm",onClick:()=>t(Be(n+be)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",be,"ms"]})]}),r(ko,{label:"Video delay",display:`${n}ms`,min:0,max:Ie,step:5,value:n,percent:n/Ie*100,onChange:_=>t(Be(_))}),r("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[r(re,{size:"sm",variant:"secondary",onClick:s,children:"Cancel"}),r(re,{size:"sm",onClick:o,children:["Apply ",n,"ms"]})]})]}):null;export{ic as A,Mo as B,jo as C,Wo as D,Zo as E,$o as F,No as G,Io as H,lc as I,Vo as J,uc as K,Z as L,ko as M,ne as N,Yo as P,Ko as R,Xo as S,Ho as T,Jo as U,Qo as a,Go as b,tc as c,oc as d,sc as e,cc as f,Ao as g,rc as h,ss as i,ac as j,Ro as k,Po as l,zo as m,Do as n,Uo as o,Fo as p,qo as q,Oo as r,is as s,Gr as t,nc as u,Hs as v,xo as w,ce as x,dc as y,ec as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as D,A as G,h as F,q as x,g as U,u as e,L as xe,T as Y,S as ie,a as te,_ as je}from"./vendor-core-DfaOB3Rn.js";import{b as Ze,u as Je,a as et}from"./vendor-query-BBT5_sHx.js";import{S as De,A as Ee,P as tt}from"./SkeletonGrid-BZHKk1I6.js";import{A as oe}from"./AnimeCard-JkXG40Es.js";import{I as V}from"./vendor-icons-DrybRNxP.js";import{u as we,a as le,b as at,c as nt,t as rt,d as We,s as ot,f as ke,B as Oe,e as st,g as re,h as lt,i as Le,j as it,k as ct,l as dt,m as ut,n as ht,o as mt,p as pt,q as gt,r as vt}from"./index-BTnhzofk.js";import{u as _t}from"./vendor-ui-3qrARCPr.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{R as Fe}from"./ResetProgressModal--N60WWCB.js";import{Q as ft}from"./QueueRail-BAwI-apz.js";import{M as _e}from"./MediaCard-Dp8DjyXB.js";import{u as Ve,M as ze}from"./useMangaPopup-CzsCbndG.js";import{M as bt}from"./MangaResetProgressModal-P3oY4_14.js";import{u as Ge,a as yt,m as Se,i as Ue,b as qe,c as He,d as Nt,e as Tt}from"./useMangaLibrary-BVQRhsFh.js";import{u as kt}from"./useProviders-UuUPzft-.js";import{u as Qe,a as $e,T as St}from"./useTv-CSsbWKH9.js";import{T as wt}from"./TvPopup-DyX7f8kC.js";import{u as Ct,a as It,b as At,t as Rt,i as Lt,c as $t}from"./useTvLibrary-a_Y0c2FS.js";import{A as Mt}from"./AsmrResetProgressModal-MQA_bNQM.js";import{u as Bt,a as Pt,b as xt}from"./useAsmr-CbzGCzmv.js";import"./useAnimeInfoData-Cvmso3IK.js";import"./QueueOptionsButton-T1J37IZT.js";import"./useIsMobile-Dvx1uJ82.js";import"./usePopup-DS9jMzp6.js";const Dt="_sectionWrapper_2p2l1_9",Et="_sectionTitleNoMargin_2p2l1_13",Wt="_carousel_2p2l1_178",P={"section-header":"_section-header_2p2l1_1",sectionWrapper:Dt,sectionTitleNoMargin:Et,"title-wrapper":"_title-wrapper_2p2l1_17","header-controls":"_header-controls_2p2l1_24","header-select":"_header-select_2p2l1_30","collapse-button":"_collapse-button_2p2l1_79","title-link":"_title-link_2p2l1_98","continue-watching":"_continue-watching_2p2l1_117","nav-arrows":"_nav-arrows_2p2l1_139","nav-button":"_nav-button_2p2l1_148","carousel-container":"_carousel-container_2p2l1_178",carousel:Wt,"carousel-inner":"_carousel-inner_2p2l1_187","carousel-card":"_carousel-card_2p2l1_192"};function fe({align:a="start",containScroll:o="trimSnaps",scrollFraction:i=.8,threshold:t=.6,onReachThreshold:n}={}){const[c,s]=_t({align:a,containScroll:o,dragFree:!0}),[N,m]=D(!1),b=G({scrollFraction:i,threshold:t,onReachThreshold:n}),v=G(!1);F(()=>{b.current={scrollFraction:i,threshold:t,onReachThreshold:n}});const g=x(d=>{m(d.canScrollPrev()||d.canScrollNext())},[]);F(()=>{if(!s)return;const d=()=>{const l=s.scrollProgress();l>=b.current.threshold&&!v.current?(v.current=!0,b.current.onReachThreshold?.()):l<b.current.threshold&&(v.current=!1),g(s)};return s.on("init",d),s.on("reInit",d),s.on("scroll",d),s.on("resize",d),()=>{s.off("init",d),s.off("reInit",d),s.off("scroll",d),s.off("resize",d)}},[s,g]);const f=x(d=>{const l=d.containerNode().firstElementChild;if(!l)return 1;const u=d.rootNode().getBoundingClientRect().width,I=l.getBoundingClientRect().width;return I?Math.max(1,Math.round(u/I)):1},[]),r=x((d,l=!1)=>{if(!s)return;const u=Math.max(1,Math.round(f(s)*b.current.scrollFraction)),I=s.selectedScrollSnap()+(d==="left"?-u:u);s.scrollTo(I,l)},[s,f]),S=x((d=!1)=>{s?.scrollTo(0,d)},[s]);return{emblaRef:c,api:s,canScroll:N,stepBy:r,scrollToStart:S}}const ee=({title:a,eyebrow:o,titleLink:i,loading:t,emptyState:n,carousel:c,layout:s,collapsible:N,defaultExpanded:m=!0,onReachThreshold:b,scrollThreshold:v,isFetchingNextPage:g,resetScrollOnShrink:f,itemCount:r=0,highlight:S,headerActions:d,loadingSkeleton:l,skeletonCount:u=7,children:I})=>{const{lowEndMode:R}=we(),{emblaRef:T,stepBy:E,scrollToStart:C}=fe({onReachThreshold:b,threshold:v}),[M,W]=U.useState(m);U.useEffect(()=>{W(m)},[m]);const B=U.useRef(0);return U.useEffect(()=>{f&&r>0&&M&&(r<=B.current||B.current===0)&&C(),r>0&&(B.current=r)},[r,f,M,C]),!t&&r===0&&!n&&!N?null:e("section",{className:`${P.sectionWrapper} ${S?P["continue-watching"]:""}`,children:[e("div",{className:P["section-header"],children:[e("div",{className:P["title-wrapper"],children:[e("div",{className:"title-stack",children:[o&&e("div",{className:"section-eyebrow",children:o}),i?e(xe,{to:i,className:P["title-link"],children:e("div",{className:`section-title ${P.sectionTitleNoMargin}`,children:a})}):e("div",{className:`section-title ${P.sectionTitleNoMargin}`,children:a})]}),c&&r>0&&M&&e("div",{className:P["nav-arrows"],children:[e("button",{className:P["nav-button"],type:"button","aria-label":"Scroll left",onClick:L=>{L.preventDefault(),E("left",R)},children:e(V,{name:"chevron-left"})}),e("button",{className:P["nav-button"],type:"button","aria-label":"Scroll right",onClick:L=>{L.preventDefault(),E("right",R)},children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:P["header-controls"],children:[d,N&&e("button",{className:P["collapse-button"],type:"button",onClick:()=>W(L=>!L),"aria-expanded":M,"aria-label":M?`Collapse ${a}`:`Expand ${a}`,children:M?e(V,{name:"chevron-up"}):e(V,{name:"chevron-down"})})]})]}),M&&(c?!t&&r===0&&n?e("div",{children:n}):e("div",{className:P["carousel-container"],children:e("div",{className:P.carousel,ref:T,children:e("div",{className:P["carousel-inner"],children:[t&&r===0?Array.from({length:u}).map((L,A)=>e("div",{className:P["carousel-card"],children:l},A)):U.Children.map(I,(L,A)=>e("div",{className:P["carousel-card"],children:L},U.isValidElement(L)&&L.key!=null?L.key:`slide-${A}`)),g&&l&&e("div",{className:P["carousel-card"],children:l})]})})}):e("div",{className:"grid-container",children:t&&r===0?e(De,{count:6,layout:s}):r>0?I:t?null:e("div",{style:{gridColumn:"1 / -1"},children:n})}))]})},Ot=({title:a,eyebrow:o,animeList:i,continueWatching:t,titleLink:n,onRemove:c,loading:s,emptyState:N,carousel:m,cardConfig:b,layout:v,onReachThreshold:g,scrollThreshold:f,isFetchingNextPage:r,collapsible:S,defaultExpanded:d=!0})=>{const l=v||"vertical";return e(ee,{title:a,eyebrow:o,titleLink:n,loading:s,emptyState:N,carousel:m,layout:l,collapsible:S,defaultExpanded:d,onReachThreshold:g,scrollThreshold:f,isFetchingNextPage:r,resetScrollOnShrink:t,highlight:t,itemCount:i.length,loadingSkeleton:e(Ee,{layout:l}),skeletonCount:7,children:m?i.map(u=>e(oe,{anime:u,continueWatching:t,onRemove:c,config:b,layout:l},u._id)):i.map(u=>e(oe,{anime:u,continueWatching:t,onRemove:c,config:b,layout:l},u._id))})},Me=U.memo(Ot),Ft="_sectionWrapper_c8uv6_2",Vt="_sectionTitleNoMargin_c8uv6_6",zt="_timeSelect_c8uv6_80",Gt="_carouselContainer_c8uv6_111",Ut="_carousel_c8uv6_111",qt="_carouselInner_c8uv6_122",Ht="_carouselItem_c8uv6_127",Qt="_rankCard_c8uv6_164",Yt="_rankPill_c8uv6_168",Xt="_rankGold_c8uv6_179",Kt="_rankSilver_c8uv6_183",jt="_rankBronze_c8uv6_187",Zt="_skeletonPoster_c8uv6_198",Jt="_skeletonText_c8uv6_199",_={sectionWrapper:Ft,sectionTitleNoMargin:Vt,"section-header":"_section-header_c8uv6_10","title-wrapper":"_title-wrapper_c8uv6_18","nav-arrows":"_nav-arrows_c8uv6_40","nav-button":"_nav-button_c8uv6_49",timeSelect:zt,carouselContainer:Gt,carousel:Ut,carouselInner:qt,carouselItem:Ht,rankCard:Qt,rankPill:Yt,rankGold:Xt,rankSilver:Kt,rankBronze:jt,skeletonPoster:Zt,skeletonText:Jt},Be="TRENDING_DESC",ea="POPULARITY_DESC",ta=10;function aa({title:a,eyebrow:o}){const{lowEndMode:i}=we(),[t,n]=le("trending_sort",Be),c=[{value:Be,label:"Trending"},{value:ea,label:"All Time"}],{data:s,fetchNextPage:N,hasNextPage:m,isFetchingNextPage:b,isLoading:v,isError:g,error:f}=at(t,ta),r=Y(()=>s?.pages.flatMap(u=>u)||[],[s]),S=x(()=>{m&&!b&&!v&&N()},[m,b,v,N]),{emblaRef:d,stepBy:l}=fe({onReachThreshold:S});return e("section",{className:_.sectionWrapper,children:[e("div",{className:_["section-header"],children:[e("div",{className:_["title-wrapper"],children:[e("div",{className:"title-stack",children:[o&&e("div",{className:"section-eyebrow",children:o}),e("div",{className:`section-title ${_.sectionTitleNoMargin}`,children:a})]}),e("div",{className:_["nav-arrows"],children:[e("button",{className:_["nav-button"],type:"button",onClick:u=>{u.preventDefault(),l("left",i)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:_["nav-button"],type:"button",onClick:u=>{u.preventDefault(),l("right",i)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:_["header-actions"],children:e("select",{className:_.timeSelect,value:t,onChange:u=>n(u.currentTarget.value),children:c.map(u=>e("option",{value:u.value,children:u.label},u.value))})})]}),v?e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,children:e("div",{className:_.carouselInner,children:Array.from({length:7}).map((u,I)=>e("div",{className:_.carouselItem,children:[e("div",{className:_.skeletonPoster}),e("div",{className:_.skeletonText})]},I))})})}):g?e(Ce,{message:f instanceof Error?f.message:"An unknown error occurred"}):e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,ref:d,children:e("div",{className:_.carouselInner,children:[r.map((u,I)=>e("div",{className:_.carouselItem,children:[e("div",{className:_.rankCard,children:e(oe,{anime:u})}),e("div",{className:`${_.rankPill} ${I===0?_.rankGold:I===1?_.rankSilver:I===2?_.rankBronze:""}`,children:I+1})]},u._id)),b&&e("div",{className:_.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:_.skeletonPoster})})]})})})]})}const na=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}],ra=10;function oa({eyebrow:a}){const{lowEndMode:o}=we(),[i,t]=le("latest_releases_format","TV"),{data:n,fetchNextPage:c,hasNextPage:s,isFetchingNextPage:N,isLoading:m,isError:b,error:v}=nt(i,ra),g=Y(()=>n?.pages.flatMap(d=>d)||[],[n]),f=x(()=>{s&&!N&&!m&&c()},[s,N,m,c]),{emblaRef:r,stepBy:S}=fe({onReachThreshold:f});return e("section",{className:_.sectionWrapper,children:[e("div",{className:_["section-header"],children:[e("div",{className:_["title-wrapper"],children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("div",{className:`section-title ${_.sectionTitleNoMargin}`,children:"Latest Releases"})]}),e("div",{className:_["nav-arrows"],children:[e("button",{className:_["nav-button"],type:"button",onClick:d=>{d.preventDefault(),S("left",o)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:_["nav-button"],type:"button",onClick:d=>{d.preventDefault(),S("right",o)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:_["header-actions"],children:e("select",{className:_.timeSelect,value:i,onChange:d=>t(d.currentTarget.value),children:na.map(d=>e("option",{value:d.value,children:d.label},d.value))})})]}),m?e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,children:e("div",{className:_.carouselInner,children:Array.from({length:7}).map((d,l)=>e("div",{className:_.carouselItem,children:[e("div",{className:_.skeletonPoster}),e("div",{className:_.skeletonText})]},l))})})}):b?e(Ce,{message:v instanceof Error?v.message:"An unknown error occurred"}):e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,ref:r,children:e("div",{className:_.carouselInner,children:[g.map(d=>e("div",{className:_.carouselItem,children:e(oe,{anime:d})},d._id)),N&&e("div",{className:_.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:_.skeletonPoster})})]})})})]})}const sa="_scheduleSection_10dfe_1",la="_sectionTitleRow_10dfe_5",ia="_sectionTitleNoMargin_10dfe_11",ca="_sectionHeader_10dfe_15",da="_headerActions_10dfe_25",ua="_timeSelect_10dfe_31",ha="_daySelectorContainer_10dfe_62",ma="_daySelector_10dfe_62",pa="_daySelectorInner_10dfe_79",ga="_dayBtn_10dfe_90",va="_active_10dfe_113",_a="_dayMonth_10dfe_121",fa="_dayNum_10dfe_129",ba="_dayName_10dfe_135",ya="_navArrows_10dfe_148",Na="_navButton_10dfe_157",Ta="_carouselContainer_10dfe_181",ka="_carousel_10dfe_181",Sa="_carouselInner_10dfe_193",wa="_carouselCard_10dfe_198",$={scheduleSection:sa,sectionTitleRow:la,sectionTitleNoMargin:ia,sectionHeader:ca,headerActions:da,timeSelect:ua,daySelectorContainer:ha,daySelector:ma,daySelectorInner:pa,dayBtn:ga,active:va,dayMonth:_a,dayNum:fa,dayName:ba,navArrows:ya,navButton:Na,carouselContainer:Ta,carousel:ka,carouselInner:Sa,carouselCard:wa},ue=a=>{const o=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),t=String(a.getDate()).padStart(2,"0");return`${o}-${i}-${t}`},Ca=async(a,o)=>await rt.data.schedule.query({date:a,format:o}),Ia=({eyebrow:a})=>{const[o,i]=D(()=>ue(new Date)),[t,n]=le("schedule_format","TV"),{emblaRef:c,canScroll:s,stepBy:N,scrollToStart:m}=fe(),b=G(null),v=G(!0),{data:g=[],isLoading:f,error:r}=Ze({queryKey:["schedule",o,t],queryFn:()=>Ca(o,t),staleTime:1e3*60*5}),S=Y(()=>{const l=[],u=new Date,I=ue(u),R=new Date(u);R.setDate(u.getDate()-1);const T=ue(R),E=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(let C=-6;C<=6;C++){const M=new Date(u);M.setDate(u.getDate()+C),l.push(M)}return l.map(C=>{const M=ue(C),L=M===I?"Today":M===T?"Yest":E[C.getDay()],A=C.getDate(),X=new Intl.DateTimeFormat("en-US",{month:"short"}).format(C);return{dateString:M,dayLabel:L,dayNum:A,monthName:X}})},[]);F(()=>{if(v.current){v.current=!1;return}if(b.current){const l=b.current.querySelector(`[data-date="${o}"]`);l&&l.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[o]),F(()=>{m(!0)},[o,m]);const d=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}];return e("div",{className:$.scheduleSection,children:[e("div",{className:$.sectionHeader,children:[e("div",{className:$.sectionTitleRow,children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("h2",{className:`section-title ${$.sectionTitleNoMargin}`,children:"Episode Schedule"})]}),g.length>0&&s&&e("div",{className:$.navArrows,children:[e("button",{className:$.navButton,onClick:()=>N("left"),"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:$.navButton,onClick:()=>N("right"),"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:$.headerActions,children:e("select",{className:$.timeSelect,value:t,onChange:l=>n(l.target.value),children:d.map(l=>e("option",{value:l.value,children:l.label},l.value))})})]}),e("div",{className:$.daySelectorContainer,children:e("div",{className:$.daySelector,ref:b,children:e("div",{className:$.daySelectorInner,children:S.map(l=>e("button",{type:"button","data-date":l.dateString,className:`${$.dayBtn} ${o===l.dateString?$.active:""}`,onClick:()=>i(l.dateString),children:[e("span",{className:$.dayMonth,children:l.monthName}),e("span",{className:$.dayNum,children:l.dayNum}),e("span",{className:$.dayName,children:l.dayLabel})]},l.dateString))})})}),e("div",{className:$.carouselContainer,children:e("div",{className:$.carousel,ref:c,children:e("div",{className:$.carouselInner,children:f?Array.from({length:7}).map((l,u)=>e("div",{className:$.carouselCard,children:e(Ee,{layout:"vertical"})},u)):r?e("div",{style:{width:"100%"},children:e(Ce,{message:r instanceof Error?r.message:"An unknown error occurred"})}):g.length===0?e("p",{style:{textAlign:"center",marginTop:"1rem",width:"100%"},children:"No episodes scheduled for this day."}):g.map(l=>e("div",{className:$.carouselCard,children:e(oe,{anime:l,continueWatching:!1,layout:"vertical"},l._id)},l._id))})})})]})},Aa="_bannerContainer_1457k_1",Ra="_hero_1457k_28",La="_ambient_1457k_37",$a="_ambientShow_1457k_49",Ma="_scrim_1457k_53",Ba="_progressLine_1457k_69",Pa="_paused_1457k_89",xa="_dots_1457k_103",Da="_dot_1457k_103",Ea="_dotActive_1457k_126",Wa="_viewport_1457k_137",Oa="_track_1457k_144",Fa="_slide_1457k_150",Va="_slideInner_1457k_158",za="_poster_1457k_168",Ga="_info_1457k_179",Ua="_kicker_1457k_184",qa="_featureLabel_1457k_191",Ha="_scoreChip_1457k_203",Qa="_rise_1457k_221",Ya="_active_1457k_225",Xa="_metaRow_1457k_281",Ka="_metaItem_1457k_292",ja="_metaDivider_1457k_298",Za="_title_1457k_305",Ja="_genres_1457k_321",en="_genreTag_1457k_329",tn="_summary_1457k_340",an="_actions_1457k_352",nn="_watchBtn_1457k_359",rn="_detailsBtn_1457k_381",on="_navArrow_1457k_402",sn="_prevArrow_1457k_435",ln="_nextArrow_1457k_439",y={bannerContainer:Aa,hero:Ra,ambient:La,ambientShow:$a,scrim:Ma,progressLine:Ba,paused:Pa,dots:xa,dot:Da,dotActive:Ea,viewport:Wa,track:Oa,slide:Fa,slideInner:Va,poster:za,info:Ga,kicker:Ua,featureLabel:qa,scoreChip:Ha,rise:Qa,active:Ya,metaRow:Xa,metaItem:Ka,metaDivider:ja,title:Za,genres:Ja,genreTag:en,summary:tn,actions:an,watchBtn:nn,detailsBtn:rn,navArrow:on,prevArrow:sn,nextArrow:ln},cn=8e3,he=()=>e("div",{className:"skeleton",style:{width:"100vw",maxWidth:"100vw",position:"relative",left:"50%",right:"50%",marginLeft:"-50vw",marginRight:"-50vw",height:"clamp(480px, 72vh, 660px)",marginTop:"calc(-1 * var(--header-height))",marginBottom:"2.5rem"}}),be=({slides:a,posterClassName:o})=>{const[i,t]=D(0),[n,c]=D(0),[s,N]=D(!1),[m,b]=D(null),[v,g]=D(0),[f,r]=D({front:"",back:"",flip:!1}),S=G(0),d=G(0),l=G(new Set),u=G(null),I=G(0),R=x(h=>h.bannerSrc,[]),T=x(()=>{c(h=>h+1)},[]),E=x(h=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null),b(null),T();const w=R(a[h]);r(k=>k.flip?{front:w,back:k.back,flip:!1}:{front:k.front,back:w,flip:!0}),t(h)},[T,a,R]),C=x(h=>{if(a.length===0)return;const w=(h%a.length+a.length)%a.length;l.current.has(R(a[w]))?E(w):b(w)},[a,R,E]);F(()=>{let h=!1;return a.forEach(w=>{const k=R(w);if(!k||l.current.has(k))return;const p=new Image;p.src=k;const O=()=>{h||l.current.has(k)||(l.current.add(k),g(q=>q+1))};p.onload=O,p.onerror=O}),()=>{h=!0}},[a,R]),F(()=>{if(a.length!==0&&!f.front){const h=R(a[0]);r({front:h,back:"",flip:!1})}},[a,f.front,R]),F(()=>{if(m!==null){if(m<0||m>=a.length){b(null);return}l.current.has(R(a[m]))&&E(m)}},[m,v,a,R,E]),F(()=>{if(m===null)return;u.current!==null&&window.clearTimeout(u.current);const h=m;return u.current=window.setTimeout(()=>{u.current=null,E(h)},2500),()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)}},[m,E]);const M=x(h=>{C(h)},[C]),W=x(()=>{C(I.current+1)},[C]),B=x(()=>{C(I.current-1)},[C]),L=G(null);if(F(()=>{const h=L.current;if(!h)return;const w=k=>{if(Math.abs(k.deltaY)>Math.abs(k.deltaX)&&Math.abs(k.deltaY)>5){k.preventDefault(),k.stopPropagation();const p=Date.now();if(p-S.current<300)return;S.current=p,T(),k.deltaY>0?W():B()}};return h.addEventListener("wheel",w,{passive:!1}),()=>h.removeEventListener("wheel",w)},[a.length,W,B,T]),F(()=>{if(a.length===0||s)return;const h=setTimeout(W,cn);return()=>clearTimeout(h)},[i,W,a.length,n,s]),F(()=>{const h=w=>{const k=w.target;k&&(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.tagName==="SELECT"||k.isContentEditable)||(w.key==="ArrowRight"?(w.preventDefault(),W()):w.key==="ArrowLeft"&&(w.preventDefault(),B()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[W,B]),F(()=>{i>=a.length&&t(0)},[a.length,i]),a.length===0)return null;const A=i>=a.length?0:i;I.current=A;const X=h=>{d.current=h.touches[0].clientX},j=h=>{const k=h.changedTouches[0].clientX-d.current;Math.abs(k)>50&&(T(),k>0?B():W())};return e("div",{className:y.bannerContainer,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:e("div",{className:`${y.hero} ${s?y.paused:""}`,onTouchStart:X,onTouchEnd:j,children:[f.front&&e("img",{src:f.front,alt:"","aria-hidden":"true",className:`${y.ambient} ${f.flip?"":y.ambientShow}`}),f.back&&e("img",{src:f.back,alt:"","aria-hidden":"true",className:`${y.ambient} ${f.flip?y.ambientShow:""}`}),e("div",{className:y.scrim,"aria-hidden":"true"}),a.length>1&&e("div",{className:y.progressLine,"aria-hidden":"true"},`progress-${n}-${A}`),a.length>1&&e("div",{className:y.dots,ref:L,role:"tablist","aria-label":"Spotlight slides",children:a.map((h,w)=>e("button",{role:"tab","aria-selected":w===A,"aria-label":`Go to slide ${w+1}: ${h.title}`,className:`${y.dot} ${w===A?y.dotActive:""}`,onClick:()=>M(w),tabIndex:w===A?0:-1},h.key))}),e("div",{className:y.viewport,children:e("div",{className:y.track,style:{transform:`translateX(-${A*100}%)`},children:a.map((h,w)=>e("div",{className:`${y.slide} ${w===A?y.active:""}`,"aria-hidden":w!==A,children:e("div",{className:y.slideInner,children:[e("img",{src:h.posterSrc,alt:h.posterAlt,className:o??y.poster,decoding:"async"}),e("div",{className:y.info,children:[e("div",{className:`${y.kicker} ${y.rise}`,children:[e("span",{className:y.featureLabel,children:"Spotlight"}),h.score!==void 0&&h.score!==null&&h.score!==""&&e("span",{className:y.scoreChip,children:[e(V,{name:"star",size:12}),e("span",{children:h.score})]})]}),e(xe,{to:h.detailTo,className:`${y.title} ${y.rise}`,"aria-label":`View details for ${h.title}`,tabIndex:w===A?0:-1,children:h.title}),h.metaItems.length>0&&e("div",{className:`${y.metaRow} ${y.rise}`,children:h.metaItems.map((k,p)=>e(U.Fragment,{children:[e("span",{className:y.metaItem,children:k}),p<h.metaItems.length-1&&e("div",{className:y.metaDivider})]},p))}),h.tags.length>0&&e("div",{className:`${y.genres} ${y.rise}`,children:h.tags.slice(0,3).map(k=>e("span",{className:y.genreTag,children:k},k))}),h.synopsis&&e("p",{className:`${y.summary} ${y.rise}`,children:h.synopsis}),e("div",{className:`${y.actions} ${y.rise}`,children:[e("button",{className:y.watchBtn,onClick:h.onPrimary,tabIndex:w===A?0:-1,children:[e(V,{name:h.primaryIcon,size:14}),e("span",{children:h.primaryLabel})]}),e("button",{className:y.detailsBtn,onClick:h.onDetails,tabIndex:w===A?0:-1,children:[e(V,{name:"info-circle",size:15}),e("span",{children:"Details"})]})]})]})]})},h.key))})}),a.length>1&&e(ie,{children:[e("button",{className:`${y.navArrow} ${y.prevArrow}`,onClick:()=>{T(),B()},"aria-label":"Previous slide",children:e(V,{name:"chevron-left",size:20})}),e("button",{className:`${y.navArrow} ${y.nextArrow}`,onClick:()=>{T(),W()},"aria-label":"Next slide",children:e(V,{name:"chevron-right",size:20})})]})]})})},dn=({animeList:a})=>{const{titlePreference:o}=We(),i=te(),t=Y(()=>a.slice(0,6).map(n=>{const c=o==="nativeName"?n.nativeName||n.name:o==="englishName"&&n.englishName||n.name;return{key:n._id,bannerSrc:n.bannerImage?ke(n.bannerImage,1280,560):ke(n.thumbnail,1280,450),posterSrc:ke(n.thumbnail,460,650),posterAlt:c,title:c,detailTo:`/anime/${n._id}`,score:n.score,metaItems:[n.type||"Anime",n.status,n.episodeCount?`${n.episodeCount} Episodes`:void 0,n.rating].filter(s=>!!s),tags:(n.genres??[]).slice(0,3).map(s=>typeof s=="string"?s:s?.name).filter(s=>!!s),synopsis:ot(n.description??""),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>i(`/watch/${n._id}`),onDetails:()=>i(`/anime/${n._id}`)}}),[a,o,i]);return e(be,{slides:t})},un="_emptyState_19tmt_1",hn="_emptyStateIcon_19tmt_16",mn="_emptyStateTitle_19tmt_23",pn="_emptyStateText_19tmt_30",me={emptyState:un,emptyStateIcon:hn,emptyStateTitle:mn,emptyStateText:pn},ye=({icon:a,text:o,actionLabel:i,onAction:t,title:n="Nothing is here..."})=>e("div",{className:me.emptyState,children:[e(V,{name:a,size:48,className:me.emptyStateIcon}),e("div",{children:[e("h3",{className:me.emptyStateTitle,children:n}),e("p",{className:me.emptyStateText,children:o})]}),e(Oe,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:i})]}),gn="_select_1dw63_1",vn={select:gn},ge=({value:a,options:o,onChange:i,ariaLabel:t,width:n})=>e("select",{className:vn.select,style:n!==void 0?{width:n}:void 0,value:a,"aria-label":t,onChange:c=>i(c.currentTarget.value),children:o.map(c=>e("option",{value:c.value,children:c.label},c.value))}),_n="_tabBar_irwbm_1",fn="_tabIndicator_irwbm_24",bn="_tabButton_irwbm_38",yn="_tabActive_irwbm_64",pe={tabBar:_n,tabIndicator:fn,tabButton:bn,tabActive:yn};function Nn({options:a,value:o,onChange:i,ariaLabel:t},n){const c=G(null),s=G(new Map),N=G(null),[m,b]=D({left:0,width:0}),v=x((g,f)=>{const r=s.current.get(g),S=c.current;if(r&&S){const d=S.getBoundingClientRect(),l=r.getBoundingClientRect();b({left:l.left-d.left+S.scrollLeft,width:l.width}),f&&r.scrollIntoView({block:"nearest",inline:"nearest"})}},[]);return je(()=>{const g=N.current!==null&&N.current!==o;N.current=o,v(o,g)},[o,a.length,v]),F(()=>{if(v(o,!1),typeof ResizeObserver>"u")return;let g=0;const f=c.current;if(!f)return;const r=new ResizeObserver(()=>{cancelAnimationFrame(g),g=requestAnimationFrame(()=>v(o,!1))});r.observe(f);let S=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{S||v(o,!1)}),()=>{S=!0,cancelAnimationFrame(g),r.disconnect()}},[o,a.length,v]),e("div",{className:pe.tabBar,ref:g=>{c.current=g,typeof n=="function"?n(g):n&&(n.current=g)},"aria-label":t,children:[e("div",{className:pe.tabIndicator,style:{left:m.left,width:m.width}}),a.map(g=>e(Oe,{ref:f=>{f&&s.current.set(g.value,f)},variant:"secondary",size:"sm",className:`${pe.tabButton} ${o===g.value?pe.tabActive:""}`,onClick:()=>i(g.value),children:g.label},g.value))]})}const ve=U.forwardRef(Nn),Tn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}];function kn(){const{options:a}=kt();return Y(()=>a.filter(o=>o.kind==="manga").map(o=>o.value)[0]??"",[a])}const Pe=({title:a,eyebrow:o,provider:i,sort:t,mature:n,headerActions:c})=>{const{toggle:s,bookmarkedIds:N}=Ge(),{popup:m,openPopup:b,scheduleClose:v,cancelClose:g,closePopup:f}=Ve(),{data:r,isLoading:S,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:u}=yt({provider:i,query:"",sort:t,status:"",type:"",rating:n?"safe,suggestive,erotica,pornographic":"safe",mature:n}),I=Y(()=>r?.pages.flatMap(T=>T.items)??[],[r]),R=x(()=>{l&&!u&&!S&&d()},[l,u,S,d]);return i?e(ie,{children:[e(ee,{title:a,eyebrow:o,loading:S,carousel:!0,itemCount:I.length,headerActions:c,onReachThreshold:R,isFetchingNextPage:u,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,children:I.map(T=>{const E=Se(T.provider,T.id);return e(_e,{item:{id:E,title:T.title,...He(T),thumbnail:qe(T.provider,T.cover),typeBadge:T.type||void 0,chapterBadge:T.latestChapter?`Ch. ${T.latestChapter}`:null,isAdult:Ue(T)},linkTo:`/manga/${T.provider}/${encodeURIComponent(T.id)}`,hoverIcon:"info",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:C=>b(C,{provider:T.provider,mangaId:T.id,title:T.title,altTitle:T.altTitle,cover:T.cover,contentRating:T.contentRating,readTarget:`/manga/${T.provider}/${encodeURIComponent(T.id)}`,mature:n}),onPopupHoverIntent:C=>C?g():v(),rawThumbnail:!0},`${T.provider}-${T.id}`)})}),m&&e(ze,{data:m.data,anchorRect:m.rect,bookmarked:N.has(Se(m.data.provider,m.data.mangaId)),onToggleBookmark:()=>s({id:m.data.mangaId,provider:m.data.provider,title:m.data.title,cover:m.data.cover,altTitle:m.data.altTitle??void 0,contentRating:m.data.contentRating}),onMouseEnter:g,onMouseLeave:v,onRequestClose:f})]}):null},Sn=()=>{const a=kn(),{hasConsent:o}=st(),[i,t]=le("manga_discover_tab","latest"),[n,c]=le("manga_trending_sort","popular");return a?e(ie,{children:[e(ve,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:i,onChange:t}),i==="latest"?e(Pe,{title:"Latest Releases",eyebrow:"Fresh chapters",provider:a,sort:"latest",mature:o}):e(Pe,{title:"Trending",eyebrow:"Discover",provider:a,sort:n,mature:o,headerActions:e("select",{className:P["header-select"],value:n,onChange:s=>c(s.currentTarget.value),"aria-label":"Trending sort",children:Tn.map(s=>e("option",{value:s.value,children:s.label},s.value))})})]}):null},wn=()=>{const a=te(),{data:o,isLoading:i}=Nt(24),[t,n]=D(null),{popup:c,openPopup:s,scheduleClose:N,cancelClose:m,closePopup:b}=Ve(),{toggle:v,bookmarkedIds:g}=Ge(),f=o?.data??[];return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{title:"Continue Reading",eyebrow:"Pick up where you left off",titleLink:"/reading-list/Continue Reading",loading:i,carousel:!0,collapsible:!0,defaultExpanded:f.length>0,highlight:!0,itemCount:f.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ye,{icon:"book",text:"You haven't read anything yet. Browse manga and open a chapter to start tracking.",actionLabel:"Browse Manga",onAction:()=>a("/manga")}),children:f.map(r=>{const S=r.page??0,d=r.pageCount??0,l=r.chapterId&&r.provider?`/manga/${r.provider}/${encodeURIComponent(r.mangaId)}/read?chapter=${encodeURIComponent(r.chapterId)}`:r.provider?`/manga/${r.provider}/${encodeURIComponent(r.mangaId)}`:"#";return e(_e,{item:{id:r.id,title:r.title,...He({title:r.title,altTitle:r.altTitle}),thumbnail:r.provider?qe(r.provider,r.cover||""):r.cover||"",chapterBadge:r.chapterNumber?`Ch. ${r.chapterNumber}`:null,isAdult:Ue(r)},linkTo:l,hoverIcon:"book",progress:d>0?{percent:S/d*100,label:`Ch. ${r.chapterNumber} · p. ${S}/${d}`}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>n({libId:r.id,title:r.title}),onOpenDetails:u=>s(u,{provider:r.provider||"",mangaId:r.mangaId||"",title:r.title||"",altTitle:r.altTitle,cover:r.cover||"",contentRating:r.contentRating||void 0,readTarget:l}),onPopupHoverIntent:u=>u?m():N(),rawThumbnail:!0},r.id)})}),e(bt,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>n(null)}),c&&c.data.provider&&e(ze,{data:c.data,anchorRect:c.rect,bookmarked:g.has(Se(c.data.provider,c.data.mangaId)),onToggleBookmark:()=>v({id:c.data.mangaId,provider:c.data.provider,title:c.data.title,cover:c.data.cover,altTitle:c.data.altTitle??void 0,contentRating:c.data.contentRating}),onMouseEnter:m,onMouseLeave:N,onRequestClose:b}),e(Sn,{})]})},Cn="_seasonGrid_bt5c7_76",In="_emptyState_bt5c7_108",H={"section-header":"_section-header_bt5c7_1","title-wrapper":"_title-wrapper_bt5c7_8","pagination-controls":"_pagination-controls_bt5c7_14",seasonGrid:Cn,emptyState:In},An=[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],Rn=[{value:"trending_week",label:"Trending Now"},{value:"trending_day",label:"Trending Today"},{value:"popular",label:"Popular All Time"},{value:"top_rated",label:"Top Rated"}],Ln=()=>{const a=te(),{data:o,isLoading:i}=Ct(24),t=It(),n=At(),[c,s]=D(null),[N,m]=D(!1),[b,v]=D(()=>localStorage.getItem("tv_home_activeTab")||"latest"),[g,f]=D("tv"),[r,S]=D("trending_week"),[d,l]=D("multi"),u=o?.data??[];U.useEffect(()=>{localStorage.setItem("tv_home_activeTab",b)},[b]);const I=r.startsWith("trending_"),R=r==="trending_day"?"day":"week",T={popular:"popularity.desc",top_rated:"vote_average.desc"},{data:E,isLoading:C}=Qe(d==="multi"?"all":d,R,1,I&&b==="trending"),{data:M,isLoading:W}=$e({type:d,sort_by:T[r]||"popularity.desc",page:1}),B=I?E?.results||[]:M?.results||[],L=I?C:W,{data:A,isLoading:X}=$e({type:g,sort_by:"primary_release_date.desc",page:1}),j=A?.results||[],h=()=>{c&&(n.mutate({mediaId:c.libId}),N&&t.mutate(c.libId),s(null),m(!1))},w=x(p=>e(St,{item:{id:p.id,title:p.title,year:p.year,type:p.type,image:p.image,vote_average:p.vote_average,adult:p.adult}},`${p.type}-${p.id}`),[]),k=()=>{switch(b){case"latest":return e("section",{children:[e("div",{className:H["section-header"],children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Fresh picks"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Latest Releases"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:e(ge,{ariaLabel:"Latest type",value:g,onChange:p=>f(p),options:[{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})})]}),X?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((p,O)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},O))}):j.length>0?e(ee,{carousel:!0,itemCount:j.length,children:j.map(w)}):e("div",{className:H.emptyState,children:e("p",{children:"No latest releases available right now."})})]});case"trending":return e("section",{children:[e("div",{className:H["section-header"],children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Discover"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Trending"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(ge,{ariaLabel:"Trending sort",value:r,onChange:S,options:Rn.map(p=>({value:p.value,label:p.label}))}),e(ge,{ariaLabel:"Trending type",value:d,onChange:p=>l(p),options:[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})]})]}),L?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((p,O)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},O))}):B.length>0?e(ee,{carousel:!0,itemCount:B.length,children:B.map(w)}):e("div",{className:H.emptyState,children:e("p",{children:"No trending content available right now."})})]})}};return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/tv-watchlist/Continue Watching",loading:i,carousel:!0,collapsible:!0,defaultExpanded:u.length>0,highlight:!0,itemCount:u.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ye,{icon:"tv",text:"You haven't watched anything yet. Search TV & Movies and start watching to track progress.",actionLabel:"Browse TV & Movies",onAction:()=>a("/tv-search")}),children:u.map(p=>{const O=p.currentTime??0,q=p.duration??0,Z=p.season??p.lastSeason??1,ce=p.episode??p.lastEpisode??1,Q=p.mediaType==="movie",J=Q?"Movie":`S${Z} E${ce}`,ae=p.completed===!0||p.completed===1||q>0&&O>=q*.8,ne=ae?100:q>0&&O>0?O/q*100:0,Ne=ae?"Watched":q>0?Q?`${re(O)} / ${re(q)}`:`${J} · ${re(O)} / ${re(q)}`:J;return e(_e,{item:{id:p.id,title:p.title,thumbnail:p.poster||"",typeBadge:Q?"Movie":"TV",chapterBadge:J,isAdult:Lt({adult:p.adult===1})},linkTo:Rt(p.mediaType,p.tmdbId,Q?void 0:Z,Q?void 0:ce),hoverIcon:"play",progress:(q>0||ae)&&ne>0?{percent:ne,label:Ne}:void 0,showProgress:!0,metaRow:p.year?e("span",{style:{opacity:.75},children:p.year}):void 0,onRemove:()=>s({libId:p.id,title:p.title}),renderPopup:(de,se)=>e(wt,{item:{id:p.tmdbId??0,title:p.title||"",year:p.year||"",type:p.mediaType||"tv",image:p.poster||""},anchorRect:de,onMouseEnter:se.onMouseEnter,onMouseLeave:se.onMouseLeave,onRequestClose:se.close})},p.id)})}),e(ve,{ariaLabel:"Browse TV",options:An,value:b,onChange:v}),e("div",{className:H.tabContent,children:k()}),e(Fe,{isOpen:!!c,itemName:c?.title,progressKind:"watch",listLabel:"my TV watchlist",alsoRemove:N,onAlsoRemoveChange:m,onClose:()=>{s(null),m(!1)},onConfirm:h})]})};function $n(a){const o=a.currentTime??0,i=a.duration??0,t=(a.trackIndex??0)+1;return i>0?`Track ${t} · ${re(o)} / ${re(i)}`:a.trackLabel?`Track ${t} · ${a.trackLabel}`:`Track ${t}`}const Mn=({title:a="Continue Listening",limit:o=24,titleLink:i,showEmptyState:t=!0})=>{const n=te(),{data:c,isLoading:s}=Bt(o),[N,m]=D(null),b=c?.data??[];return e(ie,{children:[e(ee,{title:a,eyebrow:"Pick up where you left off",titleLink:i??"/listening-list/Continue Listening",loading:s,carousel:!0,collapsible:!0,defaultExpanded:b.length>0,highlight:!0,itemCount:b.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"16 / 9"}}),skeletonCount:7,emptyState:t?e(ye,{icon:"headphones",text:"You haven't listened to anything yet. Browse ASMR and play a track to start tracking.",actionLabel:"Browse ASMR",onAction:()=>n("/asmr")}):void 0,children:b.map(v=>{const g=v.currentTime??0,f=v.duration??0,r=v.rjCode||v.id;return e(_e,{item:{id:v.id,title:v.title,thumbnail:v.thumbnail||"",chapterBadge:`Track ${(v.trackIndex??0)+1}`,isAdult:!!v.isAdult},linkTo:`/asmr/${encodeURIComponent(r)}`,hoverIcon:"play",layout:"horizontal",progress:f>0?{percent:Math.min(100,g/f*100),label:$n(v)??""}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>m({workId:v.id,title:v.title}),rawThumbnail:!0},v.id)})}),e(Mt,{workId:N?N.workId:null,title:N?.title,onClose:()=>m(null)})]})},Bn=()=>e("div",{style:{paddingBottom:"2rem"},children:e(Mn,{})}),Pn={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",18:"Drama",10765:"Sci-Fi & Fantasy",9648:"Mystery",28:"Action",12:"Adventure",14:"Fantasy",27:"Horror",878:"Sci-Fi",53:"Thriller",10749:"Romance"},xn=({items:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map(t=>{const n=$t(t.type,t.id);return{key:String(t.id),bannerSrc:t.backdrop?t.backdrop:t.image,posterSrc:t.image,posterAlt:t.title,title:t.title,detailTo:n,score:t.vote_average>0?Number(t.vote_average).toFixed(1):null,metaItems:[t.type==="tv"?"TV Show":"Movie",t.year].filter(Boolean),tags:t.genre_ids.slice(0,3).map(c=>Pn[c]).filter(Boolean),synopsis:t.overview.length>200?t.overview.slice(0,200)+"...":t.overview,primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>o(n),onDetails:()=>o(n)}}),[a,o]);return e(be,{slides:i})},Dn=({mangaList:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map(t=>({key:t.id,bannerSrc:t.cover||"",posterSrc:t.cover,posterAlt:t.title,title:t.title,detailTo:`/manga/mangadex/${t.id}`,metaItems:[t.year?String(t.year):void 0,t.status??void 0].filter(n=>!!n),tags:t.tags.slice(0,3),synopsis:t.description?.slice(0,200)||"",primaryLabel:"Read Now",primaryIcon:"book",onPrimary:()=>o(`/manga/mangadex/${t.id}`),onDetails:()=>o(`/manga/mangadex/${t.id}`)})),[a,o]);return e(be,{slides:i})},En="_posterLandscape_ak7az_1",Wn={posterLandscape:En};function On(a){const o=a.availableEpisodes?.sub;if(typeof o=="number"&&o>0)return o;const i=a.availableEpisodesDetail?.sub,t=a.availableEpisodesDetail?.dub,n=(Array.isArray(i)?i.length:0)+(Array.isArray(t)?t.length:0);return n>0?n:null}const Fn=({works:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map((t,n)=>{const c=Pt(t),s=`/asmr/${encodeURIComponent(c)}`,N=On(t);return{key:c||t._id||String(n),bannerSrc:t.thumbnail||"",posterSrc:t.thumbnail,posterAlt:t.name,title:t.name,detailTo:s,metaItems:[t.rating?t.rating.toUpperCase():void 0,N?`${N} track${N===1?"":"s"}`:void 0].filter(m=>!!m),tags:[],synopsis:t.description?.slice(0,160)||"",primaryLabel:"Listen Now",primaryIcon:"play",onPrimary:()=>o(s),onDetails:()=>o(s)}}),[a,o]);return e(be,{slides:i,posterClassName:Wn.posterLandscape})},Vn=[{value:"anime",label:"Anime"},{value:"manga",label:"Manga"},{value:"tv",label:"TV & Movies"},{value:"asmr",label:"ASMR"}],hr=()=>{const a=Je(),o=lt(),[i,t]=U.useState(1),[n,c]=D(()=>localStorage.getItem("home_activeTab")||"latest"),[s,N]=D(()=>localStorage.getItem("season_format")||"TV"),m=G(null),{data:b}=Le(i+1,s,n==="season"),{titlePreference:v}=We(),{contentType:g,setContentType:f}=it(),[r,S]=U.useState(null),[d,l]=U.useState(!1),u=ct(),{data:I=[]}=dt(),R=ut(),T=ht(),E=mt();F(()=>{document.title="Home - dango"},[]);const{data:C,isLoading:M}=pt();F(()=>{localStorage.setItem("home_activeTab",n)},[n]),F(()=>{localStorage.setItem("season_format",s),t(1)},[s]),F(()=>{C!==void 0&&C.length===0&&n==="week"&&c("latest")},[C,n]);const{data:W,isLoading:B,fetchNextPage:L,hasNextPage:A,isFetchingNextPage:X}=gt(),j=x(()=>{A&&!X&&!B&&L()},[A,X,B,L]),{data:h,isLoading:w}=vt(),{data:k,isLoading:p}=Qe("all","week",1,g==="tv"),{data:O,isLoading:q}=xt(g==="asmr"),{data:Z,isLoading:ce}=Tt(),Q=Y(()=>W?.pages||[],[W]),{data:J,isLoading:ae}=Le(i,s,n==="season"),ne=14,Ne=J&&J.length>=ne&&b&&b.length>0,de=et(o.continueWatching.remove.mutationOptions({onSuccess:async()=>{a.invalidateQueries(o.continueWatching.pathFilter()),await a.invalidateQueries({queryKey:["allContinueWatching"]}),A&&Q.length-1<14&&L()}})),se=x(z=>{const K=Q?.find(Te=>String(Te.id)===String(z));if(K){const Te=K[v]||K.name;S({id:z,name:Te})}},[Q,v]),Ye=x(()=>{r&&(de.mutate({showId:r.id}),d&&u.mutate({id:r.id}),S(null),l(!1))},[r,de,u,d]),Ie=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Ae=C!==void 0&&C.length>0,Xe=Ae?[{key:"week",label:"This Week"},...Ie]:Ie,Re=n==="week"&&!Ae?"latest":n,Ke=()=>{switch(Re){case"latest":return e(oa,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:H["section-header"],ref:m,children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"This season"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Current Season"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(ge,{ariaLabel:"Season format",width:90,value:s,onChange:N,options:[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}]}),e("div",{className:H["pagination-controls"],children:e(tt,{page:i,canGoNext:Ne,onChange:z=>{if(t(z),m.current){const K=m.current.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:K,behavior:"smooth"})}},isLoading:ae})})]})]}),e("div",{className:`grid-container ${H.seasonGrid}`,style:{minHeight:"300px",alignContent:"start"},children:ae?e(De,{count:ne}):J?.slice(0,ne).map(z=>e(oe,{anime:z},z._id))})]});case"popular":return e(aa,{title:"Trending",eyebrow:"Discover"});case"week":return e(Me,{title:"This Week",eyebrow:"Aired this week",animeList:C||[],continueWatching:!1,carousel:!0,loading:M});default:return null}};return e("div",{style:{paddingBottom:"2rem"},children:[g==="anime"&&(w&&!h?.length?e(he,{}):h&&h.length>0&&e(dn,{animeList:h})),g==="tv"&&(p&&!k?.results?.length?e(he,{}):k?.results&&k.results.length>0&&e(xn,{items:k.results})),g==="manga"&&(ce&&!Z?.length?e(he,{}):Z&&Z.length>0&&e(Dn,{mangaList:Z})),g==="asmr"&&(q&&!O?.length?e(he,{}):O&&O.length>0&&e(Fn,{works:O})),e(ve,{ariaLabel:"Content type",options:Vn,value:g,onChange:f}),g==="manga"?e(wn,{}):g==="tv"?e(Ln,{}):g==="asmr"?e(Bn,{}):e(ie,{children:[e(Me,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:Q,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:Q.length>0,onRemove:se,loading:B,onReachThreshold:j,scrollThreshold:.7,isFetchingNextPage:X,emptyState:e(ye,{icon:"history",text:"You haven't watched anything yet. Start exploring and watch something first!",actionLabel:"Explore Trending",onAction:()=>c("popular")})}),e(ft,{title:"Queue",eyebrow:"Up next",items:I,onRemove:z=>R.mutate({showId:z.showId,episodeNumber:z.episodeNumber}),showClearAll:!0,onClear:()=>T.mutate(),onReorder:z=>E.mutate(z.map(K=>({id:K.id,showId:K.showId,episodeNumber:K.episodeNumber})))}),e(ve,{ariaLabel:"Browse anime",options:Xe.map(z=>({value:z.key,label:z.label})),value:Re,onChange:c}),e("div",{className:H.tabContent,children:Ke()}),e(Ia,{eyebrow:"Never miss an episode"}),e(Fe,{isOpen:!!r,itemName:r?.name,progressKind:"watch",listLabel:"my watchlist",alsoRemove:d,onAlsoRemoveChange:l,onClose:()=>{S(null),l(!1)},onConfirm:Ye})]})]})};export{hr as default};
|
|
1
|
+
import{d as D,A as G,h as F,q as x,g as U,u as e,L as xe,T as Y,S as ie,a as te,_ as je}from"./vendor-core-DfaOB3Rn.js";import{b as Ze,u as Je,a as et}from"./vendor-query-BBT5_sHx.js";import{S as De,A as Ee,P as tt}from"./SkeletonGrid-DJelJgAv.js";import{A as oe}from"./AnimeCard-C3P9zWi9.js";import{I as V}from"./vendor-icons-DrybRNxP.js";import{u as we,a as le,b as at,c as nt,t as rt,d as We,s as ot,f as ke,B as Oe,e as st,g as re,h as lt,i as Le,j as it,k as ct,l as dt,m as ut,n as ht,o as mt,p as pt,q as gt,r as vt}from"./index-CnfZwsds.js";import{u as _t}from"./vendor-ui-3qrARCPr.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{R as Fe}from"./ResetProgressModal-CMF86mX6.js";import{Q as ft}from"./QueueRail-DOrYgNVX.js";import{M as _e}from"./MediaCard--cuFxOCS.js";import{u as Ve,M as ze}from"./useMangaPopup-D57OVGUr.js";import{M as bt}from"./MangaResetProgressModal-DGzl8vsO.js";import{u as Ge,a as yt,m as Se,i as Ue,b as qe,c as He,d as Nt,e as Tt}from"./useMangaLibrary-DuesWQaE.js";import{u as kt}from"./useProviders-mpQb_dix.js";import{u as Qe,a as $e,T as St}from"./useTv-DGflCsSI.js";import{T as wt}from"./TvPopup-DtHilRDT.js";import{u as Ct,a as It,b as At,t as Rt,i as Lt,c as $t}from"./useTvLibrary-BqeSmyc4.js";import{A as Mt}from"./AsmrResetProgressModal-DgEWBJOw.js";import{u as Bt,a as Pt,b as xt}from"./useAsmr-BbhQ59bk.js";import"./useAnimeInfoData-DYXWBPF-.js";import"./QueueOptionsButton-Djq4Cpex.js";import"./useIsMobile-Dvx1uJ82.js";import"./usePopup-DS9jMzp6.js";const Dt="_sectionWrapper_2p2l1_9",Et="_sectionTitleNoMargin_2p2l1_13",Wt="_carousel_2p2l1_178",P={"section-header":"_section-header_2p2l1_1",sectionWrapper:Dt,sectionTitleNoMargin:Et,"title-wrapper":"_title-wrapper_2p2l1_17","header-controls":"_header-controls_2p2l1_24","header-select":"_header-select_2p2l1_30","collapse-button":"_collapse-button_2p2l1_79","title-link":"_title-link_2p2l1_98","continue-watching":"_continue-watching_2p2l1_117","nav-arrows":"_nav-arrows_2p2l1_139","nav-button":"_nav-button_2p2l1_148","carousel-container":"_carousel-container_2p2l1_178",carousel:Wt,"carousel-inner":"_carousel-inner_2p2l1_187","carousel-card":"_carousel-card_2p2l1_192"};function fe({align:a="start",containScroll:o="trimSnaps",scrollFraction:i=.8,threshold:t=.6,onReachThreshold:n}={}){const[c,s]=_t({align:a,containScroll:o,dragFree:!0}),[N,m]=D(!1),b=G({scrollFraction:i,threshold:t,onReachThreshold:n}),v=G(!1);F(()=>{b.current={scrollFraction:i,threshold:t,onReachThreshold:n}});const g=x(d=>{m(d.canScrollPrev()||d.canScrollNext())},[]);F(()=>{if(!s)return;const d=()=>{const l=s.scrollProgress();l>=b.current.threshold&&!v.current?(v.current=!0,b.current.onReachThreshold?.()):l<b.current.threshold&&(v.current=!1),g(s)};return s.on("init",d),s.on("reInit",d),s.on("scroll",d),s.on("resize",d),()=>{s.off("init",d),s.off("reInit",d),s.off("scroll",d),s.off("resize",d)}},[s,g]);const f=x(d=>{const l=d.containerNode().firstElementChild;if(!l)return 1;const u=d.rootNode().getBoundingClientRect().width,I=l.getBoundingClientRect().width;return I?Math.max(1,Math.round(u/I)):1},[]),r=x((d,l=!1)=>{if(!s)return;const u=Math.max(1,Math.round(f(s)*b.current.scrollFraction)),I=s.selectedScrollSnap()+(d==="left"?-u:u);s.scrollTo(I,l)},[s,f]),S=x((d=!1)=>{s?.scrollTo(0,d)},[s]);return{emblaRef:c,api:s,canScroll:N,stepBy:r,scrollToStart:S}}const ee=({title:a,eyebrow:o,titleLink:i,loading:t,emptyState:n,carousel:c,layout:s,collapsible:N,defaultExpanded:m=!0,onReachThreshold:b,scrollThreshold:v,isFetchingNextPage:g,resetScrollOnShrink:f,itemCount:r=0,highlight:S,headerActions:d,loadingSkeleton:l,skeletonCount:u=7,children:I})=>{const{lowEndMode:R}=we(),{emblaRef:T,stepBy:E,scrollToStart:C}=fe({onReachThreshold:b,threshold:v}),[M,W]=U.useState(m);U.useEffect(()=>{W(m)},[m]);const B=U.useRef(0);return U.useEffect(()=>{f&&r>0&&M&&(r<=B.current||B.current===0)&&C(),r>0&&(B.current=r)},[r,f,M,C]),!t&&r===0&&!n&&!N?null:e("section",{className:`${P.sectionWrapper} ${S?P["continue-watching"]:""}`,children:[e("div",{className:P["section-header"],children:[e("div",{className:P["title-wrapper"],children:[e("div",{className:"title-stack",children:[o&&e("div",{className:"section-eyebrow",children:o}),i?e(xe,{to:i,className:P["title-link"],children:e("div",{className:`section-title ${P.sectionTitleNoMargin}`,children:a})}):e("div",{className:`section-title ${P.sectionTitleNoMargin}`,children:a})]}),c&&r>0&&M&&e("div",{className:P["nav-arrows"],children:[e("button",{className:P["nav-button"],type:"button","aria-label":"Scroll left",onClick:L=>{L.preventDefault(),E("left",R)},children:e(V,{name:"chevron-left"})}),e("button",{className:P["nav-button"],type:"button","aria-label":"Scroll right",onClick:L=>{L.preventDefault(),E("right",R)},children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:P["header-controls"],children:[d,N&&e("button",{className:P["collapse-button"],type:"button",onClick:()=>W(L=>!L),"aria-expanded":M,"aria-label":M?`Collapse ${a}`:`Expand ${a}`,children:M?e(V,{name:"chevron-up"}):e(V,{name:"chevron-down"})})]})]}),M&&(c?!t&&r===0&&n?e("div",{children:n}):e("div",{className:P["carousel-container"],children:e("div",{className:P.carousel,ref:T,children:e("div",{className:P["carousel-inner"],children:[t&&r===0?Array.from({length:u}).map((L,A)=>e("div",{className:P["carousel-card"],children:l},A)):U.Children.map(I,(L,A)=>e("div",{className:P["carousel-card"],children:L},U.isValidElement(L)&&L.key!=null?L.key:`slide-${A}`)),g&&l&&e("div",{className:P["carousel-card"],children:l})]})})}):e("div",{className:"grid-container",children:t&&r===0?e(De,{count:6,layout:s}):r>0?I:t?null:e("div",{style:{gridColumn:"1 / -1"},children:n})}))]})},Ot=({title:a,eyebrow:o,animeList:i,continueWatching:t,titleLink:n,onRemove:c,loading:s,emptyState:N,carousel:m,cardConfig:b,layout:v,onReachThreshold:g,scrollThreshold:f,isFetchingNextPage:r,collapsible:S,defaultExpanded:d=!0})=>{const l=v||"vertical";return e(ee,{title:a,eyebrow:o,titleLink:n,loading:s,emptyState:N,carousel:m,layout:l,collapsible:S,defaultExpanded:d,onReachThreshold:g,scrollThreshold:f,isFetchingNextPage:r,resetScrollOnShrink:t,highlight:t,itemCount:i.length,loadingSkeleton:e(Ee,{layout:l}),skeletonCount:7,children:m?i.map(u=>e(oe,{anime:u,continueWatching:t,onRemove:c,config:b,layout:l},u._id)):i.map(u=>e(oe,{anime:u,continueWatching:t,onRemove:c,config:b,layout:l},u._id))})},Me=U.memo(Ot),Ft="_sectionWrapper_c8uv6_2",Vt="_sectionTitleNoMargin_c8uv6_6",zt="_timeSelect_c8uv6_80",Gt="_carouselContainer_c8uv6_111",Ut="_carousel_c8uv6_111",qt="_carouselInner_c8uv6_122",Ht="_carouselItem_c8uv6_127",Qt="_rankCard_c8uv6_164",Yt="_rankPill_c8uv6_168",Xt="_rankGold_c8uv6_179",Kt="_rankSilver_c8uv6_183",jt="_rankBronze_c8uv6_187",Zt="_skeletonPoster_c8uv6_198",Jt="_skeletonText_c8uv6_199",_={sectionWrapper:Ft,sectionTitleNoMargin:Vt,"section-header":"_section-header_c8uv6_10","title-wrapper":"_title-wrapper_c8uv6_18","nav-arrows":"_nav-arrows_c8uv6_40","nav-button":"_nav-button_c8uv6_49",timeSelect:zt,carouselContainer:Gt,carousel:Ut,carouselInner:qt,carouselItem:Ht,rankCard:Qt,rankPill:Yt,rankGold:Xt,rankSilver:Kt,rankBronze:jt,skeletonPoster:Zt,skeletonText:Jt},Be="TRENDING_DESC",ea="POPULARITY_DESC",ta=10;function aa({title:a,eyebrow:o}){const{lowEndMode:i}=we(),[t,n]=le("trending_sort",Be),c=[{value:Be,label:"Trending"},{value:ea,label:"All Time"}],{data:s,fetchNextPage:N,hasNextPage:m,isFetchingNextPage:b,isLoading:v,isError:g,error:f}=at(t,ta),r=Y(()=>s?.pages.flatMap(u=>u)||[],[s]),S=x(()=>{m&&!b&&!v&&N()},[m,b,v,N]),{emblaRef:d,stepBy:l}=fe({onReachThreshold:S});return e("section",{className:_.sectionWrapper,children:[e("div",{className:_["section-header"],children:[e("div",{className:_["title-wrapper"],children:[e("div",{className:"title-stack",children:[o&&e("div",{className:"section-eyebrow",children:o}),e("div",{className:`section-title ${_.sectionTitleNoMargin}`,children:a})]}),e("div",{className:_["nav-arrows"],children:[e("button",{className:_["nav-button"],type:"button",onClick:u=>{u.preventDefault(),l("left",i)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:_["nav-button"],type:"button",onClick:u=>{u.preventDefault(),l("right",i)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:_["header-actions"],children:e("select",{className:_.timeSelect,value:t,onChange:u=>n(u.currentTarget.value),children:c.map(u=>e("option",{value:u.value,children:u.label},u.value))})})]}),v?e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,children:e("div",{className:_.carouselInner,children:Array.from({length:7}).map((u,I)=>e("div",{className:_.carouselItem,children:[e("div",{className:_.skeletonPoster}),e("div",{className:_.skeletonText})]},I))})})}):g?e(Ce,{message:f instanceof Error?f.message:"An unknown error occurred"}):e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,ref:d,children:e("div",{className:_.carouselInner,children:[r.map((u,I)=>e("div",{className:_.carouselItem,children:[e("div",{className:_.rankCard,children:e(oe,{anime:u})}),e("div",{className:`${_.rankPill} ${I===0?_.rankGold:I===1?_.rankSilver:I===2?_.rankBronze:""}`,children:I+1})]},u._id)),b&&e("div",{className:_.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:_.skeletonPoster})})]})})})]})}const na=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}],ra=10;function oa({eyebrow:a}){const{lowEndMode:o}=we(),[i,t]=le("latest_releases_format","TV"),{data:n,fetchNextPage:c,hasNextPage:s,isFetchingNextPage:N,isLoading:m,isError:b,error:v}=nt(i,ra),g=Y(()=>n?.pages.flatMap(d=>d)||[],[n]),f=x(()=>{s&&!N&&!m&&c()},[s,N,m,c]),{emblaRef:r,stepBy:S}=fe({onReachThreshold:f});return e("section",{className:_.sectionWrapper,children:[e("div",{className:_["section-header"],children:[e("div",{className:_["title-wrapper"],children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("div",{className:`section-title ${_.sectionTitleNoMargin}`,children:"Latest Releases"})]}),e("div",{className:_["nav-arrows"],children:[e("button",{className:_["nav-button"],type:"button",onClick:d=>{d.preventDefault(),S("left",o)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:_["nav-button"],type:"button",onClick:d=>{d.preventDefault(),S("right",o)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:_["header-actions"],children:e("select",{className:_.timeSelect,value:i,onChange:d=>t(d.currentTarget.value),children:na.map(d=>e("option",{value:d.value,children:d.label},d.value))})})]}),m?e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,children:e("div",{className:_.carouselInner,children:Array.from({length:7}).map((d,l)=>e("div",{className:_.carouselItem,children:[e("div",{className:_.skeletonPoster}),e("div",{className:_.skeletonText})]},l))})})}):b?e(Ce,{message:v instanceof Error?v.message:"An unknown error occurred"}):e("div",{className:_.carouselContainer,children:e("div",{className:_.carousel,ref:r,children:e("div",{className:_.carouselInner,children:[g.map(d=>e("div",{className:_.carouselItem,children:e(oe,{anime:d})},d._id)),N&&e("div",{className:_.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:_.skeletonPoster})})]})})})]})}const sa="_scheduleSection_10dfe_1",la="_sectionTitleRow_10dfe_5",ia="_sectionTitleNoMargin_10dfe_11",ca="_sectionHeader_10dfe_15",da="_headerActions_10dfe_25",ua="_timeSelect_10dfe_31",ha="_daySelectorContainer_10dfe_62",ma="_daySelector_10dfe_62",pa="_daySelectorInner_10dfe_79",ga="_dayBtn_10dfe_90",va="_active_10dfe_113",_a="_dayMonth_10dfe_121",fa="_dayNum_10dfe_129",ba="_dayName_10dfe_135",ya="_navArrows_10dfe_148",Na="_navButton_10dfe_157",Ta="_carouselContainer_10dfe_181",ka="_carousel_10dfe_181",Sa="_carouselInner_10dfe_193",wa="_carouselCard_10dfe_198",$={scheduleSection:sa,sectionTitleRow:la,sectionTitleNoMargin:ia,sectionHeader:ca,headerActions:da,timeSelect:ua,daySelectorContainer:ha,daySelector:ma,daySelectorInner:pa,dayBtn:ga,active:va,dayMonth:_a,dayNum:fa,dayName:ba,navArrows:ya,navButton:Na,carouselContainer:Ta,carousel:ka,carouselInner:Sa,carouselCard:wa},ue=a=>{const o=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),t=String(a.getDate()).padStart(2,"0");return`${o}-${i}-${t}`},Ca=async(a,o)=>await rt.data.schedule.query({date:a,format:o}),Ia=({eyebrow:a})=>{const[o,i]=D(()=>ue(new Date)),[t,n]=le("schedule_format","TV"),{emblaRef:c,canScroll:s,stepBy:N,scrollToStart:m}=fe(),b=G(null),v=G(!0),{data:g=[],isLoading:f,error:r}=Ze({queryKey:["schedule",o,t],queryFn:()=>Ca(o,t),staleTime:1e3*60*5}),S=Y(()=>{const l=[],u=new Date,I=ue(u),R=new Date(u);R.setDate(u.getDate()-1);const T=ue(R),E=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(let C=-6;C<=6;C++){const M=new Date(u);M.setDate(u.getDate()+C),l.push(M)}return l.map(C=>{const M=ue(C),L=M===I?"Today":M===T?"Yest":E[C.getDay()],A=C.getDate(),X=new Intl.DateTimeFormat("en-US",{month:"short"}).format(C);return{dateString:M,dayLabel:L,dayNum:A,monthName:X}})},[]);F(()=>{if(v.current){v.current=!1;return}if(b.current){const l=b.current.querySelector(`[data-date="${o}"]`);l&&l.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[o]),F(()=>{m(!0)},[o,m]);const d=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}];return e("div",{className:$.scheduleSection,children:[e("div",{className:$.sectionHeader,children:[e("div",{className:$.sectionTitleRow,children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("h2",{className:`section-title ${$.sectionTitleNoMargin}`,children:"Episode Schedule"})]}),g.length>0&&s&&e("div",{className:$.navArrows,children:[e("button",{className:$.navButton,onClick:()=>N("left"),"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:$.navButton,onClick:()=>N("right"),"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:$.headerActions,children:e("select",{className:$.timeSelect,value:t,onChange:l=>n(l.target.value),children:d.map(l=>e("option",{value:l.value,children:l.label},l.value))})})]}),e("div",{className:$.daySelectorContainer,children:e("div",{className:$.daySelector,ref:b,children:e("div",{className:$.daySelectorInner,children:S.map(l=>e("button",{type:"button","data-date":l.dateString,className:`${$.dayBtn} ${o===l.dateString?$.active:""}`,onClick:()=>i(l.dateString),children:[e("span",{className:$.dayMonth,children:l.monthName}),e("span",{className:$.dayNum,children:l.dayNum}),e("span",{className:$.dayName,children:l.dayLabel})]},l.dateString))})})}),e("div",{className:$.carouselContainer,children:e("div",{className:$.carousel,ref:c,children:e("div",{className:$.carouselInner,children:f?Array.from({length:7}).map((l,u)=>e("div",{className:$.carouselCard,children:e(Ee,{layout:"vertical"})},u)):r?e("div",{style:{width:"100%"},children:e(Ce,{message:r instanceof Error?r.message:"An unknown error occurred"})}):g.length===0?e("p",{style:{textAlign:"center",marginTop:"1rem",width:"100%"},children:"No episodes scheduled for this day."}):g.map(l=>e("div",{className:$.carouselCard,children:e(oe,{anime:l,continueWatching:!1,layout:"vertical"},l._id)},l._id))})})})]})},Aa="_bannerContainer_1457k_1",Ra="_hero_1457k_28",La="_ambient_1457k_37",$a="_ambientShow_1457k_49",Ma="_scrim_1457k_53",Ba="_progressLine_1457k_69",Pa="_paused_1457k_89",xa="_dots_1457k_103",Da="_dot_1457k_103",Ea="_dotActive_1457k_126",Wa="_viewport_1457k_137",Oa="_track_1457k_144",Fa="_slide_1457k_150",Va="_slideInner_1457k_158",za="_poster_1457k_168",Ga="_info_1457k_179",Ua="_kicker_1457k_184",qa="_featureLabel_1457k_191",Ha="_scoreChip_1457k_203",Qa="_rise_1457k_221",Ya="_active_1457k_225",Xa="_metaRow_1457k_281",Ka="_metaItem_1457k_292",ja="_metaDivider_1457k_298",Za="_title_1457k_305",Ja="_genres_1457k_321",en="_genreTag_1457k_329",tn="_summary_1457k_340",an="_actions_1457k_352",nn="_watchBtn_1457k_359",rn="_detailsBtn_1457k_381",on="_navArrow_1457k_402",sn="_prevArrow_1457k_435",ln="_nextArrow_1457k_439",y={bannerContainer:Aa,hero:Ra,ambient:La,ambientShow:$a,scrim:Ma,progressLine:Ba,paused:Pa,dots:xa,dot:Da,dotActive:Ea,viewport:Wa,track:Oa,slide:Fa,slideInner:Va,poster:za,info:Ga,kicker:Ua,featureLabel:qa,scoreChip:Ha,rise:Qa,active:Ya,metaRow:Xa,metaItem:Ka,metaDivider:ja,title:Za,genres:Ja,genreTag:en,summary:tn,actions:an,watchBtn:nn,detailsBtn:rn,navArrow:on,prevArrow:sn,nextArrow:ln},cn=8e3,he=()=>e("div",{className:"skeleton",style:{width:"100vw",maxWidth:"100vw",position:"relative",left:"50%",right:"50%",marginLeft:"-50vw",marginRight:"-50vw",height:"clamp(480px, 72vh, 660px)",marginTop:"calc(-1 * var(--header-height))",marginBottom:"2.5rem"}}),be=({slides:a,posterClassName:o})=>{const[i,t]=D(0),[n,c]=D(0),[s,N]=D(!1),[m,b]=D(null),[v,g]=D(0),[f,r]=D({front:"",back:"",flip:!1}),S=G(0),d=G(0),l=G(new Set),u=G(null),I=G(0),R=x(h=>h.bannerSrc,[]),T=x(()=>{c(h=>h+1)},[]),E=x(h=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null),b(null),T();const w=R(a[h]);r(k=>k.flip?{front:w,back:k.back,flip:!1}:{front:k.front,back:w,flip:!0}),t(h)},[T,a,R]),C=x(h=>{if(a.length===0)return;const w=(h%a.length+a.length)%a.length;l.current.has(R(a[w]))?E(w):b(w)},[a,R,E]);F(()=>{let h=!1;return a.forEach(w=>{const k=R(w);if(!k||l.current.has(k))return;const p=new Image;p.src=k;const O=()=>{h||l.current.has(k)||(l.current.add(k),g(q=>q+1))};p.onload=O,p.onerror=O}),()=>{h=!0}},[a,R]),F(()=>{if(a.length!==0&&!f.front){const h=R(a[0]);r({front:h,back:"",flip:!1})}},[a,f.front,R]),F(()=>{if(m!==null){if(m<0||m>=a.length){b(null);return}l.current.has(R(a[m]))&&E(m)}},[m,v,a,R,E]),F(()=>{if(m===null)return;u.current!==null&&window.clearTimeout(u.current);const h=m;return u.current=window.setTimeout(()=>{u.current=null,E(h)},2500),()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)}},[m,E]);const M=x(h=>{C(h)},[C]),W=x(()=>{C(I.current+1)},[C]),B=x(()=>{C(I.current-1)},[C]),L=G(null);if(F(()=>{const h=L.current;if(!h)return;const w=k=>{if(Math.abs(k.deltaY)>Math.abs(k.deltaX)&&Math.abs(k.deltaY)>5){k.preventDefault(),k.stopPropagation();const p=Date.now();if(p-S.current<300)return;S.current=p,T(),k.deltaY>0?W():B()}};return h.addEventListener("wheel",w,{passive:!1}),()=>h.removeEventListener("wheel",w)},[a.length,W,B,T]),F(()=>{if(a.length===0||s)return;const h=setTimeout(W,cn);return()=>clearTimeout(h)},[i,W,a.length,n,s]),F(()=>{const h=w=>{const k=w.target;k&&(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.tagName==="SELECT"||k.isContentEditable)||(w.key==="ArrowRight"?(w.preventDefault(),W()):w.key==="ArrowLeft"&&(w.preventDefault(),B()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[W,B]),F(()=>{i>=a.length&&t(0)},[a.length,i]),a.length===0)return null;const A=i>=a.length?0:i;I.current=A;const X=h=>{d.current=h.touches[0].clientX},j=h=>{const k=h.changedTouches[0].clientX-d.current;Math.abs(k)>50&&(T(),k>0?B():W())};return e("div",{className:y.bannerContainer,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:e("div",{className:`${y.hero} ${s?y.paused:""}`,onTouchStart:X,onTouchEnd:j,children:[f.front&&e("img",{src:f.front,alt:"","aria-hidden":"true",className:`${y.ambient} ${f.flip?"":y.ambientShow}`}),f.back&&e("img",{src:f.back,alt:"","aria-hidden":"true",className:`${y.ambient} ${f.flip?y.ambientShow:""}`}),e("div",{className:y.scrim,"aria-hidden":"true"}),a.length>1&&e("div",{className:y.progressLine,"aria-hidden":"true"},`progress-${n}-${A}`),a.length>1&&e("div",{className:y.dots,ref:L,role:"tablist","aria-label":"Spotlight slides",children:a.map((h,w)=>e("button",{role:"tab","aria-selected":w===A,"aria-label":`Go to slide ${w+1}: ${h.title}`,className:`${y.dot} ${w===A?y.dotActive:""}`,onClick:()=>M(w),tabIndex:w===A?0:-1},h.key))}),e("div",{className:y.viewport,children:e("div",{className:y.track,style:{transform:`translateX(-${A*100}%)`},children:a.map((h,w)=>e("div",{className:`${y.slide} ${w===A?y.active:""}`,"aria-hidden":w!==A,children:e("div",{className:y.slideInner,children:[e("img",{src:h.posterSrc,alt:h.posterAlt,className:o??y.poster,decoding:"async"}),e("div",{className:y.info,children:[e("div",{className:`${y.kicker} ${y.rise}`,children:[e("span",{className:y.featureLabel,children:"Spotlight"}),h.score!==void 0&&h.score!==null&&h.score!==""&&e("span",{className:y.scoreChip,children:[e(V,{name:"star",size:12}),e("span",{children:h.score})]})]}),e(xe,{to:h.detailTo,className:`${y.title} ${y.rise}`,"aria-label":`View details for ${h.title}`,tabIndex:w===A?0:-1,children:h.title}),h.metaItems.length>0&&e("div",{className:`${y.metaRow} ${y.rise}`,children:h.metaItems.map((k,p)=>e(U.Fragment,{children:[e("span",{className:y.metaItem,children:k}),p<h.metaItems.length-1&&e("div",{className:y.metaDivider})]},p))}),h.tags.length>0&&e("div",{className:`${y.genres} ${y.rise}`,children:h.tags.slice(0,3).map(k=>e("span",{className:y.genreTag,children:k},k))}),h.synopsis&&e("p",{className:`${y.summary} ${y.rise}`,children:h.synopsis}),e("div",{className:`${y.actions} ${y.rise}`,children:[e("button",{className:y.watchBtn,onClick:h.onPrimary,tabIndex:w===A?0:-1,children:[e(V,{name:h.primaryIcon,size:14}),e("span",{children:h.primaryLabel})]}),e("button",{className:y.detailsBtn,onClick:h.onDetails,tabIndex:w===A?0:-1,children:[e(V,{name:"info-circle",size:15}),e("span",{children:"Details"})]})]})]})]})},h.key))})}),a.length>1&&e(ie,{children:[e("button",{className:`${y.navArrow} ${y.prevArrow}`,onClick:()=>{T(),B()},"aria-label":"Previous slide",children:e(V,{name:"chevron-left",size:20})}),e("button",{className:`${y.navArrow} ${y.nextArrow}`,onClick:()=>{T(),W()},"aria-label":"Next slide",children:e(V,{name:"chevron-right",size:20})})]})]})})},dn=({animeList:a})=>{const{titlePreference:o}=We(),i=te(),t=Y(()=>a.slice(0,6).map(n=>{const c=o==="nativeName"?n.nativeName||n.name:o==="englishName"&&n.englishName||n.name;return{key:n._id,bannerSrc:n.bannerImage?ke(n.bannerImage,1280,560):ke(n.thumbnail,1280,450),posterSrc:ke(n.thumbnail,460,650),posterAlt:c,title:c,detailTo:`/anime/${n._id}`,score:n.score,metaItems:[n.type||"Anime",n.status,n.episodeCount?`${n.episodeCount} Episodes`:void 0,n.rating].filter(s=>!!s),tags:(n.genres??[]).slice(0,3).map(s=>typeof s=="string"?s:s?.name).filter(s=>!!s),synopsis:ot(n.description??""),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>i(`/watch/${n._id}`),onDetails:()=>i(`/anime/${n._id}`)}}),[a,o,i]);return e(be,{slides:t})},un="_emptyState_19tmt_1",hn="_emptyStateIcon_19tmt_16",mn="_emptyStateTitle_19tmt_23",pn="_emptyStateText_19tmt_30",me={emptyState:un,emptyStateIcon:hn,emptyStateTitle:mn,emptyStateText:pn},ye=({icon:a,text:o,actionLabel:i,onAction:t,title:n="Nothing is here..."})=>e("div",{className:me.emptyState,children:[e(V,{name:a,size:48,className:me.emptyStateIcon}),e("div",{children:[e("h3",{className:me.emptyStateTitle,children:n}),e("p",{className:me.emptyStateText,children:o})]}),e(Oe,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:i})]}),gn="_select_1dw63_1",vn={select:gn},ge=({value:a,options:o,onChange:i,ariaLabel:t,width:n})=>e("select",{className:vn.select,style:n!==void 0?{width:n}:void 0,value:a,"aria-label":t,onChange:c=>i(c.currentTarget.value),children:o.map(c=>e("option",{value:c.value,children:c.label},c.value))}),_n="_tabBar_irwbm_1",fn="_tabIndicator_irwbm_24",bn="_tabButton_irwbm_38",yn="_tabActive_irwbm_64",pe={tabBar:_n,tabIndicator:fn,tabButton:bn,tabActive:yn};function Nn({options:a,value:o,onChange:i,ariaLabel:t},n){const c=G(null),s=G(new Map),N=G(null),[m,b]=D({left:0,width:0}),v=x((g,f)=>{const r=s.current.get(g),S=c.current;if(r&&S){const d=S.getBoundingClientRect(),l=r.getBoundingClientRect();b({left:l.left-d.left+S.scrollLeft,width:l.width}),f&&r.scrollIntoView({block:"nearest",inline:"nearest"})}},[]);return je(()=>{const g=N.current!==null&&N.current!==o;N.current=o,v(o,g)},[o,a.length,v]),F(()=>{if(v(o,!1),typeof ResizeObserver>"u")return;let g=0;const f=c.current;if(!f)return;const r=new ResizeObserver(()=>{cancelAnimationFrame(g),g=requestAnimationFrame(()=>v(o,!1))});r.observe(f);let S=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{S||v(o,!1)}),()=>{S=!0,cancelAnimationFrame(g),r.disconnect()}},[o,a.length,v]),e("div",{className:pe.tabBar,ref:g=>{c.current=g,typeof n=="function"?n(g):n&&(n.current=g)},"aria-label":t,children:[e("div",{className:pe.tabIndicator,style:{left:m.left,width:m.width}}),a.map(g=>e(Oe,{ref:f=>{f&&s.current.set(g.value,f)},variant:"secondary",size:"sm",className:`${pe.tabButton} ${o===g.value?pe.tabActive:""}`,onClick:()=>i(g.value),children:g.label},g.value))]})}const ve=U.forwardRef(Nn),Tn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}];function kn(){const{options:a}=kt();return Y(()=>a.filter(o=>o.kind==="manga").map(o=>o.value)[0]??"",[a])}const Pe=({title:a,eyebrow:o,provider:i,sort:t,mature:n,headerActions:c})=>{const{toggle:s,bookmarkedIds:N}=Ge(),{popup:m,openPopup:b,scheduleClose:v,cancelClose:g,closePopup:f}=Ve(),{data:r,isLoading:S,fetchNextPage:d,hasNextPage:l,isFetchingNextPage:u}=yt({provider:i,query:"",sort:t,status:"",type:"",rating:n?"safe,suggestive,erotica,pornographic":"safe",mature:n}),I=Y(()=>r?.pages.flatMap(T=>T.items)??[],[r]),R=x(()=>{l&&!u&&!S&&d()},[l,u,S,d]);return i?e(ie,{children:[e(ee,{title:a,eyebrow:o,loading:S,carousel:!0,itemCount:I.length,headerActions:c,onReachThreshold:R,isFetchingNextPage:u,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,children:I.map(T=>{const E=Se(T.provider,T.id);return e(_e,{item:{id:E,title:T.title,...He(T),thumbnail:qe(T.provider,T.cover),typeBadge:T.type||void 0,chapterBadge:T.latestChapter?`Ch. ${T.latestChapter}`:null,isAdult:Ue(T)},linkTo:`/manga/${T.provider}/${encodeURIComponent(T.id)}`,hoverIcon:"info",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:C=>b(C,{provider:T.provider,mangaId:T.id,title:T.title,altTitle:T.altTitle,cover:T.cover,contentRating:T.contentRating,readTarget:`/manga/${T.provider}/${encodeURIComponent(T.id)}`,mature:n}),onPopupHoverIntent:C=>C?g():v(),rawThumbnail:!0},`${T.provider}-${T.id}`)})}),m&&e(ze,{data:m.data,anchorRect:m.rect,bookmarked:N.has(Se(m.data.provider,m.data.mangaId)),onToggleBookmark:()=>s({id:m.data.mangaId,provider:m.data.provider,title:m.data.title,cover:m.data.cover,altTitle:m.data.altTitle??void 0,contentRating:m.data.contentRating}),onMouseEnter:g,onMouseLeave:v,onRequestClose:f})]}):null},Sn=()=>{const a=kn(),{hasConsent:o}=st(),[i,t]=le("manga_discover_tab","latest"),[n,c]=le("manga_trending_sort","popular");return a?e(ie,{children:[e(ve,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:i,onChange:t}),i==="latest"?e(Pe,{title:"Latest Releases",eyebrow:"Fresh chapters",provider:a,sort:"latest",mature:o}):e(Pe,{title:"Trending",eyebrow:"Discover",provider:a,sort:n,mature:o,headerActions:e("select",{className:P["header-select"],value:n,onChange:s=>c(s.currentTarget.value),"aria-label":"Trending sort",children:Tn.map(s=>e("option",{value:s.value,children:s.label},s.value))})})]}):null},wn=()=>{const a=te(),{data:o,isLoading:i}=Nt(24),[t,n]=D(null),{popup:c,openPopup:s,scheduleClose:N,cancelClose:m,closePopup:b}=Ve(),{toggle:v,bookmarkedIds:g}=Ge(),f=o?.data??[];return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{title:"Continue Reading",eyebrow:"Pick up where you left off",titleLink:"/reading-list/Continue Reading",loading:i,carousel:!0,collapsible:!0,defaultExpanded:f.length>0,highlight:!0,itemCount:f.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ye,{icon:"book",text:"You haven't read anything yet. Browse manga and open a chapter to start tracking.",actionLabel:"Browse Manga",onAction:()=>a("/manga")}),children:f.map(r=>{const S=r.page??0,d=r.pageCount??0,l=r.chapterId&&r.provider?`/manga/${r.provider}/${encodeURIComponent(r.mangaId)}/read?chapter=${encodeURIComponent(r.chapterId)}`:r.provider?`/manga/${r.provider}/${encodeURIComponent(r.mangaId)}`:"#";return e(_e,{item:{id:r.id,title:r.title,...He({title:r.title,altTitle:r.altTitle}),thumbnail:r.provider?qe(r.provider,r.cover||""):r.cover||"",chapterBadge:r.chapterNumber?`Ch. ${r.chapterNumber}`:null,isAdult:Ue(r)},linkTo:l,hoverIcon:"book",progress:d>0?{percent:S/d*100,label:`Ch. ${r.chapterNumber} · p. ${S}/${d}`}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>n({libId:r.id,title:r.title}),onOpenDetails:u=>s(u,{provider:r.provider||"",mangaId:r.mangaId||"",title:r.title||"",altTitle:r.altTitle,cover:r.cover||"",contentRating:r.contentRating||void 0,readTarget:l}),onPopupHoverIntent:u=>u?m():N(),rawThumbnail:!0},r.id)})}),e(bt,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>n(null)}),c&&c.data.provider&&e(ze,{data:c.data,anchorRect:c.rect,bookmarked:g.has(Se(c.data.provider,c.data.mangaId)),onToggleBookmark:()=>v({id:c.data.mangaId,provider:c.data.provider,title:c.data.title,cover:c.data.cover,altTitle:c.data.altTitle??void 0,contentRating:c.data.contentRating}),onMouseEnter:m,onMouseLeave:N,onRequestClose:b}),e(Sn,{})]})},Cn="_seasonGrid_bt5c7_76",In="_emptyState_bt5c7_108",H={"section-header":"_section-header_bt5c7_1","title-wrapper":"_title-wrapper_bt5c7_8","pagination-controls":"_pagination-controls_bt5c7_14",seasonGrid:Cn,emptyState:In},An=[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],Rn=[{value:"trending_week",label:"Trending Now"},{value:"trending_day",label:"Trending Today"},{value:"popular",label:"Popular All Time"},{value:"top_rated",label:"Top Rated"}],Ln=()=>{const a=te(),{data:o,isLoading:i}=Ct(24),t=It(),n=At(),[c,s]=D(null),[N,m]=D(!1),[b,v]=D(()=>localStorage.getItem("tv_home_activeTab")||"latest"),[g,f]=D("tv"),[r,S]=D("trending_week"),[d,l]=D("multi"),u=o?.data??[];U.useEffect(()=>{localStorage.setItem("tv_home_activeTab",b)},[b]);const I=r.startsWith("trending_"),R=r==="trending_day"?"day":"week",T={popular:"popularity.desc",top_rated:"vote_average.desc"},{data:E,isLoading:C}=Qe(d==="multi"?"all":d,R,1,I&&b==="trending"),{data:M,isLoading:W}=$e({type:d,sort_by:T[r]||"popularity.desc",page:1}),B=I?E?.results||[]:M?.results||[],L=I?C:W,{data:A,isLoading:X}=$e({type:g,sort_by:"primary_release_date.desc",page:1}),j=A?.results||[],h=()=>{c&&(n.mutate({mediaId:c.libId}),N&&t.mutate(c.libId),s(null),m(!1))},w=x(p=>e(St,{item:{id:p.id,title:p.title,year:p.year,type:p.type,image:p.image,vote_average:p.vote_average,adult:p.adult}},`${p.type}-${p.id}`),[]),k=()=>{switch(b){case"latest":return e("section",{children:[e("div",{className:H["section-header"],children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Fresh picks"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Latest Releases"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:e(ge,{ariaLabel:"Latest type",value:g,onChange:p=>f(p),options:[{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})})]}),X?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((p,O)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},O))}):j.length>0?e(ee,{carousel:!0,itemCount:j.length,children:j.map(w)}):e("div",{className:H.emptyState,children:e("p",{children:"No latest releases available right now."})})]});case"trending":return e("section",{children:[e("div",{className:H["section-header"],children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Discover"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Trending"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(ge,{ariaLabel:"Trending sort",value:r,onChange:S,options:Rn.map(p=>({value:p.value,label:p.label}))}),e(ge,{ariaLabel:"Trending type",value:d,onChange:p=>l(p),options:[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})]})]}),L?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((p,O)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},O))}):B.length>0?e(ee,{carousel:!0,itemCount:B.length,children:B.map(w)}):e("div",{className:H.emptyState,children:e("p",{children:"No trending content available right now."})})]})}};return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/tv-watchlist/Continue Watching",loading:i,carousel:!0,collapsible:!0,defaultExpanded:u.length>0,highlight:!0,itemCount:u.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ye,{icon:"tv",text:"You haven't watched anything yet. Search TV & Movies and start watching to track progress.",actionLabel:"Browse TV & Movies",onAction:()=>a("/tv-search")}),children:u.map(p=>{const O=p.currentTime??0,q=p.duration??0,Z=p.season??p.lastSeason??1,ce=p.episode??p.lastEpisode??1,Q=p.mediaType==="movie",J=Q?"Movie":`S${Z} E${ce}`,ae=p.completed===!0||p.completed===1||q>0&&O>=q*.8,ne=ae?100:q>0&&O>0?O/q*100:0,Ne=ae?"Watched":q>0?Q?`${re(O)} / ${re(q)}`:`${J} · ${re(O)} / ${re(q)}`:J;return e(_e,{item:{id:p.id,title:p.title,thumbnail:p.poster||"",typeBadge:Q?"Movie":"TV",chapterBadge:J,isAdult:Lt({adult:p.adult===1})},linkTo:Rt(p.mediaType,p.tmdbId,Q?void 0:Z,Q?void 0:ce),hoverIcon:"play",progress:(q>0||ae)&&ne>0?{percent:ne,label:Ne}:void 0,showProgress:!0,metaRow:p.year?e("span",{style:{opacity:.75},children:p.year}):void 0,onRemove:()=>s({libId:p.id,title:p.title}),renderPopup:(de,se)=>e(wt,{item:{id:p.tmdbId??0,title:p.title||"",year:p.year||"",type:p.mediaType||"tv",image:p.poster||""},anchorRect:de,onMouseEnter:se.onMouseEnter,onMouseLeave:se.onMouseLeave,onRequestClose:se.close})},p.id)})}),e(ve,{ariaLabel:"Browse TV",options:An,value:b,onChange:v}),e("div",{className:H.tabContent,children:k()}),e(Fe,{isOpen:!!c,itemName:c?.title,progressKind:"watch",listLabel:"my TV watchlist",alsoRemove:N,onAlsoRemoveChange:m,onClose:()=>{s(null),m(!1)},onConfirm:h})]})};function $n(a){const o=a.currentTime??0,i=a.duration??0,t=(a.trackIndex??0)+1;return i>0?`Track ${t} · ${re(o)} / ${re(i)}`:a.trackLabel?`Track ${t} · ${a.trackLabel}`:`Track ${t}`}const Mn=({title:a="Continue Listening",limit:o=24,titleLink:i,showEmptyState:t=!0})=>{const n=te(),{data:c,isLoading:s}=Bt(o),[N,m]=D(null),b=c?.data??[];return e(ie,{children:[e(ee,{title:a,eyebrow:"Pick up where you left off",titleLink:i??"/listening-list/Continue Listening",loading:s,carousel:!0,collapsible:!0,defaultExpanded:b.length>0,highlight:!0,itemCount:b.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"16 / 9"}}),skeletonCount:7,emptyState:t?e(ye,{icon:"headphones",text:"You haven't listened to anything yet. Browse ASMR and play a track to start tracking.",actionLabel:"Browse ASMR",onAction:()=>n("/asmr")}):void 0,children:b.map(v=>{const g=v.currentTime??0,f=v.duration??0,r=v.rjCode||v.id;return e(_e,{item:{id:v.id,title:v.title,thumbnail:v.thumbnail||"",chapterBadge:`Track ${(v.trackIndex??0)+1}`,isAdult:!!v.isAdult},linkTo:`/asmr/${encodeURIComponent(r)}`,hoverIcon:"play",layout:"horizontal",progress:f>0?{percent:Math.min(100,g/f*100),label:$n(v)??""}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>m({workId:v.id,title:v.title}),rawThumbnail:!0},v.id)})}),e(Mt,{workId:N?N.workId:null,title:N?.title,onClose:()=>m(null)})]})},Bn=()=>e("div",{style:{paddingBottom:"2rem"},children:e(Mn,{})}),Pn={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",18:"Drama",10765:"Sci-Fi & Fantasy",9648:"Mystery",28:"Action",12:"Adventure",14:"Fantasy",27:"Horror",878:"Sci-Fi",53:"Thriller",10749:"Romance"},xn=({items:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map(t=>{const n=$t(t.type,t.id);return{key:String(t.id),bannerSrc:t.backdrop?t.backdrop:t.image,posterSrc:t.image,posterAlt:t.title,title:t.title,detailTo:n,score:t.vote_average>0?Number(t.vote_average).toFixed(1):null,metaItems:[t.type==="tv"?"TV Show":"Movie",t.year].filter(Boolean),tags:t.genre_ids.slice(0,3).map(c=>Pn[c]).filter(Boolean),synopsis:t.overview.length>200?t.overview.slice(0,200)+"...":t.overview,primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>o(n),onDetails:()=>o(n)}}),[a,o]);return e(be,{slides:i})},Dn=({mangaList:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map(t=>({key:t.id,bannerSrc:t.cover||"",posterSrc:t.cover,posterAlt:t.title,title:t.title,detailTo:`/manga/mangadex/${t.id}`,metaItems:[t.year?String(t.year):void 0,t.status??void 0].filter(n=>!!n),tags:t.tags.slice(0,3),synopsis:t.description?.slice(0,200)||"",primaryLabel:"Read Now",primaryIcon:"book",onPrimary:()=>o(`/manga/mangadex/${t.id}`),onDetails:()=>o(`/manga/mangadex/${t.id}`)})),[a,o]);return e(be,{slides:i})},En="_posterLandscape_ak7az_1",Wn={posterLandscape:En};function On(a){const o=a.availableEpisodes?.sub;if(typeof o=="number"&&o>0)return o;const i=a.availableEpisodesDetail?.sub,t=a.availableEpisodesDetail?.dub,n=(Array.isArray(i)?i.length:0)+(Array.isArray(t)?t.length:0);return n>0?n:null}const Fn=({works:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map((t,n)=>{const c=Pt(t),s=`/asmr/${encodeURIComponent(c)}`,N=On(t);return{key:c||t._id||String(n),bannerSrc:t.thumbnail||"",posterSrc:t.thumbnail,posterAlt:t.name,title:t.name,detailTo:s,metaItems:[t.rating?t.rating.toUpperCase():void 0,N?`${N} track${N===1?"":"s"}`:void 0].filter(m=>!!m),tags:[],synopsis:t.description?.slice(0,160)||"",primaryLabel:"Listen Now",primaryIcon:"play",onPrimary:()=>o(s),onDetails:()=>o(s)}}),[a,o]);return e(be,{slides:i,posterClassName:Wn.posterLandscape})},Vn=[{value:"anime",label:"Anime"},{value:"manga",label:"Manga"},{value:"tv",label:"TV & Movies"},{value:"asmr",label:"ASMR"}],hr=()=>{const a=Je(),o=lt(),[i,t]=U.useState(1),[n,c]=D(()=>localStorage.getItem("home_activeTab")||"latest"),[s,N]=D(()=>localStorage.getItem("season_format")||"TV"),m=G(null),{data:b}=Le(i+1,s,n==="season"),{titlePreference:v}=We(),{contentType:g,setContentType:f}=it(),[r,S]=U.useState(null),[d,l]=U.useState(!1),u=ct(),{data:I=[]}=dt(),R=ut(),T=ht(),E=mt();F(()=>{document.title="Home - dango"},[]);const{data:C,isLoading:M}=pt();F(()=>{localStorage.setItem("home_activeTab",n)},[n]),F(()=>{localStorage.setItem("season_format",s),t(1)},[s]),F(()=>{C!==void 0&&C.length===0&&n==="week"&&c("latest")},[C,n]);const{data:W,isLoading:B,fetchNextPage:L,hasNextPage:A,isFetchingNextPage:X}=gt(),j=x(()=>{A&&!X&&!B&&L()},[A,X,B,L]),{data:h,isLoading:w}=vt(),{data:k,isLoading:p}=Qe("all","week",1,g==="tv"),{data:O,isLoading:q}=xt(g==="asmr"),{data:Z,isLoading:ce}=Tt(),Q=Y(()=>W?.pages||[],[W]),{data:J,isLoading:ae}=Le(i,s,n==="season"),ne=14,Ne=J&&J.length>=ne&&b&&b.length>0,de=et(o.continueWatching.remove.mutationOptions({onSuccess:async()=>{a.invalidateQueries(o.continueWatching.pathFilter()),await a.invalidateQueries({queryKey:["allContinueWatching"]}),A&&Q.length-1<14&&L()}})),se=x(z=>{const K=Q?.find(Te=>String(Te.id)===String(z));if(K){const Te=K[v]||K.name;S({id:z,name:Te})}},[Q,v]),Ye=x(()=>{r&&(de.mutate({showId:r.id}),d&&u.mutate({id:r.id}),S(null),l(!1))},[r,de,u,d]),Ie=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Ae=C!==void 0&&C.length>0,Xe=Ae?[{key:"week",label:"This Week"},...Ie]:Ie,Re=n==="week"&&!Ae?"latest":n,Ke=()=>{switch(Re){case"latest":return e(oa,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:H["section-header"],ref:m,children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"This season"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Current Season"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(ge,{ariaLabel:"Season format",width:90,value:s,onChange:N,options:[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}]}),e("div",{className:H["pagination-controls"],children:e(tt,{page:i,canGoNext:Ne,onChange:z=>{if(t(z),m.current){const K=m.current.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:K,behavior:"smooth"})}},isLoading:ae})})]})]}),e("div",{className:`grid-container ${H.seasonGrid}`,style:{minHeight:"300px",alignContent:"start"},children:ae?e(De,{count:ne}):J?.slice(0,ne).map(z=>e(oe,{anime:z},z._id))})]});case"popular":return e(aa,{title:"Trending",eyebrow:"Discover"});case"week":return e(Me,{title:"This Week",eyebrow:"Aired this week",animeList:C||[],continueWatching:!1,carousel:!0,loading:M});default:return null}};return e("div",{style:{paddingBottom:"2rem"},children:[g==="anime"&&(w&&!h?.length?e(he,{}):h&&h.length>0&&e(dn,{animeList:h})),g==="tv"&&(p&&!k?.results?.length?e(he,{}):k?.results&&k.results.length>0&&e(xn,{items:k.results})),g==="manga"&&(ce&&!Z?.length?e(he,{}):Z&&Z.length>0&&e(Dn,{mangaList:Z})),g==="asmr"&&(q&&!O?.length?e(he,{}):O&&O.length>0&&e(Fn,{works:O})),e(ve,{ariaLabel:"Content type",options:Vn,value:g,onChange:f}),g==="manga"?e(wn,{}):g==="tv"?e(Ln,{}):g==="asmr"?e(Bn,{}):e(ie,{children:[e(Me,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:Q,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:Q.length>0,onRemove:se,loading:B,onReachThreshold:j,scrollThreshold:.7,isFetchingNextPage:X,emptyState:e(ye,{icon:"history",text:"You haven't watched anything yet. Start exploring and watch something first!",actionLabel:"Explore Trending",onAction:()=>c("popular")})}),e(ft,{title:"Queue",eyebrow:"Up next",items:I,onRemove:z=>R.mutate({showId:z.showId,episodeNumber:z.episodeNumber}),showClearAll:!0,onClear:()=>T.mutate(),onReorder:z=>E.mutate(z.map(K=>({id:K.id,showId:K.showId,episodeNumber:K.episodeNumber})))}),e(ve,{ariaLabel:"Browse anime",options:Xe.map(z=>({value:z.key,label:z.label})),value:Re,onChange:c}),e("div",{className:H.tabContent,children:Ke()}),e(Ia,{eyebrow:"Never miss an episode"}),e(Fe,{isOpen:!!r,itemName:r?.name,progressKind:"watch",listLabel:"my watchlist",alsoRemove:d,onAlsoRemoveChange:l,onClose:()=>{S(null),l(!1)},onConfirm:Ye})]})]})};export{hr as default};
|