@serifpersia/dango 3.5.9 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/client/dist/assets/{AnimeCard-CDeVbWJO.js → AnimeCard-CEDL_2lC.js} +1 -1
- package/client/dist/assets/{AnimeInfo-DVpM_cPF.js → AnimeInfo-mVGUoF9q.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-Cc3OcfHY.js → AnimeInfoPage-a1-1F_la.js} +2 -2
- package/client/dist/assets/{Asmr-DZmR_EHb.js → Asmr-CCMuiaoR.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-DBCDlfYq.js → AsmrResetProgressModal-CiwgOhH2.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-Cf5L0Dxf.js → AvSyncCalibrator-PqA6B5Ey.js} +1 -1
- package/client/dist/assets/{Home-BqhPqzWF.js → Home-BmTp0Dx7.js} +1 -1
- package/client/dist/assets/{Insights-CmbbDZr3.js → Insights-C89oz_3z.js} +1 -1
- package/client/dist/assets/{LibraryListPage-jLA7gnux.js → LibraryListPage-DOSPLTiR.js} +1 -1
- package/client/dist/assets/{ListeningList-Cm9zGlLB.js → ListeningList-IHSyufXX.js} +1 -1
- package/client/dist/assets/{Manga-x4pVT4ZH.js → Manga-H4hG-3K8.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-BPSW9UER.js → MangaInfoPage-Bjz2NwLc.js} +1 -1
- package/client/dist/assets/{MangaReadPage-V1iDbCfL.js → MangaReadPage-DZakUml0.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-Dto3km2X.js → MangaResetProgressModal-kbpad7Vl.js} +1 -1
- package/client/dist/assets/{Mature-B0DoN3tQ.js → Mature-DfODnRR8.js} +1 -1
- package/client/dist/assets/{MediaCard-D6_9HL2Z.js → MediaCard-fN3GQyTJ.js} +1 -1
- package/client/dist/assets/{Music-1MlUIfdw.js → Music-CFVwJyIo.js} +1 -1
- package/client/dist/assets/{OptionListMenu-BWwktIiH.js → OptionListMenu-BjoortST.js} +1 -1
- package/client/dist/assets/{Player-Dgtn--lM.js → Player-DMeWl-5s.js} +2 -2
- package/client/dist/assets/{PlayerSettings-CI5hGpEU.js → PlayerSettings-DaG98x1K.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-DjcdOJgg.js → QueueOptionsButton-MpSKva6y.js} +1 -1
- package/client/dist/assets/{QueueRail-B5z_xhzj.js → QueueRail-CtLxXvR_.js} +1 -1
- package/client/dist/assets/{Radio-BAE-Q-iN.js → Radio-D1zoU38z.js} +1 -1
- package/client/dist/assets/{ReadingList-B97i_hGv.js → ReadingList-C_oRyOHJ.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-C7-CvTi-.js → ResetProgressModal-CpbOV9Sk.js} +1 -1
- package/client/dist/assets/{Search-CbPFjKeU.js → Search-Cs8U1ZGO.js} +1 -1
- package/client/dist/assets/{Settings-BbihEcZ2.js → Settings-BgcOeTlE.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-BA_x2PRl.js → SkeletonGrid-gCly-9x7.js} +1 -1
- package/client/dist/assets/{Trackers-Bperfrcz.js → Trackers-DoHHWI2D.js} +1 -1
- package/client/dist/assets/{Tv-BSGuUz2F.js → Tv-DhLdh3WF.js} +1 -1
- package/client/dist/assets/{TvInfo-CxSmzVSL.js → TvInfo-CfYJPE-C.js} +1 -1
- package/client/dist/assets/{TvPopup-S5blnD3l.js → TvPopup-BBIe0fHF.js} +1 -1
- package/client/dist/assets/{TvSearch-B-2sRNbN.js → TvSearch-Bfp_r265.js} +1 -1
- package/client/dist/assets/{TvWatchlist-MaA-qhQw.js → TvWatchlist-DNcVUBXZ.js} +1 -1
- package/client/dist/assets/{Watchlist-yVEi1oVn.js → Watchlist-DnC7uDc4.js} +1 -1
- package/client/dist/assets/{hls-CnFtaJwf.js → hls-B9wsDt6U.js} +1 -1
- package/client/dist/assets/index-C6HMOCqo.css +1 -0
- package/client/dist/assets/index-CfgPGaUO.js +178 -0
- package/client/dist/assets/{useAnimeInfoData-BqAd5seW.js → useAnimeInfoData-Dpkjj68s.js} +1 -1
- package/client/dist/assets/{useAsmr-B1vlDm2S.js → useAsmr-QqLyjBbR.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-BNJC4JQo.js → useAsmrPopup-CnYAAhDj.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-CU3bFfuD.js → useMangaLibrary-CxRsa2lr.js} +1 -1
- package/client/dist/assets/{useMangaPopup-LbRnTFzq.js → useMangaPopup-CXnu2h4Y.js} +1 -1
- package/client/dist/assets/{useProviders-CvKGEjDV.js → useProviders-DDPMV3HX.js} +1 -1
- package/client/dist/assets/{useTv-LsgXHZD4.js → useTv-BkZAFGaD.js} +1 -1
- package/client/dist/assets/{useTvLibrary-c90knUfT.js → useTvLibrary-CL3kMD_c.js} +1 -1
- package/client/dist/index.html +2 -2
- package/client/dist/repo_logo.svg +39 -19
- package/package.json +2 -2
- package/server/package.json +1 -1
- package/client/dist/assets/index-Ck-R0JKv.css +0 -1
- package/client/dist/assets/index-DNxWyfmM.js +0 -178
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as y,h as A,u as e,A as R,g as Ie,S,$ as tt,p as nt,T as j}from"./vendor-core-DfaOB3Rn.js";import{t as Pe,O as it,h as H,z as $}from"./index-DNxWyfmM.js";import{I as f}from"./vendor-icons-DrybRNxP.js";import{r as p}from"./Radio.module-DGSZLpKM.js";import{a}from"./Asmr.module-CdWlioTY.js";import{b as ne,u as Ae,a as Ee}from"./vendor-query-BBT5_sHx.js";import{p as te}from"./page.module-C1MlZzf3.js";const pe=new Set,ue=new Map,qe=n=>`/api/image-proxy?url=${encodeURIComponent(n)}&strict=1`,ze=n=>/googleusercontent\.com/.test(n)?n.replace(/=w\d+-h\d+(?:-l\d+)?(?:-rj)?$/,"=w544-h544-l90-rj"):n,Ye=/^[A-Za-z0-9_-]{11}$/;function st(n,s){const l=[],b=n?ue.get(n):void 0;b&&!pe.has(b)&&l.push(b);for(const x of s??[]){if(!x?.url)continue;const w=qe(ze(x.url));pe.has(w)||l.includes(w)||l.push(w)}if(n&&Ye.test(n)){const x=qe(`https://i.ytimg.com/vi/${n}/hqdefault.jpg`);!pe.has(x)&&!l.includes(x)&&l.push(x)}return l}function at(n,s){const l=s?.[0]?.url;return l?ze(l):n&&Ye.test(n)?`https://i.ytimg.com/vi/${n}/hqdefault.jpg`:""}function rt(n,s){!n||pe.has(s)||(ue.set(n,s),ue.size>500&&ue.clear())}function ot(n){pe.add(n);for(const[s,l]of ue)l===n&&ue.delete(s)}function $e({id:n,thumbnails:s}){const[l,b]=y(0),[x,w]=y(!1);A(()=>{b(0),w(!1)},[n]);const _=st(n,s),E=_[l];return x||!E?e("span",{className:p.stationThumbPlaceholder,children:e(f,{name:"headphones"})}):e("img",{src:E,alt:"",className:p.stationThumb,loading:"lazy",decoding:"async",onLoad:()=>rt(n,E),onError:()=>{ot(E),l+1<_.length?b(l+1):w(!0)}})}function Ue(n){if(!Number.isFinite(n)||n<0)return"0:00";const s=Math.floor(n/60),l=Math.floor(n%60);return`${s}:${String(l).padStart(2,"0")}`}const ct=({track:n,shuffle:s,onToggleShuffle:l,onTrackStep:b,onTrackFailed:x,onClose:w,liked:_,likeVisible:E,likePending:de,onToggleLike:ie})=>{const O=R(null),me=R(!1),[T,se]=y(!1),[h,v]=y(!0),[V,B]=y(!1),[F,ae]=y(0),[Z,J]=y(0),[N,re]=y(()=>{const r=parseFloat(localStorage.getItem("musicVolume")||"");return Number.isFinite(r)?r:1}),[z,oe]=y(()=>localStorage.getItem("musicAutoplay")!=="false"),L=R(N);L.current=N;const k=R(z);k.current=z;const W=R(0),D=R(0),Y=R(null),G=R("");G.current||(G.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`music-${Date.now()}-${Math.random().toString(36).slice(2)}`);const fe=`/api/music/audio?videoId=${encodeURIComponent(n.id)}`,q=Ie.useCallback(()=>{Y.current&&(window.clearTimeout(Y.current),Y.current=null)},[]),ce=Ie.useCallback(r=>{const c=O.current;if(!c)return;q(),v(!0),B(!1);const I=()=>{if(c.removeEventListener("loadedmetadata",I),r>5&&Number.isFinite(c.duration)&&r<c.duration-5)try{c.currentTime=r}catch{}};c.addEventListener("loadedmetadata",I),c.src=fe,c.load(),c.volume=L.current,c.play().catch(()=>{})},[fe,q]),ye=()=>{v(!1),B(!0),x?.(n),k.current&&b(1)},be=()=>{if(!Y.current){if(D.current>=3){ye();return}D.current+=1,Y.current=window.setTimeout(()=>{Y.current=null,ce(W.current)},5e3)}},Q=()=>{D.current=0,ce(W.current)};A(()=>{W.current=0,D.current=0,se(!1),ae(0),J(0);const r=O.current;return ce(W.current),()=>{q(),r&&r.removeAttribute("src")}},[ce,q]),A(()=>{const r=O.current;r&&(r.volume=N)},[N]),A(()=>(document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")),[]);const ve=at(n.id,n.thumbnails),K=Ie.useCallback(r=>{const c=O.current;Pe.discord.musicPresence.mutate({title:n.title,artistLabel:n.artists,isPlaying:r,thumbnail:ve||"",currentTime:c?.currentTime??0,duration:Number.isFinite(c?.duration??NaN)?c?.duration:0,sessionId:G.current}).catch(()=>{}),Pe.discord.heartbeat.mutate({sessionId:G.current}).catch(()=>{})},[n,ve]);A(()=>{K(T)},[K,T,n.id]),A(()=>{if(!T)return;const r=window.setInterval(()=>K(!0),15e3);return()=>window.clearInterval(r)},[T,K]),A(()=>{const r=G.current,c=()=>it(r),I=()=>c(),U=()=>{document.visibilityState==="hidden"&&c()};return window.addEventListener("pagehide",I),window.addEventListener("beforeunload",I),document.addEventListener("visibilitychange",U),()=>{window.removeEventListener("pagehide",I),window.removeEventListener("beforeunload",I),document.removeEventListener("visibilitychange",U),c()}},[]);const Se=()=>{const r=O.current;r&&(r.paused?r.play().catch(()=>{}):r.pause())},ke=`${n.title} — ${n.artists}`,Ne=e(S,{children:[e("div",{className:a.playerButtons,children:[e("button",{className:a.playerBtn,onClick:()=>b(-1),"aria-label":"Previous track",children:e(f,{name:"step-backward"})}),e("button",{className:`${a.playerBtn} ${a.playBtn}`,onClick:Se,"aria-label":T?"Pause":"Play",children:T?e(f,{name:"pause"}):e(f,{name:"play"})}),e("button",{className:a.playerBtn,onClick:()=>b(1),"aria-label":"Next track",children:e(f,{name:"step-forward"})}),V&&e("button",{className:a.playerBtn,onClick:Q,title:"Retry playback","aria-label":"Retry playback",children:e(f,{name:"redo"})})]}),e("div",{className:a.seekRow,children:[e("span",{className:a.timeLabel,children:Ue(F)}),e("input",{className:a.seekBar,type:"range",min:0,max:Z||0,step:.1,value:Math.min(F,Z||0),onChange:r=>{const c=O.current;!c||!Number.isFinite(c.duration)||(c.currentTime=parseFloat(r.target.value),ae(c.currentTime))},onPointerDown:()=>{me.current=!0},onPointerUp:()=>{me.current=!1},style:{"--played-percent":`${Z>0?F/Z*100:0}%`},"aria-label":"Seek"}),e("span",{className:a.timeLabel,children:Ue(Z)}),h&&!V&&e("span",{className:a.timeLabel,children:"loading…"})]})]}),xe=e(S,{children:[e($e,{id:n.id,thumbnails:n.thumbnails}),e("div",{className:a.playerInfo,children:[e("p",{className:a.playerTitle,title:ke,children:ke}),e("p",{className:a.playerTrack,children:n.artists})]}),e("div",{className:a.playerControls,children:Ne}),e("div",{className:a.playerRight,children:[N===0?e(f,{name:"volume-mute",className:a.volumeIcon}):N<.5?e(f,{name:"volume-down",className:a.volumeIcon}):e(f,{name:"volume-up",className:a.volumeIcon}),e("input",{className:a.volumeBar,type:"range",min:0,max:1,step:.01,value:N,onChange:r=>{const c=parseFloat(r.target.value);re(c),localStorage.setItem("musicVolume",String(c))},style:{"--volume-percent":`${N*100}%`},"aria-label":"Volume"})]}),e("div",{className:a.playerActions,children:[E&&ie&&e("button",{className:`${a.playerBtn} ${_?a.playerBtnActive:""}`,onClick:ie,disabled:de,title:_?"Remove from Liked Music":"Add to Liked Music","aria-label":_?"Remove from Liked Music":"Add to Liked Music","aria-pressed":!!_,children:e(f,{name:"heart"})}),e("button",{className:`${a.playerBtn} ${s?a.playerBtnActive:""}`,onClick:l,title:s?"Shuffle on":"Shuffle off","aria-label":"Toggle shuffle","aria-pressed":s,children:e(f,{name:"shuffle"})}),e("button",{className:`${a.playerBtn} ${z?a.playerBtnActive:""}`,onClick:()=>{oe(r=>(localStorage.setItem("musicAutoplay",String(!r)),!r))},title:z?"Autoplay on: next track plays automatically":"Autoplay off","aria-label":"Toggle autoplay","aria-pressed":z,children:e(f,{name:"forward"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(n.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":"Open in YouTube Music",className:a.playerBtn,style:{display:"inline-flex",alignItems:"center"},children:e(f,{name:"external-link-alt"})}),e("button",{className:a.playerBtn,onClick:w,"aria-label":"Close player",children:e(f,{name:"times"})})]})]});return tt(e(S,{children:[e("audio",{ref:O,preload:"none",onPlay:()=>{se(!0),v(!1),B(!1),D.current=0,q()},onPause:()=>se(!1),onWaiting:()=>{V||v(!0)},onPlaying:()=>{v(!1),D.current=0,q()},onTimeUpdate:r=>{const c=r.target.currentTime;W.current=c,q(),me.current||ae(c)},onStalled:()=>{be()},onLoadedMetadata:r=>{const c=r.target.duration;Number.isFinite(c)&&J(c)},onDurationChange:r=>{const c=r.target.duration;Number.isFinite(c)&&J(c)},onError:()=>{be()},onEnded:()=>{k.current&&b(1)}}),e("div",{className:a.playerBar,children:xe})]}),document.body)},lt=()=>e("div",{style:{marginTop:"0.9rem",paddingTop:"0.9rem",borderTop:"1px dashed var(--border-color)"},children:[e("h4",{style:{margin:"0 0 0.35rem",fontSize:"0.95rem"},children:"Where to get the cookie"}),e("p",{style:{margin:"0 0 0.6rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Google marks its login cookies unreadable to page scripts, so this has to come from DevTools — it takes about 20 seconds:"}),e("ol",{style:{margin:"0 0 0.75rem",paddingLeft:"1.25rem",fontSize:"0.85rem",color:"var(--text-secondary)",display:"grid",gap:"0.3rem"},children:[e("li",{children:["Open"," ",e("a",{href:"https://music.youtube.com/",target:"_blank",rel:"noopener noreferrer",children:"music.youtube.com"})," ","and make sure you are logged in."]}),e("li",{children:["Press ",e("kbd",{children:"F12"}),", go to the ",e("strong",{children:"Network"})," tab, and type ",e("kbd",{children:"browse"})," ","in the filter box."]}),e("li",{children:["Click any ",e("kbd",{children:"POST"})," browse entry, then scroll to Request Headers."]}),e("li",{children:[e("strong",{children:"Right-click"})," the ",e("kbd",{children:"Cookie"})," value and choose"," ",e("strong",{children:"Copy value"})," — right-click copies the full unwrapped value, selecting the text by hand truncates it."]}),e("li",{children:"Paste it into the sign-in box above and press Sign in."})]})]}),ge=300*1e3,ut=()=>{const n=H();return ne({...n.music.authStatus.queryOptions(),staleTime:30*1e3,refetchInterval:s=>s.state.data?.authenticated?!1:3e3,retry:1})},dt=()=>{const n=H(),s=Ae();return Ee(n.music.authStart.mutationOptions({onSuccess:(l,b)=>{localStorage.setItem("ytmusic_cookie",b.cookie??""),s.invalidateQueries(n.music.pathFilter())}}))},mt=()=>{const n=H(),s=Ae();return Ee(n.music.signOut.mutationOptions({onSuccess:()=>{s.invalidateQueries(n.music.pathFilter())}}))},ht=n=>{const s=H();return ne({...s.music.search.queryOptions({q:n}),enabled:n.trim().length>0,staleTime:ge,retry:1})},pt=n=>{const s=H();return ne({...s.music.library.queryOptions(),enabled:n,staleTime:ge,retry:1})},gt=n=>{const s=H();return ne({...s.music.track.queryOptions({id:n||void 0}),enabled:!!n,staleTime:ge,retry:1})},ft=n=>{const s=H();return ne({...s.music.playlist.queryOptions({id:n||void 0}),enabled:!!n,staleTime:ge,retry:1})},yt=n=>{const s=H();return ne({...s.music.upnext.queryOptions({id:n||void 0}),enabled:!!n,staleTime:ge,retry:1})},bt=n=>{const s=H();return ne({...s.music.likes.queryOptions(),enabled:n,staleTime:120*1e3,retry:1})},vt=()=>{const n=H(),s=Ae();return Ee(n.music.like.mutationOptions({onSuccess:()=>{s.invalidateQueries(n.music.pathFilter())}}))},kt="_authRow_10tvv_1",Nt="_btn_10tvv_9",wt="_btnGhost_10tvv_42",St="_cookieForm_10tvv_74",xt="_cookieInput_10tvv_83",Tt="_link_10tvv_99",Lt="_contentLayout_10tvv_109",Mt="_mainCol_10tvv_116",_t="_upnextAside_10tvv_120",Ct="_upnextHeader_10tvv_131",Rt="_upnextTitle_10tvv_139",It="_upnextActions_10tvv_149",Pt="_nowPlayingLabel_10tvv_156",$t="_nowPlayingWrap_10tvv_168",At="_likeBtn_10tvv_172",Et="_likeActive_10tvv_196",g={authRow:kt,btn:Nt,btnGhost:wt,cookieForm:St,cookieInput:xt,link:Tt,contentLayout:Lt,mainCol:Mt,upnextAside:_t,upnextHeader:Ct,upnextTitle:Rt,upnextActions:It,nowPlayingLabel:Pt,nowPlayingWrap:$t,likeBtn:At,likeActive:Et};function He(n){const s=n.trim();if(!s)return null;const l=s.match(/[?&]v=([A-Za-z0-9_-]{11})/)?.[1]??s.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)?.[1]??null;return l||(/^[A-Za-z0-9_-]{11}$/.test(s)?s:null)}const Ot="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Yt=()=>{const[n,s]=nt(),l=He(n.get("v")??""),[b,x]=y(()=>n.get("q")??""),w=n.get("q")??"";A(()=>{x(w)},[w]);const[_,E]=y(()=>{try{return localStorage.getItem("ytmusic_cookie")??""}catch{return""}}),[de,ie]=y(!1),[O,me]=y(()=>localStorage.getItem("musicShuffle")==="true"),[T,se]=y(()=>localStorage.getItem("musicRadio")!=="false"),[h,v]=y(null),[V,B]=y([]),[F,ae]=y(null),[Z,J]=y({}),N=R([]);N.current=V;const re=R(null);re.current=h;const z=R(!1),oe=R(new Set),{data:L}=ut(),k=dt(),W=mt(),D=typeof navigator<"u"?navigator.userAgent:"",Y=/android/i.test(D),G=/firefox|fxios/i.test(D)&&!Y,fe=!G&&!Y&&/chrome|chromium|edg|brave/i.test(D),q=G||fe,ce=()=>{if(de)return;ie(!0);const t=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,i=window.setTimeout(()=>{window.removeEventListener("dango:ytmusic-cookie",o),ie(!1),$.error("Helper not detected — install the Dango Helper extension first.")},3e3),o=d=>{let m;try{m=JSON.parse(d.detail)}catch{return}if(!(!m||m.requestId!==t))if(window.clearTimeout(i),window.removeEventListener("dango:ytmusic-cookie",o),ie(!1),m?.ok&&m.cookie){const u=m.cookie.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(u.includes("…")||u.includes("...")){$.error(`Helper returned a truncated cookie (${u.length} chars) — reload music.youtube.com and Extract again.`);return}E(u),$.success("Cookie extracted from helper — signing in…"),k.mutate({cookie:u})}else m?.error==="NO_COOKIE"?$.error("Helper found no YouTube login — log in on a music.youtube.com tab first."):$.error("Helper request failed — try again.")};window.addEventListener("dango:ytmusic-cookie",o),window.dispatchEvent(new CustomEvent("dango:get-ytmusic-cookie",{detail:{requestId:t}}))},{data:ye,isLoading:be}=ht(w),{data:Q,isLoading:ve,isFetching:K,error:Se,refetch:ke}=pt(L?.authenticated===!0),{data:Ne,isLoading:xe}=ft(F?.id??null),{data:Te,isLoading:r}=yt(h?.id??null),{data:c}=bt(L?.authenticated===!0),I=vt(),U=j(()=>ye?.tracks||[],[ye]),Le=j(()=>Q?.playlists||[],[Q]),P=j(()=>Q?.tracks||[],[Q]),X=j(()=>Ne?.tracks||[],[Ne]),M=j(()=>{const t=Te?.tracks||[];return h?t.filter(i=>i.id!==h.id):t},[Te,h]),Ge=j(()=>new Set(c?.likedIds||[]),[c]),Me=t=>Z[t.id]??(Ge.has(t.id)||t.liked===!0);A(()=>{L?.authenticated!==!0&&J({})},[L?.authenticated]);const Qe=j(()=>[...U,...X,...P,...M],[U,X,P,M]),Ve=l&&h?.id!==l&&!Qe.some(t=>t.id===l)?l:null,{data:Oe}=gt(Ve),_e=h?.id;A(()=>{document.title=h?`${h.title} - dango`:"Music - dango"},[h]),A(()=>{if(!l){_e&&v(null);return}if(_e===l)return;const t=d=>{const m=d.find(u=>u.id===l);return m?(v(m),B(u=>u.some(le=>le.id===l)?u:d.length>0?d:[m]),!0):!1};if(t(U)||t(X)||t(P))return;const i=M.find(d=>d.id===l);if(i){v(i),B(d=>d.some(m=>m.id===i.id)?d:[i]);return}const o=Oe?.track;o&&o.id===l&&(v(o),B(d=>d.some(m=>m.id===o.id)?d:[o]))},[l,_e,U,X,P,M,Oe]);const ee=t=>{s(i=>{const o=new URLSearchParams(i);return t?o.set("v",t):o.delete("v"),o})},Ce=(t,i)=>{oe.current.delete(t.id),v(t),B(i.length>0?i:[t]),ee(t.id)},We=t=>{oe.current.add(t.id),$.error(`Couldn't play “${t.title}” — skipped.`)},je=async()=>{if(z.current)return;const t=N.current,i=t[t.length-1]??re.current;if(i){z.current=!0;try{const o=await Pe.music.upnext.query({id:i.id}),d=new Set(t.map(u=>u.id)),m=(o.tracks||[]).filter(u=>!d.has(u.id)&&!oe.current.has(u.id));if(m.length===0){const u=N.current[0];u&&(v(u),ee(u.id));return}B([...N.current,...m]),v(m[0]),ee(m[0].id)}catch{const o=N.current[0];o&&(v(o),ee(o.id))}finally{z.current=!1}}},Ze=t=>{const i=N.current,o=re.current;if(!o||i.length===0)return;const d=i.findIndex(C=>C.id===o.id);if(t>0&&T&&(d<0||d===i.length-1)){je();return}const m=C=>oe.current.has(C.id),u=i.length;let le;if(O&&u>1){let C=Math.floor(Math.random()*u);for(let Re=0;Re<u&&(C===d||m(i[C]));Re++)C=Math.floor(Math.random()*u);le=i[C]}else{const C=t>0?1:-1;let we=(((d<0?C>0?-1:0:d)+C)%u+u)%u;for(let De=1;De<u&&m(i[we]);De++)we=((we+C)%u+u)%u;le=i[we]}v(le),ee(le.id)},Je=()=>{if(T){se(!1),localStorage.setItem("musicRadio","false");return}const t=re.current;if(!t)return;if(M.length===0){$.error("No radio suggestions for this song yet.");return}const i=new Set,o=[];for(const d of[t,...M])i.has(d.id)||(i.add(d.id),o.push(d));se(!0),localStorage.setItem("musicRadio","true"),B(o),$.success(`Radio started — ${M.length} songs queued.`)},Be=t=>{if(L?.authenticated!==!0){$.error("Sign in to like songs.");return}const i=!Me(t);J(o=>({...o,[t.id]:i})),I.mutate({id:t.id,like:i},{onError:()=>{J(o=>{const d={...o};return delete d[t.id],d}),$.error("Like action failed — try again.")}})},Ke=()=>{me(t=>(localStorage.setItem("musicShuffle",String(!t)),!t))},Xe=t=>e("button",{className:p.stationRow,onClick:()=>ae(t),"aria-label":`Open ${t.title}`,children:[e($e,{id:t.id,thumbnails:t.thumbnails}),e("span",{className:p.stationMeta,children:[e("span",{className:p.stationName,children:t.title}),t.subtitle&&e("span",{className:p.stationSub,children:t.subtitle})]})]},t.id),he=(t,i,o)=>{const d=h?.id===t.id,m=Me(t),u=[t.album,t.duration].filter(Boolean).join(" · ");return e("div",{className:`${p.stationRow} ${d?p.stationRowActive:""}`,style:{cursor:"default"},children:[e("button",{onClick:()=>o?o(t):Ce(t,i),className:p.stationRow,style:{flex:1,minWidth:0,background:"transparent",border:0,padding:0},"aria-label":`Play ${t.title}`,children:[e($e,{id:t.id,thumbnails:t.thumbnails}),e("span",{className:p.stationMeta,children:[e("span",{className:p.stationName,children:t.title}),e("span",{className:p.stationSub,children:[t.artists,u?` · ${u}`:""]})]})]}),L?.authenticated===!0&&e("button",{className:`${g.likeBtn} ${m?g.likeActive:""}`,onClick:()=>Be(t),disabled:I.isPending,title:m?"Remove from Liked Music":"Add to Liked Music","aria-label":m?`Remove ${t.title} from Liked Music`:`Add ${t.title} to Liked Music`,"aria-pressed":m,children:e(f,{name:"heart"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(t.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":`Open ${t.title} in YouTube Music`,style:{padding:8,color:"inherit",opacity:.7,flexShrink:0},children:e(f,{name:"external-link-alt"})})]},t.id)},Fe=j(()=>{if(!h)return M;const t=new Set,i=[];for(const o of[h,...M])t.has(o.id)||(t.add(o.id),i.push(o));return i},[h,M]),et=t=>{Ce(t,Fe)};return e("div",{className:`${te.page} ${h?te.pageWithPlayer:""}`,children:[e("div",{className:te.header,children:[e("h1",{className:te.pageTitle,children:[e(f,{name:"headphones"})," Music"]}),e("form",{className:te.searchForm,onSubmit:t=>{t.preventDefault();const i=He(b);if(i)ee(i);else{const o=b.trim();s(d=>{const m=new URLSearchParams(d);return o?m.set("q",o):m.delete("q"),m})}},children:[e("input",{className:te.searchInput,value:b,onChange:t=>x(t.target.value),placeholder:"Search YouTube Music…","aria-label":"Search music"}),e("button",{className:te.searchBtn,type:"submit","aria-label":"Search",children:e(f,{name:"search"})})]})]}),e("div",{className:g.authRow,children:[L?.authenticated?e(S,{children:[e("span",{className:a.statusMsg,children:["Signed in to YouTube Music",Q&&` — ${Q.tracks.length} songs, ${Q.playlists.length} playlists`]}),e("button",{className:g.btnGhost,onClick:()=>W.mutate(),disabled:W.isPending,children:"Sign out"})]}):e(S,{children:[e("form",{onSubmit:t=>{t.preventDefault();const i=_.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(i){if(i.includes("…")||i.includes("...")){$.error("That cookie is truncated (contains …). Right-click the Cookie header → Copy value, not the wrapped preview.");return}i!==_&&E(i),k.mutate({cookie:i})}},className:g.cookieForm,children:[e("input",{className:g.cookieInput,value:_,onChange:t=>E(t.target.value),placeholder:"Paste music.youtube.com Cookie header…","aria-label":"YouTube Music cookie",type:"password"}),e("button",{className:g.btn,type:"submit",disabled:k.isPending||!_.trim(),children:k.isPending?"Checking…":"Sign in"}),q&&e("button",{className:g.btnGhost,type:"button",onClick:ce,disabled:de||k.isPending,title:"Read the YouTube Music cookie via the Dango Helper extension (same zip as AnimePahe/JapaneseASMR)",children:de?"Extracting…":"Extract from helper"})]}),q&&e("p",{className:a.statusMsg,children:["Two ways to sign in: paste the Cookie header manually (steps below), or download"," ",e("a",{href:Ot,target:"_blank",rel:"noreferrer",className:g.link,children:"dango-extension.zip"})," ","then"," ",G?e(S,{children:[e("code",{children:"about:debugging"})," → ",e("strong",{children:"This Firefox"})," →"," ",e("strong",{children:"Load Temporary Add-on"})," →"," ",e("code",{children:"dango-extension/firefox/manifest.json"})]}):e(S,{children:[e("code",{children:"chrome://extensions"})," → ",e("strong",{children:"Developer mode"})," →"," ",e("strong",{children:"Load unpacked"})," → ",e("code",{children:"dango-extension/chrome"})]}),", log in on a music.youtube.com tab, and click Extract."]}),e(lt,{})]}),k.isSuccess&&e("p",{className:a.statusMsg,children:["Signed in — found ",k.data.tracks," songs and ",k.data.playlists," ","playlists."]}),k.isError&&e("p",{className:a.statusMsg,children:k.error?.message||"Sign-in failed. Paste a fresh Cookie header from music.youtube.com."}),!L?.authenticated&&!k.isError&&!k.isSuccess&&e("p",{className:a.statusMsg,children:"Sign in with your YouTube Music cookie to see your library. Search and playback work without sign-in."})]}),e("div",{className:h?g.contentLayout:void 0,children:[e("div",{className:g.mainCol,children:w?e(S,{children:[e("h2",{className:p.sectionTitle,children:["Results for “",w,"”"]}),be?e("p",{className:a.statusMsg,children:"Searching…"}):U.length===0?e("p",{className:a.statusMsg,children:"No tracks found."}):e("div",{className:p.stationList,children:U.map(t=>he(t,U))})]}):L?.authenticated?e(S,{children:[e("h2",{className:p.sectionTitle,children:"Your library"}),ve?e("p",{className:a.statusMsg,children:"Loading library…"}):Le.length===0&&P.length===0&&!F?e(S,{children:[e("p",{className:a.statusMsg,children:Se?"Library failed to load.":"Your library came back empty — YouTube sometimes drops the saved session."}),e("div",{style:{marginBottom:8},children:e("button",{className:g.btnGhost,onClick:()=>{ke()},disabled:K,"aria-label":"Retry loading library",children:K?"Retrying…":"Retry"})}),e("p",{className:a.statusMsg,children:"If it keeps happening, sign out and paste a fresh cookie."})]}):e(S,{children:[Le.length>0&&!F&&e(S,{children:[e("h3",{className:p.sectionTitle,children:"Playlists"}),e("div",{className:p.stationList,children:Le.map(t=>Xe(t))})]}),P.length>0&&!F&&e(S,{children:[e("h3",{className:p.sectionTitle,children:["Liked songs (",P.length,")"]}),e("div",{style:{marginBottom:8},children:e("button",{className:g.btnGhost,onClick:()=>Ce(P[0],P),"aria-label":"Play all liked songs",children:[e(f,{name:"play"})," Play all"]})}),e("div",{className:p.stationList,children:P.map(t=>he(t,P))})]}),F?e(S,{children:[e("button",{className:g.btnGhost,onClick:()=>ae(null),style:{marginBottom:8},children:"← Back to library"}),e("h3",{className:p.sectionTitle,children:F.title}),xe?e("p",{className:a.statusMsg,children:"Loading playlist…"}):X.length===0?e("p",{className:a.statusMsg,children:"No tracks in this playlist."}):e("div",{className:p.stationList,children:X.map(t=>he(t,X))})]}):null]})]}):e("p",{className:a.statusMsg,children:"Search above, or sign in to see your library."})}),h&&e("aside",{className:g.upnextAside,"aria-label":"Up next",children:[e("div",{className:g.upnextHeader,children:e("span",{className:g.upnextTitle,children:[e(f,{name:"list-ul"})," Up Next"]})}),e("div",{className:g.nowPlayingWrap,children:[e("p",{className:g.nowPlayingLabel,children:"Now playing"}),he(h,V.length>0?V:[h])]}),e("div",{className:g.upnextActions,children:e("button",{className:g.btnGhost,onClick:Je,disabled:!T&&(r||M.length===0),"aria-pressed":T,title:T?"Stop the radio — the queue will loop instead of fetching more songs":"Queue these suggestions after the current song and keep the mix going",children:T?"Stop radio":"Start radio"})}),r?e("p",{className:a.statusMsg,children:"Loading suggestions…"}):M.length===0?e("p",{className:a.statusMsg,children:"No suggestions for this song."}):e("div",{className:p.stationList,children:M.map(t=>he(t,Fe,et))})]})]}),h&&e(ct,{track:h,queue:V,shuffle:O,onToggleShuffle:Ke,onTrackStep:Ze,onTrackFailed:We,onClose:()=>{v(null),ee(null)},liked:h?Me(h):!1,likeVisible:L?.authenticated===!0,likePending:I.isPending,onToggleLike:()=>Be(h)})]})};export{Yt as default};
|
|
1
|
+
import{d as y,h as A,u as e,A as R,g as Ie,S,$ as tt,p as nt,T as j}from"./vendor-core-DfaOB3Rn.js";import{t as Pe,O as it,h as H,z as $}from"./index-CfgPGaUO.js";import{I as f}from"./vendor-icons-DrybRNxP.js";import{r as p}from"./Radio.module-DGSZLpKM.js";import{a}from"./Asmr.module-CdWlioTY.js";import{b as ne,u as Ae,a as Ee}from"./vendor-query-BBT5_sHx.js";import{p as te}from"./page.module-C1MlZzf3.js";const pe=new Set,ue=new Map,qe=n=>`/api/image-proxy?url=${encodeURIComponent(n)}&strict=1`,ze=n=>/googleusercontent\.com/.test(n)?n.replace(/=w\d+-h\d+(?:-l\d+)?(?:-rj)?$/,"=w544-h544-l90-rj"):n,Ye=/^[A-Za-z0-9_-]{11}$/;function st(n,s){const l=[],b=n?ue.get(n):void 0;b&&!pe.has(b)&&l.push(b);for(const x of s??[]){if(!x?.url)continue;const w=qe(ze(x.url));pe.has(w)||l.includes(w)||l.push(w)}if(n&&Ye.test(n)){const x=qe(`https://i.ytimg.com/vi/${n}/hqdefault.jpg`);!pe.has(x)&&!l.includes(x)&&l.push(x)}return l}function at(n,s){const l=s?.[0]?.url;return l?ze(l):n&&Ye.test(n)?`https://i.ytimg.com/vi/${n}/hqdefault.jpg`:""}function rt(n,s){!n||pe.has(s)||(ue.set(n,s),ue.size>500&&ue.clear())}function ot(n){pe.add(n);for(const[s,l]of ue)l===n&&ue.delete(s)}function $e({id:n,thumbnails:s}){const[l,b]=y(0),[x,w]=y(!1);A(()=>{b(0),w(!1)},[n]);const _=st(n,s),E=_[l];return x||!E?e("span",{className:p.stationThumbPlaceholder,children:e(f,{name:"headphones"})}):e("img",{src:E,alt:"",className:p.stationThumb,loading:"lazy",decoding:"async",onLoad:()=>rt(n,E),onError:()=>{ot(E),l+1<_.length?b(l+1):w(!0)}})}function Ue(n){if(!Number.isFinite(n)||n<0)return"0:00";const s=Math.floor(n/60),l=Math.floor(n%60);return`${s}:${String(l).padStart(2,"0")}`}const ct=({track:n,shuffle:s,onToggleShuffle:l,onTrackStep:b,onTrackFailed:x,onClose:w,liked:_,likeVisible:E,likePending:de,onToggleLike:ie})=>{const O=R(null),me=R(!1),[T,se]=y(!1),[h,v]=y(!0),[V,B]=y(!1),[F,ae]=y(0),[Z,J]=y(0),[N,re]=y(()=>{const r=parseFloat(localStorage.getItem("musicVolume")||"");return Number.isFinite(r)?r:1}),[z,oe]=y(()=>localStorage.getItem("musicAutoplay")!=="false"),L=R(N);L.current=N;const k=R(z);k.current=z;const W=R(0),D=R(0),Y=R(null),G=R("");G.current||(G.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`music-${Date.now()}-${Math.random().toString(36).slice(2)}`);const fe=`/api/music/audio?videoId=${encodeURIComponent(n.id)}`,q=Ie.useCallback(()=>{Y.current&&(window.clearTimeout(Y.current),Y.current=null)},[]),ce=Ie.useCallback(r=>{const c=O.current;if(!c)return;q(),v(!0),B(!1);const I=()=>{if(c.removeEventListener("loadedmetadata",I),r>5&&Number.isFinite(c.duration)&&r<c.duration-5)try{c.currentTime=r}catch{}};c.addEventListener("loadedmetadata",I),c.src=fe,c.load(),c.volume=L.current,c.play().catch(()=>{})},[fe,q]),ye=()=>{v(!1),B(!0),x?.(n),k.current&&b(1)},be=()=>{if(!Y.current){if(D.current>=3){ye();return}D.current+=1,Y.current=window.setTimeout(()=>{Y.current=null,ce(W.current)},5e3)}},Q=()=>{D.current=0,ce(W.current)};A(()=>{W.current=0,D.current=0,se(!1),ae(0),J(0);const r=O.current;return ce(W.current),()=>{q(),r&&r.removeAttribute("src")}},[ce,q]),A(()=>{const r=O.current;r&&(r.volume=N)},[N]),A(()=>(document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")),[]);const ve=at(n.id,n.thumbnails),K=Ie.useCallback(r=>{const c=O.current;Pe.discord.musicPresence.mutate({title:n.title,artistLabel:n.artists,isPlaying:r,thumbnail:ve||"",currentTime:c?.currentTime??0,duration:Number.isFinite(c?.duration??NaN)?c?.duration:0,sessionId:G.current}).catch(()=>{}),Pe.discord.heartbeat.mutate({sessionId:G.current}).catch(()=>{})},[n,ve]);A(()=>{K(T)},[K,T,n.id]),A(()=>{if(!T)return;const r=window.setInterval(()=>K(!0),15e3);return()=>window.clearInterval(r)},[T,K]),A(()=>{const r=G.current,c=()=>it(r),I=()=>c(),U=()=>{document.visibilityState==="hidden"&&c()};return window.addEventListener("pagehide",I),window.addEventListener("beforeunload",I),document.addEventListener("visibilitychange",U),()=>{window.removeEventListener("pagehide",I),window.removeEventListener("beforeunload",I),document.removeEventListener("visibilitychange",U),c()}},[]);const Se=()=>{const r=O.current;r&&(r.paused?r.play().catch(()=>{}):r.pause())},ke=`${n.title} — ${n.artists}`,Ne=e(S,{children:[e("div",{className:a.playerButtons,children:[e("button",{className:a.playerBtn,onClick:()=>b(-1),"aria-label":"Previous track",children:e(f,{name:"step-backward"})}),e("button",{className:`${a.playerBtn} ${a.playBtn}`,onClick:Se,"aria-label":T?"Pause":"Play",children:T?e(f,{name:"pause"}):e(f,{name:"play"})}),e("button",{className:a.playerBtn,onClick:()=>b(1),"aria-label":"Next track",children:e(f,{name:"step-forward"})}),V&&e("button",{className:a.playerBtn,onClick:Q,title:"Retry playback","aria-label":"Retry playback",children:e(f,{name:"redo"})})]}),e("div",{className:a.seekRow,children:[e("span",{className:a.timeLabel,children:Ue(F)}),e("input",{className:a.seekBar,type:"range",min:0,max:Z||0,step:.1,value:Math.min(F,Z||0),onChange:r=>{const c=O.current;!c||!Number.isFinite(c.duration)||(c.currentTime=parseFloat(r.target.value),ae(c.currentTime))},onPointerDown:()=>{me.current=!0},onPointerUp:()=>{me.current=!1},style:{"--played-percent":`${Z>0?F/Z*100:0}%`},"aria-label":"Seek"}),e("span",{className:a.timeLabel,children:Ue(Z)}),h&&!V&&e("span",{className:a.timeLabel,children:"loading…"})]})]}),xe=e(S,{children:[e($e,{id:n.id,thumbnails:n.thumbnails}),e("div",{className:a.playerInfo,children:[e("p",{className:a.playerTitle,title:ke,children:ke}),e("p",{className:a.playerTrack,children:n.artists})]}),e("div",{className:a.playerControls,children:Ne}),e("div",{className:a.playerRight,children:[N===0?e(f,{name:"volume-mute",className:a.volumeIcon}):N<.5?e(f,{name:"volume-down",className:a.volumeIcon}):e(f,{name:"volume-up",className:a.volumeIcon}),e("input",{className:a.volumeBar,type:"range",min:0,max:1,step:.01,value:N,onChange:r=>{const c=parseFloat(r.target.value);re(c),localStorage.setItem("musicVolume",String(c))},style:{"--volume-percent":`${N*100}%`},"aria-label":"Volume"})]}),e("div",{className:a.playerActions,children:[E&&ie&&e("button",{className:`${a.playerBtn} ${_?a.playerBtnActive:""}`,onClick:ie,disabled:de,title:_?"Remove from Liked Music":"Add to Liked Music","aria-label":_?"Remove from Liked Music":"Add to Liked Music","aria-pressed":!!_,children:e(f,{name:"heart"})}),e("button",{className:`${a.playerBtn} ${s?a.playerBtnActive:""}`,onClick:l,title:s?"Shuffle on":"Shuffle off","aria-label":"Toggle shuffle","aria-pressed":s,children:e(f,{name:"shuffle"})}),e("button",{className:`${a.playerBtn} ${z?a.playerBtnActive:""}`,onClick:()=>{oe(r=>(localStorage.setItem("musicAutoplay",String(!r)),!r))},title:z?"Autoplay on: next track plays automatically":"Autoplay off","aria-label":"Toggle autoplay","aria-pressed":z,children:e(f,{name:"forward"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(n.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":"Open in YouTube Music",className:a.playerBtn,style:{display:"inline-flex",alignItems:"center"},children:e(f,{name:"external-link-alt"})}),e("button",{className:a.playerBtn,onClick:w,"aria-label":"Close player",children:e(f,{name:"times"})})]})]});return tt(e(S,{children:[e("audio",{ref:O,preload:"none",onPlay:()=>{se(!0),v(!1),B(!1),D.current=0,q()},onPause:()=>se(!1),onWaiting:()=>{V||v(!0)},onPlaying:()=>{v(!1),D.current=0,q()},onTimeUpdate:r=>{const c=r.target.currentTime;W.current=c,q(),me.current||ae(c)},onStalled:()=>{be()},onLoadedMetadata:r=>{const c=r.target.duration;Number.isFinite(c)&&J(c)},onDurationChange:r=>{const c=r.target.duration;Number.isFinite(c)&&J(c)},onError:()=>{be()},onEnded:()=>{k.current&&b(1)}}),e("div",{className:a.playerBar,children:xe})]}),document.body)},lt=()=>e("div",{style:{marginTop:"0.9rem",paddingTop:"0.9rem",borderTop:"1px dashed var(--border-color)"},children:[e("h4",{style:{margin:"0 0 0.35rem",fontSize:"0.95rem"},children:"Where to get the cookie"}),e("p",{style:{margin:"0 0 0.6rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Google marks its login cookies unreadable to page scripts, so this has to come from DevTools — it takes about 20 seconds:"}),e("ol",{style:{margin:"0 0 0.75rem",paddingLeft:"1.25rem",fontSize:"0.85rem",color:"var(--text-secondary)",display:"grid",gap:"0.3rem"},children:[e("li",{children:["Open"," ",e("a",{href:"https://music.youtube.com/",target:"_blank",rel:"noopener noreferrer",children:"music.youtube.com"})," ","and make sure you are logged in."]}),e("li",{children:["Press ",e("kbd",{children:"F12"}),", go to the ",e("strong",{children:"Network"})," tab, and type ",e("kbd",{children:"browse"})," ","in the filter box."]}),e("li",{children:["Click any ",e("kbd",{children:"POST"})," browse entry, then scroll to Request Headers."]}),e("li",{children:[e("strong",{children:"Right-click"})," the ",e("kbd",{children:"Cookie"})," value and choose"," ",e("strong",{children:"Copy value"})," — right-click copies the full unwrapped value, selecting the text by hand truncates it."]}),e("li",{children:"Paste it into the sign-in box above and press Sign in."})]})]}),ge=300*1e3,ut=()=>{const n=H();return ne({...n.music.authStatus.queryOptions(),staleTime:30*1e3,refetchInterval:s=>s.state.data?.authenticated?!1:3e3,retry:1})},dt=()=>{const n=H(),s=Ae();return Ee(n.music.authStart.mutationOptions({onSuccess:(l,b)=>{localStorage.setItem("ytmusic_cookie",b.cookie??""),s.invalidateQueries(n.music.pathFilter())}}))},mt=()=>{const n=H(),s=Ae();return Ee(n.music.signOut.mutationOptions({onSuccess:()=>{s.invalidateQueries(n.music.pathFilter())}}))},ht=n=>{const s=H();return ne({...s.music.search.queryOptions({q:n}),enabled:n.trim().length>0,staleTime:ge,retry:1})},pt=n=>{const s=H();return ne({...s.music.library.queryOptions(),enabled:n,staleTime:ge,retry:1})},gt=n=>{const s=H();return ne({...s.music.track.queryOptions({id:n||void 0}),enabled:!!n,staleTime:ge,retry:1})},ft=n=>{const s=H();return ne({...s.music.playlist.queryOptions({id:n||void 0}),enabled:!!n,staleTime:ge,retry:1})},yt=n=>{const s=H();return ne({...s.music.upnext.queryOptions({id:n||void 0}),enabled:!!n,staleTime:ge,retry:1})},bt=n=>{const s=H();return ne({...s.music.likes.queryOptions(),enabled:n,staleTime:120*1e3,retry:1})},vt=()=>{const n=H(),s=Ae();return Ee(n.music.like.mutationOptions({onSuccess:()=>{s.invalidateQueries(n.music.pathFilter())}}))},kt="_authRow_10tvv_1",Nt="_btn_10tvv_9",wt="_btnGhost_10tvv_42",St="_cookieForm_10tvv_74",xt="_cookieInput_10tvv_83",Tt="_link_10tvv_99",Lt="_contentLayout_10tvv_109",Mt="_mainCol_10tvv_116",_t="_upnextAside_10tvv_120",Ct="_upnextHeader_10tvv_131",Rt="_upnextTitle_10tvv_139",It="_upnextActions_10tvv_149",Pt="_nowPlayingLabel_10tvv_156",$t="_nowPlayingWrap_10tvv_168",At="_likeBtn_10tvv_172",Et="_likeActive_10tvv_196",g={authRow:kt,btn:Nt,btnGhost:wt,cookieForm:St,cookieInput:xt,link:Tt,contentLayout:Lt,mainCol:Mt,upnextAside:_t,upnextHeader:Ct,upnextTitle:Rt,upnextActions:It,nowPlayingLabel:Pt,nowPlayingWrap:$t,likeBtn:At,likeActive:Et};function He(n){const s=n.trim();if(!s)return null;const l=s.match(/[?&]v=([A-Za-z0-9_-]{11})/)?.[1]??s.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)?.[1]??null;return l||(/^[A-Za-z0-9_-]{11}$/.test(s)?s:null)}const Ot="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Yt=()=>{const[n,s]=nt(),l=He(n.get("v")??""),[b,x]=y(()=>n.get("q")??""),w=n.get("q")??"";A(()=>{x(w)},[w]);const[_,E]=y(()=>{try{return localStorage.getItem("ytmusic_cookie")??""}catch{return""}}),[de,ie]=y(!1),[O,me]=y(()=>localStorage.getItem("musicShuffle")==="true"),[T,se]=y(()=>localStorage.getItem("musicRadio")!=="false"),[h,v]=y(null),[V,B]=y([]),[F,ae]=y(null),[Z,J]=y({}),N=R([]);N.current=V;const re=R(null);re.current=h;const z=R(!1),oe=R(new Set),{data:L}=ut(),k=dt(),W=mt(),D=typeof navigator<"u"?navigator.userAgent:"",Y=/android/i.test(D),G=/firefox|fxios/i.test(D)&&!Y,fe=!G&&!Y&&/chrome|chromium|edg|brave/i.test(D),q=G||fe,ce=()=>{if(de)return;ie(!0);const t=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,i=window.setTimeout(()=>{window.removeEventListener("dango:ytmusic-cookie",o),ie(!1),$.error("Helper not detected — install the Dango Helper extension first.")},3e3),o=d=>{let m;try{m=JSON.parse(d.detail)}catch{return}if(!(!m||m.requestId!==t))if(window.clearTimeout(i),window.removeEventListener("dango:ytmusic-cookie",o),ie(!1),m?.ok&&m.cookie){const u=m.cookie.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(u.includes("…")||u.includes("...")){$.error(`Helper returned a truncated cookie (${u.length} chars) — reload music.youtube.com and Extract again.`);return}E(u),$.success("Cookie extracted from helper — signing in…"),k.mutate({cookie:u})}else m?.error==="NO_COOKIE"?$.error("Helper found no YouTube login — log in on a music.youtube.com tab first."):$.error("Helper request failed — try again.")};window.addEventListener("dango:ytmusic-cookie",o),window.dispatchEvent(new CustomEvent("dango:get-ytmusic-cookie",{detail:{requestId:t}}))},{data:ye,isLoading:be}=ht(w),{data:Q,isLoading:ve,isFetching:K,error:Se,refetch:ke}=pt(L?.authenticated===!0),{data:Ne,isLoading:xe}=ft(F?.id??null),{data:Te,isLoading:r}=yt(h?.id??null),{data:c}=bt(L?.authenticated===!0),I=vt(),U=j(()=>ye?.tracks||[],[ye]),Le=j(()=>Q?.playlists||[],[Q]),P=j(()=>Q?.tracks||[],[Q]),X=j(()=>Ne?.tracks||[],[Ne]),M=j(()=>{const t=Te?.tracks||[];return h?t.filter(i=>i.id!==h.id):t},[Te,h]),Ge=j(()=>new Set(c?.likedIds||[]),[c]),Me=t=>Z[t.id]??(Ge.has(t.id)||t.liked===!0);A(()=>{L?.authenticated!==!0&&J({})},[L?.authenticated]);const Qe=j(()=>[...U,...X,...P,...M],[U,X,P,M]),Ve=l&&h?.id!==l&&!Qe.some(t=>t.id===l)?l:null,{data:Oe}=gt(Ve),_e=h?.id;A(()=>{document.title=h?`${h.title} - dango`:"Music - dango"},[h]),A(()=>{if(!l){_e&&v(null);return}if(_e===l)return;const t=d=>{const m=d.find(u=>u.id===l);return m?(v(m),B(u=>u.some(le=>le.id===l)?u:d.length>0?d:[m]),!0):!1};if(t(U)||t(X)||t(P))return;const i=M.find(d=>d.id===l);if(i){v(i),B(d=>d.some(m=>m.id===i.id)?d:[i]);return}const o=Oe?.track;o&&o.id===l&&(v(o),B(d=>d.some(m=>m.id===o.id)?d:[o]))},[l,_e,U,X,P,M,Oe]);const ee=t=>{s(i=>{const o=new URLSearchParams(i);return t?o.set("v",t):o.delete("v"),o})},Ce=(t,i)=>{oe.current.delete(t.id),v(t),B(i.length>0?i:[t]),ee(t.id)},We=t=>{oe.current.add(t.id),$.error(`Couldn't play “${t.title}” — skipped.`)},je=async()=>{if(z.current)return;const t=N.current,i=t[t.length-1]??re.current;if(i){z.current=!0;try{const o=await Pe.music.upnext.query({id:i.id}),d=new Set(t.map(u=>u.id)),m=(o.tracks||[]).filter(u=>!d.has(u.id)&&!oe.current.has(u.id));if(m.length===0){const u=N.current[0];u&&(v(u),ee(u.id));return}B([...N.current,...m]),v(m[0]),ee(m[0].id)}catch{const o=N.current[0];o&&(v(o),ee(o.id))}finally{z.current=!1}}},Ze=t=>{const i=N.current,o=re.current;if(!o||i.length===0)return;const d=i.findIndex(C=>C.id===o.id);if(t>0&&T&&(d<0||d===i.length-1)){je();return}const m=C=>oe.current.has(C.id),u=i.length;let le;if(O&&u>1){let C=Math.floor(Math.random()*u);for(let Re=0;Re<u&&(C===d||m(i[C]));Re++)C=Math.floor(Math.random()*u);le=i[C]}else{const C=t>0?1:-1;let we=(((d<0?C>0?-1:0:d)+C)%u+u)%u;for(let De=1;De<u&&m(i[we]);De++)we=((we+C)%u+u)%u;le=i[we]}v(le),ee(le.id)},Je=()=>{if(T){se(!1),localStorage.setItem("musicRadio","false");return}const t=re.current;if(!t)return;if(M.length===0){$.error("No radio suggestions for this song yet.");return}const i=new Set,o=[];for(const d of[t,...M])i.has(d.id)||(i.add(d.id),o.push(d));se(!0),localStorage.setItem("musicRadio","true"),B(o),$.success(`Radio started — ${M.length} songs queued.`)},Be=t=>{if(L?.authenticated!==!0){$.error("Sign in to like songs.");return}const i=!Me(t);J(o=>({...o,[t.id]:i})),I.mutate({id:t.id,like:i},{onError:()=>{J(o=>{const d={...o};return delete d[t.id],d}),$.error("Like action failed — try again.")}})},Ke=()=>{me(t=>(localStorage.setItem("musicShuffle",String(!t)),!t))},Xe=t=>e("button",{className:p.stationRow,onClick:()=>ae(t),"aria-label":`Open ${t.title}`,children:[e($e,{id:t.id,thumbnails:t.thumbnails}),e("span",{className:p.stationMeta,children:[e("span",{className:p.stationName,children:t.title}),t.subtitle&&e("span",{className:p.stationSub,children:t.subtitle})]})]},t.id),he=(t,i,o)=>{const d=h?.id===t.id,m=Me(t),u=[t.album,t.duration].filter(Boolean).join(" · ");return e("div",{className:`${p.stationRow} ${d?p.stationRowActive:""}`,style:{cursor:"default"},children:[e("button",{onClick:()=>o?o(t):Ce(t,i),className:p.stationRow,style:{flex:1,minWidth:0,background:"transparent",border:0,padding:0},"aria-label":`Play ${t.title}`,children:[e($e,{id:t.id,thumbnails:t.thumbnails}),e("span",{className:p.stationMeta,children:[e("span",{className:p.stationName,children:t.title}),e("span",{className:p.stationSub,children:[t.artists,u?` · ${u}`:""]})]})]}),L?.authenticated===!0&&e("button",{className:`${g.likeBtn} ${m?g.likeActive:""}`,onClick:()=>Be(t),disabled:I.isPending,title:m?"Remove from Liked Music":"Add to Liked Music","aria-label":m?`Remove ${t.title} from Liked Music`:`Add ${t.title} to Liked Music`,"aria-pressed":m,children:e(f,{name:"heart"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(t.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":`Open ${t.title} in YouTube Music`,style:{padding:8,color:"inherit",opacity:.7,flexShrink:0},children:e(f,{name:"external-link-alt"})})]},t.id)},Fe=j(()=>{if(!h)return M;const t=new Set,i=[];for(const o of[h,...M])t.has(o.id)||(t.add(o.id),i.push(o));return i},[h,M]),et=t=>{Ce(t,Fe)};return e("div",{className:`${te.page} ${h?te.pageWithPlayer:""}`,children:[e("div",{className:te.header,children:[e("h1",{className:te.pageTitle,children:[e(f,{name:"headphones"})," Music"]}),e("form",{className:te.searchForm,onSubmit:t=>{t.preventDefault();const i=He(b);if(i)ee(i);else{const o=b.trim();s(d=>{const m=new URLSearchParams(d);return o?m.set("q",o):m.delete("q"),m})}},children:[e("input",{className:te.searchInput,value:b,onChange:t=>x(t.target.value),placeholder:"Search YouTube Music…","aria-label":"Search music"}),e("button",{className:te.searchBtn,type:"submit","aria-label":"Search",children:e(f,{name:"search"})})]})]}),e("div",{className:g.authRow,children:[L?.authenticated?e(S,{children:[e("span",{className:a.statusMsg,children:["Signed in to YouTube Music",Q&&` — ${Q.tracks.length} songs, ${Q.playlists.length} playlists`]}),e("button",{className:g.btnGhost,onClick:()=>W.mutate(),disabled:W.isPending,children:"Sign out"})]}):e(S,{children:[e("form",{onSubmit:t=>{t.preventDefault();const i=_.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(i){if(i.includes("…")||i.includes("...")){$.error("That cookie is truncated (contains …). Right-click the Cookie header → Copy value, not the wrapped preview.");return}i!==_&&E(i),k.mutate({cookie:i})}},className:g.cookieForm,children:[e("input",{className:g.cookieInput,value:_,onChange:t=>E(t.target.value),placeholder:"Paste music.youtube.com Cookie header…","aria-label":"YouTube Music cookie",type:"password"}),e("button",{className:g.btn,type:"submit",disabled:k.isPending||!_.trim(),children:k.isPending?"Checking…":"Sign in"}),q&&e("button",{className:g.btnGhost,type:"button",onClick:ce,disabled:de||k.isPending,title:"Read the YouTube Music cookie via the Dango Helper extension (same zip as AnimePahe/JapaneseASMR)",children:de?"Extracting…":"Extract from helper"})]}),q&&e("p",{className:a.statusMsg,children:["Two ways to sign in: paste the Cookie header manually (steps below), or download"," ",e("a",{href:Ot,target:"_blank",rel:"noreferrer",className:g.link,children:"dango-extension.zip"})," ","then"," ",G?e(S,{children:[e("code",{children:"about:debugging"})," → ",e("strong",{children:"This Firefox"})," →"," ",e("strong",{children:"Load Temporary Add-on"})," →"," ",e("code",{children:"dango-extension/firefox/manifest.json"})]}):e(S,{children:[e("code",{children:"chrome://extensions"})," → ",e("strong",{children:"Developer mode"})," →"," ",e("strong",{children:"Load unpacked"})," → ",e("code",{children:"dango-extension/chrome"})]}),", log in on a music.youtube.com tab, and click Extract."]}),e(lt,{})]}),k.isSuccess&&e("p",{className:a.statusMsg,children:["Signed in — found ",k.data.tracks," songs and ",k.data.playlists," ","playlists."]}),k.isError&&e("p",{className:a.statusMsg,children:k.error?.message||"Sign-in failed. Paste a fresh Cookie header from music.youtube.com."}),!L?.authenticated&&!k.isError&&!k.isSuccess&&e("p",{className:a.statusMsg,children:"Sign in with your YouTube Music cookie to see your library. Search and playback work without sign-in."})]}),e("div",{className:h?g.contentLayout:void 0,children:[e("div",{className:g.mainCol,children:w?e(S,{children:[e("h2",{className:p.sectionTitle,children:["Results for “",w,"”"]}),be?e("p",{className:a.statusMsg,children:"Searching…"}):U.length===0?e("p",{className:a.statusMsg,children:"No tracks found."}):e("div",{className:p.stationList,children:U.map(t=>he(t,U))})]}):L?.authenticated?e(S,{children:[e("h2",{className:p.sectionTitle,children:"Your library"}),ve?e("p",{className:a.statusMsg,children:"Loading library…"}):Le.length===0&&P.length===0&&!F?e(S,{children:[e("p",{className:a.statusMsg,children:Se?"Library failed to load.":"Your library came back empty — YouTube sometimes drops the saved session."}),e("div",{style:{marginBottom:8},children:e("button",{className:g.btnGhost,onClick:()=>{ke()},disabled:K,"aria-label":"Retry loading library",children:K?"Retrying…":"Retry"})}),e("p",{className:a.statusMsg,children:"If it keeps happening, sign out and paste a fresh cookie."})]}):e(S,{children:[Le.length>0&&!F&&e(S,{children:[e("h3",{className:p.sectionTitle,children:"Playlists"}),e("div",{className:p.stationList,children:Le.map(t=>Xe(t))})]}),P.length>0&&!F&&e(S,{children:[e("h3",{className:p.sectionTitle,children:["Liked songs (",P.length,")"]}),e("div",{style:{marginBottom:8},children:e("button",{className:g.btnGhost,onClick:()=>Ce(P[0],P),"aria-label":"Play all liked songs",children:[e(f,{name:"play"})," Play all"]})}),e("div",{className:p.stationList,children:P.map(t=>he(t,P))})]}),F?e(S,{children:[e("button",{className:g.btnGhost,onClick:()=>ae(null),style:{marginBottom:8},children:"← Back to library"}),e("h3",{className:p.sectionTitle,children:F.title}),xe?e("p",{className:a.statusMsg,children:"Loading playlist…"}):X.length===0?e("p",{className:a.statusMsg,children:"No tracks in this playlist."}):e("div",{className:p.stationList,children:X.map(t=>he(t,X))})]}):null]})]}):e("p",{className:a.statusMsg,children:"Search above, or sign in to see your library."})}),h&&e("aside",{className:g.upnextAside,"aria-label":"Up next",children:[e("div",{className:g.upnextHeader,children:e("span",{className:g.upnextTitle,children:[e(f,{name:"list-ul"})," Up Next"]})}),e("div",{className:g.nowPlayingWrap,children:[e("p",{className:g.nowPlayingLabel,children:"Now playing"}),he(h,V.length>0?V:[h])]}),e("div",{className:g.upnextActions,children:e("button",{className:g.btnGhost,onClick:Je,disabled:!T&&(r||M.length===0),"aria-pressed":T,title:T?"Stop the radio — the queue will loop instead of fetching more songs":"Queue these suggestions after the current song and keep the mix going",children:T?"Stop radio":"Start radio"})}),r?e("p",{className:a.statusMsg,children:"Loading suggestions…"}):M.length===0?e("p",{className:a.statusMsg,children:"No suggestions for this song."}):e("div",{className:p.stationList,children:M.map(t=>he(t,Fe,et))})]})]}),h&&e(ct,{track:h,queue:V,shuffle:O,onToggleShuffle:Ke,onTrackStep:Ze,onTrackFailed:We,onClose:()=>{v(null),ee(null)},liked:h?Me(h):!1,likeVisible:L?.authenticated===!0,likePending:I.isPending,onToggleLike:()=>Be(h)})]})};export{Yt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as s,d as y,h as g}from"./vendor-core-DfaOB3Rn.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{M as l,I as m,T as S,J as f,K as k,L as x,N}from"./AvSyncCalibrator-
|
|
1
|
+
import{u as e,S as s,d as y,h as g}from"./vendor-core-DfaOB3Rn.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{M as l,I as m,T as S,J as f,K as k,L as x,N}from"./AvSyncCalibrator-PqA6B5Ey.js";const C=({classes:o,title:t,titleTag:i="span",showBack:a=!0,onBack:n,panelRef:b,onPanelClick:r,children:c})=>{const d=i;return e("div",{ref:b,className:o.panel,onClick:r,"data-speed-boost-ignore":"true",children:[e("div",{className:o.header,children:[a&&e("button",{className:o.backBtn,onClick:n,children:e(p,{name:"chevron-left"})}),e(d,{className:o.title||void 0,children:t})]}),e("div",{className:o.content,children:c})]})},$=({classes:o,values:t,onChange:i})=>{const a=()=>{const n=x;i("fontSize",n.fontSize),i("position",n.position),i("bgOpacity",n.bgOpacity),i("bgColor",n.bgColor),i("textColor",n.textColor),i("edge",n.edge),i("bold",n.bold)};return e(s,{children:[e(l,{label:"Font Size",display:t.fontSize.toFixed(1),min:.5,max:10,step:.5,value:t.fontSize,percent:(t.fontSize-.5)/9.5*100,onChange:n=>{Number.isFinite(n)&&i("fontSize",n)}}),e(l,{label:"Vertical Position",display:`${t.position}`,min:0,max:100,step:1,value:t.position,percent:t.position,onChange:n=>{Number.isFinite(n)&&i("position",Math.round(n))}}),e(l,{label:"Background Opacity",display:`${Math.round(t.bgOpacity*100)}%`,min:0,max:1,step:.05,value:t.bgOpacity,percent:t.bgOpacity*100,onChange:n=>{Number.isFinite(n)&&i("bgOpacity",n)}}),e(m,{label:"Text Color",colors:S,value:t.textColor,onChange:n=>i("textColor",n)}),e(m,{label:"Background Color",colors:f,value:t.bgColor,onChange:n=>i("bgColor",n)}),e(k,{label:"Text Edge",options:["shadow","outline","none"],value:t.edge,onChange:n=>i("edge",n)}),e("button",{type:"button",className:`${o.item} ${t.bold?o.active:""}`,onClick:()=>i("bold",!t.bold),children:[e("span",{children:"Bold Text"}),t.bold&&e(p,{name:"check",size:12})]}),e("button",{type:"button",className:o.item,onClick:a,children:e("span",{children:"Reset to Defaults"})})]})},z=({classes:o,enabled:t,delayMs:i,onToggle:a,onDelayChange:n,onCalibrate:b})=>{const[r,c]=y(null),d=r??i;g(()=>{c(null)},[i]);const h=()=>{r!==null&&(n(r),c(null))};return e(s,{children:[e("button",{type:"button",className:`${o.item} ${t?o.active:""}`,onClick:()=>a(!t),children:[e("span",{children:"Video delay"}),t&&e(p,{name:"check",size:12})]}),e(l,{label:"Video delay",display:`${d}ms`,min:0,max:500,step:5,value:d,percent:d/500*100,onChange:u=>c(Math.round(u)),onCommit:h}),e("div",{className:o.note,children:"For Bluetooth headsets where audio arrives late. Video is held back via canvas; audio plays untouched."}),b&&e("button",{type:"button",className:o.item,onClick:b,children:e("span",{children:"Calibrate…"})})]})},E=({classes:o,values:t,onChange:i})=>e(s,{children:[e("button",{type:"button",className:`${o.item} ${t.enabled?o.active:""}`,onClick:()=>i({enabled:!t.enabled}),"aria-pressed":t.enabled,children:[e("span",{children:"Ambient light"}),e("span",{style:{display:"flex",alignItems:"center",gap:6},children:[t.enabled?"On":"Off",t.enabled&&e(p,{name:"check",size:12})]})]}),e(l,{label:"Blur",display:`${t.blur}px`,min:0,max:120,step:2,value:t.blur,percent:t.blur/120*100,onChange:a=>i({blur:Math.round(a)})}),e(l,{label:"Saturation",display:`${t.saturation}%`,min:0,max:200,step:5,value:t.saturation,percent:t.saturation/200*100,onChange:a=>i({saturation:Math.round(a)})}),e(l,{label:"Brightness",display:`${t.brightness}%`,min:20,max:120,step:5,value:t.brightness,percent:(t.brightness-20)/100*100,onChange:a=>i({brightness:Math.round(a)})}),e(l,{label:"Opacity",display:`${t.opacity}%`,min:10,max:100,step:5,value:t.opacity,percent:(t.opacity-10)/90*100,onChange:a=>i({opacity:Math.round(a)})}),e("div",{className:o.note,children:"Mirrors the video onto the backdrop behind the player. Turn off for pure black."}),e("button",{type:"button",className:o.item,onClick:()=>i({...N}),children:e("span",{children:"Reset to defaults"})})]}),B=({classes:o,options:t,onSelect:i})=>e(s,{children:t.map(a=>e("button",{type:"button",className:`${o.item} ${a.selected?o.active:""}`,onClick:()=>i(a.key),children:[e("span",{children:a.label}),a.selected&&e(p,{name:"check",size:12})]},a.key))});export{z as A,B as O,C as S,$ as a,E as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-
|
|
2
|
-
import{u as r,g as Ot,h as B,P as Br,z as Lr,d as ue,A as f,q as K,y as Ir,T as Je,o as Dr,a as $r,c as Fr,_ as Wr,S as Mt}from"./vendor-core-DfaOB3Rn.js";import{_ as mr,S as _t,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 $e,B as it,K as jr,f as Yr}from"./index-DNxWyfmM.js";import{u as fr,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 mn,q as fn,r as hn,t as Fe,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-Cf5L0Dxf.js";import{I as Z}from"./vendor-icons-DrybRNxP.js";import{l as Cn}from"./hls-CnFtaJwf.js";import{u as Rn}from"./useIsMobile-Dvx1uJ82.js";import{s as ze,Q as Mn}from"./QueueRail-B5z_xhzj.js";import{u as _n,Q as Nn}from"./QueueOptionsButton-DjcdOJgg.js";import{u as hr}from"./useProviders-CvKGEjDV.js";import{A as xn}from"./AnimeMetaDetails-BogOi_bM.js";import{S as Pn}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_1b7ea_1",Dn="_hidden_1b7ea_21",$n="_topControls_1b7ea_27",Fn="_backBtn_1b7ea_47",Wn="_videoTitleInfo_1b7ea_67",On="_animeTitle_1b7ea_73",Un="_episodeNumber_1b7ea_81",Vn="_bottomControls_1b7ea_89",qn="_progressBarContainer_1b7ea_108",Qn="_progressBar_1b7ea_108",zn="_thumb_1b7ea_127",Gn="_scrubbing_1b7ea_142",Kn="_watchedBar_1b7ea_146",Hn="_bufferedBar_1b7ea_147",jn="_timeBubble_1b7ea_185",Yn="_skipSegment_1b7ea_219",Xn="_op_1b7ea_229",Jn="_ed_1b7ea_232",Zn="_recap_1b7ea_235",es="_bottomControlsRow_1b7ea_239",ts="_leftControls_1b7ea_247",rs="_rightControls_1b7ea_248",ns="_controlBtn_1b7ea_255",ss="_theaterBtn_1b7ea_296",os="_nextEpisodeBtn_1b7ea_300",is="_active_1b7ea_317",as="_timeDisplay_1b7ea_321",ls="_skipControls_1b7ea_329",cs="_skipBtn_1b7ea_335",us="_volumeContainer_1b7ea_376",ds="_volumeSlider_1b7ea_382",ps="_playerPageLayout_1b7ea_440",ms="_videoPlayerWrapper_1b7ea_444",fs="_playerInfoContainer_1b7ea_449",hs="_visible_1b7ea_566",vs="_shortcuts_1b7ea_584",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:ms,playerInfoContainer:fs,visible:hs,shortcuts:vs},gs=({player:n,handlers:l,visible:m,skipIntervals:D,showNextEpisodeButton:h,onNextEpisode:S,isTheaterMode:b,onTheaterModeToggle:A,settingsBtnRef:x,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} ${m?"":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:P=>P.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(P=>{const de=P.start_time/T.duration*100,U=(P.end_time-P.start_time)/T.duration*100;return r("div",{className:`${C.skipSegment} ${C[P.skip_type]} `,style:{left:`${de}% `,width:`${U}% `},title:P.skip_type.toUpperCase()},P.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:P=>o.setShowVolumeSlider(P)}),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:h&&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:x,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:P=>{P.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:m,actions:D}=n,h=o=>{m.videoRef.current&&(m.videoRef.current.volume=o,m.videoRef.current.muted=o===0)},S=o=>{!m.videoRef.current||isNaN(l.duration)||l.duration===0||(m.videoRef.current.currentTime=o*l.duration,D.sendProgressUpdate(!1,!0))},b=()=>{m.videoRef.current&&(D.setIsScrubbing(!0),D.wasPlayingBeforeScrub.current=!m.videoRef.current.paused,m.videoRef.current.pause())},A=o=>{!m.videoRef.current||!l.duration||(m.videoRef.current.currentTime=o*l.duration)},x=()=>{D.setIsScrubbing(!1),D.wasPlayingBeforeScrub.current&&m.videoRef.current?.play()},$=o=>{if(!m.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(P=>P.label===o||P.lang===o);g?localStorage.setItem("playerLastSubtitle",Zr(g)):localStorage.setItem("playerLastSubtitle",o)}}catch{}let J=!1;Array.from(m.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:h,handleSeek:S,handleScrubStart:b,handleScrubMove:A,handleScrubEnd:x,handleSubtitleSelection:$,isSubtitleActive:T,handleCCToggle:()=>{if(!m.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(()=>mr(()=>import("./PlayerSettings-CI5hGpEU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Ss=({player:n,isAutoplayEnabled:l,onAutoplayChange:m,showNextEpisodeButton:D,onNextEpisode:h,videoSources:S,selectedSource:b,selectedLink:A,onSourceChange:x,loadingVideo:$,skipIntervals:T,animeTitle:e,episodeNumber:o,isTheaterMode:J,onTheaterModeToggle:g,anime4kEnabled:P,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Ae,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Be,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),Le=Ot.useRef(null),yt=Ot.useRef(null);B(()=>{const F=W=>{Te.current&&!Te.current.contains(W.target)&&Le.current&&!Le.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,xe=r(gs,{player:n,handlers:G,visible:Ze,skipIntervals:T,showNextEpisodeButton:D,onNextEpisode:h,isTheaterMode:J,onTheaterModeToggle:g,settingsBtnRef:Le,timeDisplayRef:yt}),lt=r(Br,{fallback:null,children:r(ys,{ref:Te,isOpen:ye,onClose:()=>Y(!1),videoSources:S,currentSource:b,currentLink:A,onSourceChange:x,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:P,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Ae,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Be,isAutoSkipEnabled:R.isAutoSkipEnabled,onAutoSkipChange:F=>{q.setIsAutoSkipEnabled(F);try{localStorage.setItem("autoSkipEnabled",F.toString())}catch{}},isAutoplayEnabled:l,onAutoplayChange:m,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?xe: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(_t,{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,m)=>r("div",{className:ze.item,style:{pointerEvents:"none"},children:[r("div",{className:ze.dragHandle,style:{opacity:.2},children:r(_t,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:ze.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(_t,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:ze.meta,children:[r(_t,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(_t,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},m))})]}),ws=({selectedProvider:n,onProviderChange:l,isAdult:m,options:D})=>{const h=D&&D.length>0?D:[],S=m===void 0?h:h.filter(b=>b.mature===m);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(x=>(x.tier??"direct")===b);return A.length===0?null:r("optgroup",{label:Bn[b],children:A.map(x=>r("option",{value:x.value,children:x.sub?`${x.label} (${An[x.sub]})`:x.label},x.value))},b)})})]})},Ts=({videoSources:n,selectedSource:l,selectedLink:m,onSourceChange:D,onLinkChange:h})=>{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,x)=>r("button",{className:`${at.sourceButton} ${l?.sourceName===A.sourceName?at.active:""} `,onClick:()=>D(A),children:A.sourceName},`${A.sourceName}-${x}`))}),b&&r("select",{className:at.sourceSelect,"aria-label":"Fallback embed quality",value:m?.link??l.links[0]?.link??"",onChange:A=>{const x=l.links.find($=>$.link===A.target.value);x&&h(x)},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-DaG98x1K.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/OptionListMenu-BjoortST.js","assets/AvSyncCalibrator-PqA6B5Ey.js","assets/index-CfgPGaUO.js","assets/vendor-query-BBT5_sHx.js","assets/index-C6HMOCqo.css","assets/AvSyncCalibrator-ieaRTs3u.css","assets/PlayerSettings-Bj6SsmQ2.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 f,q as K,y as Ir,T as Je,o as Dr,a as $r,c as Fr,_ as Wr,S as Mt}from"./vendor-core-DfaOB3Rn.js";import{_ as mr,S as _t,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 $e,B as it,K as jr,f as Yr}from"./index-CfgPGaUO.js";import{u as fr,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 mn,q as fn,r as hn,t as Fe,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-PqA6B5Ey.js";import{I as Z}from"./vendor-icons-DrybRNxP.js";import{l as Cn}from"./hls-B9wsDt6U.js";import{u as Rn}from"./useIsMobile-Dvx1uJ82.js";import{s as ze,Q as Mn}from"./QueueRail-CtLxXvR_.js";import{u as _n,Q as Nn}from"./QueueOptionsButton-MpSKva6y.js";import{u as hr}from"./useProviders-DDPMV3HX.js";import{A as xn}from"./AnimeMetaDetails-BogOi_bM.js";import{S as Pn}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_1b7ea_1",Dn="_hidden_1b7ea_21",$n="_topControls_1b7ea_27",Fn="_backBtn_1b7ea_47",Wn="_videoTitleInfo_1b7ea_67",On="_animeTitle_1b7ea_73",Un="_episodeNumber_1b7ea_81",Vn="_bottomControls_1b7ea_89",qn="_progressBarContainer_1b7ea_108",Qn="_progressBar_1b7ea_108",zn="_thumb_1b7ea_127",Gn="_scrubbing_1b7ea_142",Kn="_watchedBar_1b7ea_146",Hn="_bufferedBar_1b7ea_147",jn="_timeBubble_1b7ea_185",Yn="_skipSegment_1b7ea_219",Xn="_op_1b7ea_229",Jn="_ed_1b7ea_232",Zn="_recap_1b7ea_235",es="_bottomControlsRow_1b7ea_239",ts="_leftControls_1b7ea_247",rs="_rightControls_1b7ea_248",ns="_controlBtn_1b7ea_255",ss="_theaterBtn_1b7ea_296",os="_nextEpisodeBtn_1b7ea_300",is="_active_1b7ea_317",as="_timeDisplay_1b7ea_321",ls="_skipControls_1b7ea_329",cs="_skipBtn_1b7ea_335",us="_volumeContainer_1b7ea_376",ds="_volumeSlider_1b7ea_382",ps="_playerPageLayout_1b7ea_440",ms="_videoPlayerWrapper_1b7ea_444",fs="_playerInfoContainer_1b7ea_449",hs="_visible_1b7ea_566",vs="_shortcuts_1b7ea_584",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:ms,playerInfoContainer:fs,visible:hs,shortcuts:vs},gs=({player:n,handlers:l,visible:m,skipIntervals:D,showNextEpisodeButton:h,onNextEpisode:S,isTheaterMode:b,onTheaterModeToggle:A,settingsBtnRef:x,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} ${m?"":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:P=>P.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(P=>{const de=P.start_time/T.duration*100,U=(P.end_time-P.start_time)/T.duration*100;return r("div",{className:`${C.skipSegment} ${C[P.skip_type]} `,style:{left:`${de}% `,width:`${U}% `},title:P.skip_type.toUpperCase()},P.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:P=>o.setShowVolumeSlider(P)}),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:h&&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:x,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:P=>{P.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:m,actions:D}=n,h=o=>{m.videoRef.current&&(m.videoRef.current.volume=o,m.videoRef.current.muted=o===0)},S=o=>{!m.videoRef.current||isNaN(l.duration)||l.duration===0||(m.videoRef.current.currentTime=o*l.duration,D.sendProgressUpdate(!1,!0))},b=()=>{m.videoRef.current&&(D.setIsScrubbing(!0),D.wasPlayingBeforeScrub.current=!m.videoRef.current.paused,m.videoRef.current.pause())},A=o=>{!m.videoRef.current||!l.duration||(m.videoRef.current.currentTime=o*l.duration)},x=()=>{D.setIsScrubbing(!1),D.wasPlayingBeforeScrub.current&&m.videoRef.current?.play()},$=o=>{if(!m.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(P=>P.label===o||P.lang===o);g?localStorage.setItem("playerLastSubtitle",Zr(g)):localStorage.setItem("playerLastSubtitle",o)}}catch{}let J=!1;Array.from(m.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:h,handleSeek:S,handleScrubStart:b,handleScrubMove:A,handleScrubEnd:x,handleSubtitleSelection:$,isSubtitleActive:T,handleCCToggle:()=>{if(!m.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(()=>mr(()=>import("./PlayerSettings-DaG98x1K.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Ss=({player:n,isAutoplayEnabled:l,onAutoplayChange:m,showNextEpisodeButton:D,onNextEpisode:h,videoSources:S,selectedSource:b,selectedLink:A,onSourceChange:x,loadingVideo:$,skipIntervals:T,animeTitle:e,episodeNumber:o,isTheaterMode:J,onTheaterModeToggle:g,anime4kEnabled:P,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Ae,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Be,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),Le=Ot.useRef(null),yt=Ot.useRef(null);B(()=>{const F=W=>{Te.current&&!Te.current.contains(W.target)&&Le.current&&!Le.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,xe=r(gs,{player:n,handlers:G,visible:Ze,skipIntervals:T,showNextEpisodeButton:D,onNextEpisode:h,isTheaterMode:J,onTheaterModeToggle:g,settingsBtnRef:Le,timeDisplayRef:yt}),lt=r(Br,{fallback:null,children:r(ys,{ref:Te,isOpen:ye,onClose:()=>Y(!1),videoSources:S,currentSource:b,currentLink:A,onSourceChange:x,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:P,onAnime4kToggle:de,anime4kSupported:U,anime4kProfile:L,onAnime4kProfileChange:V,anime4kInitializing:Ae,anime4kError:Oe,videoDelayEnabled:i,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Be,isAutoSkipEnabled:R.isAutoSkipEnabled,onAutoSkipChange:F=>{q.setIsAutoSkipEnabled(F);try{localStorage.setItem("autoSkipEnabled",F.toString())}catch{}},isAutoplayEnabled:l,onAutoplayChange:m,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?xe: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(_t,{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,m)=>r("div",{className:ze.item,style:{pointerEvents:"none"},children:[r("div",{className:ze.dragHandle,style:{opacity:.2},children:r(_t,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:ze.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(_t,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:ze.meta,children:[r(_t,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(_t,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},m))})]}),ws=({selectedProvider:n,onProviderChange:l,isAdult:m,options:D})=>{const h=D&&D.length>0?D:[],S=m===void 0?h:h.filter(b=>b.mature===m);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(x=>(x.tier??"direct")===b);return A.length===0?null:r("optgroup",{label:Bn[b],children:A.map(x=>r("option",{value:x.value,children:x.sub?`${x.label} (${An[x.sub]})`:x.label},x.value))},b)})})]})},Ts=({videoSources:n,selectedSource:l,selectedLink:m,onSourceChange:D,onLinkChange:h})=>{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,x)=>r("button",{className:`${at.sourceButton} ${l?.sourceName===A.sourceName?at.active:""} `,onClick:()=>D(A),children:A.sourceName},`${A.sourceName}-${x}`))}),b&&r("select",{className:at.sourceSelect,"aria-label":"Fallback embed quality",value:m?.link??l.links[0]?.link??"",onChange:A=>{const x=l.links.find($=>$.link===A.target.value);x&&h(x)},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 z,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-
|
|
1
|
+
import{g as z,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-BjoortST.js";import{u as re}from"./index-CfgPGaUO.js";import"./AvSyncCalibrator-PqA6B5Ey.js";import"./vendor-query-BBT5_sHx.js";const ce="_settingsPanel_y6z3b_1",oe="_header_y6z3b_33",de="_backBtn_y6z3b_56",me="_contentWrapper_y6z3b_76",ue="_menuContent_y6z3b_82",he="_menuItem_y6z3b_89",pe="_selected_y6z3b_114",be="_currentValue_y6z3b_134",ye="_menuNote_y6z3b_141",ge="_menuError_y6z3b_150",n={settingsPanel:ce,header:oe,backBtn:de,contentWrapper:me,menuContent:ue,menuItem:he,selected:pe,currentValue:be,menuNote:ye,menuError:ge},ve=(w,$)=>{const{isOpen:y,onClose:ke,videoSources:Ce,currentSource:C,currentLink:N,onSourceChange:P,subtitles:V,activeSubtitleTrack:g,onSubtitleChange:O,subtitleSettings:E,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:d,onAutoSkipChange:W,isAutoplayEnabled:m,onAutoplayChange:G,fallbackChoice:p,onFallbackChoiceChange:j,isTheaterMode:q,ambientSettings:b,onAmbientChange:k}=w,{lowEndMode:F}=re(),[a,i]=ne("main");z.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:[d?"Auto-skip On":null,m?"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&&P(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"},...V.map(t=>({key:t.label||t.lang,label:t.label,selected:g===(t.label||t.lang)}))],onSelect:t=>O(t)})}),K=()=>e("div",{className:n.menuContent,children:e(se,{classes:{item:n.menuItem,active:n.selected},values:E,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} ${d?n.selected:""}`,onClick:()=>W(!d),"aria-pressed":d,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>G(!m),"aria-pressed":m,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>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:$,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},ze=z.forwardRef(ve);export{ze as default};
|
package/client/dist/assets/{QueueOptionsButton-DjcdOJgg.js → QueueOptionsButton-MpSKva6y.js}
RENAMED
|
@@ -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-
|
|
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-CfgPGaUO.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-
|
|
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-CfgPGaUO.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-
|
|
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-CfgPGaUO.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-
|
|
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-fN3GQyTJ.js";import{L as F}from"./LibraryListPage-DOSPLTiR.js";import{u as _,M as z}from"./useMangaPopup-CXnu2h4Y.js";import{M as D}from"./MangaResetProgressModal-kbpad7Vl.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-CxRsa2lr.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-icons-DrybRNxP.js";import"./index-CfgPGaUO.js";import"./vendor-query-BBT5_sHx.js";import"./SkeletonGrid-gCly-9x7.js";import"./ErrorMessage-DAxegITP.js";import"./Watchlist.module-XGtVQr1d.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-CpbOV9Sk.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};
|
package/client/dist/assets/{ResetProgressModal-C7-CvTi-.js → ResetProgressModal-CpbOV9Sk.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e}from"./vendor-core-DfaOB3Rn.js";import{M as r,B as n}from"./index-
|
|
1
|
+
import{u as e}from"./vendor-core-DfaOB3Rn.js";import{M as r,B as n}from"./index-CfgPGaUO.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-BA_x2PRl.js";import{A as Ae}from"./AnimeCard-CDeVbWJO.js";import{t as be,u as ye,v as Se,L as ae,B as w,N as Ne}from"./index-DNxWyfmM.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-BqAd5seW.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-DjcdOJgg.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-D6_9HL2Z.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-gCly-9x7.js";import{A as Ae}from"./AnimeCard-CEDL_2lC.js";import{t as be,u as ye,v as Se,L as ae,B as w,N as Ne}from"./index-CfgPGaUO.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-Dpkjj68s.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-MpSKva6y.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-fN3GQyTJ.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};
|