@serifpersia/dango 3.7.6 → 3.7.8

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 (86) hide show
  1. package/README.md +3 -1
  2. package/client/dist/assets/{AnimeCard-a7KkMGQv.js → AnimeCard-B_eNHj3Q.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-De3gudGy.js → AnimeInfo-B4DtKpJi.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-adJHjnqz.js → AnimeInfoPage-BTJBbJx7.js} +2 -2
  5. package/client/dist/assets/Asmr-DB4F0zQm.js +2 -0
  6. package/client/dist/assets/{AsmrResetProgressModal-CZGzmnlI.js → AsmrResetProgressModal-BkO6uAVo.js} +1 -1
  7. package/client/dist/assets/Home-BYtjQAAm.js +1 -0
  8. package/client/dist/assets/Insights-kd8R5HFL.js +1 -0
  9. package/client/dist/assets/{LibraryListPage-CgZiYRmp.js → LibraryListPage-BXCoAwO-.js} +1 -1
  10. package/client/dist/assets/{ListeningList-DX_Imiie.js → ListeningList-B58inkaW.js} +1 -1
  11. package/client/dist/assets/Manga-B09DXrt3.js +1 -0
  12. package/client/dist/assets/{MangaInfoPage-D_3Rx6rr.js → MangaInfoPage-HniBD97j.js} +1 -1
  13. package/client/dist/assets/MangaReadPage-XTo4eB8e.js +1 -0
  14. package/client/dist/assets/{MangaResetProgressModal-Bd_lIuFo.js → MangaResetProgressModal-DgD2JJiz.js} +1 -1
  15. package/client/dist/assets/Mature--NRjmFgA.js +1 -0
  16. package/client/dist/assets/{MatureConsentModal-RZ_j_2BD.js → MatureConsentModal-BxCEXBbj.js} +1 -1
  17. package/client/dist/assets/{MediaCard-BODgA6ir.js → MediaCard-BXWAjpwt.js} +1 -1
  18. package/client/dist/assets/OptionListMenu-DHzVKmrw.js +1 -0
  19. package/client/dist/assets/Player-BopSS6Gv.js +56 -0
  20. package/client/dist/assets/PlayerProvider-Cj4nkG1Z.js +1 -0
  21. package/client/dist/assets/PlayerSettings-BEorvGw8.js +1 -0
  22. package/client/dist/assets/{QueueOptionsButton-C-y5QFrT.js → QueueOptionsButton-E2SuRJH_.js} +1 -1
  23. package/client/dist/assets/{QueueRail-DGFI6xTM.js → QueueRail-ZlyY6iwq.js} +1 -1
  24. package/client/dist/assets/{ReadingList-BB_fA_j0.js → ReadingList-DEOzfsq9.js} +1 -1
  25. package/client/dist/assets/{ResetProgressModal-DEnbScHS.js → ResetProgressModal-B4qmiw-m.js} +1 -1
  26. package/client/dist/assets/Search-C2mxeTuG.js +1 -0
  27. package/client/dist/assets/Settings-BqOAQxhe.js +21 -0
  28. package/client/dist/assets/Settings-D37LNfis.css +1 -0
  29. package/client/dist/assets/{SkeletonGrid-w6TsxWu7.js → SkeletonGrid-Od92F7If.js} +1 -1
  30. package/client/dist/assets/Trackers-CyWVHtOz.js +2 -0
  31. package/client/dist/assets/Tv-B8tWYqQt.js +4 -0
  32. package/client/dist/assets/TvInfo-CYh7oICz.js +1 -0
  33. package/client/dist/assets/TvPopup-8uQGvzWG.js +1 -0
  34. package/client/dist/assets/TvSearch-DMc5DzU4.js +1 -0
  35. package/client/dist/assets/{TvWatchlist-er5RKLmv.js → TvWatchlist-fPe4D63a.js} +1 -1
  36. package/client/dist/assets/VirtualKeyboard-CjOEv-Zs.js +1 -0
  37. package/client/dist/assets/WatchAlong-Cd_rNUGz.js +1 -0
  38. package/client/dist/assets/WatchAlongPanel-BKprdx-w.js +1 -0
  39. package/client/dist/assets/WatchAlongPanel-DbJuLqxU.css +1 -0
  40. package/client/dist/assets/{Watchlist-BiJ1SCAH.js → Watchlist-DMj82PtZ.js} +1 -1
  41. package/client/dist/assets/index-B_2ppn5P.js +178 -0
  42. package/client/dist/assets/index-DP9TtvZX.css +1 -0
  43. package/client/dist/assets/{libraryInvalidation-CVK2SYUR.js → libraryInvalidation-DeUzK6TJ.js} +1 -1
  44. package/client/dist/assets/playbackCompletion-_kwPgoZi.js +1 -0
  45. package/client/dist/assets/{useAnimeInfoData-8RI9qMzw.js → useAnimeInfoData-CH9hmj5A.js} +1 -1
  46. package/client/dist/assets/{useAsmr-ClAcWwjW.js → useAsmr-DQsv1SQT.js} +1 -1
  47. package/client/dist/assets/{useAsmrPopup-CDcDqi0C.js → useAsmrPopup-6kWviNqn.js} +1 -1
  48. package/client/dist/assets/{useMangaLibrary-D3Foz2m_.js → useMangaLibrary-DlU4Z9JL.js} +1 -1
  49. package/client/dist/assets/{useMangaPopup-kZzwoCN6.js → useMangaPopup-3MuX6uO9.js} +1 -1
  50. package/client/dist/assets/{useProviders-OKWPunZg.js → useProviders-Dx9rG8FY.js} +1 -1
  51. package/client/dist/assets/useTv-DZQzHJgO.js +1 -0
  52. package/client/dist/assets/useTvLibrary-DVpLBz5c.js +1 -0
  53. package/client/dist/assets/useWatchAlongPlayer-KZT7d2pQ.js +10 -0
  54. package/client/dist/index.html +2 -2
  55. package/package.json +2 -2
  56. package/server/dist/config.js +1 -1
  57. package/server/dist/profile-scope.js +1 -0
  58. package/server/dist/server.js +257 -249
  59. package/server/dist/shipped-defaults.js +1 -1
  60. package/server/package.json +2 -2
  61. package/client/dist/assets/Asmr-BH3j9n5n.js +0 -2
  62. package/client/dist/assets/Home-4lO9InFx.js +0 -1
  63. package/client/dist/assets/Insights-Co9pEzWb.js +0 -1
  64. package/client/dist/assets/Manga-tDOa59vQ.js +0 -1
  65. package/client/dist/assets/MangaReadPage-D0satiXp.js +0 -1
  66. package/client/dist/assets/Mature-DhozU6BP.js +0 -1
  67. package/client/dist/assets/OptionListMenu-CGazCg0C.js +0 -1
  68. package/client/dist/assets/Player-M3yMiFzg.js +0 -56
  69. package/client/dist/assets/PlayerProvider-pi0at080.js +0 -1
  70. package/client/dist/assets/PlayerSettings-k4bqwbns.js +0 -1
  71. package/client/dist/assets/Search-Dikasx2q.js +0 -1
  72. package/client/dist/assets/Settings-CCoAhBc0.js +0 -21
  73. package/client/dist/assets/Settings-DYjRBgpE.css +0 -1
  74. package/client/dist/assets/Trackers-CoM-8Hz9.js +0 -2
  75. package/client/dist/assets/Tv-BLUeZ2n8.js +0 -4
  76. package/client/dist/assets/TvInfo-BjFZ57fG.js +0 -1
  77. package/client/dist/assets/TvPopup-D6UvGI7M.js +0 -1
  78. package/client/dist/assets/TvSearch-BDNZjbZo.js +0 -1
  79. package/client/dist/assets/VirtualKeyboard-DeP7fb3P.js +0 -1
  80. package/client/dist/assets/index-5x1mF1nD.css +0 -1
  81. package/client/dist/assets/index-BP1z44Uk.js +0 -178
  82. package/client/dist/assets/playbackCompletion-IPHm9fp5.js +0 -1
  83. package/client/dist/assets/usePlaybackEnd-DmvZ__Ut.js +0 -10
  84. package/client/dist/assets/useTv-BgO7EV-p.js +0 -1
  85. package/client/dist/assets/useTvLibrary-C6rSJQi_.js +0 -1
  86. /package/client/dist/assets/{usePlaybackEnd-BMf_H2dw.css → useWatchAlongPlayer-BMf_H2dw.css} +0 -0
@@ -1 +1 @@
1
- const r={GITHUB_CLIENT_ID:"Ov23liT1ZtPk7XtN9PZk",GOOGLE_AUTH_WORKER_URL:"https://google-auth-client.ramiserifpersia.workers.dev",DISCORD_CLIENT_ID:"1512253778022367426",MAL_AUTH_WORKER_URL:"https://dango-mal-auth.ramiserifpersia.workers.dev/",PROVIDER_REPO_URL:"https://raw.githubusercontent.com/serifpersia/dango-providers/main/registry.json"};export{r as SHIPPED_DEFAULTS};
1
+ const r={GITHUB_CLIENT_ID:"Ov23liT1ZtPk7XtN9PZk",GOOGLE_AUTH_WORKER_URL:"https://google-auth-client.ramiserifpersia.workers.dev",DISCORD_CLIENT_ID:"1512253778022367426",MAL_AUTH_WORKER_URL:"https://dango-mal-auth.ramiserifpersia.workers.dev/",WATCH_ALONG_WORKER_URL:"",PROVIDER_REPO_URL:"https://raw.githubusercontent.com/serifpersia/dango-providers/main/registry.json"};export{r as SHIPPED_DEFAULTS};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dango-server",
3
3
  "private": true,
4
- "version": "3.7.6",
4
+ "version": "3.7.8",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=22.12.0"
@@ -10,7 +10,7 @@
10
10
  "start": "node --max-old-space-size=256 dist/server.js",
11
11
  "dev": "tsx watch src/server.ts --dev",
12
12
  "build": "tsc --noEmit && node build.mjs",
13
- "test": "node --import tsx --test \"src/**/*.test.ts\"",
13
+ "test": "node --import tsx --test \"src/**/*.test.ts\" \"../worker/dango-watch-along/*.test.mjs\"",
14
14
  "format": "prettier --write .",
15
15
  "lint": "eslint ."
16
16
  },
@@ -1,2 +0,0 @@
1
- import{T as $e,u as e,d as b,A as H,a as Ue,g as Be,q as Y,h as T,S as E,$ as Ee,o as nt,p as rt}from"./vendor-core-DfaOB3Rn.js";import{I as w}from"./vendor-icons-DrybRNxP.js";import{u as st}from"./vendor-query-BBT5_sHx.js";import{T as je}from"./ToggleSwitch-CN_ppEc9.js";import{M as ot}from"./MatureConsentModal-RZ_j_2BD.js";import{M as lt,P as it}from"./MediaCard-BODgA6ir.js";import{c as Ve,a as Je,d as ct,e as Ke,f as ze,g as dt,h as ut,i as mt,j as ht,k as Oe,l as Ae}from"./useAsmr-ClAcWwjW.js";import{g as Re,t as Le,W as pt,B as He,M as Ge,P as M,A as ae,e as gt,X as ft,q as De}from"./index-BP1z44Uk.js";import{u as yt,A as _t}from"./useAsmrPopup-CDcDqi0C.js";import{u as bt,d as kt,e as vt,f as wt,g as Ct,h as Nt,S as Fe,a as Tt,i as We,j as St,k as At,V as Bt,l as Rt}from"./PlayerProvider-pi0at080.js";import{p as ne}from"./page.module-C1MlZzf3.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./libraryInvalidation-CVK2SYUR.js";import"./usePopup-DS9jMzp6.js";const Lt="_sortSelect_1f2gy_1",Mt="_grid_1f2gy_11",Pt="_fetching_1f2gy_25",It="_thumbPlaceholder_1f2gy_64",xt="_asmrCardWrap_1f2gy_100",$t="_bookmarkBtn_1f2gy_105",Et="_bookmarked_1f2gy_129",jt="_statusMsg_1f2gy_152",Ot="_skeletonCard_1f2gy_160",Ht="_skeletonThumb_1f2gy_165",Dt="_skeletonLine_1f2gy_171",Ft="_shimmer_1f2gy_178",Wt="_matureToggleWrap_1f2gy_219",qt="_matureLabel_1f2gy_226",Ut="_translateToggleWrap_1f2gy_232",Vt="_filterTogglesGroup_1f2gy_239",Jt="_filterBar_1f2gy_251",Kt="_filterLabel_1f2gy_258",zt="_detailOverlay_1f2gy_263",Gt="_detailModal_1f2gy_275",Yt="_detailClose_1f2gy_287",Qt="_detailHeader_1f2gy_303",Xt="_detailCover_1f2gy_309",Zt="_detailInfo_1f2gy_318",ea="_detailTitle_1f2gy_322",ta="_detailRj_1f2gy_329",aa="_metaRow_1f2gy_335",na="_metaLabel_1f2gy_341",ra="_tagChips_1f2gy_347",sa="_tagChip_1f2gy_347",oa="_npOverlay_1f2gy_363",la="_playerBarDocked_1f2gy_378",ia="_playerBarDockedHidden_1f2gy_392",ca="_npOverlayControlsHidden_1f2gy_403",da="_npArrow_1f2gy_403",ua="_npImageCount_1f2gy_404",ma="_npStage_1f2gy_413",ha="_sliderViewport_1f2gy_429",pa="_slide_1f2gy_429",ga="_slideImg_1f2gy_431",fa="_npStageBlank_1f2gy_450",ya="_sliderTrack_1f2gy_469",_a="_slideImgLoaded_1f2gy_502",ba="_slideSpinner_1f2gy_507",ka="_npArrowLeft_1f2gy_557",va="_npArrowRight_1f2gy_561",wa="_chapterPanel_1f2gy_578",Ca="_chapterRow_1f2gy_593",Na="_chapterRowActive_1f2gy_612",Ta="_chapterRowTime_1f2gy_616",Sa="_chapterRowLabel_1f2gy_627",Aa="_npBackdrop_1f2gy_633",Ba="_playerBtn_1f2gy_639",Ra="_playerBtnActive_1f2gy_639",La="_tracksSection_1f2gy_645",Ma="_tracksHeading_1f2gy_649",Pa="_trackList_1f2gy_655",Ia="_trackRow_1f2gy_664",xa="_trackIcon_1f2gy_682",$a="_trackLabel_1f2gy_687",Ea="_trackType_1f2gy_692",ja="_noTracks_1f2gy_697",Oa="_playAllBtn_1f2gy_702",Ha="_detailActions_1f2gy_715",Da="_playerBar_1f2gy_378",Fa="_playerActions_1f2gy_738",Wa="_playerInfo_1f2gy_744",qa="_playerTitle_1f2gy_749",Ua="_playerTrack_1f2gy_758",Va="_playerControls_1f2gy_764",Ja="_seekRow_1f2gy_771",Ka="_playerButtons_1f2gy_779",za="_seekBtn_1f2gy_814",Ga="_playBtn_1f2gy_824",Ya="_seekBar_1f2gy_871",Qa="_volumeBar_1f2gy_872",Xa="_timeLabel_1f2gy_964",Za="_playerRight_1f2gy_970",en="_volumeIcon_1f2gy_976",tn="_playerToggle_1f2gy_1020",t={sortSelect:Lt,grid:Mt,fetching:Pt,thumbPlaceholder:It,asmrCardWrap:xt,bookmarkBtn:$t,bookmarked:Et,statusMsg:jt,skeletonCard:Ot,skeletonThumb:Ht,skeletonLine:Dt,shimmer:Ft,matureToggleWrap:Wt,matureLabel:qt,translateToggleWrap:Ut,filterTogglesGroup:Vt,filterBar:Jt,filterLabel:Kt,detailOverlay:zt,detailModal:Gt,detailClose:Yt,detailHeader:Qt,detailCover:Xt,detailInfo:Zt,detailTitle:ea,detailRj:ta,metaRow:aa,metaLabel:na,tagChips:ra,tagChip:sa,npOverlay:oa,playerBarDocked:la,playerBarDockedHidden:ia,npOverlayControlsHidden:ca,npArrow:da,npImageCount:ua,npStage:ma,sliderViewport:ha,slide:pa,slideImg:ga,npStageBlank:fa,sliderTrack:ya,slideImgLoaded:_a,slideSpinner:ba,npArrowLeft:ka,npArrowRight:va,chapterPanel:wa,chapterRow:Ca,chapterRowActive:Na,chapterRowTime:Ta,chapterRowLabel:Sa,npBackdrop:Aa,playerBtn:Ba,playerBtnActive:Ra,tracksSection:La,tracksHeading:Ma,trackList:Pa,trackRow:Ia,trackIcon:xa,trackLabel:$a,trackType:Ea,noTracks:ja,playAllBtn:Oa,detailActions:Ha,playerBar:Da,playerActions:Fa,playerInfo:Wa,playerTitle:qa,playerTrack:Ua,playerControls:Va,seekRow:Ja,playerButtons:Ka,seekBtn:za,playBtn:Ga,seekBar:Ya,volumeBar:Qa,timeLabel:Xa,playerRight:Za,volumeIcon:en,playerToggle:tn},an=({work:r,onClose:o,onPlay:k,t:g})=>{const{data:i,isLoading:u}=Ve(r.id||null),y=Je(r),{data:S}=ct(y||void 0),{toggle:_,bookmarkedIds:C}=Ke(),{data:P}=ze(y||void 0),R=y?C.has(y):!!S?.inLibrary,f=$e(()=>(i?.description||r.description||"").split(`
2
- `).map(c=>{const l=c.indexOf(":");return l===-1?null:{label:c.slice(0,l),value:c.slice(l+1).trim()}}).filter(c=>!!c&&!!c.value),[i?.description,r.description]),m=i?.tracks||[],L=r.thumbnail||i?.images?.[0],A=$e(()=>{const c=P?.progress??[];return c.length>0?c.reduce((l,B)=>l.updatedAt>=B.updatedAt?l:B):null},[P]),h=A&&A.trackIndex<m.length?A.trackIndex:null;return e("div",{className:t.detailOverlay,onClick:o,children:e("div",{className:t.detailModal,onClick:c=>c.stopPropagation(),children:[e("button",{className:t.detailClose,onClick:o,"aria-label":"Close",children:e(w,{name:"times"})}),e("div",{className:t.detailHeader,children:[L?e("img",{className:t.detailCover,src:L,alt:r.name,decoding:"async"}):e("div",{className:`${t.detailCover} ${t.thumbPlaceholder}`}),e("div",{className:t.detailInfo,children:[e("h2",{className:t.detailTitle,children:g?g(r.name):r.name}),e("p",{className:t.detailRj,children:r.id}),f.map(c=>c.label==="Tags"?e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:"Tags"}),e("span",{className:t.tagChips,children:c.value.split(", ").map(l=>e("span",{className:t.tagChip,children:l},l))})]},c.label):e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:c.label}),c.value]},c.label))]})]}),e("div",{className:t.tracksSection,children:[e("h3",{className:t.tracksHeading,children:u?"Loading tracks…":`Tracks (${m.length})`}),!u&&(m.length>0?e("ul",{className:t.trackList,children:m.map((c,l)=>e("li",{children:e("button",{className:t.trackRow,onClick:()=>k(r,m,l),children:[e(w,{name:"play",className:t.trackIcon}),e("span",{className:t.trackLabel,children:c.resolutionStr}),e("span",{className:t.trackType,children:c.hls?"HLS":"MP3"})]})},c.link))}):e("p",{className:t.noTracks,children:"No audio streams available for this work."}))]}),e("div",{className:t.detailActions,children:[!u&&m.length>0&&e("button",{className:t.playAllBtn,onClick:()=>k(r,m,0),children:[e(w,{name:"play"})," Play from start"]}),!u&&h!==null&&A&&e("button",{className:t.playAllBtn,onClick:()=>k(r,m,h),children:[e(w,{name:"history"})," Resume track ",h+1," ·"," ",Re(A.currentTime),A.duration>0?` / ${Re(A.duration)}`:""]}),y&&e("button",{className:t.playAllBtn,onClick:()=>_({rjCode:y,title:r.name,thumbnail:r.thumbnail||"",isAdult:!!r.isAdult}),"aria-pressed":R,children:[e(w,{name:R?"check":"plus"})," ",R?"In listening list":"Add to listening list"]})]})]})})},nn=r=>{const{engine:o}=bt({volumeKey:"asmrVolume",mutedKey:"asmrMuted"});return e(kt,{engine:o,children:e(rn,{...r})})},rn=({title:r,images:o,chapters:k,tracks:g,trackIndex:i,expanded:u,isAdult:y,rjCode:S,t:_,onTrackChange:C,onExpandedChange:P,onClose:R})=>{const f=vt(),m=f.mediaRef,{duration:L,volume:A,isPlaying:h}=wt(f),{currentTime:c}=Ct(f),[l,B]=b(!0),[p,x]=b(0),[j,Q]=b(new Set),[N,K]=b(!1),[$,D]=b(!0),U=H("");U.current||(U.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`asmr-${Date.now()}-${Math.random().toString(36).slice(2)}`);const ue=Ue(),F=Be.useMemo(()=>S?dt(S):"",[S]),W=ut(),_e=mt(),{data:X}=ze(F||void 0),[be,re]=b(!1),me=H(""),q=H(null),he=H(0),V=H(0),se=H(0),oe=g[i],pe=oe?.link,J=oe?.hls,ge=oe?.resolutionStr||"",le=o.length>0,Z=`${F}:${i}`,ie=Be.useMemo(()=>(X?.progress??[]).find(s=>s.trackIndex===i)??null,[X,i]),ke=H({workId:"",trackIndex:0,trackLabel:""}),z=H(X);z.current=X,ke.current={workId:F,trackIndex:i,trackLabel:ge};const ce=Y((a,s,v,O=!1)=>{!a.workId||!v||v<10||!O&&Math.abs(s-he.current)<5||(he.current=s,W.mutate({workId:a.workId,trackIndex:a.trackIndex,trackLabel:a.trackLabel,currentTime:Math.floor(s),duration:Math.floor(v),title:r,thumbnail:o[0]||"",rjCode:a.workId,isAdult:y?1:0}))},[W,r,o,y]),fe=Y((a=!1)=>{q.current&&(clearTimeout(q.current),q.current=null),ce(ke.current,V.current,se.current,a)},[ce]),ee=H(fe);ee.current=fe;const ve=H(ce);ve.current=ce,T(()=>{if(!m.current||!pe)return;const s={workId:F,trackIndex:i,trackLabel:ge},v=()=>{q.current&&(clearTimeout(q.current),q.current=null),ve.current(s,f.getTimeline().currentTime,f.getState().duration||se.current,!0)};V.current=0,se.current=0,he.current=0;const O=z.current?.progress?.find(at=>at.trackIndex===i),Ne=O?.currentTime||0,Te=O?.duration||0,Se=Ne>=10&&Te-Ne>=15,tt=f.loadSource({url:pe,hls:J},{autoPlay:!Se});return()=>{v(),tt()}},[f,pe,J,F,i,ge,m]),T(()=>{const a=()=>{document.visibilityState==="hidden"&&ee.current()},s=()=>ee.current();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",s),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",s)}},[]),T(()=>{if(!ie||me.current===Z||!(L>0))return;const a=ie.currentTime||0,s=ie.duration||L;me.current=Z,!(!(a>=10&&s-a>=15&&V.current<a)||!m.current)&&(f.seek(a),V.current=a,f.play())},[f,m,ie,L,Z]),T(()=>{if(u)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[u]),T(()=>{x(0)},[o]),T(()=>{u&&D(!0)},[u]),T(()=>{N&&D(!0)},[N]);const de=Y(a=>{if(!r||g.length===0)return;const s=g[i],v=s?`${s.resolutionStr} (${i+1}/${g.length})`:"",O=m.current,Ne=O?O.currentTime:0,Te=O&&O.duration||0,Se=o[0]||"";Le.discord.asmrPresence.mutate({title:r,trackLabel:v,isPlaying:a,thumbnail:Se,thumbnails:o,currentTime:Ne,duration:Te,isAdult:!!y,rjCode:S||"",sessionId:U.current}).catch(()=>{}),Le.discord.heartbeat.mutate({sessionId:U.current}).catch(()=>{})},[m,r,g,i,o,y,S]);T(()=>{de(h)},[de,h,i,r,u]),T(()=>{if(!h)return;const a=window.setInterval(()=>de(!0),15e3);return()=>window.clearInterval(a)},[h,de]),T(()=>{const a=U.current,s=()=>pt(a),v=()=>s(),O=()=>{document.visibilityState==="hidden"&&s()};return window.addEventListener("pagehide",v),window.addEventListener("beforeunload",v),document.addEventListener("visibilitychange",O),()=>{window.removeEventListener("pagehide",v),window.removeEventListener("beforeunload",v),document.removeEventListener("visibilitychange",O),s()}},[]);const n=Y(a=>{Q(s=>{if(s.has(a))return s;const v=new Set(s);return v.add(a),v})},[]),d=Y((a,s)=>{a&&a.complete&&a.naturalWidth>0&&n(s)},[n]);T(()=>{if(!u)return;const a=s=>{if(!(s.defaultPrevented||s.ctrlKey||s.metaKey||s.altKey||s.target instanceof Element&&s.target.closest('input, textarea, select, button, [role="slider"], [contenteditable="true"]'))){if(s.key==="Escape"){N?K(!1):P(!1);return}!l||o.length<2||(s.key==="ArrowLeft"&&x(v=>Math.max(0,v-1)),s.key==="ArrowRight"&&x(v=>Math.min(o.length-1,v+1)))}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[u,l,o.length,N,P]);const I=()=>{fe(!0),i<g.length-1?C(i+1):re(!0)},we=a=>{const s=a.currentTarget.currentTime;V.current=s,q.current&&clearTimeout(q.current),q.current=setTimeout(()=>ee.current(),5e3)},te=()=>{ee.current()},Ce=a=>{const s=a.currentTarget.duration;se.current=Number.isFinite(s)?s:0},G=Y(()=>{F&&_e.mutate({rjCode:F,title:r,thumbnail:o[0]||"",status:"Completed",isAdult:!!y,silent:!0}),re(!1),R(),ue("/")},[F,_e,r,o,y,R,ue]),Qe=k.reduce((a,s,v)=>c>=s.time?v:a,-1),Xe=a=>f.seek(a);Nt(f,()=>D(!0),!u||!l&&!N);const Ze=e(E,{children:[e("div",{className:t.playerButtons,children:[e("button",{className:t.playerBtn,onClick:()=>C(Math.max(0,i-1)),disabled:i===0,"aria-label":"Previous track",children:e(w,{name:"step-backward"})}),e(Fe,{seconds:-10,className:`${t.playerBtn} ${t.seekBtn}`}),e(Tt,{className:`${t.playerBtn} ${t.playBtn}`}),e(Fe,{seconds:10,className:`${t.playerBtn} ${t.seekBtn}`}),e("button",{className:t.playerBtn,onClick:()=>C(Math.min(g.length-1,i+1)),disabled:i>=g.length-1,"aria-label":"Next track",children:e(w,{name:"step-forward"})})]}),e("div",{className:t.seekRow,children:[e(We,{className:t.timeLabel}),e(St,{className:t.seekBar}),e(We,{className:t.timeLabel,durationOnly:!0})]})]}),Me=e(E,{children:[e("button",{className:`${t.playerBtn} ${t.playerToggle}`,onClick:()=>P(!u),"aria-label":u?"Minimize player":"Expand player",title:u?"Minimize to browse":"Expand",children:u?e(w,{name:"chevron-down"}):e(w,{name:"chevron-up"})}),e("div",{className:t.playerInfo,children:[e(At,{}),e("p",{className:t.playerTitle,title:r,children:_?_(r):r}),e("p",{className:t.playerTrack,children:[oe?.resolutionStr||"",g.length>1?` (${i+1}/${g.length})`:""]})]}),e("div",{className:t.playerControls,children:Ze}),e("div",{className:t.playerRight,children:[A===0?e(w,{name:"volume-mute",className:t.volumeIcon}):A<.5?e(w,{name:"volume-down",className:t.volumeIcon}):e(w,{name:"volume-up",className:t.volumeIcon}),e(Bt,{className:t.volumeBar})]}),e("div",{className:t.playerActions,children:[u&&le&&e("button",{className:t.playerBtn,onClick:()=>B(a=>!a),"aria-label":l?"Hide images":"Show images",title:l?"Hide images":"Show images",children:l?e(w,{name:"eye-slash"}):e(w,{name:"image"})}),u&&k.length>0&&e("button",{className:`${t.playerBtn} ${N?t.playerBtnActive:""}`,onClick:()=>K(a=>!a),"aria-label":N?"Hide bookmarks":"Show bookmarks",title:"Timestamps",children:e(w,{name:"list-ol"})}),e("button",{className:t.playerBtn,onClick:R,"aria-label":"Close player",children:e(w,{name:"times"})})]})]}),Pe=e(Rt,{preload:"metadata",onPause:te,onTimeUpdate:we,onLoadedMetadata:Ce,onEnded:I}),Ie=e(Ge,{isOpen:be,onClose:()=>re(!1),title:"Finished!",children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e(w,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),e("p",{style:{fontSize:"1.1rem",fontWeight:600},children:_?_(r):r}),e("p",{style:{color:"var(--text-secondary)"},children:"You finished this work!"}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(He,{variant:"secondary",onClick:()=>re(!1),children:"Close"}),e(He,{onClick:G,children:"Mark Completed & Back to Home"})]})]})});if(!u)return Ee(e(E,{children:[Pe,e("div",{ref:f.containerRef,"data-player-root":"true",className:t.playerBar,children:Me}),Ie]}),document.body);const ye=Math.min(p,Math.max(0,o.length-1)),xe=o[ye],et=l&&le&&!!xe&&!j.has(xe);return Ee(e(E,{children:[Pe,Ie,e("div",{ref:f.containerRef,"data-player-root":"true",className:`${t.npOverlay} ${$?"":t.npOverlayControlsHidden}`,children:[e("div",{className:`${t.npStage} ${!l||!le?t.npStageBlank:""}`,onClick:()=>D(a=>!a),children:l&&le&&e(E,{children:[e("div",{className:t.sliderViewport,children:[e("div",{className:t.sliderTrack,style:{transform:`translateX(-${ye*100}%)`},children:o.map(a=>e("div",{className:t.slide,children:e("img",{ref:s=>d(s,a),src:a,alt:`${_?_(r):r} - work image`,loading:"lazy",decoding:"async",draggable:!1,onLoad:()=>n(a),onError:()=>n(a),className:`${t.slideImg} ${j.has(a)?t.slideImgLoaded:""}`})},a))}),et&&e("span",{className:t.slideSpinner,"aria-label":"Loading image"})]}),o.length>1&&e(E,{children:[e("button",{className:`${t.npArrow} ${t.npArrowLeft}`,onClick:a=>{a.stopPropagation(),x(s=>Math.max(0,s-1)),D(!0)},disabled:ye===0,"aria-label":"Previous image",children:e(w,{name:"chevron-left"})}),e("button",{className:`${t.npArrow} ${t.npArrowRight}`,onClick:a=>{a.stopPropagation(),x(s=>Math.min(o.length-1,s+1)),D(!0)},disabled:ye===o.length-1,"aria-label":"Next image",children:e(w,{name:"chevron-right"})}),e("span",{className:t.npImageCount,onClick:a=>a.stopPropagation(),children:[ye+1," / ",o.length]})]})]})}),e("div",{className:`${t.playerBar} ${t.playerBarDocked} ${$?"":t.playerBarDockedHidden}`,onClick:a=>a.stopPropagation(),children:[Me,N&&e(E,{children:[e("div",{className:t.npBackdrop,onClick:()=>K(!1)}),e("div",{className:t.chapterPanel,children:k.map((a,s)=>e("button",{className:`${t.chapterRow} ${s===Qe?t.chapterRowActive:""}`,title:_?_(a.label):a.label,onClick:()=>{Xe(a.time),K(!1)},children:[e("span",{className:t.chapterRowTime,children:Re(a.time)}),e("span",{className:t.chapterRowLabel,title:_?_(a.label):a.label,children:_?_(a.label):a.label})]},`${a.time}-${s}`))})]})]})]})]}),document.body)},sn="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",on=r=>{try{return JSON.parse(r.detail)}catch{return null}},ln=({isOpen:r,onClose:o,onSuccess:k})=>{const[g,i]=b(1),[u,y]=b(typeof navigator<"u"?navigator.userAgent:""),[S,_]=b(""),[C,P]=b(!1),[R,f]=b(!1),m=H(null),L=typeof navigator<"u"?navigator.userAgent:"",A=/android/i.test(L),h=/firefox|fxios/i.test(L)&&!A,c=!h&&!A&&/chrome|chromium|edg|brave/i.test(L),l=h||c;T(()=>{r&&(i(1),y(typeof navigator<"u"?navigator.userAgent:""),_(""),P(!1),f(!1))},[r]),T(()=>()=>{m.current&&(window.removeEventListener("dango:jasmr-cookie",m.current),m.current=null)},[]);const B=async()=>{localStorage.setItem("jasmr_ua",u),window.open("https://japaneseasmr.com","_blank","noopener,noreferrer"),i(2)},p=()=>{if(R)return;f(!0);const j=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,Q=window.setTimeout(()=>{f(!1),m.current&&(window.removeEventListener("dango:jasmr-cookie",m.current),m.current=null),ae.error("Helper not detected - install it via about:debugging first.")},3e3),N=K=>{const $=on(K);if(!(!$||$.requestId!==j))if(window.clearTimeout(Q),window.removeEventListener("dango:jasmr-cookie",N),m.current=null,f(!1),$?.ok&&$.cookie)_($.cookie),ae.success("Cookie extracted from helper!");else if($?.error==="NO_COOKIE"){const D=$.debug?.stores?.length??0,U=$.debug?.names??[];ae.error(`Helper found no cf_clearance (checked ${D} stores, saw: ${U.join(", ")||"none"}) - solve the challenge on the JapaneseASMR tab first.`)}else ae.error("Helper request failed - try again.")};m.current=N,window.addEventListener("dango:jasmr-cookie",N),window.dispatchEvent(new CustomEvent("dango:get-jasmr-cookie",{detail:{requestId:j}}))},x=async()=>{if(!S.trim()){ae.error("Please enter the cf_clearance cookie");return}P(!0);try{localStorage.setItem("jasmr_cookie",S.trim()),ae.success("Cookie updated successfully!"),k?.(),o()}catch{ae.error("Failed to save cookie")}finally{P(!1)}};return e(Ge,{isOpen:r,onClose:o,title:"JapaneseASMR Verification Required",children:e("div",{className:M.container,children:g===1?e(E,{children:[e("p",{children:["JapaneseASMR is protected by a Cloudflare challenge. Solve it once in your browser and paste the ",e("strong",{children:"cf_clearance"})," cookie so the app can load the site for you."]}),e("div",{className:M.field,children:[e("label",{children:"Your User-Agent (must match the browser you solve the challenge with):"}),e("textarea",{value:u,onChange:j=>y(j.currentTarget.value),rows:3,className:M.textarea})]}),e("div",{className:M.actions,children:[e("button",{className:M.secondaryButton,onClick:o,children:"Cancel"}),e("button",{className:M.button,onClick:B,children:"Start Verification (Opens JapaneseASMR)"})]})]}):e(E,{children:[e("p",{children:["1. Solve the challenge on the ",e("strong",{children:"JapaneseASMR tab"})," (keep that tab open).",e("br",{}),"2. Copy the ",e("strong",{children:"cf_clearance"})," cookie value using one of these:",e("br",{}),e("br",{}),e("strong",{children:"Chrome / Edge — DevTools:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Application"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", double-click its ",e("strong",{children:"Value"})," to select it, then copy.",e("br",{}),e("br",{}),e("strong",{children:"Firefox — Storage Inspector:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Storage"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", right-click the value → ",e("strong",{children:"Copy Value"}),".",e("br",{}),e("br",{}),e("strong",{children:"Either browser — extension:"})," open"," ",e("strong",{children:"Cookie Manager"})," while on the JapaneseASMR tab, find"," ",e("strong",{children:"cf_clearance"}),", and copy its value (or use the extension's export).",e("br",{}),e("br",{}),"3. Paste it below. Copy ",e("strong",{children:"only the value"})," — remove any"," ",e("code",{children:"cf_clearance="})," prefix or quotes if they were included."]}),l&&e("div",{className:M.hint,children:[e("strong",{children:"Dango helper (one-time setup):"})," ",h?e(E,{children:["type ",e("code",{children:"about:debugging"})," in the address bar →"," ",e("strong",{children:"This Firefox"})," → ",e("strong",{children:"Load Temporary Add-on"})," ","→ open the ",e("code",{children:"dango-extension/firefox"})," folder and pick"," ",e("code",{children:"manifest.json"}),". (Temporary helpers unload when Firefox closes - repeat after a restart.)"]}):e(E,{children:["type ",e("code",{children:"chrome://extensions"})," in the address bar → enable"," ",e("strong",{children:"Developer mode"})," → ",e("strong",{children:"Load unpacked"})," → open the ",e("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice - expected.)"]})," ","Use this link to download the extension and extract it:"," ",e("a",{href:sn,target:"_blank",rel:"noreferrer",className:M.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",e("div",{className:M.actions,children:e("button",{className:M.button,onClick:p,disabled:R,type:"button",children:R?"Extracting…":"Extract cookie from helper"})})]}),e("div",{className:M.field,children:[e("label",{children:"cf_clearance cookie value:"}),e("input",{type:"text",value:S,onChange:j=>_(j.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:M.input})]}),e("div",{className:M.actions,children:[e("button",{className:M.secondaryButton,onClick:o,children:"Cancel"}),e("button",{className:M.secondaryButton,onClick:()=>i(1),children:"Back"}),e("button",{className:M.button,onClick:x,disabled:C,children:C?"Saving...":"Submit"})]})]})})})},Ye="asmrTranslateCache",cn=10080*60*1e3;function dn(){try{const r=localStorage.getItem(Ye);if(!r)return new Map;const o=JSON.parse(r);return new Map(Object.entries(o))}catch{return new Map}}function un(r){try{const o={};for(const[k,g]of r)o[k]=g;localStorage.setItem(Ye,JSON.stringify(o))}catch{}}function qe(r){return/[\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF]/.test(r)}async function mn(r){const o=r.map(i=>i.trim()).filter(Boolean);if(o.length===0)return new Map;const k=await Le.settings.translate.mutate({texts:o,source:"ja",target:"en"}),g=new Map;for(const[i,u]of Object.entries(k.translations||{}))g.set(i,u);for(const i of o)g.has(i)||g.set(i,i);return g}function hn(r,o){const[k,g]=b(new Map),[i,u]=b(!1),y=H(null),S=r.join("");return T(()=>{const C=S?S.split(""):[];if(!o||C.length===0){g(new Map),u(!1);return}const P=Array.from(new Set(C.map(h=>h.trim()).filter(Boolean).filter(qe)));if(P.length===0){g(new Map);return}y.current||(y.current=dn());const R=Date.now(),f=new Map,m=[];for(const h of P){const c=y.current.get(h);c&&R-c.ts<cn?f.set(h,c.t):m.push(h)}if(m.length===0){g(f);return}let L=!1;u(!0);const A=[];for(let h=0;h<m.length;h+=15)A.push(m.slice(h,h+15));return(async()=>{const h=new Map;for(const l of A){try{const B=await mn(l);for(const[p,x]of B)h.set(p,x)}catch{}await new Promise(B=>setTimeout(B,120))}if(L)return;if(y.current){for(const[l,B]of h)y.current.set(l,{t:B,ts:Date.now()});un(y.current)}const c=new Map([...f,...h]);g(c),u(!1)})(),()=>{L=!0}},[o,S]),{t:C=>!o||!C||!qe(C)?C:k.get(C.trim())||C,map:k,isTranslating:i}}const pn=[{label:"Date",options:[{value:"latest",label:"Latest"},{value:"oldest",label:"Oldest"}]},{label:"Title",options:[{value:"title_asc",label:"A → Z"},{value:"title_desc",label:"Z → A"}]},{label:"Popular (Views)",options:[{value:"popular_recent",label:"Recent"},{value:"popular_week",label:"Week"},{value:"popular_month",label:"Month"},{value:"popular_6_months",label:"6 Months"},{value:"popular_year",label:"Year"},{value:"popular",label:"All Time"}]},{label:"Most Commented",options:[{value:"comments_week",label:"Week"},{value:"comments_month",label:"Month"},{value:"comments_year",label:"Year"},{value:"comments",label:"All Time"}]},{label:"Other",options:[{value:"random",label:"Random"}]}],gn=[{value:"",label:"All"},{value:"sfw",label:"SFW / 全年齢"},{value:"r-15",label:"R-15"},{value:"r-18",label:"NSFW / R18"},{value:"yuri",label:"Yuri / Girls love / 百合"},{value:"otokonoko",label:"Otoko no ko / 男の娘"},{value:"futanari",label:"Futanari / フタナリ"},{value:"r-18g",label:"R-18G / グロ"}],fn=[{value:"sfw",label:"SFW / 全年齢"}],Pn=()=>{const{rj:r}=nt(),o=Ue(),[k,g]=rt(),{hasConsent:i,grant:u}=gt(),[y,S]=b(!1),[_,C]=b(()=>k.get("q")||""),[P,R]=b(()=>k.get("q")||""),[f,m]=b("latest"),[L,A]=b("sfw"),[h,c]=b(1),[l,B]=b(null),[p,x]=b(null),[j,Q]=b(!0),[N,K]=b(()=>localStorage.getItem("asmrTranslateEN")==="true"),[$,D]=b(!1),U=st(),{toggle:ue,bookmarkedIds:F}=Ke(),{popup:W,openPopup:_e,scheduleClose:X,cancelClose:be,closePopup:re}=yt();T(()=>ft("jasmr",()=>D(!0)),[]),T(()=>{localStorage.setItem("asmrTranslateEN",String(N))},[N]);const me=i,q=me?L:"sfw",he=me?gn:fn,{data:V,isLoading:se,isError:oe,isFetching:pe}=ht(P,h,f,q),J=Be.useMemo(()=>V?.shows??[],[V?.shows]),ge=V?.hasNext??!1;T(()=>{if(!r){l&&!p&&B(null);return}const n=r.toUpperCase();if(p&&(p.work.id?.toUpperCase()===n||p.work._id?.toUpperCase()===n)){l&&B(null);return}const d=J.find(I=>(I.id||I._id)?.toUpperCase()===n);d?(!l||(l.id||l._id)!==(d.id||d._id))&&B(d):(!l||(l.id||l._id)?.toUpperCase()!==n)&&B({_id:n,id:n,name:n})},[r,J,p,l]);const le=Y(()=>{o("/asmr")},[o]);T(()=>{!r&&p&&x(null)},[r,p]);const{data:Z}=Ve(p&&p.work.id||null),ie=p?[p.work.thumbnail,...Z?.images||[]].filter(Boolean):[],ke=[...J.map(n=>n.name),l?.name||"",p?.work.name||"",...Z?.chapters?.map(n=>n.label)||[]].filter(Boolean),{t:z}=hn(ke,N);T(()=>{const n=p?p.work.name:l?l.name:r?r.toUpperCase():"",d=n?N?z(n):n:"",I=d?`${d} - dango`:"dango";document.title=I;try{window.history.replaceState(window.history.state,I,window.location.href)}catch{}},[l,p,r,N,z]);const ce=n=>{n.preventDefault(),R(_),c(1);const d=new URLSearchParams(k);_.trim()?d.set("q",_.trim()):d.delete("q"),d.delete("page"),g(d,{replace:!0})};T(()=>{const n=k.get("q")||"";C(d=>d===n?d:n),R(d=>d===n?d:n),c(1)},[k]);const fe=n=>{n.currentTarget.checked&&!i&&S(!0)},ee=()=>{u(),S(!1),c(1)},ve=()=>{S(!1)},de=Y((n,d,I)=>{B(null),Q(!0),x({work:n,tracks:d,index:I})},[]);return e("div",{className:`${ne.page} ${p?ne.pageWithPlayer:""}`,children:[!(p&&j)&&e(E,{children:[e("header",{className:ne.header,children:[e("h1",{className:ne.pageTitle,children:[e(w,{name:"headphones"})," ASMR"]}),e("form",{className:ne.searchForm,onSubmit:ce,children:[e("input",{className:ne.searchInput,type:"text",value:_,onChange:n=>C(n.currentTarget.value),placeholder:"Search works, circles, CV… (-word excludes)","aria-label":"Search ASMR works"}),e("button",{className:ne.searchBtn,type:"submit","aria-label":"Search",children:e(w,{name:"search"})})]})]}),e("div",{className:t.filterBar,children:[e("label",{className:t.filterLabel,htmlFor:"asmr-sort",children:"Sort"}),e("select",{id:"asmr-sort",className:t.sortSelect,value:f,onChange:n=>{m(n.currentTarget.value),c(1)},children:pn.map(n=>e("optgroup",{label:n.label,children:n.options.map(d=>e("option",{value:d.value,children:d.label},d.value))},n.label))}),e("label",{className:t.filterLabel,htmlFor:"asmr-rating",children:"Type"}),e("select",{id:"asmr-rating",className:t.sortSelect,value:L,onChange:n=>{A(n.currentTarget.value),c(1)},children:he.map(n=>e("option",{value:n.value,children:n.label},n.value))}),e("div",{className:t.filterTogglesGroup,children:[e("div",{className:t.translateToggleWrap,children:[e("span",{className:t.filterLabel,children:"JP"}),e(je,{id:"asmr-translate-toggle",isChecked:N,onChange:n=>K(n.currentTarget.checked)}),e("span",{className:t.filterLabel,children:"EN"})]}),!i&&e("div",{className:t.matureToggleWrap,children:[e("label",{className:t.matureLabel,htmlFor:"asmr-mature-toggle",children:"Mature"}),e(je,{id:"asmr-mature-toggle",isChecked:!1,onChange:fe})]})]})]}),oe?e("p",{className:t.statusMsg,children:"Failed to load works. Please try again."}):se&&J.length===0?e("div",{className:t.grid,"aria-hidden":!0,children:Array.from({length:12}).map((n,d)=>e("div",{className:t.skeletonCard,children:[e("div",{className:`${t.skeletonThumb} ${t.shimmer}`}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"88%"}}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"55%"}})]},d))}):J.length===0?e("p",{className:t.statusMsg,children:"No works found."}):e(E,{children:[e("div",{className:`${t.grid} ${pe?t.fetching:""}`,children:J.map(n=>{const d=N?{...n,name:z(n.name)}:n,I=Je(n),we=Oe(I),te=F.has(we),Ce=`/asmr/${encodeURIComponent(I)}`;return e("div",{className:t.asmrCardWrap,children:[e(lt,{item:{id:we,title:d.name,thumbnail:n.thumbnail||"",typeBadge:I||void 0,isAdult:Ae(n)},linkTo:Ce,hoverIcon:"info",layout:"horizontal",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!1,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:G=>_e(G,{rjCode:I,title:d.name,thumbnail:n.thumbnail||"",isAdult:Ae(n),rating:n.rating,listenTarget:Ce}),onPopupHoverIntent:G=>G?be():X(),rawThumbnail:!0}),e("button",{className:`${t.bookmarkBtn} ${te?t.bookmarked:""}`,onClick:G=>{G.preventDefault(),G.stopPropagation(),ue({rjCode:I,title:n.name,thumbnail:n.thumbnail||"",isAdult:Ae(n)})},title:te?"Remove from listening list":"Add to listening list","aria-label":te?"Remove from listening list":"Add to listening list","aria-pressed":te,children:e(w,{name:te?"check":"plus",size:12})})]},n._id||n.id)})}),e(it,{page:h,canGoNext:ge,onChange:n=>c(n),variant:"labeled"})]})]}),l&&e(an,{work:l,onClose:le,onPlay:de,t:z}),W&&e(_t,{data:W.data,anchorRect:W.rect,bookmarked:F.has(Oe(W.data.rjCode)),onToggleBookmark:()=>ue({rjCode:W.data.rjCode,title:W.data.title,thumbnail:W.data.thumbnail||"",isAdult:W.data.isAdult}),onMouseEnter:be,onMouseLeave:X,onRequestClose:re}),$&&e(ln,{isOpen:$,onClose:()=>D(!1),onSuccess:()=>{U.invalidateQueries({queryKey:[De.asmrBrowse]}),U.invalidateQueries({queryKey:[De.asmrWork]})}}),y&&e(ot,{isOpen:!0,scope:"section",showResetHint:!0,onClose:ve,onGrant:ee}),p&&e(nn,{title:p.work.name,images:ie,chapters:Z?.chapters||[],tracks:p.tracks,trackIndex:p.index,expanded:j,isAdult:!!p.work.isAdult,rjCode:p.work.id||p.work._id,t:z,onTrackChange:n=>x(d=>d&&{...d,index:n}),onExpandedChange:Q,onClose:()=>{x(null),Q(!0),r&&o("/asmr")}})]})};export{Pn as default};
@@ -1 +0,0 @@
1
- import{d as E,A as F,h as O,q as P,g as G,u as e,L as De,T as Q,S as le,a as J,_ as Ze}from"./vendor-core-DfaOB3Rn.js";import{b as Je,u as et,a as tt}from"./vendor-query-BBT5_sHx.js";import{M as me,P as at}from"./MediaCard-BODgA6ir.js";import{A as ie}from"./AnimeCard-a7KkMGQv.js";import{S as We,A as Oe}from"./SkeletonGrid-w6TsxWu7.js";import{I as z}from"./vendor-icons-DrybRNxP.js";import{u as Se,a as se,b as nt,c as rt,q as ze,t as ot,d as Ve,s as st,f as Ne,B as Fe,e as lt,g as ne,h as ke,i as it,j as $e,k as ct,l as dt,m as ut,n as ht,o as pt,p as mt,r as gt,v as vt,w as _t}from"./index-BP1z44Uk.js";import{u as bt}from"./vendor-ui-3qrARCPr.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{R as qe}from"./ResetProgressModal-DEnbScHS.js";import{Q as ft}from"./QueueRail-DGFI6xTM.js";import{u as Ge,M as Ue}from"./useMangaPopup-kZzwoCN6.js";import{M as yt}from"./MangaResetProgressModal-Bd_lIuFo.js";import{u as Qe,a as Nt,m as we,i as Ye,b as Ie,c as He,d as Tt,e as wt}from"./useMangaLibrary-D3Foz2m_.js";import{u as St}from"./useProviders-OKWPunZg.js";import{u as Xe,a as Me,T as kt}from"./useTv-BgO7EV-p.js";import{T as Ct}from"./TvPopup-D6UvGI7M.js";import{u as It,a as At,b as Rt,t as Lt,i as $t,c as Mt,M as xt,T as Bt}from"./useTvLibrary-C6rSJQi_.js";import{A as Pt}from"./AsmrResetProgressModal-CZGzmnlI.js";import{u as Et,a as Dt,b as Wt}from"./useAsmr-ClAcWwjW.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-RZ_j_2BD.js";import"./useAnimeInfoData-8RI9qMzw.js";import"./QueueOptionsButton-C-y5QFrT.js";import"./playbackCompletion-IPHm9fp5.js";import"./usePopup-DS9jMzp6.js";import"./libraryInvalidation-CVK2SYUR.js";const Ot="_sectionWrapper_2p2l1_9",zt="_sectionTitleNoMargin_2p2l1_13",Vt="_carousel_2p2l1_178",B={"section-header":"_section-header_2p2l1_1",sectionWrapper:Ot,sectionTitleNoMargin:zt,"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]=bt({align:n,containScroll:s,dragFree:!0}),[c,N]=E(!1),g=F({scrollFraction:h,threshold:t,onReachThreshold:o}),m=F(!1);O(()=>{g.current={scrollFraction:h,threshold:t,onReachThreshold:o}});const p=P(d=>{N(d.canScrollPrev()||d.canScrollNext())},[]);O(()=>{if(!i)return;const d=()=>{const u=i.scrollProgress();u>=g.current.threshold&&!m.current?(m.current=!0,g.current.onReachThreshold?.()):u<g.current.threshold&&(m.current=!1),p(i)};return i.on("init",d),i.on("reInit",d),i.on("scroll",d),i.on("resize",d),()=>{i.off("init",d),i.off("reInit",d),i.off("scroll",d),i.off("resize",d)}},[i,p]);const T=P(d=>{const u=d.containerNode().firstElementChild;if(!u)return 1;const b=d.rootNode().getBoundingClientRect().width,k=u.getBoundingClientRect().width;return k?Math.max(1,Math.round(b/k)):1},[]),r=P((d,u=!1)=>{if(!i)return;const b=Math.max(1,Math.round(T(i)*g.current.scrollFraction)),k=i.selectedScrollSnap()+(d==="left"?-b:b);i.scrollTo(k,u)},[i,T]),S=P((d=!1)=>{i?.scrollTo(0,d)},[i]);return{emblaRef:l,api:i,canScroll:c,stepBy:r,scrollToStart:S}}const Z=({title:n,eyebrow:s,titleLink:h,loading:t,emptyState:o,carousel:l,layout:i,collapsible:c,defaultExpanded:N=!0,onReachThreshold:g,scrollThreshold:m,isFetchingNextPage:p,resetScrollOnShrink:T,itemCount:r=0,highlight:S,headerActions:d,loadingSkeleton:u,skeletonCount:b=7,children:k})=>{const{lowEndMode:w}=Se(),{emblaRef:A,stepBy:$,scrollToStart:R}=ge({onReachThreshold:g,threshold:m}),[C,U]=G.useState(N);G.useEffect(()=>{U(N)},[N]);const x=G.useRef(0);return G.useEffect(()=>{T&&r>0&&C&&(r<=x.current||x.current===0)&&R(),r>0&&(x.current=r)},[r,T,C,R]),!t&&r===0&&!o&&!c?null:e("section",{className:`${B.sectionWrapper} ${S?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(De,{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",w)},children:e(z,{name:"chevron-left"})}),e("button",{className:B["nav-button"],type:"button","aria-label":"Scroll right",onClick:I=>{I.preventDefault(),$("right",w)},children:e(z,{name:"chevron-right"})})]})]}),e("div",{className:B["header-controls"],children:[d,c&&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(z,{name:"chevron-up"}):e(z,{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:b}).map((I,V)=>e("div",{className:B["carousel-card"],children:u},V)):G.Children.map(k,(I,V)=>e("div",{className:B["carousel-card"],children:I},G.isValidElement(I)&&I.key!=null?I.key:`slide-${V}`)),p&&u&&e("div",{className:B["carousel-card"],children:u})]})})}):e("div",{className:"grid-container",children:t&&r===0?e(We,{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:c,carousel:N,cardConfig:g,layout:m,onReachThreshold:p,scrollThreshold:T,isFetchingNextPage:r,collapsible:S,defaultExpanded:d=!0})=>{const u=m||"vertical";return e(Z,{title:n,eyebrow:s,titleLink:o,loading:i,emptyState:c,carousel:N,layout:u,collapsible:S,defaultExpanded:d,onReachThreshold:p,scrollThreshold:T,isFetchingNextPage:r,resetScrollOnShrink:t,highlight:t,itemCount:h.length,loadingSkeleton:e(Oe,{layout:u}),skeletonCount:7,children:h.map(b=>e(ie,{anime:b,continueWatching:t,onRemove:l,config:g,layout:u},b._id))})},xe=G.memo(Ft),qt="_wrapper_16dme_1",Gt="_arrow_16dme_6",Ut="_select_16dme_15",Te={wrapper:qt,arrow:Gt,select:Ut},re=({value:n,options:s,onChange:h,ariaLabel:t,width:o})=>e("span",{className:Te.wrapper,children:[e("select",{className:Te.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))}),e(z,{name:"chevron-down",size:12,className:Te.arrow})]}),Qt="_sectionWrapper_1he76_2",Yt="_sectionTitleNoMargin_1he76_6",Ht="_carouselContainer_1he76_80",Xt="_carousel_1he76_80",Kt="_carouselInner_1he76_91",jt="_carouselItem_1he76_96",Zt="_rankCard_1he76_133",Jt="_rankPill_1he76_137",ea="_rankGold_1he76_148",ta="_rankSilver_1he76_152",aa="_rankBronze_1he76_156",na="_skeletonPoster_1he76_167",ra="_skeletonText_1he76_168",v={sectionWrapper:Qt,sectionTitleNoMargin:Yt,"section-header":"_section-header_1he76_10","title-wrapper":"_title-wrapper_1he76_18","nav-arrows":"_nav-arrows_1he76_40","nav-button":"_nav-button_1he76_49",carouselContainer:Ht,carousel:Xt,carouselInner:Kt,carouselItem:jt,rankCard:Zt,rankPill:Jt,rankGold:ea,rankSilver:ta,rankBronze:aa,skeletonPoster:na,skeletonText:ra,"header-actions":"_header-actions_1he76_205"},Be="TRENDING_DESC",oa="POPULARITY_DESC",sa=10;function la({title:n,eyebrow:s}){const{lowEndMode:h}=Se(),[t,o]=se("trending_sort",Be),l=[{value:Be,label:"Trending"},{value:oa,label:"All Time"}],{data:i,fetchNextPage:c,hasNextPage:N,isFetchingNextPage:g,isLoading:m,isError:p,error:T}=nt(t,sa),r=Q(()=>i?.pages.flatMap(b=>b)||[],[i]),S=P(()=>{N&&!g&&!m&&c()},[N,g,m,c]),{emblaRef:d,stepBy:u}=ge({onReachThreshold:S});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:b=>{b.preventDefault(),u("left",h)},"aria-label":"Scroll left",children:e(z,{name:"chevron-left"})}),e("button",{className:v["nav-button"],type:"button",onClick:b=>{b.preventDefault(),u("right",h)},"aria-label":"Scroll right",children:e(z,{name:"chevron-right"})})]})]}),e("div",{className:v["header-actions"],children:e(re,{ariaLabel:"Trending sort",width:120,value:t,options:l,onChange:o})})]}),m?e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,children:e("div",{className:v.carouselInner,children:Array.from({length:7}).map((b,k)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.skeletonPoster}),e("div",{className:v.skeletonText})]},k))})})}):p?e(Ce,{message:T instanceof Error?T.message:"An unknown error occurred"}):e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,ref:d,children:e("div",{className:v.carouselInner,children:[r.map((b,k)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.rankCard,children:e(ie,{anime:b})}),e("div",{className:`${v.rankPill} ${k===0?v.rankGold:k===1?v.rankSilver:k===2?v.rankBronze:""}`,children:k+1})]},b._id)),g&&e("div",{className:v.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:v.skeletonPoster})})]})})})]})}const ia=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}],ca=10;function da({eyebrow:n}){const{lowEndMode:s}=Se(),[h,t]=se("latest_releases_format","TV"),{data:o,fetchNextPage:l,hasNextPage:i,isFetchingNextPage:c,isLoading:N,isError:g,error:m}=rt(h,ca),p=Q(()=>o?.pages.flatMap(d=>d)||[],[o]),T=P(()=>{i&&!c&&!N&&l()},[i,c,N,l]),{emblaRef:r,stepBy:S}=ge({onReachThreshold:T});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:d=>{d.preventDefault(),S("left",s)},"aria-label":"Scroll left",children:e(z,{name:"chevron-left"})}),e("button",{className:v["nav-button"],type:"button",onClick:d=>{d.preventDefault(),S("right",s)},"aria-label":"Scroll right",children:e(z,{name:"chevron-right"})})]})]}),e("div",{className:v["header-actions"],children:e("select",{className:v.timeSelect,value:h,onChange:d=>t(d.currentTarget.value),children:ia.map(d=>e("option",{value:d.value,children:d.label},d.value))})})]}),N?e("div",{className:v.carouselContainer,children:e("div",{className:v.carousel,children:e("div",{className:v.carouselInner,children:Array.from({length:7}).map((d,u)=>e("div",{className:v.carouselItem,children:[e("div",{className:v.skeletonPoster}),e("div",{className:v.skeletonText})]},u))})})}):g?e(Ce,{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(d=>e("div",{className:v.carouselItem,children:e(ie,{anime:d})},d._id)),c&&e("div",{className:v.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:v.skeletonPoster})})]})})})]})}const ua="_scheduleSection_lnxz1_1",ha="_sectionTitleRow_lnxz1_5",pa="_sectionTitleNoMargin_lnxz1_11",ma="_sectionHeader_lnxz1_15",ga="_headerActions_lnxz1_25",va="_daySelectorContainer_lnxz1_32",_a="_daySelector_lnxz1_32",ba="_daySelectorInner_lnxz1_49",fa="_dayBtn_lnxz1_60",ya="_active_lnxz1_83",Na="_dayMonth_lnxz1_91",Ta="_dayNum_lnxz1_99",wa="_dayName_lnxz1_105",Sa="_navArrows_lnxz1_118",ka="_navButton_lnxz1_127",Ca="_carouselContainer_lnxz1_158",Ia="_carousel_lnxz1_158",Aa="_carouselInner_lnxz1_170",Ra="_carouselCard_lnxz1_175",L={scheduleSection:ua,sectionTitleRow:ha,sectionTitleNoMargin:pa,sectionHeader:ma,headerActions:ga,daySelectorContainer:va,daySelector:_a,daySelectorInner:ba,dayBtn:fa,active:ya,dayMonth:Na,dayNum:Ta,dayName:wa,navArrows:Sa,navButton:ka,carouselContainer:Ca,carousel:Ia,carouselInner:Aa,carouselCard:Ra},ce=n=>{const s=n.getFullYear(),h=String(n.getMonth()+1).padStart(2,"0"),t=String(n.getDate()).padStart(2,"0");return`${s}-${h}-${t}`},La=async(n,s)=>await ot.data.schedule.query({date:n,format:s}),$a=({eyebrow:n})=>{const[s,h]=E(()=>ce(new Date)),[t,o]=se("schedule_format","TV"),{emblaRef:l,canScroll:i,stepBy:c,scrollToStart:N}=ge(),g=F(null),m=F(!0),{data:p=[],isLoading:T,error:r}=Je({queryKey:[ze.schedule,s,t],queryFn:()=>La(s,t),staleTime:1e3*60*5}),S=Q(()=>{const u=[],b=new Date,k=ce(b),w=new Date(b);w.setDate(b.getDate()-1);const A=ce(w),$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(let R=-6;R<=6;R++){const C=new Date(b);C.setDate(b.getDate()+R),u.push(C)}return u.map(R=>{const C=ce(R),I=C===k?"Today":C===A?"Yest":$[R.getDay()],V=R.getDate(),M=new Intl.DateTimeFormat("en-US",{month:"short"}).format(R);return{dateString:C,dayLabel:I,dayNum:V,monthName:M}})},[]);O(()=>{if(m.current){m.current=!1;return}if(g.current){const u=g.current.querySelector(`[data-date="${s}"]`);u&&u.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[s]),O(()=>{N(!0)},[s,N]);const d=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}];return e("div",{className: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:()=>c("left"),"aria-label":"Scroll left",children:e(z,{name:"chevron-left"})}),e("button",{className:L.navButton,onClick:()=>c("right"),"aria-label":"Scroll right",children:e(z,{name:"chevron-right"})})]})]}),e("div",{className:L.headerActions,children:e(re,{ariaLabel:"Schedule format",width:120,value:t,options:d,onChange:o})})]}),e("div",{className:L.daySelectorContainer,children:e("div",{className:L.daySelector,ref:g,children:e("div",{className:L.daySelectorInner,children:S.map(u=>e("button",{type:"button","data-date":u.dateString,"aria-pressed":s===u.dateString,className:`${L.dayBtn} ${s===u.dateString?L.active:""}`,onClick:()=>h(u.dateString),children:[e("span",{className:L.dayMonth,children:u.monthName}),e("span",{className:L.dayNum,children:u.dayNum}),e("span",{className:L.dayName,children:u.dayLabel})]},u.dateString))})})}),e("div",{className:L.carouselContainer,children:e("div",{className:L.carousel,ref:l,children:e("div",{className:L.carouselInner,children:T?Array.from({length:7}).map((u,b)=>e("div",{className:L.carouselCard,children:e(Oe,{layout:"vertical"})},b)):r?e("div",{style:{width:"100%"},children:e(Ce,{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(u=>e("div",{className:L.carouselCard,children:e(ie,{anime:u,continueWatching:!1,layout:"vertical"},u._id)},u._id))})})})]})},Ma="_bannerContainer_1l49p_1",xa="_hero_1l49p_28",Ba="_ambient_1l49p_37",Pa="_ambientShow_1l49p_49",Ea="_scrim_1l49p_53",Da="_progressLine_1l49p_69",Wa="_paused_1l49p_89",Oa="_dots_1l49p_103",za="_dot_1l49p_103",Va="_dotActive_1l49p_126",Fa="_viewport_1l49p_137",qa="_track_1l49p_144",Ga="_slide_1l49p_150",Ua="_slideInner_1l49p_158",Qa="_poster_1l49p_168",Ya="_posterLandscape_1l49p_179",Ha="_info_1l49p_203",Xa="_kicker_1l49p_208",Ka="_featureLabel_1l49p_215",ja="_scoreChip_1l49p_227",Za="_rise_1l49p_245",Ja="_active_1l49p_249",en="_metaRow_1l49p_305",tn="_metaItem_1l49p_316",an="_metaDivider_1l49p_322",nn="_title_1l49p_329",rn="_genres_1l49p_345",on="_genreTag_1l49p_353",sn="_summary_1l49p_364",ln="_actions_1l49p_376",cn="_watchBtn_1l49p_383",dn="_detailsBtn_1l49p_405",un="_navArrow_1l49p_426",hn="_prevArrow_1l49p_459",pn="_nextArrow_1l49p_463",f={bannerContainer:Ma,hero:xa,ambient:Ba,ambientShow:Pa,scrim:Ea,progressLine:Da,paused:Wa,dots:Oa,dot:za,dotActive:Va,viewport:Fa,track:qa,slide:Ga,slideInner:Ua,poster:Qa,posterLandscape:Ya,info:Ha,kicker:Xa,featureLabel:Ka,scoreChip:ja,rise:Za,active:Ja,metaRow:en,metaItem:tn,metaDivider:an,title:nn,genres:rn,genreTag:on,summary:sn,actions:ln,watchBtn:cn,detailsBtn:dn,navArrow:un,prevArrow:hn,nextArrow:pn},mn=8e3,de=()=>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),[c,N]=E(!1),[g,m]=E(null),[p,T]=E(0),[r,S]=E({front:"",back:"",flip:!1}),d=F(0),u=F(0),b=F(new Set),k=F(null),w=F(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 _=A(n[a]);S(y=>y.flip?{front:_,back:y.back,flip:!1}:{front:y.front,back:_,flip:!0}),o(a)},[$,n,A]),C=P(a=>{if(n.length===0)return;const _=(a%n.length+n.length)%n.length;b.current.has(A(n[_]))?R(_):m(_)},[n,A,R]);O(()=>{let a=!1;return n.forEach(_=>{const y=A(_);if(!y||b.current.has(y))return;const D=new Image;D.src=y;const K=()=>{a||b.current.has(y)||(b.current.add(y),T(q=>q+1))};D.onload=K,D.onerror=K}),()=>{a=!0}},[n,A]),O(()=>{if(n.length!==0&&!r.front){const a=A(n[0]);S({front:a,back:"",flip:!1})}},[n,r.front,A]),O(()=>{if(g!==null){if(g<0||g>=n.length){m(null);return}b.current.has(A(n[g]))&&R(g)}},[g,p,n,A,R]),O(()=>{if(g===null)return;k.current!==null&&window.clearTimeout(k.current);const a=g;return k.current=window.setTimeout(()=>{k.current=null,R(a)},2500),()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)}},[g,R]);const U=P(a=>{C(a)},[C]),x=P(()=>{C(w.current+1)},[C]),I=P(()=>{C(w.current-1)},[C]),V=F(null);if(O(()=>{const a=V.current;if(!a)return;const _=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-d.current<300)return;d.current=D,$(),y.deltaY>0?x():I()}};return a.addEventListener("wheel",_,{passive:!1}),()=>a.removeEventListener("wheel",_)},[n.length,x,I,$]),O(()=>{if(n.length===0||c)return;const a=setTimeout(x,mn);return()=>clearTimeout(a)},[t,x,n.length,l,c]),O(()=>{const a=_=>{const y=_.target;y&&(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.tagName==="SELECT"||y.isContentEditable)||(_.key==="ArrowRight"?(_.preventDefault(),x()):_.key==="ArrowLeft"&&(_.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;w.current=M;const ee=a=>{u.current=a.touches[0].clientX},H=a=>{const y=a.changedTouches[0].clientX-u.current;Math.abs(y)>50&&($(),y>0?I():x())};return e("div",{className:f.bannerContainer,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:e("div",{className:`${f.hero} ${c?f.paused:""}`,onTouchStart:ee,onTouchEnd:H,children:[r.front&&e("img",{src:r.front,alt:"","aria-hidden":"true",className:`${f.ambient} ${r.flip?"":f.ambientShow}`}),r.back&&e("img",{src:r.back,alt:"","aria-hidden":"true",className:`${f.ambient} ${r.flip?f.ambientShow:""}`}),e("div",{className:f.scrim,"aria-hidden":"true"}),n.length>1&&e("div",{className:f.progressLine,"aria-hidden":"true"},`progress-${l}-${M}`),n.length>1&&e("div",{className:f.dots,ref:V,role:"tablist","aria-label":"Spotlight slides",children:n.map((a,_)=>e("button",{role:"tab","aria-selected":_===M,"aria-label":`Go to slide ${_+1}: ${a.title}`,className:`${f.dot} ${_===M?f.dotActive:""}`,onClick:()=>U(_),tabIndex:_===M?0:-1},a.key))}),e("div",{className:f.viewport,children:e("div",{className:f.track,style:{transform:`translateX(-${M*100}%)`},children:n.map((a,_)=>e("div",{className:`${f.slide} ${_===M?f.active:""}`,"aria-hidden":_!==M,children:e("div",{className:f.slideInner,children:[e("img",{src:a.posterSrc,alt:a.posterAlt,className:s==="landscape"?f.posterLandscape:f.poster,decoding:"async"}),e("div",{className:f.info,children:[e("div",{className:`${f.kicker} ${f.rise}`,children:[e("span",{className:f.featureLabel,children:h}),a.score!==void 0&&a.score!==null&&a.score!==""&&e("span",{className:f.scoreChip,children:[e(z,{name:"star",size:12}),e("span",{children:a.score})]})]}),e(De,{to:a.detailTo,className:`${f.title} ${f.rise}`,"aria-label":`View details for ${a.title}`,tabIndex:_===M?0:-1,children:a.title}),a.metaItems.length>0&&e("div",{className:`${f.metaRow} ${f.rise}`,children:a.metaItems.map((y,D)=>e(G.Fragment,{children:[e("span",{className:f.metaItem,children:y}),D<a.metaItems.length-1&&e("div",{className:f.metaDivider})]},D))}),a.tags.length>0&&e("div",{className:`${f.genres} ${f.rise}`,children:a.tags.slice(0,3).map(y=>e("span",{className:f.genreTag,children:y},y))}),a.synopsis&&e("p",{className:`${f.summary} ${f.rise}`,children:a.synopsis}),e("div",{className:`${f.actions} ${f.rise}`,children:[e("button",{className:f.watchBtn,onClick:a.onPrimary,tabIndex:_===M?0:-1,children:[e(z,{name:a.primaryIcon,size:14}),e("span",{children:a.primaryLabel})]}),e("button",{className:f.detailsBtn,onClick:a.onDetails,tabIndex:_===M?0:-1,children:[e(z,{name:"info-circle",size:15}),e("span",{children:"Details"})]})]})]})]})},a.key))})}),n.length>1&&e(le,{children:[e("button",{className:`${f.navArrow} ${f.prevArrow}`,onClick:()=>{$(),I()},"aria-label":"Previous slide",children:e(z,{name:"chevron-left",size:20})}),e("button",{className:`${f.navArrow} ${f.nextArrow}`,onClick:()=>{$(),x()},"aria-label":"Next slide",children:e(z,{name:"chevron-right",size:20})})]})]})})},gn=({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?Ne(o.bannerImage,1280,560):Ne(o.thumbnail,1280,450),posterSrc:Ne(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:st(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})},vn="_emptyState_19tmt_1",_n="_emptyStateIcon_19tmt_16",bn="_emptyStateTitle_19tmt_23",fn="_emptyStateText_19tmt_30",ue={emptyState:vn,emptyStateIcon:_n,emptyStateTitle:bn,emptyStateText:fn},_e=({icon:n,text:s,actionLabel:h,onAction:t,title:o="Nothing is here..."})=>e("div",{className:ue.emptyState,children:[e(z,{name:n,size:48,className:ue.emptyStateIcon}),e("div",{children:[e("h3",{className:ue.emptyStateTitle,children:o}),e("p",{className:ue.emptyStateText,children:s})]}),e(Fe,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:h})]}),yn="_tabBar_irwbm_1",Nn="_tabIndicator_irwbm_24",Tn="_tabButton_irwbm_38",wn="_tabActive_irwbm_64",he={tabBar:yn,tabIndicator:Nn,tabButton:Tn,tabActive:wn};function Sn({options:n,value:s,onChange:h,ariaLabel:t},o){const l=F(null),i=F(new Map),c=F(null),[N,g]=E({left:0,width:0}),m=P((p,T)=>{const r=i.current.get(p),S=l.current;if(r&&S){const d=S.getBoundingClientRect(),u=r.getBoundingClientRect();g({left:u.left-d.left+S.scrollLeft,width:u.width}),T&&r.scrollIntoView({block:"nearest",inline:"nearest"})}},[]);return Ze(()=>{const p=c.current!==null&&c.current!==s;c.current=s,m(s,p)},[s,n.length,m]),O(()=>{if(m(s,!1),typeof ResizeObserver>"u")return;let p=0;const T=l.current;if(!T)return;const r=new ResizeObserver(()=>{cancelAnimationFrame(p),p=requestAnimationFrame(()=>m(s,!1))});r.observe(T);let S=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{S||m(s,!1)}),()=>{S=!0,cancelAnimationFrame(p),r.disconnect()}},[s,n.length,m]),e("div",{className:he.tabBar,ref:p=>{l.current=p,typeof o=="function"?o(p):o&&(o.current=p)},"aria-label":t,children:[e("div",{className:he.tabIndicator,style:{left:N.left,width:N.width}}),n.map(p=>e(Fe,{ref:T=>{T&&i.current.set(p.value,T)},variant:"secondary",size:"sm",className:`${he.tabButton} ${s===p.value?he.tabActive:""}`,onClick:()=>h(p.value),children:p.label},p.value))]})}const pe=G.forwardRef(Sn),kn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}],Pe=({title:n,eyebrow:s,sort:h,mature:t,headerActions:o})=>{const{toggle:l,bookmarkedIds:i}=Qe(),{popup:c,openPopup:N,scheduleClose:g,cancelClose:m,closePopup:p}=Ge(),{data:T,isLoading:r,fetchNextPage:S,hasNextPage:d,isFetchingNextPage:u}=Nt({provider:"",query:"",sort:h,status:"",type:"",rating:t?"safe,suggestive,erotica,pornographic":"safe",mature:t}),b=Q(()=>T?.pages.flatMap(w=>w.items)??[],[T]),k=P(()=>{d&&!u&&!r&&S()},[d,u,r,S]);return e(le,{children:[e(Z,{title:n,eyebrow:s,loading:r,carousel:!0,itemCount:b.length,headerActions:o,onReachThreshold:k,isFetchingNextPage:u,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,children:b.map(w=>{const A=we(w.provider,w.id);return e(me,{item:{id:A,title:w.title,...He(w),thumbnail:Ie(w.provider,w.cover),typeBadge:w.type||void 0,chapterBadge:w.latestChapter?`Ch. ${w.latestChapter}`:null,isAdult:Ye(w)},linkTo:`/manga/${w.provider}/${encodeURIComponent(w.id)}`,hoverIcon:"info",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:$=>N($,{provider:w.provider,mangaId:w.id,title:w.title,altTitle:w.altTitle,cover:w.cover,contentRating:w.contentRating,readTarget:`/manga/${w.provider}/${encodeURIComponent(w.id)}`,mature:t}),onPopupHoverIntent:$=>$?m():g(),rawThumbnail:!0},`${w.provider}-${w.id}`)})}),c&&e(Ue,{data:c.data,anchorRect:c.rect,bookmarked:i.has(we(c.data.provider,c.data.mangaId)),onToggleBookmark:()=>l({id:c.data.mangaId,provider:c.data.provider,title:c.data.title,cover:c.data.cover,altTitle:c.data.altTitle??void 0,contentRating:c.data.contentRating}),onMouseEnter:m,onMouseLeave:g,onRequestClose:p})]})},Cn=()=>{const{options:n}=St(),s=Q(()=>n.some(c=>c.kind==="manga"),[n]),{hasConsent:h}=lt(),[t,o]=se("manga_discover_tab","latest"),[l,i]=se("manga_trending_sort","popular");return s?e(le,{children:[e(pe,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:t,onChange:o}),t==="latest"?e(Pe,{title:"Latest Releases",eyebrow:"Fresh chapters",sort:"latest",mature:h}):e(Pe,{title:"Trending",eyebrow:"Discover",sort:l,mature:h,headerActions:e("select",{className:B["header-select"],value:l,onChange:c=>i(c.currentTarget.value),"aria-label":"Trending sort",children:kn.map(c=>e("option",{value:c.value,children:c.label},c.value))})})]}):null},In=()=>{const n=J(),{data:s,isLoading:h}=Tt(24),[t,o]=E(null),{popup:l,openPopup:i,scheduleClose:c,cancelClose:N,closePopup:g}=Ge(),{toggle:m,bookmarkedIds:p}=Qe(),T=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:T.length>0,highlight:!0,itemCount:T.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:T.map(r=>{const S=r.page??0,d=r.pageCount??0,u=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||"",...He({title:r.title||"",altTitle:r.altTitle}),thumbnail:r.provider?Ie(r.provider,r.cover||""):r.cover||"",chapterBadge:r.chapterNumber?`Ch. ${r.chapterNumber}`:null,isAdult:Ye(r)},linkTo:u,hoverIcon:"book",progress:d>0?{percent:S/d*100,label:`Ch. ${r.chapterNumber} · p. ${S}/${d}`}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>o({libId:r.id,title:r.title||""}),onOpenDetails:b=>i(b,{provider:r.provider||"",mangaId:r.mangaId||"",title:r.title||"",altTitle:r.altTitle,cover:r.cover||"",contentRating:r.contentRating||void 0,readTarget:u}),onPopupHoverIntent:b=>b?N():c(),rawThumbnail:!0},r.id)})}),e(yt,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>o(null)}),l&&l.data.provider&&e(Ue,{data:l.data,anchorRect:l.rect,bookmarked:p.has(we(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:N,onMouseLeave:c,onRequestClose:g}),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",Ee={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}=It(24),t=At(),o=Rt(),[l,i]=E(null),[c,N]=E(()=>localStorage.getItem("tv_home_activeTab")||"latest"),[g,m]=E("tv"),[p,T]=E("trending_week"),[r,S]=E("multi"),d=s?.data??[];G.useEffect(()=>{localStorage.setItem("tv_home_activeTab",c)},[c]);const u=p.startsWith("trending_"),b=p==="trending_day"?"day":"week",k={popular:"popularity.desc",top_rated:"vote_average.desc"},{data:w,isLoading:A}=Xe(r==="multi"?"all":r,b,1,u&&c==="trending"),{data:$,isLoading:R}=Me({type:r,sort_by:k[p]||"popularity.desc",page:1}),C=u?w?.results||[]:$?.results||[],U=u?A:R,{data:x,isLoading:I}=Me({type:g,sort_by:"primary_release_date.desc",page:1}),V=x?.results||[],M=a=>{l&&(o.mutate({mediaId:l.libId}),a&&t.mutate(l.libId))},ee=P(a=>e(kt,{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(c){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(re,{ariaLabel:"Latest type",value:g,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,_)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},_))}):V.length>0?e(Z,{carousel:!0,itemCount:V.length,children:V.map(ee)}):e("div",{className:Ee.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(re,{ariaLabel:"Trending sort",value:p,onChange:T,options:$n.map(a=>({value:a.value,label:a.label}))}),e(re,{ariaLabel:"Trending type",value:r,onChange:a=>S(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,_)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},_))}):C.length>0?e(Z,{carousel:!0,itemCount:C.length,children:C.map(ee)}):e("div",{className:Ee.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:d.length>0,highlight:!0,itemCount:d.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:d.map(a=>{const _=a.currentTime??0,y=a.duration??0,D=a.season??1,K=a.episode??1,q=a.mediaType==="movie",j=q?"Movie":`S${D} E${K}`,te=a.completed===1||y>0&&_>=y*.8,ae=te?100:y>0&&_>0?_/y*100:0,be=te?"Watched":y>0?q?`${ne(_)} / ${ne(y)}`:`${j} · ${ne(_)} / ${ne(y)}`:j;return e(me,{item:{id:a.id,title:a.title||"",thumbnail:a.poster||"",typeBadge:q?"Movie":"TV",chapterBadge:j,isAdult:$t({adult:a.adult===1})},linkTo:Lt(a.mediaType,a.tmdbId??0,q?void 0:D,q?void 0:K),hoverIcon:"play",progress:(y>0||te)&&ae>0?{percent:ae,label:be}: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:(fe,oe)=>e(Ct,{item:{id:a.tmdbId??0,title:a.title||"",year:a.year||"",type:a.mediaType||"tv",image:a.poster||""},anchorRect:fe,onMouseEnter:oe.onMouseEnter,onMouseLeave:oe.onMouseLeave,onRequestClose:oe.close})},a.id)})}),e(pe,{ariaLabel:"Browse TV",options:Ln,value:c,onChange:N}),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}=Et(s),[c,N]=E(null),g=l?.data??[];return e(le,{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:g.length>0,highlight:!0,itemCount:g.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:g.map(m=>{const p=m.currentTime??0,T=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:T>0?{percent:Math.min(100,p/T*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:()=>N({workId:m.id,title:m.title||""}),rawThumbnail:!0},m.id)})}),e(Pt,{workId:c?c.workId:null,title:c?.title,onClose:()=>N(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=Mt(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=>xt[l]??Bt[l]).filter(Boolean),synopsis:ke(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=Ie(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:ke(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=Dt(t),i=`/asmr/${encodeURIComponent(l)}`,c=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,c?`${c} track${c===1?"":"s"}`:void 0].filter(N=>!!N),tags:[],synopsis:ke(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"})},zn=[{value:"anime",label:"Anime"},{value:"manga",label:"Manga"},{value:"tv",label:"TV & Movies"},{value:"asmr",label:"ASMR"}],mr=()=>{const n=et(),s=it(),[h,t]=G.useState(1),[o,l]=E(()=>localStorage.getItem("home_activeTab")||"latest"),[i,c]=E(()=>localStorage.getItem("season_format")||"TV"),N=F(null),{data:g}=$e(h+1,i,o==="season"),{titlePreference:m}=Ve(),{contentType:p,setContentType:T}=ct(),[r,S]=G.useState(null),d=dt(),{data:u=[]}=ut(),b=ht(),k=pt(),w=mt();O(()=>{document.title="Home - dango"},[]);const{data:A,isLoading:$}=gt();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}=vt(),V=P(()=>{x&&!I&&!C&&U()},[x,I,C,U]),{data:M,isLoading:ee}=_t(),{data:H,isLoading:a}=Xe("all","week",1,p==="tv"),{data:_,isLoading:y}=Wt(p==="asmr"),{data:D,isLoading:K}=wt(),q=Q(()=>R?.pages||[],[R]),{data:j,isLoading:te}=$e(h,i,o==="season"),ae=14,be=j&&j.length>=ae&&g&&g.length>0,fe=tt(s.continueWatching.remove.mutationOptions({onSuccess:async()=>{n.invalidateQueries(s.continueWatching.pathFilter()),await n.invalidateQueries({queryKey:[ze.continueWatching]}),x&&q.length-1<14&&U()}})),oe=P(W=>{const Y=q?.find(ye=>String(ye.id)===String(W));if(Y){const ye=Y[m]||Y.name;S({id:W,name:ye})}},[q,m]),Ae=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Re=A!==void 0&&A.length>0,Ke=Re?[{key:"week",label:"This Week"},...Ae]:Ae,Le=o==="week"&&!Re?"latest":o,je=()=>{switch(Le){case"latest":return e(da,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:X["section-header"],ref:N,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(re,{ariaLabel:"Season format",width:90,value:i,onChange:c,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(at,{page:h,canGoNext:be,onChange:W=>{if(t(W),N.current){const Y=N.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(We,{count:ae}):j?.slice(0,ae).map(W=>e(ie,{anime:W},W._id))})]});case"popular":return e(la,{title:"Trending",eyebrow:"Discover"});case"week":return e(xe,{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(de,{}):M&&M.length>0&&e(gn,{animeList:M})),p==="tv"&&(a&&!H?.results?.length?e(de,{}):H?.results&&H.results.length>0&&e(En,{items:H.results})),p==="manga"&&(K&&!D?.length?e(de,{}):D&&D.length>0&&e(Dn,{mangaList:D})),p==="asmr"&&(y&&!_?.length?e(de,{}):_&&_.length>0&&e(On,{works:_})),e(pe,{ariaLabel:"Content type",options:zn,value:p,onChange:T}),p==="manga"?e(In,{}):p==="tv"?e(Mn,{}):p==="asmr"?e(Pn,{}):e(le,{children:[e(xe,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:q,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:q.length>0,onRemove:oe,loading:C,onReachThreshold:V,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:u,onRemove:W=>b.mutate({showId:W.showId,episodeNumber:W.episodeNumber}),showClearAll:!0,onClear:()=>k.mutate(),onReorder:W=>w.mutate(W.map(Y=>({id:Y.id,showId:Y.showId,episodeNumber:Y.episodeNumber})))}),e(pe,{ariaLabel:"Browse anime",options:Ke.map(W=>({value:W.key,label:W.label})),value:Le,onChange:l}),e("div",{children:je()}),e($a,{eyebrow:"Never miss an episode"}),e(qe,{isOpen:!!r,itemName:r?.name,progressKind:"watch",listLabel:"my watchlist",onClose:()=>{S(null)},onConfirm:W=>{r&&(fe.mutate({showId:r.id}),W&&d.mutate({id:r.id}))}})]})]})};export{mr as default};
@@ -1 +0,0 @@
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-BP1z44Uk.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 +0,0 @@
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-RZ_j_2BD.js";import{E as ie}from"./ErrorMessage-DAxegITP.js";import{M as ce,P as de}from"./MediaCard-BODgA6ir.js";import{u as ue,M as ge}from"./useMangaPopup-kZzwoCN6.js";import{e as pe,U as he}from"./index-BP1z44Uk.js";import{f as me,u as ve,m as D,i as be,b as fe,c as Se}from"./useMangaLibrary-D3Foz2m_.js";import{u as Te}from"./useProviders-OKWPunZg.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-CVK2SYUR.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 +0,0 @@
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-D3Foz2m_.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-BP1z44Uk.js";import{p as ze}from"./page.module-C1MlZzf3.js";import"./libraryInvalidation-CVK2SYUR.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 +0,0 @@
1
- import{a as $e,p as ke,h as ue,d as i,T as me,u as t,S as he}from"./vendor-core-DfaOB3Rn.js";import{b as ge}from"./vendor-query-BBT5_sHx.js";import{i as qe,e as Fe,B as W,U as Ue,t as q,A as Ye}from"./index-BP1z44Uk.js";import{I as pe}from"./vendor-icons-DrybRNxP.js";import{P as ve}from"./MediaCard-BODgA6ir.js";import{A as xe}from"./AnimeCard-a7KkMGQv.js";import{S as Ve}from"./SkeletonGrid-w6TsxWu7.js";import{M as He}from"./MatureConsentModal-RZ_j_2BD.js";import{E as Ke}from"./ErrorMessage-DAxegITP.js";import{u as Qe}from"./useProviders-OKWPunZg.js";import{s as a}from"./Search.module-C_qwCdHS.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./useAnimeInfoData-8RI9qMzw.js";import"./QueueOptionsButton-C-y5QFrT.js";import"./playbackCompletion-IPHm9fp5.js";const We="_shrinkSelect_130sm_1",ze="_tightGrid_130sm_7",z={shrinkSelect:We,tightGrid:ze},je=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],Ze=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Je=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Xe=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],et={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},tt=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],fe=m=>m.split("-").map(u=>u&&u[0].toUpperCase()+u.slice(1)).join(" "),at=new Set(["page","limit","year","minScore","minEpisodes"]),rt=new Set(["provider","query","page","limit","type","status","season","year","country","genres","genre","excludeGenres","sortBy","order","studio","blacklist","minScore","minEpisodes"]);function st(m){const u=new URLSearchParams(m),s={};for(const[b,y]of u.entries())rt.has(b)&&(at.has(b)?s[b]=Number(y)||0:s[b]=y);return s}function Ct(){const m=$e(),u=qe(),[s,b]=ke(),{hasConsent:y,grant:Se}=Fe();ue(()=>{document.title="Mature - dango"},[]);const[l,be]=i(s.get("provider")||"anilist"),[N,j]=i(s.get("query")||""),[L,F]=i(s.get("query")||""),[O,g]=i(parseInt(s.get("page")||"1",10)||1),[I,U]=i(()=>{const e=s.get("sortBy");return e||(l==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[_,Z]=i(s.get("sortBy")||""),[C,ye]=i(s.get("status")||""),[D,Ne]=i(s.get("season")||"ALL"),[G,Ce]=i(s.get("year")||"ALL"),[p,M]=i(s.get("genre")||s.get("genres")||""),[Y,Ae]=i(s.get("order")||"recent"),[x,Ee]=i(s.get("studio")||""),[B,Te]=i(s.get("studio")||""),[J,X]=i([]),[V,Pe]=i(!1),[Re,ee]=i(null),{options:te}=Qe(),ae=me(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=me(()=>[...je,...ae.map(e=>({value:e.id,label:e.label}))],[ae]),{data:w}=ge({...u.data.matureFilters.queryOptions(),enabled:y,staleTime:1/0}),c=l==="anilist"||l==="mal",H=c?void 0:w?.providers?.[l],T=H?.browse,P=H?.genres??[],A=H?.orders??[],se=A.length>0&&!A.includes(Y)?A[0]:Y,$=!c&&(T?.genre===!0||P.length>0||J.length>0),v=!c&&(T?.order===!0||A.length>0),E=!c&&T?.studio===!0,le=!c&&T?.sort===!0,K=c?14:T?.pageSize??14,f=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const n=w?.providers?.[e.provider]?.browse,d=w?.providers?.[e.provider]?.orders??[],o=d.length>0&&!d.includes(e.remoteOrder)?d[0]:e.remoteOrder;(!n||n.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!n||n.genre)&&e.genre&&r.set("genre",e.genre),(!n||n.order)&&o!==(d[0]??"recent")&&r.set("order",o),(!n||n.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}b(r,{replace:!0})},S=(e={})=>({provider:l,query:L,page:O,sort:I,remoteSort:_,status:C,season:D,year:G,genre:p,remoteOrder:Y,studio:B,...e}),Le=(()=>{const e=new URLSearchParams;return e.set("provider",l),L.trim()&&e.set("query",L.trim()),e.set("page",String(O)),e.set("limit",String(K)),l==="anilist"&&(e.set("sortBy",I),C&&e.set("status",C),D!=="ALL"&&e.set("season",D),G!=="ALL"&&e.set("year",G)),l==="mal"?(e.set("sortBy",I),C&&e.set("status",C)):c||($&&p&&e.set("genre",p),v&&e.set("order",se),le&&_&&e.set("sortBy",_),E&&B.trim()&&e.set("studio",B.trim())),e.toString()})(),{data:h,isLoading:Oe,isError:Ie,error:_e}=ge({...u.data.matureSearch.queryOptions(st(Le)),enabled:y});ue(()=>{const e=h?.genres;!c&&P.length===0&&e&&e.length>0&&X(r=>{const n=new Set(r.map(o=>o.slug)),d=[...r];for(const o of e)o.slug&&!n.has(o.slug)&&(n.add(o.slug),d.push(o));return d.length===r.length?r:d})},[h,l,c,P.length]);const k=(h?.data||[]).map(e=>({...e,isAdult:!0})),ie=h?.hasMore??!1,ne=h?.total!=null?Math.max(1,Math.ceil(h.total/K)):void 0,R=()=>{Ue(),g(1);let e=p;!c&&!v&&N.trim()&&(e=""),M(e),E&&Te(x),F(N),f(S({query:N,page:1,genre:e,studio:E?x:B}))},De=e=>{be(e),g(1),Z(""),M(""),X([]),e==="mal"?U("SCORE_DESC"):e==="anilist"&&U("POPULARITY_DESC"),F(N),f(S({provider:e,page:1,remoteSort:"",genre:"",query:N}))},Ge=e=>{M(e),g(1),e&&(j(""),F("")),f(S({genre:e,page:1,query:e?"":L}))},oe=e=>{g(e),f(S({page:e})),window.scrollTo({top:0,behavior:"smooth"})},Me=async(e,r)=>{const n=r.id||r._id;if(l!=="mal"&&!/^\d+$/.test(n)&&(e.preventDefault(),e.stopPropagation(),!Re)){ee(n);try{if(l!=="anilist"){let o=!1;try{o=(await q.data.anilistStatus.query())?.available===!0}catch{o=!1}if(o){const de=await q.data.matureResolve.query({title:r.name});m(`/anime/${de.id}`);return}const ce=await q.data.matureAllocate.mutate({provider:l,nativeId:n,title:r.name,thumbnail:r.thumbnail});if(!ce?.id)throw new Error("Allocate failed");m(`/anime/${ce.id}`);return}const d=await q.data.matureResolve.query({title:r.name});m(`/anime/${d.id}`)}catch{Ye.error("Could not match this title on AniList")}finally{ee(null)}}},Q=new Date().getFullYear(),Be=[{value:"ALL",label:"All Years"},...Array.from({length:Q-1980+1},(e,r)=>({value:String(Q-r),label:String(Q-r)}))],we=P.length>0?P.map(e=>({value:e,label:fe(e)})):J.map(e=>({value:e.slug,label:e.name}));return y?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(pe,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===l)?.label}...`,value:N,onChange:e=>j(e.currentTarget.value),onKeyDown:e=>{e.key==="Enter"&&R()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:l,onChange:e=>De(e.currentTarget.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(W,{onClick:R,className:a.searchBtn,children:"Search"}),c&&t("button",{onClick:()=>Pe(!V),className:`${a.filterToggleBtn} ${V?a.active:""}`,children:[t(pe,{name:"filter"})," Filters"]}),le&&t("select",{value:_,onChange:e=>{Z(e.currentTarget.value),g(1),f(S({remoteSort:e.currentTarget.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(l==="anilist"||l==="mal")&&t("div",{className:`${a.advancedFilters} ${V?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:I,onChange:e=>U(e.currentTarget.value),children:Ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:C,onChange:e=>ye(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),l==="anilist"&&t(he,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:D,onChange:e=>Ne(e.currentTarget.value),children:tt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:G,onChange:e=>Ce(e.currentTarget.value),children:Be.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(W,{onClick:R,className:a.searchBtn,children:"Apply Filters"})})]}),!c&&!!w&&($||v||E)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${z.tightGrid}`,children:[v&&t("div",{className:`${a.filterItem} ${z.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:se,onChange:e=>{Ae(e.currentTarget.value),g(1),f(S({remoteOrder:e.currentTarget.value,page:1}))},children:(A.length>0?A:["recent"]).map(e=>t("option",{value:e,children:et[e]||e},e))})]}),$&&t("div",{className:`${a.filterItem} ${z.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:p,onChange:e=>{v?(M(e.currentTarget.value),g(1),f(S({genre:e.currentTarget.value,page:1}))):Ge(e.currentTarget.value)},children:[t("option",{value:"",children:"All Genres"}),we.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),E&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:x,onChange:e=>Ee(e.currentTarget.value),onKeyDown:e=>{e.key==="Enter"&&R()},className:a.searchInput})]})]}),p&&$&&!v&&t("p",{className:a.pageSubtitle,children:["Browsing the ",fe(p)," genre - search text is ignored while a genre is selected."]}),(v||E)&&t("div",{className:a.filterActions,children:t(W,{onClick:R,className:a.searchBtn,children:"Apply Filters"})})]})]}),Ie&&t(Ke,{message:_e?.message||"Search failed"}),Oe?t(Ve,{count:K}):k.length===0?t("div",{className:a.noResults,children:[t("h3",{children:"No results found"}),t("p",{children:"Try a different query, genre or provider"})]}):t(he,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[h?.total??k.length," result",(h?.total??k.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(ve,{page:O,totalPages:ne,canGoNext:ie,onChange:oe,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:k.map(e=>t("div",{onClickCapture:r=>Me(r,e),children:t(xe,{anime:e})},`${l}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(ve,{page:O,totalPages:ne,canGoNext:ie,onChange:oe,variant:"labeled"})})})]})]}):t(He,{isOpen:!0,onClose:()=>m("/"),onGrant:Se})}export{Ct as default};
@@ -1 +0,0 @@
1
- import{u as e,S as s,d as y,h as S}from"./vendor-core-DfaOB3Rn.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{M as l,S as m,T as g,B as f,z as k,D as x,F as N}from"./usePlaybackEnd-DmvZ__Ut.js";const C=({classes:o,title:t,titleTag:i="span",showBack:a=!0,onBack:n,panelRef:b,onPanelClick:r,children:c})=>{const d=i;return e("div",{ref:b,className:o.panel,onClick:r,"data-speed-boost-ignore":"true",children:[e("div",{className:o.header,children:[a&&e("button",{className:o.backBtn,onClick:n,children:e(p,{name:"chevron-left"})}),e(d,{className:o.title||void 0,children:t})]}),e("div",{className:o.content,children:c})]})},$=({classes:o,values:t,onChange:i})=>{const a=()=>{const n=x;i("fontSize",n.fontSize),i("position",n.position),i("bgOpacity",n.bgOpacity),i("bgColor",n.bgColor),i("textColor",n.textColor),i("edge",n.edge),i("bold",n.bold)};return e(s,{children:[e(l,{label:"Font Size",display:t.fontSize.toFixed(1),min:.5,max:10,step:.5,value:t.fontSize,percent:(t.fontSize-.5)/9.5*100,onChange:n=>{Number.isFinite(n)&&i("fontSize",n)}}),e(l,{label:"Vertical Position",display:`${t.position}`,min:0,max:100,step:1,value:t.position,percent:t.position,onChange:n=>{Number.isFinite(n)&&i("position",Math.round(n))}}),e(l,{label:"Background Opacity",display:`${Math.round(t.bgOpacity*100)}%`,min:0,max:1,step:.05,value:t.bgOpacity,percent:t.bgOpacity*100,onChange:n=>{Number.isFinite(n)&&i("bgOpacity",n)}}),e(m,{label:"Text Color",colors:g,value:t.textColor,onChange:n=>i("textColor",n)}),e(m,{label:"Background Color",colors:f,value:t.bgColor,onChange:n=>i("bgColor",n)}),e(k,{label:"Text Edge",options:["shadow","outline","none"],value:t.edge,onChange:n=>i("edge",n)}),e("button",{type:"button",className:`${o.item} ${t.bold?o.active:""}`,onClick:()=>i("bold",!t.bold),children:[e("span",{children:"Bold Text"}),t.bold&&e(p,{name:"check",size:12})]}),e("button",{type:"button",className:o.item,onClick:a,children:e("span",{children:"Reset to Defaults"})})]})},z=({classes:o,enabled:t,delayMs:i,onToggle:a,onDelayChange:n,onCalibrate:b})=>{const[r,c]=y(null),d=r??i;S(()=>{c(null)},[i]);const h=()=>{r!==null&&(n(r),c(null))};return e(s,{children:[e("button",{type:"button",className:`${o.item} ${t?o.active:""}`,onClick:()=>a(!t),children:[e("span",{children:"Video delay"}),t&&e(p,{name:"check",size:12})]}),e(l,{label:"Video delay",display:`${d}ms`,min:0,max:500,step:5,value:d,percent:d/500*100,onChange:u=>c(Math.round(u)),onCommit:h}),e("div",{className:o.note,children:"For Bluetooth headsets where audio arrives late. Video is held back via canvas; audio plays untouched."}),b&&e("button",{type:"button",className:o.item,onClick:b,children:e("span",{children:"Calibrate…"})})]})},B=({classes:o,values:t,onChange:i})=>e(s,{children:[e("button",{type:"button",className:`${o.item} ${t.enabled?o.active:""}`,onClick:()=>i({enabled:!t.enabled}),"aria-pressed":t.enabled,children:[e("span",{children:"Ambient light"}),e("span",{style:{display:"flex",alignItems:"center",gap:6},children:[t.enabled?"On":"Off",t.enabled&&e(p,{name:"check",size:12})]})]}),e(l,{label:"Blur",display:`${t.blur}px`,min:0,max:120,step:2,value:t.blur,percent:t.blur/120*100,onChange:a=>i({blur:Math.round(a)})}),e(l,{label:"Saturation",display:`${t.saturation}%`,min:0,max:200,step:5,value:t.saturation,percent:t.saturation/200*100,onChange:a=>i({saturation:Math.round(a)})}),e(l,{label:"Brightness",display:`${t.brightness}%`,min:20,max:120,step:5,value:t.brightness,percent:(t.brightness-20)/100*100,onChange:a=>i({brightness:Math.round(a)})}),e(l,{label:"Opacity",display:`${t.opacity}%`,min:10,max:100,step:5,value:t.opacity,percent:(t.opacity-10)/90*100,onChange:a=>i({opacity:Math.round(a)})}),e("div",{className:o.note,children:"Mirrors the video onto the backdrop behind the player. Turn off for pure black."}),e("button",{type:"button",className:o.item,onClick:()=>i({...N}),children:e("span",{children:"Reset to defaults"})})]}),E=({classes:o,options:t,onSelect:i})=>e(s,{children:t.map(a=>e("button",{type:"button",className:`${o.item} ${a.selected?o.active:""}`,onClick:()=>i(a.key),children:[e("span",{children:a.label}),a.selected&&e(p,{name:"check",size:12})]},a.key))});export{z as A,E as O,C as S,$ as a,B as b};