@serifpersia/dango 3.6.1 → 3.6.2

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 (50) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-DbrG4Bo-.js → AnimeCard-KCdQSFYo.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-CgSQGjef.js → AnimeInfo-CWppMyrH.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-DSybdvf_.js → AnimeInfoPage-CfYONEFT.js} +2 -2
  5. package/client/dist/assets/{Asmr-DFFV-7y4.js → Asmr-CbkxcXne.js} +1 -1
  6. package/client/dist/assets/{AsmrResetProgressModal-Brdfu_22.js → AsmrResetProgressModal-CjPrSioI.js} +1 -1
  7. package/client/dist/assets/{AvSyncCalibrator-DBBUzoHn.js → AvSyncCalibrator-XNJmMFmH.js} +1 -1
  8. package/client/dist/assets/{Home-DjGl-3os.js → Home-BTkitKD6.js} +1 -1
  9. package/client/dist/assets/{Insights-4O52Z1t2.js → Insights-_LB6kp3M.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-Z0w_rmHP.js → LibraryListPage-4BBrV2Ne.js} +1 -1
  11. package/client/dist/assets/{ListeningList-DjbzDs1E.js → ListeningList-BlAwt-LT.js} +1 -1
  12. package/client/dist/assets/{Manga-BRIDluzF.js → Manga-BtLdEUi5.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-Q4CjEGJH.js → MangaInfoPage-CQr6_pSH.js} +1 -1
  14. package/client/dist/assets/{MangaReadPage-BbJK5FY6.js → MangaReadPage-DUHUub1H.js} +1 -1
  15. package/client/dist/assets/{MangaResetProgressModal-BCFPXDF6.js → MangaResetProgressModal-CnP9RIzg.js} +1 -1
  16. package/client/dist/assets/{Mature-DjQzs66p.js → Mature-Dv8i7W02.js} +1 -1
  17. package/client/dist/assets/{MediaCard-DedwE5DX.js → MediaCard-tBWyjKaV.js} +1 -1
  18. package/client/dist/assets/{Music-z2RkiMDf.js → Music-kBqpbxdz.js} +1 -1
  19. package/client/dist/assets/{OptionListMenu-CetjZizt.js → OptionListMenu-BiiWXfEL.js} +1 -1
  20. package/client/dist/assets/{Player-DD-9SgWU.js → Player-CXReluOl.js} +2 -2
  21. package/client/dist/assets/{PlayerSettings-ne_DQSTl.js → PlayerSettings-uFwbD3Z7.js} +1 -1
  22. package/client/dist/assets/{QueueOptionsButton-CIKT4YcD.js → QueueOptionsButton-BN-6sbNV.js} +1 -1
  23. package/client/dist/assets/{QueueRail-DPclldS0.js → QueueRail-BYyC_xPZ.js} +1 -1
  24. package/client/dist/assets/{Radio-aeqPTMht.js → Radio-DN66fPmx.js} +1 -1
  25. package/client/dist/assets/{ReadingList-p6G7NHtC.js → ReadingList-6z-6l85T.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal-B7UuuL3X.js → ResetProgressModal-CZieLUpX.js} +1 -1
  27. package/client/dist/assets/{Search-BzyHVByR.js → Search-aO0P-vef.js} +1 -1
  28. package/client/dist/assets/{Settings-DMmtLUsL.js → Settings-CYeDIeBU.js} +1 -1
  29. package/client/dist/assets/{SkeletonGrid-B5JXhZO4.js → SkeletonGrid-DJKwfPjg.js} +1 -1
  30. package/client/dist/assets/{Trackers-tLL1afjB.js → Trackers-CLJvFNWX.js} +1 -1
  31. package/client/dist/assets/Tv-B-TnGO82.js +4 -0
  32. package/client/dist/assets/{TvInfo-DmrBLjgK.js → TvInfo-Y7k3LY78.js} +1 -1
  33. package/client/dist/assets/{TvPopup-D1mSlOZt.js → TvPopup-CM8RMOwX.js} +1 -1
  34. package/client/dist/assets/{TvSearch-BGQRUq9E.js → TvSearch-Bn-OsC1u.js} +1 -1
  35. package/client/dist/assets/{TvWatchlist-DdLkpeQT.js → TvWatchlist-PyOWvixK.js} +1 -1
  36. package/client/dist/assets/{Watchlist-BObmM6QB.js → Watchlist-CCmzjnDR.js} +1 -1
  37. package/client/dist/assets/{hls-qCuNYJym.js → hls-Dn7_lAv2.js} +1 -1
  38. package/client/dist/assets/{index-B4AdKbhW.js → index-VzVAYX5A.js} +2 -2
  39. package/client/dist/assets/{useAnimeInfoData-CSnwUBuU.js → useAnimeInfoData-BpD2dXLB.js} +1 -1
  40. package/client/dist/assets/{useAsmr-BKAaWEXn.js → useAsmr-Dm1-a4VV.js} +1 -1
  41. package/client/dist/assets/{useAsmrPopup-DDLRBLzz.js → useAsmrPopup-2SWfvbnM.js} +1 -1
  42. package/client/dist/assets/{useMangaLibrary-C6XEMuSr.js → useMangaLibrary-RpiA2f_k.js} +1 -1
  43. package/client/dist/assets/{useMangaPopup-wfCJubPD.js → useMangaPopup-Dcfgv2CZ.js} +1 -1
  44. package/client/dist/assets/{useProviders-C7jrBgxf.js → useProviders-vzvT6VhD.js} +1 -1
  45. package/client/dist/assets/{useTv-DM5KtzEc.js → useTv-DrhnOiw6.js} +1 -1
  46. package/client/dist/assets/{useTvLibrary-73NkS_5R.js → useTvLibrary-DDReryyQ.js} +1 -1
  47. package/client/dist/index.html +1 -1
  48. package/package.json +2 -2
  49. package/server/package.json +1 -1
  50. package/client/dist/assets/Tv-CluLN4KA.js +0 -4
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-ne_DQSTl.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/OptionListMenu-CetjZizt.js","assets/AvSyncCalibrator-DBBUzoHn.js","assets/index-B4AdKbhW.js","assets/vendor-query-BBT5_sHx.js","assets/index-D0Haw_Zl.css","assets/AvSyncCalibrator-ZSpMgUid.css","assets/PlayerSettings-BXGe3F5k.css"])))=>i.map(i=>d[i]);
2
- import{u as r,g as Ot,h as B,P as Br,z as Lr,d as ue,A as m,q as K,y as Ir,T as Je,o as Dr,a as $r,c as Fr,_ as Wr,S as Wt}from"./vendor-core-DfaOB3Rn.js";import{_ as hr,S as Mt,h as Or,t as Ee,z as We,J as Ur,e as Vr,l as qr,m as Qr,n as zr,o as Gr,d as Kr,u as Hr,M as Fe,B as it,K as jr,f as Yr}from"./index-B4AdKbhW.js";import{u as mr,b as lr,a as jt}from"./vendor-query-BBT5_sHx.js";import{S as Xr,U as Jr,p as Yt,s as Zr,C as en,a as tn,b as rn,c as at,l as nn,u as sn,d as on,e as an,f as ln,i as cn,g as cr,h as un,j as dn,k as ur,m as dr,n as pn,o as hn,q as mn,r as fn,t as Ae,A as vn,R as gn,E as bn,v as yn,w as p,x as Sn,y as En,P as wn,z as Tn,B as kn}from"./AvSyncCalibrator-DBBUzoHn.js";import{I as Z}from"./vendor-icons-DrybRNxP.js";import{l as Cn}from"./hls-qCuNYJym.js";import{u as Rn}from"./useIsMobile-Dvx1uJ82.js";import{s as ze,Q as Mn}from"./QueueRail-DPclldS0.js";import{u as _n,Q as Nn}from"./QueueOptionsButton-CIKT4YcD.js";import{u as fr}from"./useProviders-C7jrBgxf.js";import{A as Pn}from"./AnimeMetaDetails-BogOi_bM.js";import{S as xn}from"./SynopsisText-B3Sa5pRv.js";import"./vendor-ui-3qrARCPr.js";const An={soft:"Softsub",hard:"Hardsub",mixed:"Mixed"},Bn={direct:"Direct",embed:"Embed",cookie:"Needs cookie"},Ln=["direct","cookie","embed"],In="_controlsOverlay_1h2da_1",Dn="_hidden_1h2da_21",$n="_topControls_1h2da_27",Fn="_backBtn_1h2da_47",Wn="_videoTitleInfo_1h2da_67",On="_animeTitle_1h2da_73",Un="_episodeNumber_1h2da_83",Vn="_bottomControls_1h2da_91",qn="_progressBarContainer_1h2da_110",Qn="_progressBar_1h2da_110",zn="_thumb_1h2da_129",Gn="_scrubbing_1h2da_144",Kn="_watchedBar_1h2da_148",Hn="_bufferedBar_1h2da_149",jn="_timeBubble_1h2da_187",Yn="_skipSegment_1h2da_221",Xn="_op_1h2da_231",Jn="_ed_1h2da_234",Zn="_recap_1h2da_237",es="_bottomControlsRow_1h2da_241",ts="_leftControls_1h2da_249",rs="_rightControls_1h2da_250",ns="_controlBtn_1h2da_257",ss="_theaterBtn_1h2da_298",os="_nextEpisodeBtn_1h2da_302",is="_active_1h2da_323",as="_timeDisplay_1h2da_327",ls="_skipControls_1h2da_335",cs="_skipBtn_1h2da_341",us="_volumeContainer_1h2da_382",ds="_volumeSlider_1h2da_388",ps="_playerPageLayout_1h2da_446",hs="_videoPlayerWrapper_1h2da_450",ms="_playerInfoContainer_1h2da_455",fs="_visible_1h2da_572",vs="_shortcuts_1h2da_590",C={controlsOverlay:In,hidden:Dn,topControls:$n,backBtn:Fn,videoTitleInfo:Wn,animeTitle:On,episodeNumber:Un,bottomControls:Vn,progressBarContainer:qn,progressBar:Qn,thumb:zn,scrubbing:Gn,watchedBar:Kn,bufferedBar:Hn,timeBubble:jn,skipSegment:Yn,op:Xn,ed:Jn,recap:Zn,bottomControlsRow:es,leftControls:ts,rightControls:rs,controlBtn:ns,theaterBtn:ss,nextEpisodeBtn:os,active:is,timeDisplay:as,skipControls:ls,skipBtn:cs,volumeContainer:us,volumeSlider:ds,playerPageLayout:ps,videoPlayerWrapper:hs,playerInfoContainer:ms,visible:fs,shortcuts:vs},gs=({player:n,handlers:l,visible:h,skipIntervals:D,showNextEpisodeButton:f,onNextEpisode:S,isTheaterMode:b,onTheaterModeToggle:A,settingsBtnRef:P,timeDisplayRef:$})=>{const{state:T,refs:e,actions:o}=n,{showSettings:J}=T,g=()=>T.isMuted||T.volume===0?r(Z,{name:"volume-mute"}):T.volume<.5?r(Z,{name:"volume-down"}):r(Z,{name:"volume-up"});return r("div",{className:`${C.controlsOverlay} ${h?"":C.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:r("div",{className:C.bottomControls,"data-speed-boost-ignore":"true",onClick:x=>x.stopPropagation(),children:[r(Xr,{classes:{container:C.progressBarContainer,scrubbing:C.scrubbing,timeBubble:C.timeBubble,bar:C.progressBar,buffered:C.bufferedBar,watched:C.watchedBar,thumb:C.thumb},videoRef:e.videoRef,duration:T.duration,formatTime:o.formatTime,isScrubbing:T.isScrubbing,onSeek:l.handleSeek,onScrubStart:l.handleScrubStart,onScrubMove:l.handleScrubMove,onScrubEnd:l.handleScrubEnd,timeLabelRef:$,children:[T.duration>0&&n.state.currentSkipInterval&&r("div",{className:`${C.skipSegment} ${C[n.state.currentSkipInterval.skip_type]} `,style:{left:`${n.state.currentSkipInterval.start_time/T.duration*100}% `,width:`${(n.state.currentSkipInterval.end_time-n.state.currentSkipInterval.start_time)/T.duration*100}% `}}),D.map(x=>{const de=x.start_time/T.duration*100,U=(x.end_time-x.start_time)/T.duration*100;return r("div",{className:`${C.skipSegment} ${C[x.skip_type]} `,style:{left:`${de}% `,width:`${U}% `},title:x.skip_type.toUpperCase()},x.skip_id)})]}),r("div",{className:C.bottomControlsRow,children:[r("div",{className:C.leftControls,children:[r("button",{className:C.controlBtn,onClick:o.togglePlay,"aria-label":T.isPlaying?"Pause":"Play",children:T.isPlaying?r(Z,{name:"pause"}):r(Z,{name:"play"})}),r(Jr,{muted:T.isMuted,volume:T.volume,volumeIcon:g(),buttonClassName:C.controlBtn,onToggleMute:o.toggleMute,onVolumeChange:l.handleVolumeChange,onExpandedChange:x=>o.setShowVolumeSlider(x)}),r("span",{className:C.timeDisplay,ref:$,children:[o.formatTime(0)," / ",o.formatTime(T.duration)]}),T.currentSkipInterval&&!T.isAutoSkipEnabled&&r("button",{className:C.controlBtn,onClick:()=>{e.videoRef.current&&T.currentSkipInterval&&(e.videoRef.current.currentTime=T.currentSkipInterval.end_time,o.setCurrentSkipInterval(null))},children:["Skip ",T.currentSkipInterval.skip_type==="op"?"Opening":"Ending"]})]}),r("div",{className:C.rightControls,children:[r("div",{className:C.skipControls,children:f&&r("button",{className:C.nextEpisodeBtn,onClick:S,title:"Play next episode",children:"Next EP"})}),r("button",{className:`${C.controlBtn} ${l.isSubtitleActive?C.active:""}`,onClick:l.handleCCToggle,title:l.isSubtitleActive?"Disable Subtitles":"Enable Subtitles","aria-label":"Toggle Subtitles",children:r(Z,{name:"closed-captioning",size:22})}),r("button",{ref:P,className:`${C.controlBtn} ${J?C.active:""} `,onClick:()=>o.setShowSettings(!J),"aria-label":"Settings",children:r(Z,{name:"cog"})}),r("button",{className:`${C.controlBtn} ${C.theaterBtn} ${b?C.active:""} `,onClick:x=>{x.stopPropagation(),A()},title:b?"Exit Theater Mode":"Theater Mode","aria-label":b?"Exit Theater Mode":"Theater Mode",children:r(Z,{name:"tv"})}),r("button",{className:C.controlBtn,onClick:o.toggleFullscreen,"aria-label":T.isFullscreen?"Exit Fullscreen":"Fullscreen",children:T.isFullscreen?r(Z,{name:"compress"}):r(Z,{name:"expand"})})]})]})]})})};function bs(n){const{state:l,refs:h,actions:D}=n,f=o=>{h.videoRef.current&&(h.videoRef.current.volume=o,h.videoRef.current.muted=o===0)},S=o=>{!h.videoRef.current||isNaN(l.duration)||l.duration===0||(h.videoRef.current.currentTime=o*l.duration,D.sendProgressUpdate(!1,!0))},b=()=>{h.videoRef.current&&(D.setIsScrubbing(!0),D.wasPlayingBeforeScrub.current=!h.videoRef.current.paused,h.videoRef.current.pause())},A=o=>{!h.videoRef.current||!l.duration||(h.videoRef.current.currentTime=o*l.duration)},P=()=>{D.setIsScrubbing(!1),D.wasPlayingBeforeScrub.current&&h.videoRef.current?.play()},$=o=>{if(!h.videoRef.current)return;D.setActiveSubtitleTrack(o);try{if(o===null||o==="off")localStorage.setItem("playerSubtitlesEnabled","false");else{localStorage.setItem("playerSubtitlesEnabled","true");const g=l.availableSubtitles.find(x=>x.label===o||x.lang===o);g?localStorage.setItem("playerLastSubtitle",Zr(g)):localStorage.setItem("playerLastSubtitle",o)}}catch{}let J=!1;Array.from(h.videoRef.current.textTracks).forEach(g=>{const de=o!==null&&o!=="off"&&(g.language===o||g.label===o)&&!J;g.mode=de?"showing":"hidden",de&&(J=!0)})},T=l.activeSubtitleTrack!==null&&l.activeSubtitleTrack!=="off";return{handleVolumeChange:f,handleSeek:S,handleScrubStart:b,handleScrubMove:A,handleScrubEnd:P,handleSubtitleSelection:$,isSubtitleActive:T,handleCCToggle:()=>{if(!h.videoRef.current)return;if(T){$("off");return}if(l.availableSubtitles.length===0)return;let o=null;try{o=localStorage.getItem("playerLastSubtitle")}catch{}const J=Yt(l.availableSubtitles,{lastKey:o,enabled:!0});if(J<0)return;const g=l.availableSubtitles[J];$(g.label||g.lang)}}}const ys=Lr(()=>hr(()=>import("./PlayerSettings-ne_DQSTl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Ss=({player:n,isAutoplayEnabled:l,onAutoplayChange:h,showNextEpisodeButton:D,onNextEpisode:f,videoSources:S,selectedSource:b,selectedLink:A,onSourceChange:P,loadingVideo:$,skipIntervals:T,animeTitle:e,episodeNumber:o,isTheaterMode:J,onTheaterModeToggle:g,anime4kEnabled:x,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Be,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Le,fallbackChoice:_e,onFallbackChoiceChange:Ne,ambientSettings:Ue,onAmbientChange:oe,children:we,overlays:c,isInteractingExtra:y=!1,className:v,hideChrome:I=!1})=>{const{state:R,actions:q}=n,{showSettings:ye}=R,{setShowSettings:Y}=q,G=bs(n),Te=Ot.useRef(null),Ie=Ot.useRef(null),yt=Ot.useRef(null);B(()=>{const F=W=>{Te.current&&!Te.current.contains(W.target)&&Ie.current&&!Ie.current.contains(W.target)&&ye&&Y(!1)};return ye&&document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}},[ye,Y]);const Ze=R.showControls||ye||R.isScrubbing,St=r(rn,{visible:Ze,title:e,episode:o?`Episode ${o}`:void 0,onBack:()=>window.history.back(),classes:{overlay:C.controlsOverlay,hidden:C.hidden,top:C.topControls,backBtn:C.backBtn,titleInfo:C.videoTitleInfo,title:C.animeTitle,episode:C.episodeNumber}}),H=!$&&!R.isBuffering&&R.duration>0?r(en,{isPlaying:R.isPlaying,onTogglePlay:q.togglePlay,onSkipBack:()=>q.seek(-10),onSkipForward:()=>q.seek(10)}):null,Pe=r(gs,{player:n,handlers:G,visible:Ze,skipIntervals:T,showNextEpisodeButton:D,onNextEpisode:f,isTheaterMode:J,onTheaterModeToggle:g,settingsBtnRef:Ie,timeDisplayRef:yt}),lt=r(Br,{fallback:null,children:r(ys,{ref:Te,isOpen:ye,onClose:()=>Y(!1),videoSources:S,currentSource:b,currentLink:A,onSourceChange:P,subtitles:R.availableSubtitles,activeSubtitleTrack:R.activeSubtitleTrack,onSubtitleChange:G.handleSubtitleSelection,subtitleSettings:{fontSize:R.subtitleFontSize,position:R.subtitlePosition,bgOpacity:R.subtitleBgOpacity,bgColor:R.subtitleBgColor,textColor:R.subtitleTextColor,edge:R.subtitleEdge,bold:R.subtitleBold},onSubtitleSettingsChange:(F,W)=>{const ke=(Ve,Ge)=>{try{localStorage.setItem(Ve,String(Ge))}catch{}};switch(F){case"fontSize":q.setSubtitleFontSize(W),ke("subtitleFontSize",W);break;case"position":q.setSubtitlePosition(W),ke("subtitlePosition",W);break;case"bgOpacity":q.setSubtitleBgOpacity(W),ke("subtitleBgOpacity",W);break;case"bgColor":q.setSubtitleBgColor(W),ke("subtitleBgColor",W);break;case"textColor":q.setSubtitleTextColor(W),ke("subtitleTextColor",W);break;case"edge":q.setSubtitleEdge(W),ke("subtitleEdge",W);break;case"bold":q.setSubtitleBold(W),ke("subtitleBold",W);break}},useNativeControls:R.useNativeControls,onNativeControlsToggle:q.setUseNativeControls,anime4kEnabled:x,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Be,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Le,isAutoSkipEnabled:R.isAutoSkipEnabled,onAutoSkipChange:F=>{q.setIsAutoSkipEnabled(F);try{localStorage.setItem("autoSkipEnabled",F.toString())}catch{}},isAutoplayEnabled:l,onAutoplayChange:h,fallbackChoice:_e,onFallbackChoiceChange:Ne,isTheaterMode:J,ambientSettings:Ue,onAmbientChange:oe})}),_=ye?r("div",{"data-speed-boost-ignore":"true",onClick:F=>F.stopPropagation(),children:lt}):null;return r(tn,{player:n,topBar:St,centerControls:H,bottomBar:!$&&R.duration>0?Pe:null,settingsPanel:_,overlays:c,isInteracting:y,className:v,chromeDisabled:I,children:we})},Es=({count:n=3})=>r("section",{className:ze.section,children:[r("div",{className:ze.header,children:r("button",{className:ze.headerToggle,disabled:!0,children:[r("span",{className:ze.title,children:r(Mt,{width:"60px",height:"1.2rem",variant:"text"})}),r(Z,{name:"chevron-down",style:{opacity:.3}})]})}),r("div",{className:ze.list,children:Array.from({length:n}).map((l,h)=>r("div",{className:ze.item,style:{pointerEvents:"none"},children:[r("div",{className:ze.dragHandle,style:{opacity:.2},children:r(Mt,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:ze.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(Mt,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:ze.meta,children:[r(Mt,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(Mt,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},h))})]}),ws=({selectedProvider:n,onProviderChange:l,isAdult:h,options:D})=>{const f=D&&D.length>0?D:[],S=h===void 0?f:f.filter(b=>b.mature===h);return r("div",{className:at.providerSelectContainer,children:[r("h4",{children:"Provider"}),r("select",{className:at.providerSelect,value:n,onChange:b=>l(b.target.value),children:Ln.map(b=>{const A=S.filter(P=>(P.tier??"direct")===b);return A.length===0?null:r("optgroup",{label:Bn[b],children:A.map(P=>r("option",{value:P.value,children:P.sub?`${P.label} (${An[P.sub]})`:P.label},P.value))},b)})})]})},Ts=({videoSources:n,selectedSource:l,selectedLink:h,onSourceChange:D,onLinkChange:f})=>{const S=Array.isArray(n)?n:[];if(S.length===0)return null;const b=l?.type==="iframe"&&(l.links?.length??0)>1;return r("div",{className:at.sourceSelectionContainer,children:[r("h4",{children:"Source"}),r("div",{className:at.sourceButtons,children:S.map((A,P)=>r("button",{className:`${at.sourceButton} ${l?.sourceName===A.sourceName?at.active:""} `,onClick:()=>D(A),children:A.sourceName},`${A.sourceName}-${P}`))}),b&&r("select",{className:at.sourceSelect,"aria-label":"Fallback embed quality",value:h?.link??l.links[0]?.link??"",onChange:A=>{const P=l.links.find($=>$.link===A.target.value);P&&f(P)},children:l.links.map(A=>r("option",{value:A.link,children:A.resolutionStr},A.link))})]})},ks=Ot.memo(Ts,(n,l)=>n.selectedSource?.sourceName===l.selectedSource?.sourceName&&n.selectedLink?.link===l.selectedLink?.link&&n.videoSources===l.videoSources),Cs={low:{sd:1.5,hd:1.3,fhd:1.25},balanced:{sd:2,hd:1.5,fhd:1.25},high:{sd:2.5,hd:2,fhd:1.5},denoise:{sd:1.5,hd:1.5,fhd:1.5}},Rs={low:"ModeB",balanced:"ModeA",high:"ModeAA",denoise:"ModeC"},Ms=5,_s=15e3,Ns=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-uFwbD3Z7.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/OptionListMenu-BiiWXfEL.js","assets/AvSyncCalibrator-XNJmMFmH.js","assets/index-VzVAYX5A.js","assets/vendor-query-BBT5_sHx.js","assets/index-D0Haw_Zl.css","assets/AvSyncCalibrator-ZSpMgUid.css","assets/PlayerSettings-BXGe3F5k.css"])))=>i.map(i=>d[i]);
2
+ import{u as r,g as Ot,h as B,P as Br,z as Lr,d as ue,A as m,q as K,y as Ir,T as Je,o as Dr,a as $r,c as Fr,_ as Wr,S as Wt}from"./vendor-core-DfaOB3Rn.js";import{_ as hr,S as Mt,h as Or,t as Ee,z as We,J as Ur,e as Vr,l as qr,m as Qr,n as zr,o as Gr,d as Kr,u as Hr,M as Fe,B as it,K as jr,f as Yr}from"./index-VzVAYX5A.js";import{u as mr,b as lr,a as jt}from"./vendor-query-BBT5_sHx.js";import{S as Xr,U as Jr,p as Yt,s as Zr,C as en,a as tn,b as rn,c as at,l as nn,u as sn,d as on,e as an,f as ln,i as cn,g as cr,h as un,j as dn,k as ur,m as dr,n as pn,o as hn,q as mn,r as fn,t as Ae,A as vn,R as gn,E as bn,v as yn,w as p,x as Sn,y as En,P as wn,z as Tn,B as kn}from"./AvSyncCalibrator-XNJmMFmH.js";import{I as Z}from"./vendor-icons-DrybRNxP.js";import{l as Cn}from"./hls-Dn7_lAv2.js";import{u as Rn}from"./useIsMobile-Dvx1uJ82.js";import{s as ze,Q as Mn}from"./QueueRail-BYyC_xPZ.js";import{u as _n,Q as Nn}from"./QueueOptionsButton-BN-6sbNV.js";import{u as fr}from"./useProviders-vzvT6VhD.js";import{A as Pn}from"./AnimeMetaDetails-BogOi_bM.js";import{S as xn}from"./SynopsisText-B3Sa5pRv.js";import"./vendor-ui-3qrARCPr.js";const An={soft:"Softsub",hard:"Hardsub",mixed:"Mixed"},Bn={direct:"Direct",embed:"Embed",cookie:"Needs cookie"},Ln=["direct","cookie","embed"],In="_controlsOverlay_1h2da_1",Dn="_hidden_1h2da_21",$n="_topControls_1h2da_27",Fn="_backBtn_1h2da_47",Wn="_videoTitleInfo_1h2da_67",On="_animeTitle_1h2da_73",Un="_episodeNumber_1h2da_83",Vn="_bottomControls_1h2da_91",qn="_progressBarContainer_1h2da_110",Qn="_progressBar_1h2da_110",zn="_thumb_1h2da_129",Gn="_scrubbing_1h2da_144",Kn="_watchedBar_1h2da_148",Hn="_bufferedBar_1h2da_149",jn="_timeBubble_1h2da_187",Yn="_skipSegment_1h2da_221",Xn="_op_1h2da_231",Jn="_ed_1h2da_234",Zn="_recap_1h2da_237",es="_bottomControlsRow_1h2da_241",ts="_leftControls_1h2da_249",rs="_rightControls_1h2da_250",ns="_controlBtn_1h2da_257",ss="_theaterBtn_1h2da_298",os="_nextEpisodeBtn_1h2da_302",is="_active_1h2da_323",as="_timeDisplay_1h2da_327",ls="_skipControls_1h2da_335",cs="_skipBtn_1h2da_341",us="_volumeContainer_1h2da_382",ds="_volumeSlider_1h2da_388",ps="_playerPageLayout_1h2da_446",hs="_videoPlayerWrapper_1h2da_450",ms="_playerInfoContainer_1h2da_455",fs="_visible_1h2da_572",vs="_shortcuts_1h2da_590",C={controlsOverlay:In,hidden:Dn,topControls:$n,backBtn:Fn,videoTitleInfo:Wn,animeTitle:On,episodeNumber:Un,bottomControls:Vn,progressBarContainer:qn,progressBar:Qn,thumb:zn,scrubbing:Gn,watchedBar:Kn,bufferedBar:Hn,timeBubble:jn,skipSegment:Yn,op:Xn,ed:Jn,recap:Zn,bottomControlsRow:es,leftControls:ts,rightControls:rs,controlBtn:ns,theaterBtn:ss,nextEpisodeBtn:os,active:is,timeDisplay:as,skipControls:ls,skipBtn:cs,volumeContainer:us,volumeSlider:ds,playerPageLayout:ps,videoPlayerWrapper:hs,playerInfoContainer:ms,visible:fs,shortcuts:vs},gs=({player:n,handlers:l,visible:h,skipIntervals:D,showNextEpisodeButton:f,onNextEpisode:S,isTheaterMode:b,onTheaterModeToggle:A,settingsBtnRef:P,timeDisplayRef:$})=>{const{state:T,refs:e,actions:o}=n,{showSettings:J}=T,g=()=>T.isMuted||T.volume===0?r(Z,{name:"volume-mute"}):T.volume<.5?r(Z,{name:"volume-down"}):r(Z,{name:"volume-up"});return r("div",{className:`${C.controlsOverlay} ${h?"":C.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:r("div",{className:C.bottomControls,"data-speed-boost-ignore":"true",onClick:x=>x.stopPropagation(),children:[r(Xr,{classes:{container:C.progressBarContainer,scrubbing:C.scrubbing,timeBubble:C.timeBubble,bar:C.progressBar,buffered:C.bufferedBar,watched:C.watchedBar,thumb:C.thumb},videoRef:e.videoRef,duration:T.duration,formatTime:o.formatTime,isScrubbing:T.isScrubbing,onSeek:l.handleSeek,onScrubStart:l.handleScrubStart,onScrubMove:l.handleScrubMove,onScrubEnd:l.handleScrubEnd,timeLabelRef:$,children:[T.duration>0&&n.state.currentSkipInterval&&r("div",{className:`${C.skipSegment} ${C[n.state.currentSkipInterval.skip_type]} `,style:{left:`${n.state.currentSkipInterval.start_time/T.duration*100}% `,width:`${(n.state.currentSkipInterval.end_time-n.state.currentSkipInterval.start_time)/T.duration*100}% `}}),D.map(x=>{const de=x.start_time/T.duration*100,U=(x.end_time-x.start_time)/T.duration*100;return r("div",{className:`${C.skipSegment} ${C[x.skip_type]} `,style:{left:`${de}% `,width:`${U}% `},title:x.skip_type.toUpperCase()},x.skip_id)})]}),r("div",{className:C.bottomControlsRow,children:[r("div",{className:C.leftControls,children:[r("button",{className:C.controlBtn,onClick:o.togglePlay,"aria-label":T.isPlaying?"Pause":"Play",children:T.isPlaying?r(Z,{name:"pause"}):r(Z,{name:"play"})}),r(Jr,{muted:T.isMuted,volume:T.volume,volumeIcon:g(),buttonClassName:C.controlBtn,onToggleMute:o.toggleMute,onVolumeChange:l.handleVolumeChange,onExpandedChange:x=>o.setShowVolumeSlider(x)}),r("span",{className:C.timeDisplay,ref:$,children:[o.formatTime(0)," / ",o.formatTime(T.duration)]}),T.currentSkipInterval&&!T.isAutoSkipEnabled&&r("button",{className:C.controlBtn,onClick:()=>{e.videoRef.current&&T.currentSkipInterval&&(e.videoRef.current.currentTime=T.currentSkipInterval.end_time,o.setCurrentSkipInterval(null))},children:["Skip ",T.currentSkipInterval.skip_type==="op"?"Opening":"Ending"]})]}),r("div",{className:C.rightControls,children:[r("div",{className:C.skipControls,children:f&&r("button",{className:C.nextEpisodeBtn,onClick:S,title:"Play next episode",children:"Next EP"})}),r("button",{className:`${C.controlBtn} ${l.isSubtitleActive?C.active:""}`,onClick:l.handleCCToggle,title:l.isSubtitleActive?"Disable Subtitles":"Enable Subtitles","aria-label":"Toggle Subtitles",children:r(Z,{name:"closed-captioning",size:22})}),r("button",{ref:P,className:`${C.controlBtn} ${J?C.active:""} `,onClick:()=>o.setShowSettings(!J),"aria-label":"Settings",children:r(Z,{name:"cog"})}),r("button",{className:`${C.controlBtn} ${C.theaterBtn} ${b?C.active:""} `,onClick:x=>{x.stopPropagation(),A()},title:b?"Exit Theater Mode":"Theater Mode","aria-label":b?"Exit Theater Mode":"Theater Mode",children:r(Z,{name:"tv"})}),r("button",{className:C.controlBtn,onClick:o.toggleFullscreen,"aria-label":T.isFullscreen?"Exit Fullscreen":"Fullscreen",children:T.isFullscreen?r(Z,{name:"compress"}):r(Z,{name:"expand"})})]})]})]})})};function bs(n){const{state:l,refs:h,actions:D}=n,f=o=>{h.videoRef.current&&(h.videoRef.current.volume=o,h.videoRef.current.muted=o===0)},S=o=>{!h.videoRef.current||isNaN(l.duration)||l.duration===0||(h.videoRef.current.currentTime=o*l.duration,D.sendProgressUpdate(!1,!0))},b=()=>{h.videoRef.current&&(D.setIsScrubbing(!0),D.wasPlayingBeforeScrub.current=!h.videoRef.current.paused,h.videoRef.current.pause())},A=o=>{!h.videoRef.current||!l.duration||(h.videoRef.current.currentTime=o*l.duration)},P=()=>{D.setIsScrubbing(!1),D.wasPlayingBeforeScrub.current&&h.videoRef.current?.play()},$=o=>{if(!h.videoRef.current)return;D.setActiveSubtitleTrack(o);try{if(o===null||o==="off")localStorage.setItem("playerSubtitlesEnabled","false");else{localStorage.setItem("playerSubtitlesEnabled","true");const g=l.availableSubtitles.find(x=>x.label===o||x.lang===o);g?localStorage.setItem("playerLastSubtitle",Zr(g)):localStorage.setItem("playerLastSubtitle",o)}}catch{}let J=!1;Array.from(h.videoRef.current.textTracks).forEach(g=>{const de=o!==null&&o!=="off"&&(g.language===o||g.label===o)&&!J;g.mode=de?"showing":"hidden",de&&(J=!0)})},T=l.activeSubtitleTrack!==null&&l.activeSubtitleTrack!=="off";return{handleVolumeChange:f,handleSeek:S,handleScrubStart:b,handleScrubMove:A,handleScrubEnd:P,handleSubtitleSelection:$,isSubtitleActive:T,handleCCToggle:()=>{if(!h.videoRef.current)return;if(T){$("off");return}if(l.availableSubtitles.length===0)return;let o=null;try{o=localStorage.getItem("playerLastSubtitle")}catch{}const J=Yt(l.availableSubtitles,{lastKey:o,enabled:!0});if(J<0)return;const g=l.availableSubtitles[J];$(g.label||g.lang)}}}const ys=Lr(()=>hr(()=>import("./PlayerSettings-uFwbD3Z7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Ss=({player:n,isAutoplayEnabled:l,onAutoplayChange:h,showNextEpisodeButton:D,onNextEpisode:f,videoSources:S,selectedSource:b,selectedLink:A,onSourceChange:P,loadingVideo:$,skipIntervals:T,animeTitle:e,episodeNumber:o,isTheaterMode:J,onTheaterModeToggle:g,anime4kEnabled:x,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Be,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Le,fallbackChoice:_e,onFallbackChoiceChange:Ne,ambientSettings:Ue,onAmbientChange:oe,children:we,overlays:c,isInteractingExtra:y=!1,className:v,hideChrome:I=!1})=>{const{state:R,actions:q}=n,{showSettings:ye}=R,{setShowSettings:Y}=q,G=bs(n),Te=Ot.useRef(null),Ie=Ot.useRef(null),yt=Ot.useRef(null);B(()=>{const F=W=>{Te.current&&!Te.current.contains(W.target)&&Ie.current&&!Ie.current.contains(W.target)&&ye&&Y(!1)};return ye&&document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}},[ye,Y]);const Ze=R.showControls||ye||R.isScrubbing,St=r(rn,{visible:Ze,title:e,episode:o?`Episode ${o}`:void 0,onBack:()=>window.history.back(),classes:{overlay:C.controlsOverlay,hidden:C.hidden,top:C.topControls,backBtn:C.backBtn,titleInfo:C.videoTitleInfo,title:C.animeTitle,episode:C.episodeNumber}}),H=!$&&!R.isBuffering&&R.duration>0?r(en,{isPlaying:R.isPlaying,onTogglePlay:q.togglePlay,onSkipBack:()=>q.seek(-10),onSkipForward:()=>q.seek(10)}):null,Pe=r(gs,{player:n,handlers:G,visible:Ze,skipIntervals:T,showNextEpisodeButton:D,onNextEpisode:f,isTheaterMode:J,onTheaterModeToggle:g,settingsBtnRef:Ie,timeDisplayRef:yt}),lt=r(Br,{fallback:null,children:r(ys,{ref:Te,isOpen:ye,onClose:()=>Y(!1),videoSources:S,currentSource:b,currentLink:A,onSourceChange:P,subtitles:R.availableSubtitles,activeSubtitleTrack:R.activeSubtitleTrack,onSubtitleChange:G.handleSubtitleSelection,subtitleSettings:{fontSize:R.subtitleFontSize,position:R.subtitlePosition,bgOpacity:R.subtitleBgOpacity,bgColor:R.subtitleBgColor,textColor:R.subtitleTextColor,edge:R.subtitleEdge,bold:R.subtitleBold},onSubtitleSettingsChange:(F,W)=>{const ke=(Ve,Ge)=>{try{localStorage.setItem(Ve,String(Ge))}catch{}};switch(F){case"fontSize":q.setSubtitleFontSize(W),ke("subtitleFontSize",W);break;case"position":q.setSubtitlePosition(W),ke("subtitlePosition",W);break;case"bgOpacity":q.setSubtitleBgOpacity(W),ke("subtitleBgOpacity",W);break;case"bgColor":q.setSubtitleBgColor(W),ke("subtitleBgColor",W);break;case"textColor":q.setSubtitleTextColor(W),ke("subtitleTextColor",W);break;case"edge":q.setSubtitleEdge(W),ke("subtitleEdge",W);break;case"bold":q.setSubtitleBold(W),ke("subtitleBold",W);break}},useNativeControls:R.useNativeControls,onNativeControlsToggle:q.setUseNativeControls,anime4kEnabled:x,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Be,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Le,isAutoSkipEnabled:R.isAutoSkipEnabled,onAutoSkipChange:F=>{q.setIsAutoSkipEnabled(F);try{localStorage.setItem("autoSkipEnabled",F.toString())}catch{}},isAutoplayEnabled:l,onAutoplayChange:h,fallbackChoice:_e,onFallbackChoiceChange:Ne,isTheaterMode:J,ambientSettings:Ue,onAmbientChange:oe})}),_=ye?r("div",{"data-speed-boost-ignore":"true",onClick:F=>F.stopPropagation(),children:lt}):null;return r(tn,{player:n,topBar:St,centerControls:H,bottomBar:!$&&R.duration>0?Pe:null,settingsPanel:_,overlays:c,isInteracting:y,className:v,chromeDisabled:I,children:we})},Es=({count:n=3})=>r("section",{className:ze.section,children:[r("div",{className:ze.header,children:r("button",{className:ze.headerToggle,disabled:!0,children:[r("span",{className:ze.title,children:r(Mt,{width:"60px",height:"1.2rem",variant:"text"})}),r(Z,{name:"chevron-down",style:{opacity:.3}})]})}),r("div",{className:ze.list,children:Array.from({length:n}).map((l,h)=>r("div",{className:ze.item,style:{pointerEvents:"none"},children:[r("div",{className:ze.dragHandle,style:{opacity:.2},children:r(Mt,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:ze.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(Mt,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:ze.meta,children:[r(Mt,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(Mt,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},h))})]}),ws=({selectedProvider:n,onProviderChange:l,isAdult:h,options:D})=>{const f=D&&D.length>0?D:[],S=h===void 0?f:f.filter(b=>b.mature===h);return r("div",{className:at.providerSelectContainer,children:[r("h4",{children:"Provider"}),r("select",{className:at.providerSelect,value:n,onChange:b=>l(b.target.value),children:Ln.map(b=>{const A=S.filter(P=>(P.tier??"direct")===b);return A.length===0?null:r("optgroup",{label:Bn[b],children:A.map(P=>r("option",{value:P.value,children:P.sub?`${P.label} (${An[P.sub]})`:P.label},P.value))},b)})})]})},Ts=({videoSources:n,selectedSource:l,selectedLink:h,onSourceChange:D,onLinkChange:f})=>{const S=Array.isArray(n)?n:[];if(S.length===0)return null;const b=l?.type==="iframe"&&(l.links?.length??0)>1;return r("div",{className:at.sourceSelectionContainer,children:[r("h4",{children:"Source"}),r("div",{className:at.sourceButtons,children:S.map((A,P)=>r("button",{className:`${at.sourceButton} ${l?.sourceName===A.sourceName?at.active:""} `,onClick:()=>D(A),children:A.sourceName},`${A.sourceName}-${P}`))}),b&&r("select",{className:at.sourceSelect,"aria-label":"Fallback embed quality",value:h?.link??l.links[0]?.link??"",onChange:A=>{const P=l.links.find($=>$.link===A.target.value);P&&f(P)},children:l.links.map(A=>r("option",{value:A.link,children:A.resolutionStr},A.link))})]})},ks=Ot.memo(Ts,(n,l)=>n.selectedSource?.sourceName===l.selectedSource?.sourceName&&n.selectedLink?.link===l.selectedLink?.link&&n.videoSources===l.videoSources),Cs={low:{sd:1.5,hd:1.3,fhd:1.25},balanced:{sd:2,hd:1.5,fhd:1.25},high:{sd:2.5,hd:2,fhd:1.5},denoise:{sd:1.5,hd:1.5,fhd:1.5}},Rs={low:"ModeB",balanced:"ModeA",high:"ModeAA",denoise:"ModeC"},Ms=5,_s=15e3,Ns=`
3
3
  @group(0) @binding(0) var extTex: texture_external;
4
4
  @group(0) @binding(1) var extSamp: sampler;
5
5
  struct VSOut {
@@ -1 +1 @@
1
- import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as ae,O as A,a as se,A as le,b as ie}from"./OptionListMenu-CetjZizt.js";import{u as re}from"./index-B4AdKbhW.js";import"./AvSyncCalibrator-DBBUzoHn.js";import"./vendor-query-BBT5_sHx.js";const ce="_settingsPanel_1dymm_1",oe="_header_1dymm_33",me="_backBtn_1dymm_56",de="_contentWrapper_1dymm_76",ue="_menuContent_1dymm_82",he="_menuItem_1dymm_89",pe="_selected_1dymm_114",be="_currentValue_1dymm_134",ye="_menuNote_1dymm_141",ge="_menuError_1dymm_150",n={settingsPanel:ce,header:oe,backBtn:me,contentWrapper:de,menuContent:ue,menuItem:he,selected:pe,currentValue:be,menuNote:ye,menuError:ge},ve=($,P)=>{const{isOpen:y,onClose:ke,videoSources:Ce,currentSource:C,currentLink:N,onSourceChange:V,subtitles:O,activeSubtitleTrack:g,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:v,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:f,anime4kProfile:r,onAnime4kProfileChange:h,anime4kInitializing:L,anime4kError:S,videoDelayEnabled:_,onVideoDelayToggle:M,videoDelayMs:I,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:m,onAutoSkipChange:W,isAutoplayEnabled:d,onAutoplayChange:G,fallbackChoice:p,onFallbackChoiceChange:j,isTheaterMode:q,ambientSettings:b,onAmbientChange:k}=$,{lowEndMode:F}=re(),[a,i]=ne("main");w.useEffect(()=>{if(!y){const t=setTimeout(()=>i("main"),300);return()=>clearTimeout(t)}},[y]);const Q=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>i("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:N?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:g||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),F&&e("button",{className:`${n.menuItem} ${v?n.selected:""}`,onClick:()=>{const t=!v;U(t),localStorage.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),v&&e(o,{name:"check",size:12})]}),f&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),f&&u&&e("button",{className:n.menuItem,onClick:()=>i("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>i("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:_?`${I}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[m?"Auto-skip On":null,d?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]}),q&&b&&k&&e("button",{className:n.menuItem,onClick:()=>i("ambient"),children:[e("span",{children:"Ambient Light"}),e("span",{className:n.currentValue,children:b.enabled?"On":"Off"})]})]}),R=()=>{const t=C?.links.sort((s,c)=>(parseInt(c.resolutionStr)||0)-(parseInt(s.resolutionStr)||0))||[];return e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.resolutionStr,label:s.resolutionStr,selected:N?.resolutionStr===s.resolutionStr})),onSelect:s=>{const c=t.find(l=>l.resolutionStr===s);c&&V(C,c)}})})},H=()=>e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:g==="off"},...O.map(t=>({key:t.label||t.lang,label:t.label,selected:g===(t.label||t.lang)}))],onSelect:t=>E(t)})}),K=()=>e("div",{className:n.menuContent,children:e(se,{classes:{item:n.menuItem,active:n.selected},values:z,onChange:T})}),J=te(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const c=navigator.userAgent.toLowerCase();return c.includes("chrome")||c.includes("chromium")||c.includes("edg")}catch{return!0}},[]),X=()=>e("div",{className:n.menuContent,children:[L&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),S&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",S]}),!J&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${r==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),r==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),r==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),r==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),r==="denoise"&&e(o,{name:"check",size:12})]})]}),Y=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>W(!m),"aria-pressed":m,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>G(!d),"aria-pressed":d,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>j(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),Z=()=>e("div",{className:n.menuContent,children:e(le,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:_,delayMs:I,onToggle:M,onDelayChange:D,onCalibrate:x})}),ee=()=>b&&k?e("div",{className:n.menuContent,children:e(ie,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:k})}):null;return y?e(ae,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a==="ambient"?"Ambient Light":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>i("main"),panelRef:P,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&Q(),a==="quality"&&R(),a==="subtitles"&&H(),a==="subtitle-style"&&K(),a==="upscaler"&&X(),a==="av-sync"&&Z(),a==="playback"&&Y(),a==="ambient"&&ee()]}):null},we=w.forwardRef(ve);export{we as default};
1
+ import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as ae,O as A,a as se,A as le,b as ie}from"./OptionListMenu-BiiWXfEL.js";import{u as re}from"./index-VzVAYX5A.js";import"./AvSyncCalibrator-XNJmMFmH.js";import"./vendor-query-BBT5_sHx.js";const ce="_settingsPanel_1dymm_1",oe="_header_1dymm_33",me="_backBtn_1dymm_56",de="_contentWrapper_1dymm_76",ue="_menuContent_1dymm_82",he="_menuItem_1dymm_89",pe="_selected_1dymm_114",be="_currentValue_1dymm_134",ye="_menuNote_1dymm_141",ge="_menuError_1dymm_150",n={settingsPanel:ce,header:oe,backBtn:me,contentWrapper:de,menuContent:ue,menuItem:he,selected:pe,currentValue:be,menuNote:ye,menuError:ge},ve=($,P)=>{const{isOpen:y,onClose:ke,videoSources:Ce,currentSource:C,currentLink:N,onSourceChange:V,subtitles:O,activeSubtitleTrack:g,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:v,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:f,anime4kProfile:r,onAnime4kProfileChange:h,anime4kInitializing:L,anime4kError:S,videoDelayEnabled:_,onVideoDelayToggle:M,videoDelayMs:I,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:m,onAutoSkipChange:W,isAutoplayEnabled:d,onAutoplayChange:G,fallbackChoice:p,onFallbackChoiceChange:j,isTheaterMode:q,ambientSettings:b,onAmbientChange:k}=$,{lowEndMode:F}=re(),[a,i]=ne("main");w.useEffect(()=>{if(!y){const t=setTimeout(()=>i("main"),300);return()=>clearTimeout(t)}},[y]);const Q=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>i("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:N?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:g||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),F&&e("button",{className:`${n.menuItem} ${v?n.selected:""}`,onClick:()=>{const t=!v;U(t),localStorage.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),v&&e(o,{name:"check",size:12})]}),f&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),f&&u&&e("button",{className:n.menuItem,onClick:()=>i("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>i("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:_?`${I}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[m?"Auto-skip On":null,d?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]}),q&&b&&k&&e("button",{className:n.menuItem,onClick:()=>i("ambient"),children:[e("span",{children:"Ambient Light"}),e("span",{className:n.currentValue,children:b.enabled?"On":"Off"})]})]}),R=()=>{const t=C?.links.sort((s,c)=>(parseInt(c.resolutionStr)||0)-(parseInt(s.resolutionStr)||0))||[];return e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.resolutionStr,label:s.resolutionStr,selected:N?.resolutionStr===s.resolutionStr})),onSelect:s=>{const c=t.find(l=>l.resolutionStr===s);c&&V(C,c)}})})},H=()=>e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:g==="off"},...O.map(t=>({key:t.label||t.lang,label:t.label,selected:g===(t.label||t.lang)}))],onSelect:t=>E(t)})}),K=()=>e("div",{className:n.menuContent,children:e(se,{classes:{item:n.menuItem,active:n.selected},values:z,onChange:T})}),J=te(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const c=navigator.userAgent.toLowerCase();return c.includes("chrome")||c.includes("chromium")||c.includes("edg")}catch{return!0}},[]),X=()=>e("div",{className:n.menuContent,children:[L&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),S&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",S]}),!J&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${r==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),r==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),r==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),r==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),r==="denoise"&&e(o,{name:"check",size:12})]})]}),Y=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>W(!m),"aria-pressed":m,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>G(!d),"aria-pressed":d,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>j(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),Z=()=>e("div",{className:n.menuContent,children:e(le,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:_,delayMs:I,onToggle:M,onDelayChange:D,onCalibrate:x})}),ee=()=>b&&k?e("div",{className:n.menuContent,children:e(ie,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:k})}):null;return y?e(ae,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a==="ambient"?"Ambient Light":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>i("main"),panelRef:P,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&Q(),a==="quality"&&R(),a==="subtitles"&&H(),a==="subtitle-style"&&K(),a==="upscaler"&&X(),a==="av-sync"&&Z(),a==="playback"&&Y(),a==="ambient"&&ee()]}):null},we=w.forwardRef(ve);export{we as default};
@@ -1 +1 @@
1
- import{b as F}from"./vendor-query-BBT5_sHx.js";import{t as T,l as j,Z as H,$ as J,a0 as W}from"./index-B4AdKbhW.js";import{d as X,T as R,q as r,u as t,$ as Y,S as w}from"./vendor-core-DfaOB3Rn.js";import{a as ee,c as te,d as ne,b as se,o as oe,f as ae,s as ie}from"./vendor-ui-3qrARCPr.js";import{I as u}from"./vendor-icons-DrybRNxP.js";function Pe(n){return F({queryKey:["show-meta",n],queryFn:async()=>n?T.data.showMeta.query({id:n}):{},enabled:!!n,staleTime:3e4})}async function re(n){try{return await T.watchlist.queueSuggested.query({showId:n})}catch{throw new Error("Failed to resolve suggested episode")}}const ue="_trigger_1vova_6",le="_triggerBtn_1vova_11",me="_chevron_1vova_25",ce="_menu_1vova_34",de="_menuTitle_1vova_51",pe="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",a={trigger:ue,triggerBtn:le,chevron:me,menu:ce,menuTitle:de,menuItem:pe,removeItem:ge,menuEmpty:fe},ve=8,qe=({showId:n,showName:v,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:z="",activeClassName:A="",align:D="right",onMenuOpenChange:p})=>{const{data:E=[]}=j(),P=H(),q=J(),[l,f]=X(!1),{refs:Q,floatingStyles:M,context:S}=ee({open:l,onOpenChange:e=>{e||(f(!1),p?.(!1))},placement:D==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ae({padding:8}),ie({padding:8})],whileElementsMounted:se}),x=te(S,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:C,getFloatingProps:I}=ne([x]),m=R(()=>E.filter(e=>e.showId===n),[E,n]),{data:K}=F({queryKey:["suggestedEpisode",n],queryFn:()=>re(n),enabled:!!n}),{data:$,isFetching:N}=W(n,l),s=R(()=>$?.episodes||[],[$]),k=r(()=>{f(!0),p?.(!0)},[p]),c=r(()=>{f(!1),p?.(!1)},[p]),d=m.length>0,o=s.length>0,g=K?.episodeNumber,i=r(e=>{!n||e.length===0||(P.mutate({showId:n,episodeNumbers:e,showName:v,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,v,h,y,_,b,P,c]),L=r(()=>{!n||m.length===0||(q.mutate({showId:n,episodeNumbers:m.map(e=>e.episodeNumber)}),c())},[n,m,q,c]),O=r(()=>{o?i([s[0]]):g&&i([String(g)])},[o,s,g,i]),U=r(()=>{o&&i(s.slice(0,3))},[o,s,i]),G=r(()=>{o&&i([...s])},[o,s,i]),B=s[0],V=s[Math.min(2,s.length-1)],Z=t("div",{className:a.trigger,ref:Q.setReference,children:t("span",{className:`${a.triggerBtn} ${z} ${d?A:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":l,"aria-label":d?"Queued":"Queue",...C(),onClick:e=>{e.preventDefault(),e.stopPropagation(),l?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),l?c():k())},children:[d?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),d?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:a.chevron})]})});return t(w,{children:[Z,l&&Y(t("div",{ref:Q.setFloating,className:a.menu,style:M,role:"menu",...I(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:a.menuTitle,children:"Queue episodes"}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o&&!g,onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+1 — EP ${B}`:`+1 — EP ${g||"?"}`})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),U()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+3 — EP ${B}${s.length>1?`-${V}`:""}`:"+3"})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),G()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:a.menuEmpty,children:d?"All episodes are already queued":"No remaining unwatched episodes"}),d&&t("button",{className:`${a.menuItem} ${a.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),L()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",m.length>0?` (${m.length})`:""]})]})]}),document.body)]})};export{qe as Q,Pe as u};
1
+ import{b as F}from"./vendor-query-BBT5_sHx.js";import{t as T,l as j,Z as H,$ as J,a0 as W}from"./index-VzVAYX5A.js";import{d as X,T as R,q as r,u as t,$ as Y,S as w}from"./vendor-core-DfaOB3Rn.js";import{a as ee,c as te,d as ne,b as se,o as oe,f as ae,s as ie}from"./vendor-ui-3qrARCPr.js";import{I as u}from"./vendor-icons-DrybRNxP.js";function Pe(n){return F({queryKey:["show-meta",n],queryFn:async()=>n?T.data.showMeta.query({id:n}):{},enabled:!!n,staleTime:3e4})}async function re(n){try{return await T.watchlist.queueSuggested.query({showId:n})}catch{throw new Error("Failed to resolve suggested episode")}}const ue="_trigger_1vova_6",le="_triggerBtn_1vova_11",me="_chevron_1vova_25",ce="_menu_1vova_34",de="_menuTitle_1vova_51",pe="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",a={trigger:ue,triggerBtn:le,chevron:me,menu:ce,menuTitle:de,menuItem:pe,removeItem:ge,menuEmpty:fe},ve=8,qe=({showId:n,showName:v,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:z="",activeClassName:A="",align:D="right",onMenuOpenChange:p})=>{const{data:E=[]}=j(),P=H(),q=J(),[l,f]=X(!1),{refs:Q,floatingStyles:M,context:S}=ee({open:l,onOpenChange:e=>{e||(f(!1),p?.(!1))},placement:D==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ae({padding:8}),ie({padding:8})],whileElementsMounted:se}),x=te(S,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:C,getFloatingProps:I}=ne([x]),m=R(()=>E.filter(e=>e.showId===n),[E,n]),{data:K}=F({queryKey:["suggestedEpisode",n],queryFn:()=>re(n),enabled:!!n}),{data:$,isFetching:N}=W(n,l),s=R(()=>$?.episodes||[],[$]),k=r(()=>{f(!0),p?.(!0)},[p]),c=r(()=>{f(!1),p?.(!1)},[p]),d=m.length>0,o=s.length>0,g=K?.episodeNumber,i=r(e=>{!n||e.length===0||(P.mutate({showId:n,episodeNumbers:e,showName:v,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,v,h,y,_,b,P,c]),L=r(()=>{!n||m.length===0||(q.mutate({showId:n,episodeNumbers:m.map(e=>e.episodeNumber)}),c())},[n,m,q,c]),O=r(()=>{o?i([s[0]]):g&&i([String(g)])},[o,s,g,i]),U=r(()=>{o&&i(s.slice(0,3))},[o,s,i]),G=r(()=>{o&&i([...s])},[o,s,i]),B=s[0],V=s[Math.min(2,s.length-1)],Z=t("div",{className:a.trigger,ref:Q.setReference,children:t("span",{className:`${a.triggerBtn} ${z} ${d?A:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":l,"aria-label":d?"Queued":"Queue",...C(),onClick:e=>{e.preventDefault(),e.stopPropagation(),l?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),l?c():k())},children:[d?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),d?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:a.chevron})]})});return t(w,{children:[Z,l&&Y(t("div",{ref:Q.setFloating,className:a.menu,style:M,role:"menu",...I(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:a.menuTitle,children:"Queue episodes"}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o&&!g,onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+1 — EP ${B}`:`+1 — EP ${g||"?"}`})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),U()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+3 — EP ${B}${s.length>1?`-${V}`:""}`:"+3"})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),G()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:a.menuEmpty,children:d?"All episodes are already queued":"No remaining unwatched episodes"}),d&&t("button",{className:`${a.menuItem} ${a.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),L()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",m.length>0?` (${m.length})`:""]})]})]}),document.body)]})};export{qe as Q,Pe as u};
@@ -1 +1 @@
1
- import{g as s,u as n,a as Y}from"./vendor-core-DfaOB3Rn.js";import{I as P}from"./vendor-icons-DrybRNxP.js";import{d as L,f as z}from"./index-B4AdKbhW.js";const F="_section_1pwqc_1",O="_header_1pwqc_10",j="_headerToggle_1pwqc_20",G="_headerActions_1pwqc_34",J="_title_1pwqc_40",K="_badge_1pwqc_50",V="_clearBtn_1pwqc_65",W="_nextBtn_1pwqc_83",Z="_list_1pwqc_101",ee="_item_1pwqc_114",ne="_active_1pwqc_134",te="_dragging_1pwqc_142",re="_dragHandle_1pwqc_149",ce="_thumbnail_1pwqc_167",ae="_meta_1pwqc_175",oe="_name_1pwqc_182",se="_episode_1pwqc_204",ie="_iconBtn_1pwqc_210",r={section:F,header:O,headerToggle:j,headerActions:G,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ce,meta:ae,name:oe,episode:se,iconBtn:ie},le=({item:c,isActive:T,index:m,onRemove:D,onTouchPointerDown:v,onTouchPointerMove:x,onTouchPointerUp:q,onTouchPointerCancel:I,shouldIgnoreClick:_,onDragStart:B,onDragEnter:f,onDragEnd:o,isDragging:w})=>{const a=Y(),{titlePreference:i}=L(),l=c[i]||c.name||"Unknown show";return n("div",{"data-queue-index":m,className:`${r.item} ${T?r.active:""} ${w?r.dragging:""}`,draggable:!0,onDragStart:B,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:o,onPointerDown:u=>v(m,u),onPointerMove:x,onPointerUp:q,onPointerCancel:I,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(P,{name:"bars"})}),n("img",{className:r.thumbnail,src:z(c.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||a(`/watch/${c.showId}/${c.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",c.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||D(c)},"aria-label":`Remove ${l} episode ${c.episodeNumber} from queue`,children:n(P,{name:"times"})})]})},he=({title:c="Queue",eyebrow:T,items:m,currentShowId:D,currentEpisode:v,onRemove:x,onReorder:q,onNextQueue:I,onClear:_,showClearAll:B=!1,defaultExpanded:f=!0})=>{const[o,w]=s.useState([]),[a,i]=s.useState(null),[l,u]=s.useState(f),b=s.useRef(null),N=s.useRef(null),d=s.useRef(null),p=s.useRef(!1),R=s.useRef(!1);s.useEffect(()=>{w(m)},[m]),s.useEffect(()=>{u(f)},[f]);const E=e=>{i(e)},$=e=>{if(a===null||a===e)return;const t=[...o],h=t[a];t.splice(a,1),t.splice(e,0,h),i(e),w(t)},k=()=>{a!==null&&q(o.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},C=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&p.current&&(q(o.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),R.current=!0,window.setTimeout(()=>{R.current=!1},0)),b.current=null,N.current=null,p.current=!1,i(null)},A=(e,t)=>{if(t.pointerType==="mouse")return;const h=t.currentTarget,g=t.pointerId;b.current=t.pointerId,N.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{p.current=!0,i(e);try{h.setPointerCapture(g)}catch{}},220)},Q=e=>{if(e.pointerType==="mouse"||b.current!==e.pointerId)return;if(!p.current&&N.current){const H=Math.abs(e.clientX-N.current.x),X=Math.abs(e.clientY-N.current.y);(H>8||X>8)&&C(!1);return}if(!p.current)return;e.preventDefault();const h=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),g=h?Number(h.dataset.queueIndex):NaN;if(Number.isNaN(g)||a===null||g===a)return;const y=[...o],U=y[a];y.splice(a,1),y.splice(g,0,U),i(g),w(y)},S=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(p.current)},M=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(!1)};return o.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${c}`:`Expand ${c}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[T&&n("div",{className:"section-eyebrow",children:T}),n("span",{children:c})]}),n("span",{className:r.badge,children:o.length})]}),l?n(P,{name:"chevron-up"}):n(P,{name:"chevron-down"})]}),B&&_&&n("div",{className:r.headerActions,children:[I&&o.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:I,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:o.map((e,t)=>n(le,{item:e,isActive:e.showId===D&&e.episodeNumber===v,index:t,onRemove:x,onTouchPointerDown:A,onTouchPointerMove:Q,onTouchPointerUp:S,onTouchPointerCancel:M,shouldIgnoreClick:()=>R.current,onDragStart:()=>E(t),onDragEnter:()=>$(t),onDragEnd:k,isDragging:a===t},e.id))})]})};export{he as Q,r as s};
1
+ import{g as s,u as n,a as Y}from"./vendor-core-DfaOB3Rn.js";import{I as P}from"./vendor-icons-DrybRNxP.js";import{d as L,f as z}from"./index-VzVAYX5A.js";const F="_section_1pwqc_1",O="_header_1pwqc_10",j="_headerToggle_1pwqc_20",G="_headerActions_1pwqc_34",J="_title_1pwqc_40",K="_badge_1pwqc_50",V="_clearBtn_1pwqc_65",W="_nextBtn_1pwqc_83",Z="_list_1pwqc_101",ee="_item_1pwqc_114",ne="_active_1pwqc_134",te="_dragging_1pwqc_142",re="_dragHandle_1pwqc_149",ce="_thumbnail_1pwqc_167",ae="_meta_1pwqc_175",oe="_name_1pwqc_182",se="_episode_1pwqc_204",ie="_iconBtn_1pwqc_210",r={section:F,header:O,headerToggle:j,headerActions:G,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ce,meta:ae,name:oe,episode:se,iconBtn:ie},le=({item:c,isActive:T,index:m,onRemove:D,onTouchPointerDown:v,onTouchPointerMove:x,onTouchPointerUp:q,onTouchPointerCancel:I,shouldIgnoreClick:_,onDragStart:B,onDragEnter:f,onDragEnd:o,isDragging:w})=>{const a=Y(),{titlePreference:i}=L(),l=c[i]||c.name||"Unknown show";return n("div",{"data-queue-index":m,className:`${r.item} ${T?r.active:""} ${w?r.dragging:""}`,draggable:!0,onDragStart:B,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:o,onPointerDown:u=>v(m,u),onPointerMove:x,onPointerUp:q,onPointerCancel:I,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(P,{name:"bars"})}),n("img",{className:r.thumbnail,src:z(c.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||a(`/watch/${c.showId}/${c.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",c.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||D(c)},"aria-label":`Remove ${l} episode ${c.episodeNumber} from queue`,children:n(P,{name:"times"})})]})},he=({title:c="Queue",eyebrow:T,items:m,currentShowId:D,currentEpisode:v,onRemove:x,onReorder:q,onNextQueue:I,onClear:_,showClearAll:B=!1,defaultExpanded:f=!0})=>{const[o,w]=s.useState([]),[a,i]=s.useState(null),[l,u]=s.useState(f),b=s.useRef(null),N=s.useRef(null),d=s.useRef(null),p=s.useRef(!1),R=s.useRef(!1);s.useEffect(()=>{w(m)},[m]),s.useEffect(()=>{u(f)},[f]);const E=e=>{i(e)},$=e=>{if(a===null||a===e)return;const t=[...o],h=t[a];t.splice(a,1),t.splice(e,0,h),i(e),w(t)},k=()=>{a!==null&&q(o.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},C=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&p.current&&(q(o.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),R.current=!0,window.setTimeout(()=>{R.current=!1},0)),b.current=null,N.current=null,p.current=!1,i(null)},A=(e,t)=>{if(t.pointerType==="mouse")return;const h=t.currentTarget,g=t.pointerId;b.current=t.pointerId,N.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{p.current=!0,i(e);try{h.setPointerCapture(g)}catch{}},220)},Q=e=>{if(e.pointerType==="mouse"||b.current!==e.pointerId)return;if(!p.current&&N.current){const H=Math.abs(e.clientX-N.current.x),X=Math.abs(e.clientY-N.current.y);(H>8||X>8)&&C(!1);return}if(!p.current)return;e.preventDefault();const h=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),g=h?Number(h.dataset.queueIndex):NaN;if(Number.isNaN(g)||a===null||g===a)return;const y=[...o],U=y[a];y.splice(a,1),y.splice(g,0,U),i(g),w(y)},S=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(p.current)},M=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(!1)};return o.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${c}`:`Expand ${c}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[T&&n("div",{className:"section-eyebrow",children:T}),n("span",{children:c})]}),n("span",{className:r.badge,children:o.length})]}),l?n(P,{name:"chevron-up"}):n(P,{name:"chevron-down"})]}),B&&_&&n("div",{className:r.headerActions,children:[I&&o.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:I,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:o.map((e,t)=>n(le,{item:e,isActive:e.showId===D&&e.episodeNumber===v,index:t,onRemove:x,onTouchPointerDown:A,onTouchPointerMove:Q,onTouchPointerUp:S,onTouchPointerCancel:M,shouldIgnoreClick:()=>R.current,onDragStart:()=>E(t),onDragEnter:()=>$(t),onDragEnd:k,isDragging:a===t},e.id))})]})};export{he as Q,r as s};
@@ -1 +1 @@
1
- import{d as h,A as F,h as y,g as se,u as e,S as R,$ as J,T as K}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{b as Z}from"./vendor-query-BBT5_sHx.js";import{h as x,t as G,O as re}from"./index-B4AdKbhW.js";import{a}from"./Asmr.module-CdWlioTY.js";import{r as i}from"./Radio.module-DGSZLpKM.js";import{p as L}from"./page.module-C1MlZzf3.js";const ee=300*1e3,le="https://cdn.listen.moe/covers/";function z(n){return n?n.startsWith("http")?n:`${le}${n}`:null}function oe(n){return n?z(n.albums[0]?.image)||z(n.artists[0]?.image)||z(n.sources[0]?.image):null}function U(n){return n?n.artists.map(s=>s.nameRomaji||s.name).join(", "):""}const ie=()=>{const n=x();return Z({...n.radio.stations.queryOptions(),staleTime:ee})},ce=n=>{const s=x();return Z({...s.radio.search.queryOptions({q:n}),enabled:n.trim().length>0,staleTime:ee})},X={song:null,lastPlayed:[],listeners:0,startTime:null},de=n=>{const[s,p]=h(X),[l,c]=h(!1),d=F(null);return y(()=>{if(p(X),c(!1),!n)return;let u=null,f=!1;try{u=new WebSocket(n)}catch{return}return u.onopen=()=>{f||c(!0)},u.onmessage=v=>{try{const m=JSON.parse(v.data);if(m.op===0){const N=m.d?.heartbeat||35e3;d.current&&window.clearInterval(d.current),d.current=window.setInterval(()=>{u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({op:9}))},N)}else m.op===1&&p({song:m.d?.song||null,lastPlayed:m.d?.lastPlayed||[],listeners:m.d?.listeners||0,startTime:m.d?.startTime||null})}catch{}},u.onclose=()=>{f||c(!1)},()=>{f=!0,d.current&&window.clearInterval(d.current),d.current=null,u&&u.close()}},[n]),{nowPlaying:s,connected:l}};function Y(n){if(!n)return"";const s=Math.max(0,Math.floor((Date.now()-new Date(n).getTime())/1e3)),p=Math.floor(s/60),l=s%60;return`${p}:${String(l).padStart(2,"0")}`}const me=({station:n,nowPlaying:s,connected:p,expanded:l,onStationStep:c,onExpandedChange:d,onClose:u})=>{const f=F(null),[v,m]=h(!1),[N,V]=h(!0),[S,I]=h(!1),[T,k]=h(!0),[A,E]=h(""),[b,D]=h(()=>{const t=parseFloat(localStorage.getItem("radioVolume")||"");return Number.isFinite(t)?t:1}),r=F(""),g=F(b);g.current=b,r.current||(r.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`radio-${Date.now()}-${Math.random().toString(36).slice(2)}`);const w=s.song,C=oe(w)||n.favicon||null,[B,W]=h(!1);y(()=>{W(!1)},[C]);const M=B?null:C,q=!!M,P=w?`${U(w)} — ${w.title}`:n.name;y(()=>{const t=f.current;if(t)return m(!1),t.src=n.streamUrl,t.load(),t.volume=g.current,t.play().catch(()=>m(!1)),()=>{t.removeAttribute("src")}},[n.id,n.streamUrl]),y(()=>{const t=f.current;t&&(t.volume=b)},[b]),y(()=>{if(l)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[l]),y(()=>{l&&k(!0)},[l]);const te=t=>t?Math.max(0,Math.floor((Date.now()-new Date(t).getTime())/1e3)):0,O=se.useCallback(t=>{n&&(G.discord.radioPresence.mutate({title:P,stationLabel:n.name,isPlaying:t,thumbnail:M||"",currentTime:te(s.startTime),sessionId:r.current}).catch(()=>{}),G.discord.heartbeat.mutate({sessionId:r.current}).catch(()=>{}))},[n,P,M,s.startTime]);y(()=>{O(v)},[O,v,n.id,P,l]),y(()=>{if(!v)return;const t=window.setInterval(()=>O(!0),15e3);return()=>window.clearInterval(t)},[v,O]),y(()=>{const t=r.current,$=()=>re(t),H=()=>$(),_=()=>{document.visibilityState==="hidden"&&$()};return window.addEventListener("pagehide",H),window.addEventListener("beforeunload",H),document.addEventListener("visibilitychange",_),()=>{window.removeEventListener("pagehide",H),window.removeEventListener("beforeunload",H),document.removeEventListener("visibilitychange",_),$()}},[]),y(()=>{if(!s.startTime){E("");return}E(Y(s.startTime));const t=window.setInterval(()=>E(Y(s.startTime)),1e3);return()=>window.clearInterval(t)},[s.startTime,s.song?.id]),y(()=>{if(!l)return;const t=$=>{$.key==="Escape"&&(S?I(!1):d(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[l,S,d]);const ae=()=>{const t=f.current;t&&(t.paused?(t.load(),t.play().catch(()=>{})):t.pause())},ne=e(R,{children:[e("div",{className:a.playerButtons,children:[e("button",{className:a.playerBtn,onClick:()=>c(-1),"aria-label":"Previous station",children:e(o,{name:"step-backward"})}),e("button",{className:`${a.playerBtn} ${a.playBtn}`,onClick:ae,"aria-label":v?"Pause":"Play",children:v?e(o,{name:"pause"}):e(o,{name:"play"})}),e("button",{className:a.playerBtn,onClick:()=>c(1),"aria-label":"Next station",children:e(o,{name:"step-forward"})})]}),e("div",{className:a.seekRow,children:[e("span",{className:i.liveBadge,children:[e(o,{name:"broadcast-tower",size:10})," LIVE"]}),A&&e("span",{className:a.timeLabel,children:A}),p&&s.listeners>0&&e("span",{className:a.timeLabel,children:[s.listeners," listening"]}),!p&&n.source==="listen.moe"&&e("span",{className:a.timeLabel,children:"connecting…"})]})]}),j=e(R,{children:[e("button",{className:`${a.playerBtn} ${a.playerToggle}`,onClick:()=>d(!l),"aria-label":l?"Minimize player":"Expand player",title:l?"Minimize to browse":"Expand",children:l?e(o,{name:"chevron-down"}):e(o,{name:"chevron-up"})}),e("div",{className:a.playerInfo,children:[e("p",{className:a.playerTitle,title:P,children:P}),e("p",{className:a.playerTrack,children:n.name})]}),e("div",{className:a.playerControls,children:ne}),e("div",{className:a.playerRight,children:[b===0?e(o,{name:"volume-mute",className:a.volumeIcon}):b<.5?e(o,{name:"volume-down",className:a.volumeIcon}):e(o,{name:"volume-up",className:a.volumeIcon}),e("input",{className:a.volumeBar,type:"range",min:0,max:1,step:.01,value:b,onChange:t=>{const $=parseFloat(t.target.value);D($),localStorage.setItem("radioVolume",String($))},style:{"--volume-percent":`${b*100}%`},"aria-label":"Volume"})]}),e("div",{className:a.playerActions,children:[l&&q&&e("button",{className:a.playerBtn,onClick:()=>V(t=>!t),"aria-label":N?"Hide art":"Show art",title:N?"Hide art":"Show art",children:N?e(o,{name:"eye-slash"}):e(o,{name:"image"})}),l&&s.lastPlayed.length>0&&e("button",{className:`${a.playerBtn} ${S?a.playerBtnActive:""}`,onClick:()=>I(t=>!t),"aria-label":S?"Hide history":"Show history",title:"Recently played",children:e(o,{name:"list-ol"})}),e("button",{className:a.playerBtn,onClick:u,"aria-label":"Close player",children:e(o,{name:"times"})})]})]}),Q=e("audio",{ref:f,preload:"none",onPlay:()=>m(!0),onPause:()=>m(!1)});return l?J(e(R,{children:[Q,e("div",{className:`${a.npOverlay} ${T?"":a.npOverlayControlsHidden}`,children:[e("div",{className:`${a.npStage} ${!N||!q?a.npStageBlank:""}`,onClick:()=>k(t=>!t),children:N&&q&&M&&e("div",{className:i.coverWrap,children:e("img",{src:M,alt:P,loading:"lazy",decoding:"async",draggable:!1,className:i.cover,onError:()=>W(!0)})})}),e("div",{className:`${a.playerBar} ${a.playerBarDocked} ${T?"":a.playerBarDockedHidden}`,onClick:t=>t.stopPropagation(),children:[j,S&&e(R,{children:[e("div",{className:a.npBackdrop,onClick:()=>I(!1)}),e("div",{className:a.chapterPanel,children:s.lastPlayed.map(t=>e("div",{className:a.chapterRow,children:e("span",{className:a.chapterRowLabel,title:`${U(t)} — ${t.title}`,children:[U(t)," — ",t.title]})},t.id))})]})]})]})]}),document.body):J(e(R,{children:[Q,e("div",{className:a.playerBar,children:j})]}),document.body)},Ne=()=>{y(()=>{document.title="Radio - dango"},[]);const[n,s]=h(""),[p,l]=h(""),[c,d]=h(null),[u,f]=h(!0),{data:v,isLoading:m}=ie(),{data:N,isLoading:V}=ce(p),S=K(()=>v?.stations||[],[v]),I=K(()=>N?.stations||[],[N]),T=p?I:S,{nowPlaying:k,connected:A}=de(c?.gateway),E=r=>{d(r),f(!0)},b=r=>{const g=T.length>0?T:S;if(g.length===0||!c)return;const w=g.findIndex(B=>B.id===c.id),C=g[(w<0?0:w+r+g.length)%g.length];d(C)},D=r=>{const g=c?.id===r.id,w=g&&k.song?`${U(k.song)} — ${k.song.title}`:null,C=[r.codec,r.bitrate?`${r.bitrate}k`:"",r.tags].filter(Boolean).join(" · ");return e("button",{className:`${i.stationRow} ${g?i.stationRowActive:""}`,onClick:()=>E(r),children:[r.favicon?e("img",{src:r.favicon,alt:"",className:i.stationThumb,loading:"lazy",decoding:"async",onError:B=>{B.target.style.display="none"}}):e("span",{className:i.stationThumbPlaceholder,children:e(o,{name:"broadcast-tower"})}),e("span",{className:i.stationMeta,children:[e("span",{className:i.stationName,children:r.name}),C&&e("span",{className:i.stationSub,children:C})]}),w&&e("span",{className:i.stationNowPlaying,children:w})]},r.id)};return e("div",{className:`${L.page} ${c?L.pageWithPlayer:""}`,children:[e("div",{className:L.header,children:[e("h1",{className:L.pageTitle,children:[e(o,{name:"broadcast-tower"})," Radio"]}),e("form",{className:L.searchForm,onSubmit:r=>{r.preventDefault(),l(n)},children:[e("input",{className:L.searchInput,value:n,onChange:r=>s(r.target.value),placeholder:"Search stations (anime, j-pop, k-pop…)","aria-label":"Search radio stations"}),e("button",{className:L.searchBtn,type:"submit","aria-label":"Search",children:e(o,{name:"search"})})]})]}),p?e(R,{children:[e("h2",{className:i.sectionTitle,children:["Results for “",p,"”"]}),V?e("p",{className:a.statusMsg,children:"Searching…"}):I.length===0?e("p",{className:a.statusMsg,children:"No stations found."}):e("div",{className:i.stationList,children:I.map(D)})]}):e(R,{children:[e("h2",{className:i.sectionTitle,children:"Featured"}),m?e("p",{className:a.statusMsg,children:"Loading…"}):e("div",{className:i.stationList,children:S.map(D)})]}),c&&e(me,{station:c,nowPlaying:k,connected:A,expanded:u,onStationStep:b,onExpandedChange:f,onClose:()=>d(null)})]})};export{Ne as default};
1
+ import{d as h,A as F,h as y,g as se,u as e,S as R,$ as J,T as K}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{b as Z}from"./vendor-query-BBT5_sHx.js";import{h as x,t as G,O as re}from"./index-VzVAYX5A.js";import{a}from"./Asmr.module-CdWlioTY.js";import{r as i}from"./Radio.module-DGSZLpKM.js";import{p as L}from"./page.module-C1MlZzf3.js";const ee=300*1e3,le="https://cdn.listen.moe/covers/";function z(n){return n?n.startsWith("http")?n:`${le}${n}`:null}function oe(n){return n?z(n.albums[0]?.image)||z(n.artists[0]?.image)||z(n.sources[0]?.image):null}function U(n){return n?n.artists.map(s=>s.nameRomaji||s.name).join(", "):""}const ie=()=>{const n=x();return Z({...n.radio.stations.queryOptions(),staleTime:ee})},ce=n=>{const s=x();return Z({...s.radio.search.queryOptions({q:n}),enabled:n.trim().length>0,staleTime:ee})},X={song:null,lastPlayed:[],listeners:0,startTime:null},de=n=>{const[s,p]=h(X),[l,c]=h(!1),d=F(null);return y(()=>{if(p(X),c(!1),!n)return;let u=null,f=!1;try{u=new WebSocket(n)}catch{return}return u.onopen=()=>{f||c(!0)},u.onmessage=v=>{try{const m=JSON.parse(v.data);if(m.op===0){const N=m.d?.heartbeat||35e3;d.current&&window.clearInterval(d.current),d.current=window.setInterval(()=>{u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({op:9}))},N)}else m.op===1&&p({song:m.d?.song||null,lastPlayed:m.d?.lastPlayed||[],listeners:m.d?.listeners||0,startTime:m.d?.startTime||null})}catch{}},u.onclose=()=>{f||c(!1)},()=>{f=!0,d.current&&window.clearInterval(d.current),d.current=null,u&&u.close()}},[n]),{nowPlaying:s,connected:l}};function Y(n){if(!n)return"";const s=Math.max(0,Math.floor((Date.now()-new Date(n).getTime())/1e3)),p=Math.floor(s/60),l=s%60;return`${p}:${String(l).padStart(2,"0")}`}const me=({station:n,nowPlaying:s,connected:p,expanded:l,onStationStep:c,onExpandedChange:d,onClose:u})=>{const f=F(null),[v,m]=h(!1),[N,V]=h(!0),[S,I]=h(!1),[T,k]=h(!0),[A,E]=h(""),[b,D]=h(()=>{const t=parseFloat(localStorage.getItem("radioVolume")||"");return Number.isFinite(t)?t:1}),r=F(""),g=F(b);g.current=b,r.current||(r.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`radio-${Date.now()}-${Math.random().toString(36).slice(2)}`);const w=s.song,C=oe(w)||n.favicon||null,[B,W]=h(!1);y(()=>{W(!1)},[C]);const M=B?null:C,q=!!M,P=w?`${U(w)} — ${w.title}`:n.name;y(()=>{const t=f.current;if(t)return m(!1),t.src=n.streamUrl,t.load(),t.volume=g.current,t.play().catch(()=>m(!1)),()=>{t.removeAttribute("src")}},[n.id,n.streamUrl]),y(()=>{const t=f.current;t&&(t.volume=b)},[b]),y(()=>{if(l)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[l]),y(()=>{l&&k(!0)},[l]);const te=t=>t?Math.max(0,Math.floor((Date.now()-new Date(t).getTime())/1e3)):0,O=se.useCallback(t=>{n&&(G.discord.radioPresence.mutate({title:P,stationLabel:n.name,isPlaying:t,thumbnail:M||"",currentTime:te(s.startTime),sessionId:r.current}).catch(()=>{}),G.discord.heartbeat.mutate({sessionId:r.current}).catch(()=>{}))},[n,P,M,s.startTime]);y(()=>{O(v)},[O,v,n.id,P,l]),y(()=>{if(!v)return;const t=window.setInterval(()=>O(!0),15e3);return()=>window.clearInterval(t)},[v,O]),y(()=>{const t=r.current,$=()=>re(t),H=()=>$(),_=()=>{document.visibilityState==="hidden"&&$()};return window.addEventListener("pagehide",H),window.addEventListener("beforeunload",H),document.addEventListener("visibilitychange",_),()=>{window.removeEventListener("pagehide",H),window.removeEventListener("beforeunload",H),document.removeEventListener("visibilitychange",_),$()}},[]),y(()=>{if(!s.startTime){E("");return}E(Y(s.startTime));const t=window.setInterval(()=>E(Y(s.startTime)),1e3);return()=>window.clearInterval(t)},[s.startTime,s.song?.id]),y(()=>{if(!l)return;const t=$=>{$.key==="Escape"&&(S?I(!1):d(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[l,S,d]);const ae=()=>{const t=f.current;t&&(t.paused?(t.load(),t.play().catch(()=>{})):t.pause())},ne=e(R,{children:[e("div",{className:a.playerButtons,children:[e("button",{className:a.playerBtn,onClick:()=>c(-1),"aria-label":"Previous station",children:e(o,{name:"step-backward"})}),e("button",{className:`${a.playerBtn} ${a.playBtn}`,onClick:ae,"aria-label":v?"Pause":"Play",children:v?e(o,{name:"pause"}):e(o,{name:"play"})}),e("button",{className:a.playerBtn,onClick:()=>c(1),"aria-label":"Next station",children:e(o,{name:"step-forward"})})]}),e("div",{className:a.seekRow,children:[e("span",{className:i.liveBadge,children:[e(o,{name:"broadcast-tower",size:10})," LIVE"]}),A&&e("span",{className:a.timeLabel,children:A}),p&&s.listeners>0&&e("span",{className:a.timeLabel,children:[s.listeners," listening"]}),!p&&n.source==="listen.moe"&&e("span",{className:a.timeLabel,children:"connecting…"})]})]}),j=e(R,{children:[e("button",{className:`${a.playerBtn} ${a.playerToggle}`,onClick:()=>d(!l),"aria-label":l?"Minimize player":"Expand player",title:l?"Minimize to browse":"Expand",children:l?e(o,{name:"chevron-down"}):e(o,{name:"chevron-up"})}),e("div",{className:a.playerInfo,children:[e("p",{className:a.playerTitle,title:P,children:P}),e("p",{className:a.playerTrack,children:n.name})]}),e("div",{className:a.playerControls,children:ne}),e("div",{className:a.playerRight,children:[b===0?e(o,{name:"volume-mute",className:a.volumeIcon}):b<.5?e(o,{name:"volume-down",className:a.volumeIcon}):e(o,{name:"volume-up",className:a.volumeIcon}),e("input",{className:a.volumeBar,type:"range",min:0,max:1,step:.01,value:b,onChange:t=>{const $=parseFloat(t.target.value);D($),localStorage.setItem("radioVolume",String($))},style:{"--volume-percent":`${b*100}%`},"aria-label":"Volume"})]}),e("div",{className:a.playerActions,children:[l&&q&&e("button",{className:a.playerBtn,onClick:()=>V(t=>!t),"aria-label":N?"Hide art":"Show art",title:N?"Hide art":"Show art",children:N?e(o,{name:"eye-slash"}):e(o,{name:"image"})}),l&&s.lastPlayed.length>0&&e("button",{className:`${a.playerBtn} ${S?a.playerBtnActive:""}`,onClick:()=>I(t=>!t),"aria-label":S?"Hide history":"Show history",title:"Recently played",children:e(o,{name:"list-ol"})}),e("button",{className:a.playerBtn,onClick:u,"aria-label":"Close player",children:e(o,{name:"times"})})]})]}),Q=e("audio",{ref:f,preload:"none",onPlay:()=>m(!0),onPause:()=>m(!1)});return l?J(e(R,{children:[Q,e("div",{className:`${a.npOverlay} ${T?"":a.npOverlayControlsHidden}`,children:[e("div",{className:`${a.npStage} ${!N||!q?a.npStageBlank:""}`,onClick:()=>k(t=>!t),children:N&&q&&M&&e("div",{className:i.coverWrap,children:e("img",{src:M,alt:P,loading:"lazy",decoding:"async",draggable:!1,className:i.cover,onError:()=>W(!0)})})}),e("div",{className:`${a.playerBar} ${a.playerBarDocked} ${T?"":a.playerBarDockedHidden}`,onClick:t=>t.stopPropagation(),children:[j,S&&e(R,{children:[e("div",{className:a.npBackdrop,onClick:()=>I(!1)}),e("div",{className:a.chapterPanel,children:s.lastPlayed.map(t=>e("div",{className:a.chapterRow,children:e("span",{className:a.chapterRowLabel,title:`${U(t)} — ${t.title}`,children:[U(t)," — ",t.title]})},t.id))})]})]})]})]}),document.body):J(e(R,{children:[Q,e("div",{className:a.playerBar,children:j})]}),document.body)},Ne=()=>{y(()=>{document.title="Radio - dango"},[]);const[n,s]=h(""),[p,l]=h(""),[c,d]=h(null),[u,f]=h(!0),{data:v,isLoading:m}=ie(),{data:N,isLoading:V}=ce(p),S=K(()=>v?.stations||[],[v]),I=K(()=>N?.stations||[],[N]),T=p?I:S,{nowPlaying:k,connected:A}=de(c?.gateway),E=r=>{d(r),f(!0)},b=r=>{const g=T.length>0?T:S;if(g.length===0||!c)return;const w=g.findIndex(B=>B.id===c.id),C=g[(w<0?0:w+r+g.length)%g.length];d(C)},D=r=>{const g=c?.id===r.id,w=g&&k.song?`${U(k.song)} — ${k.song.title}`:null,C=[r.codec,r.bitrate?`${r.bitrate}k`:"",r.tags].filter(Boolean).join(" · ");return e("button",{className:`${i.stationRow} ${g?i.stationRowActive:""}`,onClick:()=>E(r),children:[r.favicon?e("img",{src:r.favicon,alt:"",className:i.stationThumb,loading:"lazy",decoding:"async",onError:B=>{B.target.style.display="none"}}):e("span",{className:i.stationThumbPlaceholder,children:e(o,{name:"broadcast-tower"})}),e("span",{className:i.stationMeta,children:[e("span",{className:i.stationName,children:r.name}),C&&e("span",{className:i.stationSub,children:C})]}),w&&e("span",{className:i.stationNowPlaying,children:w})]},r.id)};return e("div",{className:`${L.page} ${c?L.pageWithPlayer:""}`,children:[e("div",{className:L.header,children:[e("h1",{className:L.pageTitle,children:[e(o,{name:"broadcast-tower"})," Radio"]}),e("form",{className:L.searchForm,onSubmit:r=>{r.preventDefault(),l(n)},children:[e("input",{className:L.searchInput,value:n,onChange:r=>s(r.target.value),placeholder:"Search stations (anime, j-pop, k-pop…)","aria-label":"Search radio stations"}),e("button",{className:L.searchBtn,type:"submit","aria-label":"Search",children:e(o,{name:"search"})})]})]}),p?e(R,{children:[e("h2",{className:i.sectionTitle,children:["Results for “",p,"”"]}),V?e("p",{className:a.statusMsg,children:"Searching…"}):I.length===0?e("p",{className:a.statusMsg,children:"No stations found."}):e("div",{className:i.stationList,children:I.map(D)})]}):e(R,{children:[e("h2",{className:i.sectionTitle,children:"Featured"}),m?e("p",{className:a.statusMsg,children:"Loading…"}):e("div",{className:i.stationList,children:S.map(D)})]}),c&&e(me,{station:c,nowPlaying:k,connected:A,expanded:u,onStationStep:b,onExpandedChange:f,onClose:()=>d(null)})]})};export{Ne as default};
@@ -1 +1 @@
1
- import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-DedwE5DX.js";import{L as F}from"./LibraryListPage-Z0w_rmHP.js";import{u as _,M as z}from"./useMangaPopup-wfCJubPD.js";import{M as D}from"./MangaResetProgressModal-BCFPXDF6.js";import{x as G,d as O,o as Q,p as Y,u as q,y as H,z as K,A as V,M as h,m as Z,i as j,b as J,c as W}from"./useMangaLibrary-C6XEMuSr.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-icons-DrybRNxP.js";import"./index-B4AdKbhW.js";import"./vendor-query-BBT5_sHx.js";import"./SkeletonGrid-B5JXhZO4.js";import"./ErrorMessage-DAxegITP.js";import"./Watchlist.module-XGtVQr1d.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-B7UuuL3X.js";const X=["All","Continue Reading",...h],R=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function ba(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=G(r?"All":e,g,R),s=O(100),I=Q(),T=Y(),{toggle:L,bookmarkedIds:C}=q(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:M}=_(),f=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),A=r?s.data?.total??0:n.data?.total??0,$=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...h],entries:S,total:A,isLoading:$,error:N,page:g,pageSize:R,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>f.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate(a):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:J(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:j(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(z,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:M}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{ba as default};
1
+ import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-tBWyjKaV.js";import{L as F}from"./LibraryListPage-4BBrV2Ne.js";import{u as _,M as z}from"./useMangaPopup-Dcfgv2CZ.js";import{M as D}from"./MangaResetProgressModal-CnP9RIzg.js";import{x as G,d as O,o as Q,p as Y,u as q,y as H,z as K,A as V,M as h,m as Z,i as j,b as J,c as W}from"./useMangaLibrary-RpiA2f_k.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-icons-DrybRNxP.js";import"./index-VzVAYX5A.js";import"./vendor-query-BBT5_sHx.js";import"./SkeletonGrid-DJKwfPjg.js";import"./ErrorMessage-DAxegITP.js";import"./Watchlist.module-XGtVQr1d.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-CZieLUpX.js";const X=["All","Continue Reading",...h],R=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function ba(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=G(r?"All":e,g,R),s=O(100),I=Q(),T=Y(),{toggle:L,bookmarkedIds:C}=q(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:M}=_(),f=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),A=r?s.data?.total??0:n.data?.total??0,$=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...h],entries:S,total:A,isLoading:$,error:N,page:g,pageSize:R,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>f.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate(a):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:J(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:j(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(z,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:M}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{ba as default};
@@ -1 +1 @@
1
- import{u as e}from"./vendor-core-DfaOB3Rn.js";import{M as r,B as n}from"./index-B4AdKbhW.js";const p=({isOpen:t,itemName:c,progressKind:i,listLabel:s,alsoRemove:a,onAlsoRemoveChange:d,onClose:o,onConfirm:l})=>e(r,{isOpen:t,onClose:o,title:"Reset Progress",children:[e(r.Body,{children:[e("p",{children:["Are you sure you want to remove your ",i,' progress for "',c,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:a,onChange:h=>d(h.target.checked)}),"Also remove from ",s]})]}),e(r.Actions,{children:[e(n,{variant:"secondary",onClick:o,children:"No"}),e(n,{variant:"danger",onClick:l,children:"Yes"})]})]});export{p as R};
1
+ import{u as e}from"./vendor-core-DfaOB3Rn.js";import{M as r,B as n}from"./index-VzVAYX5A.js";const p=({isOpen:t,itemName:c,progressKind:i,listLabel:s,alsoRemove:a,onAlsoRemoveChange:d,onClose:o,onConfirm:l})=>e(r,{isOpen:t,onClose:o,title:"Reset Progress",children:[e(r.Body,{children:[e("p",{children:["Are you sure you want to remove your ",i,' progress for "',c,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:a,onChange:h=>d(h.target.checked)}),"Also remove from ",s]})]}),e(r.Actions,{children:[e(n,{variant:"secondary",onClick:o,children:"No"}),e(n,{variant:"danger",onClick:l,children:"Yes"})]})]});export{p as R};
@@ -1 +1 @@
1
- import{h as R,p as me,a as ge,d as o,A as ve,g as fe,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as L}from"./vendor-icons-DrybRNxP.js";import{P as ee,S as Le}from"./SkeletonGrid-B5JXhZO4.js";import{A as Ae}from"./AnimeCard-DbrG4Bo-.js";import{t as be,u as ye,v as Se,L as ae,B as w,N as Ne}from"./index-B4AdKbhW.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-CSnwUBuU.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-CIKT4YcD.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-DedwE5DX.js";import"./useIsMobile-Dvx1uJ82.js";const Te=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Ee=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ie=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],De=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Pe=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function Ve(){R(()=>{document.title="Search - dango"},[]);const[r,te]=me(),le=ge(),[h,k]=o(r.get("query")||""),[p,_]=o(parseInt(r.get("page")||"1")),[u,A]=o(r.get("type")||"ALL"),[m,b]=o(r.get("season")||"ALL"),[g,y]=o(r.get("year")||"ALL"),[B,E]=o(r.get("country")||"ALL"),[G,ne]=o(r.get("provider")||"anilist"),[Y,I]=o(r.get("sortBy")||"POPULARITY_DESC"),[U,D]=o(r.get("status")||""),[S,re]=o(!1),[se,F]=o(null);R(()=>{let e=!1;return be.data.anilistStatus.query().then(n=>{e||F(n.available)}).catch(()=>{e||F(!0)}),()=>{e=!0}},[]);const{lowEndMode:ie}=ye(),P=ve(null),{data:oe}=Se(),M=oe?.genres||[],[v,N]=o(()=>{const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),e}),$=new URLSearchParams(r);$.delete("page");const V=$.toString(),{data:f=[],isLoading:C,isError:ce,error:ue}=ae(V,p,14),{data:j}=ae(V,p+1,14),[x,de]=o(!1),T=fe.useMemo(()=>G==="anilist"&&u==="ADULT"||x?f:f.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[f,x,G,u]);R(()=>{k(r.get("query")||""),A(r.get("type")||"ALL"),b(r.get("season")||"ALL"),y(r.get("year")||"ALL"),E(r.get("country")||"ALL"),ne(r.get("provider")||"anilist"),I(r.get("sortBy")||"POPULARITY_DESC"),D(r.get("status")||""),_(parseInt(r.get("page")||"1"));const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const c=(e=1,n={})=>{Ne();const s=n.type??u,l=n.status??U,q=n.season??m,H=n.year??g,J=n.country??B,K=n.sort??Y,Q=n.genreState??v,pe=n.showMature??x,i=new URLSearchParams;h.trim()&&i.set("query",h.trim()),s!=="ALL"&&i.set("type",s),l&&i.set("status",l),q!=="ALL"&&i.set("season",q),H!=="ALL"&&i.set("year",H),J!=="ALL"&&i.set("country",J),K!=="POPULARITY_DESC"&&i.set("sortBy",K);const X=Object.entries(Q).filter(([,d])=>d==="include").map(([d])=>d),Z=Object.entries(Q).filter(([,d])=>d==="exclude").map(([d])=>d);X.length>0&&i.set("genres",X.join(",")),Z.length>0&&i.set("excludeGenres",Z.join(",")),s!=="ADULT"&&!pe&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),te(i),e!==p&&_(e)},W=e=>{if(c(e),P.current){const n=P.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},O=new Date().getFullYear(),he=[{value:"ALL",label:"All Years"},...Array.from({length:O-1980+1},(e,n)=>({value:String(O-n),label:String(O-n)}))],z=f.length>=14&&j&&j.length>0;return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(L,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:h,onInput:e=>k(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&c()})]}),a("div",{className:t.searchActions,children:[a(w,{onClick:()=>c(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${S?t.active:""}`,onClick:()=>re(!S),children:[a(L,{name:"filter",size:14}),a("span",{children:"Filters"}),S?a(L,{name:"chevron-up",size:12}):a(L,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${S?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:u,onChange:e=>{if(e.currentTarget.value==="ADULT"){le("/mature?provider=mal");return}A(e.currentTarget.value)},children:Te.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:U,onChange:e=>D(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:m,onChange:e=>b(e.currentTarget.value),children:Ee.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:g,onChange:e=>y(e.currentTarget.value),children:he.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",se===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only — ignored by fallback providers"})]}),a("select",{value:B,onChange:e=>E(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:Y,onChange:e=>I(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:M.map(e=>a("button",{className:`${t.genreButton} ${t[v[e]||""]}`,onClick:()=>{N(n=>{const s=n[e],l={...n};return s==="include"?l[e]="exclude":s==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(w,{variant:"secondary",onClick:()=>{N({}),A("ALL"),b("ALL"),y("ALL"),E("ALL"),I("POPULARITY_DESC"),D(""),de(!1),c(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(w,{onClick:()=>c(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ce&&a(Ce,{message:ue?.message||"Error"}),(u!=="ALL"||m!=="ALL"||g!=="ALL"||Object.keys(v).length>0)&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),u!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",u,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),A("ALL"),c(1,{type:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),m!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",m,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),b("ALL"),c(1,{season:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),g!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",g,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),y("ALL"),c(1,{year:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(v).map(([e,n])=>a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,a("button",{onClick:s=>{s.stopPropagation(),s.preventDefault();const l={...v};delete l[e],N(l),c(1,{genreState:l})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),a("div",{className:t.resultsHeader,ref:P,children:[a("h2",{className:t.resultsTitle,children:h?`Search Results for "${h}"`:"Discover Anime"}),T.length>0&&a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C})]}),a("div",{className:`${t.resultsGrid} ${ie?t.lowEnd:""}`,children:C?a(Le,{}):T.map(e=>a(Ae,{anime:e},e._id))}),!C&&T.length===0&&a("div",{className:t.noResults,children:[a(L,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C,variant:"labeled"})})]})}export{Ve as default};
1
+ import{h as R,p as me,a as ge,d as o,A as ve,g as fe,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as L}from"./vendor-icons-DrybRNxP.js";import{P as ee,S as Le}from"./SkeletonGrid-DJKwfPjg.js";import{A as Ae}from"./AnimeCard-KCdQSFYo.js";import{t as be,u as ye,v as Se,L as ae,B as w,N as Ne}from"./index-VzVAYX5A.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-BpD2dXLB.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-BN-6sbNV.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-tBWyjKaV.js";import"./useIsMobile-Dvx1uJ82.js";const Te=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Ee=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ie=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],De=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Pe=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function Ve(){R(()=>{document.title="Search - dango"},[]);const[r,te]=me(),le=ge(),[h,k]=o(r.get("query")||""),[p,_]=o(parseInt(r.get("page")||"1")),[u,A]=o(r.get("type")||"ALL"),[m,b]=o(r.get("season")||"ALL"),[g,y]=o(r.get("year")||"ALL"),[B,E]=o(r.get("country")||"ALL"),[G,ne]=o(r.get("provider")||"anilist"),[Y,I]=o(r.get("sortBy")||"POPULARITY_DESC"),[U,D]=o(r.get("status")||""),[S,re]=o(!1),[se,F]=o(null);R(()=>{let e=!1;return be.data.anilistStatus.query().then(n=>{e||F(n.available)}).catch(()=>{e||F(!0)}),()=>{e=!0}},[]);const{lowEndMode:ie}=ye(),P=ve(null),{data:oe}=Se(),M=oe?.genres||[],[v,N]=o(()=>{const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),e}),$=new URLSearchParams(r);$.delete("page");const V=$.toString(),{data:f=[],isLoading:C,isError:ce,error:ue}=ae(V,p,14),{data:j}=ae(V,p+1,14),[x,de]=o(!1),T=fe.useMemo(()=>G==="anilist"&&u==="ADULT"||x?f:f.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[f,x,G,u]);R(()=>{k(r.get("query")||""),A(r.get("type")||"ALL"),b(r.get("season")||"ALL"),y(r.get("year")||"ALL"),E(r.get("country")||"ALL"),ne(r.get("provider")||"anilist"),I(r.get("sortBy")||"POPULARITY_DESC"),D(r.get("status")||""),_(parseInt(r.get("page")||"1"));const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const c=(e=1,n={})=>{Ne();const s=n.type??u,l=n.status??U,q=n.season??m,H=n.year??g,J=n.country??B,K=n.sort??Y,Q=n.genreState??v,pe=n.showMature??x,i=new URLSearchParams;h.trim()&&i.set("query",h.trim()),s!=="ALL"&&i.set("type",s),l&&i.set("status",l),q!=="ALL"&&i.set("season",q),H!=="ALL"&&i.set("year",H),J!=="ALL"&&i.set("country",J),K!=="POPULARITY_DESC"&&i.set("sortBy",K);const X=Object.entries(Q).filter(([,d])=>d==="include").map(([d])=>d),Z=Object.entries(Q).filter(([,d])=>d==="exclude").map(([d])=>d);X.length>0&&i.set("genres",X.join(",")),Z.length>0&&i.set("excludeGenres",Z.join(",")),s!=="ADULT"&&!pe&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),te(i),e!==p&&_(e)},W=e=>{if(c(e),P.current){const n=P.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},O=new Date().getFullYear(),he=[{value:"ALL",label:"All Years"},...Array.from({length:O-1980+1},(e,n)=>({value:String(O-n),label:String(O-n)}))],z=f.length>=14&&j&&j.length>0;return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(L,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:h,onInput:e=>k(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&c()})]}),a("div",{className:t.searchActions,children:[a(w,{onClick:()=>c(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${S?t.active:""}`,onClick:()=>re(!S),children:[a(L,{name:"filter",size:14}),a("span",{children:"Filters"}),S?a(L,{name:"chevron-up",size:12}):a(L,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${S?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:u,onChange:e=>{if(e.currentTarget.value==="ADULT"){le("/mature?provider=mal");return}A(e.currentTarget.value)},children:Te.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:U,onChange:e=>D(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:m,onChange:e=>b(e.currentTarget.value),children:Ee.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:g,onChange:e=>y(e.currentTarget.value),children:he.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",se===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only — ignored by fallback providers"})]}),a("select",{value:B,onChange:e=>E(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:Y,onChange:e=>I(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:M.map(e=>a("button",{className:`${t.genreButton} ${t[v[e]||""]}`,onClick:()=>{N(n=>{const s=n[e],l={...n};return s==="include"?l[e]="exclude":s==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(w,{variant:"secondary",onClick:()=>{N({}),A("ALL"),b("ALL"),y("ALL"),E("ALL"),I("POPULARITY_DESC"),D(""),de(!1),c(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(w,{onClick:()=>c(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ce&&a(Ce,{message:ue?.message||"Error"}),(u!=="ALL"||m!=="ALL"||g!=="ALL"||Object.keys(v).length>0)&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),u!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",u,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),A("ALL"),c(1,{type:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),m!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",m,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),b("ALL"),c(1,{season:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),g!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",g,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),y("ALL"),c(1,{year:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(v).map(([e,n])=>a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,a("button",{onClick:s=>{s.stopPropagation(),s.preventDefault();const l={...v};delete l[e],N(l),c(1,{genreState:l})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),a("div",{className:t.resultsHeader,ref:P,children:[a("h2",{className:t.resultsTitle,children:h?`Search Results for "${h}"`:"Discover Anime"}),T.length>0&&a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C})]}),a("div",{className:`${t.resultsGrid} ${ie?t.lowEnd:""}`,children:C?a(Le,{}):T.map(e=>a(Ae,{anime:e},e._id))}),!C&&T.length===0&&a("div",{className:t.noResults,children:[a(L,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C,variant:"labeled"})})]})}export{Ve as default};
@@ -1,4 +1,4 @@
1
- import{d as s,A as H,h as A,u as e,q as ie,S as ke,T as Ce,p as Se,g as ce,_ as _e}from"./vendor-core-DfaOB3Rn.js";import{d as Ne,t as C,B as T,M as $,j as he,h as Te,z as de,F as te,G as Ie,T as Re,u as xe,e as Le,H as Pe,y as ae,A as De,V as Ae,I as Oe}from"./index-B4AdKbhW.js";import{u as oe}from"./vendor-query-BBT5_sHx.js";import{T as q}from"./ToggleSwitch-CN_ppEc9.js";import{I as Y}from"./vendor-icons-DrybRNxP.js";const ne={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},se=["name","nativeName","englishName"],re={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},Ge=()=>{const{titlePreference:t,setTitlePreference:r,loading:o}=Ne(),[d,l]=s(re[t]),[v,w]=s(!1),c=H(null);A(()=>{o||l(re[t])},[t,o]);const a=async()=>{if(v)return;w(!0);const u=(se.indexOf(t)+1)%se.length,p=se[u],h=re[p];c.current&&(c.current.style.transform="translateX(-100%)",c.current.style.opacity="0"),setTimeout(async()=>{l(h),r(p),c.current&&(c.current.style.transition="none",c.current.style.transform="translateX(100%)",c.current.style.opacity="0",c.current.offsetWidth,c.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",c.current.style.transform="translateX(0)",c.current.style.opacity="1");try{await C.settings.set.mutate({key:"titlePreference",value:p})}catch(_){console.error("Error saving title preference:",_)}finally{w(!1)}},300)};return o?e("p",{children:"Loading title preference..."}):e("div",{className:ne["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:ne["toggle-button"],disabled:v,children:e("span",{ref:c,className:ne["toggle-label"],children:d})})]})},Me="_settingsHeader_14a5d_1",Ue="_pageTitle_14a5d_6",Ee="_pageSubtitle_14a5d_14",ze="_settingsLayout_14a5d_20",$e="_sidebar_14a5d_27",Fe="_sidebarIndicator_14a5d_35",qe="_sidebarItem_14a5d_50",Ke="_active_14a5d_72",je="_mainContent_14a5d_80",He="_tabContent_14a5d_85",We="_sectionCard_14a5d_103",Be="_settingItem_14a5d_127",Ve="_settingRow_14a5d_132",Qe="_controls_14a5d_145",Ye="_status_14a5d_151",m={settingsHeader:Me,pageTitle:Ue,pageSubtitle:Ee,settingsLayout:ze,sidebar:$e,sidebarIndicator:Fe,sidebarItem:qe,active:Ke,mainContent:je,tabContent:He,sectionCard:We,settingItem:Be,settingRow:Ve,controls:Qe,status:Ye},Je="_sectionCard_wt900_12",Xe="_title_wt900_22",Ze="_signIn_wt900_29",et="_userInfo_wt900_36",tt="_warning_wt900_58",at="_formGroup_wt900_65",nt="_label_wt900_69",st="_inputWrapper_wt900_79",rt="_input_wt900_79",it="_select_wt900_103",ot="_actions_wt900_140",lt="_hr_wt900_148",g={sectionCard:Je,title:Xe,signIn:Ze,userInfo:et,warning:tt,formGroup:at,label:nt,inputWrapper:st,input:rt,select:it,actions:ot,hr:lt},ct=()=>{const[t,r]=s(!0),[o,d]=s(!1),[l,v]=s(!1),[w,c]=s(null),[a,i]=s({status:"idle"}),[u,p]=s(!1),[h,_]=s(""),[y,k]=s(!1),R=H(null),[x,L]=s({show:!1,message:"",type:"info"}),P=()=>{R.current&&(window.clearInterval(R.current),R.current=null)},b=ie(f=>{v(f.authenticated),c(f.user||f.device.user||null),i(f.device),p(!!f.hasCustomClientId)},[]),S=ie(async()=>{const f=await C.auth.githubStatus.query();b(f)},[b]),O=async()=>{try{const f=await C.auth.githubPoll.query();i(f),f.status==="success"?(P(),await S(),L({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):f.status==="error"&&(P(),L({show:!0,message:f.error||"GitHub authentication failed.",type:"error"}))}catch{P(),L({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},U=(f=5)=>{P(),R.current=window.setInterval(O,Math.max(f,5)*1e3)};A(()=>(S().catch(()=>{L({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>r(!1)),P),[S]);const N=async()=>{d(!0);try{const f=await C.auth.githubStart.mutate();i(f),U(f.verification?.interval)}catch(f){L({show:!0,message:f instanceof Error?f.message:"Failed to start GitHub authentication.",type:"error"})}finally{d(!1)}},G=async()=>{try{await C.auth.githubLogout.mutate(),v(!1),c(null),i({status:"idle"}),L({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{L({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},E=async()=>{k(!0);try{await C.auth.saveGithubAuth.mutate({clientId:h}),_(""),await S(),L({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{L({show:!0,message:"Failed to save override.",type:"error"})}finally{k(!1)}},K=async()=>{k(!0);try{await C.auth.saveGithubAuth.mutate({clientId:""}),_(""),await S(),L({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{L({show:!0,message:"Failed to clear override.",type:"error"})}finally{k(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:g.sectionCard,children:[e("h3",{className:g.title,children:"GitHub Cloud Sync"}),e("p",{className:g.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),l&&w?e("div",{className:g.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:w.name||w.login})]}),e(T,{variant:"danger",onClick:G,children:"Sign Out"})]}):e("div",{className:g.signIn,children:e(T,{onClick:N,disabled:o||a.status==="pending",children:o||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.verification&&e(ke,{children:[e("hr",{className:g.hr}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Verification URL"}),e("div",{className:g.inputWrapper,children:[e("input",{className:g.input,value:a.verification.verification_uri,readOnly:!0}),e(T,{onClick:()=>{const f=a.verification?.verification_uri;f&&/^https?:\/\//i.test(f)&&window.open(f,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Device Code"}),e("input",{className:g.input,value:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:g.warning,children:a.error}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",u?"(override active)":""]}),e("div",{className:g.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:g.label,children:"Client ID (optional)"}),e("input",{className:g.input,value:h,onChange:f=>_(f.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:g.actions,children:[e(T,{onClick:E,disabled:y,children:"Save override"}),e(T,{variant:"secondary",onClick:K,disabled:y,children:"Use dango defaults"})]})]}),e($,{isOpen:x.show,onClose:()=>L(f=>({...f,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:x.message})}),e($.Actions,{children:e(T,{onClick:()=>L(f=>({...f,show:!1})),children:"OK"})})]})]})},dt=()=>{const[t,r]=s(!0),[o,d]=s(null),[l,v]=s(!1),[w,c]=s(!1),[a,i]=s(""),[u,p]=s(""),[h,_]=s(""),[y,k]=s(!1),[R,x]=s({show:!1,message:"",type:"info"}),L=async()=>{try{const N=await C.auth.user.query();d(N?.email?N:null)}catch{d(null)}},P=async()=>{try{const[N,G]=await Promise.all([C.auth.configStatus.query(),C.auth.googleAuth.query()]);v(!!N.hasConfig),c(!!(G.hasCustomWorkerUrl||G.hasCustomClientId||G.hasClientSecret))}catch(N){console.error("Failed to fetch config status",N)}};A(()=>{(async()=>{r(!0),await Promise.all([L(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await L(),window.history.replaceState(null,"",window.location.pathname))}catch{}r(!1)})();const G=E=>{E.origin===window.location.origin&&typeof E.data=="object"&&E.data!==null&&E.data.type==="GOOGLE_AUTH_SUCCESS"&&(d(E.data.user),window.location.reload())};return window.addEventListener("message",G),()=>window.removeEventListener("message",G)},[]);const b=async()=>{try{const N=await C.auth.googleLogin.mutate();if(N.authenticated){window.location.reload();return}if(N.url){if(typeof window.DangoBridge<"u"){window.location.href=N.url;return}const E=600,K=700,f=window.innerWidth/2-E/2,J=window.innerHeight/2-K/2;window.open(N.url,"GoogleAuth",`width=${E},height=${K},top=${J},left=${f}`)}else throw new Error("Auth URL not available")}catch{x({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},S=async()=>{try{await C.auth.logout.mutate(),d(null),x({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(N){console.error("Sign out failed",N),x({show:!0,message:"Failed to sign out.",type:"error"})}},O=async()=>{k(!0);try{await C.auth.saveGoogleAuth.mutate({workerUrl:a,clientId:u,clientSecret:h}),i(""),p(""),_(""),await P(),x({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{x({show:!0,message:"Failed to save override.",type:"error"})}finally{k(!1)}},U=async()=>{k(!0);try{await C.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),i(""),p(""),_(""),await P(),x({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{x({show:!0,message:"Failed to clear override.",type:"error"})}finally{k(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:g.sectionCard,children:[e("h3",{className:g.title,children:"Google Drive Sync"}),o?e("div",{className:g.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:o.name})," (",o.email,")"]}),e(T,{variant:"danger",onClick:S,children:"Sign Out"})]}):e("div",{className:g.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(T,{onClick:b,disabled:!l,children:"Sign in with Google"}),!l&&e("p",{className:g.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",w?"(override active)":""]}),e("div",{className:g.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:g.label,children:"Worker URL (optional)"}),e("input",{className:g.input,value:a,onChange:N=>i(N.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Client ID (optional)"}),e("input",{className:g.input,value:u,onChange:N=>p(N.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:g.input,value:h,onChange:N=>_(N.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:g.actions,children:[e(T,{onClick:O,disabled:y,children:"Save override"}),e(T,{variant:"secondary",onClick:U,disabled:y,children:"Use dango defaults"})]})]}),e($,{isOpen:R.show,onClose:()=>x(N=>({...N,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:R.message})}),e($.Actions,{children:e(T,{onClick:()=>x(N=>({...N,show:!1})),children:"OK"})})]})]})},ut="_sectionCard_1pqo4_1",ht="_settingItem_1pqo4_26",gt="_settingRow_1pqo4_31",mt="_modalOverlay_1pqo4_38",pt="_modal_1pqo4_38",yt="_modalActions_1pqo4_73",ft="_modalSecondary_1pqo4_79",vt="_modalPrimary_1pqo4_89",z={sectionCard:ut,settingItem:ht,settingRow:gt,modalOverlay:mt,modal:pt,modalActions:yt,modalSecondary:ft,modalPrimary:vt},wt={anime:{heading:"Watchlist Preferences",blurb:"Customize your experience when managing your watchlist and series entries.",skipKey:"skipRemoveConfirmation",ignoreKey:"ignoreAdultContent",listOnlyKey:"cwWatchlistOnly",skipLabel:"Skip confirmation when removing from watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in watchlist",listNoun:"watchlist",continueNoun:"continue watching",adultCountUrl:"/api/continue-watching/adult-count",purgeUrl:"/api/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["allContinueWatching"]]},manga:{heading:"Reading List Preferences",blurb:"Customize your experience when managing your reading list and manga entries.",skipKey:"mangaSkipRemoveConfirmation",ignoreKey:"mangaIgnoreAdultContent",listOnlyKey:"mangaCwWatchlistOnly",skipLabel:"Skip confirmation when removing from reading list",ignoreLabel:"Hide adult content from continue reading",listOnlyLabel:"Only show continue reading for manga in reading list",listNoun:"reading list",continueNoun:"continue reading",adultCountUrl:"/api/manga/continue-reading/adult-count",purgeUrl:"/api/manga/continue-reading/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue reading`,invalidateKeys:[["manga-continue-reading"]]},tv:{heading:"TV Watchlist Preferences",blurb:"Customize your experience when managing your TV watchlist and series entries.",skipKey:"tvSkipRemoveConfirmation",ignoreKey:"tvIgnoreAdultContent",listOnlyKey:"tvCwWatchlistOnly",skipLabel:"Skip confirmation when removing from TV watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in TV watchlist",listNoun:"TV watchlist",continueNoun:"continue watching",adultCountUrl:"/api/tv/continue-watching/adult-count",purgeUrl:"/api/tv/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["tv-continue-watching"]]},asmr:{heading:"Listening List Preferences",blurb:"Customize your experience when managing your listening list and work entries.",skipKey:"asmrSkipRemoveConfirmation",ignoreKey:"asmrIgnoreAdultContent",listOnlyKey:"asmrCwWatchlistOnly",skipLabel:"Skip confirmation when removing from listening list",ignoreLabel:"Hide adult content from continue listening",listOnlyLabel:"Only show continue listening for works in listening list",listNoun:"listening list",continueNoun:"continue listening",adultCountUrl:"/api/asmr/continue-listening/adult-count",purgeUrl:"/api/asmr/continue-listening/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue listening`,invalidateKeys:[["asmr-continue-listening"]]}},bt=(t,r)=>{if(t==null)return r;const o=String(t);return o==="true"||o==="1"?!0:o==="false"||o==="0"?!1:r},ue=(t,r,o)=>{const[d,l]=s(r),[v,w]=s(!1),c=oe();return A(()=>{(async()=>{try{const u=await C.settings.getByKey.query({key:t});l(bt(u.value,r))}catch(u){console.error("Failed to fetch setting",u)}})()},[t,r]),{value:d,setValue:l,isUpdating:v,toggle:async()=>{if(v)return;w(!0);const i=!d;l(i);try{await C.settings.set.mutate({key:t,value:i});for(const u of o)c.invalidateQueries({queryKey:u})}catch(u){console.error("Error saving setting:",u),l(!i)}finally{w(!1)}}}},kt=()=>{const{contentType:t}=he(),r=wt[t],[o,d]=s(!1),[l,v]=s(!0),[w,c]=s(!1),a=ue(r.ignoreKey,!0,r.invalidateKeys),i=ue(r.listOnlyKey,!1,r.invalidateKeys),[u,p]=s(null),[h,_]=s(!1),y=oe(),k=Te();A(()=>{v(!0),(async()=>{try{const S=await C.settings.getByKey.query({key:r.skipKey});String(S.value)==="true"||String(S.value)==="1"?d(!0):d(!1)}catch(S){console.error("Failed to fetch setting",S)}finally{v(!1)}})()},[r.skipKey]);const R=async()=>{if(w)return;c(!0);const b=!o;d(b);try{await C.settings.set.mutate({key:r.skipKey,value:b})}catch(S){console.error("Error saving setting:",S),d(!b)}finally{c(!1)}},x=async()=>{if(!a.isUpdating){if(a.value)try{let b;if(t==="anime"?b=(await C.continueWatching.adultCount.query()).count:t==="manga"?b=(await C.mangaProgress.adultCount.query()).count:t==="asmr"?b=(await C.asmrProgress.adultCount.query()).count:b=(await C.tvProgress.adultCount.query()).count,typeof b=="number"&&b>0){p(b);return}}catch(b){console.error("Failed to fetch adult count",b)}a.toggle()}},L=()=>{p(null),a.toggle()},P=async()=>{if(!h){_(!0);try{let b;t==="anime"?b=(await C.continueWatching.purgeAdult.mutate()).removed:t==="manga"?b=(await C.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?b=(await C.asmrProgress.purgeAdult.mutate()).removed:b=(await C.tvProgress.purgeAdult.mutate()).removed,de.success(r.purgeDoneText(b??0));for(const S of r.invalidateKeys)y.invalidateQueries({queryKey:S});t==="anime"&&y.invalidateQueries(k.continueWatching.pathFilter()),t==="manga"&&y.invalidateQueries(k.mangaProgress.pathFilter()),t==="asmr"&&y.invalidateQueries(k.asmrProgress.pathFilter()),t==="tv"&&y.invalidateQueries(k.tvProgress.pathFilter())}catch(b){console.error("Failed to purge adult entries",b),de.error("Failed to remove adult entries")}finally{_(!1),p(null)}a.toggle()}};return l?e("div",{children:"Loading settings..."}):e("div",{className:z.sectionCard,children:[e("h3",{children:r.heading}),e("p",{children:r.blurb}),e("div",{className:z.settingItem,children:e("div",{className:z.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:r.skipLabel}),e(q,{isChecked:o,onChange:R,id:"skip-confirmation-toggle",disabled:w})]})}),e("div",{className:z.settingItem,children:e("div",{className:z.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:r.ignoreLabel}),e(q,{isChecked:a.value,onChange:x,id:"ignore-adult-toggle",disabled:a.isUpdating})]})}),e("div",{className:z.settingItem,children:e("div",{className:z.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:r.listOnlyLabel}),e(q,{isChecked:i.value,onChange:i.toggle,id:"cw-watchlist-only-toggle",disabled:i.isUpdating})]})}),u!==null&&e("div",{className:z.modalOverlay,onClick:()=>p(null),children:e("div",{className:z.modal,onClick:b=>b.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[u," adult ",u===1?"entry":"entries"," not in your"," ",r.listNoun," ",u===1?"is":"are"," currently hidden from"," ",r.continueNoun,". You can purge ",u===1?"it":"them"," from the database instead of showing ",u===1?"it":"them","."]}),e("div",{className:z.modalActions,children:[e("button",{type:"button",className:z.modalSecondary,onClick:L,disabled:h,children:"Show them"}),e("button",{type:"button",className:z.modalPrimary,onClick:P,disabled:h,children:h?"Purging...":`Purge ${u}`})]})]})})]})},Ct="_sectionCard_jkggs_1",St="_statsGrid_jkggs_26",_t="_statCard_jkggs_33",Nt="_statLabel_jkggs_43",Tt="_statValue_jkggs_51",It="_statMeta_jkggs_57",Rt="_statusBanner_jkggs_63",xt="_statusSuccess_jkggs_74",Lt="_statusUpdating_jkggs_80",Pt="_statusError_jkggs_86",Dt="_sha_jkggs_92",At="_settingItem_jkggs_99",Ot="_settingRow_jkggs_104",Gt="_settingTitle_jkggs_111",Mt="_settingSubtitle_jkggs_117",Ut="_actionsRow_jkggs_124",I={sectionCard:Ct,statsGrid:St,statCard:_t,statLabel:Nt,statValue:Tt,statMeta:It,statusBanner:Rt,statusSuccess:xt,statusUpdating:Lt,statusError:Pt,sha:Dt,settingItem:At,settingRow:Ot,settingTitle:Gt,settingSubtitle:Mt,actionsRow:Ut},Et=()=>{const[t,r]=s(null),[o,d]=s(!0),[l,v]=s(!1),[w,c]=s(!1),a=H(null),i=async()=>{try{const y=await C.settings.offlineDbInfo.query();return r(y),y}catch(y){console.error("Failed to fetch offline DB info:",y)}finally{d(!1)}return null};A(()=>(i(),()=>{a.current&&window.clearInterval(a.current)}),[]),A(()=>{t?.isRefreshing?a.current||(a.current=window.setInterval(async()=>{const y=await i();y&&!y.isRefreshing&&a.current&&(window.clearInterval(a.current),a.current=null)},2e3)):a.current&&(window.clearInterval(a.current),a.current=null)},[t?.isRefreshing]);const u=async()=>{if(!t||l)return;const y=!t.autoUpdateEnabled;v(!0),r({...t,autoUpdateEnabled:y});try{await C.settings.setOfflineDbAutoUpdate.mutate({enabled:y})}catch(k){console.error("Failed to update auto update setting:",k),r({...t,autoUpdateEnabled:!y})}finally{v(!1)}},p=async()=>{if(!(t?.isRefreshing||w)){c(!0);try{await C.settings.triggerOfflineDbUpdate.mutate(),r(y=>y?{...y,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(y){console.error("Failed to trigger offline DB update:",y)}finally{c(!1)}}},h=y=>{if(!y)return"Never";try{return new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return y}},_=t?.isRefreshing||w;return e("div",{className:I.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:I.statsGrid,children:[e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"MAL Mapped"}),e("span",{className:I.statValue,children:o?"—":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Release"}),e("span",{className:I.statMeta,children:o?"—":t?.releaseTag??"Never"})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Last Checked"}),e("span",{className:I.statMeta,children:o?"—":h(t?.lastCheckedAt??null)})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Last Updated"}),e("span",{className:I.statMeta,children:o?"—":h(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${I.statusBanner} ${t.lastStatus==="failed"?I.statusError:t.lastStatus==="updating"?I.statusUpdating:I.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:I.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:I.settingItem,children:e("div",{className:I.settingRow,children:[e("div",{children:[e("span",{className:I.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:I.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(q,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:u,disabled:o||l})]})}),e("div",{className:I.actionsRow,children:e(T,{onClick:p,disabled:o||_,children:_?"Updating Database...":"Update Offline Database Now"})})]})},zt="_sectionCard_1g4qx_1",$t="_dangerCard_1g4qx_26",Ft="_status_1g4qx_34",qt="_warningText_1g4qx_40",Kt="_ackLabel_1g4qx_44",Q={sectionCard:zt,dangerCard:$t,status:Ft,warningText:qt,ackLabel:Kt},jt=()=>{const t=oe(),[r,o]=s(!1),[d,l]=s(!1),[v,w]=s(!1),[c,a]=s(""),i=()=>{l(!1),a(""),o(!0)},u=()=>{v||(o(!1),l(!1))},p=async()=>{if(!(!d||v)){w(!0),a("");try{const h=await fetch("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),_=await h.json();if(!h.ok)throw new Error(_.error||"Failed to clear database");const y=_.deleted,k=_.deletedManga,R=_.deletedTv,x=_.deletedAsmr,L=Object.values(y).reduce((O,U)=>O+(U||0),0)+Object.values(k??{}).reduce((O,U)=>O+(U||0),0)+Object.values(R??{}).reduce((O,U)=>O+(U||0),0)+Object.values(x??{}).reduce((O,U)=>O+(U||0),0),P=(k?.manga_library??0)+(k?.manga_progress??0),b=(R?.tv_library??0)+(R?.tv_progress??0),S=(x?.asmr_library??0)+(x?.asmr_progress??0);a(`Library cleared — ${y.watchlist??0} watchlist entries, ${P} manga rows, ${b} TV rows, ${S} ASMR rows and ${L} total rows removed.`),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]}),t.invalidateQueries({queryKey:["manga-library"]}),t.invalidateQueries({queryKey:["manga-continue-reading"]}),t.invalidateQueries({queryKey:["tv-library"]}),t.invalidateQueries({queryKey:["tv-continue-watching"]}),t.invalidateQueries({queryKey:["asmr-library"]}),t.invalidateQueries({queryKey:["asmr-continue-listening"]}),o(!1)}catch(h){a(h.message)}finally{w(!1),l(!1)}}};return e("div",{className:`${Q.sectionCard} ${Q.dangerCard}`,children:[e("h3",{children:"Danger Zone"}),e("p",{children:"Permanently delete your library (watchlist, watched episodes, queue, cached show metadata, manga reading list and reading progress, TV watchlist and watch progress, ASMR listening list and listening progress) to start fresh. Your settings, sync state and the offline metadata cache are preserved."}),e(T,{variant:"danger",onClick:i,children:"Clear Library Data"}),c&&e("p",{className:Q.status,children:c}),e($,{isOpen:r,onClose:u,title:"Clear library data?",width:"sm",children:[e($.Body,{children:[e("p",{className:Q.warningText,children:"This permanently deletes everything in your library. It acts on the active database (dev or prod, per server config) and cannot be undone. Settings, sync state and the offline metadata cache are kept."}),e("label",{className:Q.ackLabel,children:[e("input",{type:"checkbox",checked:d,onChange:h=>l(h.target.checked),disabled:v}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e($.Actions,{children:[e(T,{variant:"secondary",onClick:u,disabled:v,children:"Cancel"}),e(T,{variant:"danger",onClick:p,disabled:!d||v,children:v?"Clearing...":"Yes, delete everything"})]})]})]})},Ht=()=>{const[t,r]=s(""),[o,d]=s([]),[l,v]=s(null),[w,c]=s(!0),[a,i]=s({show:!1,message:"",type:"info"}),u=async()=>{try{c(!0);const _=await(await fetch("/api/auth/settings/rclone")).json();r(_.remote||""),d(_.availableRemotes||[]),v(_.activeRemote||null)}catch(h){console.error("Failed to fetch Rclone settings",h)}finally{c(!1)}};A(()=>{u()},[]);const p=async()=>{try{if((await fetch("/api/auth/settings/rclone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:t})})).ok)i({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),u();else throw new Error("Failed to save")}catch{i({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return w?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:g.sectionCard,children:[e("h3",{className:g.title,children:"Rclone Cloud Sync"}),e("p",{className:g.signIn,children:"Configure which Rclone remote to use for database synchronization."}),l?e("div",{className:g.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:l})]})}):e("p",{className:g.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Remote Name"}),e("div",{className:g.inputWrapper,children:e("select",{className:g.select,value:t,onChange:h=>r(h.target.value),children:[e("option",{value:"",children:"(Disabled / None)"}),o.map(h=>e("option",{value:h,children:h},h)),t&&!o.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:g.warning,style:{marginTop:"12px"},children:[e("strong",{children:"Note:"})," You can choose which provider is active using the selector at the top of the page."]})]}),e("div",{className:g.actions,children:e(T,{onClick:p,children:"Save Rclone Settings"})}),e($,{isOpen:a.show,onClose:()=>i(h=>({...h,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:a.message})}),e($.Actions,{children:e(T,{onClick:()=>i(h=>({...h,show:!1})),children:"OK"})})]})]})},Wt=()=>{const[t,r]=s(null),[o,d]=s(!0),l=async()=>{try{const i=await(await fetch("/api/auth/settings/sync")).json();r(i)}catch(a){console.error("Failed to fetch sync settings",a)}finally{d(!1)}};A(()=>{l()},[]);const v=async a=>{const i=a.target.value;try{const u=await fetch("/api/auth/settings/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i})});if(u.ok){const p=await u.json();r(h=>h?{...h,activeProvider:p.activeProvider}:null),await l(),te.success(`Sync provider updated to ${i==="default"?"Default Order":i}`)}else te.error("Failed to update sync provider")}catch{te.error("Error updating sync provider")}};if(o||!t)return null;const w=[{value:"default",label:"Default (Priority Based)"}];t.authenticatedProviders.github&&w.push({value:"github",label:"GitHub"}),t.authenticatedProviders.google&&w.push({value:"google",label:"Google Drive"}),t.authenticatedProviders.rclone&&w.push({value:"rclone",label:"Rclone"}),w.push({value:"none",label:"None (Local Only)"});const c=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:m.sectionCard,children:[e("h3",{children:"Active Sync Provider"}),e("p",{children:'Choose which provider to use for synchronization. "Default" uses the first available provider you are logged into.'}),e("div",{style:{marginBottom:"1.5rem",padding:"0.75rem",background:"rgba(255, 255, 255, 0.03)",borderRadius:"var(--radius-md)",borderLeft:"4px solid var(--accent)",fontSize:"var(--font-size-sm)"},children:["Current Status:"," ",e("strong",{style:{color:"var(--accent-light)",textTransform:"capitalize"},children:c(t.actualActiveProvider)})]}),e("div",{className:m.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:t.activeProvider,onChange:v,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:w.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function Bt(){return"javascript:"+encodeURIComponent(`(function(){
1
+ import{d as s,A as H,h as A,u as e,q as ie,S as ke,T as Ce,p as Se,g as ce,_ as _e}from"./vendor-core-DfaOB3Rn.js";import{d as Ne,t as C,B as T,M as $,j as he,h as Te,z as de,F as te,G as Ie,T as Re,u as xe,e as Le,H as Pe,y as ae,A as De,V as Ae,I as Oe}from"./index-VzVAYX5A.js";import{u as oe}from"./vendor-query-BBT5_sHx.js";import{T as q}from"./ToggleSwitch-CN_ppEc9.js";import{I as Y}from"./vendor-icons-DrybRNxP.js";const ne={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},se=["name","nativeName","englishName"],re={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},Ge=()=>{const{titlePreference:t,setTitlePreference:r,loading:o}=Ne(),[d,l]=s(re[t]),[v,w]=s(!1),c=H(null);A(()=>{o||l(re[t])},[t,o]);const a=async()=>{if(v)return;w(!0);const u=(se.indexOf(t)+1)%se.length,p=se[u],h=re[p];c.current&&(c.current.style.transform="translateX(-100%)",c.current.style.opacity="0"),setTimeout(async()=>{l(h),r(p),c.current&&(c.current.style.transition="none",c.current.style.transform="translateX(100%)",c.current.style.opacity="0",c.current.offsetWidth,c.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",c.current.style.transform="translateX(0)",c.current.style.opacity="1");try{await C.settings.set.mutate({key:"titlePreference",value:p})}catch(_){console.error("Error saving title preference:",_)}finally{w(!1)}},300)};return o?e("p",{children:"Loading title preference..."}):e("div",{className:ne["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:ne["toggle-button"],disabled:v,children:e("span",{ref:c,className:ne["toggle-label"],children:d})})]})},Me="_settingsHeader_14a5d_1",Ue="_pageTitle_14a5d_6",Ee="_pageSubtitle_14a5d_14",ze="_settingsLayout_14a5d_20",$e="_sidebar_14a5d_27",Fe="_sidebarIndicator_14a5d_35",qe="_sidebarItem_14a5d_50",Ke="_active_14a5d_72",je="_mainContent_14a5d_80",He="_tabContent_14a5d_85",We="_sectionCard_14a5d_103",Be="_settingItem_14a5d_127",Ve="_settingRow_14a5d_132",Qe="_controls_14a5d_145",Ye="_status_14a5d_151",m={settingsHeader:Me,pageTitle:Ue,pageSubtitle:Ee,settingsLayout:ze,sidebar:$e,sidebarIndicator:Fe,sidebarItem:qe,active:Ke,mainContent:je,tabContent:He,sectionCard:We,settingItem:Be,settingRow:Ve,controls:Qe,status:Ye},Je="_sectionCard_wt900_12",Xe="_title_wt900_22",Ze="_signIn_wt900_29",et="_userInfo_wt900_36",tt="_warning_wt900_58",at="_formGroup_wt900_65",nt="_label_wt900_69",st="_inputWrapper_wt900_79",rt="_input_wt900_79",it="_select_wt900_103",ot="_actions_wt900_140",lt="_hr_wt900_148",g={sectionCard:Je,title:Xe,signIn:Ze,userInfo:et,warning:tt,formGroup:at,label:nt,inputWrapper:st,input:rt,select:it,actions:ot,hr:lt},ct=()=>{const[t,r]=s(!0),[o,d]=s(!1),[l,v]=s(!1),[w,c]=s(null),[a,i]=s({status:"idle"}),[u,p]=s(!1),[h,_]=s(""),[y,k]=s(!1),R=H(null),[x,L]=s({show:!1,message:"",type:"info"}),P=()=>{R.current&&(window.clearInterval(R.current),R.current=null)},b=ie(f=>{v(f.authenticated),c(f.user||f.device.user||null),i(f.device),p(!!f.hasCustomClientId)},[]),S=ie(async()=>{const f=await C.auth.githubStatus.query();b(f)},[b]),O=async()=>{try{const f=await C.auth.githubPoll.query();i(f),f.status==="success"?(P(),await S(),L({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):f.status==="error"&&(P(),L({show:!0,message:f.error||"GitHub authentication failed.",type:"error"}))}catch{P(),L({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},U=(f=5)=>{P(),R.current=window.setInterval(O,Math.max(f,5)*1e3)};A(()=>(S().catch(()=>{L({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>r(!1)),P),[S]);const N=async()=>{d(!0);try{const f=await C.auth.githubStart.mutate();i(f),U(f.verification?.interval)}catch(f){L({show:!0,message:f instanceof Error?f.message:"Failed to start GitHub authentication.",type:"error"})}finally{d(!1)}},G=async()=>{try{await C.auth.githubLogout.mutate(),v(!1),c(null),i({status:"idle"}),L({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{L({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},E=async()=>{k(!0);try{await C.auth.saveGithubAuth.mutate({clientId:h}),_(""),await S(),L({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{L({show:!0,message:"Failed to save override.",type:"error"})}finally{k(!1)}},K=async()=>{k(!0);try{await C.auth.saveGithubAuth.mutate({clientId:""}),_(""),await S(),L({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{L({show:!0,message:"Failed to clear override.",type:"error"})}finally{k(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:g.sectionCard,children:[e("h3",{className:g.title,children:"GitHub Cloud Sync"}),e("p",{className:g.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),l&&w?e("div",{className:g.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:w.name||w.login})]}),e(T,{variant:"danger",onClick:G,children:"Sign Out"})]}):e("div",{className:g.signIn,children:e(T,{onClick:N,disabled:o||a.status==="pending",children:o||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.verification&&e(ke,{children:[e("hr",{className:g.hr}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Verification URL"}),e("div",{className:g.inputWrapper,children:[e("input",{className:g.input,value:a.verification.verification_uri,readOnly:!0}),e(T,{onClick:()=>{const f=a.verification?.verification_uri;f&&/^https?:\/\//i.test(f)&&window.open(f,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Device Code"}),e("input",{className:g.input,value:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:g.warning,children:a.error}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",u?"(override active)":""]}),e("div",{className:g.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:g.label,children:"Client ID (optional)"}),e("input",{className:g.input,value:h,onChange:f=>_(f.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:g.actions,children:[e(T,{onClick:E,disabled:y,children:"Save override"}),e(T,{variant:"secondary",onClick:K,disabled:y,children:"Use dango defaults"})]})]}),e($,{isOpen:x.show,onClose:()=>L(f=>({...f,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:x.message})}),e($.Actions,{children:e(T,{onClick:()=>L(f=>({...f,show:!1})),children:"OK"})})]})]})},dt=()=>{const[t,r]=s(!0),[o,d]=s(null),[l,v]=s(!1),[w,c]=s(!1),[a,i]=s(""),[u,p]=s(""),[h,_]=s(""),[y,k]=s(!1),[R,x]=s({show:!1,message:"",type:"info"}),L=async()=>{try{const N=await C.auth.user.query();d(N?.email?N:null)}catch{d(null)}},P=async()=>{try{const[N,G]=await Promise.all([C.auth.configStatus.query(),C.auth.googleAuth.query()]);v(!!N.hasConfig),c(!!(G.hasCustomWorkerUrl||G.hasCustomClientId||G.hasClientSecret))}catch(N){console.error("Failed to fetch config status",N)}};A(()=>{(async()=>{r(!0),await Promise.all([L(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await L(),window.history.replaceState(null,"",window.location.pathname))}catch{}r(!1)})();const G=E=>{E.origin===window.location.origin&&typeof E.data=="object"&&E.data!==null&&E.data.type==="GOOGLE_AUTH_SUCCESS"&&(d(E.data.user),window.location.reload())};return window.addEventListener("message",G),()=>window.removeEventListener("message",G)},[]);const b=async()=>{try{const N=await C.auth.googleLogin.mutate();if(N.authenticated){window.location.reload();return}if(N.url){if(typeof window.DangoBridge<"u"){window.location.href=N.url;return}const E=600,K=700,f=window.innerWidth/2-E/2,J=window.innerHeight/2-K/2;window.open(N.url,"GoogleAuth",`width=${E},height=${K},top=${J},left=${f}`)}else throw new Error("Auth URL not available")}catch{x({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},S=async()=>{try{await C.auth.logout.mutate(),d(null),x({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(N){console.error("Sign out failed",N),x({show:!0,message:"Failed to sign out.",type:"error"})}},O=async()=>{k(!0);try{await C.auth.saveGoogleAuth.mutate({workerUrl:a,clientId:u,clientSecret:h}),i(""),p(""),_(""),await P(),x({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{x({show:!0,message:"Failed to save override.",type:"error"})}finally{k(!1)}},U=async()=>{k(!0);try{await C.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),i(""),p(""),_(""),await P(),x({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{x({show:!0,message:"Failed to clear override.",type:"error"})}finally{k(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:g.sectionCard,children:[e("h3",{className:g.title,children:"Google Drive Sync"}),o?e("div",{className:g.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:o.name})," (",o.email,")"]}),e(T,{variant:"danger",onClick:S,children:"Sign Out"})]}):e("div",{className:g.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(T,{onClick:b,disabled:!l,children:"Sign in with Google"}),!l&&e("p",{className:g.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",w?"(override active)":""]}),e("div",{className:g.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:g.label,children:"Worker URL (optional)"}),e("input",{className:g.input,value:a,onChange:N=>i(N.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Client ID (optional)"}),e("input",{className:g.input,value:u,onChange:N=>p(N.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:g.input,value:h,onChange:N=>_(N.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:g.actions,children:[e(T,{onClick:O,disabled:y,children:"Save override"}),e(T,{variant:"secondary",onClick:U,disabled:y,children:"Use dango defaults"})]})]}),e($,{isOpen:R.show,onClose:()=>x(N=>({...N,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:R.message})}),e($.Actions,{children:e(T,{onClick:()=>x(N=>({...N,show:!1})),children:"OK"})})]})]})},ut="_sectionCard_1pqo4_1",ht="_settingItem_1pqo4_26",gt="_settingRow_1pqo4_31",mt="_modalOverlay_1pqo4_38",pt="_modal_1pqo4_38",yt="_modalActions_1pqo4_73",ft="_modalSecondary_1pqo4_79",vt="_modalPrimary_1pqo4_89",z={sectionCard:ut,settingItem:ht,settingRow:gt,modalOverlay:mt,modal:pt,modalActions:yt,modalSecondary:ft,modalPrimary:vt},wt={anime:{heading:"Watchlist Preferences",blurb:"Customize your experience when managing your watchlist and series entries.",skipKey:"skipRemoveConfirmation",ignoreKey:"ignoreAdultContent",listOnlyKey:"cwWatchlistOnly",skipLabel:"Skip confirmation when removing from watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in watchlist",listNoun:"watchlist",continueNoun:"continue watching",adultCountUrl:"/api/continue-watching/adult-count",purgeUrl:"/api/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["allContinueWatching"]]},manga:{heading:"Reading List Preferences",blurb:"Customize your experience when managing your reading list and manga entries.",skipKey:"mangaSkipRemoveConfirmation",ignoreKey:"mangaIgnoreAdultContent",listOnlyKey:"mangaCwWatchlistOnly",skipLabel:"Skip confirmation when removing from reading list",ignoreLabel:"Hide adult content from continue reading",listOnlyLabel:"Only show continue reading for manga in reading list",listNoun:"reading list",continueNoun:"continue reading",adultCountUrl:"/api/manga/continue-reading/adult-count",purgeUrl:"/api/manga/continue-reading/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue reading`,invalidateKeys:[["manga-continue-reading"]]},tv:{heading:"TV Watchlist Preferences",blurb:"Customize your experience when managing your TV watchlist and series entries.",skipKey:"tvSkipRemoveConfirmation",ignoreKey:"tvIgnoreAdultContent",listOnlyKey:"tvCwWatchlistOnly",skipLabel:"Skip confirmation when removing from TV watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in TV watchlist",listNoun:"TV watchlist",continueNoun:"continue watching",adultCountUrl:"/api/tv/continue-watching/adult-count",purgeUrl:"/api/tv/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["tv-continue-watching"]]},asmr:{heading:"Listening List Preferences",blurb:"Customize your experience when managing your listening list and work entries.",skipKey:"asmrSkipRemoveConfirmation",ignoreKey:"asmrIgnoreAdultContent",listOnlyKey:"asmrCwWatchlistOnly",skipLabel:"Skip confirmation when removing from listening list",ignoreLabel:"Hide adult content from continue listening",listOnlyLabel:"Only show continue listening for works in listening list",listNoun:"listening list",continueNoun:"continue listening",adultCountUrl:"/api/asmr/continue-listening/adult-count",purgeUrl:"/api/asmr/continue-listening/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue listening`,invalidateKeys:[["asmr-continue-listening"]]}},bt=(t,r)=>{if(t==null)return r;const o=String(t);return o==="true"||o==="1"?!0:o==="false"||o==="0"?!1:r},ue=(t,r,o)=>{const[d,l]=s(r),[v,w]=s(!1),c=oe();return A(()=>{(async()=>{try{const u=await C.settings.getByKey.query({key:t});l(bt(u.value,r))}catch(u){console.error("Failed to fetch setting",u)}})()},[t,r]),{value:d,setValue:l,isUpdating:v,toggle:async()=>{if(v)return;w(!0);const i=!d;l(i);try{await C.settings.set.mutate({key:t,value:i});for(const u of o)c.invalidateQueries({queryKey:u})}catch(u){console.error("Error saving setting:",u),l(!i)}finally{w(!1)}}}},kt=()=>{const{contentType:t}=he(),r=wt[t],[o,d]=s(!1),[l,v]=s(!0),[w,c]=s(!1),a=ue(r.ignoreKey,!0,r.invalidateKeys),i=ue(r.listOnlyKey,!1,r.invalidateKeys),[u,p]=s(null),[h,_]=s(!1),y=oe(),k=Te();A(()=>{v(!0),(async()=>{try{const S=await C.settings.getByKey.query({key:r.skipKey});String(S.value)==="true"||String(S.value)==="1"?d(!0):d(!1)}catch(S){console.error("Failed to fetch setting",S)}finally{v(!1)}})()},[r.skipKey]);const R=async()=>{if(w)return;c(!0);const b=!o;d(b);try{await C.settings.set.mutate({key:r.skipKey,value:b})}catch(S){console.error("Error saving setting:",S),d(!b)}finally{c(!1)}},x=async()=>{if(!a.isUpdating){if(a.value)try{let b;if(t==="anime"?b=(await C.continueWatching.adultCount.query()).count:t==="manga"?b=(await C.mangaProgress.adultCount.query()).count:t==="asmr"?b=(await C.asmrProgress.adultCount.query()).count:b=(await C.tvProgress.adultCount.query()).count,typeof b=="number"&&b>0){p(b);return}}catch(b){console.error("Failed to fetch adult count",b)}a.toggle()}},L=()=>{p(null),a.toggle()},P=async()=>{if(!h){_(!0);try{let b;t==="anime"?b=(await C.continueWatching.purgeAdult.mutate()).removed:t==="manga"?b=(await C.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?b=(await C.asmrProgress.purgeAdult.mutate()).removed:b=(await C.tvProgress.purgeAdult.mutate()).removed,de.success(r.purgeDoneText(b??0));for(const S of r.invalidateKeys)y.invalidateQueries({queryKey:S});t==="anime"&&y.invalidateQueries(k.continueWatching.pathFilter()),t==="manga"&&y.invalidateQueries(k.mangaProgress.pathFilter()),t==="asmr"&&y.invalidateQueries(k.asmrProgress.pathFilter()),t==="tv"&&y.invalidateQueries(k.tvProgress.pathFilter())}catch(b){console.error("Failed to purge adult entries",b),de.error("Failed to remove adult entries")}finally{_(!1),p(null)}a.toggle()}};return l?e("div",{children:"Loading settings..."}):e("div",{className:z.sectionCard,children:[e("h3",{children:r.heading}),e("p",{children:r.blurb}),e("div",{className:z.settingItem,children:e("div",{className:z.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:r.skipLabel}),e(q,{isChecked:o,onChange:R,id:"skip-confirmation-toggle",disabled:w})]})}),e("div",{className:z.settingItem,children:e("div",{className:z.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:r.ignoreLabel}),e(q,{isChecked:a.value,onChange:x,id:"ignore-adult-toggle",disabled:a.isUpdating})]})}),e("div",{className:z.settingItem,children:e("div",{className:z.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:r.listOnlyLabel}),e(q,{isChecked:i.value,onChange:i.toggle,id:"cw-watchlist-only-toggle",disabled:i.isUpdating})]})}),u!==null&&e("div",{className:z.modalOverlay,onClick:()=>p(null),children:e("div",{className:z.modal,onClick:b=>b.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[u," adult ",u===1?"entry":"entries"," not in your"," ",r.listNoun," ",u===1?"is":"are"," currently hidden from"," ",r.continueNoun,". You can purge ",u===1?"it":"them"," from the database instead of showing ",u===1?"it":"them","."]}),e("div",{className:z.modalActions,children:[e("button",{type:"button",className:z.modalSecondary,onClick:L,disabled:h,children:"Show them"}),e("button",{type:"button",className:z.modalPrimary,onClick:P,disabled:h,children:h?"Purging...":`Purge ${u}`})]})]})})]})},Ct="_sectionCard_jkggs_1",St="_statsGrid_jkggs_26",_t="_statCard_jkggs_33",Nt="_statLabel_jkggs_43",Tt="_statValue_jkggs_51",It="_statMeta_jkggs_57",Rt="_statusBanner_jkggs_63",xt="_statusSuccess_jkggs_74",Lt="_statusUpdating_jkggs_80",Pt="_statusError_jkggs_86",Dt="_sha_jkggs_92",At="_settingItem_jkggs_99",Ot="_settingRow_jkggs_104",Gt="_settingTitle_jkggs_111",Mt="_settingSubtitle_jkggs_117",Ut="_actionsRow_jkggs_124",I={sectionCard:Ct,statsGrid:St,statCard:_t,statLabel:Nt,statValue:Tt,statMeta:It,statusBanner:Rt,statusSuccess:xt,statusUpdating:Lt,statusError:Pt,sha:Dt,settingItem:At,settingRow:Ot,settingTitle:Gt,settingSubtitle:Mt,actionsRow:Ut},Et=()=>{const[t,r]=s(null),[o,d]=s(!0),[l,v]=s(!1),[w,c]=s(!1),a=H(null),i=async()=>{try{const y=await C.settings.offlineDbInfo.query();return r(y),y}catch(y){console.error("Failed to fetch offline DB info:",y)}finally{d(!1)}return null};A(()=>(i(),()=>{a.current&&window.clearInterval(a.current)}),[]),A(()=>{t?.isRefreshing?a.current||(a.current=window.setInterval(async()=>{const y=await i();y&&!y.isRefreshing&&a.current&&(window.clearInterval(a.current),a.current=null)},2e3)):a.current&&(window.clearInterval(a.current),a.current=null)},[t?.isRefreshing]);const u=async()=>{if(!t||l)return;const y=!t.autoUpdateEnabled;v(!0),r({...t,autoUpdateEnabled:y});try{await C.settings.setOfflineDbAutoUpdate.mutate({enabled:y})}catch(k){console.error("Failed to update auto update setting:",k),r({...t,autoUpdateEnabled:!y})}finally{v(!1)}},p=async()=>{if(!(t?.isRefreshing||w)){c(!0);try{await C.settings.triggerOfflineDbUpdate.mutate(),r(y=>y?{...y,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(y){console.error("Failed to trigger offline DB update:",y)}finally{c(!1)}}},h=y=>{if(!y)return"Never";try{return new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return y}},_=t?.isRefreshing||w;return e("div",{className:I.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:I.statsGrid,children:[e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"MAL Mapped"}),e("span",{className:I.statValue,children:o?"—":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Release"}),e("span",{className:I.statMeta,children:o?"—":t?.releaseTag??"Never"})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Last Checked"}),e("span",{className:I.statMeta,children:o?"—":h(t?.lastCheckedAt??null)})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Last Updated"}),e("span",{className:I.statMeta,children:o?"—":h(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${I.statusBanner} ${t.lastStatus==="failed"?I.statusError:t.lastStatus==="updating"?I.statusUpdating:I.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:I.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:I.settingItem,children:e("div",{className:I.settingRow,children:[e("div",{children:[e("span",{className:I.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:I.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(q,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:u,disabled:o||l})]})}),e("div",{className:I.actionsRow,children:e(T,{onClick:p,disabled:o||_,children:_?"Updating Database...":"Update Offline Database Now"})})]})},zt="_sectionCard_1g4qx_1",$t="_dangerCard_1g4qx_26",Ft="_status_1g4qx_34",qt="_warningText_1g4qx_40",Kt="_ackLabel_1g4qx_44",Q={sectionCard:zt,dangerCard:$t,status:Ft,warningText:qt,ackLabel:Kt},jt=()=>{const t=oe(),[r,o]=s(!1),[d,l]=s(!1),[v,w]=s(!1),[c,a]=s(""),i=()=>{l(!1),a(""),o(!0)},u=()=>{v||(o(!1),l(!1))},p=async()=>{if(!(!d||v)){w(!0),a("");try{const h=await fetch("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),_=await h.json();if(!h.ok)throw new Error(_.error||"Failed to clear database");const y=_.deleted,k=_.deletedManga,R=_.deletedTv,x=_.deletedAsmr,L=Object.values(y).reduce((O,U)=>O+(U||0),0)+Object.values(k??{}).reduce((O,U)=>O+(U||0),0)+Object.values(R??{}).reduce((O,U)=>O+(U||0),0)+Object.values(x??{}).reduce((O,U)=>O+(U||0),0),P=(k?.manga_library??0)+(k?.manga_progress??0),b=(R?.tv_library??0)+(R?.tv_progress??0),S=(x?.asmr_library??0)+(x?.asmr_progress??0);a(`Library cleared — ${y.watchlist??0} watchlist entries, ${P} manga rows, ${b} TV rows, ${S} ASMR rows and ${L} total rows removed.`),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]}),t.invalidateQueries({queryKey:["manga-library"]}),t.invalidateQueries({queryKey:["manga-continue-reading"]}),t.invalidateQueries({queryKey:["tv-library"]}),t.invalidateQueries({queryKey:["tv-continue-watching"]}),t.invalidateQueries({queryKey:["asmr-library"]}),t.invalidateQueries({queryKey:["asmr-continue-listening"]}),o(!1)}catch(h){a(h.message)}finally{w(!1),l(!1)}}};return e("div",{className:`${Q.sectionCard} ${Q.dangerCard}`,children:[e("h3",{children:"Danger Zone"}),e("p",{children:"Permanently delete your library (watchlist, watched episodes, queue, cached show metadata, manga reading list and reading progress, TV watchlist and watch progress, ASMR listening list and listening progress) to start fresh. Your settings, sync state and the offline metadata cache are preserved."}),e(T,{variant:"danger",onClick:i,children:"Clear Library Data"}),c&&e("p",{className:Q.status,children:c}),e($,{isOpen:r,onClose:u,title:"Clear library data?",width:"sm",children:[e($.Body,{children:[e("p",{className:Q.warningText,children:"This permanently deletes everything in your library. It acts on the active database (dev or prod, per server config) and cannot be undone. Settings, sync state and the offline metadata cache are kept."}),e("label",{className:Q.ackLabel,children:[e("input",{type:"checkbox",checked:d,onChange:h=>l(h.target.checked),disabled:v}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e($.Actions,{children:[e(T,{variant:"secondary",onClick:u,disabled:v,children:"Cancel"}),e(T,{variant:"danger",onClick:p,disabled:!d||v,children:v?"Clearing...":"Yes, delete everything"})]})]})]})},Ht=()=>{const[t,r]=s(""),[o,d]=s([]),[l,v]=s(null),[w,c]=s(!0),[a,i]=s({show:!1,message:"",type:"info"}),u=async()=>{try{c(!0);const _=await(await fetch("/api/auth/settings/rclone")).json();r(_.remote||""),d(_.availableRemotes||[]),v(_.activeRemote||null)}catch(h){console.error("Failed to fetch Rclone settings",h)}finally{c(!1)}};A(()=>{u()},[]);const p=async()=>{try{if((await fetch("/api/auth/settings/rclone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:t})})).ok)i({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),u();else throw new Error("Failed to save")}catch{i({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return w?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:g.sectionCard,children:[e("h3",{className:g.title,children:"Rclone Cloud Sync"}),e("p",{className:g.signIn,children:"Configure which Rclone remote to use for database synchronization."}),l?e("div",{className:g.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:l})]})}):e("p",{className:g.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:g.formGroup,children:[e("label",{className:g.label,children:"Remote Name"}),e("div",{className:g.inputWrapper,children:e("select",{className:g.select,value:t,onChange:h=>r(h.target.value),children:[e("option",{value:"",children:"(Disabled / None)"}),o.map(h=>e("option",{value:h,children:h},h)),t&&!o.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:g.warning,style:{marginTop:"12px"},children:[e("strong",{children:"Note:"})," You can choose which provider is active using the selector at the top of the page."]})]}),e("div",{className:g.actions,children:e(T,{onClick:p,children:"Save Rclone Settings"})}),e($,{isOpen:a.show,onClose:()=>i(h=>({...h,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:a.message})}),e($.Actions,{children:e(T,{onClick:()=>i(h=>({...h,show:!1})),children:"OK"})})]})]})},Wt=()=>{const[t,r]=s(null),[o,d]=s(!0),l=async()=>{try{const i=await(await fetch("/api/auth/settings/sync")).json();r(i)}catch(a){console.error("Failed to fetch sync settings",a)}finally{d(!1)}};A(()=>{l()},[]);const v=async a=>{const i=a.target.value;try{const u=await fetch("/api/auth/settings/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i})});if(u.ok){const p=await u.json();r(h=>h?{...h,activeProvider:p.activeProvider}:null),await l(),te.success(`Sync provider updated to ${i==="default"?"Default Order":i}`)}else te.error("Failed to update sync provider")}catch{te.error("Error updating sync provider")}};if(o||!t)return null;const w=[{value:"default",label:"Default (Priority Based)"}];t.authenticatedProviders.github&&w.push({value:"github",label:"GitHub"}),t.authenticatedProviders.google&&w.push({value:"google",label:"Google Drive"}),t.authenticatedProviders.rclone&&w.push({value:"rclone",label:"Rclone"}),w.push({value:"none",label:"None (Local Only)"});const c=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:m.sectionCard,children:[e("h3",{children:"Active Sync Provider"}),e("p",{children:'Choose which provider to use for synchronization. "Default" uses the first available provider you are logged into.'}),e("div",{style:{marginBottom:"1.5rem",padding:"0.75rem",background:"rgba(255, 255, 255, 0.03)",borderRadius:"var(--radius-md)",borderLeft:"4px solid var(--accent)",fontSize:"var(--font-size-sm)"},children:["Current Status:"," ",e("strong",{style:{color:"var(--accent-light)",textTransform:"capitalize"},children:c(t.actualActiveProvider)})]}),e("div",{className:m.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:t.activeProvider,onChange:v,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:w.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function Bt(){return"javascript:"+encodeURIComponent(`(function(){
2
2
  if(!/(^|\\.)discord\\.com$/.test(location.hostname)){alert('Dango: use this bookmarklet while on discord.com');return}
3
3
  var t=null;
4
4
  try{
@@ -1 +1 @@
1
- import{d as _,A as v,h as E,T as R,u as e,g as A}from"./vendor-core-DfaOB3Rn.js";import{I as P}from"./vendor-icons-DrybRNxP.js";import{u as L}from"./index-B4AdKbhW.js";const x="_pagination_zelsc_1",M="_pageBtn_zelsc_7",S="_pageInfo_zelsc_38",G="_pagePicker_zelsc_48",F="_dropdown_zelsc_52",K="_flipDown_zelsc_68",T="_jumpRow_zelsc_73",W="_jumpInput_zelsc_79",q="_jumpGo_zelsc_90",J="_optionList_zelsc_105",O="_optionBtn_zelsc_113",H="_current_zelsc_132",s={pagination:x,pageBtn:M,pageInfo:S,pagePicker:G,dropdown:F,flipDown:K,jumpRow:T,jumpInput:W,jumpGo:q,optionList:J,optionBtn:O,current:H},cn=({page:t,totalPages:d,canGoNext:m,onChange:p,isLoading:f=!1,variant:g="compact"})=>{const[l,u]=_(!1),[b,h]=_(""),[k,N]=_(0),[$,z]=_(!1),w=v(null),y=v(null),j=v(null);E(()=>{if(!l)return;const n=o=>{w.current&&!w.current.contains(o.target)&&u(!1)},r=o=>{o.key==="Escape"&&u(!1)};return document.addEventListener("pointerdown",n),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",n),document.removeEventListener("keydown",r)}},[l]),E(()=>{if(!l)return;N(0),z(!1);const n=requestAnimationFrame(()=>{const r=j.current?.getBoundingClientRect(),o=y.current?.getBoundingClientRect();if(!r)return;let c=0;r.right>window.innerWidth-8?c=window.innerWidth-8-r.right:r.left<8&&(c=8-r.left),N(Math.round(c)),o&&o.top<r.height+24&&z(!0)});return()=>cancelAnimationFrame(n)},[l]);const i=d,C=R(()=>{if(i!==void 0){if(i<=100)return Array.from({length:i},(o,c)=>c+1);const r=new Set([1,i]);for(let o=t-10;o<=t+10;o++)o>=1&&o<=i&&r.add(o);return[...r].sort((o,c)=>o-c)}const n=m?t+1:t;return Array.from({length:n},(r,o)=>o+1)},[i,t,m]),B=n=>{const r=i!==void 0?Math.min(Math.max(1,n),i):Math.max(1,n);u(!1),h(""),r!==t&&p(r)},D=()=>{const n=parseInt(b,10);Number.isNaN(n)||B(n)},I=f||(i!==void 0?t>=i:!m);return e("div",{className:s.pagination,ref:w,children:[e("button",{className:s.pageBtn,onClick:()=>p(t-1),disabled:t<=1||f,"aria-label":"Previous page",children:[e(P,{name:"chevron-left",size:14}),g==="labeled"&&e("span",{children:"Previous"})]}),e("div",{className:s.pagePicker,ref:y,children:[e("button",{className:s.pageBtn,onClick:()=>{h(""),u(n=>!n)},disabled:f,"aria-label":"Jump to page","aria-expanded":l,children:e("span",{className:s.pageInfo,children:["Page ",e("strong",{children:t}),i!==void 0&&` of ${i}`]})}),l&&e("div",{ref:j,className:`${s.dropdown} ${$?s.flipDown:""}`,style:k!==0?{marginLeft:k}:void 0,children:[e("div",{className:s.jumpRow,children:[e("input",{className:s.jumpInput,type:"number",inputMode:"numeric",min:1,max:i,value:b,placeholder:"Page #",onChange:n=>h(n.currentTarget.value),onKeyDown:n=>{n.key==="Enter"&&D()}}),e("button",{className:s.jumpGo,onClick:D,children:"Go"})]}),e("div",{className:s.optionList,children:C.map(n=>e("button",{className:`${s.optionBtn} ${n===t?s.current:""}`,onClick:()=>B(n),disabled:n===t,children:n},n))})]})]}),e("button",{className:s.pageBtn,onClick:()=>p(t+1),disabled:I,"aria-label":"Next page",children:[g==="labeled"&&e("span",{children:"Next"}),e(P,{name:"chevron-right",size:14})]})]})},Q="_skeletonCard_1b0hr_1",U="_poster_1b0hr_11",V="_line_1b0hr_20",X="_info_1b0hr_38",Y="_short_1b0hr_54",Z="_horizontal_1b0hr_60",nn="_vertical_1b0hr_78",en="_lowEnd_1b0hr_97",a={skeletonCard:Q,poster:U,line:V,"skeleton-wave":"_skeleton-wave_1b0hr_1",info:X,short:Y,horizontal:Z,vertical:nn,lowEnd:en},tn=({layout:t="vertical"})=>{const{lowEndMode:d}=L();return e("div",{className:`${a.skeletonCard} ${a[t]} ${d?a.lowEnd:""}`,children:[e("div",{className:a.poster}),e("div",{className:a.info,children:[e("div",{className:a.line}),e("div",{className:`${a.line} ${a.short}`})]})]})},on=({count:t=14,layout:d="vertical"})=>e("div",{className:"grid-container",children:Array.from({length:t}).map((m,p)=>e(tn,{layout:d},p))}),ln=A.memo(on);export{tn as A,cn as P,ln as S};
1
+ import{d as _,A as v,h as E,T as R,u as e,g as A}from"./vendor-core-DfaOB3Rn.js";import{I as P}from"./vendor-icons-DrybRNxP.js";import{u as L}from"./index-VzVAYX5A.js";const x="_pagination_zelsc_1",M="_pageBtn_zelsc_7",S="_pageInfo_zelsc_38",G="_pagePicker_zelsc_48",F="_dropdown_zelsc_52",K="_flipDown_zelsc_68",T="_jumpRow_zelsc_73",W="_jumpInput_zelsc_79",q="_jumpGo_zelsc_90",J="_optionList_zelsc_105",O="_optionBtn_zelsc_113",H="_current_zelsc_132",s={pagination:x,pageBtn:M,pageInfo:S,pagePicker:G,dropdown:F,flipDown:K,jumpRow:T,jumpInput:W,jumpGo:q,optionList:J,optionBtn:O,current:H},cn=({page:t,totalPages:d,canGoNext:m,onChange:p,isLoading:f=!1,variant:g="compact"})=>{const[l,u]=_(!1),[b,h]=_(""),[k,N]=_(0),[$,z]=_(!1),w=v(null),y=v(null),j=v(null);E(()=>{if(!l)return;const n=o=>{w.current&&!w.current.contains(o.target)&&u(!1)},r=o=>{o.key==="Escape"&&u(!1)};return document.addEventListener("pointerdown",n),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",n),document.removeEventListener("keydown",r)}},[l]),E(()=>{if(!l)return;N(0),z(!1);const n=requestAnimationFrame(()=>{const r=j.current?.getBoundingClientRect(),o=y.current?.getBoundingClientRect();if(!r)return;let c=0;r.right>window.innerWidth-8?c=window.innerWidth-8-r.right:r.left<8&&(c=8-r.left),N(Math.round(c)),o&&o.top<r.height+24&&z(!0)});return()=>cancelAnimationFrame(n)},[l]);const i=d,C=R(()=>{if(i!==void 0){if(i<=100)return Array.from({length:i},(o,c)=>c+1);const r=new Set([1,i]);for(let o=t-10;o<=t+10;o++)o>=1&&o<=i&&r.add(o);return[...r].sort((o,c)=>o-c)}const n=m?t+1:t;return Array.from({length:n},(r,o)=>o+1)},[i,t,m]),B=n=>{const r=i!==void 0?Math.min(Math.max(1,n),i):Math.max(1,n);u(!1),h(""),r!==t&&p(r)},D=()=>{const n=parseInt(b,10);Number.isNaN(n)||B(n)},I=f||(i!==void 0?t>=i:!m);return e("div",{className:s.pagination,ref:w,children:[e("button",{className:s.pageBtn,onClick:()=>p(t-1),disabled:t<=1||f,"aria-label":"Previous page",children:[e(P,{name:"chevron-left",size:14}),g==="labeled"&&e("span",{children:"Previous"})]}),e("div",{className:s.pagePicker,ref:y,children:[e("button",{className:s.pageBtn,onClick:()=>{h(""),u(n=>!n)},disabled:f,"aria-label":"Jump to page","aria-expanded":l,children:e("span",{className:s.pageInfo,children:["Page ",e("strong",{children:t}),i!==void 0&&` of ${i}`]})}),l&&e("div",{ref:j,className:`${s.dropdown} ${$?s.flipDown:""}`,style:k!==0?{marginLeft:k}:void 0,children:[e("div",{className:s.jumpRow,children:[e("input",{className:s.jumpInput,type:"number",inputMode:"numeric",min:1,max:i,value:b,placeholder:"Page #",onChange:n=>h(n.currentTarget.value),onKeyDown:n=>{n.key==="Enter"&&D()}}),e("button",{className:s.jumpGo,onClick:D,children:"Go"})]}),e("div",{className:s.optionList,children:C.map(n=>e("button",{className:`${s.optionBtn} ${n===t?s.current:""}`,onClick:()=>B(n),disabled:n===t,children:n},n))})]})]}),e("button",{className:s.pageBtn,onClick:()=>p(t+1),disabled:I,"aria-label":"Next page",children:[g==="labeled"&&e("span",{children:"Next"}),e(P,{name:"chevron-right",size:14})]})]})},Q="_skeletonCard_1b0hr_1",U="_poster_1b0hr_11",V="_line_1b0hr_20",X="_info_1b0hr_38",Y="_short_1b0hr_54",Z="_horizontal_1b0hr_60",nn="_vertical_1b0hr_78",en="_lowEnd_1b0hr_97",a={skeletonCard:Q,poster:U,line:V,"skeleton-wave":"_skeleton-wave_1b0hr_1",info:X,short:Y,horizontal:Z,vertical:nn,lowEnd:en},tn=({layout:t="vertical"})=>{const{lowEndMode:d}=L();return e("div",{className:`${a.skeletonCard} ${a[t]} ${d?a.lowEnd:""}`,children:[e("div",{className:a.poster}),e("div",{className:a.info,children:[e("div",{className:a.line}),e("div",{className:`${a.line} ${a.short}`})]})]})},on=({count:t=14,layout:d="vertical"})=>e("div",{className:"grid-container",children:Array.from({length:t}).map((m,p)=>e(tn,{layout:d},p))}),ln=A.memo(on);export{tn as A,cn as P,ln as S};