@serifpersia/dango 3.6.0 → 3.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -13
- package/client/dist/assets/{AnimeCard-CEDL_2lC.js → AnimeCard-KCdQSFYo.js} +1 -1
- package/client/dist/assets/AnimeInfo-BivVqWcB.css +1 -0
- package/client/dist/assets/AnimeInfo-CWppMyrH.js +1 -0
- package/client/dist/assets/{AnimeInfoPage-a1-1F_la.js → AnimeInfoPage-CfYONEFT.js} +2 -2
- package/client/dist/assets/{Asmr-CCMuiaoR.js → Asmr-CbkxcXne.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-CiwgOhH2.js → AsmrResetProgressModal-CjPrSioI.js} +1 -1
- package/client/dist/assets/AvSyncCalibrator-XNJmMFmH.js +10 -0
- package/client/dist/assets/AvSyncCalibrator-ZSpMgUid.css +1 -0
- package/client/dist/assets/{Home-BmTp0Dx7.js → Home-BTkitKD6.js} +1 -1
- package/client/dist/assets/Home-DeY8zvfI.css +1 -0
- package/client/dist/assets/{Insights-C89oz_3z.js → Insights-_LB6kp3M.js} +1 -1
- package/client/dist/assets/{LibraryListPage-DOSPLTiR.js → LibraryListPage-4BBrV2Ne.js} +1 -1
- package/client/dist/assets/{ListeningList-IHSyufXX.js → ListeningList-BlAwt-LT.js} +1 -1
- package/client/dist/assets/{Manga-H4hG-3K8.js → Manga-BtLdEUi5.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-Bjz2NwLc.js → MangaInfoPage-CQr6_pSH.js} +1 -1
- package/client/dist/assets/{MangaReadPage-DZakUml0.js → MangaReadPage-DUHUub1H.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-kbpad7Vl.js → MangaResetProgressModal-CnP9RIzg.js} +1 -1
- package/client/dist/assets/{Mature-DfODnRR8.js → Mature-Dv8i7W02.js} +1 -1
- package/client/dist/assets/{MediaCard-fN3GQyTJ.js → MediaCard-tBWyjKaV.js} +1 -1
- package/client/dist/assets/{Music-CFVwJyIo.js → Music-kBqpbxdz.js} +1 -1
- package/client/dist/assets/{OptionListMenu-BjoortST.js → OptionListMenu-BiiWXfEL.js} +1 -1
- package/client/dist/assets/{Player-DMeWl-5s.js → Player-CXReluOl.js} +6 -6
- package/client/dist/assets/Player-DCB994_8.css +1 -0
- package/client/dist/assets/PlayerSettings-BXGe3F5k.css +1 -0
- package/client/dist/assets/{PlayerSettings-DaG98x1K.js → PlayerSettings-uFwbD3Z7.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-MpSKva6y.js → QueueOptionsButton-BN-6sbNV.js} +1 -1
- package/client/dist/assets/{QueueRail-CtLxXvR_.js → QueueRail-BYyC_xPZ.js} +1 -1
- package/client/dist/assets/{Radio-D1zoU38z.js → Radio-DN66fPmx.js} +1 -1
- package/client/dist/assets/{ReadingList-C_oRyOHJ.js → ReadingList-6z-6l85T.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CpbOV9Sk.js → ResetProgressModal-CZieLUpX.js} +1 -1
- package/client/dist/assets/{Search-Cs8U1ZGO.js → Search-aO0P-vef.js} +1 -1
- package/client/dist/assets/Settings-CYeDIeBU.js +21 -0
- package/client/dist/assets/{SkeletonGrid-gCly-9x7.js → SkeletonGrid-DJKwfPjg.js} +1 -1
- package/client/dist/assets/Trackers-CLJvFNWX.js +2 -0
- package/client/dist/assets/Tv-B-TnGO82.js +4 -0
- package/client/dist/assets/Tv-Bdruknna.css +1 -0
- package/client/dist/assets/{TvInfo-CfYJPE-C.js → TvInfo-Y7k3LY78.js} +1 -1
- package/client/dist/assets/{TvPopup-BBIe0fHF.js → TvPopup-CM8RMOwX.js} +1 -1
- package/client/dist/assets/{TvSearch-Bfp_r265.js → TvSearch-Bn-OsC1u.js} +1 -1
- package/client/dist/assets/{TvWatchlist-DNcVUBXZ.js → TvWatchlist-PyOWvixK.js} +1 -1
- package/client/dist/assets/{Watchlist-DnC7uDc4.js → Watchlist-CCmzjnDR.js} +1 -1
- package/client/dist/assets/{hls-B9wsDt6U.js → hls-Dn7_lAv2.js} +1 -1
- package/client/dist/assets/index-D0Haw_Zl.css +1 -0
- package/client/dist/assets/index-VzVAYX5A.js +178 -0
- package/client/dist/assets/{useAnimeInfoData-Dpkjj68s.js → useAnimeInfoData-BpD2dXLB.js} +1 -1
- package/client/dist/assets/{useAsmr-QqLyjBbR.js → useAsmr-Dm1-a4VV.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-CnYAAhDj.js → useAsmrPopup-2SWfvbnM.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-CxRsa2lr.js → useMangaLibrary-RpiA2f_k.js} +1 -1
- package/client/dist/assets/{useMangaPopup-CXnu2h4Y.js → useMangaPopup-Dcfgv2CZ.js} +1 -1
- package/client/dist/assets/{useProviders-DDPMV3HX.js → useProviders-vzvT6VhD.js} +1 -1
- package/client/dist/assets/{useTv-BkZAFGaD.js → useTv-DrhnOiw6.js} +1 -1
- package/client/dist/assets/{useTvLibrary-CL3kMD_c.js → useTvLibrary-DDReryyQ.js} +1 -1
- package/client/dist/index.html +2 -2
- package/client/dist/repo_logo.svg +19 -39
- package/orchestrator.js +107 -8
- package/package.json +2 -2
- package/server/dist/app-hono.js +13 -8
- package/server/dist/config.js +3 -2
- package/server/dist/hono/auth.js +0 -7
- package/server/dist/trpc/routers/auth.js +16 -0
- package/server/package.json +1 -1
- package/client/dist/assets/AnimeInfo-BFWtHlPC.css +0 -1
- package/client/dist/assets/AnimeInfo-mVGUoF9q.js +0 -1
- package/client/dist/assets/AvSyncCalibrator-PqA6B5Ey.js +0 -10
- package/client/dist/assets/AvSyncCalibrator-ieaRTs3u.css +0 -1
- package/client/dist/assets/Home-B_q2l74h.css +0 -1
- package/client/dist/assets/Player-DBLl-bj_.css +0 -1
- package/client/dist/assets/PlayerSettings-Bj6SsmQ2.css +0 -1
- package/client/dist/assets/Settings-BgcOeTlE.js +0 -21
- package/client/dist/assets/Trackers-DoHHWI2D.js +0 -2
- package/client/dist/assets/Tv-BlVIanQL.css +0 -1
- package/client/dist/assets/Tv-DhLdh3WF.js +0 -4
- package/client/dist/assets/index-C6HMOCqo.css +0 -1
- package/client/dist/assets/index-CfgPGaUO.js +0 -178
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as D,A as w,q as Z,h as g,u as e,S as ce,o as ve,p as be,a as we,T as Ne}from"./vendor-core-DfaOB3Rn.js";import{E as ye}from"./ErrorMessage-DAxegITP.js";import{I as $}from"./vendor-icons-DrybRNxP.js";import{u as Ce}from"./vendor-query-BBT5_sHx.js";import{t as Se,v as ke,m as Ie,k as $e,r as Pe,n as Re,w as Me,q as xe,s as Ee}from"./useMangaLibrary-CxRsa2lr.js";import{s as t}from"./Manga.module-depGEacJ.js";import{e as Te,d as Le,t as oe}from"./index-CfgPGaUO.js";import{p as Be}from"./page.module-C1MlZzf3.js";const le="mangaReadMode",de="mangaFitMode";function ze(){try{return localStorage.getItem(le)==="page"?"page":"strip"}catch{return"strip"}}function Ae(){try{return localStorage.getItem(de)==="height"?"height":"width"}catch{return"width"}}const Fe=({provider:h,mangaTitle:p,chapter:f,chapters:y,onBack:C,onOpenChapter:v,initialPage:u=0,onProgress:q})=>{const[c,P]=D(ze),[B,i]=D(Ae),[d,z]=D(0),[A,M]=D(new Set),[b,S]=D(0),N=w(null),x=w([]),X=Ce(),{data:_,isLoading:Y,isError:R}=Se(h,f.id),s=_?.pages??[],m=s.map(n=>ke(h,n)),I=w(0),F=w(0),E=w(!1);F.current=s.length;const T=y.findIndex(n=>n.id===f.id),a=T>0?[...y.slice(0,T)].reverse().find(n=>!n.externalUrl)??null:null,o=T>=0?y.slice(T+1).find(n=>!n.externalUrl)??null:null,k=Z(n=>{E.current=!0,z(r=>{const l=r+n;return l<0?(a&&v(a),0):l>=s.length?(o&&v(o),r):l})},[s.length,a,o,v]);g(()=>{E.current=!1,I.current=Math.max(0,u),z(Math.max(0,u)),M(new Set),x.current=[],u<=0&&window.scrollTo(0,0)},[f.id,u]);const G=w(q);G.current=q;const J=w(""),j=w(null),ee=w(null),[W,ue]=D(0),L=Z(()=>{const n=c==="strip"?x.current[I.current]:ee.current,r=n?.querySelector("img");if(!n||!r)return;const l=Math.max(0,(n.clientWidth-r.clientWidth)/2)+8;ue(H=>Math.abs(H-l)<1?H:l)},[c]);g(()=>{I.current=d,s.length!==0&&G.current?.(Math.min(d+1,s.length),s.length)},[d,s.length]),g(()=>{u<=0||E.current||I.current===0&&(E.current=!1,I.current=u,z(u))},[u]),g(()=>{if(c!=="strip"||s.length===0||u<=0)return;const n=`${f.id}:${u}`;if(J.current===n)return;J.current=n;const r=window.setTimeout(()=>{x.current[Math.min(u,s.length-1)]?.scrollIntoView({block:"start"})},150);return()=>window.clearTimeout(r)},[c,s.length,u,f.id]),g(()=>{document.title=`${p} Ch. ${f.number} - dango`},[p,f.number]),g(()=>{try{localStorage.setItem(le,c)}catch{}},[c]),g(()=>{try{localStorage.setItem(de,B)}catch{}},[B]),g(()=>{c==="page"&&window.scrollTo(0,0)},[c]),g(()=>{if(c!=="page"||s.length===0)return;const n=r=>{r.key==="ArrowRight"||r.key===" "?(r.preventDefault(),k(1)):r.key==="ArrowLeft"&&(r.preventDefault(),k(-1))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[c,s.length,k]),g(()=>{if(c!=="strip"||s.length===0)return;let n=0;const r=()=>{n=0;const H=window.innerHeight*.3,O=x.current;let V=-1,re=0;for(let Q=0;Q<O.length;Q++){const se=O[Q];if(!se)continue;const ie=se.getBoundingClientRect();if(ie.height>4&&re++,ie.top<=H)V=Q;else break}V<0||re<Math.min(3,O.length)||(V!==I.current&&(E.current=!0,I.current=V,z(V)),L())},l=()=>{n||(n=requestAnimationFrame(r))};return j.current=l,l(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),n&&cancelAnimationFrame(n),j.current=null}},[c,s.length,_,L]),g(()=>{if(!(c!=="page"||s.length===0))return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[c,d,s.length,L]);const ge=n=>{N.current=n.touches[0].clientX},he=n=>{if(N.current===null)return;const r=n.changedTouches[0].clientX-N.current;N.current=null,!(Math.abs(r)<50)&&k(r<0?1:-1)},K=n=>{n&&v(n)},te=n=>M(r=>{if(r.has(n))return r;const l=new Set(r);return l.add(n),l}),me=n=>{M(r=>{const l=new Set(r);return l.delete(n),l}),S(r=>r+1)},pe=()=>{M(new Set),S(n=>n+1),X.invalidateQueries({queryKey:["mangaPages",h,f.id]})},fe=s.length>0&&A.size>=s.length,ne=n=>b>0?`${n}&n=${b}`:n,ae=n=>e("div",{className:t.deadPage,role:"alert",children:[e("span",{children:["Page ",n+1," failed to load"]}),e("button",{className:t.pageBtn,onClick:()=>me(n),children:[e($,{name:"sync-alt",size:12})," Retry"]})]}),U=B==="height";return e("div",{className:t.readerShell,children:[e("div",{className:t.readerBar,children:[e("button",{className:t.readerIconBtn,onClick:C,"aria-label":"Back to chapters",children:e($,{name:"chevron-left",size:14})}),e("span",{className:t.readerTitle,children:[p," — Ch. ",f.number,f.title?` ${f.title}`:""]}),s.length>0&&e("span",{className:t.readerCounter,children:[Math.min(d+1,s.length)," / ",s.length]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Reading mode",children:[e("button",{type:"button","aria-pressed":c==="strip",className:c==="strip"?t.readerSegmentActive:"",onClick:()=>P("strip"),children:"Strip"}),e("button",{type:"button","aria-pressed":c==="page",className:c==="page"?t.readerSegmentActive:"",onClick:()=>P("page"),children:"Page"})]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Fit mode",children:[e("button",{type:"button","aria-pressed":!U,className:U?"":t.readerSegmentActive,onClick:()=>i("width"),title:"Fit width — best for portrait / phones",children:"Wide"}),e("button",{type:"button","aria-pressed":U,className:U?t.readerSegmentActive:"",onClick:()=>i("height"),title:"Fit height — best for landscape / desktop",children:"Tall"})]}),e("button",{className:t.readerIconBtn,disabled:!a,onClick:()=>K(a),"aria-label":"Previous chapter",children:e($,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!o,onClick:()=>K(o),"aria-label":"Next chapter",children:e($,{name:"chevron-right",size:14})})]}),R?e("p",{className:t.statusMsg,children:"Failed to load pages. Please try again."}):Y?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((n,r)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},r))}):s.length===0?e("p",{className:t.statusMsg,children:"No pages found for this chapter."}):fe?e("div",{className:t.failedBox,children:[e("p",{className:t.statusMsg,children:"Page images failed to load (expired or blocked links)."}),e("button",{className:t.pageBtn,onClick:pe,children:[e($,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${U?t.readerPagesTall:""}`,children:m.map((n,r)=>e("div",{ref:l=>{x.current[r]=l},className:t.readerPageWrap,children:[r===d&&e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),A.has(r)?ae(r):e("img",{className:t.readerPage,src:ne(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onLoad:()=>j.current?.(),onError:()=>te(r)})]},`${r}-${s[r].slice(-32)}`))}):e(ce,{children:[e("div",{ref:ee,className:`${t.pageView} ${U?t.pageViewTall:""}`,onTouchStart:ge,onTouchEnd:he,children:[e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),e("button",{className:`${t.tapZone} ${t.tapZoneLeft}`,onClick:()=>k(-1),"aria-label":"Previous page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-left",size:16})})}),A.has(d)?ae(d):e("img",{className:t.pageImage,src:ne(m[d]),alt:`Page ${d+1} of ${s.length}`,decoding:"async",draggable:!1,onLoad:()=>L(),onError:()=>te(d)},`${d}-${s[d].slice(-32)}`),e("button",{className:`${t.tapZone} ${t.tapZoneRight}`,onClick:()=>k(1),"aria-label":"Next page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-right",size:16})})})]}),e("nav",{className:t.pagination,"aria-label":"Page navigation",children:[e("button",{className:t.pageBtn,disabled:d<=0,onClick:()=>k(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[d+1," / ",s.length]}),e("button",{className:t.pageBtn,disabled:d>=s.length-1,onClick:()=>k(1),children:"Next page"})]})]}),(a||o)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!a,onClick:()=>K(a),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!o,onClick:()=>K(o),children:"Next chapter"})]})]})},Ue=800,De=5e3;function Xe(){const{provider:h="",id:p=""}=ve(),[f]=be(),y=we(),C=f.get("chapter")||"",v=f.get("rating")||"safe",{hasConsent:u}=Te(),q=u?v:"safe",c=h&&p?Ie(h,p):"",P=h.toLowerCase()==="anilist";g(()=>{P&&p&&y(`/manga/anilist/${encodeURIComponent(p)}`,{replace:!0})},[P,p,y]);const B=$e(!P&&h?h:null,!P&&p?p:null,q,u),i=B.data,{titlePreference:d}=Le(),z=i?Pe(i,d):"Manga",A=Re(c||void 0),M=Me(),b=i&&C?i.chapters.find(a=>a.id===C)??null:null,S=xe(C),N=S!=null&&i?Ee(i.chapters,S):null;g(()=>{if(S!=null&&N&&N.id!==C){const a=new URLSearchParams;a.set("chapter",N.id),u&&v!=="safe"&&a.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${a.toString()}`,{replace:!0})}},[S,N,C,u,v,h,p,y]);const x=S!=null&&!!i&&!!N,X=S!=null&&!!i&&!N,_=Ne(()=>{const a=(A.data?.progress??[]).find(o=>o.chapterId===C);return a&&a.page>0?a.page:0},[A.data,C]),Y=_>1?_-1:0,R=w(null),s=w(null),m=Z(()=>{R.current&&(clearTimeout(R.current),R.current=null);const a=s.current;s.current=null,a&&c&&M.mutate({mangaId:c,chapterId:a.chapterId,chapterNumber:a.chapterNumber,page:a.page,pageCount:a.pageCount,title:i?.title??null,cover:i?.cover??null,provider:h||null,altTitle:i?.altTitle??null,contentRating:i?.contentRating??null})},[c,M,i?.title,i?.cover,i?.altTitle,i?.contentRating,h]),I=Z((a,o)=>{b&&(s.current={chapterId:b.id,chapterNumber:b.number,page:a,pageCount:o},R.current&&clearTimeout(R.current),R.current=setTimeout(m,Ue))},[b,m]);g(()=>{m()},[C,m]),g(()=>()=>m(),[m]),g(()=>{const a=window.setInterval(()=>{s.current&&m()},De);return()=>window.clearInterval(a)},[m]),g(()=>{const a=()=>{document.visibilityState==="hidden"&&m()},o=()=>m();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",o)}},[m]);const F=w("");F.current||(F.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),g(()=>{if(!i||!b)return;const a=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{oe.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${b.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:a,sessionId:F.current}).catch(()=>{}),oe.discord.heartbeat.mutate({sessionId:F.current}).catch(()=>{})};o();const k=window.setInterval(o,6e4);return()=>window.clearInterval(k)},[i,b]);const E=a=>{if(m(),a.externalUrl){window.open(a.externalUrl,"_blank","noopener,noreferrer");return}const o=new URLSearchParams;o.set("chapter",a.id),u&&v!=="safe"&&o.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${o.toString()}`)},T=()=>{m();const a=new URLSearchParams;u&&v!=="safe"&&a.set("rating",v);const o=a.toString()?`?${a.toString()}`:"";y(`/manga/${h}/${encodeURIComponent(p)}${o}`)};return P?null:e("div",{className:Be.page,children:B.isLoading||x?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((a,o)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},o))}):!i||!b?e(ce,{children:[e("button",{className:t.backBtn,onClick:T,children:"Back to title"}),e(ye,{message:X?`Chapter ${S} isn't available from ${h} for this title.`:"Failed to load this chapter. Please try again."})]}):e(Fe,{provider:h,mangaTitle:z,chapter:b,chapters:i.chapters,onBack:T,onOpenChapter:E,initialPage:Y,onProgress:I},b.id)})}export{Xe as default};
|
|
1
|
+
import{d as D,A as w,q as Z,h as g,u as e,S as ce,o as ve,p as be,a as we,T as Ne}from"./vendor-core-DfaOB3Rn.js";import{E as ye}from"./ErrorMessage-DAxegITP.js";import{I as $}from"./vendor-icons-DrybRNxP.js";import{u as Ce}from"./vendor-query-BBT5_sHx.js";import{t as Se,v as ke,m as Ie,k as $e,r as Pe,n as Re,w as Me,q as xe,s as Ee}from"./useMangaLibrary-RpiA2f_k.js";import{s as t}from"./Manga.module-depGEacJ.js";import{e as Te,d as Le,t as oe}from"./index-VzVAYX5A.js";import{p as Be}from"./page.module-C1MlZzf3.js";const le="mangaReadMode",de="mangaFitMode";function ze(){try{return localStorage.getItem(le)==="page"?"page":"strip"}catch{return"strip"}}function Ae(){try{return localStorage.getItem(de)==="height"?"height":"width"}catch{return"width"}}const Fe=({provider:h,mangaTitle:p,chapter:f,chapters:y,onBack:C,onOpenChapter:v,initialPage:u=0,onProgress:q})=>{const[c,P]=D(ze),[B,i]=D(Ae),[d,z]=D(0),[A,M]=D(new Set),[b,S]=D(0),N=w(null),x=w([]),X=Ce(),{data:_,isLoading:Y,isError:R}=Se(h,f.id),s=_?.pages??[],m=s.map(n=>ke(h,n)),I=w(0),F=w(0),E=w(!1);F.current=s.length;const T=y.findIndex(n=>n.id===f.id),a=T>0?[...y.slice(0,T)].reverse().find(n=>!n.externalUrl)??null:null,o=T>=0?y.slice(T+1).find(n=>!n.externalUrl)??null:null,k=Z(n=>{E.current=!0,z(r=>{const l=r+n;return l<0?(a&&v(a),0):l>=s.length?(o&&v(o),r):l})},[s.length,a,o,v]);g(()=>{E.current=!1,I.current=Math.max(0,u),z(Math.max(0,u)),M(new Set),x.current=[],u<=0&&window.scrollTo(0,0)},[f.id,u]);const G=w(q);G.current=q;const J=w(""),j=w(null),ee=w(null),[W,ue]=D(0),L=Z(()=>{const n=c==="strip"?x.current[I.current]:ee.current,r=n?.querySelector("img");if(!n||!r)return;const l=Math.max(0,(n.clientWidth-r.clientWidth)/2)+8;ue(H=>Math.abs(H-l)<1?H:l)},[c]);g(()=>{I.current=d,s.length!==0&&G.current?.(Math.min(d+1,s.length),s.length)},[d,s.length]),g(()=>{u<=0||E.current||I.current===0&&(E.current=!1,I.current=u,z(u))},[u]),g(()=>{if(c!=="strip"||s.length===0||u<=0)return;const n=`${f.id}:${u}`;if(J.current===n)return;J.current=n;const r=window.setTimeout(()=>{x.current[Math.min(u,s.length-1)]?.scrollIntoView({block:"start"})},150);return()=>window.clearTimeout(r)},[c,s.length,u,f.id]),g(()=>{document.title=`${p} Ch. ${f.number} - dango`},[p,f.number]),g(()=>{try{localStorage.setItem(le,c)}catch{}},[c]),g(()=>{try{localStorage.setItem(de,B)}catch{}},[B]),g(()=>{c==="page"&&window.scrollTo(0,0)},[c]),g(()=>{if(c!=="page"||s.length===0)return;const n=r=>{r.key==="ArrowRight"||r.key===" "?(r.preventDefault(),k(1)):r.key==="ArrowLeft"&&(r.preventDefault(),k(-1))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[c,s.length,k]),g(()=>{if(c!=="strip"||s.length===0)return;let n=0;const r=()=>{n=0;const H=window.innerHeight*.3,O=x.current;let V=-1,re=0;for(let Q=0;Q<O.length;Q++){const se=O[Q];if(!se)continue;const ie=se.getBoundingClientRect();if(ie.height>4&&re++,ie.top<=H)V=Q;else break}V<0||re<Math.min(3,O.length)||(V!==I.current&&(E.current=!0,I.current=V,z(V)),L())},l=()=>{n||(n=requestAnimationFrame(r))};return j.current=l,l(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),n&&cancelAnimationFrame(n),j.current=null}},[c,s.length,_,L]),g(()=>{if(!(c!=="page"||s.length===0))return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[c,d,s.length,L]);const ge=n=>{N.current=n.touches[0].clientX},he=n=>{if(N.current===null)return;const r=n.changedTouches[0].clientX-N.current;N.current=null,!(Math.abs(r)<50)&&k(r<0?1:-1)},K=n=>{n&&v(n)},te=n=>M(r=>{if(r.has(n))return r;const l=new Set(r);return l.add(n),l}),me=n=>{M(r=>{const l=new Set(r);return l.delete(n),l}),S(r=>r+1)},pe=()=>{M(new Set),S(n=>n+1),X.invalidateQueries({queryKey:["mangaPages",h,f.id]})},fe=s.length>0&&A.size>=s.length,ne=n=>b>0?`${n}&n=${b}`:n,ae=n=>e("div",{className:t.deadPage,role:"alert",children:[e("span",{children:["Page ",n+1," failed to load"]}),e("button",{className:t.pageBtn,onClick:()=>me(n),children:[e($,{name:"sync-alt",size:12})," Retry"]})]}),U=B==="height";return e("div",{className:t.readerShell,children:[e("div",{className:t.readerBar,children:[e("button",{className:t.readerIconBtn,onClick:C,"aria-label":"Back to chapters",children:e($,{name:"chevron-left",size:14})}),e("span",{className:t.readerTitle,children:[p," — Ch. ",f.number,f.title?` ${f.title}`:""]}),s.length>0&&e("span",{className:t.readerCounter,children:[Math.min(d+1,s.length)," / ",s.length]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Reading mode",children:[e("button",{type:"button","aria-pressed":c==="strip",className:c==="strip"?t.readerSegmentActive:"",onClick:()=>P("strip"),children:"Strip"}),e("button",{type:"button","aria-pressed":c==="page",className:c==="page"?t.readerSegmentActive:"",onClick:()=>P("page"),children:"Page"})]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Fit mode",children:[e("button",{type:"button","aria-pressed":!U,className:U?"":t.readerSegmentActive,onClick:()=>i("width"),title:"Fit width — best for portrait / phones",children:"Wide"}),e("button",{type:"button","aria-pressed":U,className:U?t.readerSegmentActive:"",onClick:()=>i("height"),title:"Fit height — best for landscape / desktop",children:"Tall"})]}),e("button",{className:t.readerIconBtn,disabled:!a,onClick:()=>K(a),"aria-label":"Previous chapter",children:e($,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!o,onClick:()=>K(o),"aria-label":"Next chapter",children:e($,{name:"chevron-right",size:14})})]}),R?e("p",{className:t.statusMsg,children:"Failed to load pages. Please try again."}):Y?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((n,r)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},r))}):s.length===0?e("p",{className:t.statusMsg,children:"No pages found for this chapter."}):fe?e("div",{className:t.failedBox,children:[e("p",{className:t.statusMsg,children:"Page images failed to load (expired or blocked links)."}),e("button",{className:t.pageBtn,onClick:pe,children:[e($,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${U?t.readerPagesTall:""}`,children:m.map((n,r)=>e("div",{ref:l=>{x.current[r]=l},className:t.readerPageWrap,children:[r===d&&e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),A.has(r)?ae(r):e("img",{className:t.readerPage,src:ne(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onLoad:()=>j.current?.(),onError:()=>te(r)})]},`${r}-${s[r].slice(-32)}`))}):e(ce,{children:[e("div",{ref:ee,className:`${t.pageView} ${U?t.pageViewTall:""}`,onTouchStart:ge,onTouchEnd:he,children:[e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e($,{name:"bookmark",size:12})},d),e("button",{className:`${t.tapZone} ${t.tapZoneLeft}`,onClick:()=>k(-1),"aria-label":"Previous page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-left",size:16})})}),A.has(d)?ae(d):e("img",{className:t.pageImage,src:ne(m[d]),alt:`Page ${d+1} of ${s.length}`,decoding:"async",draggable:!1,onLoad:()=>L(),onError:()=>te(d)},`${d}-${s[d].slice(-32)}`),e("button",{className:`${t.tapZone} ${t.tapZoneRight}`,onClick:()=>k(1),"aria-label":"Next page",children:e("span",{className:t.tapChevron,children:e($,{name:"chevron-right",size:16})})})]}),e("nav",{className:t.pagination,"aria-label":"Page navigation",children:[e("button",{className:t.pageBtn,disabled:d<=0,onClick:()=>k(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[d+1," / ",s.length]}),e("button",{className:t.pageBtn,disabled:d>=s.length-1,onClick:()=>k(1),children:"Next page"})]})]}),(a||o)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!a,onClick:()=>K(a),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!o,onClick:()=>K(o),children:"Next chapter"})]})]})},Ue=800,De=5e3;function Xe(){const{provider:h="",id:p=""}=ve(),[f]=be(),y=we(),C=f.get("chapter")||"",v=f.get("rating")||"safe",{hasConsent:u}=Te(),q=u?v:"safe",c=h&&p?Ie(h,p):"",P=h.toLowerCase()==="anilist";g(()=>{P&&p&&y(`/manga/anilist/${encodeURIComponent(p)}`,{replace:!0})},[P,p,y]);const B=$e(!P&&h?h:null,!P&&p?p:null,q,u),i=B.data,{titlePreference:d}=Le(),z=i?Pe(i,d):"Manga",A=Re(c||void 0),M=Me(),b=i&&C?i.chapters.find(a=>a.id===C)??null:null,S=xe(C),N=S!=null&&i?Ee(i.chapters,S):null;g(()=>{if(S!=null&&N&&N.id!==C){const a=new URLSearchParams;a.set("chapter",N.id),u&&v!=="safe"&&a.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${a.toString()}`,{replace:!0})}},[S,N,C,u,v,h,p,y]);const x=S!=null&&!!i&&!!N,X=S!=null&&!!i&&!N,_=Ne(()=>{const a=(A.data?.progress??[]).find(o=>o.chapterId===C);return a&&a.page>0?a.page:0},[A.data,C]),Y=_>1?_-1:0,R=w(null),s=w(null),m=Z(()=>{R.current&&(clearTimeout(R.current),R.current=null);const a=s.current;s.current=null,a&&c&&M.mutate({mangaId:c,chapterId:a.chapterId,chapterNumber:a.chapterNumber,page:a.page,pageCount:a.pageCount,title:i?.title??null,cover:i?.cover??null,provider:h||null,altTitle:i?.altTitle??null,contentRating:i?.contentRating??null})},[c,M,i?.title,i?.cover,i?.altTitle,i?.contentRating,h]),I=Z((a,o)=>{b&&(s.current={chapterId:b.id,chapterNumber:b.number,page:a,pageCount:o},R.current&&clearTimeout(R.current),R.current=setTimeout(m,Ue))},[b,m]);g(()=>{m()},[C,m]),g(()=>()=>m(),[m]),g(()=>{const a=window.setInterval(()=>{s.current&&m()},De);return()=>window.clearInterval(a)},[m]),g(()=>{const a=()=>{document.visibilityState==="hidden"&&m()},o=()=>m();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",o)}},[m]);const F=w("");F.current||(F.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),g(()=>{if(!i||!b)return;const a=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{oe.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${b.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:a,sessionId:F.current}).catch(()=>{}),oe.discord.heartbeat.mutate({sessionId:F.current}).catch(()=>{})};o();const k=window.setInterval(o,6e4);return()=>window.clearInterval(k)},[i,b]);const E=a=>{if(m(),a.externalUrl){window.open(a.externalUrl,"_blank","noopener,noreferrer");return}const o=new URLSearchParams;o.set("chapter",a.id),u&&v!=="safe"&&o.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${o.toString()}`)},T=()=>{m();const a=new URLSearchParams;u&&v!=="safe"&&a.set("rating",v);const o=a.toString()?`?${a.toString()}`:"";y(`/manga/${h}/${encodeURIComponent(p)}${o}`)};return P?null:e("div",{className:Be.page,children:B.isLoading||x?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((a,o)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},o))}):!i||!b?e(ce,{children:[e("button",{className:t.backBtn,onClick:T,children:"Back to title"}),e(ye,{message:X?`Chapter ${S} isn't available from ${h} for this title.`:"Failed to load this chapter. Please try again."})]}):e(Fe,{provider:h,mangaTitle:z,chapter:b,chapters:i.chapters,onBack:T,onOpenChapter:E,initialPage:Y,onProgress:I},b.id)})}export{Xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as n,u as l}from"./vendor-core-DfaOB3Rn.js";import{R as i}from"./ResetProgressModal-
|
|
1
|
+
import{d as n,u as l}from"./vendor-core-DfaOB3Rn.js";import{R as i}from"./ResetProgressModal-CZieLUpX.js";import{B as f,o as R}from"./useMangaLibrary-RpiA2f_k.js";const p=({mangaId:e,title:a,onClose:s})=>{const[r,o]=n(!1),t=f(),m=R();return l(i,{isOpen:!!e,itemName:a,progressKind:"reading",listLabel:"my reading list",alsoRemove:r,onAlsoRemoveChange:o,onClose:()=>{o(!1),s()},onConfirm:()=>{e&&(t.mutate({mangaId:e}),r&&m.mutate(e),o(!1),s())}})};export{p as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as t,a as ke,p as $e,h as ue,d as n,T as me,S as he}from"./vendor-core-DfaOB3Rn.js";import{b as ge}from"./vendor-query-BBT5_sHx.js";import{B as O,M as qe,h as Fe,e as xe,N as Ue,t as F,z as Ye}from"./index-CfgPGaUO.js";import{I as pe}from"./vendor-icons-DrybRNxP.js";import{S as Ve,P as ve}from"./SkeletonGrid-gCly-9x7.js";import{A as We}from"./AnimeCard-CEDL_2lC.js";import{E as je}from"./ErrorMessage-DAxegITP.js";import{u as He}from"./useProviders-DDPMV3HX.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-Dpkjj68s.js";import"./QueueOptionsButton-MpSKva6y.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-fN3GQyTJ.js";import"./useIsMobile-Dvx1uJ82.js";const Ke=({isOpen:u,onClose:c,onGrant:s})=>t(qe,{isOpen:u,title:"Content Warning",onClose:c,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(O,{variant:"secondary",onClick:c,children:"Go Back"}),t(O,{onClick:s,children:"I'm 18+, Continue"})]})]})}),Qe="_shrinkSelect_130sm_1",ze="_tightGrid_130sm_7",Q={shrinkSelect:Qe,tightGrid:ze},Ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],Je=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Xe=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],et=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],tt={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},at=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],fe=u=>u.split("-").map(c=>c&&c[0].toUpperCase()+c.slice(1)).join(" "),rt=new Set(["page","limit","year","minScore","minEpisodes"]),st=new Set(["provider","query","page","limit","type","status","season","year","country","genres","genre","excludeGenres","sortBy","order","studio","blacklist","minScore","minEpisodes"]);function it(u){const c=new URLSearchParams(u),s={};for(const[y,b]of c.entries())st.has(y)&&(rt.has(y)?s[y]=Number(b)||0:s[y]=b);return s}function Ct(){const u=ke(),c=Fe(),[s,y]=$e(),{hasConsent:b,grant:Se}=xe();ue(()=>{document.title="Mature - dango"},[]);const[i,ye]=n(s.get("provider")||"anilist"),[C,z]=n(s.get("query")||""),[T,x]=n(s.get("query")||""),[I,g]=n(parseInt(s.get("page")||"1",10)||1),[_,U]=n(()=>{const e=s.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[D,Z]=n(s.get("sortBy")||""),[N,be]=n(s.get("status")||""),[G,Ce]=n(s.get("season")||"ALL"),[B,Ne]=n(s.get("year")||"ALL"),[p,M]=n(s.get("genre")||s.get("genres")||""),[Y,Ae]=n(s.get("order")||"recent"),[V,Ee]=n(s.get("studio")||""),[w,Pe]=n(s.get("studio")||""),[J,X]=n([]),[W,Re]=n(!1),[Le,ee]=n(null),{options:te}=He(),ae=me(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=me(()=>[...Ze,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:k}=ge({...c.data.matureFilters.queryOptions(),enabled:b,staleTime:1/0}),d=i==="anilist"||i==="mal",j=d?void 0:k?.providers?.[i],P=j?.browse,R=j?.genres??[],A=j?.orders??[],se=A.length>0&&!A.includes(Y)?A[0]:Y,$=!d&&(P?.genre===!0||R.length>0||J.length>0),v=!d&&(P?.order===!0||A.length>0),E=!d&&P?.studio===!0,ie=!d&&P?.sort===!0,H=d?14:P?.pageSize??14,f=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const l=k?.providers?.[e.provider]?.browse,m=k?.providers?.[e.provider]?.orders??[],o=m.length>0&&!m.includes(e.remoteOrder)?m[0]:e.remoteOrder;(!l||l.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!l||l.genre)&&e.genre&&r.set("genre",e.genre),(!l||l.order)&&o!==(m[0]??"recent")&&r.set("order",o),(!l||l.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}y(r,{replace:!0})},S=(e={})=>({provider:i,query:T,page:I,sort:_,remoteSort:D,status:N,season:G,year:B,genre:p,remoteOrder:Y,studio:w,...e}),Oe=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(I)),e.set("limit",String(H)),i==="anilist"&&(e.set("sortBy",_),N&&e.set("status",N),G!=="ALL"&&e.set("season",G),B!=="ALL"&&e.set("year",B)),i==="mal"?(e.set("sortBy",_),N&&e.set("status",N)):d||($&&p&&e.set("genre",p),v&&e.set("order",se),ie&&D&&e.set("sortBy",D),E&&w.trim()&&e.set("studio",w.trim())),e.toString()})(),{data:h,isLoading:Te,isError:Ie,error:_e}=ge({...c.data.matureSearch.queryOptions(it(Oe)),enabled:b});ue(()=>{const e=h?.genres;!d&&R.length===0&&e&&e.length>0&&X(r=>{const l=new Set(r.map(o=>o.slug)),m=[...r];for(const o of e)o.slug&&!l.has(o.slug)&&(l.add(o.slug),m.push(o));return m.length===r.length?r:m})},[h,i,d,R.length]);const q=(h?.data||[]).map(e=>({...e,isAdult:!0})),ne=h?.hasMore??!1,le=h?.total!=null?Math.max(1,Math.ceil(h.total/H)):void 0,L=()=>{Ue(),g(1);let e=p;!d&&!v&&C.trim()&&(e=""),M(e),E&&Pe(V),x(C),f(S({query:C,page:1,genre:e,studio:E?V:w}))},De=e=>{ye(e),g(1),Z(""),M(""),X([]),e==="mal"?U("SCORE_DESC"):e==="anilist"&&U("POPULARITY_DESC"),x(C),f(S({provider:e,page:1,remoteSort:"",genre:"",query:C}))},Ge=e=>{M(e),g(1),e&&(z(""),x("")),f(S({genre:e,page:1,query:e?"":T}))},oe=e=>{g(e),f(S({page:e})),window.scrollTo({top:0,behavior:"smooth"})},Be=async(e,r)=>{const l=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(l)&&(e.preventDefault(),e.stopPropagation(),!Le)){ee(l);try{if(i!=="anilist"){let o=!1;try{o=(await F.data.anilistStatus.query())?.available===!0}catch{o=!1}if(o){const de=await F.data.matureResolve.query({title:r.name});u(`/anime/${de.id}`);return}const ce=await F.data.matureAllocate.mutate({provider:i,nativeId:l,title:r.name,thumbnail:r.thumbnail});if(!ce?.id)throw new Error("Allocate failed");u(`/anime/${ce.id}`);return}const m=await F.data.matureResolve.query({title:r.name});u(`/anime/${m.id}`)}catch{Ye.error("Could not match this title on AniList")}finally{ee(null)}}},K=new Date().getFullYear(),Me=[{value:"ALL",label:"All Years"},...Array.from({length:K-1980+1},(e,r)=>({value:String(K-r),label:String(K-r)}))],we=R.length>0?R.map(e=>({value:e,label:fe(e)})):J.map(e=>({value:e.slug,label:e.name}));return b?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(pe,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:C,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>De(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:L,className:a.searchBtn,children:"Search"}),d&&t("button",{onClick:()=>Re(!W),className:`${a.filterToggleBtn} ${W?a.active:""}`,children:[t(pe,{name:"filter"})," Filters"]}),ie&&t("select",{value:D,onChange:e=>{Z(e.target.value),g(1),f(S({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:et.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${W?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:_,onChange:e=>U(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:N,onChange:e=>be(e.currentTarget.value),children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(he,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:G,onChange:e=>Ce(e.currentTarget.value),children:at.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:B,onChange:e=>Ne(e.currentTarget.value),children:Me.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]}),!d&&!!k&&($||v||E)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${Q.tightGrid}`,children:[v&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:se,onChange:e=>{Ae(e.target.value),g(1),f(S({remoteOrder:e.target.value,page:1}))},children:(A.length>0?A:["recent"]).map(e=>t("option",{value:e,children:tt[e]||e},e))})]}),$&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:p,onChange:e=>{v?(M(e.target.value),g(1),f(S({genre:e.target.value,page:1}))):Ge(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),we.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),E&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:V,onChange:e=>Ee(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]})]}),p&&$&&!v&&t("p",{className:a.pageSubtitle,children:["Browsing the ",fe(p)," genre — search text is ignored while a genre is selected."]}),(v||E)&&t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]})]}),Ie&&t(je,{message:_e?.message||"Search failed"}),Te?t(Ve,{count:H}):q.length===0?t("div",{className:a.noResults,children:[t("h3",{children:"No results found"}),t("p",{children:"Try a different query, genre or provider"})]}):t(he,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[h?.total??q.length," result",(h?.total??q.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(ve,{page:I,totalPages:le,canGoNext:ne,onChange:oe,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:q.map(e=>t("div",{onClickCapture:r=>Be(r,e),children:t(We,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(ve,{page:I,totalPages:le,canGoNext:ne,onChange:oe,variant:"labeled"})})})]})]}):t(Ke,{isOpen:!0,onClose:()=>u("/"),onGrant:Se})}export{Ct as default};
|
|
1
|
+
import{u as t,a as ke,p as $e,h as ue,d as n,T as me,S as he}from"./vendor-core-DfaOB3Rn.js";import{b as ge}from"./vendor-query-BBT5_sHx.js";import{B as O,M as qe,h as Fe,e as xe,N as Ue,t as F,z as Ye}from"./index-VzVAYX5A.js";import{I as pe}from"./vendor-icons-DrybRNxP.js";import{S as Ve,P as ve}from"./SkeletonGrid-DJKwfPjg.js";import{A as We}from"./AnimeCard-KCdQSFYo.js";import{E as je}from"./ErrorMessage-DAxegITP.js";import{u as He}from"./useProviders-vzvT6VhD.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-BpD2dXLB.js";import"./QueueOptionsButton-BN-6sbNV.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-tBWyjKaV.js";import"./useIsMobile-Dvx1uJ82.js";const Ke=({isOpen:u,onClose:c,onGrant:s})=>t(qe,{isOpen:u,title:"Content Warning",onClose:c,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(O,{variant:"secondary",onClick:c,children:"Go Back"}),t(O,{onClick:s,children:"I'm 18+, Continue"})]})]})}),Qe="_shrinkSelect_130sm_1",ze="_tightGrid_130sm_7",Q={shrinkSelect:Qe,tightGrid:ze},Ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],Je=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Xe=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],et=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],tt={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},at=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],fe=u=>u.split("-").map(c=>c&&c[0].toUpperCase()+c.slice(1)).join(" "),rt=new Set(["page","limit","year","minScore","minEpisodes"]),st=new Set(["provider","query","page","limit","type","status","season","year","country","genres","genre","excludeGenres","sortBy","order","studio","blacklist","minScore","minEpisodes"]);function it(u){const c=new URLSearchParams(u),s={};for(const[y,b]of c.entries())st.has(y)&&(rt.has(y)?s[y]=Number(b)||0:s[y]=b);return s}function Ct(){const u=ke(),c=Fe(),[s,y]=$e(),{hasConsent:b,grant:Se}=xe();ue(()=>{document.title="Mature - dango"},[]);const[i,ye]=n(s.get("provider")||"anilist"),[C,z]=n(s.get("query")||""),[T,x]=n(s.get("query")||""),[I,g]=n(parseInt(s.get("page")||"1",10)||1),[_,U]=n(()=>{const e=s.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[D,Z]=n(s.get("sortBy")||""),[N,be]=n(s.get("status")||""),[G,Ce]=n(s.get("season")||"ALL"),[B,Ne]=n(s.get("year")||"ALL"),[p,M]=n(s.get("genre")||s.get("genres")||""),[Y,Ae]=n(s.get("order")||"recent"),[V,Ee]=n(s.get("studio")||""),[w,Pe]=n(s.get("studio")||""),[J,X]=n([]),[W,Re]=n(!1),[Le,ee]=n(null),{options:te}=He(),ae=me(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=me(()=>[...Ze,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:k}=ge({...c.data.matureFilters.queryOptions(),enabled:b,staleTime:1/0}),d=i==="anilist"||i==="mal",j=d?void 0:k?.providers?.[i],P=j?.browse,R=j?.genres??[],A=j?.orders??[],se=A.length>0&&!A.includes(Y)?A[0]:Y,$=!d&&(P?.genre===!0||R.length>0||J.length>0),v=!d&&(P?.order===!0||A.length>0),E=!d&&P?.studio===!0,ie=!d&&P?.sort===!0,H=d?14:P?.pageSize??14,f=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const l=k?.providers?.[e.provider]?.browse,m=k?.providers?.[e.provider]?.orders??[],o=m.length>0&&!m.includes(e.remoteOrder)?m[0]:e.remoteOrder;(!l||l.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!l||l.genre)&&e.genre&&r.set("genre",e.genre),(!l||l.order)&&o!==(m[0]??"recent")&&r.set("order",o),(!l||l.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}y(r,{replace:!0})},S=(e={})=>({provider:i,query:T,page:I,sort:_,remoteSort:D,status:N,season:G,year:B,genre:p,remoteOrder:Y,studio:w,...e}),Oe=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(I)),e.set("limit",String(H)),i==="anilist"&&(e.set("sortBy",_),N&&e.set("status",N),G!=="ALL"&&e.set("season",G),B!=="ALL"&&e.set("year",B)),i==="mal"?(e.set("sortBy",_),N&&e.set("status",N)):d||($&&p&&e.set("genre",p),v&&e.set("order",se),ie&&D&&e.set("sortBy",D),E&&w.trim()&&e.set("studio",w.trim())),e.toString()})(),{data:h,isLoading:Te,isError:Ie,error:_e}=ge({...c.data.matureSearch.queryOptions(it(Oe)),enabled:b});ue(()=>{const e=h?.genres;!d&&R.length===0&&e&&e.length>0&&X(r=>{const l=new Set(r.map(o=>o.slug)),m=[...r];for(const o of e)o.slug&&!l.has(o.slug)&&(l.add(o.slug),m.push(o));return m.length===r.length?r:m})},[h,i,d,R.length]);const q=(h?.data||[]).map(e=>({...e,isAdult:!0})),ne=h?.hasMore??!1,le=h?.total!=null?Math.max(1,Math.ceil(h.total/H)):void 0,L=()=>{Ue(),g(1);let e=p;!d&&!v&&C.trim()&&(e=""),M(e),E&&Pe(V),x(C),f(S({query:C,page:1,genre:e,studio:E?V:w}))},De=e=>{ye(e),g(1),Z(""),M(""),X([]),e==="mal"?U("SCORE_DESC"):e==="anilist"&&U("POPULARITY_DESC"),x(C),f(S({provider:e,page:1,remoteSort:"",genre:"",query:C}))},Ge=e=>{M(e),g(1),e&&(z(""),x("")),f(S({genre:e,page:1,query:e?"":T}))},oe=e=>{g(e),f(S({page:e})),window.scrollTo({top:0,behavior:"smooth"})},Be=async(e,r)=>{const l=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(l)&&(e.preventDefault(),e.stopPropagation(),!Le)){ee(l);try{if(i!=="anilist"){let o=!1;try{o=(await F.data.anilistStatus.query())?.available===!0}catch{o=!1}if(o){const de=await F.data.matureResolve.query({title:r.name});u(`/anime/${de.id}`);return}const ce=await F.data.matureAllocate.mutate({provider:i,nativeId:l,title:r.name,thumbnail:r.thumbnail});if(!ce?.id)throw new Error("Allocate failed");u(`/anime/${ce.id}`);return}const m=await F.data.matureResolve.query({title:r.name});u(`/anime/${m.id}`)}catch{Ye.error("Could not match this title on AniList")}finally{ee(null)}}},K=new Date().getFullYear(),Me=[{value:"ALL",label:"All Years"},...Array.from({length:K-1980+1},(e,r)=>({value:String(K-r),label:String(K-r)}))],we=R.length>0?R.map(e=>({value:e,label:fe(e)})):J.map(e=>({value:e.slug,label:e.name}));return b?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(pe,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:C,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>De(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:L,className:a.searchBtn,children:"Search"}),d&&t("button",{onClick:()=>Re(!W),className:`${a.filterToggleBtn} ${W?a.active:""}`,children:[t(pe,{name:"filter"})," Filters"]}),ie&&t("select",{value:D,onChange:e=>{Z(e.target.value),g(1),f(S({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:et.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${W?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:_,onChange:e=>U(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:N,onChange:e=>be(e.currentTarget.value),children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(he,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:G,onChange:e=>Ce(e.currentTarget.value),children:at.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:B,onChange:e=>Ne(e.currentTarget.value),children:Me.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]}),!d&&!!k&&($||v||E)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${Q.tightGrid}`,children:[v&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:se,onChange:e=>{Ae(e.target.value),g(1),f(S({remoteOrder:e.target.value,page:1}))},children:(A.length>0?A:["recent"]).map(e=>t("option",{value:e,children:tt[e]||e},e))})]}),$&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:p,onChange:e=>{v?(M(e.target.value),g(1),f(S({genre:e.target.value,page:1}))):Ge(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),we.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),E&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:V,onChange:e=>Ee(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]})]}),p&&$&&!v&&t("p",{className:a.pageSubtitle,children:["Browsing the ",fe(p)," genre — search text is ignored while a genre is selected."]}),(v||E)&&t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]})]}),Ie&&t(je,{message:_e?.message||"Search failed"}),Te?t(Ve,{count:H}):q.length===0?t("div",{className:a.noResults,children:[t("h3",{children:"No results found"}),t("p",{children:"Try a different query, genre or provider"})]}):t(he,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[h?.total??q.length," result",(h?.total??q.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(ve,{page:I,totalPages:le,canGoNext:ne,onChange:oe,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:q.map(e=>t("div",{onClickCapture:r=>Be(r,e),children:t(We,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(ve,{page:I,totalPages:le,canGoNext:ne,onChange:oe,variant:"labeled"})})})]})]}):t(Ke,{isOpen:!0,onClose:()=>u("/"),onGrant:Se})}export{Ct as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as T,u as e,S as ee,$ as Ee,d as x,h as K,A as M,q as d,N as Se,a as Ie,L as Re}from"./vendor-core-DfaOB3Rn.js";import{a as Ae,b as Le,f as $e,s as ke}from"./vendor-ui-3qrARCPr.js";import{u as te}from"./useIsMobile-Dvx1uJ82.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{t as Oe,d as ze,u as De,a as Ue,f as Ve,M as Ge,B as Q}from"./index-CfgPGaUO.js";const We="_popupPortal_7glox_1",Ye="_popupContent_7glox_6",je="_popupBackdrop_7glox_31",Fe="_mobile_7glox_38",Xe="_header_7glox_62",qe="_title_7glox_67",He="_body_7glox_87",Je="_metaRow_7glox_94",Ke="_metaItem_7glox_101",Qe="_scoreIcon_7glox_107",Ze="_synopsis_7glox_111",et="_details_7glox_121",tt="_detailItem_7glox_129",nt="_genres_7glox_133",ot="_genre_7glox_133",rt="_footer_7glox_148",st="_primaryAction_7glox_157",at="_watchBtn_7glox_161",lt="_secondaryActions_7glox_184",ct="_watchlistBtn_7glox_189",it="_detailsBtn_7glox_190",dt="_active_7glox_216",ut="_loading_7glox_227",_t="_spinner_7glox_237",R={popupPortal:We,popupContent:Ye,popupBackdrop:je,mobile:Fe,header:Xe,title:qe,body:He,metaRow:Je,metaItem:Ke,scoreIcon:Qe,synopsis:Ze,details:et,detailItem:tt,genres:nt,genre:ot,footer:rt,primaryAction:st,watchBtn:at,secondaryActions:lt,watchlistBtn:ct,detailsBtn:it,active:dt,loading:ut,spinner:_t},cn=({anchorRect:t,onMouseEnter:a,onMouseLeave:l,onRequestClose:c,children:u})=>{const i=te(),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Ae({placement:"right-start",middleware:[$e({fallbackAxisSideDirection:"start"}),ke({padding:20})],whileElementsMounted:Le});T.useEffect(()=>{w.setPositionReference(r)},[w,r]),T.useEffect(()=>{if(!i)return;const y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y}},[i]);const _=e(ee,{children:[i&&e("div",{className:R.popupBackdrop,onClick:()=>c?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:l,children:e("div",{className:R.popupContent,children:u})})]});return Ee(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[l,c]=x(a);return K(()=>{c(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return Oe.data.showMeta.query({id:t}).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&c(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:l}}const mt="_cardWrapper_w7bu0_1",ft="_card_w7bu0_1",ht="_cardButton_w7bu0_35",bt="_hoverOverlay_w7bu0_60",Bt="_matureOverlay_w7bu0_81",wt="_posterContainer_w7bu0_91",vt="_horizontal_w7bu0_100",yt="_posterImg_w7bu0_104",Ct="_blurred_w7bu0_116",Mt="_flat_w7bu0_139",xt="_loaded_w7bu0_143",Tt="_posterGradient_w7bu0_147",Pt="_progressSection_w7bu0_167",Nt="_titleSection_w7bu0_174",Et="_title_w7bu0_174",St="_titleText_w7bu0_193",It="_badge_w7bu0_205",Rt="_typeBadge_w7bu0_216 _badge_w7bu0_205",At="_epBadge_w7bu0_225 _badge_w7bu0_205",Lt="_airTime_w7bu0_234",$t="_adultBadge_w7bu0_241 _badge_w7bu0_205",kt="_gated_w7bu0_254",Ot="_notAiredBadge_w7bu0_260 _badge_w7bu0_205",zt="_metaRow_w7bu0_275",Dt="_metaItem_w7bu0_286",Ut="_progressContainer_w7bu0_303",Vt="_progressBar_w7bu0_311",Gt="_timestamp_w7bu0_318",Wt="_removeBtn_w7bu0_323",Yt="_infoBtn_w7bu0_324",jt="_mobileBadges_w7bu0_375",Ft="_mobileBadgeBase_w7bu0_382",Xt="_mobileType_w7bu0_390 _mobileBadgeBase_w7bu0_382",qt="_mobileEp_w7bu0_397 _mobileBadgeBase_w7bu0_382",Ht="_vertical_w7bu0_489",Jt="_placeholder_w7bu0_504",Kt="_placeholderText_w7bu0_513",Qt="_lowEnd_w7bu0_520",n={cardWrapper:mt,card:ft,cardButton:ht,hoverOverlay:bt,matureOverlay:Bt,posterContainer:wt,horizontal:vt,posterImg:yt,blurred:Ct,flat:Mt,loaded:xt,posterGradient:Tt,progressSection:Pt,titleSection:Nt,title:Et,titleText:St,badge:It,typeBadge:Rt,epBadge:At,airTime:Lt,adultBadge:$t,gated:kt,notAiredBadge:Ot,metaRow:zt,metaItem:Dt,progressContainer:Ut,progressBar:Vt,timestamp:Gt,removeBtn:Wt,infoBtn:Yt,mobileBadges:jt,mobileBadgeBase:Ft,mobileType:Xt,mobileEp:qt,vertical:Ht,placeholder:Jt,placeholderText:Kt,lowEnd:Qt},Zt=500,Z=20,en=300;function tn(t){const a=M(null),l=M(null),c=M(!1),u=M({x:0,y:0}),i=M(null),r=d(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),w=d(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),b=d(s=>{a.current&&clearTimeout(a.current),a.current=setTimeout(s,en)},[]),_=d((s,p=!1)=>{c.current=p,t(s,p)},[t]),y=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,c.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),l.current=setTimeout(()=>{l.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!l.current)return;const p=Math.abs(s.clientX-u.current.x),m=Math.abs(s.clientY-u.current.y);(p>Z||m>Z)&&r()},[r]),g=d(()=>{r(),i.current=null},[r]),P=d((s,p)=>{s.preventDefault(),s.stopPropagation(),i.current==="touch"?l.current&&(clearTimeout(l.current),l.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!c.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>c.current?(c.current=!1,!0):!1,[]);return{longPressFiredRef:c,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown:y,handlePointerMove:B,handlePointerUpOrCancel:g,handleContextMenu:P,consumeLongPressClick:A}}const z={elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!0}}},dn=Se(({item:t,linkTo:a,hoverIcon:l,progress:c,showProgress:u=!1,metaRow:i,display:r,layout:w="vertical",onRemove:b,showRemoveButton:_,showInfoButton:y=!1,onOpenDetails:B,renderPopup:g,onPopupHoverIntent:P,rawThumbnail:A,enrichedId:s})=>{const p=Ie(),m=te(),{titlePreference:ne}=ze(),{lowEndMode:C}=De(),[oe,re]=x(!1),[se,D]=x(!1),{thumbnail:U}=gt(s,t.thumbnail),[L,V]=x(!1),[G,W]=x(null),Y=o=>{W(o),V(!0)},$=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose($)},[f,$]),j=f.clearPopupTimeout,ae=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},le=()=>{g&&k()},ce=()=>{j()},ie=()=>{g&&k()},de=o=>{f.handlePointerDown(o,h)},ue=o=>{f.handlePointerMove(o)},F=()=>{f.handlePointerUpOrCancel()},_e=o=>{if(B){o.preventDefault(),o.stopPropagation(),B(o.currentTarget.getBoundingClientRect());return}if(g){f.handleContextMenu(o,h);return}f.handleContextMenu(o,h)},X={...r,elements:{...z.elements,...r?.elements||{},poster:{...z.elements?.poster,...r?.elements?.poster||{}},info:{...z.elements?.info,...r?.elements?.info||{}}}},O=t[ne]||t.title,N=X.elements?.poster,E=X.elements?.info,pe=(N?.typeBadge??!0)&&!!t.typeBadge,ge=(N?.chapterBadge??!0)&&!!t.chapterBadge,me=_??N?.removeButton??!!b,fe=N?.adultBadge??!0,he=E?.mobileBadges??!0,be=E?.progress??!0,Be=E?.meta??!0,we=u&&!!c&&c.percent>0,q=!!t.isAdult,[ve,ye]=Ue("agreedToViewMature","false"),Ce=ve==="true",[H,S]=T.useState(!1),I=T.useRef(null),Me=()=>{ye("true"),S(!1),I.current&&(p(I.current),I.current=null)},h=q&&!Ce,xe=o=>{if(f.consumeLongPressClick()){o.preventDefault(),o.stopPropagation();return}h&&(o.preventDefault(),o.stopPropagation(),I.current=a,S(!0))},Te=l==="book"?e(v,{name:"book",size:28}):l==="play"?e(v,{name:"play",size:28}):l==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),Pe=d(o=>{o.preventDefault(),o.stopPropagation(),b&&b(t.id)},[b,t.id]),Ne=A?U??t.thumbnail:Ve(U,C?100:150,C?150:200);return e("div",{className:`${n.cardWrapper} ${C?n.lowEnd:""}`,onMouseEnter:()=>{D(!0),P?.(!0),L&&j()},onMouseLeave:()=>{D(!1),P?.(!1),L&&k()},children:[e(Re,{to:a,className:`${n.card} ${n[w]} ${h?n.cardButton:""}`,onClick:xe,onContextMenu:_e,onPointerDown:de,onPointerMove:ue,onPointerUp:F,onPointerCancel:F,children:[e("div",{className:n.posterContainer,children:[h&&e("div",{className:`${n.matureOverlay} ${C?n.flat:""}`}),e("img",{src:Ne,alt:O,className:`${n.posterImg} ${oe?n.loaded:""} ${h&&!C?n.blurred:""}`,loading:"lazy",decoding:"async",onLoad:()=>re(!0)}),!m&&e(ee,{children:[pe&&e("div",{className:n.typeBadge,children:t.typeBadge}),ge&&e("div",{className:n.epBadge,children:[t.chapterBadge,t.airMeta&&e("span",{className:n.airTime,children:t.airMeta})]})]}),fe&&q&&e("div",{className:`${n.adultBadge} ${h?n.gated:""}`,children:"18+"}),t.notAired&&e("div",{className:n.notAiredBadge,children:"NOT AIRED"}),!m&&se&&e("div",{className:n.hoverOverlay,children:Te})]}),be&&u&&we&&c&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${c.percent}%`}})}),e("div",{className:n.timestamp,children:c.label})]}),e("div",{className:n.titleSection,children:[m&&he&&e("div",{className:n.mobileBadges,children:[!!t.typeBadge&&e("span",{className:n.mobileType,children:t.typeBadge}),t.chapterBadge&&e("span",{className:n.mobileEp,children:t.chapterBadge})]}),E?.title!==!1&&e("div",{className:n.title,title:O,children:e("span",{className:n.titleText,children:O})}),Be&&i&&e("div",{className:n.metaRow,children:i})]})]}),H&&e(Ge,{isOpen:H,title:"Content Warning",onClose:()=>S(!1),children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:"This title contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," ","(or the age of majority in your jurisdiction) and wish to view this content."]}),e("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"1rem"},children:["You can reset this preference at any time in the ",e("strong",{children:"Settings"})," page."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(Q,{variant:"secondary",onClick:()=>S(!1),children:"Go Back"}),e(Q,{onClick:Me,children:"I'm 18+, Continue"})]})]})}),me&&e("button",{className:n.removeBtn,onClick:Pe,"aria-label":"Remove",children:e(v,{name:"times",size:10})}),y&&!m&&!h&&e("button",{className:n.infoBtn,onMouseEnter:ae,onMouseLeave:le,"aria-label":"Info",children:e(v,{name:"info",size:11})}),g&&L&&G?g(G,{close:$,onMouseEnter:ce,onMouseLeave:ie}):null]})});export{dn as M,cn as a,n as m,R as p};
|
|
1
|
+
import{g as T,u as e,S as ee,$ as Ee,d as x,h as K,A as M,q as d,N as Se,a as Ie,L as Re}from"./vendor-core-DfaOB3Rn.js";import{a as Ae,b as Le,f as $e,s as ke}from"./vendor-ui-3qrARCPr.js";import{u as te}from"./useIsMobile-Dvx1uJ82.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{t as Oe,d as ze,u as De,a as Ue,f as Ve,M as Ge,B as Q}from"./index-VzVAYX5A.js";const We="_popupPortal_7glox_1",Ye="_popupContent_7glox_6",je="_popupBackdrop_7glox_31",Fe="_mobile_7glox_38",Xe="_header_7glox_62",qe="_title_7glox_67",He="_body_7glox_87",Je="_metaRow_7glox_94",Ke="_metaItem_7glox_101",Qe="_scoreIcon_7glox_107",Ze="_synopsis_7glox_111",et="_details_7glox_121",tt="_detailItem_7glox_129",nt="_genres_7glox_133",ot="_genre_7glox_133",rt="_footer_7glox_148",st="_primaryAction_7glox_157",at="_watchBtn_7glox_161",lt="_secondaryActions_7glox_184",ct="_watchlistBtn_7glox_189",it="_detailsBtn_7glox_190",dt="_active_7glox_216",ut="_loading_7glox_227",_t="_spinner_7glox_237",R={popupPortal:We,popupContent:Ye,popupBackdrop:je,mobile:Fe,header:Xe,title:qe,body:He,metaRow:Je,metaItem:Ke,scoreIcon:Qe,synopsis:Ze,details:et,detailItem:tt,genres:nt,genre:ot,footer:rt,primaryAction:st,watchBtn:at,secondaryActions:lt,watchlistBtn:ct,detailsBtn:it,active:dt,loading:ut,spinner:_t},cn=({anchorRect:t,onMouseEnter:a,onMouseLeave:l,onRequestClose:c,children:u})=>{const i=te(),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Ae({placement:"right-start",middleware:[$e({fallbackAxisSideDirection:"start"}),ke({padding:20})],whileElementsMounted:Le});T.useEffect(()=>{w.setPositionReference(r)},[w,r]),T.useEffect(()=>{if(!i)return;const y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y}},[i]);const _=e(ee,{children:[i&&e("div",{className:R.popupBackdrop,onClick:()=>c?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:l,children:e("div",{className:R.popupContent,children:u})})]});return Ee(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[l,c]=x(a);return K(()=>{c(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return Oe.data.showMeta.query({id:t}).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&c(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:l}}const mt="_cardWrapper_w7bu0_1",ft="_card_w7bu0_1",ht="_cardButton_w7bu0_35",bt="_hoverOverlay_w7bu0_60",Bt="_matureOverlay_w7bu0_81",wt="_posterContainer_w7bu0_91",vt="_horizontal_w7bu0_100",yt="_posterImg_w7bu0_104",Ct="_blurred_w7bu0_116",Mt="_flat_w7bu0_139",xt="_loaded_w7bu0_143",Tt="_posterGradient_w7bu0_147",Pt="_progressSection_w7bu0_167",Nt="_titleSection_w7bu0_174",Et="_title_w7bu0_174",St="_titleText_w7bu0_193",It="_badge_w7bu0_205",Rt="_typeBadge_w7bu0_216 _badge_w7bu0_205",At="_epBadge_w7bu0_225 _badge_w7bu0_205",Lt="_airTime_w7bu0_234",$t="_adultBadge_w7bu0_241 _badge_w7bu0_205",kt="_gated_w7bu0_254",Ot="_notAiredBadge_w7bu0_260 _badge_w7bu0_205",zt="_metaRow_w7bu0_275",Dt="_metaItem_w7bu0_286",Ut="_progressContainer_w7bu0_303",Vt="_progressBar_w7bu0_311",Gt="_timestamp_w7bu0_318",Wt="_removeBtn_w7bu0_323",Yt="_infoBtn_w7bu0_324",jt="_mobileBadges_w7bu0_375",Ft="_mobileBadgeBase_w7bu0_382",Xt="_mobileType_w7bu0_390 _mobileBadgeBase_w7bu0_382",qt="_mobileEp_w7bu0_397 _mobileBadgeBase_w7bu0_382",Ht="_vertical_w7bu0_489",Jt="_placeholder_w7bu0_504",Kt="_placeholderText_w7bu0_513",Qt="_lowEnd_w7bu0_520",n={cardWrapper:mt,card:ft,cardButton:ht,hoverOverlay:bt,matureOverlay:Bt,posterContainer:wt,horizontal:vt,posterImg:yt,blurred:Ct,flat:Mt,loaded:xt,posterGradient:Tt,progressSection:Pt,titleSection:Nt,title:Et,titleText:St,badge:It,typeBadge:Rt,epBadge:At,airTime:Lt,adultBadge:$t,gated:kt,notAiredBadge:Ot,metaRow:zt,metaItem:Dt,progressContainer:Ut,progressBar:Vt,timestamp:Gt,removeBtn:Wt,infoBtn:Yt,mobileBadges:jt,mobileBadgeBase:Ft,mobileType:Xt,mobileEp:qt,vertical:Ht,placeholder:Jt,placeholderText:Kt,lowEnd:Qt},Zt=500,Z=20,en=300;function tn(t){const a=M(null),l=M(null),c=M(!1),u=M({x:0,y:0}),i=M(null),r=d(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),w=d(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),b=d(s=>{a.current&&clearTimeout(a.current),a.current=setTimeout(s,en)},[]),_=d((s,p=!1)=>{c.current=p,t(s,p)},[t]),y=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,c.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),l.current=setTimeout(()=>{l.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!l.current)return;const p=Math.abs(s.clientX-u.current.x),m=Math.abs(s.clientY-u.current.y);(p>Z||m>Z)&&r()},[r]),g=d(()=>{r(),i.current=null},[r]),P=d((s,p)=>{s.preventDefault(),s.stopPropagation(),i.current==="touch"?l.current&&(clearTimeout(l.current),l.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!c.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>c.current?(c.current=!1,!0):!1,[]);return{longPressFiredRef:c,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown:y,handlePointerMove:B,handlePointerUpOrCancel:g,handleContextMenu:P,consumeLongPressClick:A}}const z={elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!0}}},dn=Se(({item:t,linkTo:a,hoverIcon:l,progress:c,showProgress:u=!1,metaRow:i,display:r,layout:w="vertical",onRemove:b,showRemoveButton:_,showInfoButton:y=!1,onOpenDetails:B,renderPopup:g,onPopupHoverIntent:P,rawThumbnail:A,enrichedId:s})=>{const p=Ie(),m=te(),{titlePreference:ne}=ze(),{lowEndMode:C}=De(),[oe,re]=x(!1),[se,D]=x(!1),{thumbnail:U}=gt(s,t.thumbnail),[L,V]=x(!1),[G,W]=x(null),Y=o=>{W(o),V(!0)},$=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose($)},[f,$]),j=f.clearPopupTimeout,ae=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},le=()=>{g&&k()},ce=()=>{j()},ie=()=>{g&&k()},de=o=>{f.handlePointerDown(o,h)},ue=o=>{f.handlePointerMove(o)},F=()=>{f.handlePointerUpOrCancel()},_e=o=>{if(B){o.preventDefault(),o.stopPropagation(),B(o.currentTarget.getBoundingClientRect());return}if(g){f.handleContextMenu(o,h);return}f.handleContextMenu(o,h)},X={...r,elements:{...z.elements,...r?.elements||{},poster:{...z.elements?.poster,...r?.elements?.poster||{}},info:{...z.elements?.info,...r?.elements?.info||{}}}},O=t[ne]||t.title,N=X.elements?.poster,E=X.elements?.info,pe=(N?.typeBadge??!0)&&!!t.typeBadge,ge=(N?.chapterBadge??!0)&&!!t.chapterBadge,me=_??N?.removeButton??!!b,fe=N?.adultBadge??!0,he=E?.mobileBadges??!0,be=E?.progress??!0,Be=E?.meta??!0,we=u&&!!c&&c.percent>0,q=!!t.isAdult,[ve,ye]=Ue("agreedToViewMature","false"),Ce=ve==="true",[H,S]=T.useState(!1),I=T.useRef(null),Me=()=>{ye("true"),S(!1),I.current&&(p(I.current),I.current=null)},h=q&&!Ce,xe=o=>{if(f.consumeLongPressClick()){o.preventDefault(),o.stopPropagation();return}h&&(o.preventDefault(),o.stopPropagation(),I.current=a,S(!0))},Te=l==="book"?e(v,{name:"book",size:28}):l==="play"?e(v,{name:"play",size:28}):l==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),Pe=d(o=>{o.preventDefault(),o.stopPropagation(),b&&b(t.id)},[b,t.id]),Ne=A?U??t.thumbnail:Ve(U,C?100:150,C?150:200);return e("div",{className:`${n.cardWrapper} ${C?n.lowEnd:""}`,onMouseEnter:()=>{D(!0),P?.(!0),L&&j()},onMouseLeave:()=>{D(!1),P?.(!1),L&&k()},children:[e(Re,{to:a,className:`${n.card} ${n[w]} ${h?n.cardButton:""}`,onClick:xe,onContextMenu:_e,onPointerDown:de,onPointerMove:ue,onPointerUp:F,onPointerCancel:F,children:[e("div",{className:n.posterContainer,children:[h&&e("div",{className:`${n.matureOverlay} ${C?n.flat:""}`}),e("img",{src:Ne,alt:O,className:`${n.posterImg} ${oe?n.loaded:""} ${h&&!C?n.blurred:""}`,loading:"lazy",decoding:"async",onLoad:()=>re(!0)}),!m&&e(ee,{children:[pe&&e("div",{className:n.typeBadge,children:t.typeBadge}),ge&&e("div",{className:n.epBadge,children:[t.chapterBadge,t.airMeta&&e("span",{className:n.airTime,children:t.airMeta})]})]}),fe&&q&&e("div",{className:`${n.adultBadge} ${h?n.gated:""}`,children:"18+"}),t.notAired&&e("div",{className:n.notAiredBadge,children:"NOT AIRED"}),!m&&se&&e("div",{className:n.hoverOverlay,children:Te})]}),be&&u&&we&&c&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${c.percent}%`}})}),e("div",{className:n.timestamp,children:c.label})]}),e("div",{className:n.titleSection,children:[m&&he&&e("div",{className:n.mobileBadges,children:[!!t.typeBadge&&e("span",{className:n.mobileType,children:t.typeBadge}),t.chapterBadge&&e("span",{className:n.mobileEp,children:t.chapterBadge})]}),E?.title!==!1&&e("div",{className:n.title,title:O,children:e("span",{className:n.titleText,children:O})}),Be&&i&&e("div",{className:n.metaRow,children:i})]})]}),H&&e(Ge,{isOpen:H,title:"Content Warning",onClose:()=>S(!1),children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:"This title contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," ","(or the age of majority in your jurisdiction) and wish to view this content."]}),e("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"1rem"},children:["You can reset this preference at any time in the ",e("strong",{children:"Settings"})," page."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(Q,{variant:"secondary",onClick:()=>S(!1),children:"Go Back"}),e(Q,{onClick:Me,children:"I'm 18+, Continue"})]})]})}),me&&e("button",{className:n.removeBtn,onClick:Pe,"aria-label":"Remove",children:e(v,{name:"times",size:10})}),y&&!m&&!h&&e("button",{className:n.infoBtn,onMouseEnter:ae,onMouseLeave:le,"aria-label":"Info",children:e(v,{name:"info",size:11})}),g&&L&&G?g(G,{close:$,onMouseEnter:ce,onMouseLeave:ie}):null]})});export{dn as M,cn as a,n as m,R as p};
|
|
@@ -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-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
|
+
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-VzVAYX5A.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-XNJmMFmH.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};
|