@serifpersia/dango 3.7.3 → 3.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +10 -6
  2. package/client/dist/assets/{AnimeCard-BVufFeLC.js → AnimeCard-BxhPLWBG.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-Dihook4h.js → AnimeInfo-DcpKPBLS.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-K0ErjilQ.js → AnimeInfoPage-jKNSPHbX.js} +2 -2
  5. package/client/dist/assets/{Asmr-CP7vVwsh.js → Asmr-DlKBykO-.js} +2 -2
  6. package/client/dist/assets/Asmr-Do89pEHG.css +1 -0
  7. package/client/dist/assets/{AsmrResetProgressModal-cYO4Sr2k.js → AsmrResetProgressModal-DPHPLqPo.js} +1 -1
  8. package/client/dist/assets/{Home-BYuAVKgx.js → Home-D7-FNOmo.js} +1 -1
  9. package/client/dist/assets/{Insights-Bx01GySp.js → Insights-C9HufjGJ.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-BnrEDG8j.js → LibraryListPage-BT_xDjEq.js} +1 -1
  11. package/client/dist/assets/{ListeningList-kRSLAo3B.js → ListeningList-DL1rdCRi.js} +1 -1
  12. package/client/dist/assets/{Manga-COhyMd3K.js → Manga-BfFRq7eK.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-LTEvl_nL.js → MangaInfoPage-wBJjn2FL.js} +1 -1
  14. package/client/dist/assets/{MangaReadPage-sEwzyBQ7.js → MangaReadPage-BAgsRqxt.js} +1 -1
  15. package/client/dist/assets/{MangaResetProgressModal-CbMR36Zu.js → MangaResetProgressModal-Br5zqZ-U.js} +1 -1
  16. package/client/dist/assets/{Mature-CMvs_-gf.js → Mature-MO7ZwJVT.js} +1 -1
  17. package/client/dist/assets/{MatureConsentModal-BnB-RHYQ.js → MatureConsentModal-Beq4JL0b.js} +1 -1
  18. package/client/dist/assets/{MediaCard-B0PJStxp.css → MediaCard-CoyScn-7.css} +1 -1
  19. package/client/dist/assets/MediaCard-lz7FdOe_.js +1 -0
  20. package/client/dist/assets/{OptionListMenu-onM2KK2X.js → OptionListMenu-BSUcso28.js} +1 -1
  21. package/client/dist/assets/Player-CnLC-x2S.js +56 -0
  22. package/client/dist/assets/{PlayerSettings-BfSv-hut.js → PlayerSettings-kqYmlLDl.js} +1 -1
  23. package/client/dist/assets/{QueueOptionsButton-B4Re8F3V.js → QueueOptionsButton-B8xuoYlH.js} +1 -1
  24. package/client/dist/assets/{QueueRail-Dkx_M6ng.js → QueueRail-D1FmM-GR.js} +1 -1
  25. package/client/dist/assets/{ReadingList-C--ZvTe2.js → ReadingList-D8ZiOnWi.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal-BuESoxbY.js → ResetProgressModal-0PvvM2XJ.js} +1 -1
  27. package/client/dist/assets/{Search-CEErwr88.js → Search-D1T-PrGX.js} +1 -1
  28. package/client/dist/assets/Settings-DALBQcFc.js +21 -0
  29. package/client/dist/assets/Settings-DYjRBgpE.css +1 -0
  30. package/client/dist/assets/{SkeletonGrid-QWMGLCGp.js → SkeletonGrid-pA-dcLBM.js} +1 -1
  31. package/client/dist/assets/Trackers-CvO6aWVx.css +1 -0
  32. package/client/dist/assets/Trackers-D68sJf1y.js +2 -0
  33. package/client/dist/assets/{Tv-C6F9655r.js → Tv-DO-WeaMv.js} +1 -1
  34. package/client/dist/assets/{TvInfo-BajXP7JJ.js → TvInfo-CpPIymn8.js} +1 -1
  35. package/client/dist/assets/{TvPopup-DZtX79Ol.js → TvPopup-BwGJ1Tjg.js} +1 -1
  36. package/client/dist/assets/{TvSearch-DcWcxRb1.js → TvSearch-D9SrfJjK.js} +1 -1
  37. package/client/dist/assets/{TvWatchlist-Cf_25dKi.js → TvWatchlist-25tpA8ln.js} +1 -1
  38. package/client/dist/assets/{Watchlist-DBmU8PNR.js → Watchlist-mlZQTcqR.js} +1 -1
  39. package/client/dist/assets/{hls-Bi-DS5KL.js → hls-qvAoYTJt.js} +1 -1
  40. package/client/dist/assets/index-DlcgJVM6.js +178 -0
  41. package/client/dist/assets/{index-B7katXv0.css → index-ZssheiHa.css} +1 -1
  42. package/client/dist/assets/{libraryInvalidation-DI-v-DQ1.js → libraryInvalidation-DdnIPcOQ.js} +1 -1
  43. package/client/dist/assets/{useAnimeInfoData-DpUA78Mv.js → useAnimeInfoData-tcGkDs2b.js} +1 -1
  44. package/client/dist/assets/{useAsmr-BwyYDnlP.js → useAsmr-B-FYJW2L.js} +1 -1
  45. package/client/dist/assets/{useAsmrPopup-BrrEaBlV.js → useAsmrPopup-Ct9jC6X6.js} +1 -1
  46. package/client/dist/assets/{useMangaLibrary-BAUaug-u.js → useMangaLibrary-BacTdrw2.js} +1 -1
  47. package/client/dist/assets/{useMangaPopup-3Lx5tEub.js → useMangaPopup-B_wRaMyP.js} +1 -1
  48. package/client/dist/assets/usePlaybackEnd-DLFOYx3Q.css +1 -0
  49. package/client/dist/assets/{usePlaybackEnd-CuDnNZ8o.js → usePlaybackEnd-DuEfjKb8.js} +2 -2
  50. package/client/dist/assets/{useProviders-CKqOSX5-.js → useProviders-D0XOHCsj.js} +1 -1
  51. package/client/dist/assets/{useTv-CZB47zUF.js → useTv-IidbSQU4.js} +1 -1
  52. package/client/dist/assets/{useTvLibrary-BGz7Unv_.js → useTvLibrary-DiCSdUOj.js} +1 -1
  53. package/client/dist/index.html +2 -2
  54. package/package.json +2 -2
  55. package/server/dist/server.js +251 -246
  56. package/server/dist/shipped-defaults.js +1 -1
  57. package/server/package.json +1 -1
  58. package/client/dist/assets/Asmr-Dl1EZqaI.css +0 -1
  59. package/client/dist/assets/MediaCard-hWGCEHWx.js +0 -1
  60. package/client/dist/assets/Player-2YKevlG4.js +0 -56
  61. package/client/dist/assets/Settings-BEHII_8K.css +0 -1
  62. package/client/dist/assets/Settings-C-QEEujv.js +0 -21
  63. package/client/dist/assets/Trackers-1i4Hd5D3.js +0 -2
  64. package/client/dist/assets/Trackers-D5XBOCDp.css +0 -1
  65. package/client/dist/assets/index-DB81Su4I.js +0 -178
  66. package/client/dist/assets/usePlaybackEnd-BtUHM1mW.css +0 -1
@@ -1 +1 @@
1
- import{d as E,A as q,h as O,q as P,g as G,u as e,L as Ee,T as Q,S as se,a as J,_ as je}from"./vendor-core-DfaOB3Rn.js";import{b as Ze,u as Je,a as et}from"./vendor-query-BBT5_sHx.js";import{M as me,P as tt}from"./MediaCard-hWGCEHWx.js";import{A as le}from"./AnimeCard-BVufFeLC.js";import{S as De,A as We}from"./SkeletonGrid-QWMGLCGp.js";import{I as V}from"./vendor-icons-DrybRNxP.js";import{u as Se,a as oe,b as at,c as nt,q as Oe,t as rt,d as Ve,s as ot,f as Te,B as Fe,e as st,g as ne,h as we,i as lt,j as Le,k as it,l as ct,m as dt,n as ut,o as ht,p as pt,r as mt,v as gt,w as vt}from"./index-DB81Su4I.js";import{u as _t}from"./vendor-ui-3qrARCPr.js";import{E as ke}from"./ErrorMessage-DAxegITP.js";import{R as qe}from"./ResetProgressModal-BuESoxbY.js";import{Q as ft}from"./QueueRail-Dkx_M6ng.js";import{u as ze,M as Ge}from"./useMangaPopup-3Lx5tEub.js";import{M as bt}from"./MangaResetProgressModal-CbMR36Zu.js";import{u as Ue,a as yt,m as Ne,i as Qe,b as Ce,c as Ye,d as Tt,e as Nt}from"./useMangaLibrary-BAUaug-u.js";import{u as St}from"./useProviders-CKqOSX5-.js";import{u as He,a as $e,T as wt}from"./useTv-CZB47zUF.js";import{T as kt}from"./TvPopup-DZtX79Ol.js";import{u as Ct,a as It,b as At,t as Rt,i as Lt,c as $t,M as Mt,T as xt}from"./useTvLibrary-BGz7Unv_.js";import{A as Bt}from"./AsmrResetProgressModal-cYO4Sr2k.js";import{u as Pt,a as Et,b as Dt}from"./useAsmr-BwyYDnlP.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BnB-RHYQ.js";import"./useAnimeInfoData-DpUA78Mv.js";import"./QueueOptionsButton-B4Re8F3V.js";import"./playbackCompletion-IPHm9fp5.js";import"./usePopup-DS9jMzp6.js";import"./libraryInvalidation-DI-v-DQ1.js";const Wt="_sectionWrapper_2p2l1_9",Ot="_sectionTitleNoMargin_2p2l1_13",Vt="_carousel_2p2l1_178",B={"section-header":"_section-header_2p2l1_1",sectionWrapper:Wt,sectionTitleNoMargin:Ot,"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:Vt,"carousel-inner":"_carousel-inner_2p2l1_187","carousel-card":"_carousel-card_2p2l1_192"};function ge({align:n="start",containScroll:s="trimSnaps",scrollFraction:h=.8,threshold:t=.6,onReachThreshold:o}={}){const[l,i]=_t({align:n,containScroll:s,dragFree:!0}),[d,T]=E(!1),_=q({scrollFraction:h,threshold:t,onReachThreshold:o}),m=q(!1);O(()=>{_.current={scrollFraction:h,threshold:t,onReachThreshold:o}});const p=P(u=>{T(u.canScrollPrev()||u.canScrollNext())},[]);O(()=>{if(!i)return;const u=()=>{const c=i.scrollProgress();c>=_.current.threshold&&!m.current?(m.current=!0,_.current.onReachThreshold?.()):c<_.current.threshold&&(m.current=!1),p(i)};return i.on("init",u),i.on("reInit",u),i.on("scroll",u),i.on("resize",u),()=>{i.off("init",u),i.off("reInit",u),i.off("scroll",u),i.off("resize",u)}},[i,p]);const N=P(u=>{const c=u.containerNode().firstElementChild;if(!c)return 1;const g=u.rootNode().getBoundingClientRect().width,k=c.getBoundingClientRect().width;return k?Math.max(1,Math.round(g/k)):1},[]),r=P((u,c=!1)=>{if(!i)return;const g=Math.max(1,Math.round(N(i)*_.current.scrollFraction)),k=i.selectedScrollSnap()+(u==="left"?-g:g);i.scrollTo(k,c)},[i,N]),w=P((u=!1)=>{i?.scrollTo(0,u)},[i]);return{emblaRef:l,api:i,canScroll:d,stepBy:r,scrollToStart:w}}const Z=({title:n,eyebrow:s,titleLink:h,loading:t,emptyState:o,carousel:l,layout:i,collapsible:d,defaultExpanded:T=!0,onReachThreshold:_,scrollThreshold:m,isFetchingNextPage:p,resetScrollOnShrink:N,itemCount:r=0,highlight:w,headerActions:u,loadingSkeleton:c,skeletonCount:g=7,children:k})=>{const{lowEndMode:S}=Se(),{emblaRef:A,stepBy:$,scrollToStart:R}=ge({onReachThreshold:_,threshold:m}),[C,U]=G.useState(T);G.useEffect(()=>{U(T)},[T]);const x=G.useRef(0);return G.useEffect(()=>{N&&r>0&&C&&(r<=x.current||x.current===0)&&R(),r>0&&(x.current=r)},[r,N,C,R]),!t&&r===0&&!o&&!d?null:e("section",{className:`${B.sectionWrapper} ${w?B["continue-watching"]:""}`,children:[e("div",{className:B["section-header"],children:[e("div",{className:B["title-wrapper"],children:[e("div",{className:"title-stack",children:[s&&e("div",{className:"section-eyebrow",children:s}),h?e(Ee,{to:h,className:B["title-link"],children:e("div",{className:`section-title ${B.sectionTitleNoMargin}`,children:n})}):e("div",{className:`section-title ${B.sectionTitleNoMargin}`,children:n})]}),l&&r>0&&C&&e("div",{className:B["nav-arrows"],children:[e("button",{className:B["nav-button"],type:"button","aria-label":"Scroll left",onClick:I=>{I.preventDefault(),$("left",S)},children:e(V,{name:"chevron-left"})}),e("button",{className:B["nav-button"],type:"button","aria-label":"Scroll right",onClick:I=>{I.preventDefault(),$("right",S)},children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:B["header-controls"],children:[u,d&&e("button",{className:B["collapse-button"],type:"button",onClick:()=>U(I=>!I),"aria-expanded":C,"aria-label":C?`Collapse ${n}`:`Expand ${n}`,children:C?e(V,{name:"chevron-up"}):e(V,{name:"chevron-down"})})]})]}),C&&(l?!t&&r===0&&o?e("div",{children:o}):e("div",{className:B["carousel-container"],children:e("div",{className:B.carousel,ref:A,children:e("div",{className:B["carousel-inner"],children:[t&&r===0?Array.from({length:g}).map((I,F)=>e("div",{className:B["carousel-card"],children:c},F)):G.Children.map(k,(I,F)=>e("div",{className:B["carousel-card"],children:I},G.isValidElement(I)&&I.key!=null?I.key:`slide-${F}`)),p&&c&&e("div",{className:B["carousel-card"],children:c})]})})}):e("div",{className:"grid-container",children:t&&r===0?e(De,{count:6,layout:i}):r>0?k:t?null:e("div",{style:{gridColumn:"1 / -1"},children:o})}))]})},Ft=({title:n,eyebrow:s,animeList:h,continueWatching:t,titleLink:o,onRemove:l,loading:i,emptyState:d,carousel:T,cardConfig:_,layout:m,onReachThreshold:p,scrollThreshold:N,isFetchingNextPage:r,collapsible:w,defaultExpanded:u=!0})=>{const c=m||"vertical";return e(Z,{title:n,eyebrow:s,titleLink:o,loading:i,emptyState:d,carousel:T,layout:c,collapsible:w,defaultExpanded:u,onReachThreshold:p,scrollThreshold:N,isFetchingNextPage:r,resetScrollOnShrink:t,highlight:t,itemCount:h.length,loadingSkeleton:e(We,{layout:c}),skeletonCount:7,children:h.map(g=>e(le,{anime:g,continueWatching:t,onRemove:l,config:_,layout:c},g._id))})},Me=G.memo(Ft),qt="_sectionWrapper_xt8h9_2",zt="_sectionTitleNoMargin_xt8h9_6",Gt="_timeSelect_xt8h9_80",Ut="_carouselContainer_xt8h9_111",Qt="_carousel_xt8h9_111",Yt="_carouselInner_xt8h9_122",Ht="_carouselItem_xt8h9_127",Xt="_rankCard_xt8h9_164",Kt="_rankPill_xt8h9_168",jt="_rankGold_xt8h9_179",Zt="_rankSilver_xt8h9_183",Jt="_rankBronze_xt8h9_187",ea="_skeletonPoster_xt8h9_198",ta="_skeletonText_xt8h9_199",v={sectionWrapper:qt,sectionTitleNoMargin:zt,"section-header":"_section-header_xt8h9_10","title-wrapper":"_title-wrapper_xt8h9_18","nav-arrows":"_nav-arrows_xt8h9_40","nav-button":"_nav-button_xt8h9_49",timeSelect:Gt,carouselContainer:Ut,carousel:Qt,carouselInner:Yt,carouselItem:Ht,rankCard:Xt,rankPill:Kt,rankGold:jt,rankSilver:Zt,rankBronze:Jt,skeletonPoster:ea,skeletonText:ta,"header-actions":"_header-actions_xt8h9_236"},xe="TRENDING_DESC",aa="POPULARITY_DESC",na=10;function ra({title:n,eyebrow:s}){const{lowEndMode:h}=Se(),[t,o]=oe("trending_sort",xe),l=[{value:xe,label:"Trending"},{value:aa,label:"All Time"}],{data:i,fetchNextPage:d,hasNextPage:T,isFetchingNextPage:_,isLoading:m,isError:p,error:N}=at(t,na),r=Q(()=>i?.pages.flatMap(g=>g)||[],[i]),w=P(()=>{T&&!_&&!m&&d()},[T,_,m,d]),{emblaRef:u,stepBy:c}=ge({onReachThreshold:w});return e("section",{className:v.sectionWrapper,children:[e("div",{className:v["section-header"],children:[e("div",{className:v["title-wrapper"],children:[e("div",{className:"title-stack",children:[s&&e("div",{className:"section-eyebrow",children:s}),e("div",{className:`section-title ${v.sectionTitleNoMargin}`,children:n})]}),e("div",{className:v["nav-arrows"],children:[e("button",{className:v["nav-button"],type:"button",onClick:g=>{g.preventDefault(),c("left",h)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:v["nav-button"],type:"button",onClick:g=>{g.preventDefault(),c("right",h)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:v["header-actions"],children:e("select",{className:v.timeSelect,value:t,onChange:g=>o(g.currentTarget.value),children:l.map(g=>e("option",{value:g.value,children:g.label},g.value))})})]}),m?e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,children:e("div",{className:v.carouselInner,children:Array.from({length:7}).map((g,k)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.skeletonPoster}),e("div",{className:v.skeletonText})]},k))})})}):p?e(ke,{message:N instanceof Error?N.message:"An unknown error occurred"}):e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,ref:u,children:e("div",{className:v.carouselInner,children:[r.map((g,k)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.rankCard,children:e(le,{anime:g})}),e("div",{className:`${v.rankPill} ${k===0?v.rankGold:k===1?v.rankSilver:k===2?v.rankBronze:""}`,children:k+1})]},g._id)),_&&e("div",{className:v.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:v.skeletonPoster})})]})})})]})}const oa=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}],sa=10;function la({eyebrow:n}){const{lowEndMode:s}=Se(),[h,t]=oe("latest_releases_format","TV"),{data:o,fetchNextPage:l,hasNextPage:i,isFetchingNextPage:d,isLoading:T,isError:_,error:m}=nt(h,sa),p=Q(()=>o?.pages.flatMap(u=>u)||[],[o]),N=P(()=>{i&&!d&&!T&&l()},[i,d,T,l]),{emblaRef:r,stepBy:w}=ge({onReachThreshold:N});return e("section",{className:v.sectionWrapper,children:[e("div",{className:v["section-header"],children:[e("div",{className:v["title-wrapper"],children:[e("div",{className:"title-stack",children:[n&&e("div",{className:"section-eyebrow",children:n}),e("div",{className:`section-title ${v.sectionTitleNoMargin}`,children:"Latest Releases"})]}),e("div",{className:v["nav-arrows"],children:[e("button",{className:v["nav-button"],type:"button",onClick:u=>{u.preventDefault(),w("left",s)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:v["nav-button"],type:"button",onClick:u=>{u.preventDefault(),w("right",s)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:v["header-actions"],children:e("select",{className:v.timeSelect,value:h,onChange:u=>t(u.currentTarget.value),children:oa.map(u=>e("option",{value:u.value,children:u.label},u.value))})})]}),T?e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,children:e("div",{className:v.carouselInner,children:Array.from({length:7}).map((u,c)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.skeletonPoster}),e("div",{className:v.skeletonText})]},c))})})}):_?e(ke,{message:m instanceof Error?m.message:"An unknown error occurred"}):e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,ref:r,children:e("div",{className:v.carouselInner,children:[p.map(u=>e("div",{className:v.carouselItem,children:e(le,{anime:u})},u._id)),d&&e("div",{className:v.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:v.skeletonPoster})})]})})})]})}const ia="_scheduleSection_10dfe_1",ca="_sectionTitleRow_10dfe_5",da="_sectionTitleNoMargin_10dfe_11",ua="_sectionHeader_10dfe_15",ha="_headerActions_10dfe_25",pa="_timeSelect_10dfe_31",ma="_daySelectorContainer_10dfe_62",ga="_daySelector_10dfe_62",va="_daySelectorInner_10dfe_79",_a="_dayBtn_10dfe_90",fa="_active_10dfe_113",ba="_dayMonth_10dfe_121",ya="_dayNum_10dfe_129",Ta="_dayName_10dfe_135",Na="_navArrows_10dfe_148",Sa="_navButton_10dfe_157",wa="_carouselContainer_10dfe_181",ka="_carousel_10dfe_181",Ca="_carouselInner_10dfe_193",Ia="_carouselCard_10dfe_198",L={scheduleSection:ia,sectionTitleRow:ca,sectionTitleNoMargin:da,sectionHeader:ua,headerActions:ha,timeSelect:pa,daySelectorContainer:ma,daySelector:ga,daySelectorInner:va,dayBtn:_a,active:fa,dayMonth:ba,dayNum:ya,dayName:Ta,navArrows:Na,navButton:Sa,carouselContainer:wa,carousel:ka,carouselInner:Ca,carouselCard:Ia},ie=n=>{const s=n.getFullYear(),h=String(n.getMonth()+1).padStart(2,"0"),t=String(n.getDate()).padStart(2,"0");return`${s}-${h}-${t}`},Aa=async(n,s)=>await rt.data.schedule.query({date:n,format:s}),Ra=({eyebrow:n})=>{const[s,h]=E(()=>ie(new Date)),[t,o]=oe("schedule_format","TV"),{emblaRef:l,canScroll:i,stepBy:d,scrollToStart:T}=ge(),_=q(null),m=q(!0),{data:p=[],isLoading:N,error:r}=Ze({queryKey:[Oe.schedule,s,t],queryFn:()=>Aa(s,t),staleTime:1e3*60*5}),w=Q(()=>{const c=[],g=new Date,k=ie(g),S=new Date(g);S.setDate(g.getDate()-1);const A=ie(S),$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(let R=-6;R<=6;R++){const C=new Date(g);C.setDate(g.getDate()+R),c.push(C)}return c.map(R=>{const C=ie(R),I=C===k?"Today":C===A?"Yest":$[R.getDay()],F=R.getDate(),M=new Intl.DateTimeFormat("en-US",{month:"short"}).format(R);return{dateString:C,dayLabel:I,dayNum:F,monthName:M}})},[]);O(()=>{if(m.current){m.current=!1;return}if(_.current){const c=_.current.querySelector(`[data-date="${s}"]`);c&&c.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[s]),O(()=>{T(!0)},[s,T]);const u=[{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:L.scheduleSection,children:[e("div",{className:L.sectionHeader,children:[e("div",{className:L.sectionTitleRow,children:[e("div",{className:"title-stack",children:[n&&e("div",{className:"section-eyebrow",children:n}),e("h2",{className:`section-title ${L.sectionTitleNoMargin}`,children:"Episode Schedule"})]}),p.length>0&&i&&e("div",{className:L.navArrows,children:[e("button",{className:L.navButton,onClick:()=>d("left"),"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:L.navButton,onClick:()=>d("right"),"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:L.headerActions,children:e("select",{className:L.timeSelect,value:t,onChange:c=>o(c.currentTarget.value),children:u.map(c=>e("option",{value:c.value,children:c.label},c.value))})})]}),e("div",{className:L.daySelectorContainer,children:e("div",{className:L.daySelector,ref:_,children:e("div",{className:L.daySelectorInner,children:w.map(c=>e("button",{type:"button","data-date":c.dateString,className:`${L.dayBtn} ${s===c.dateString?L.active:""}`,onClick:()=>h(c.dateString),children:[e("span",{className:L.dayMonth,children:c.monthName}),e("span",{className:L.dayNum,children:c.dayNum}),e("span",{className:L.dayName,children:c.dayLabel})]},c.dateString))})})}),e("div",{className:L.carouselContainer,children:e("div",{className:L.carousel,ref:l,children:e("div",{className:L.carouselInner,children:N?Array.from({length:7}).map((c,g)=>e("div",{className:L.carouselCard,children:e(We,{layout:"vertical"})},g)):r?e("div",{style:{width:"100%"},children:e(ke,{message:r instanceof Error?r.message:"An unknown error occurred"})}):p.length===0?e("p",{style:{textAlign:"center",marginTop:"1rem",width:"100%"},children:"No episodes scheduled for this day."}):p.map(c=>e("div",{className:L.carouselCard,children:e(le,{anime:c,continueWatching:!1,layout:"vertical"},c._id)},c._id))})})})]})},La="_bannerContainer_1l49p_1",$a="_hero_1l49p_28",Ma="_ambient_1l49p_37",xa="_ambientShow_1l49p_49",Ba="_scrim_1l49p_53",Pa="_progressLine_1l49p_69",Ea="_paused_1l49p_89",Da="_dots_1l49p_103",Wa="_dot_1l49p_103",Oa="_dotActive_1l49p_126",Va="_viewport_1l49p_137",Fa="_track_1l49p_144",qa="_slide_1l49p_150",za="_slideInner_1l49p_158",Ga="_poster_1l49p_168",Ua="_posterLandscape_1l49p_179",Qa="_info_1l49p_203",Ya="_kicker_1l49p_208",Ha="_featureLabel_1l49p_215",Xa="_scoreChip_1l49p_227",Ka="_rise_1l49p_245",ja="_active_1l49p_249",Za="_metaRow_1l49p_305",Ja="_metaItem_1l49p_316",en="_metaDivider_1l49p_322",tn="_title_1l49p_329",an="_genres_1l49p_345",nn="_genreTag_1l49p_353",rn="_summary_1l49p_364",on="_actions_1l49p_376",sn="_watchBtn_1l49p_383",ln="_detailsBtn_1l49p_405",cn="_navArrow_1l49p_426",dn="_prevArrow_1l49p_459",un="_nextArrow_1l49p_463",b={bannerContainer:La,hero:$a,ambient:Ma,ambientShow:xa,scrim:Ba,progressLine:Pa,paused:Ea,dots:Da,dot:Wa,dotActive:Oa,viewport:Va,track:Fa,slide:qa,slideInner:za,poster:Ga,posterLandscape:Ua,info:Qa,kicker:Ya,featureLabel:Ha,scoreChip:Xa,rise:Ka,active:ja,metaRow:Za,metaItem:Ja,metaDivider:en,title:tn,genres:an,genreTag:nn,summary:rn,actions:on,watchBtn:sn,detailsBtn:ln,navArrow:cn,prevArrow:dn,nextArrow:un},hn=8e3,ce=()=>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"}}),ve=({slides:n,posterAspect:s="portrait",eyebrow:h="Spotlight"})=>{const[t,o]=E(0),[l,i]=E(0),[d,T]=E(!1),[_,m]=E(null),[p,N]=E(0),[r,w]=E({front:"",back:"",flip:!1}),u=q(0),c=q(0),g=q(new Set),k=q(null),S=q(0),A=P(a=>a.bannerSrc,[]),$=P(()=>{i(a=>a+1)},[]),R=P(a=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null),m(null),$();const f=A(n[a]);w(y=>y.flip?{front:f,back:y.back,flip:!1}:{front:y.front,back:f,flip:!0}),o(a)},[$,n,A]),C=P(a=>{if(n.length===0)return;const f=(a%n.length+n.length)%n.length;g.current.has(A(n[f]))?R(f):m(f)},[n,A,R]);O(()=>{let a=!1;return n.forEach(f=>{const y=A(f);if(!y||g.current.has(y))return;const D=new Image;D.src=y;const K=()=>{a||g.current.has(y)||(g.current.add(y),N(z=>z+1))};D.onload=K,D.onerror=K}),()=>{a=!0}},[n,A]),O(()=>{if(n.length!==0&&!r.front){const a=A(n[0]);w({front:a,back:"",flip:!1})}},[n,r.front,A]),O(()=>{if(_!==null){if(_<0||_>=n.length){m(null);return}g.current.has(A(n[_]))&&R(_)}},[_,p,n,A,R]),O(()=>{if(_===null)return;k.current!==null&&window.clearTimeout(k.current);const a=_;return k.current=window.setTimeout(()=>{k.current=null,R(a)},2500),()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)}},[_,R]);const U=P(a=>{C(a)},[C]),x=P(()=>{C(S.current+1)},[C]),I=P(()=>{C(S.current-1)},[C]),F=q(null);if(O(()=>{const a=F.current;if(!a)return;const f=y=>{if(Math.abs(y.deltaY)>Math.abs(y.deltaX)&&Math.abs(y.deltaY)>5){y.preventDefault(),y.stopPropagation();const D=Date.now();if(D-u.current<300)return;u.current=D,$(),y.deltaY>0?x():I()}};return a.addEventListener("wheel",f,{passive:!1}),()=>a.removeEventListener("wheel",f)},[n.length,x,I,$]),O(()=>{if(n.length===0||d)return;const a=setTimeout(x,hn);return()=>clearTimeout(a)},[t,x,n.length,l,d]),O(()=>{const a=f=>{const y=f.target;y&&(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.tagName==="SELECT"||y.isContentEditable)||(f.key==="ArrowRight"?(f.preventDefault(),x()):f.key==="ArrowLeft"&&(f.preventDefault(),I()))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[x,I]),O(()=>{t>=n.length&&o(0)},[n.length,t]),n.length===0)return null;const M=t>=n.length?0:t;S.current=M;const ee=a=>{c.current=a.touches[0].clientX},H=a=>{const y=a.changedTouches[0].clientX-c.current;Math.abs(y)>50&&($(),y>0?I():x())};return e("div",{className:b.bannerContainer,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:e("div",{className:`${b.hero} ${d?b.paused:""}`,onTouchStart:ee,onTouchEnd:H,children:[r.front&&e("img",{src:r.front,alt:"","aria-hidden":"true",className:`${b.ambient} ${r.flip?"":b.ambientShow}`}),r.back&&e("img",{src:r.back,alt:"","aria-hidden":"true",className:`${b.ambient} ${r.flip?b.ambientShow:""}`}),e("div",{className:b.scrim,"aria-hidden":"true"}),n.length>1&&e("div",{className:b.progressLine,"aria-hidden":"true"},`progress-${l}-${M}`),n.length>1&&e("div",{className:b.dots,ref:F,role:"tablist","aria-label":"Spotlight slides",children:n.map((a,f)=>e("button",{role:"tab","aria-selected":f===M,"aria-label":`Go to slide ${f+1}: ${a.title}`,className:`${b.dot} ${f===M?b.dotActive:""}`,onClick:()=>U(f),tabIndex:f===M?0:-1},a.key))}),e("div",{className:b.viewport,children:e("div",{className:b.track,style:{transform:`translateX(-${M*100}%)`},children:n.map((a,f)=>e("div",{className:`${b.slide} ${f===M?b.active:""}`,"aria-hidden":f!==M,children:e("div",{className:b.slideInner,children:[e("img",{src:a.posterSrc,alt:a.posterAlt,className:s==="landscape"?b.posterLandscape:b.poster,decoding:"async"}),e("div",{className:b.info,children:[e("div",{className:`${b.kicker} ${b.rise}`,children:[e("span",{className:b.featureLabel,children:h}),a.score!==void 0&&a.score!==null&&a.score!==""&&e("span",{className:b.scoreChip,children:[e(V,{name:"star",size:12}),e("span",{children:a.score})]})]}),e(Ee,{to:a.detailTo,className:`${b.title} ${b.rise}`,"aria-label":`View details for ${a.title}`,tabIndex:f===M?0:-1,children:a.title}),a.metaItems.length>0&&e("div",{className:`${b.metaRow} ${b.rise}`,children:a.metaItems.map((y,D)=>e(G.Fragment,{children:[e("span",{className:b.metaItem,children:y}),D<a.metaItems.length-1&&e("div",{className:b.metaDivider})]},D))}),a.tags.length>0&&e("div",{className:`${b.genres} ${b.rise}`,children:a.tags.slice(0,3).map(y=>e("span",{className:b.genreTag,children:y},y))}),a.synopsis&&e("p",{className:`${b.summary} ${b.rise}`,children:a.synopsis}),e("div",{className:`${b.actions} ${b.rise}`,children:[e("button",{className:b.watchBtn,onClick:a.onPrimary,tabIndex:f===M?0:-1,children:[e(V,{name:a.primaryIcon,size:14}),e("span",{children:a.primaryLabel})]}),e("button",{className:b.detailsBtn,onClick:a.onDetails,tabIndex:f===M?0:-1,children:[e(V,{name:"info-circle",size:15}),e("span",{children:"Details"})]})]})]})]})},a.key))})}),n.length>1&&e(se,{children:[e("button",{className:`${b.navArrow} ${b.prevArrow}`,onClick:()=>{$(),I()},"aria-label":"Previous slide",children:e(V,{name:"chevron-left",size:20})}),e("button",{className:`${b.navArrow} ${b.nextArrow}`,onClick:()=>{$(),x()},"aria-label":"Next slide",children:e(V,{name:"chevron-right",size:20})})]})]})})},pn=({animeList:n})=>{const{titlePreference:s}=Ve(),h=J(),t=Q(()=>n.slice(0,6).map(o=>{const l=s==="nativeName"?o.nativeName||o.name:s==="englishName"&&o.englishName||o.name;return{key:o._id,bannerSrc:o.bannerImage?Te(o.bannerImage,1280,560):Te(o.thumbnail,1280,450),posterSrc:Te(o.thumbnail,460,650),posterAlt:l,title:l,detailTo:`/anime/${o._id}`,score:o.score,metaItems:[o.type||"Anime",o.status,o.episodeCount?`${o.episodeCount} Episodes`:void 0,o.rating].filter(i=>!!i),tags:(o.genres??[]).slice(0,3).map(i=>typeof i=="string"?i:i?.name).filter(i=>!!i),synopsis:ot(o.description??""),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>h(`/watch/${o._id}`),onDetails:()=>h(`/anime/${o._id}`)}}),[n,s,h]);return e(ve,{slides:t})},mn="_emptyState_19tmt_1",gn="_emptyStateIcon_19tmt_16",vn="_emptyStateTitle_19tmt_23",_n="_emptyStateText_19tmt_30",de={emptyState:mn,emptyStateIcon:gn,emptyStateTitle:vn,emptyStateText:_n},_e=({icon:n,text:s,actionLabel:h,onAction:t,title:o="Nothing is here..."})=>e("div",{className:de.emptyState,children:[e(V,{name:n,size:48,className:de.emptyStateIcon}),e("div",{children:[e("h3",{className:de.emptyStateTitle,children:o}),e("p",{className:de.emptyStateText,children:s})]}),e(Fe,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:h})]}),fn="_select_1dw63_1",bn={select:fn},he=({value:n,options:s,onChange:h,ariaLabel:t,width:o})=>e("select",{className:bn.select,style:o!==void 0?{width:o}:void 0,value:n,"aria-label":t,onChange:l=>h(l.currentTarget.value),children:s.map(l=>e("option",{value:l.value,children:l.label},l.value))}),yn="_tabBar_irwbm_1",Tn="_tabIndicator_irwbm_24",Nn="_tabButton_irwbm_38",Sn="_tabActive_irwbm_64",ue={tabBar:yn,tabIndicator:Tn,tabButton:Nn,tabActive:Sn};function wn({options:n,value:s,onChange:h,ariaLabel:t},o){const l=q(null),i=q(new Map),d=q(null),[T,_]=E({left:0,width:0}),m=P((p,N)=>{const r=i.current.get(p),w=l.current;if(r&&w){const u=w.getBoundingClientRect(),c=r.getBoundingClientRect();_({left:c.left-u.left+w.scrollLeft,width:c.width}),N&&r.scrollIntoView({block:"nearest",inline:"nearest"})}},[]);return je(()=>{const p=d.current!==null&&d.current!==s;d.current=s,m(s,p)},[s,n.length,m]),O(()=>{if(m(s,!1),typeof ResizeObserver>"u")return;let p=0;const N=l.current;if(!N)return;const r=new ResizeObserver(()=>{cancelAnimationFrame(p),p=requestAnimationFrame(()=>m(s,!1))});r.observe(N);let w=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{w||m(s,!1)}),()=>{w=!0,cancelAnimationFrame(p),r.disconnect()}},[s,n.length,m]),e("div",{className:ue.tabBar,ref:p=>{l.current=p,typeof o=="function"?o(p):o&&(o.current=p)},"aria-label":t,children:[e("div",{className:ue.tabIndicator,style:{left:T.left,width:T.width}}),n.map(p=>e(Fe,{ref:N=>{N&&i.current.set(p.value,N)},variant:"secondary",size:"sm",className:`${ue.tabButton} ${s===p.value?ue.tabActive:""}`,onClick:()=>h(p.value),children:p.label},p.value))]})}const pe=G.forwardRef(wn),kn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}],Be=({title:n,eyebrow:s,sort:h,mature:t,headerActions:o})=>{const{toggle:l,bookmarkedIds:i}=Ue(),{popup:d,openPopup:T,scheduleClose:_,cancelClose:m,closePopup:p}=ze(),{data:N,isLoading:r,fetchNextPage:w,hasNextPage:u,isFetchingNextPage:c}=yt({provider:"",query:"",sort:h,status:"",type:"",rating:t?"safe,suggestive,erotica,pornographic":"safe",mature:t}),g=Q(()=>N?.pages.flatMap(S=>S.items)??[],[N]),k=P(()=>{u&&!c&&!r&&w()},[u,c,r,w]);return e(se,{children:[e(Z,{title:n,eyebrow:s,loading:r,carousel:!0,itemCount:g.length,headerActions:o,onReachThreshold:k,isFetchingNextPage:c,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,children:g.map(S=>{const A=Ne(S.provider,S.id);return e(me,{item:{id:A,title:S.title,...Ye(S),thumbnail:Ce(S.provider,S.cover),typeBadge:S.type||void 0,chapterBadge:S.latestChapter?`Ch. ${S.latestChapter}`:null,isAdult:Qe(S)},linkTo:`/manga/${S.provider}/${encodeURIComponent(S.id)}`,hoverIcon:"info",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:$=>T($,{provider:S.provider,mangaId:S.id,title:S.title,altTitle:S.altTitle,cover:S.cover,contentRating:S.contentRating,readTarget:`/manga/${S.provider}/${encodeURIComponent(S.id)}`,mature:t}),onPopupHoverIntent:$=>$?m():_(),rawThumbnail:!0},`${S.provider}-${S.id}`)})}),d&&e(Ge,{data:d.data,anchorRect:d.rect,bookmarked:i.has(Ne(d.data.provider,d.data.mangaId)),onToggleBookmark:()=>l({id:d.data.mangaId,provider:d.data.provider,title:d.data.title,cover:d.data.cover,altTitle:d.data.altTitle??void 0,contentRating:d.data.contentRating}),onMouseEnter:m,onMouseLeave:_,onRequestClose:p})]})},Cn=()=>{const{options:n}=St(),s=Q(()=>n.some(d=>d.kind==="manga"),[n]),{hasConsent:h}=st(),[t,o]=oe("manga_discover_tab","latest"),[l,i]=oe("manga_trending_sort","popular");return s?e(se,{children:[e(pe,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:t,onChange:o}),t==="latest"?e(Be,{title:"Latest Releases",eyebrow:"Fresh chapters",sort:"latest",mature:h}):e(Be,{title:"Trending",eyebrow:"Discover",sort:l,mature:h,headerActions:e("select",{className:B["header-select"],value:l,onChange:d=>i(d.currentTarget.value),"aria-label":"Trending sort",children:kn.map(d=>e("option",{value:d.value,children:d.label},d.value))})})]}):null},In=()=>{const n=J(),{data:s,isLoading:h}=Tt(24),[t,o]=E(null),{popup:l,openPopup:i,scheduleClose:d,cancelClose:T,closePopup:_}=ze(),{toggle:m,bookmarkedIds:p}=Ue(),N=s?.data??[];return e("div",{style:{paddingBottom:"2rem"},children:[e(Z,{title:"Continue Reading",eyebrow:"Pick up where you left off",titleLink:"/reading-list/Continue Reading",loading:h,carousel:!0,collapsible:!0,defaultExpanded:N.length>0,highlight:!0,itemCount:N.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(_e,{icon:"book",text:"You haven't read anything yet. Browse manga and open a chapter to start tracking.",actionLabel:"Browse Manga",onAction:()=>n("/manga")}),children:N.map(r=>{const w=r.page??0,u=r.pageCount??0,c=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(me,{item:{id:r.id,title:r.title||"",...Ye({title:r.title||"",altTitle:r.altTitle}),thumbnail:r.provider?Ce(r.provider,r.cover||""):r.cover||"",chapterBadge:r.chapterNumber?`Ch. ${r.chapterNumber}`:null,isAdult:Qe(r)},linkTo:c,hoverIcon:"book",progress:u>0?{percent:w/u*100,label:`Ch. ${r.chapterNumber} · p. ${w}/${u}`}: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:()=>o({libId:r.id,title:r.title||""}),onOpenDetails:g=>i(g,{provider:r.provider||"",mangaId:r.mangaId||"",title:r.title||"",altTitle:r.altTitle,cover:r.cover||"",contentRating:r.contentRating||void 0,readTarget:c}),onPopupHoverIntent:g=>g?T():d(),rawThumbnail:!0},r.id)})}),e(bt,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>o(null)}),l&&l.data.provider&&e(Ge,{data:l.data,anchorRect:l.rect,bookmarked:p.has(Ne(l.data.provider,l.data.mangaId)),onToggleBookmark:()=>m({id:l.data.mangaId,provider:l.data.provider,title:l.data.title,cover:l.data.cover,altTitle:l.data.altTitle??void 0,contentRating:l.data.contentRating}),onMouseEnter:T,onMouseLeave:d,onRequestClose:_}),e(Cn,{})]})},An="_seasonGrid_knq79_24",X={"section-header":"_section-header_knq79_1","title-wrapper":"_title-wrapper_knq79_8","pagination-controls":"_pagination-controls_knq79_14",seasonGrid:An},Rn="_emptyState_bpz5x_1",Pe={emptyState:Rn},Ln=[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],$n=[{value:"trending_week",label:"Trending Now"},{value:"trending_day",label:"Trending Today"},{value:"popular",label:"Popular All Time"},{value:"top_rated",label:"Top Rated"}],Mn=()=>{const n=J(),{data:s,isLoading:h}=Ct(24),t=It(),o=At(),[l,i]=E(null),[d,T]=E(()=>localStorage.getItem("tv_home_activeTab")||"latest"),[_,m]=E("tv"),[p,N]=E("trending_week"),[r,w]=E("multi"),u=s?.data??[];G.useEffect(()=>{localStorage.setItem("tv_home_activeTab",d)},[d]);const c=p.startsWith("trending_"),g=p==="trending_day"?"day":"week",k={popular:"popularity.desc",top_rated:"vote_average.desc"},{data:S,isLoading:A}=He(r==="multi"?"all":r,g,1,c&&d==="trending"),{data:$,isLoading:R}=$e({type:r,sort_by:k[p]||"popularity.desc",page:1}),C=c?S?.results||[]:$?.results||[],U=c?A:R,{data:x,isLoading:I}=$e({type:_,sort_by:"primary_release_date.desc",page:1}),F=x?.results||[],M=a=>{l&&(o.mutate({mediaId:l.libId}),a&&t.mutate(l.libId))},ee=P(a=>e(wt,{item:{id:a.id,title:a.title,year:a.year,type:a.type,image:a.image,vote_average:a.vote_average,adult:a.adult}},`${a.type}-${a.id}`),[]),H=()=>{switch(d){case"latest":return e("section",{children:[e("div",{className:X["section-header"],children:[e("div",{className:X["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(he,{ariaLabel:"Latest type",value:_,onChange:a=>m(a),options:[{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})})]}),I?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((a,f)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},f))}):F.length>0?e(Z,{carousel:!0,itemCount:F.length,children:F.map(ee)}):e("div",{className:Pe.emptyState,children:e("p",{children:"No latest releases available right now."})})]});case"trending":return e("section",{children:[e("div",{className:X["section-header"],children:[e("div",{className:X["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(he,{ariaLabel:"Trending sort",value:p,onChange:N,options:$n.map(a=>({value:a.value,label:a.label}))}),e(he,{ariaLabel:"Trending type",value:r,onChange:a=>w(a),options:[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})]})]}),U?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((a,f)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},f))}):C.length>0?e(Z,{carousel:!0,itemCount:C.length,children:C.map(ee)}):e("div",{className:Pe.emptyState,children:e("p",{children:"No trending content available right now."})})]})}};return e("div",{style:{paddingBottom:"2rem"},children:[e(Z,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/tv-watchlist/Continue Watching",loading:h,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(_e,{icon:"tv",text:"You haven't watched anything yet. Search TV & Movies and start watching to track progress.",actionLabel:"Browse TV & Movies",onAction:()=>n("/tv-search")}),children:u.map(a=>{const f=a.currentTime??0,y=a.duration??0,D=a.season??1,K=a.episode??1,z=a.mediaType==="movie",j=z?"Movie":`S${D} E${K}`,te=a.completed===1||y>0&&f>=y*.8,ae=te?100:y>0&&f>0?f/y*100:0,fe=te?"Watched":y>0?z?`${ne(f)} / ${ne(y)}`:`${j} · ${ne(f)} / ${ne(y)}`:j;return e(me,{item:{id:a.id,title:a.title||"",thumbnail:a.poster||"",typeBadge:z?"Movie":"TV",chapterBadge:j,isAdult:Lt({adult:a.adult===1})},linkTo:Rt(a.mediaType,a.tmdbId??0,z?void 0:D,z?void 0:K),hoverIcon:"play",progress:(y>0||te)&&ae>0?{percent:ae,label:fe}:void 0,showProgress:!0,metaRow:a.year?e("span",{style:{opacity:.75},children:a.year}):void 0,onRemove:()=>i({libId:a.id,title:a.title||""}),renderPopup:(be,re)=>e(kt,{item:{id:a.tmdbId??0,title:a.title||"",year:a.year||"",type:a.mediaType||"tv",image:a.poster||""},anchorRect:be,onMouseEnter:re.onMouseEnter,onMouseLeave:re.onMouseLeave,onRequestClose:re.close})},a.id)})}),e(pe,{ariaLabel:"Browse TV",options:Ln,value:d,onChange:T}),e("div",{children:H()}),e(qe,{isOpen:!!l,itemName:l?.title,progressKind:"watch",listLabel:"my TV watchlist",onClose:()=>{i(null)},onConfirm:M})]})};function xn(n){const s=n.currentTime??0,h=n.duration??0,t=(n.trackIndex??0)+1;return h>0?`Track ${t} · ${ne(s)} / ${ne(h)}`:n.trackLabel?`Track ${t} · ${n.trackLabel}`:`Track ${t}`}const Bn=({title:n="Continue Listening",limit:s=24,titleLink:h,showEmptyState:t=!0})=>{const o=J(),{data:l,isLoading:i}=Pt(s),[d,T]=E(null),_=l?.data??[];return e(se,{children:[e(Z,{title:n,eyebrow:"Pick up where you left off",titleLink:h??"/listening-list/Continue Listening",loading:i,carousel:!0,collapsible:!0,defaultExpanded:_.length>0,highlight:!0,itemCount:_.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"16 / 9"}}),skeletonCount:7,emptyState:t?e(_e,{icon:"headphones",text:"You haven't listened to anything yet. Browse ASMR and play a track to start tracking.",actionLabel:"Browse ASMR",onAction:()=>o("/asmr")}):void 0,children:_.map(m=>{const p=m.currentTime??0,N=m.duration??0,r=m.rjCode||m.id;return e(me,{item:{id:m.id,title:m.title||"",thumbnail:m.thumbnail||"",chapterBadge:`Track ${(m.trackIndex??0)+1}`,isAdult:!!m.isAdult},linkTo:`/asmr/${encodeURIComponent(r)}`,hoverIcon:"play",layout:"horizontal",progress:N>0?{percent:Math.min(100,p/N*100),label:xn(m)??""}: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:()=>T({workId:m.id,title:m.title||""}),rawThumbnail:!0},m.id)})}),e(Bt,{workId:d?d.workId:null,title:d?.title,onClose:()=>T(null)})]})},Pn=()=>e("div",{style:{paddingBottom:"2rem"},children:e(Bn,{})}),En=({items:n})=>{const s=J(),h=Q(()=>n.slice(0,6).map(t=>{const o=$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:o,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(l=>Mt[l]??xt[l]).filter(Boolean),synopsis:we(t.overview,200),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>s(o),onDetails:()=>s(o)}}),[n,s]);return e(ve,{slides:h,eyebrow:"TV Spotlight"})},Dn=({mangaList:n})=>{const s=J(),h=Q(()=>n.slice(0,6).map(t=>{const o=`/manga/${t.provider||"mangadex"}/${t.id}`,l=Ce(t.provider||"mangadex",t.cover||"");return{key:`${t.provider}-${t.id}`,bannerSrc:l,posterSrc:l,posterAlt:t.title,title:t.title,detailTo:o,metaItems:[t.year?String(t.year):void 0,t.status??void 0].filter(i=>!!i),tags:t.tags.slice(0,3),synopsis:we(t.description,200,""),primaryLabel:"Read Now",primaryIcon:"book",onPrimary:()=>s(o),onDetails:()=>s(o)}}),[n,s]);return e(ve,{slides:h,eyebrow:"Manga Spotlight"})};function Wn(n){const s=n.availableEpisodes?.sub;if(typeof s=="number"&&s>0)return s;const h=n.availableEpisodesDetail?.sub,t=n.availableEpisodesDetail?.dub,o=(Array.isArray(h)?h.length:0)+(Array.isArray(t)?t.length:0);return o>0?o:null}const On=({works:n})=>{const s=J(),h=Q(()=>n.slice(0,6).map((t,o)=>{const l=Et(t),i=`/asmr/${encodeURIComponent(l)}`,d=Wn(t);return{key:l||t._id||String(o),bannerSrc:t.thumbnail||"",posterSrc:t.thumbnail||"",posterAlt:t.name,title:t.name,detailTo:i,metaItems:[t.rating?t.rating.toUpperCase():void 0,d?`${d} track${d===1?"":"s"}`:void 0].filter(T=>!!T),tags:[],synopsis:we(t.description,160,""),primaryLabel:"Listen Now",primaryIcon:"play",onPrimary:()=>s(i),onDetails:()=>s(i)}}),[n,s]);return e(ve,{slides:h,eyebrow:"ASMR Spotlight",posterAspect:"landscape"})},Vn=[{value:"anime",label:"Anime"},{value:"manga",label:"Manga"},{value:"tv",label:"TV & Movies"},{value:"asmr",label:"ASMR"}],mr=()=>{const n=Je(),s=lt(),[h,t]=G.useState(1),[o,l]=E(()=>localStorage.getItem("home_activeTab")||"latest"),[i,d]=E(()=>localStorage.getItem("season_format")||"TV"),T=q(null),{data:_}=Le(h+1,i,o==="season"),{titlePreference:m}=Ve(),{contentType:p,setContentType:N}=it(),[r,w]=G.useState(null),u=ct(),{data:c=[]}=dt(),g=ut(),k=ht(),S=pt();O(()=>{document.title="Home - dango"},[]);const{data:A,isLoading:$}=mt();O(()=>{localStorage.setItem("home_activeTab",o)},[o]),O(()=>{localStorage.setItem("season_format",i),t(1)},[i]),O(()=>{A!==void 0&&A.length===0&&o==="week"&&l("latest")},[A,o]);const{data:R,isLoading:C,fetchNextPage:U,hasNextPage:x,isFetchingNextPage:I}=gt(),F=P(()=>{x&&!I&&!C&&U()},[x,I,C,U]),{data:M,isLoading:ee}=vt(),{data:H,isLoading:a}=He("all","week",1,p==="tv"),{data:f,isLoading:y}=Dt(p==="asmr"),{data:D,isLoading:K}=Nt(),z=Q(()=>R?.pages||[],[R]),{data:j,isLoading:te}=Le(h,i,o==="season"),ae=14,fe=j&&j.length>=ae&&_&&_.length>0,be=et(s.continueWatching.remove.mutationOptions({onSuccess:async()=>{n.invalidateQueries(s.continueWatching.pathFilter()),await n.invalidateQueries({queryKey:[Oe.continueWatching]}),x&&z.length-1<14&&U()}})),re=P(W=>{const Y=z?.find(ye=>String(ye.id)===String(W));if(Y){const ye=Y[m]||Y.name;w({id:W,name:ye})}},[z,m]),Ie=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Ae=A!==void 0&&A.length>0,Xe=Ae?[{key:"week",label:"This Week"},...Ie]:Ie,Re=o==="week"&&!Ae?"latest":o,Ke=()=>{switch(Re){case"latest":return e(la,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:X["section-header"],ref:T,children:[e("div",{className:X["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(he,{ariaLabel:"Season format",width:90,value:i,onChange:d,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:X["pagination-controls"],children:e(tt,{page:h,canGoNext:fe,onChange:W=>{if(t(W),T.current){const Y=T.current.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:Y,behavior:"smooth"})}},isLoading:te})})]})]}),e("div",{className:`grid-container ${X.seasonGrid}`,style:{minHeight:"300px",alignContent:"start"},children:te?e(De,{count:ae}):j?.slice(0,ae).map(W=>e(le,{anime:W},W._id))})]});case"popular":return e(ra,{title:"Trending",eyebrow:"Discover"});case"week":return e(Me,{title:"This Week",eyebrow:"Aired this week",animeList:A||[],continueWatching:!1,carousel:!0,loading:$});default:return null}};return e("div",{style:{paddingBottom:"2rem"},children:[p==="anime"&&(ee&&!M?.length?e(ce,{}):M&&M.length>0&&e(pn,{animeList:M})),p==="tv"&&(a&&!H?.results?.length?e(ce,{}):H?.results&&H.results.length>0&&e(En,{items:H.results})),p==="manga"&&(K&&!D?.length?e(ce,{}):D&&D.length>0&&e(Dn,{mangaList:D})),p==="asmr"&&(y&&!f?.length?e(ce,{}):f&&f.length>0&&e(On,{works:f})),e(pe,{ariaLabel:"Content type",options:Vn,value:p,onChange:N}),p==="manga"?e(In,{}):p==="tv"?e(Mn,{}):p==="asmr"?e(Pn,{}):e(se,{children:[e(Me,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:z,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:z.length>0,onRemove:re,loading:C,onReachThreshold:F,scrollThreshold:.7,isFetchingNextPage:I,emptyState:e(_e,{icon:"history",text:"You haven't watched anything yet. Start exploring and watch something first!",actionLabel:"Explore Trending",onAction:()=>l("popular")})}),e(ft,{title:"Queue",eyebrow:"Up next",items:c,onRemove:W=>g.mutate({showId:W.showId,episodeNumber:W.episodeNumber}),showClearAll:!0,onClear:()=>k.mutate(),onReorder:W=>S.mutate(W.map(Y=>({id:Y.id,showId:Y.showId,episodeNumber:Y.episodeNumber})))}),e(pe,{ariaLabel:"Browse anime",options:Xe.map(W=>({value:W.key,label:W.label})),value:Re,onChange:l}),e("div",{children:Ke()}),e(Ra,{eyebrow:"Never miss an episode"}),e(qe,{isOpen:!!r,itemName:r?.name,progressKind:"watch",listLabel:"my watchlist",onClose:()=>{w(null)},onConfirm:W=>{r&&(be.mutate({showId:r.id}),W&&u.mutate({id:r.id}))}})]})]})};export{mr as default};
1
+ import{d as E,A as q,h as O,q as P,g as G,u as e,L as Ee,T as Q,S as se,a as J,_ as je}from"./vendor-core-DfaOB3Rn.js";import{b as Ze,u as Je,a as et}from"./vendor-query-BBT5_sHx.js";import{M as me,P as tt}from"./MediaCard-lz7FdOe_.js";import{A as le}from"./AnimeCard-BxhPLWBG.js";import{S as De,A as We}from"./SkeletonGrid-pA-dcLBM.js";import{I as V}from"./vendor-icons-DrybRNxP.js";import{u as Se,a as oe,b as at,c as nt,q as Oe,t as rt,d as Ve,s as ot,f as Te,B as Fe,e as st,g as ne,h as we,i as lt,j as Le,k as it,l as ct,m as dt,n as ut,o as ht,p as pt,r as mt,v as gt,w as vt}from"./index-DlcgJVM6.js";import{u as _t}from"./vendor-ui-3qrARCPr.js";import{E as ke}from"./ErrorMessage-DAxegITP.js";import{R as qe}from"./ResetProgressModal-0PvvM2XJ.js";import{Q as ft}from"./QueueRail-D1FmM-GR.js";import{u as ze,M as Ge}from"./useMangaPopup-B_wRaMyP.js";import{M as bt}from"./MangaResetProgressModal-Br5zqZ-U.js";import{u as Ue,a as yt,m as Ne,i as Qe,b as Ce,c as Ye,d as Tt,e as Nt}from"./useMangaLibrary-BacTdrw2.js";import{u as St}from"./useProviders-D0XOHCsj.js";import{u as He,a as $e,T as wt}from"./useTv-IidbSQU4.js";import{T as kt}from"./TvPopup-BwGJ1Tjg.js";import{u as Ct,a as It,b as At,t as Rt,i as Lt,c as $t,M as Mt,T as xt}from"./useTvLibrary-DiCSdUOj.js";import{A as Bt}from"./AsmrResetProgressModal-DPHPLqPo.js";import{u as Pt,a as Et,b as Dt}from"./useAsmr-B-FYJW2L.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-Beq4JL0b.js";import"./useAnimeInfoData-tcGkDs2b.js";import"./QueueOptionsButton-B8xuoYlH.js";import"./playbackCompletion-IPHm9fp5.js";import"./usePopup-DS9jMzp6.js";import"./libraryInvalidation-DdnIPcOQ.js";const Wt="_sectionWrapper_2p2l1_9",Ot="_sectionTitleNoMargin_2p2l1_13",Vt="_carousel_2p2l1_178",B={"section-header":"_section-header_2p2l1_1",sectionWrapper:Wt,sectionTitleNoMargin:Ot,"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:Vt,"carousel-inner":"_carousel-inner_2p2l1_187","carousel-card":"_carousel-card_2p2l1_192"};function ge({align:n="start",containScroll:s="trimSnaps",scrollFraction:h=.8,threshold:t=.6,onReachThreshold:o}={}){const[l,i]=_t({align:n,containScroll:s,dragFree:!0}),[d,T]=E(!1),_=q({scrollFraction:h,threshold:t,onReachThreshold:o}),m=q(!1);O(()=>{_.current={scrollFraction:h,threshold:t,onReachThreshold:o}});const p=P(u=>{T(u.canScrollPrev()||u.canScrollNext())},[]);O(()=>{if(!i)return;const u=()=>{const c=i.scrollProgress();c>=_.current.threshold&&!m.current?(m.current=!0,_.current.onReachThreshold?.()):c<_.current.threshold&&(m.current=!1),p(i)};return i.on("init",u),i.on("reInit",u),i.on("scroll",u),i.on("resize",u),()=>{i.off("init",u),i.off("reInit",u),i.off("scroll",u),i.off("resize",u)}},[i,p]);const N=P(u=>{const c=u.containerNode().firstElementChild;if(!c)return 1;const g=u.rootNode().getBoundingClientRect().width,k=c.getBoundingClientRect().width;return k?Math.max(1,Math.round(g/k)):1},[]),r=P((u,c=!1)=>{if(!i)return;const g=Math.max(1,Math.round(N(i)*_.current.scrollFraction)),k=i.selectedScrollSnap()+(u==="left"?-g:g);i.scrollTo(k,c)},[i,N]),w=P((u=!1)=>{i?.scrollTo(0,u)},[i]);return{emblaRef:l,api:i,canScroll:d,stepBy:r,scrollToStart:w}}const Z=({title:n,eyebrow:s,titleLink:h,loading:t,emptyState:o,carousel:l,layout:i,collapsible:d,defaultExpanded:T=!0,onReachThreshold:_,scrollThreshold:m,isFetchingNextPage:p,resetScrollOnShrink:N,itemCount:r=0,highlight:w,headerActions:u,loadingSkeleton:c,skeletonCount:g=7,children:k})=>{const{lowEndMode:S}=Se(),{emblaRef:A,stepBy:$,scrollToStart:R}=ge({onReachThreshold:_,threshold:m}),[C,U]=G.useState(T);G.useEffect(()=>{U(T)},[T]);const x=G.useRef(0);return G.useEffect(()=>{N&&r>0&&C&&(r<=x.current||x.current===0)&&R(),r>0&&(x.current=r)},[r,N,C,R]),!t&&r===0&&!o&&!d?null:e("section",{className:`${B.sectionWrapper} ${w?B["continue-watching"]:""}`,children:[e("div",{className:B["section-header"],children:[e("div",{className:B["title-wrapper"],children:[e("div",{className:"title-stack",children:[s&&e("div",{className:"section-eyebrow",children:s}),h?e(Ee,{to:h,className:B["title-link"],children:e("div",{className:`section-title ${B.sectionTitleNoMargin}`,children:n})}):e("div",{className:`section-title ${B.sectionTitleNoMargin}`,children:n})]}),l&&r>0&&C&&e("div",{className:B["nav-arrows"],children:[e("button",{className:B["nav-button"],type:"button","aria-label":"Scroll left",onClick:I=>{I.preventDefault(),$("left",S)},children:e(V,{name:"chevron-left"})}),e("button",{className:B["nav-button"],type:"button","aria-label":"Scroll right",onClick:I=>{I.preventDefault(),$("right",S)},children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:B["header-controls"],children:[u,d&&e("button",{className:B["collapse-button"],type:"button",onClick:()=>U(I=>!I),"aria-expanded":C,"aria-label":C?`Collapse ${n}`:`Expand ${n}`,children:C?e(V,{name:"chevron-up"}):e(V,{name:"chevron-down"})})]})]}),C&&(l?!t&&r===0&&o?e("div",{children:o}):e("div",{className:B["carousel-container"],children:e("div",{className:B.carousel,ref:A,children:e("div",{className:B["carousel-inner"],children:[t&&r===0?Array.from({length:g}).map((I,F)=>e("div",{className:B["carousel-card"],children:c},F)):G.Children.map(k,(I,F)=>e("div",{className:B["carousel-card"],children:I},G.isValidElement(I)&&I.key!=null?I.key:`slide-${F}`)),p&&c&&e("div",{className:B["carousel-card"],children:c})]})})}):e("div",{className:"grid-container",children:t&&r===0?e(De,{count:6,layout:i}):r>0?k:t?null:e("div",{style:{gridColumn:"1 / -1"},children:o})}))]})},Ft=({title:n,eyebrow:s,animeList:h,continueWatching:t,titleLink:o,onRemove:l,loading:i,emptyState:d,carousel:T,cardConfig:_,layout:m,onReachThreshold:p,scrollThreshold:N,isFetchingNextPage:r,collapsible:w,defaultExpanded:u=!0})=>{const c=m||"vertical";return e(Z,{title:n,eyebrow:s,titleLink:o,loading:i,emptyState:d,carousel:T,layout:c,collapsible:w,defaultExpanded:u,onReachThreshold:p,scrollThreshold:N,isFetchingNextPage:r,resetScrollOnShrink:t,highlight:t,itemCount:h.length,loadingSkeleton:e(We,{layout:c}),skeletonCount:7,children:h.map(g=>e(le,{anime:g,continueWatching:t,onRemove:l,config:_,layout:c},g._id))})},Me=G.memo(Ft),qt="_sectionWrapper_xt8h9_2",zt="_sectionTitleNoMargin_xt8h9_6",Gt="_timeSelect_xt8h9_80",Ut="_carouselContainer_xt8h9_111",Qt="_carousel_xt8h9_111",Yt="_carouselInner_xt8h9_122",Ht="_carouselItem_xt8h9_127",Xt="_rankCard_xt8h9_164",Kt="_rankPill_xt8h9_168",jt="_rankGold_xt8h9_179",Zt="_rankSilver_xt8h9_183",Jt="_rankBronze_xt8h9_187",ea="_skeletonPoster_xt8h9_198",ta="_skeletonText_xt8h9_199",v={sectionWrapper:qt,sectionTitleNoMargin:zt,"section-header":"_section-header_xt8h9_10","title-wrapper":"_title-wrapper_xt8h9_18","nav-arrows":"_nav-arrows_xt8h9_40","nav-button":"_nav-button_xt8h9_49",timeSelect:Gt,carouselContainer:Ut,carousel:Qt,carouselInner:Yt,carouselItem:Ht,rankCard:Xt,rankPill:Kt,rankGold:jt,rankSilver:Zt,rankBronze:Jt,skeletonPoster:ea,skeletonText:ta,"header-actions":"_header-actions_xt8h9_236"},xe="TRENDING_DESC",aa="POPULARITY_DESC",na=10;function ra({title:n,eyebrow:s}){const{lowEndMode:h}=Se(),[t,o]=oe("trending_sort",xe),l=[{value:xe,label:"Trending"},{value:aa,label:"All Time"}],{data:i,fetchNextPage:d,hasNextPage:T,isFetchingNextPage:_,isLoading:m,isError:p,error:N}=at(t,na),r=Q(()=>i?.pages.flatMap(g=>g)||[],[i]),w=P(()=>{T&&!_&&!m&&d()},[T,_,m,d]),{emblaRef:u,stepBy:c}=ge({onReachThreshold:w});return e("section",{className:v.sectionWrapper,children:[e("div",{className:v["section-header"],children:[e("div",{className:v["title-wrapper"],children:[e("div",{className:"title-stack",children:[s&&e("div",{className:"section-eyebrow",children:s}),e("div",{className:`section-title ${v.sectionTitleNoMargin}`,children:n})]}),e("div",{className:v["nav-arrows"],children:[e("button",{className:v["nav-button"],type:"button",onClick:g=>{g.preventDefault(),c("left",h)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:v["nav-button"],type:"button",onClick:g=>{g.preventDefault(),c("right",h)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:v["header-actions"],children:e("select",{className:v.timeSelect,value:t,onChange:g=>o(g.currentTarget.value),children:l.map(g=>e("option",{value:g.value,children:g.label},g.value))})})]}),m?e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,children:e("div",{className:v.carouselInner,children:Array.from({length:7}).map((g,k)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.skeletonPoster}),e("div",{className:v.skeletonText})]},k))})})}):p?e(ke,{message:N instanceof Error?N.message:"An unknown error occurred"}):e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,ref:u,children:e("div",{className:v.carouselInner,children:[r.map((g,k)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.rankCard,children:e(le,{anime:g})}),e("div",{className:`${v.rankPill} ${k===0?v.rankGold:k===1?v.rankSilver:k===2?v.rankBronze:""}`,children:k+1})]},g._id)),_&&e("div",{className:v.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:v.skeletonPoster})})]})})})]})}const oa=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}],sa=10;function la({eyebrow:n}){const{lowEndMode:s}=Se(),[h,t]=oe("latest_releases_format","TV"),{data:o,fetchNextPage:l,hasNextPage:i,isFetchingNextPage:d,isLoading:T,isError:_,error:m}=nt(h,sa),p=Q(()=>o?.pages.flatMap(u=>u)||[],[o]),N=P(()=>{i&&!d&&!T&&l()},[i,d,T,l]),{emblaRef:r,stepBy:w}=ge({onReachThreshold:N});return e("section",{className:v.sectionWrapper,children:[e("div",{className:v["section-header"],children:[e("div",{className:v["title-wrapper"],children:[e("div",{className:"title-stack",children:[n&&e("div",{className:"section-eyebrow",children:n}),e("div",{className:`section-title ${v.sectionTitleNoMargin}`,children:"Latest Releases"})]}),e("div",{className:v["nav-arrows"],children:[e("button",{className:v["nav-button"],type:"button",onClick:u=>{u.preventDefault(),w("left",s)},"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:v["nav-button"],type:"button",onClick:u=>{u.preventDefault(),w("right",s)},"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:v["header-actions"],children:e("select",{className:v.timeSelect,value:h,onChange:u=>t(u.currentTarget.value),children:oa.map(u=>e("option",{value:u.value,children:u.label},u.value))})})]}),T?e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,children:e("div",{className:v.carouselInner,children:Array.from({length:7}).map((u,c)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.skeletonPoster}),e("div",{className:v.skeletonText})]},c))})})}):_?e(ke,{message:m instanceof Error?m.message:"An unknown error occurred"}):e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,ref:r,children:e("div",{className:v.carouselInner,children:[p.map(u=>e("div",{className:v.carouselItem,children:e(le,{anime:u})},u._id)),d&&e("div",{className:v.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:v.skeletonPoster})})]})})})]})}const ia="_scheduleSection_10dfe_1",ca="_sectionTitleRow_10dfe_5",da="_sectionTitleNoMargin_10dfe_11",ua="_sectionHeader_10dfe_15",ha="_headerActions_10dfe_25",pa="_timeSelect_10dfe_31",ma="_daySelectorContainer_10dfe_62",ga="_daySelector_10dfe_62",va="_daySelectorInner_10dfe_79",_a="_dayBtn_10dfe_90",fa="_active_10dfe_113",ba="_dayMonth_10dfe_121",ya="_dayNum_10dfe_129",Ta="_dayName_10dfe_135",Na="_navArrows_10dfe_148",Sa="_navButton_10dfe_157",wa="_carouselContainer_10dfe_181",ka="_carousel_10dfe_181",Ca="_carouselInner_10dfe_193",Ia="_carouselCard_10dfe_198",L={scheduleSection:ia,sectionTitleRow:ca,sectionTitleNoMargin:da,sectionHeader:ua,headerActions:ha,timeSelect:pa,daySelectorContainer:ma,daySelector:ga,daySelectorInner:va,dayBtn:_a,active:fa,dayMonth:ba,dayNum:ya,dayName:Ta,navArrows:Na,navButton:Sa,carouselContainer:wa,carousel:ka,carouselInner:Ca,carouselCard:Ia},ie=n=>{const s=n.getFullYear(),h=String(n.getMonth()+1).padStart(2,"0"),t=String(n.getDate()).padStart(2,"0");return`${s}-${h}-${t}`},Aa=async(n,s)=>await rt.data.schedule.query({date:n,format:s}),Ra=({eyebrow:n})=>{const[s,h]=E(()=>ie(new Date)),[t,o]=oe("schedule_format","TV"),{emblaRef:l,canScroll:i,stepBy:d,scrollToStart:T}=ge(),_=q(null),m=q(!0),{data:p=[],isLoading:N,error:r}=Ze({queryKey:[Oe.schedule,s,t],queryFn:()=>Aa(s,t),staleTime:1e3*60*5}),w=Q(()=>{const c=[],g=new Date,k=ie(g),S=new Date(g);S.setDate(g.getDate()-1);const A=ie(S),$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(let R=-6;R<=6;R++){const C=new Date(g);C.setDate(g.getDate()+R),c.push(C)}return c.map(R=>{const C=ie(R),I=C===k?"Today":C===A?"Yest":$[R.getDay()],F=R.getDate(),M=new Intl.DateTimeFormat("en-US",{month:"short"}).format(R);return{dateString:C,dayLabel:I,dayNum:F,monthName:M}})},[]);O(()=>{if(m.current){m.current=!1;return}if(_.current){const c=_.current.querySelector(`[data-date="${s}"]`);c&&c.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[s]),O(()=>{T(!0)},[s,T]);const u=[{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:L.scheduleSection,children:[e("div",{className:L.sectionHeader,children:[e("div",{className:L.sectionTitleRow,children:[e("div",{className:"title-stack",children:[n&&e("div",{className:"section-eyebrow",children:n}),e("h2",{className:`section-title ${L.sectionTitleNoMargin}`,children:"Episode Schedule"})]}),p.length>0&&i&&e("div",{className:L.navArrows,children:[e("button",{className:L.navButton,onClick:()=>d("left"),"aria-label":"Scroll left",children:e(V,{name:"chevron-left"})}),e("button",{className:L.navButton,onClick:()=>d("right"),"aria-label":"Scroll right",children:e(V,{name:"chevron-right"})})]})]}),e("div",{className:L.headerActions,children:e("select",{className:L.timeSelect,value:t,onChange:c=>o(c.currentTarget.value),children:u.map(c=>e("option",{value:c.value,children:c.label},c.value))})})]}),e("div",{className:L.daySelectorContainer,children:e("div",{className:L.daySelector,ref:_,children:e("div",{className:L.daySelectorInner,children:w.map(c=>e("button",{type:"button","data-date":c.dateString,className:`${L.dayBtn} ${s===c.dateString?L.active:""}`,onClick:()=>h(c.dateString),children:[e("span",{className:L.dayMonth,children:c.monthName}),e("span",{className:L.dayNum,children:c.dayNum}),e("span",{className:L.dayName,children:c.dayLabel})]},c.dateString))})})}),e("div",{className:L.carouselContainer,children:e("div",{className:L.carousel,ref:l,children:e("div",{className:L.carouselInner,children:N?Array.from({length:7}).map((c,g)=>e("div",{className:L.carouselCard,children:e(We,{layout:"vertical"})},g)):r?e("div",{style:{width:"100%"},children:e(ke,{message:r instanceof Error?r.message:"An unknown error occurred"})}):p.length===0?e("p",{style:{textAlign:"center",marginTop:"1rem",width:"100%"},children:"No episodes scheduled for this day."}):p.map(c=>e("div",{className:L.carouselCard,children:e(le,{anime:c,continueWatching:!1,layout:"vertical"},c._id)},c._id))})})})]})},La="_bannerContainer_1l49p_1",$a="_hero_1l49p_28",Ma="_ambient_1l49p_37",xa="_ambientShow_1l49p_49",Ba="_scrim_1l49p_53",Pa="_progressLine_1l49p_69",Ea="_paused_1l49p_89",Da="_dots_1l49p_103",Wa="_dot_1l49p_103",Oa="_dotActive_1l49p_126",Va="_viewport_1l49p_137",Fa="_track_1l49p_144",qa="_slide_1l49p_150",za="_slideInner_1l49p_158",Ga="_poster_1l49p_168",Ua="_posterLandscape_1l49p_179",Qa="_info_1l49p_203",Ya="_kicker_1l49p_208",Ha="_featureLabel_1l49p_215",Xa="_scoreChip_1l49p_227",Ka="_rise_1l49p_245",ja="_active_1l49p_249",Za="_metaRow_1l49p_305",Ja="_metaItem_1l49p_316",en="_metaDivider_1l49p_322",tn="_title_1l49p_329",an="_genres_1l49p_345",nn="_genreTag_1l49p_353",rn="_summary_1l49p_364",on="_actions_1l49p_376",sn="_watchBtn_1l49p_383",ln="_detailsBtn_1l49p_405",cn="_navArrow_1l49p_426",dn="_prevArrow_1l49p_459",un="_nextArrow_1l49p_463",b={bannerContainer:La,hero:$a,ambient:Ma,ambientShow:xa,scrim:Ba,progressLine:Pa,paused:Ea,dots:Da,dot:Wa,dotActive:Oa,viewport:Va,track:Fa,slide:qa,slideInner:za,poster:Ga,posterLandscape:Ua,info:Qa,kicker:Ya,featureLabel:Ha,scoreChip:Xa,rise:Ka,active:ja,metaRow:Za,metaItem:Ja,metaDivider:en,title:tn,genres:an,genreTag:nn,summary:rn,actions:on,watchBtn:sn,detailsBtn:ln,navArrow:cn,prevArrow:dn,nextArrow:un},hn=8e3,ce=()=>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"}}),ve=({slides:n,posterAspect:s="portrait",eyebrow:h="Spotlight"})=>{const[t,o]=E(0),[l,i]=E(0),[d,T]=E(!1),[_,m]=E(null),[p,N]=E(0),[r,w]=E({front:"",back:"",flip:!1}),u=q(0),c=q(0),g=q(new Set),k=q(null),S=q(0),A=P(a=>a.bannerSrc,[]),$=P(()=>{i(a=>a+1)},[]),R=P(a=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null),m(null),$();const f=A(n[a]);w(y=>y.flip?{front:f,back:y.back,flip:!1}:{front:y.front,back:f,flip:!0}),o(a)},[$,n,A]),C=P(a=>{if(n.length===0)return;const f=(a%n.length+n.length)%n.length;g.current.has(A(n[f]))?R(f):m(f)},[n,A,R]);O(()=>{let a=!1;return n.forEach(f=>{const y=A(f);if(!y||g.current.has(y))return;const D=new Image;D.src=y;const K=()=>{a||g.current.has(y)||(g.current.add(y),N(z=>z+1))};D.onload=K,D.onerror=K}),()=>{a=!0}},[n,A]),O(()=>{if(n.length!==0&&!r.front){const a=A(n[0]);w({front:a,back:"",flip:!1})}},[n,r.front,A]),O(()=>{if(_!==null){if(_<0||_>=n.length){m(null);return}g.current.has(A(n[_]))&&R(_)}},[_,p,n,A,R]),O(()=>{if(_===null)return;k.current!==null&&window.clearTimeout(k.current);const a=_;return k.current=window.setTimeout(()=>{k.current=null,R(a)},2500),()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)}},[_,R]);const U=P(a=>{C(a)},[C]),x=P(()=>{C(S.current+1)},[C]),I=P(()=>{C(S.current-1)},[C]),F=q(null);if(O(()=>{const a=F.current;if(!a)return;const f=y=>{if(Math.abs(y.deltaY)>Math.abs(y.deltaX)&&Math.abs(y.deltaY)>5){y.preventDefault(),y.stopPropagation();const D=Date.now();if(D-u.current<300)return;u.current=D,$(),y.deltaY>0?x():I()}};return a.addEventListener("wheel",f,{passive:!1}),()=>a.removeEventListener("wheel",f)},[n.length,x,I,$]),O(()=>{if(n.length===0||d)return;const a=setTimeout(x,hn);return()=>clearTimeout(a)},[t,x,n.length,l,d]),O(()=>{const a=f=>{const y=f.target;y&&(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.tagName==="SELECT"||y.isContentEditable)||(f.key==="ArrowRight"?(f.preventDefault(),x()):f.key==="ArrowLeft"&&(f.preventDefault(),I()))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[x,I]),O(()=>{t>=n.length&&o(0)},[n.length,t]),n.length===0)return null;const M=t>=n.length?0:t;S.current=M;const ee=a=>{c.current=a.touches[0].clientX},H=a=>{const y=a.changedTouches[0].clientX-c.current;Math.abs(y)>50&&($(),y>0?I():x())};return e("div",{className:b.bannerContainer,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:e("div",{className:`${b.hero} ${d?b.paused:""}`,onTouchStart:ee,onTouchEnd:H,children:[r.front&&e("img",{src:r.front,alt:"","aria-hidden":"true",className:`${b.ambient} ${r.flip?"":b.ambientShow}`}),r.back&&e("img",{src:r.back,alt:"","aria-hidden":"true",className:`${b.ambient} ${r.flip?b.ambientShow:""}`}),e("div",{className:b.scrim,"aria-hidden":"true"}),n.length>1&&e("div",{className:b.progressLine,"aria-hidden":"true"},`progress-${l}-${M}`),n.length>1&&e("div",{className:b.dots,ref:F,role:"tablist","aria-label":"Spotlight slides",children:n.map((a,f)=>e("button",{role:"tab","aria-selected":f===M,"aria-label":`Go to slide ${f+1}: ${a.title}`,className:`${b.dot} ${f===M?b.dotActive:""}`,onClick:()=>U(f),tabIndex:f===M?0:-1},a.key))}),e("div",{className:b.viewport,children:e("div",{className:b.track,style:{transform:`translateX(-${M*100}%)`},children:n.map((a,f)=>e("div",{className:`${b.slide} ${f===M?b.active:""}`,"aria-hidden":f!==M,children:e("div",{className:b.slideInner,children:[e("img",{src:a.posterSrc,alt:a.posterAlt,className:s==="landscape"?b.posterLandscape:b.poster,decoding:"async"}),e("div",{className:b.info,children:[e("div",{className:`${b.kicker} ${b.rise}`,children:[e("span",{className:b.featureLabel,children:h}),a.score!==void 0&&a.score!==null&&a.score!==""&&e("span",{className:b.scoreChip,children:[e(V,{name:"star",size:12}),e("span",{children:a.score})]})]}),e(Ee,{to:a.detailTo,className:`${b.title} ${b.rise}`,"aria-label":`View details for ${a.title}`,tabIndex:f===M?0:-1,children:a.title}),a.metaItems.length>0&&e("div",{className:`${b.metaRow} ${b.rise}`,children:a.metaItems.map((y,D)=>e(G.Fragment,{children:[e("span",{className:b.metaItem,children:y}),D<a.metaItems.length-1&&e("div",{className:b.metaDivider})]},D))}),a.tags.length>0&&e("div",{className:`${b.genres} ${b.rise}`,children:a.tags.slice(0,3).map(y=>e("span",{className:b.genreTag,children:y},y))}),a.synopsis&&e("p",{className:`${b.summary} ${b.rise}`,children:a.synopsis}),e("div",{className:`${b.actions} ${b.rise}`,children:[e("button",{className:b.watchBtn,onClick:a.onPrimary,tabIndex:f===M?0:-1,children:[e(V,{name:a.primaryIcon,size:14}),e("span",{children:a.primaryLabel})]}),e("button",{className:b.detailsBtn,onClick:a.onDetails,tabIndex:f===M?0:-1,children:[e(V,{name:"info-circle",size:15}),e("span",{children:"Details"})]})]})]})]})},a.key))})}),n.length>1&&e(se,{children:[e("button",{className:`${b.navArrow} ${b.prevArrow}`,onClick:()=>{$(),I()},"aria-label":"Previous slide",children:e(V,{name:"chevron-left",size:20})}),e("button",{className:`${b.navArrow} ${b.nextArrow}`,onClick:()=>{$(),x()},"aria-label":"Next slide",children:e(V,{name:"chevron-right",size:20})})]})]})})},pn=({animeList:n})=>{const{titlePreference:s}=Ve(),h=J(),t=Q(()=>n.slice(0,6).map(o=>{const l=s==="nativeName"?o.nativeName||o.name:s==="englishName"&&o.englishName||o.name;return{key:o._id,bannerSrc:o.bannerImage?Te(o.bannerImage,1280,560):Te(o.thumbnail,1280,450),posterSrc:Te(o.thumbnail,460,650),posterAlt:l,title:l,detailTo:`/anime/${o._id}`,score:o.score,metaItems:[o.type||"Anime",o.status,o.episodeCount?`${o.episodeCount} Episodes`:void 0,o.rating].filter(i=>!!i),tags:(o.genres??[]).slice(0,3).map(i=>typeof i=="string"?i:i?.name).filter(i=>!!i),synopsis:ot(o.description??""),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>h(`/watch/${o._id}`),onDetails:()=>h(`/anime/${o._id}`)}}),[n,s,h]);return e(ve,{slides:t})},mn="_emptyState_19tmt_1",gn="_emptyStateIcon_19tmt_16",vn="_emptyStateTitle_19tmt_23",_n="_emptyStateText_19tmt_30",de={emptyState:mn,emptyStateIcon:gn,emptyStateTitle:vn,emptyStateText:_n},_e=({icon:n,text:s,actionLabel:h,onAction:t,title:o="Nothing is here..."})=>e("div",{className:de.emptyState,children:[e(V,{name:n,size:48,className:de.emptyStateIcon}),e("div",{children:[e("h3",{className:de.emptyStateTitle,children:o}),e("p",{className:de.emptyStateText,children:s})]}),e(Fe,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:h})]}),fn="_select_1dw63_1",bn={select:fn},he=({value:n,options:s,onChange:h,ariaLabel:t,width:o})=>e("select",{className:bn.select,style:o!==void 0?{width:o}:void 0,value:n,"aria-label":t,onChange:l=>h(l.currentTarget.value),children:s.map(l=>e("option",{value:l.value,children:l.label},l.value))}),yn="_tabBar_irwbm_1",Tn="_tabIndicator_irwbm_24",Nn="_tabButton_irwbm_38",Sn="_tabActive_irwbm_64",ue={tabBar:yn,tabIndicator:Tn,tabButton:Nn,tabActive:Sn};function wn({options:n,value:s,onChange:h,ariaLabel:t},o){const l=q(null),i=q(new Map),d=q(null),[T,_]=E({left:0,width:0}),m=P((p,N)=>{const r=i.current.get(p),w=l.current;if(r&&w){const u=w.getBoundingClientRect(),c=r.getBoundingClientRect();_({left:c.left-u.left+w.scrollLeft,width:c.width}),N&&r.scrollIntoView({block:"nearest",inline:"nearest"})}},[]);return je(()=>{const p=d.current!==null&&d.current!==s;d.current=s,m(s,p)},[s,n.length,m]),O(()=>{if(m(s,!1),typeof ResizeObserver>"u")return;let p=0;const N=l.current;if(!N)return;const r=new ResizeObserver(()=>{cancelAnimationFrame(p),p=requestAnimationFrame(()=>m(s,!1))});r.observe(N);let w=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{w||m(s,!1)}),()=>{w=!0,cancelAnimationFrame(p),r.disconnect()}},[s,n.length,m]),e("div",{className:ue.tabBar,ref:p=>{l.current=p,typeof o=="function"?o(p):o&&(o.current=p)},"aria-label":t,children:[e("div",{className:ue.tabIndicator,style:{left:T.left,width:T.width}}),n.map(p=>e(Fe,{ref:N=>{N&&i.current.set(p.value,N)},variant:"secondary",size:"sm",className:`${ue.tabButton} ${s===p.value?ue.tabActive:""}`,onClick:()=>h(p.value),children:p.label},p.value))]})}const pe=G.forwardRef(wn),kn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}],Be=({title:n,eyebrow:s,sort:h,mature:t,headerActions:o})=>{const{toggle:l,bookmarkedIds:i}=Ue(),{popup:d,openPopup:T,scheduleClose:_,cancelClose:m,closePopup:p}=ze(),{data:N,isLoading:r,fetchNextPage:w,hasNextPage:u,isFetchingNextPage:c}=yt({provider:"",query:"",sort:h,status:"",type:"",rating:t?"safe,suggestive,erotica,pornographic":"safe",mature:t}),g=Q(()=>N?.pages.flatMap(S=>S.items)??[],[N]),k=P(()=>{u&&!c&&!r&&w()},[u,c,r,w]);return e(se,{children:[e(Z,{title:n,eyebrow:s,loading:r,carousel:!0,itemCount:g.length,headerActions:o,onReachThreshold:k,isFetchingNextPage:c,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,children:g.map(S=>{const A=Ne(S.provider,S.id);return e(me,{item:{id:A,title:S.title,...Ye(S),thumbnail:Ce(S.provider,S.cover),typeBadge:S.type||void 0,chapterBadge:S.latestChapter?`Ch. ${S.latestChapter}`:null,isAdult:Qe(S)},linkTo:`/manga/${S.provider}/${encodeURIComponent(S.id)}`,hoverIcon:"info",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:$=>T($,{provider:S.provider,mangaId:S.id,title:S.title,altTitle:S.altTitle,cover:S.cover,contentRating:S.contentRating,readTarget:`/manga/${S.provider}/${encodeURIComponent(S.id)}`,mature:t}),onPopupHoverIntent:$=>$?m():_(),rawThumbnail:!0},`${S.provider}-${S.id}`)})}),d&&e(Ge,{data:d.data,anchorRect:d.rect,bookmarked:i.has(Ne(d.data.provider,d.data.mangaId)),onToggleBookmark:()=>l({id:d.data.mangaId,provider:d.data.provider,title:d.data.title,cover:d.data.cover,altTitle:d.data.altTitle??void 0,contentRating:d.data.contentRating}),onMouseEnter:m,onMouseLeave:_,onRequestClose:p})]})},Cn=()=>{const{options:n}=St(),s=Q(()=>n.some(d=>d.kind==="manga"),[n]),{hasConsent:h}=st(),[t,o]=oe("manga_discover_tab","latest"),[l,i]=oe("manga_trending_sort","popular");return s?e(se,{children:[e(pe,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:t,onChange:o}),t==="latest"?e(Be,{title:"Latest Releases",eyebrow:"Fresh chapters",sort:"latest",mature:h}):e(Be,{title:"Trending",eyebrow:"Discover",sort:l,mature:h,headerActions:e("select",{className:B["header-select"],value:l,onChange:d=>i(d.currentTarget.value),"aria-label":"Trending sort",children:kn.map(d=>e("option",{value:d.value,children:d.label},d.value))})})]}):null},In=()=>{const n=J(),{data:s,isLoading:h}=Tt(24),[t,o]=E(null),{popup:l,openPopup:i,scheduleClose:d,cancelClose:T,closePopup:_}=ze(),{toggle:m,bookmarkedIds:p}=Ue(),N=s?.data??[];return e("div",{style:{paddingBottom:"2rem"},children:[e(Z,{title:"Continue Reading",eyebrow:"Pick up where you left off",titleLink:"/reading-list/Continue Reading",loading:h,carousel:!0,collapsible:!0,defaultExpanded:N.length>0,highlight:!0,itemCount:N.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(_e,{icon:"book",text:"You haven't read anything yet. Browse manga and open a chapter to start tracking.",actionLabel:"Browse Manga",onAction:()=>n("/manga")}),children:N.map(r=>{const w=r.page??0,u=r.pageCount??0,c=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(me,{item:{id:r.id,title:r.title||"",...Ye({title:r.title||"",altTitle:r.altTitle}),thumbnail:r.provider?Ce(r.provider,r.cover||""):r.cover||"",chapterBadge:r.chapterNumber?`Ch. ${r.chapterNumber}`:null,isAdult:Qe(r)},linkTo:c,hoverIcon:"book",progress:u>0?{percent:w/u*100,label:`Ch. ${r.chapterNumber} · p. ${w}/${u}`}: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:()=>o({libId:r.id,title:r.title||""}),onOpenDetails:g=>i(g,{provider:r.provider||"",mangaId:r.mangaId||"",title:r.title||"",altTitle:r.altTitle,cover:r.cover||"",contentRating:r.contentRating||void 0,readTarget:c}),onPopupHoverIntent:g=>g?T():d(),rawThumbnail:!0},r.id)})}),e(bt,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>o(null)}),l&&l.data.provider&&e(Ge,{data:l.data,anchorRect:l.rect,bookmarked:p.has(Ne(l.data.provider,l.data.mangaId)),onToggleBookmark:()=>m({id:l.data.mangaId,provider:l.data.provider,title:l.data.title,cover:l.data.cover,altTitle:l.data.altTitle??void 0,contentRating:l.data.contentRating}),onMouseEnter:T,onMouseLeave:d,onRequestClose:_}),e(Cn,{})]})},An="_seasonGrid_knq79_24",X={"section-header":"_section-header_knq79_1","title-wrapper":"_title-wrapper_knq79_8","pagination-controls":"_pagination-controls_knq79_14",seasonGrid:An},Rn="_emptyState_bpz5x_1",Pe={emptyState:Rn},Ln=[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],$n=[{value:"trending_week",label:"Trending Now"},{value:"trending_day",label:"Trending Today"},{value:"popular",label:"Popular All Time"},{value:"top_rated",label:"Top Rated"}],Mn=()=>{const n=J(),{data:s,isLoading:h}=Ct(24),t=It(),o=At(),[l,i]=E(null),[d,T]=E(()=>localStorage.getItem("tv_home_activeTab")||"latest"),[_,m]=E("tv"),[p,N]=E("trending_week"),[r,w]=E("multi"),u=s?.data??[];G.useEffect(()=>{localStorage.setItem("tv_home_activeTab",d)},[d]);const c=p.startsWith("trending_"),g=p==="trending_day"?"day":"week",k={popular:"popularity.desc",top_rated:"vote_average.desc"},{data:S,isLoading:A}=He(r==="multi"?"all":r,g,1,c&&d==="trending"),{data:$,isLoading:R}=$e({type:r,sort_by:k[p]||"popularity.desc",page:1}),C=c?S?.results||[]:$?.results||[],U=c?A:R,{data:x,isLoading:I}=$e({type:_,sort_by:"primary_release_date.desc",page:1}),F=x?.results||[],M=a=>{l&&(o.mutate({mediaId:l.libId}),a&&t.mutate(l.libId))},ee=P(a=>e(wt,{item:{id:a.id,title:a.title,year:a.year,type:a.type,image:a.image,vote_average:a.vote_average,adult:a.adult}},`${a.type}-${a.id}`),[]),H=()=>{switch(d){case"latest":return e("section",{children:[e("div",{className:X["section-header"],children:[e("div",{className:X["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(he,{ariaLabel:"Latest type",value:_,onChange:a=>m(a),options:[{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})})]}),I?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((a,f)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},f))}):F.length>0?e(Z,{carousel:!0,itemCount:F.length,children:F.map(ee)}):e("div",{className:Pe.emptyState,children:e("p",{children:"No latest releases available right now."})})]});case"trending":return e("section",{children:[e("div",{className:X["section-header"],children:[e("div",{className:X["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(he,{ariaLabel:"Trending sort",value:p,onChange:N,options:$n.map(a=>({value:a.value,label:a.label}))}),e(he,{ariaLabel:"Trending type",value:r,onChange:a=>w(a),options:[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})]})]}),U?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((a,f)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},f))}):C.length>0?e(Z,{carousel:!0,itemCount:C.length,children:C.map(ee)}):e("div",{className:Pe.emptyState,children:e("p",{children:"No trending content available right now."})})]})}};return e("div",{style:{paddingBottom:"2rem"},children:[e(Z,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/tv-watchlist/Continue Watching",loading:h,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(_e,{icon:"tv",text:"You haven't watched anything yet. Search TV & Movies and start watching to track progress.",actionLabel:"Browse TV & Movies",onAction:()=>n("/tv-search")}),children:u.map(a=>{const f=a.currentTime??0,y=a.duration??0,D=a.season??1,K=a.episode??1,z=a.mediaType==="movie",j=z?"Movie":`S${D} E${K}`,te=a.completed===1||y>0&&f>=y*.8,ae=te?100:y>0&&f>0?f/y*100:0,fe=te?"Watched":y>0?z?`${ne(f)} / ${ne(y)}`:`${j} · ${ne(f)} / ${ne(y)}`:j;return e(me,{item:{id:a.id,title:a.title||"",thumbnail:a.poster||"",typeBadge:z?"Movie":"TV",chapterBadge:j,isAdult:Lt({adult:a.adult===1})},linkTo:Rt(a.mediaType,a.tmdbId??0,z?void 0:D,z?void 0:K),hoverIcon:"play",progress:(y>0||te)&&ae>0?{percent:ae,label:fe}:void 0,showProgress:!0,metaRow:a.year?e("span",{style:{opacity:.75},children:a.year}):void 0,onRemove:()=>i({libId:a.id,title:a.title||""}),renderPopup:(be,re)=>e(kt,{item:{id:a.tmdbId??0,title:a.title||"",year:a.year||"",type:a.mediaType||"tv",image:a.poster||""},anchorRect:be,onMouseEnter:re.onMouseEnter,onMouseLeave:re.onMouseLeave,onRequestClose:re.close})},a.id)})}),e(pe,{ariaLabel:"Browse TV",options:Ln,value:d,onChange:T}),e("div",{children:H()}),e(qe,{isOpen:!!l,itemName:l?.title,progressKind:"watch",listLabel:"my TV watchlist",onClose:()=>{i(null)},onConfirm:M})]})};function xn(n){const s=n.currentTime??0,h=n.duration??0,t=(n.trackIndex??0)+1;return h>0?`Track ${t} · ${ne(s)} / ${ne(h)}`:n.trackLabel?`Track ${t} · ${n.trackLabel}`:`Track ${t}`}const Bn=({title:n="Continue Listening",limit:s=24,titleLink:h,showEmptyState:t=!0})=>{const o=J(),{data:l,isLoading:i}=Pt(s),[d,T]=E(null),_=l?.data??[];return e(se,{children:[e(Z,{title:n,eyebrow:"Pick up where you left off",titleLink:h??"/listening-list/Continue Listening",loading:i,carousel:!0,collapsible:!0,defaultExpanded:_.length>0,highlight:!0,itemCount:_.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"16 / 9"}}),skeletonCount:7,emptyState:t?e(_e,{icon:"headphones",text:"You haven't listened to anything yet. Browse ASMR and play a track to start tracking.",actionLabel:"Browse ASMR",onAction:()=>o("/asmr")}):void 0,children:_.map(m=>{const p=m.currentTime??0,N=m.duration??0,r=m.rjCode||m.id;return e(me,{item:{id:m.id,title:m.title||"",thumbnail:m.thumbnail||"",chapterBadge:`Track ${(m.trackIndex??0)+1}`,isAdult:!!m.isAdult},linkTo:`/asmr/${encodeURIComponent(r)}`,hoverIcon:"play",layout:"horizontal",progress:N>0?{percent:Math.min(100,p/N*100),label:xn(m)??""}: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:()=>T({workId:m.id,title:m.title||""}),rawThumbnail:!0},m.id)})}),e(Bt,{workId:d?d.workId:null,title:d?.title,onClose:()=>T(null)})]})},Pn=()=>e("div",{style:{paddingBottom:"2rem"},children:e(Bn,{})}),En=({items:n})=>{const s=J(),h=Q(()=>n.slice(0,6).map(t=>{const o=$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:o,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(l=>Mt[l]??xt[l]).filter(Boolean),synopsis:we(t.overview,200),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>s(o),onDetails:()=>s(o)}}),[n,s]);return e(ve,{slides:h,eyebrow:"TV Spotlight"})},Dn=({mangaList:n})=>{const s=J(),h=Q(()=>n.slice(0,6).map(t=>{const o=`/manga/${t.provider||"mangadex"}/${t.id}`,l=Ce(t.provider||"mangadex",t.cover||"");return{key:`${t.provider}-${t.id}`,bannerSrc:l,posterSrc:l,posterAlt:t.title,title:t.title,detailTo:o,metaItems:[t.year?String(t.year):void 0,t.status??void 0].filter(i=>!!i),tags:t.tags.slice(0,3),synopsis:we(t.description,200,""),primaryLabel:"Read Now",primaryIcon:"book",onPrimary:()=>s(o),onDetails:()=>s(o)}}),[n,s]);return e(ve,{slides:h,eyebrow:"Manga Spotlight"})};function Wn(n){const s=n.availableEpisodes?.sub;if(typeof s=="number"&&s>0)return s;const h=n.availableEpisodesDetail?.sub,t=n.availableEpisodesDetail?.dub,o=(Array.isArray(h)?h.length:0)+(Array.isArray(t)?t.length:0);return o>0?o:null}const On=({works:n})=>{const s=J(),h=Q(()=>n.slice(0,6).map((t,o)=>{const l=Et(t),i=`/asmr/${encodeURIComponent(l)}`,d=Wn(t);return{key:l||t._id||String(o),bannerSrc:t.thumbnail||"",posterSrc:t.thumbnail||"",posterAlt:t.name,title:t.name,detailTo:i,metaItems:[t.rating?t.rating.toUpperCase():void 0,d?`${d} track${d===1?"":"s"}`:void 0].filter(T=>!!T),tags:[],synopsis:we(t.description,160,""),primaryLabel:"Listen Now",primaryIcon:"play",onPrimary:()=>s(i),onDetails:()=>s(i)}}),[n,s]);return e(ve,{slides:h,eyebrow:"ASMR Spotlight",posterAspect:"landscape"})},Vn=[{value:"anime",label:"Anime"},{value:"manga",label:"Manga"},{value:"tv",label:"TV & Movies"},{value:"asmr",label:"ASMR"}],mr=()=>{const n=Je(),s=lt(),[h,t]=G.useState(1),[o,l]=E(()=>localStorage.getItem("home_activeTab")||"latest"),[i,d]=E(()=>localStorage.getItem("season_format")||"TV"),T=q(null),{data:_}=Le(h+1,i,o==="season"),{titlePreference:m}=Ve(),{contentType:p,setContentType:N}=it(),[r,w]=G.useState(null),u=ct(),{data:c=[]}=dt(),g=ut(),k=ht(),S=pt();O(()=>{document.title="Home - dango"},[]);const{data:A,isLoading:$}=mt();O(()=>{localStorage.setItem("home_activeTab",o)},[o]),O(()=>{localStorage.setItem("season_format",i),t(1)},[i]),O(()=>{A!==void 0&&A.length===0&&o==="week"&&l("latest")},[A,o]);const{data:R,isLoading:C,fetchNextPage:U,hasNextPage:x,isFetchingNextPage:I}=gt(),F=P(()=>{x&&!I&&!C&&U()},[x,I,C,U]),{data:M,isLoading:ee}=vt(),{data:H,isLoading:a}=He("all","week",1,p==="tv"),{data:f,isLoading:y}=Dt(p==="asmr"),{data:D,isLoading:K}=Nt(),z=Q(()=>R?.pages||[],[R]),{data:j,isLoading:te}=Le(h,i,o==="season"),ae=14,fe=j&&j.length>=ae&&_&&_.length>0,be=et(s.continueWatching.remove.mutationOptions({onSuccess:async()=>{n.invalidateQueries(s.continueWatching.pathFilter()),await n.invalidateQueries({queryKey:[Oe.continueWatching]}),x&&z.length-1<14&&U()}})),re=P(W=>{const Y=z?.find(ye=>String(ye.id)===String(W));if(Y){const ye=Y[m]||Y.name;w({id:W,name:ye})}},[z,m]),Ie=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Ae=A!==void 0&&A.length>0,Xe=Ae?[{key:"week",label:"This Week"},...Ie]:Ie,Re=o==="week"&&!Ae?"latest":o,Ke=()=>{switch(Re){case"latest":return e(la,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:X["section-header"],ref:T,children:[e("div",{className:X["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(he,{ariaLabel:"Season format",width:90,value:i,onChange:d,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:X["pagination-controls"],children:e(tt,{page:h,canGoNext:fe,onChange:W=>{if(t(W),T.current){const Y=T.current.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:Y,behavior:"smooth"})}},isLoading:te})})]})]}),e("div",{className:`grid-container ${X.seasonGrid}`,style:{minHeight:"300px",alignContent:"start"},children:te?e(De,{count:ae}):j?.slice(0,ae).map(W=>e(le,{anime:W},W._id))})]});case"popular":return e(ra,{title:"Trending",eyebrow:"Discover"});case"week":return e(Me,{title:"This Week",eyebrow:"Aired this week",animeList:A||[],continueWatching:!1,carousel:!0,loading:$});default:return null}};return e("div",{style:{paddingBottom:"2rem"},children:[p==="anime"&&(ee&&!M?.length?e(ce,{}):M&&M.length>0&&e(pn,{animeList:M})),p==="tv"&&(a&&!H?.results?.length?e(ce,{}):H?.results&&H.results.length>0&&e(En,{items:H.results})),p==="manga"&&(K&&!D?.length?e(ce,{}):D&&D.length>0&&e(Dn,{mangaList:D})),p==="asmr"&&(y&&!f?.length?e(ce,{}):f&&f.length>0&&e(On,{works:f})),e(pe,{ariaLabel:"Content type",options:Vn,value:p,onChange:N}),p==="manga"?e(In,{}):p==="tv"?e(Mn,{}):p==="asmr"?e(Pn,{}):e(se,{children:[e(Me,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:z,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:z.length>0,onRemove:re,loading:C,onReachThreshold:F,scrollThreshold:.7,isFetchingNextPage:I,emptyState:e(_e,{icon:"history",text:"You haven't watched anything yet. Start exploring and watch something first!",actionLabel:"Explore Trending",onAction:()=>l("popular")})}),e(ft,{title:"Queue",eyebrow:"Up next",items:c,onRemove:W=>g.mutate({showId:W.showId,episodeNumber:W.episodeNumber}),showClearAll:!0,onClear:()=>k.mutate(),onReorder:W=>S.mutate(W.map(Y=>({id:Y.id,showId:Y.showId,episodeNumber:Y.episodeNumber})))}),e(pe,{ariaLabel:"Browse anime",options:Xe.map(W=>({value:W.key,label:W.label})),value:Re,onChange:l}),e("div",{children:Ke()}),e(Ra,{eyebrow:"Never miss an episode"}),e(qe,{isOpen:!!r,itemName:r?.name,progressKind:"watch",listLabel:"my watchlist",onClose:()=>{w(null)},onConfirm:W=>{r&&(be.mutate({showId:r.id}),W&&u.mutate({id:r.id}))}})]})]})};export{mr as default};
@@ -1 +1 @@
1
- import{h as P,T as c,d as O,u as e,L as A}from"./vendor-core-DfaOB3Rn.js";import{b as S,u as F,a as q}from"./vendor-query-BBT5_sHx.js";import{q as _,t as g,$ as V,d as Y,A as L,f as B}from"./index-DB81Su4I.js";import{I as l}from"./vendor-icons-DrybRNxP.js";const H="_header_1geik_1",E="_fadeIn_1geik_1",U="_personaBadge_1geik_9",z="_personaInfo_1geik_37",K="_personaLabel_1geik_42",Q="_personaValue_1geik_51",j="_statsGrid_1geik_57",J="_slideUpIn_1geik_1",X="_statCard_1geik_65",Z="_statIcon_1geik_82",ee="_statInfo_1geik_98",ae="_statValue_1geik_103",te="_statLabel_1geik_112",se="_wideSection_1geik_120",ne="_sectionHeader_1geik_132",re="_yearSelect_1geik_147",ie="_heatmapLayout_1geik_176",le="_dayLabels_1geik_183",oe="_heatmapWrapper_1geik_195",ce="_heatmapMonthLabels_1geik_201",de="_heatmapGrid_1geik_212",he="_heatBox_1geik_220",me="_hiddenBox_1geik_229",_e="_level0_1geik_240",ge="_level1_1geik_243",pe="_level2_1geik_247",ue="_level3_1geik_251",ke="_level4_1geik_255",Ne="_heatmapFooter_1geik_260",ve="_heatLegend_1geik_267",ye="_chartsContainer_1geik_277",be="_chartWrapper_1geik_285",fe="_hourlyChart_1geik_312",Ce="_hourlyBarContainer_1geik_320",Se="_hourlyBar_1geik_320",Le="_hourlyLabel_1geik_346",Be="_chartSubtext_1geik_353",we="_popScale_1geik_365",Ie="_popTrack_1geik_369",De="_popThumb_1geik_377",xe="_popLabels_1geik_389",Te="_popDescription_1geik_399",$e="_seasonalChart_1geik_414",Me="_seasonalBarContainer_1geik_422",Re="_seasonalBar_1geik_422",Ge="_seasonalLabel_1geik_444",We="_genreList_1geik_452",Pe="_genreRow_1geik_459",Oe="_genreInfo_1geik_465",Ae="_genreName_1geik_472",Fe="_genreCount_1geik_479",qe="_genreBarBg_1geik_486",Ve="_genreBar_1geik_486",Ye="_warningSection_1geik_499",He="_warningHeader_1geik_510",Ee="_droppedGrid_1geik_526",Ue="_droppedCard_1geik_532",ze="_droppedName_1geik_549",Ke="_droppedDate_1geik_556",Qe="_genreGrid_1geik_597",je="_genreCard_1geik_609",Je="_rankBadge_1geik_618",Xe="_rankNumber_1geik_631",Ze="_genreTitle_1geik_637",ea="_genreStats_1geik_645",aa="_posterRow_1geik_653",ta="_miniPoster_1geik_660",sa="_genreCardSkeleton_1geik_674",na="_pulse_1geik_1",ra="_skeletonRank_1geik_682",ia="_skeletonTitle_1geik_696",la="_skeletonStats_1geik_709",oa="_skeletonPosters_1geik_721",ca="_recSection_1geik_752",da="_recSubtext_1geik_763",ha="_recGrid_1geik_769",ma="_recCard_1geik_775",_a="_recCover_1geik_790",ga="_recInfo_1geik_798",pa="_recTitle_1geik_805",ua="_recMatch_1geik_816",ka="_recMeta_1geik_822",Na="_recWhy_1geik_827",va="_recNote_1geik_832",ya="_recAddBtn_1geik_838",ba="_loading_1geik_860",fa="_error_1geik_866",a={header:H,fadeIn:E,personaBadge:U,personaInfo:z,personaLabel:K,personaValue:Q,statsGrid:j,slideUpIn:J,statCard:X,statIcon:Z,statInfo:ee,statValue:ae,statLabel:te,wideSection:se,sectionHeader:ne,yearSelect:re,heatmapLayout:ie,dayLabels:le,heatmapWrapper:oe,heatmapMonthLabels:ce,heatmapGrid:de,heatBox:he,hiddenBox:me,level0:_e,level1:ge,level2:pe,level3:ue,level4:ke,heatmapFooter:Ne,heatLegend:ve,chartsContainer:ye,chartWrapper:be,hourlyChart:fe,hourlyBarContainer:Ce,hourlyBar:Se,hourlyLabel:Le,chartSubtext:Be,popScale:we,popTrack:Ie,popThumb:De,popLabels:xe,popDescription:Te,seasonalChart:$e,seasonalBarContainer:Me,seasonalBar:Re,seasonalLabel:Ge,genreList:We,genreRow:Pe,genreInfo:Oe,genreName:Ae,genreCount:Fe,genreBarBg:qe,genreBar:Ve,warningSection:Ye,warningHeader:He,droppedGrid:Ee,droppedCard:Ue,droppedName:ze,droppedDate:Ke,genreGrid:Qe,genreCard:je,rankBadge:Je,rankNumber:Xe,genreTitle:Ze,genreStats:ea,posterRow:aa,miniPoster:ta,genreCardSkeleton:sa,pulse:na,skeletonRank:ra,skeletonTitle:ia,skeletonStats:la,skeletonPosters:oa,recSection:ca,recSubtext:da,recGrid:ha,recCard:ma,recCover:_a,recInfo:ga,recTitle:pa,recMatch:ua,recMeta:ka,recWhy:Na,recNote:va,recAddBtn:ya,loading:ba,error:fa},wa=()=>{P(()=>{document.title="Insights - dango"},[]);const{data:n,isLoading:w,isError:I}=S({queryKey:[_.insights],queryFn:async()=>await g.insights.summary.query()}),{data:D,isLoading:p}=V(),{titlePreference:x}=Y(),u=F(),{data:k}=S({queryKey:[_.insightsRecommendations],queryFn:async()=>await g.insights.recommendations.query(),staleTime:300*1e3,retry:1}),N=q({mutationFn:async t=>{await g.watchlist.add.mutate({id:String(t.id),name:t.title,thumbnail:t.cover||"",status:"Plan to Watch",type:t.format})},onSuccess:()=>{u.invalidateQueries({queryKey:[_.watchlist]}),u.invalidateQueries({queryKey:[_.insightsRecommendations]}),L.success("Added to Plan to Watch")},onError:()=>L.error("Could not add to watchlist")}),v=c(()=>[...k?.candidates||[]].sort((t,s)=>s.matchPct-t.matchPct).slice(0,6),[k]),y=t=>{const s=t.name||t.englishName||t.nativeName||"";switch(x){case"nativeName":return t.nativeName||s;case"englishName":return t.englishName||s;default:return s}},[d,T]=O(new Date().getFullYear()),$=c(()=>{if(!n?.activityGrid)return[new Date().getFullYear()];const t=new Set(n.activityGrid.map(s=>parseInt(s.day.split("-")[0])));return t.add(new Date().getFullYear()),Array.from(t).sort((s,r)=>r-s)},[n]),b=c(()=>{if(!n?.activityGrid)return[];const t=new Map(n.activityGrid.map(m=>[m.day,m.count])),s=[],r=new Date(d,0,1),o=new Date(d,11,31),h=r.getDay(),i=new Date(r);for(i.setDate(i.getDate()-h);(i<=o||i.getDay()!==0)&&!(i>o&&i.getDay()===0);){const m=i.getFullYear(),G=String(i.getMonth()+1).padStart(2,"0"),W=String(i.getDate()).padStart(2,"0"),f=`${m}-${G}-${W}`,C=i<r||i>o;s.push({date:f,count:C?0:t.get(f)||0,month:i.getMonth(),isOutOfRange:C}),i.setDate(i.getDate()+1)}return s},[n,d]),M=c(()=>n?.seasonality?.length?Math.max(...n.seasonality.map(t=>t.seconds),1):0,[n]),R=c(()=>n?.hourlyDist?.length?Math.max(...n.hourlyDist.map(t=>t.count),1):0,[n]);return w||p?e("div",{className:a.loading,children:"Analyzing your anime lifestyle..."}):I?e("div",{className:a.error,children:"Could not load insights. Data might be syncing."}):n?e("div",{className:"page-container",children:[e("div",{className:a.header,children:[e("h2",{className:"section-title",children:"Watch Insights"}),e("div",{className:a.personaBadge,children:[e(l,{name:"user-astronaut"}),e("div",{className:a.personaInfo,children:[e("span",{className:a.personaLabel,children:"Your Persona"}),e("span",{className:a.personaValue,children:n.persona})]})]})]}),e("div",{className:a.statsGrid,children:[e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(138, 79, 255, 0.2)",color:"var(--accent)"},children:e(l,{name:"clock"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.totalHours,"h"]}),e("span",{className:a.statLabel,children:"Watch Time"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(167, 139, 250, 0.2)",color:"#a78bfa"},children:e(l,{name:"bookmark"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.totalAnime}),e("span",{className:a.statLabel,children:"Total Anime"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.totalEpisodes}),e("span",{className:a.statLabel,children:"Episodes Watched"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.completionRate,"%"]}),e("span",{className:a.statLabel,children:"Completion Rate"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(45, 212, 191, 0.2)",color:"#2dd4bf"},children:e(l,{name:"tv"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.completedAnime}),e("span",{className:a.statLabel,children:"Completed Shows"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(239, 68, 68, 0.2)",color:"#ef4444"},children:e(l,{name:"fire"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.bingeFactor}),e("span",{className:a.statLabel,children:"Max Daily Binge"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(59, 130, 246, 0.2)",color:"#3b82f6"},children:e(l,{name:"history"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.avgSessionMinutes,"m"]}),e("span",{className:a.statLabel,children:"Avg. Session"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(251, 191, 36, 0.2)",color:"#fbbf24"},children:e(l,{name:"layer-group"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.avgCompletionDays,"d"]}),e("span",{className:a.statLabel,children:"Avg. Speed"})]})]})]}),e("div",{className:a.wideSection,children:[e("div",{className:a.sectionHeader,children:[e("h3",{children:"Activity"}),e("select",{className:a.yearSelect,value:d,onChange:t=>T(Number(t.currentTarget.value)),children:$.map(t=>e("option",{value:t,children:t},t))})]}),e("div",{className:a.heatmapLayout,children:[e("div",{className:a.dayLabels,children:[e("span",{style:{gridRow:2},children:"Mon"}),e("span",{style:{gridRow:4},children:"Wed"}),e("span",{style:{gridRow:6},children:"Fri"})]}),e("div",{className:a.heatmapWrapper,children:[e("div",{className:a.heatmapMonthLabels,children:(()=>{const t=[];let s=-1;return b.forEach((r,o)=>{if(r.month!==s&&!r.isOutOfRange){const h=Math.floor(o/7)+1;h>(t.length>0?t[t.length-1].props.style?.gridColumn+2:-1)&&(t.push(e("span",{style:{gridColumn:h,whiteSpace:"nowrap"},children:new Date(0,r.month).toLocaleString("default",{month:"short"})},o)),s=r.month)}}),t})()}),e("div",{className:a.heatmapGrid,children:b.map((t,s)=>{let r=0;return t.count>0&&!t.isOutOfRange&&(r=1),t.count>2&&!t.isOutOfRange&&(r=2),t.count>5&&!t.isOutOfRange&&(r=3),t.count>10&&!t.isOutOfRange&&(r=4),e("div",{className:`${a.heatBox} ${a[`level${r}`]} ${t.isOutOfRange?a.hiddenBox:""}`,title:t.isOutOfRange?"":`${t.count} episodes on ${t.date}`},s)})}),e("div",{className:a.heatmapFooter,children:e("div",{className:a.heatLegend,children:[e("span",{children:"Less"}),e("div",{className:`${a.heatBox} ${a.level0}`}),e("div",{className:`${a.heatBox} ${a.level1}`}),e("div",{className:`${a.heatBox} ${a.level2}`}),e("div",{className:`${a.heatBox} ${a.level3}`}),e("div",{className:`${a.heatBox} ${a.level4}`}),e("span",{children:"More"})]})})]})]})]}),e("div",{className:a.chartsContainer,children:[e("div",{className:a.chartWrapper,children:[e("h3",{children:"Time Distribution (24h)"}),e("div",{className:a.hourlyChart,children:n.hourlyDist?.map((t,s)=>e("div",{className:a.hourlyBarContainer,children:[e("div",{className:a.hourlyBar,style:{height:`${t.count/R*100||2}%`,width:"100%",maxWidth:"12px"},title:`${t.count} watches at ${t.hour}:00`}),e("span",{className:a.hourlyLabel,style:{visibility:s%4===0?"visible":"hidden"},children:t.hour})]},s))}),e("div",{className:a.chartSubtext,children:(()=>{if(!n.hourlyDist?.length)return"Watch more to see your peak hours!";const t=parseInt([...n.hourlyDist].sort((s,r)=>r.count-s.count)[0].hour);return t>=6&&t<19?"You prefer daytime watching ☀️":"You're a confirmed Night Owl 🦉"})()})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Popularity Bias"}),e("div",{className:a.popScale,children:[e("div",{className:a.popTrack,children:e("div",{className:a.popThumb,style:{left:`${Math.max(0,Math.min(100,100-n.popularityScore*10))}%`}})}),e("div",{className:a.popLabels,children:[e("span",{children:"Mainstream"}),e("span",{children:"Underground"})]})]}),e("p",{className:a.popDescription,children:["Your taste score is ",e("strong",{children:[n.popularityScore,"/10"]}),".",n.popularityScore>=5?" You follow the big hits!":" You're a connoisseur of the obscure!"]})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Monthly Activity"}),e("div",{className:a.seasonalChart,children:n.seasonality?.map((t,s)=>e("div",{className:a.seasonalBarContainer,children:[e("div",{className:a.seasonalBar,style:{height:`${t.seconds/M*100||5}%`,width:"100%",maxWidth:"24px"},title:`${Math.round(t.seconds/3600)}h in ${new Date(0,s).toLocaleString("default",{month:"long"})}`}),e("span",{className:a.seasonalLabel,children:new Date(0,s).toLocaleString("default",{month:"short"})})]},s))})]})]}),e("div",{className:a.genreGrid,children:p?Array.from({length:4}).map((t,s)=>e("div",{className:a.genreCardSkeleton,children:[e("div",{className:a.skeletonRank}),e("div",{className:a.skeletonTitle}),e("div",{className:a.skeletonStats}),e("div",{className:a.skeletonPosters})]},s)):D?.map(t=>e("div",{className:a.genreCard,children:[e("div",{className:a.rankBadge,children:e("span",{className:a.rankNumber,children:t.rank})}),e("h3",{className:a.genreTitle,children:t.name}),e("div",{className:a.genreStats,children:[e("span",{children:[t.count," episodes"]}),e("span",{children:t.meanScore>0?`${t.meanScore.toFixed(1)} avg score`:"-"}),e("span",{children:t.timeWatched})]}),e("div",{className:a.posterRow,children:t.topShows.map(s=>e("img",{src:B(s.thumbnail),alt:y(s),className:a.miniPoster,title:y(s),loading:"lazy",decoding:"async"},s.id))})]},t.name))}),v.length>0&&e("div",{className:a.recSection,children:[e("h3",{children:"Recommended For You"}),e("p",{className:a.recSubtext,children:"From your library taste - updates automatically as you watch"}),e("div",{className:a.recGrid,children:v.map(t=>e("div",{className:a.recCard,children:[t.cover&&e("img",{src:B(t.cover),alt:t.title,className:a.recCover,loading:"lazy",decoding:"async"}),e("div",{className:a.recInfo,children:[e(A,{to:`/anime/${t.id}`,className:a.recTitle,children:t.title}),e("span",{className:a.recMatch,children:[t.matchPct,"% match"]}),e("span",{className:a.recMeta,children:[t.year,t.format,t.episodes?`${t.episodes}ep`:null].filter(Boolean).join(" · ")}),e("span",{className:a.recWhy,children:["Shares ",t.sharedGenres.join(", "),t.exemplars.length>0&&` - like ${t.exemplars.join(", ")}`]}),t.kind==="continue"&&e("span",{className:a.recNote,children:"Continue - you watched the earlier part."}),t.kind==="sequel"&&t.prequelTitle&&e("span",{className:a.recNote,children:['Sequel - start with "',t.prequelTitle,'" first.']}),e("button",{className:a.recAddBtn,onClick:()=>N.mutate(t),disabled:N.isPending,children:"+ Plan to Watch"})]})]},t.id))})]}),n.droppedShows?.length>0&&e("div",{className:a.warningSection,children:[e("div",{className:a.warningHeader,children:[e(l,{name:"exclamation-triangle"}),e("h3",{children:"Dusty Watchlist (Inactive 90+ days)"})]}),e("div",{className:a.droppedGrid,children:n.droppedShows.map(t=>e("div",{className:a.droppedCard,children:[e("span",{className:a.droppedName,children:t.name}),e("span",{className:a.droppedDate,children:["Last watched: ",new Date(t.lastActivity).toLocaleDateString()]})]},t.id))})]})]}):null};export{wa as default};
1
+ import{h as P,T as c,d as O,u as e,L as A}from"./vendor-core-DfaOB3Rn.js";import{b as S,u as F,a as q}from"./vendor-query-BBT5_sHx.js";import{q as _,t as g,$ as V,d as Y,A as L,f as B}from"./index-DlcgJVM6.js";import{I as l}from"./vendor-icons-DrybRNxP.js";const H="_header_1geik_1",E="_fadeIn_1geik_1",U="_personaBadge_1geik_9",z="_personaInfo_1geik_37",K="_personaLabel_1geik_42",Q="_personaValue_1geik_51",j="_statsGrid_1geik_57",J="_slideUpIn_1geik_1",X="_statCard_1geik_65",Z="_statIcon_1geik_82",ee="_statInfo_1geik_98",ae="_statValue_1geik_103",te="_statLabel_1geik_112",se="_wideSection_1geik_120",ne="_sectionHeader_1geik_132",re="_yearSelect_1geik_147",ie="_heatmapLayout_1geik_176",le="_dayLabels_1geik_183",oe="_heatmapWrapper_1geik_195",ce="_heatmapMonthLabels_1geik_201",de="_heatmapGrid_1geik_212",he="_heatBox_1geik_220",me="_hiddenBox_1geik_229",_e="_level0_1geik_240",ge="_level1_1geik_243",pe="_level2_1geik_247",ue="_level3_1geik_251",ke="_level4_1geik_255",Ne="_heatmapFooter_1geik_260",ve="_heatLegend_1geik_267",ye="_chartsContainer_1geik_277",be="_chartWrapper_1geik_285",fe="_hourlyChart_1geik_312",Ce="_hourlyBarContainer_1geik_320",Se="_hourlyBar_1geik_320",Le="_hourlyLabel_1geik_346",Be="_chartSubtext_1geik_353",we="_popScale_1geik_365",Ie="_popTrack_1geik_369",De="_popThumb_1geik_377",xe="_popLabels_1geik_389",Te="_popDescription_1geik_399",$e="_seasonalChart_1geik_414",Me="_seasonalBarContainer_1geik_422",Re="_seasonalBar_1geik_422",Ge="_seasonalLabel_1geik_444",We="_genreList_1geik_452",Pe="_genreRow_1geik_459",Oe="_genreInfo_1geik_465",Ae="_genreName_1geik_472",Fe="_genreCount_1geik_479",qe="_genreBarBg_1geik_486",Ve="_genreBar_1geik_486",Ye="_warningSection_1geik_499",He="_warningHeader_1geik_510",Ee="_droppedGrid_1geik_526",Ue="_droppedCard_1geik_532",ze="_droppedName_1geik_549",Ke="_droppedDate_1geik_556",Qe="_genreGrid_1geik_597",je="_genreCard_1geik_609",Je="_rankBadge_1geik_618",Xe="_rankNumber_1geik_631",Ze="_genreTitle_1geik_637",ea="_genreStats_1geik_645",aa="_posterRow_1geik_653",ta="_miniPoster_1geik_660",sa="_genreCardSkeleton_1geik_674",na="_pulse_1geik_1",ra="_skeletonRank_1geik_682",ia="_skeletonTitle_1geik_696",la="_skeletonStats_1geik_709",oa="_skeletonPosters_1geik_721",ca="_recSection_1geik_752",da="_recSubtext_1geik_763",ha="_recGrid_1geik_769",ma="_recCard_1geik_775",_a="_recCover_1geik_790",ga="_recInfo_1geik_798",pa="_recTitle_1geik_805",ua="_recMatch_1geik_816",ka="_recMeta_1geik_822",Na="_recWhy_1geik_827",va="_recNote_1geik_832",ya="_recAddBtn_1geik_838",ba="_loading_1geik_860",fa="_error_1geik_866",a={header:H,fadeIn:E,personaBadge:U,personaInfo:z,personaLabel:K,personaValue:Q,statsGrid:j,slideUpIn:J,statCard:X,statIcon:Z,statInfo:ee,statValue:ae,statLabel:te,wideSection:se,sectionHeader:ne,yearSelect:re,heatmapLayout:ie,dayLabels:le,heatmapWrapper:oe,heatmapMonthLabels:ce,heatmapGrid:de,heatBox:he,hiddenBox:me,level0:_e,level1:ge,level2:pe,level3:ue,level4:ke,heatmapFooter:Ne,heatLegend:ve,chartsContainer:ye,chartWrapper:be,hourlyChart:fe,hourlyBarContainer:Ce,hourlyBar:Se,hourlyLabel:Le,chartSubtext:Be,popScale:we,popTrack:Ie,popThumb:De,popLabels:xe,popDescription:Te,seasonalChart:$e,seasonalBarContainer:Me,seasonalBar:Re,seasonalLabel:Ge,genreList:We,genreRow:Pe,genreInfo:Oe,genreName:Ae,genreCount:Fe,genreBarBg:qe,genreBar:Ve,warningSection:Ye,warningHeader:He,droppedGrid:Ee,droppedCard:Ue,droppedName:ze,droppedDate:Ke,genreGrid:Qe,genreCard:je,rankBadge:Je,rankNumber:Xe,genreTitle:Ze,genreStats:ea,posterRow:aa,miniPoster:ta,genreCardSkeleton:sa,pulse:na,skeletonRank:ra,skeletonTitle:ia,skeletonStats:la,skeletonPosters:oa,recSection:ca,recSubtext:da,recGrid:ha,recCard:ma,recCover:_a,recInfo:ga,recTitle:pa,recMatch:ua,recMeta:ka,recWhy:Na,recNote:va,recAddBtn:ya,loading:ba,error:fa},wa=()=>{P(()=>{document.title="Insights - dango"},[]);const{data:n,isLoading:w,isError:I}=S({queryKey:[_.insights],queryFn:async()=>await g.insights.summary.query()}),{data:D,isLoading:p}=V(),{titlePreference:x}=Y(),u=F(),{data:k}=S({queryKey:[_.insightsRecommendations],queryFn:async()=>await g.insights.recommendations.query(),staleTime:300*1e3,retry:1}),N=q({mutationFn:async t=>{await g.watchlist.add.mutate({id:String(t.id),name:t.title,thumbnail:t.cover||"",status:"Plan to Watch",type:t.format})},onSuccess:()=>{u.invalidateQueries({queryKey:[_.watchlist]}),u.invalidateQueries({queryKey:[_.insightsRecommendations]}),L.success("Added to Plan to Watch")},onError:()=>L.error("Could not add to watchlist")}),v=c(()=>[...k?.candidates||[]].sort((t,s)=>s.matchPct-t.matchPct).slice(0,6),[k]),y=t=>{const s=t.name||t.englishName||t.nativeName||"";switch(x){case"nativeName":return t.nativeName||s;case"englishName":return t.englishName||s;default:return s}},[d,T]=O(new Date().getFullYear()),$=c(()=>{if(!n?.activityGrid)return[new Date().getFullYear()];const t=new Set(n.activityGrid.map(s=>parseInt(s.day.split("-")[0])));return t.add(new Date().getFullYear()),Array.from(t).sort((s,r)=>r-s)},[n]),b=c(()=>{if(!n?.activityGrid)return[];const t=new Map(n.activityGrid.map(m=>[m.day,m.count])),s=[],r=new Date(d,0,1),o=new Date(d,11,31),h=r.getDay(),i=new Date(r);for(i.setDate(i.getDate()-h);(i<=o||i.getDay()!==0)&&!(i>o&&i.getDay()===0);){const m=i.getFullYear(),G=String(i.getMonth()+1).padStart(2,"0"),W=String(i.getDate()).padStart(2,"0"),f=`${m}-${G}-${W}`,C=i<r||i>o;s.push({date:f,count:C?0:t.get(f)||0,month:i.getMonth(),isOutOfRange:C}),i.setDate(i.getDate()+1)}return s},[n,d]),M=c(()=>n?.seasonality?.length?Math.max(...n.seasonality.map(t=>t.seconds),1):0,[n]),R=c(()=>n?.hourlyDist?.length?Math.max(...n.hourlyDist.map(t=>t.count),1):0,[n]);return w||p?e("div",{className:a.loading,children:"Analyzing your anime lifestyle..."}):I?e("div",{className:a.error,children:"Could not load insights. Data might be syncing."}):n?e("div",{className:"page-container",children:[e("div",{className:a.header,children:[e("h2",{className:"section-title",children:"Watch Insights"}),e("div",{className:a.personaBadge,children:[e(l,{name:"user-astronaut"}),e("div",{className:a.personaInfo,children:[e("span",{className:a.personaLabel,children:"Your Persona"}),e("span",{className:a.personaValue,children:n.persona})]})]})]}),e("div",{className:a.statsGrid,children:[e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(138, 79, 255, 0.2)",color:"var(--accent)"},children:e(l,{name:"clock"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.totalHours,"h"]}),e("span",{className:a.statLabel,children:"Watch Time"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(167, 139, 250, 0.2)",color:"#a78bfa"},children:e(l,{name:"bookmark"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.totalAnime}),e("span",{className:a.statLabel,children:"Total Anime"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.totalEpisodes}),e("span",{className:a.statLabel,children:"Episodes Watched"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.completionRate,"%"]}),e("span",{className:a.statLabel,children:"Completion Rate"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(45, 212, 191, 0.2)",color:"#2dd4bf"},children:e(l,{name:"tv"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.completedAnime}),e("span",{className:a.statLabel,children:"Completed Shows"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(239, 68, 68, 0.2)",color:"#ef4444"},children:e(l,{name:"fire"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.bingeFactor}),e("span",{className:a.statLabel,children:"Max Daily Binge"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(59, 130, 246, 0.2)",color:"#3b82f6"},children:e(l,{name:"history"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.avgSessionMinutes,"m"]}),e("span",{className:a.statLabel,children:"Avg. Session"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(251, 191, 36, 0.2)",color:"#fbbf24"},children:e(l,{name:"layer-group"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.avgCompletionDays,"d"]}),e("span",{className:a.statLabel,children:"Avg. Speed"})]})]})]}),e("div",{className:a.wideSection,children:[e("div",{className:a.sectionHeader,children:[e("h3",{children:"Activity"}),e("select",{className:a.yearSelect,value:d,onChange:t=>T(Number(t.currentTarget.value)),children:$.map(t=>e("option",{value:t,children:t},t))})]}),e("div",{className:a.heatmapLayout,children:[e("div",{className:a.dayLabels,children:[e("span",{style:{gridRow:2},children:"Mon"}),e("span",{style:{gridRow:4},children:"Wed"}),e("span",{style:{gridRow:6},children:"Fri"})]}),e("div",{className:a.heatmapWrapper,children:[e("div",{className:a.heatmapMonthLabels,children:(()=>{const t=[];let s=-1;return b.forEach((r,o)=>{if(r.month!==s&&!r.isOutOfRange){const h=Math.floor(o/7)+1;h>(t.length>0?t[t.length-1].props.style?.gridColumn+2:-1)&&(t.push(e("span",{style:{gridColumn:h,whiteSpace:"nowrap"},children:new Date(0,r.month).toLocaleString("default",{month:"short"})},o)),s=r.month)}}),t})()}),e("div",{className:a.heatmapGrid,children:b.map((t,s)=>{let r=0;return t.count>0&&!t.isOutOfRange&&(r=1),t.count>2&&!t.isOutOfRange&&(r=2),t.count>5&&!t.isOutOfRange&&(r=3),t.count>10&&!t.isOutOfRange&&(r=4),e("div",{className:`${a.heatBox} ${a[`level${r}`]} ${t.isOutOfRange?a.hiddenBox:""}`,title:t.isOutOfRange?"":`${t.count} episodes on ${t.date}`},s)})}),e("div",{className:a.heatmapFooter,children:e("div",{className:a.heatLegend,children:[e("span",{children:"Less"}),e("div",{className:`${a.heatBox} ${a.level0}`}),e("div",{className:`${a.heatBox} ${a.level1}`}),e("div",{className:`${a.heatBox} ${a.level2}`}),e("div",{className:`${a.heatBox} ${a.level3}`}),e("div",{className:`${a.heatBox} ${a.level4}`}),e("span",{children:"More"})]})})]})]})]}),e("div",{className:a.chartsContainer,children:[e("div",{className:a.chartWrapper,children:[e("h3",{children:"Time Distribution (24h)"}),e("div",{className:a.hourlyChart,children:n.hourlyDist?.map((t,s)=>e("div",{className:a.hourlyBarContainer,children:[e("div",{className:a.hourlyBar,style:{height:`${t.count/R*100||2}%`,width:"100%",maxWidth:"12px"},title:`${t.count} watches at ${t.hour}:00`}),e("span",{className:a.hourlyLabel,style:{visibility:s%4===0?"visible":"hidden"},children:t.hour})]},s))}),e("div",{className:a.chartSubtext,children:(()=>{if(!n.hourlyDist?.length)return"Watch more to see your peak hours!";const t=parseInt([...n.hourlyDist].sort((s,r)=>r.count-s.count)[0].hour);return t>=6&&t<19?"You prefer daytime watching ☀️":"You're a confirmed Night Owl 🦉"})()})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Popularity Bias"}),e("div",{className:a.popScale,children:[e("div",{className:a.popTrack,children:e("div",{className:a.popThumb,style:{left:`${Math.max(0,Math.min(100,100-n.popularityScore*10))}%`}})}),e("div",{className:a.popLabels,children:[e("span",{children:"Mainstream"}),e("span",{children:"Underground"})]})]}),e("p",{className:a.popDescription,children:["Your taste score is ",e("strong",{children:[n.popularityScore,"/10"]}),".",n.popularityScore>=5?" You follow the big hits!":" You're a connoisseur of the obscure!"]})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Monthly Activity"}),e("div",{className:a.seasonalChart,children:n.seasonality?.map((t,s)=>e("div",{className:a.seasonalBarContainer,children:[e("div",{className:a.seasonalBar,style:{height:`${t.seconds/M*100||5}%`,width:"100%",maxWidth:"24px"},title:`${Math.round(t.seconds/3600)}h in ${new Date(0,s).toLocaleString("default",{month:"long"})}`}),e("span",{className:a.seasonalLabel,children:new Date(0,s).toLocaleString("default",{month:"short"})})]},s))})]})]}),e("div",{className:a.genreGrid,children:p?Array.from({length:4}).map((t,s)=>e("div",{className:a.genreCardSkeleton,children:[e("div",{className:a.skeletonRank}),e("div",{className:a.skeletonTitle}),e("div",{className:a.skeletonStats}),e("div",{className:a.skeletonPosters})]},s)):D?.map(t=>e("div",{className:a.genreCard,children:[e("div",{className:a.rankBadge,children:e("span",{className:a.rankNumber,children:t.rank})}),e("h3",{className:a.genreTitle,children:t.name}),e("div",{className:a.genreStats,children:[e("span",{children:[t.count," episodes"]}),e("span",{children:t.meanScore>0?`${t.meanScore.toFixed(1)} avg score`:"-"}),e("span",{children:t.timeWatched})]}),e("div",{className:a.posterRow,children:t.topShows.map(s=>e("img",{src:B(s.thumbnail),alt:y(s),className:a.miniPoster,title:y(s),loading:"lazy",decoding:"async"},s.id))})]},t.name))}),v.length>0&&e("div",{className:a.recSection,children:[e("h3",{children:"Recommended For You"}),e("p",{className:a.recSubtext,children:"From your library taste - updates automatically as you watch"}),e("div",{className:a.recGrid,children:v.map(t=>e("div",{className:a.recCard,children:[t.cover&&e("img",{src:B(t.cover),alt:t.title,className:a.recCover,loading:"lazy",decoding:"async"}),e("div",{className:a.recInfo,children:[e(A,{to:`/anime/${t.id}`,className:a.recTitle,children:t.title}),e("span",{className:a.recMatch,children:[t.matchPct,"% match"]}),e("span",{className:a.recMeta,children:[t.year,t.format,t.episodes?`${t.episodes}ep`:null].filter(Boolean).join(" · ")}),e("span",{className:a.recWhy,children:["Shares ",t.sharedGenres.join(", "),t.exemplars.length>0&&` - like ${t.exemplars.join(", ")}`]}),t.kind==="continue"&&e("span",{className:a.recNote,children:"Continue - you watched the earlier part."}),t.kind==="sequel"&&t.prequelTitle&&e("span",{className:a.recNote,children:['Sequel - start with "',t.prequelTitle,'" first.']}),e("button",{className:a.recAddBtn,onClick:()=>N.mutate(t),disabled:N.isPending,children:"+ Plan to Watch"})]})]},t.id))})]}),n.droppedShows?.length>0&&e("div",{className:a.warningSection,children:[e("div",{className:a.warningHeader,children:[e(l,{name:"exclamation-triangle"}),e("h3",{children:"Dusty Watchlist (Inactive 90+ days)"})]}),e("div",{className:a.droppedGrid,children:n.droppedShows.map(t=>e("div",{className:a.droppedCard,children:[e("span",{className:a.droppedName,children:t.name}),e("span",{className:a.droppedDate,children:["Last watched: ",new Date(t.lastActivity).toLocaleDateString()]})]},t.id))})]})]}):null};export{wa as default};
@@ -1 +1 @@
1
- import{a as ie,d as N,h as re,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as h}from"./vendor-icons-DrybRNxP.js";import{P as E}from"./MediaCard-hWGCEHWx.js";import{S as de}from"./SkeletonGrid-QWMGLCGp.js";import{E as oe}from"./ErrorMessage-DAxegITP.js";import{C as me,D as he,M as k,B as q}from"./index-DB81Su4I.js";import{s as l}from"./LibraryListPage.module-r6k9nyT9.js";function be({headerTitle:H,headerSubtitle:O,filters:U,filterBy:r,filterBasePath:V,continueFilter:W,statusOptions:$,entries:d,total:o,isLoading:f,error:A,page:M,pageSize:u,onPageChange:I,emptyTitle:Y,emptyFilteredText:j,emptyAllText:F,browseLabel:J,browseTarget:Q,removeListLabel:w,listNoun:S,skipConfirmKey:x,onBulkStatus:X,onBulkRemove:B,onStatusChange:Z,onRemoveItem:R,renderCard:_,modals:K}){const z=ie(),[g,T]=N(!1),[t,i]=N(new Set),[n,p]=N(null),[P,b]=N(!1),{data:y}=me(x),L=he();re(()=>{i(new Set),T(!1)},[r]);const m=r===W,D=String(y)==="true"||String(y)==="1",ee=()=>{T(a=>(a&&i(new Set),!a))},ae=a=>{i(s=>{const c=new Set(s);return c.has(a)?c.delete(a):c.add(a),c})},v=d.map(a=>a.libId),C=v.length>0&&v.every(a=>t.has(a)),le=()=>{i(a=>{const s=new Set(a);if(C)for(const c of v)s.delete(c);else for(const c of v)s.add(c);return s})},te=a=>{t.size!==0&&(X([...t],a),i(new Set))},se=()=>{t.size!==0&&(m||D?(B([...t]),i(new Set)):p({ids:[...t]}))},ne=a=>{m||D?R(a.libId):p({ids:[a.libId],title:a.title})},ce=()=>{n&&(P&&L.mutate({key:x,value:!0}),n.ids.length===1?R(n.ids[0]):B(n.ids),i(new Set),p(null),b(!1))},G=()=>{p(null),b(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:H}),e("p",{className:l.subtitle,children:O})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:U.map(a=>e("button",{className:`${l.filterBtn} ${r===a?l.active:""}`,onClick:()=>z(`${V}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[r,e("span",{className:l.itemCount,children:["(",o," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:ee,children:[e(h,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),o>0&&e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:I,isLoading:f})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:le,children:[e("span",{className:`${l.selectAllBox} ${C?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:C?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[t.size," selected"]}),e("div",{className:l.manageSpacer}),!m&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&te(a.currentTarget.value)},disabled:t.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:t.size===0,children:[e(h,{name:"trash",size:13}),e("span",{children:m?"Reset Selected":"Remove Selected"})]})]}),f?e(de,{}):A?e(oe,{message:A.message}):d.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:Y}),e("p",{className:l.emptyText,children:r!=="All"?j:F}),e("button",{className:l.emptyBtn,onClick:()=>z(Q),children:[e(h,{name:"search",size:14}),e("span",{children:J})]})]}):e("div",{className:l.grid,children:d.map(a=>e("div",{className:`${l.itemWrapper} ${t.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ae(a.libId),title:t.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:t.has(a.libId)?e(h,{name:"check",size:12}):null})}),_(a),!m&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:s=>Z(a.libId,s.currentTarget.value),children:$.map(s=>e("option",{value:s,children:s},s))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:w,"aria-label":w,children:e(h,{name:"trash",size:12})})]})]},a.key))}),o>0&&e("div",{className:l.bottomPagination,children:e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:I,isLoading:f,variant:"labeled"})}),K,e(k,{isOpen:!!n,onClose:G,title:`Remove from ${S}`,children:[e(k.Body,{children:[e("p",{children:n&&n.ids.length===1?`Are you sure you want to remove "${n.title}" from your ${S}?`:`Are you sure you want to remove ${n?.ids.length??0} selected items from your ${S}?`}),e("label",{children:[e("input",{type:"checkbox",checked:P,onChange:a=>b(a.currentTarget.checked)}),"Don't ask again"]})]}),e(k.Actions,{children:[e(q,{variant:"secondary",onClick:G,children:"No"}),e(q,{variant:"danger",onClick:ce,children:"Yes"})]})]})]})}export{be as L};
1
+ import{a as ie,d as N,h as re,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as h}from"./vendor-icons-DrybRNxP.js";import{P as E}from"./MediaCard-lz7FdOe_.js";import{S as de}from"./SkeletonGrid-pA-dcLBM.js";import{E as oe}from"./ErrorMessage-DAxegITP.js";import{C as me,D as he,M as k,B as q}from"./index-DlcgJVM6.js";import{s as l}from"./LibraryListPage.module-r6k9nyT9.js";function be({headerTitle:H,headerSubtitle:O,filters:U,filterBy:r,filterBasePath:V,continueFilter:W,statusOptions:$,entries:d,total:o,isLoading:f,error:A,page:M,pageSize:u,onPageChange:I,emptyTitle:Y,emptyFilteredText:j,emptyAllText:F,browseLabel:J,browseTarget:Q,removeListLabel:w,listNoun:S,skipConfirmKey:x,onBulkStatus:X,onBulkRemove:B,onStatusChange:Z,onRemoveItem:R,renderCard:_,modals:K}){const z=ie(),[g,T]=N(!1),[t,i]=N(new Set),[n,p]=N(null),[P,b]=N(!1),{data:y}=me(x),L=he();re(()=>{i(new Set),T(!1)},[r]);const m=r===W,D=String(y)==="true"||String(y)==="1",ee=()=>{T(a=>(a&&i(new Set),!a))},ae=a=>{i(s=>{const c=new Set(s);return c.has(a)?c.delete(a):c.add(a),c})},v=d.map(a=>a.libId),C=v.length>0&&v.every(a=>t.has(a)),le=()=>{i(a=>{const s=new Set(a);if(C)for(const c of v)s.delete(c);else for(const c of v)s.add(c);return s})},te=a=>{t.size!==0&&(X([...t],a),i(new Set))},se=()=>{t.size!==0&&(m||D?(B([...t]),i(new Set)):p({ids:[...t]}))},ne=a=>{m||D?R(a.libId):p({ids:[a.libId],title:a.title})},ce=()=>{n&&(P&&L.mutate({key:x,value:!0}),n.ids.length===1?R(n.ids[0]):B(n.ids),i(new Set),p(null),b(!1))},G=()=>{p(null),b(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:H}),e("p",{className:l.subtitle,children:O})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:U.map(a=>e("button",{className:`${l.filterBtn} ${r===a?l.active:""}`,onClick:()=>z(`${V}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[r,e("span",{className:l.itemCount,children:["(",o," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:ee,children:[e(h,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),o>0&&e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:I,isLoading:f})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:le,children:[e("span",{className:`${l.selectAllBox} ${C?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:C?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[t.size," selected"]}),e("div",{className:l.manageSpacer}),!m&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&te(a.currentTarget.value)},disabled:t.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:t.size===0,children:[e(h,{name:"trash",size:13}),e("span",{children:m?"Reset Selected":"Remove Selected"})]})]}),f?e(de,{}):A?e(oe,{message:A.message}):d.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:Y}),e("p",{className:l.emptyText,children:r!=="All"?j:F}),e("button",{className:l.emptyBtn,onClick:()=>z(Q),children:[e(h,{name:"search",size:14}),e("span",{children:J})]})]}):e("div",{className:l.grid,children:d.map(a=>e("div",{className:`${l.itemWrapper} ${t.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ae(a.libId),title:t.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:t.has(a.libId)?e(h,{name:"check",size:12}):null})}),_(a),!m&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:s=>Z(a.libId,s.currentTarget.value),children:$.map(s=>e("option",{value:s,children:s},s))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:w,"aria-label":w,children:e(h,{name:"trash",size:12})})]})]},a.key))}),o>0&&e("div",{className:l.bottomPagination,children:e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:I,isLoading:f,variant:"labeled"})}),K,e(k,{isOpen:!!n,onClose:G,title:`Remove from ${S}`,children:[e(k.Body,{children:[e("p",{children:n&&n.ids.length===1?`Are you sure you want to remove "${n.title}" from your ${S}?`:`Are you sure you want to remove ${n?.ids.length??0} selected items from your ${S}?`}),e("label",{children:[e("input",{type:"checkbox",checked:P,onChange:a=>b(a.currentTarget.checked)}),"Don't ask again"]})]}),e(k.Actions,{children:[e(q,{variant:"secondary",onClick:G,children:"No"}),e(q,{variant:"danger",onClick:ce,children:"Yes"})]})]})]})}export{be as L};
@@ -1 +1 @@
1
- import{o as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-DfaOB3Rn.js";import{M as F}from"./MediaCard-hWGCEHWx.js";import{L as N}from"./LibraryListPage-BnrEDG8j.js";import{u as _,A as q}from"./useAsmrPopup-BrrEaBlV.js";import{A as z}from"./AsmrResetProgressModal-cYO4Sr2k.js";import{g as h}from"./index-DB81Su4I.js";import{m as O,u as Q,n as Y,o as D,e as G,p as H,q as K,r as Z,A as T,k as J}from"./useAsmr-BwyYDnlP.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BnB-RHYQ.js";import"./SkeletonGrid-QWMGLCGp.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-BuESoxbY.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-DI-v-DQ1.js";const V=["All","Continue Listening",...T],A=24;function W(a){const d=a.currentTime??0,i=a.duration??0,r=(a.trackIndex??0)+1;return i>0?`Track ${r} · ${h(d)} / ${h(i)}`:`Track ${r}`}function Lt(){const{filter:a="All"}=U(),[d,i]=k(1),[r,m]=k(null);L(()=>{document.title="Listening List - dango"},[]),L(()=>{i(1)},[a]);const o=a==="Continue Listening",n=O(o?"All":a,d,A),l=Q(100),f=Y(),C=D(),{toggle:v,bookmarkedIds:R}=G(),{popup:s,openPopup:I,scheduleClose:c,cancelClose:p,closePopup:B}=_(),P=H(),S=K(),j=Z(),M=E(()=>o?(l.data?.data??[]).map(t=>{const e=t.currentTime??0,g=t.duration??0,b=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:b,title:t.title||"",thumbnail:t.thumbnail||"",status:t.watchlistStatus??"",isAdult:!!t.isAdult,trackLabel:`Track ${(t.trackIndex??0)+1}`,progressPercent:g>0?Math.min(100,e/g*100):0,progressLabel:W(t),detailTarget:`/asmr/${encodeURIComponent(b)}`}}):(n.data?.data??[]).map(t=>{const e=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:e,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:t.lastTrackIndex!==null&&t.lastTrackIndex!==void 0?`Track ${t.lastTrackIndex+1}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/asmr/${encodeURIComponent(e)}`}}),[o,l.data,n.data]),w=o?l.data?.total??0:n.data?.total??0,x=o?l.isLoading:n.isLoading,$=o?l.error:n.error;return u(N,{headerTitle:"My Listening List",headerSubtitle:"Track and manage your ASMR collection",filters:V,filterBy:a,filterBasePath:"/listening-list",continueFilter:"Continue Listening",statusOptions:[...T],entries:M,total:w,isLoading:x,error:$,page:d,pageSize:A,onPageChange:i,emptyTitle:"Your listening list is looking a bit lonely",emptyFilteredText:"No works match this filter.",emptyAllText:"Let's find something to listen to!",browseLabel:"Browse ASMR",browseTarget:"/asmr",removeListLabel:"Remove from Listening List",listNoun:"listening list",skipConfirmKey:"asmrSkipRemoveConfirmation",onBulkStatus:(t,e)=>P.mutate({ids:t,status:e}),onBulkRemove:t=>{o?j.mutate({ids:t}):S.mutate({ids:t})},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate({id:t}),renderCard:t=>u(F,{item:{id:t.libId,title:t.title,thumbnail:t.thumbnail,typeBadge:t.rjCode||void 0,chapterBadge:t.trackLabel??null,isAdult:t.isAdult},linkTo:t.detailTarget,hoverIcon:"info",layout:"horizontal",showInfoButton:!o,progress:t.progressPercent!==void 0&&t.progressLabel?{percent:t.progressPercent,label:t.progressLabel}:void 0,showProgress:o,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:o?()=>m(t):void 0,onOpenDetails:o?void 0:e=>I(e,{rjCode:t.rjCode,title:t.title,thumbnail:t.thumbnail,isAdult:t.isAdult,listenTarget:t.detailTarget,progressLabel:t.progressLabel}),onPopupHoverIntent:e=>e?p():c(),rawThumbnail:!0}),modals:u(y,{children:[u(z,{workId:r?r.libId:null,title:r?.title,onClose:()=>m(null)}),s&&u(q,{data:s.data,anchorRect:s.rect,bookmarked:R.has(J(s.data.rjCode)),onToggleBookmark:()=>v({rjCode:s.data.rjCode,title:s.data.title,thumbnail:s.data.thumbnail||"",isAdult:s.data.isAdult}),onMouseEnter:p,onMouseLeave:c,onRequestClose:B})]})})}export{Lt as default};
1
+ import{o as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-DfaOB3Rn.js";import{M as F}from"./MediaCard-lz7FdOe_.js";import{L as N}from"./LibraryListPage-BT_xDjEq.js";import{u as _,A as q}from"./useAsmrPopup-Ct9jC6X6.js";import{A as z}from"./AsmrResetProgressModal-DPHPLqPo.js";import{g as h}from"./index-DlcgJVM6.js";import{m as O,u as Q,n as Y,o as D,e as G,p as H,q as K,r as Z,A as T,k as J}from"./useAsmr-B-FYJW2L.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-Beq4JL0b.js";import"./SkeletonGrid-pA-dcLBM.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-0PvvM2XJ.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-DdnIPcOQ.js";const V=["All","Continue Listening",...T],A=24;function W(a){const d=a.currentTime??0,i=a.duration??0,r=(a.trackIndex??0)+1;return i>0?`Track ${r} · ${h(d)} / ${h(i)}`:`Track ${r}`}function Lt(){const{filter:a="All"}=U(),[d,i]=k(1),[r,m]=k(null);L(()=>{document.title="Listening List - dango"},[]),L(()=>{i(1)},[a]);const o=a==="Continue Listening",n=O(o?"All":a,d,A),l=Q(100),f=Y(),C=D(),{toggle:v,bookmarkedIds:R}=G(),{popup:s,openPopup:I,scheduleClose:c,cancelClose:p,closePopup:B}=_(),P=H(),S=K(),j=Z(),M=E(()=>o?(l.data?.data??[]).map(t=>{const e=t.currentTime??0,g=t.duration??0,b=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:b,title:t.title||"",thumbnail:t.thumbnail||"",status:t.watchlistStatus??"",isAdult:!!t.isAdult,trackLabel:`Track ${(t.trackIndex??0)+1}`,progressPercent:g>0?Math.min(100,e/g*100):0,progressLabel:W(t),detailTarget:`/asmr/${encodeURIComponent(b)}`}}):(n.data?.data??[]).map(t=>{const e=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:e,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:t.lastTrackIndex!==null&&t.lastTrackIndex!==void 0?`Track ${t.lastTrackIndex+1}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/asmr/${encodeURIComponent(e)}`}}),[o,l.data,n.data]),w=o?l.data?.total??0:n.data?.total??0,x=o?l.isLoading:n.isLoading,$=o?l.error:n.error;return u(N,{headerTitle:"My Listening List",headerSubtitle:"Track and manage your ASMR collection",filters:V,filterBy:a,filterBasePath:"/listening-list",continueFilter:"Continue Listening",statusOptions:[...T],entries:M,total:w,isLoading:x,error:$,page:d,pageSize:A,onPageChange:i,emptyTitle:"Your listening list is looking a bit lonely",emptyFilteredText:"No works match this filter.",emptyAllText:"Let's find something to listen to!",browseLabel:"Browse ASMR",browseTarget:"/asmr",removeListLabel:"Remove from Listening List",listNoun:"listening list",skipConfirmKey:"asmrSkipRemoveConfirmation",onBulkStatus:(t,e)=>P.mutate({ids:t,status:e}),onBulkRemove:t=>{o?j.mutate({ids:t}):S.mutate({ids:t})},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate({id:t}),renderCard:t=>u(F,{item:{id:t.libId,title:t.title,thumbnail:t.thumbnail,typeBadge:t.rjCode||void 0,chapterBadge:t.trackLabel??null,isAdult:t.isAdult},linkTo:t.detailTarget,hoverIcon:"info",layout:"horizontal",showInfoButton:!o,progress:t.progressPercent!==void 0&&t.progressLabel?{percent:t.progressPercent,label:t.progressLabel}:void 0,showProgress:o,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:o?()=>m(t):void 0,onOpenDetails:o?void 0:e=>I(e,{rjCode:t.rjCode,title:t.title,thumbnail:t.thumbnail,isAdult:t.isAdult,listenTarget:t.detailTarget,progressLabel:t.progressLabel}),onPopupHoverIntent:e=>e?p():c(),rawThumbnail:!0}),modals:u(y,{children:[u(z,{workId:r?r.libId:null,title:r?.title,onClose:()=>m(null)}),s&&u(q,{data:s.data,anchorRect:s.rect,bookmarked:R.has(J(s.data.rjCode)),onToggleBookmark:()=>v({rjCode:s.data.rjCode,title:s.data.title,thumbnail:s.data.thumbnail||"",isAdult:s.data.isAdult}),onMouseEnter:p,onMouseLeave:c,onRequestClose:B})]})})}export{Lt as default};
@@ -1 +1 @@
1
- import{p as le,d as E,T as re,h as O,u as a,m as ne,S as q}from"./vendor-core-DfaOB3Rn.js";import{I as M}from"./vendor-icons-DrybRNxP.js";import{T as se}from"./ToggleSwitch-CN_ppEc9.js";import{M as oe}from"./MatureConsentModal-BnB-RHYQ.js";import{E as ie}from"./ErrorMessage-DAxegITP.js";import{M as ce,P as de}from"./MediaCard-hWGCEHWx.js";import{u as ue,M as ge}from"./useMangaPopup-3Lx5tEub.js";import{e as pe,U as he}from"./index-DB81Su4I.js";import{f as me,u as ve,m as D,i as be,b as fe,c as Se}from"./useMangaLibrary-BAUaug-u.js";import{u as Te}from"./useProviders-CKqOSX5-.js";import{s as l}from"./Manga.module-depGEacJ.js";import{p as c}from"./page.module-C1MlZzf3.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./usePopup-DS9jMzp6.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-DI-v-DQ1.js";const ye=[{value:"popular",label:"Popular"},{value:"latest",label:"Latest"},{value:"rating",label:"Top Rated"},{value:"followed",label:"Most Followed"}],Me=[{value:"",label:"Any Status"},{value:"ongoing",label:"Ongoing"},{value:"completed",label:"Completed"},{value:"hiatus",label:"Hiatus"},{value:"cancelled",label:"Cancelled"}],Ne=[{value:"",label:"Any Status"},{value:"publishing",label:"Publishing"},{value:"finished",label:"Finished"},{value:"on hiatus",label:"On Hiatus"},{value:"discontinued",label:"Discontinued"}],Ce=[{value:"",label:"All Types"},{value:"manga",label:"Manga"},{value:"novel",label:"Novel"},{value:"one-shot",label:"One-Shot"},{value:"doujinshi",label:"Doujinshi"}],Pe=[{value:"safe",label:"Safe"}],Ie=[{value:"safe",label:"Safe"},{value:"suggestive",label:"Suggestive"},{value:"erotica",label:"Erotica"},{value:"pornographic",label:"Pornographic"}];function He(){const[n,N]=le(),{hasConsent:v,grant:_}=pe(),[j,b]=E(!1),[C,P]=E(n.get("q")||""),{options:I,isLoading:R,refetch:G}=Te(),d=re(()=>I.filter(e=>e.kind==="manga").map(e=>({value:e.id,label:e.label})),[I]),f=n.get("provider")||"",S=f&&d.some(e=>e.value===f)?f:"",T=n.get("q")||"",L=parseInt(n.get("page")||"1"),$=n.get("sort")||"popular",k=n.get("status")||"",w=n.get("type")||"",u=n.get("rating")||"safe",A=n.get("id")||"";O(()=>{document.title="Manga - dango"},[]);const o=v,y=o?u:"safe",H=o?Ie:Pe,i=(e,t=!1)=>{const r=new URLSearchParams(n);for(const[m,U]of Object.entries(e))U?r.set(m,U):r.delete(m);t&&r.delete("page"),N(r)},g=me({provider:S,query:T,page:L,sort:$,status:k,type:w,rating:y,mature:o}),h=g.data?.items??[],z=g.data?.hasNext??!1,p=S||h[0]?.provider||"",{toggle:V,bookmarkedIds:X}=ve(),{popup:s,openPopup:K,scheduleClose:x,cancelClose:B,closePopup:Q}=ue();if(O(()=>{P(T)},[T]),A){const e=new URLSearchParams;o&&u!=="safe"&&e.set("rating",u);const t=n.get("chapter")||"";t&&e.set("chapter",t);const r=e.toString()?`?${e.toString()}`:"",m=`/manga/${p||"mangadex"}/${encodeURIComponent(A)}${t?`/read${r}`:r}`;return a(ne,{to:m,replace:!0})}const W=e=>{e.preventDefault(),he(),i({q:C},!0)},Y=e=>{e.currentTarget.checked&&!v&&b(!0)},J=()=>{_(),b(!1),i({},!0)},Z=()=>{b(!1)},F=e=>{const t=new URLSearchParams;o&&u!=="safe"&&t.set("rating",u);const r=t.toString()?`?${t.toString()}`:"";return`/manga/${e.provider}/${encodeURIComponent(e.id)}${r}`},ee=p==="mangapill"?Ne:Me,ae=p==="mangapill",te=p==="mangadex";return a("div",{className:c.page,children:[a("div",{className:c.header,children:[a("h1",{className:c.pageTitle,children:[a(M,{name:"book"})," Manga"]}),a("form",{className:c.searchForm,onSubmit:W,children:[a("input",{className:c.searchInput,value:C,onChange:e=>P(e.currentTarget.value),placeholder:"Search manga titles...","aria-label":"Search manga"}),a("button",{className:c.searchBtn,type:"submit","aria-label":"Search",children:a(M,{name:"search",size:14})})]}),a("select",{className:l.select,value:S,disabled:d.length===0,onChange:e=>{const t=new URLSearchParams(n);t.set("provider",e.currentTarget.value),t.delete("page"),t.delete("id"),t.delete("chapter"),t.delete("status"),t.delete("type"),N(t)},"aria-label":"Manga provider",children:d.length===0?a("option",{value:"",children:R?"Loading providers…":"No providers available"}):a(q,{children:[a("option",{value:"",children:"Auto"}),d.map(e=>a("option",{value:e.value,children:e.label},e.value))]})}),d.length===0&&!R&&a("button",{className:c.searchBtn,type:"button",onClick:()=>G(),"aria-label":"Retry loading providers",children:a(M,{name:"redo",size:14})})]}),a("div",{className:l.filterRow,children:[p==="mangadex"&&a("select",{className:l.select,value:$,onChange:e=>i({sort:e.currentTarget.value},!0),"aria-label":"Sort manga",children:ye.map(e=>a("option",{value:e.value,children:e.label},e.value))}),a("select",{className:l.select,value:k,onChange:e=>i({status:e.currentTarget.value},!0),"aria-label":"Filter by status",children:ee.map(e=>a("option",{value:e.value,children:e.label},e.label))}),ae&&a("select",{className:l.select,value:w,onChange:e=>i({type:e.currentTarget.value},!0),"aria-label":"Filter by type",children:Ce.filter(e=>e.value!=="doujinshi"||o).map(e=>a("option",{value:e.value,children:e.label},e.value))}),te&&a("select",{className:l.select,value:y,onChange:e=>i({rating:e.currentTarget.value},!0),"aria-label":"Content rating",children:H.map(e=>a("option",{value:e.value,children:e.label},e.value))}),!v&&a("div",{className:l.matureToggleWrap,children:[a("label",{className:l.matureLabel,htmlFor:"manga-mature-toggle",children:"Mature"}),a(se,{id:"manga-mature-toggle",isChecked:!1,onChange:Y})]})]}),g.isError?a(ie,{message:"Failed to load manga. Please try again."}):g.isLoading&&h.length===0?a("div",{className:l.grid,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>a("div",{className:l.skeletonCard,children:[a("div",{className:`${l.skeletonThumb} ${l.shimmer}`}),a("div",{className:`${l.skeletonLine} ${l.shimmer}`,style:{width:"88%"}}),a("div",{className:`${l.skeletonLine} ${l.shimmer}`,style:{width:"55%"}})]},t))}):h.length===0?a("p",{className:l.statusMsg,children:"No titles found. Try another search or provider."}):a(q,{children:[a("div",{className:`${l.grid} ${g.isFetching?l.fetching:""}`,children:h.map(e=>{const t=D(e.provider,e.id);return a(ce,{item:{id:t,title:e.title,...Se(e),thumbnail:fe(e.provider,e.cover),typeBadge:e.type||void 0,chapterBadge:e.latestChapter?`Ch. ${e.latestChapter}`:null,isAdult:be(e)},linkTo:F(e),hoverIcon:"info",display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:r=>K(r,{provider:e.provider,mangaId:e.id,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:F(e),rating:y,mature:o}),onPopupHoverIntent:r=>r?B():x(),rawThumbnail:!0},`${e.provider}-${e.id}`)})}),a(de,{page:L,canGoNext:z,onChange:e=>i({page:String(e)}),variant:"labeled"})]}),s&&a(ge,{data:s.data,anchorRect:s.rect,bookmarked:X.has(D(s.data.provider,s.data.mangaId)),onToggleBookmark:()=>V({id:s.data.mangaId,provider:s.data.provider,title:s.data.title,cover:s.data.cover,altTitle:s.data.altTitle??void 0,contentRating:s.data.contentRating}),onMouseEnter:B,onMouseLeave:x,onRequestClose:Q}),j&&a(oe,{isOpen:!0,scope:"section",showResetHint:!0,onClose:Z,onGrant:J})]})}export{He as default};
1
+ import{p as le,d as E,T as re,h as O,u as a,m as ne,S as q}from"./vendor-core-DfaOB3Rn.js";import{I as M}from"./vendor-icons-DrybRNxP.js";import{T as se}from"./ToggleSwitch-CN_ppEc9.js";import{M as oe}from"./MatureConsentModal-Beq4JL0b.js";import{E as ie}from"./ErrorMessage-DAxegITP.js";import{M as ce,P as de}from"./MediaCard-lz7FdOe_.js";import{u as ue,M as ge}from"./useMangaPopup-B_wRaMyP.js";import{e as pe,U as he}from"./index-DlcgJVM6.js";import{f as me,u as ve,m as D,i as be,b as fe,c as Se}from"./useMangaLibrary-BacTdrw2.js";import{u as Te}from"./useProviders-D0XOHCsj.js";import{s as l}from"./Manga.module-depGEacJ.js";import{p as c}from"./page.module-C1MlZzf3.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./usePopup-DS9jMzp6.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-DdnIPcOQ.js";const ye=[{value:"popular",label:"Popular"},{value:"latest",label:"Latest"},{value:"rating",label:"Top Rated"},{value:"followed",label:"Most Followed"}],Me=[{value:"",label:"Any Status"},{value:"ongoing",label:"Ongoing"},{value:"completed",label:"Completed"},{value:"hiatus",label:"Hiatus"},{value:"cancelled",label:"Cancelled"}],Ne=[{value:"",label:"Any Status"},{value:"publishing",label:"Publishing"},{value:"finished",label:"Finished"},{value:"on hiatus",label:"On Hiatus"},{value:"discontinued",label:"Discontinued"}],Ce=[{value:"",label:"All Types"},{value:"manga",label:"Manga"},{value:"novel",label:"Novel"},{value:"one-shot",label:"One-Shot"},{value:"doujinshi",label:"Doujinshi"}],Pe=[{value:"safe",label:"Safe"}],Ie=[{value:"safe",label:"Safe"},{value:"suggestive",label:"Suggestive"},{value:"erotica",label:"Erotica"},{value:"pornographic",label:"Pornographic"}];function He(){const[n,N]=le(),{hasConsent:v,grant:_}=pe(),[j,b]=E(!1),[C,P]=E(n.get("q")||""),{options:I,isLoading:R,refetch:G}=Te(),d=re(()=>I.filter(e=>e.kind==="manga").map(e=>({value:e.id,label:e.label})),[I]),f=n.get("provider")||"",S=f&&d.some(e=>e.value===f)?f:"",T=n.get("q")||"",L=parseInt(n.get("page")||"1"),$=n.get("sort")||"popular",k=n.get("status")||"",w=n.get("type")||"",u=n.get("rating")||"safe",A=n.get("id")||"";O(()=>{document.title="Manga - dango"},[]);const o=v,y=o?u:"safe",H=o?Ie:Pe,i=(e,t=!1)=>{const r=new URLSearchParams(n);for(const[m,U]of Object.entries(e))U?r.set(m,U):r.delete(m);t&&r.delete("page"),N(r)},g=me({provider:S,query:T,page:L,sort:$,status:k,type:w,rating:y,mature:o}),h=g.data?.items??[],z=g.data?.hasNext??!1,p=S||h[0]?.provider||"",{toggle:V,bookmarkedIds:X}=ve(),{popup:s,openPopup:K,scheduleClose:x,cancelClose:B,closePopup:Q}=ue();if(O(()=>{P(T)},[T]),A){const e=new URLSearchParams;o&&u!=="safe"&&e.set("rating",u);const t=n.get("chapter")||"";t&&e.set("chapter",t);const r=e.toString()?`?${e.toString()}`:"",m=`/manga/${p||"mangadex"}/${encodeURIComponent(A)}${t?`/read${r}`:r}`;return a(ne,{to:m,replace:!0})}const W=e=>{e.preventDefault(),he(),i({q:C},!0)},Y=e=>{e.currentTarget.checked&&!v&&b(!0)},J=()=>{_(),b(!1),i({},!0)},Z=()=>{b(!1)},F=e=>{const t=new URLSearchParams;o&&u!=="safe"&&t.set("rating",u);const r=t.toString()?`?${t.toString()}`:"";return`/manga/${e.provider}/${encodeURIComponent(e.id)}${r}`},ee=p==="mangapill"?Ne:Me,ae=p==="mangapill",te=p==="mangadex";return a("div",{className:c.page,children:[a("div",{className:c.header,children:[a("h1",{className:c.pageTitle,children:[a(M,{name:"book"})," Manga"]}),a("form",{className:c.searchForm,onSubmit:W,children:[a("input",{className:c.searchInput,value:C,onChange:e=>P(e.currentTarget.value),placeholder:"Search manga titles...","aria-label":"Search manga"}),a("button",{className:c.searchBtn,type:"submit","aria-label":"Search",children:a(M,{name:"search",size:14})})]}),a("select",{className:l.select,value:S,disabled:d.length===0,onChange:e=>{const t=new URLSearchParams(n);t.set("provider",e.currentTarget.value),t.delete("page"),t.delete("id"),t.delete("chapter"),t.delete("status"),t.delete("type"),N(t)},"aria-label":"Manga provider",children:d.length===0?a("option",{value:"",children:R?"Loading providers…":"No providers available"}):a(q,{children:[a("option",{value:"",children:"Auto"}),d.map(e=>a("option",{value:e.value,children:e.label},e.value))]})}),d.length===0&&!R&&a("button",{className:c.searchBtn,type:"button",onClick:()=>G(),"aria-label":"Retry loading providers",children:a(M,{name:"redo",size:14})})]}),a("div",{className:l.filterRow,children:[p==="mangadex"&&a("select",{className:l.select,value:$,onChange:e=>i({sort:e.currentTarget.value},!0),"aria-label":"Sort manga",children:ye.map(e=>a("option",{value:e.value,children:e.label},e.value))}),a("select",{className:l.select,value:k,onChange:e=>i({status:e.currentTarget.value},!0),"aria-label":"Filter by status",children:ee.map(e=>a("option",{value:e.value,children:e.label},e.label))}),ae&&a("select",{className:l.select,value:w,onChange:e=>i({type:e.currentTarget.value},!0),"aria-label":"Filter by type",children:Ce.filter(e=>e.value!=="doujinshi"||o).map(e=>a("option",{value:e.value,children:e.label},e.value))}),te&&a("select",{className:l.select,value:y,onChange:e=>i({rating:e.currentTarget.value},!0),"aria-label":"Content rating",children:H.map(e=>a("option",{value:e.value,children:e.label},e.value))}),!v&&a("div",{className:l.matureToggleWrap,children:[a("label",{className:l.matureLabel,htmlFor:"manga-mature-toggle",children:"Mature"}),a(se,{id:"manga-mature-toggle",isChecked:!1,onChange:Y})]})]}),g.isError?a(ie,{message:"Failed to load manga. Please try again."}):g.isLoading&&h.length===0?a("div",{className:l.grid,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>a("div",{className:l.skeletonCard,children:[a("div",{className:`${l.skeletonThumb} ${l.shimmer}`}),a("div",{className:`${l.skeletonLine} ${l.shimmer}`,style:{width:"88%"}}),a("div",{className:`${l.skeletonLine} ${l.shimmer}`,style:{width:"55%"}})]},t))}):h.length===0?a("p",{className:l.statusMsg,children:"No titles found. Try another search or provider."}):a(q,{children:[a("div",{className:`${l.grid} ${g.isFetching?l.fetching:""}`,children:h.map(e=>{const t=D(e.provider,e.id);return a(ce,{item:{id:t,title:e.title,...Se(e),thumbnail:fe(e.provider,e.cover),typeBadge:e.type||void 0,chapterBadge:e.latestChapter?`Ch. ${e.latestChapter}`:null,isAdult:be(e)},linkTo:F(e),hoverIcon:"info",display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:r=>K(r,{provider:e.provider,mangaId:e.id,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:F(e),rating:y,mature:o}),onPopupHoverIntent:r=>r?B():x(),rawThumbnail:!0},`${e.provider}-${e.id}`)})}),a(de,{page:L,canGoNext:z,onChange:e=>i({page:String(e)}),variant:"labeled"})]}),s&&a(ge,{data:s.data,anchorRect:s.rect,bookmarked:X.has(D(s.data.provider,s.data.mangaId)),onToggleBookmark:()=>V({id:s.data.mangaId,provider:s.data.provider,title:s.data.title,cover:s.data.cover,altTitle:s.data.altTitle??void 0,contentRating:s.data.contentRating}),onMouseEnter:B,onMouseLeave:x,onRequestClose:Q}),j&&a(oe,{isOpen:!0,scope:"section",showResetHint:!0,onClose:Z,onGrant:J})]})}export{He as default};
@@ -1 +1 @@
1
- import{u as e,a as Q,d as z,S as E,o as O,p as G,T as $,h as Y}from"./vendor-core-DfaOB3Rn.js";import{I as x}from"./vendor-icons-DrybRNxP.js";import{B as M,e as H,d as J}from"./index-DB81Su4I.js";import{E as K}from"./ErrorMessage-DAxegITP.js";import{b as D,g as V,f as U,h as j,j as X,m as A,k as Z,l as ee,n as te,r as ae,o as re,p as ne,q as se,s as ie,M as oe}from"./useMangaLibrary-BAUaug-u.js";import{s as r}from"./Manga.module-depGEacJ.js";import{p as le}from"./page.module-C1MlZzf3.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-DI-v-DQ1.js";const ce=({detail:a,altTitle:c,onBack:b,onOpenChapter:v,bookmarkButton:n,statusSelect:g,primaryAction:k,progressByChapter:d})=>{const h=[a.type,a.status,a.year?String(a.year):"",a.author?`by ${a.author}`:""].filter(Boolean);return e("div",{children:[e("button",{className:r.backBtn,onClick:b,children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e("div",{className:r.detail,children:[a.cover&&e("img",{className:r.detailCover,src:D(a.provider,a.cover),alt:a.title,decoding:"async",draggable:!1}),e("div",{className:r.detailInfo,children:[e("h2",{className:r.detailTitle,children:a.title}),c&&e("p",{className:r.detailAltTitle,children:["Also known as: ",c]}),h.length>0&&e("div",{className:r.detailMeta,children:h.map(t=>e("span",{className:r.badge,children:t},t))}),a.genres&&a.genres.length>0&&e("div",{className:r.detailMeta,children:a.genres.map(t=>e("span",{className:r.badge,children:t},t))}),a.description&&e("p",{className:r.detailDesc,children:a.description}),(n||g||k)&&e("div",{className:r.detailActions,children:[k,n,g]})]})]}),e("h3",{className:r.detailTitle,style:{fontSize:"1rem"},children:["Chapters (",a.chapters.length,")"]}),a.chapters.length===0?e("p",{className:r.statusMsg,children:"No chapters found for this title on this provider."}):e("div",{className:r.chapterList,children:a.chapters.map(t=>{const o=d?.get(t.id),p=!!o&&o.pageCount>0&&o.page>=o.pageCount;return e("button",{className:`${r.chapterRow} ${p?r.chapterDone:""}`,onClick:()=>v(t),title:t.externalUrl?"External only - opens on source site":void 0,children:[e("span",{children:["Ch. ",t.number,t.title?` - ${t.title}`:""]}),e("span",{className:r.chapterMeta,children:[o&&o.pageCount>0?p?"read":`p. ${o.page}/${o.pageCount}`:"",t.group,t.externalUrl?"external":""].filter(Boolean).join(" · ")})]},t.id)})})]})},de=({libId:a,anilistId:c})=>{const b=Q(),v=V(a),n=v.data?.item,[g,k]=z(null),[d,h]=z(null),t=g??n?.title??"",o=U({provider:"mangadex",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),p=U({provider:"mangapill",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),S=j(),y=X(),T=async s=>{const u=A(s.provider,s.id);h(u);try{await S.mutateAsync({provider:s.provider,mangaId:s.id,title:s.title,cover:s.cover,altTitle:s.altTitle,contentRating:s.contentRating,silent:!0}),await y.mutateAsync({id:u,anilistId:c}),b(`/manga/${s.provider}/${encodeURIComponent(s.id)}`)}catch{return}finally{h(null)}},C=(s,u,B)=>e("div",{style:{marginTop:"12px"},children:[e("div",{style:{fontWeight:600,textTransform:"capitalize",marginBottom:"6px"},children:s}),B?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"Searching…"}):!u||u.length===0?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"No matches."}):u.slice(0,6).map(l=>{const I=A(l.provider,l.id),N=d===I;return e("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderTop:"1px solid var(--border, #223)"},children:[l.cover&&e("img",{src:D(l.provider,l.cover),alt:"",loading:"lazy",style:{width:"34px",height:"48px",objectFit:"cover",borderRadius:"4px"}}),e("div",{style:{flex:1,minWidth:0},children:[e("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.title}),l.latestChapter&&e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.75rem"},children:l.latestChapter})]}),e(M,{onClick:()=>T(l),disabled:N,children:[e(x,{name:"external-link-alt",size:12})," ",N?"Linking…":"Link"]})]},I)})]});return e("div",{children:[e("button",{onClick:()=>b("/manga"),style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",marginBottom:"12px"},children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),v.isLoading?e("div",{style:{color:"var(--text-tertiary)"},children:"Loading library entry…"}):n?e(E,{children:[e("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[n.cover&&e("img",{src:n.cover,alt:"",style:{width:"64px",height:"90px",objectFit:"cover",borderRadius:"6px"}}),e("div",{children:[e("h2",{style:{margin:"0 0 4px"},children:n.title}),e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:["Tracked on AniList",n.lastChapterNumber?` · Ch. ${n.lastChapterNumber}`:"",n.status?` · ${n.status}`:""]})]})]}),e("p",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem",marginTop:"12px"},children:"AniList doesn't host chapters. Search your providers below and link the matching manga - your AniList status and chapter progress will sync to it from now on."}),e("div",{style:{display:"flex",gap:"8px",marginTop:"8px"},children:e("input",{type:"text",value:g??n.title,onChange:s=>k(s.currentTarget.value),placeholder:"Search providers…",style:{flex:1,padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--border, #223)",background:"var(--bg-secondary, transparent)",color:"inherit"}})}),C("mangadex",o.data?.items,o.isLoading),C("mangapill",p.data?.items,p.isLoading)]}):e("div",{style:{color:"var(--text-tertiary)"},children:"This AniList entry is no longer in your library."})]})};function ke(){const{provider:a="",id:c=""}=O(),[b]=G(),v=Q(),{hasConsent:n}=H(),g=b.get("rating")||"safe",k=n?g:"safe",d=a&&c?A(a,c):void 0,h=Z(a||null,c||null,k,n),t=h.data,o=ee(d),p=te(d),{titlePreference:S}=J(),y=$(()=>t&&{...t,title:ae(t,S)},[t,S]),T=j(),C=re(),s=ne();Y(()=>{y&&(document.title=`${y.title} - dango`)},[y]);const u=$(()=>{const i=new Map;for(const m of p.data?.progress??[])i.set(m.chapterId,m);return i},[p.data]),B=a.toLowerCase()==="anilist"&&/^\d+$/.test(c)?parseInt(c,10):null,l=o.data?.inLibrary??!1,I=o.data?.status??"Reading",N=$(()=>(t?.chapters??[]).filter(i=>!i.externalUrl),[t]),f=$(()=>{if(!t)return null;const i=[...p.data?.progress??[]].sort((m,L)=>L.updatedAt-m.updatedAt);for(const m of i){const L=t.chapters.find(w=>w.id===m.chapterId);if(L&&!L.externalUrl)return L;const P=se(m.chapterId);if(P!=null){const w=ie(t.chapters,P);if(w&&!w.externalUrl)return w}}return N[0]??null},[t,p.data,N]),q=f?u.get(f.id):void 0,F=(p.data?.progress?.length??0)>0,W=f&&(q||F)?`Continue Ch. ${f?.number}`:"Start Reading",R=i=>{if(i.externalUrl){window.open(i.externalUrl,"_blank","noopener,noreferrer");return}const m=new URLSearchParams;m.set("chapter",i.id),n&&g!=="safe"&&m.set("rating",g),v(`/manga/${a}/${encodeURIComponent(c)}/read?${m.toString()}`)},_=()=>{!t||!d||(l?C.mutate(d):T.mutate({provider:a,mangaId:c,title:t.title,cover:t.cover,author:t.author,altTitle:t.altTitle,contentRating:t.contentRating}))};return e("div",{className:le.page,children:h.isLoading?e("div",{"aria-hidden":!0,children:[e("div",{className:`${r.skeletonThumb} ${r.shimmer}`,style:{maxWidth:"12rem"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"40%"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"70%"}})]}):h.isError||!t||!y?B!=null&&d?e(de,{libId:d,anilistId:B}):e(E,{children:[e("button",{className:r.backBtn,onClick:()=>v("/manga"),children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e(K,{message:"Failed to load this title. Please try again."})]}):e(ce,{detail:y,altTitle:t.altTitle!==y.title?t.altTitle:void 0,onBack:()=>v("/manga"),onOpenChapter:R,progressByChapter:u,primaryAction:f?e(M,{onClick:()=>f&&R(f),children:[e(x,{name:"book",size:13})," ",W]}):void 0,bookmarkButton:e(M,{variant:l?"secondary":"primary",onClick:_,disabled:T.isPending||C.isPending,children:[e(x,{name:"bookmark",size:13})," ",l?"Bookmarked":"Bookmark"]}),statusSelect:l?e("select",{className:r.detailSelect,value:I,onChange:i=>d&&s.mutate({id:d,status:i.currentTarget.value}),"aria-label":"Reading status",children:oe.map(i=>e("option",{value:i,children:i},i))}):void 0})})}export{ke as default};
1
+ import{u as e,a as Q,d as z,S as E,o as O,p as G,T as $,h as Y}from"./vendor-core-DfaOB3Rn.js";import{I as x}from"./vendor-icons-DrybRNxP.js";import{B as M,e as H,d as J}from"./index-DlcgJVM6.js";import{E as K}from"./ErrorMessage-DAxegITP.js";import{b as D,g as V,f as U,h as j,j as X,m as A,k as Z,l as ee,n as te,r as ae,o as re,p as ne,q as se,s as ie,M as oe}from"./useMangaLibrary-BacTdrw2.js";import{s as r}from"./Manga.module-depGEacJ.js";import{p as le}from"./page.module-C1MlZzf3.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-DdnIPcOQ.js";const ce=({detail:a,altTitle:c,onBack:b,onOpenChapter:v,bookmarkButton:n,statusSelect:g,primaryAction:k,progressByChapter:d})=>{const h=[a.type,a.status,a.year?String(a.year):"",a.author?`by ${a.author}`:""].filter(Boolean);return e("div",{children:[e("button",{className:r.backBtn,onClick:b,children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e("div",{className:r.detail,children:[a.cover&&e("img",{className:r.detailCover,src:D(a.provider,a.cover),alt:a.title,decoding:"async",draggable:!1}),e("div",{className:r.detailInfo,children:[e("h2",{className:r.detailTitle,children:a.title}),c&&e("p",{className:r.detailAltTitle,children:["Also known as: ",c]}),h.length>0&&e("div",{className:r.detailMeta,children:h.map(t=>e("span",{className:r.badge,children:t},t))}),a.genres&&a.genres.length>0&&e("div",{className:r.detailMeta,children:a.genres.map(t=>e("span",{className:r.badge,children:t},t))}),a.description&&e("p",{className:r.detailDesc,children:a.description}),(n||g||k)&&e("div",{className:r.detailActions,children:[k,n,g]})]})]}),e("h3",{className:r.detailTitle,style:{fontSize:"1rem"},children:["Chapters (",a.chapters.length,")"]}),a.chapters.length===0?e("p",{className:r.statusMsg,children:"No chapters found for this title on this provider."}):e("div",{className:r.chapterList,children:a.chapters.map(t=>{const o=d?.get(t.id),p=!!o&&o.pageCount>0&&o.page>=o.pageCount;return e("button",{className:`${r.chapterRow} ${p?r.chapterDone:""}`,onClick:()=>v(t),title:t.externalUrl?"External only - opens on source site":void 0,children:[e("span",{children:["Ch. ",t.number,t.title?` - ${t.title}`:""]}),e("span",{className:r.chapterMeta,children:[o&&o.pageCount>0?p?"read":`p. ${o.page}/${o.pageCount}`:"",t.group,t.externalUrl?"external":""].filter(Boolean).join(" · ")})]},t.id)})})]})},de=({libId:a,anilistId:c})=>{const b=Q(),v=V(a),n=v.data?.item,[g,k]=z(null),[d,h]=z(null),t=g??n?.title??"",o=U({provider:"mangadex",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),p=U({provider:"mangapill",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),S=j(),y=X(),T=async s=>{const u=A(s.provider,s.id);h(u);try{await S.mutateAsync({provider:s.provider,mangaId:s.id,title:s.title,cover:s.cover,altTitle:s.altTitle,contentRating:s.contentRating,silent:!0}),await y.mutateAsync({id:u,anilistId:c}),b(`/manga/${s.provider}/${encodeURIComponent(s.id)}`)}catch{return}finally{h(null)}},C=(s,u,B)=>e("div",{style:{marginTop:"12px"},children:[e("div",{style:{fontWeight:600,textTransform:"capitalize",marginBottom:"6px"},children:s}),B?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"Searching…"}):!u||u.length===0?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"No matches."}):u.slice(0,6).map(l=>{const I=A(l.provider,l.id),N=d===I;return e("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderTop:"1px solid var(--border, #223)"},children:[l.cover&&e("img",{src:D(l.provider,l.cover),alt:"",loading:"lazy",style:{width:"34px",height:"48px",objectFit:"cover",borderRadius:"4px"}}),e("div",{style:{flex:1,minWidth:0},children:[e("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.title}),l.latestChapter&&e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.75rem"},children:l.latestChapter})]}),e(M,{onClick:()=>T(l),disabled:N,children:[e(x,{name:"external-link-alt",size:12})," ",N?"Linking…":"Link"]})]},I)})]});return e("div",{children:[e("button",{onClick:()=>b("/manga"),style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",marginBottom:"12px"},children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),v.isLoading?e("div",{style:{color:"var(--text-tertiary)"},children:"Loading library entry…"}):n?e(E,{children:[e("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[n.cover&&e("img",{src:n.cover,alt:"",style:{width:"64px",height:"90px",objectFit:"cover",borderRadius:"6px"}}),e("div",{children:[e("h2",{style:{margin:"0 0 4px"},children:n.title}),e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:["Tracked on AniList",n.lastChapterNumber?` · Ch. ${n.lastChapterNumber}`:"",n.status?` · ${n.status}`:""]})]})]}),e("p",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem",marginTop:"12px"},children:"AniList doesn't host chapters. Search your providers below and link the matching manga - your AniList status and chapter progress will sync to it from now on."}),e("div",{style:{display:"flex",gap:"8px",marginTop:"8px"},children:e("input",{type:"text",value:g??n.title,onChange:s=>k(s.currentTarget.value),placeholder:"Search providers…",style:{flex:1,padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--border, #223)",background:"var(--bg-secondary, transparent)",color:"inherit"}})}),C("mangadex",o.data?.items,o.isLoading),C("mangapill",p.data?.items,p.isLoading)]}):e("div",{style:{color:"var(--text-tertiary)"},children:"This AniList entry is no longer in your library."})]})};function ke(){const{provider:a="",id:c=""}=O(),[b]=G(),v=Q(),{hasConsent:n}=H(),g=b.get("rating")||"safe",k=n?g:"safe",d=a&&c?A(a,c):void 0,h=Z(a||null,c||null,k,n),t=h.data,o=ee(d),p=te(d),{titlePreference:S}=J(),y=$(()=>t&&{...t,title:ae(t,S)},[t,S]),T=j(),C=re(),s=ne();Y(()=>{y&&(document.title=`${y.title} - dango`)},[y]);const u=$(()=>{const i=new Map;for(const m of p.data?.progress??[])i.set(m.chapterId,m);return i},[p.data]),B=a.toLowerCase()==="anilist"&&/^\d+$/.test(c)?parseInt(c,10):null,l=o.data?.inLibrary??!1,I=o.data?.status??"Reading",N=$(()=>(t?.chapters??[]).filter(i=>!i.externalUrl),[t]),f=$(()=>{if(!t)return null;const i=[...p.data?.progress??[]].sort((m,L)=>L.updatedAt-m.updatedAt);for(const m of i){const L=t.chapters.find(w=>w.id===m.chapterId);if(L&&!L.externalUrl)return L;const P=se(m.chapterId);if(P!=null){const w=ie(t.chapters,P);if(w&&!w.externalUrl)return w}}return N[0]??null},[t,p.data,N]),q=f?u.get(f.id):void 0,F=(p.data?.progress?.length??0)>0,W=f&&(q||F)?`Continue Ch. ${f?.number}`:"Start Reading",R=i=>{if(i.externalUrl){window.open(i.externalUrl,"_blank","noopener,noreferrer");return}const m=new URLSearchParams;m.set("chapter",i.id),n&&g!=="safe"&&m.set("rating",g),v(`/manga/${a}/${encodeURIComponent(c)}/read?${m.toString()}`)},_=()=>{!t||!d||(l?C.mutate(d):T.mutate({provider:a,mangaId:c,title:t.title,cover:t.cover,author:t.author,altTitle:t.altTitle,contentRating:t.contentRating}))};return e("div",{className:le.page,children:h.isLoading?e("div",{"aria-hidden":!0,children:[e("div",{className:`${r.skeletonThumb} ${r.shimmer}`,style:{maxWidth:"12rem"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"40%"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"70%"}})]}):h.isError||!t||!y?B!=null&&d?e(de,{libId:d,anilistId:B}):e(E,{children:[e("button",{className:r.backBtn,onClick:()=>v("/manga"),children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e(K,{message:"Failed to load this title. Please try again."})]}):e(ce,{detail:y,altTitle:t.altTitle!==y.title?t.altTitle:void 0,onBack:()=>v("/manga"),onOpenChapter:R,progressByChapter:u,primaryAction:f?e(M,{onClick:()=>f&&R(f),children:[e(x,{name:"book",size:13})," ",W]}):void 0,bookmarkButton:e(M,{variant:l?"secondary":"primary",onClick:_,disabled:T.isPending||C.isPending,children:[e(x,{name:"bookmark",size:13})," ",l?"Bookmarked":"Bookmark"]}),statusSelect:l?e("select",{className:r.detailSelect,value:I,onChange:i=>d&&s.mutate({id:d,status:i.currentTarget.value}),"aria-label":"Reading status",children:oe.map(i=>e("option",{value:i,children:i},i))}):void 0})})}export{ke as default};
@@ -1 +1 @@
1
- import{d as D,A as w,q as Z,h as g,u as e,S as ce,o as ve,p as be,a as we,T as Ne}from"./vendor-core-DfaOB3Rn.js";import{E as ye}from"./ErrorMessage-DAxegITP.js";import{I as $}from"./vendor-icons-DrybRNxP.js";import{u as Ce}from"./vendor-query-BBT5_sHx.js";import{t as ke,v as Se,m as Ie,k as $e,r as Pe,n as Re,w as Me,q as xe,s as Ee}from"./useMangaLibrary-BAUaug-u.js";import{s as t}from"./Manga.module-depGEacJ.js";import{q as Te,e as Le,d as Be,t as oe}from"./index-DB81Su4I.js";import{p as ze}from"./page.module-C1MlZzf3.js";import"./libraryInvalidation-DI-v-DQ1.js";const le="mangaReadMode",de="mangaFitMode";function Ae(){try{return localStorage.getItem(le)==="page"?"page":"strip"}catch{return"strip"}}function Fe(){try{return localStorage.getItem(de)==="height"?"height":"width"}catch{return"width"}}const Ue=({provider:h,mangaTitle:p,chapter:f,chapters:y,onBack:C,onOpenChapter:v,initialPage:u=0,onProgress:V})=>{const[c,P]=D(Ae),[B,i]=D(Fe),[d,z]=D(0),[A,M]=D(new Set),[b,k]=D(0),N=w(null),x=w([]),X=Ce(),{data:_,isLoading:Y,isError:R}=ke(h,f.id),s=_?.pages??[],m=s.map(n=>Se(h,n)),I=w(0),F=w(0),E=w(!1);F.current=s.length;const T=y.findIndex(n=>n.id===f.id),a=T>0?[...y.slice(0,T)].reverse().find(n=>!n.externalUrl)??null:null,o=T>=0?y.slice(T+1).find(n=>!n.externalUrl)??null:null,S=Z(n=>{E.current=!0,z(r=>{const l=r+n;return l<0?(a&&v(a),0):l>=s.length?(o&&v(o),r):l})},[s.length,a,o,v]);g(()=>{E.current=!1,I.current=Math.max(0,u),z(Math.max(0,u)),M(new Set),x.current=[],u<=0&&window.scrollTo(0,0)},[f.id,u]);const G=w(V);G.current=V;const J=w(""),j=w(null),ee=w(null),[W,ue]=D(0),L=Z(()=>{const n=c==="strip"?x.current[I.current]:ee.current,r=n?.querySelector("img");if(!n||!r)return;const l=Math.max(0,(n.clientWidth-r.clientWidth)/2)+8;ue(H=>Math.abs(H-l)<1?H:l)},[c]);g(()=>{I.current=d,s.length!==0&&G.current?.(Math.min(d+1,s.length),s.length)},[d,s.length]),g(()=>{u<=0||E.current||I.current===0&&(E.current=!1,I.current=u,z(u))},[u]),g(()=>{if(c!=="strip"||s.length===0||u<=0)return;const n=`${f.id}:${u}`;if(J.current===n)return;J.current=n;const r=window.setTimeout(()=>{x.current[Math.min(u,s.length-1)]?.scrollIntoView({block:"start"})},150);return()=>window.clearTimeout(r)},[c,s.length,u,f.id]),g(()=>{document.title=`${p} Ch. ${f.number} - dango`},[p,f.number]),g(()=>{try{localStorage.setItem(le,c)}catch{}},[c]),g(()=>{try{localStorage.setItem(de,B)}catch{}},[B]),g(()=>{c==="page"&&window.scrollTo(0,0)},[c]),g(()=>{if(c!=="page"||s.length===0)return;const n=r=>{r.key==="ArrowRight"||r.key===" "?(r.preventDefault(),S(1)):r.key==="ArrowLeft"&&(r.preventDefault(),S(-1))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[c,s.length,S]),g(()=>{if(c!=="strip"||s.length===0)return;let n=0;const r=()=>{n=0;const H=window.innerHeight*.3,O=x.current;let q=-1,re=0;for(let Q=0;Q<O.length;Q++){const se=O[Q];if(!se)continue;const ie=se.getBoundingClientRect();if(ie.height>4&&re++,ie.top<=H)q=Q;else break}q<0||re<Math.min(3,O.length)||(q!==I.current&&(E.current=!0,I.current=q,z(q)),L())},l=()=>{n||(n=requestAnimationFrame(r))};return j.current=l,l(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),n&&cancelAnimationFrame(n),j.current=null}},[c,s.length,_,L]),g(()=>{if(!(c!=="page"||s.length===0))return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[c,d,s.length,L]);const ge=n=>{N.current=n.touches[0].clientX},he=n=>{if(N.current===null)return;const r=n.changedTouches[0].clientX-N.current;N.current=null,!(Math.abs(r)<50)&&S(r<0?1:-1)},K=n=>{n&&v(n)},te=n=>M(r=>{if(r.has(n))return r;const l=new Set(r);return l.add(n),l}),me=n=>{M(r=>{const l=new Set(r);return l.delete(n),l}),k(r=>r+1)},pe=()=>{M(new Set),k(n=>n+1),X.invalidateQueries({queryKey:[Te.mangaPages,h,f.id]})},fe=s.length>0&&A.size>=s.length,ne=n=>b>0?`${n}&n=${b}`:n,ae=n=>e("div",{className:t.deadPage,role:"alert",children:[e("span",{children:["Page ",n+1," failed to load"]}),e("button",{className:t.pageBtn,onClick:()=>me(n),children:[e($,{name:"sync-alt",size:12})," Retry"]})]}),U=B==="height";return e("div",{className:t.readerShell,children:[e("div",{className:t.readerBar,children:[e("button",{className:t.readerIconBtn,onClick:C,"aria-label":"Back to chapters",children:e($,{name:"chevron-left",size:14})}),e("span",{className:t.readerTitle,children:[p," - Ch. ",f.number,f.title?` ${f.title}`:""]}),s.length>0&&e("span",{className:t.readerCounter,children:[Math.min(d+1,s.length)," / ",s.length]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Reading mode",children:[e("button",{type:"button","aria-pressed":c==="strip",className:c==="strip"?t.readerSegmentActive:"",onClick:()=>P("strip"),children:"Strip"}),e("button",{type:"button","aria-pressed":c==="page",className:c==="page"?t.readerSegmentActive:"",onClick:()=>P("page"),children:"Page"})]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Fit mode",children:[e("button",{type:"button","aria-pressed":!U,className:U?"":t.readerSegmentActive,onClick:()=>i("width"),title:"Fit width - best for portrait / phones",children:"Wide"}),e("button",{type:"button","aria-pressed":U,className:U?t.readerSegmentActive:"",onClick:()=>i("height"),title:"Fit height - best for landscape / desktop",children:"Tall"})]}),e("button",{className:t.readerIconBtn,disabled:!a,onClick:()=>K(a),"aria-label":"Previous chapter",children:e($,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!o,onClick:()=>K(o),"aria-label":"Next chapter",children:e($,{name:"chevron-right",size:14})})]}),R?e("p",{className:t.statusMsg,children:"Failed to load pages. Please try again."}):Y?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((n,r)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},r))}):s.length===0?e("p",{className:t.statusMsg,children:"No pages found for this chapter."}):fe?e("div",{className:t.failedBox,children:[e("p",{className:t.statusMsg,children:"Page images failed to load (expired or blocked links)."}),e("button",{className:t.pageBtn,onClick:pe,children:[e($,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${U?t.readerPagesTall:""}`,children:m.map((n,r)=>e("div",{ref:l=>{x.current[r]=l},className:t.readerPageWrap,children:[r===d&&e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),A.has(r)?ae(r):e("img",{className:t.readerPage,src:ne(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onLoad:()=>j.current?.(),onError:()=>te(r)})]},`${r}-${s[r].slice(-32)}`))}):e(ce,{children:[e("div",{ref:ee,className:`${t.pageView} ${U?t.pageViewTall:""}`,onTouchStart:ge,onTouchEnd:he,children:[e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),e("button",{className:`${t.tapZone} ${t.tapZoneLeft}`,onClick:()=>S(-1),"aria-label":"Previous page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-left",size:16})})}),A.has(d)?ae(d):e("img",{className:t.pageImage,src:ne(m[d]),alt:`Page ${d+1} of ${s.length}`,decoding:"async",draggable:!1,onLoad:()=>L(),onError:()=>te(d)},`${d}-${s[d].slice(-32)}`),e("button",{className:`${t.tapZone} ${t.tapZoneRight}`,onClick:()=>S(1),"aria-label":"Next page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-right",size:16})})})]}),e("nav",{className:t.pagination,"aria-label":"Page navigation",children:[e("button",{className:t.pageBtn,disabled:d<=0,onClick:()=>S(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[d+1," / ",s.length]}),e("button",{className:t.pageBtn,disabled:d>=s.length-1,onClick:()=>S(1),children:"Next page"})]})]}),(a||o)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!a,onClick:()=>K(a),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!o,onClick:()=>K(o),children:"Next chapter"})]})]})},De=800,_e=5e3;function je(){const{provider:h="",id:p=""}=ve(),[f]=be(),y=we(),C=f.get("chapter")||"",v=f.get("rating")||"safe",{hasConsent:u}=Le(),V=u?v:"safe",c=h&&p?Ie(h,p):"",P=h.toLowerCase()==="anilist";g(()=>{P&&p&&y(`/manga/anilist/${encodeURIComponent(p)}`,{replace:!0})},[P,p,y]);const B=$e(!P&&h?h:null,!P&&p?p:null,V,u),i=B.data,{titlePreference:d}=Be(),z=i?Pe(i,d):"Manga",A=Re(c||void 0),M=Me(),b=i&&C?i.chapters.find(a=>a.id===C)??null:null,k=xe(C),N=k!=null&&i?Ee(i.chapters,k):null;g(()=>{if(k!=null&&N&&N.id!==C){const a=new URLSearchParams;a.set("chapter",N.id),u&&v!=="safe"&&a.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${a.toString()}`,{replace:!0})}},[k,N,C,u,v,h,p,y]);const x=k!=null&&!!i&&!!N,X=k!=null&&!!i&&!N,_=Ne(()=>{const a=(A.data?.progress??[]).find(o=>o.chapterId===C);return a&&a.page>0?a.page:0},[A.data,C]),Y=_>1?_-1:0,R=w(null),s=w(null),m=Z(()=>{R.current&&(clearTimeout(R.current),R.current=null);const a=s.current;s.current=null,a&&c&&M.mutate({mangaId:c,chapterId:a.chapterId,chapterNumber:a.chapterNumber,page:a.page,pageCount:a.pageCount,title:i?.title??null,cover:i?.cover??null,provider:h||null,altTitle:i?.altTitle??null,contentRating:i?.contentRating??null})},[c,M,i?.title,i?.cover,i?.altTitle,i?.contentRating,h]),I=Z((a,o)=>{b&&(s.current={chapterId:b.id,chapterNumber:b.number,page:a,pageCount:o},R.current&&clearTimeout(R.current),R.current=setTimeout(m,De))},[b,m]);g(()=>{m()},[C,m]),g(()=>()=>m(),[m]),g(()=>{const a=window.setInterval(()=>{s.current&&m()},_e);return()=>window.clearInterval(a)},[m]),g(()=>{const a=()=>{document.visibilityState==="hidden"&&m()},o=()=>m();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",o)}},[m]);const F=w("");F.current||(F.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),g(()=>{if(!i||!b)return;const a=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{oe.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${b.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:a,sessionId:F.current}).catch(()=>{}),oe.discord.heartbeat.mutate({sessionId:F.current}).catch(()=>{})};o();const S=window.setInterval(o,6e4);return()=>window.clearInterval(S)},[i,b]);const E=a=>{if(m(),a.externalUrl){window.open(a.externalUrl,"_blank","noopener,noreferrer");return}const o=new URLSearchParams;o.set("chapter",a.id),u&&v!=="safe"&&o.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${o.toString()}`)},T=()=>{m();const a=new URLSearchParams;u&&v!=="safe"&&a.set("rating",v);const o=a.toString()?`?${a.toString()}`:"";y(`/manga/${h}/${encodeURIComponent(p)}${o}`)};return P?null:e("div",{className:ze.page,children:B.isLoading||x?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((a,o)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},o))}):!i||!b?e(ce,{children:[e("button",{className:t.backBtn,onClick:T,children:"Back to title"}),e(ye,{message:X?`Chapter ${k} isn't available from ${h} for this title.`:"Failed to load this chapter. Please try again."})]}):e(Ue,{provider:h,mangaTitle:z,chapter:b,chapters:i.chapters,onBack:T,onOpenChapter:E,initialPage:Y,onProgress:I},b.id)})}export{je as default};
1
+ import{d as D,A as w,q as Z,h as g,u as e,S as ce,o as ve,p as be,a as we,T as Ne}from"./vendor-core-DfaOB3Rn.js";import{E as ye}from"./ErrorMessage-DAxegITP.js";import{I as $}from"./vendor-icons-DrybRNxP.js";import{u as Ce}from"./vendor-query-BBT5_sHx.js";import{t as ke,v as Se,m as Ie,k as $e,r as Pe,n as Re,w as Me,q as xe,s as Ee}from"./useMangaLibrary-BacTdrw2.js";import{s as t}from"./Manga.module-depGEacJ.js";import{q as Te,e as Le,d as Be,t as oe}from"./index-DlcgJVM6.js";import{p as ze}from"./page.module-C1MlZzf3.js";import"./libraryInvalidation-DdnIPcOQ.js";const le="mangaReadMode",de="mangaFitMode";function Ae(){try{return localStorage.getItem(le)==="page"?"page":"strip"}catch{return"strip"}}function Fe(){try{return localStorage.getItem(de)==="height"?"height":"width"}catch{return"width"}}const Ue=({provider:h,mangaTitle:p,chapter:f,chapters:y,onBack:C,onOpenChapter:v,initialPage:u=0,onProgress:V})=>{const[c,P]=D(Ae),[B,i]=D(Fe),[d,z]=D(0),[A,M]=D(new Set),[b,k]=D(0),N=w(null),x=w([]),X=Ce(),{data:_,isLoading:Y,isError:R}=ke(h,f.id),s=_?.pages??[],m=s.map(n=>Se(h,n)),I=w(0),F=w(0),E=w(!1);F.current=s.length;const T=y.findIndex(n=>n.id===f.id),a=T>0?[...y.slice(0,T)].reverse().find(n=>!n.externalUrl)??null:null,o=T>=0?y.slice(T+1).find(n=>!n.externalUrl)??null:null,S=Z(n=>{E.current=!0,z(r=>{const l=r+n;return l<0?(a&&v(a),0):l>=s.length?(o&&v(o),r):l})},[s.length,a,o,v]);g(()=>{E.current=!1,I.current=Math.max(0,u),z(Math.max(0,u)),M(new Set),x.current=[],u<=0&&window.scrollTo(0,0)},[f.id,u]);const G=w(V);G.current=V;const J=w(""),j=w(null),ee=w(null),[W,ue]=D(0),L=Z(()=>{const n=c==="strip"?x.current[I.current]:ee.current,r=n?.querySelector("img");if(!n||!r)return;const l=Math.max(0,(n.clientWidth-r.clientWidth)/2)+8;ue(H=>Math.abs(H-l)<1?H:l)},[c]);g(()=>{I.current=d,s.length!==0&&G.current?.(Math.min(d+1,s.length),s.length)},[d,s.length]),g(()=>{u<=0||E.current||I.current===0&&(E.current=!1,I.current=u,z(u))},[u]),g(()=>{if(c!=="strip"||s.length===0||u<=0)return;const n=`${f.id}:${u}`;if(J.current===n)return;J.current=n;const r=window.setTimeout(()=>{x.current[Math.min(u,s.length-1)]?.scrollIntoView({block:"start"})},150);return()=>window.clearTimeout(r)},[c,s.length,u,f.id]),g(()=>{document.title=`${p} Ch. ${f.number} - dango`},[p,f.number]),g(()=>{try{localStorage.setItem(le,c)}catch{}},[c]),g(()=>{try{localStorage.setItem(de,B)}catch{}},[B]),g(()=>{c==="page"&&window.scrollTo(0,0)},[c]),g(()=>{if(c!=="page"||s.length===0)return;const n=r=>{r.key==="ArrowRight"||r.key===" "?(r.preventDefault(),S(1)):r.key==="ArrowLeft"&&(r.preventDefault(),S(-1))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[c,s.length,S]),g(()=>{if(c!=="strip"||s.length===0)return;let n=0;const r=()=>{n=0;const H=window.innerHeight*.3,O=x.current;let q=-1,re=0;for(let Q=0;Q<O.length;Q++){const se=O[Q];if(!se)continue;const ie=se.getBoundingClientRect();if(ie.height>4&&re++,ie.top<=H)q=Q;else break}q<0||re<Math.min(3,O.length)||(q!==I.current&&(E.current=!0,I.current=q,z(q)),L())},l=()=>{n||(n=requestAnimationFrame(r))};return j.current=l,l(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),n&&cancelAnimationFrame(n),j.current=null}},[c,s.length,_,L]),g(()=>{if(!(c!=="page"||s.length===0))return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[c,d,s.length,L]);const ge=n=>{N.current=n.touches[0].clientX},he=n=>{if(N.current===null)return;const r=n.changedTouches[0].clientX-N.current;N.current=null,!(Math.abs(r)<50)&&S(r<0?1:-1)},K=n=>{n&&v(n)},te=n=>M(r=>{if(r.has(n))return r;const l=new Set(r);return l.add(n),l}),me=n=>{M(r=>{const l=new Set(r);return l.delete(n),l}),k(r=>r+1)},pe=()=>{M(new Set),k(n=>n+1),X.invalidateQueries({queryKey:[Te.mangaPages,h,f.id]})},fe=s.length>0&&A.size>=s.length,ne=n=>b>0?`${n}&n=${b}`:n,ae=n=>e("div",{className:t.deadPage,role:"alert",children:[e("span",{children:["Page ",n+1," failed to load"]}),e("button",{className:t.pageBtn,onClick:()=>me(n),children:[e($,{name:"sync-alt",size:12})," Retry"]})]}),U=B==="height";return e("div",{className:t.readerShell,children:[e("div",{className:t.readerBar,children:[e("button",{className:t.readerIconBtn,onClick:C,"aria-label":"Back to chapters",children:e($,{name:"chevron-left",size:14})}),e("span",{className:t.readerTitle,children:[p," - Ch. ",f.number,f.title?` ${f.title}`:""]}),s.length>0&&e("span",{className:t.readerCounter,children:[Math.min(d+1,s.length)," / ",s.length]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Reading mode",children:[e("button",{type:"button","aria-pressed":c==="strip",className:c==="strip"?t.readerSegmentActive:"",onClick:()=>P("strip"),children:"Strip"}),e("button",{type:"button","aria-pressed":c==="page",className:c==="page"?t.readerSegmentActive:"",onClick:()=>P("page"),children:"Page"})]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Fit mode",children:[e("button",{type:"button","aria-pressed":!U,className:U?"":t.readerSegmentActive,onClick:()=>i("width"),title:"Fit width - best for portrait / phones",children:"Wide"}),e("button",{type:"button","aria-pressed":U,className:U?t.readerSegmentActive:"",onClick:()=>i("height"),title:"Fit height - best for landscape / desktop",children:"Tall"})]}),e("button",{className:t.readerIconBtn,disabled:!a,onClick:()=>K(a),"aria-label":"Previous chapter",children:e($,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!o,onClick:()=>K(o),"aria-label":"Next chapter",children:e($,{name:"chevron-right",size:14})})]}),R?e("p",{className:t.statusMsg,children:"Failed to load pages. Please try again."}):Y?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((n,r)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},r))}):s.length===0?e("p",{className:t.statusMsg,children:"No pages found for this chapter."}):fe?e("div",{className:t.failedBox,children:[e("p",{className:t.statusMsg,children:"Page images failed to load (expired or blocked links)."}),e("button",{className:t.pageBtn,onClick:pe,children:[e($,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${U?t.readerPagesTall:""}`,children:m.map((n,r)=>e("div",{ref:l=>{x.current[r]=l},className:t.readerPageWrap,children:[r===d&&e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),A.has(r)?ae(r):e("img",{className:t.readerPage,src:ne(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onLoad:()=>j.current?.(),onError:()=>te(r)})]},`${r}-${s[r].slice(-32)}`))}):e(ce,{children:[e("div",{ref:ee,className:`${t.pageView} ${U?t.pageViewTall:""}`,onTouchStart:ge,onTouchEnd:he,children:[e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),e("button",{className:`${t.tapZone} ${t.tapZoneLeft}`,onClick:()=>S(-1),"aria-label":"Previous page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-left",size:16})})}),A.has(d)?ae(d):e("img",{className:t.pageImage,src:ne(m[d]),alt:`Page ${d+1} of ${s.length}`,decoding:"async",draggable:!1,onLoad:()=>L(),onError:()=>te(d)},`${d}-${s[d].slice(-32)}`),e("button",{className:`${t.tapZone} ${t.tapZoneRight}`,onClick:()=>S(1),"aria-label":"Next page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-right",size:16})})})]}),e("nav",{className:t.pagination,"aria-label":"Page navigation",children:[e("button",{className:t.pageBtn,disabled:d<=0,onClick:()=>S(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[d+1," / ",s.length]}),e("button",{className:t.pageBtn,disabled:d>=s.length-1,onClick:()=>S(1),children:"Next page"})]})]}),(a||o)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!a,onClick:()=>K(a),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!o,onClick:()=>K(o),children:"Next chapter"})]})]})},De=800,_e=5e3;function je(){const{provider:h="",id:p=""}=ve(),[f]=be(),y=we(),C=f.get("chapter")||"",v=f.get("rating")||"safe",{hasConsent:u}=Le(),V=u?v:"safe",c=h&&p?Ie(h,p):"",P=h.toLowerCase()==="anilist";g(()=>{P&&p&&y(`/manga/anilist/${encodeURIComponent(p)}`,{replace:!0})},[P,p,y]);const B=$e(!P&&h?h:null,!P&&p?p:null,V,u),i=B.data,{titlePreference:d}=Be(),z=i?Pe(i,d):"Manga",A=Re(c||void 0),M=Me(),b=i&&C?i.chapters.find(a=>a.id===C)??null:null,k=xe(C),N=k!=null&&i?Ee(i.chapters,k):null;g(()=>{if(k!=null&&N&&N.id!==C){const a=new URLSearchParams;a.set("chapter",N.id),u&&v!=="safe"&&a.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${a.toString()}`,{replace:!0})}},[k,N,C,u,v,h,p,y]);const x=k!=null&&!!i&&!!N,X=k!=null&&!!i&&!N,_=Ne(()=>{const a=(A.data?.progress??[]).find(o=>o.chapterId===C);return a&&a.page>0?a.page:0},[A.data,C]),Y=_>1?_-1:0,R=w(null),s=w(null),m=Z(()=>{R.current&&(clearTimeout(R.current),R.current=null);const a=s.current;s.current=null,a&&c&&M.mutate({mangaId:c,chapterId:a.chapterId,chapterNumber:a.chapterNumber,page:a.page,pageCount:a.pageCount,title:i?.title??null,cover:i?.cover??null,provider:h||null,altTitle:i?.altTitle??null,contentRating:i?.contentRating??null})},[c,M,i?.title,i?.cover,i?.altTitle,i?.contentRating,h]),I=Z((a,o)=>{b&&(s.current={chapterId:b.id,chapterNumber:b.number,page:a,pageCount:o},R.current&&clearTimeout(R.current),R.current=setTimeout(m,De))},[b,m]);g(()=>{m()},[C,m]),g(()=>()=>m(),[m]),g(()=>{const a=window.setInterval(()=>{s.current&&m()},_e);return()=>window.clearInterval(a)},[m]),g(()=>{const a=()=>{document.visibilityState==="hidden"&&m()},o=()=>m();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",o)}},[m]);const F=w("");F.current||(F.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),g(()=>{if(!i||!b)return;const a=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{oe.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${b.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:a,sessionId:F.current}).catch(()=>{}),oe.discord.heartbeat.mutate({sessionId:F.current}).catch(()=>{})};o();const S=window.setInterval(o,6e4);return()=>window.clearInterval(S)},[i,b]);const E=a=>{if(m(),a.externalUrl){window.open(a.externalUrl,"_blank","noopener,noreferrer");return}const o=new URLSearchParams;o.set("chapter",a.id),u&&v!=="safe"&&o.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${o.toString()}`)},T=()=>{m();const a=new URLSearchParams;u&&v!=="safe"&&a.set("rating",v);const o=a.toString()?`?${a.toString()}`:"";y(`/manga/${h}/${encodeURIComponent(p)}${o}`)};return P?null:e("div",{className:ze.page,children:B.isLoading||x?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((a,o)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},o))}):!i||!b?e(ce,{children:[e("button",{className:t.backBtn,onClick:T,children:"Back to title"}),e(ye,{message:X?`Chapter ${k} isn't available from ${h} for this title.`:"Failed to load this chapter. Please try again."})]}):e(Ue,{provider:h,mangaTitle:z,chapter:b,chapters:i.chapters,onBack:T,onOpenChapter:E,initialPage:Y,onProgress:I},b.id)})}export{je as default};
@@ -1 +1 @@
1
- import{u as a}from"./vendor-core-DfaOB3Rn.js";import{R as i}from"./ResetProgressModal-BuESoxbY.js";import{B as n,o as g}from"./useMangaLibrary-BAUaug-u.js";const M=({mangaId:e,title:o,onClose:r})=>{const s=n(),t=g();return a(i,{isOpen:!!e,itemName:o,progressKind:"reading",listLabel:"my reading list",onClose:r,onConfirm:m=>{e&&(s.mutate({mangaId:e}),m&&t.mutate(e))}})};export{M};
1
+ import{u as a}from"./vendor-core-DfaOB3Rn.js";import{R as i}from"./ResetProgressModal-0PvvM2XJ.js";import{B as n,o as g}from"./useMangaLibrary-BacTdrw2.js";const M=({mangaId:e,title:o,onClose:r})=>{const s=n(),t=g();return a(i,{isOpen:!!e,itemName:o,progressKind:"reading",listLabel:"my reading list",onClose:r,onConfirm:m=>{e&&(s.mutate({mangaId:e}),m&&t.mutate(e))}})};export{M};