@serifpersia/dango 3.3.7 → 3.3.9
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 +1 -1
- package/client/dist/assets/{AnimeCard-WlhU88fn.js → AnimeCard-URCiiy5W.js} +1 -1
- package/client/dist/assets/{AnimeInfo-BCLagpbu.js → AnimeInfo-e3z3er9t.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-o0U_OXKP.js → AnimeInfoPage-B7Djlmy_.js} +2 -2
- package/client/dist/assets/{Asmr-ieGJ_BcQ.js → Asmr-C28TfSvX.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-BwaoVski.js → AsmrResetProgressModal-6Xh71AgR.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-CXvBuY4l.js → AvSyncCalibrator-BwCtRW0P.js} +1 -1
- package/client/dist/assets/{Home-DjLpvsp8.js → Home-BJdbHYja.js} +1 -1
- package/client/dist/assets/Insights-CjRy42YE.js +1 -0
- package/client/dist/assets/{LibraryListPage-B2nhFFrc.js → LibraryListPage-B0qWqhb_.js} +1 -1
- package/client/dist/assets/{ListeningList-okIpsKCr.js → ListeningList-CSqD8j1C.js} +1 -1
- package/client/dist/assets/{Manga-3u9nVNZC.js → Manga-Cg2YuObF.js} +1 -1
- package/client/dist/assets/MangaInfoPage-DcArhEsy.js +1 -0
- package/client/dist/assets/MangaReadPage-YCETZRte.js +1 -0
- package/client/dist/assets/{MangaResetProgressModal-Ch8RjwbO.js → MangaResetProgressModal-D_yT3d1v.js} +1 -1
- package/client/dist/assets/{Mature-pINwl5wj.js → Mature-BGxRWkV5.js} +1 -1
- package/client/dist/assets/{MediaCard-DDiYEAm8.js → MediaCard-CAzoxsRS.js} +1 -1
- package/client/dist/assets/Music-Cgo-yQ7E.js +1 -0
- package/client/dist/assets/{OptionListMenu-CzH2VSPh.js → OptionListMenu--Owe9Jle.js} +1 -1
- package/client/dist/assets/Player-yRXG2BrP.js +56 -0
- package/client/dist/assets/{PlayerSettings-jrmY95-i.js → PlayerSettings-DrZLa0CC.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-CcVP7Vi6.js → QueueOptionsButton-BVZyPyKf.js} +1 -1
- package/client/dist/assets/{QueueRail-Cj-PU9EV.js → QueueRail-B7f1-e6i.js} +1 -1
- package/client/dist/assets/{Radio-CRlbaxQt.js → Radio-BFjxlzuF.js} +1 -1
- package/client/dist/assets/{ReadingList-wRtHGNo8.js → ReadingList-BaIem8H1.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-BokfoYFB.js → ResetProgressModal-DES5Y-Fl.js} +1 -1
- package/client/dist/assets/{Search-BOOBeTVA.js → Search-BOBo0Ogh.js} +1 -1
- package/client/dist/assets/{Settings-BgrcswJD.js → Settings-DOvNQ0gX.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-C6S7OYHn.js → SkeletonGrid-BxfgjP4i.js} +1 -1
- package/client/dist/assets/Trackers-DZ9KqOWv.js +2 -0
- package/client/dist/assets/{Tv-ByVckozq.js → Tv-5mATEU4p.js} +1 -1
- package/client/dist/assets/{TvInfo-fJ9SFMK8.js → TvInfo-CF-5C5Fs.js} +1 -1
- package/client/dist/assets/{TvPopup-yfH7p0y0.js → TvPopup-Dfqifj3s.js} +1 -1
- package/client/dist/assets/{TvSearch-CBNWDByW.js → TvSearch-BWDwWnHe.js} +1 -1
- package/client/dist/assets/{TvWatchlist-BqjZ2-4A.js → TvWatchlist-D3n5_4MI.js} +1 -1
- package/client/dist/assets/{Watchlist-B_Q2hEiJ.js → Watchlist-B8MHNsAU.js} +1 -1
- package/client/dist/assets/{hls-kIF7bMpF.js → hls-BO_L1WoN.js} +1 -1
- package/client/dist/assets/index-D2RkUJIN.js +178 -0
- package/client/dist/assets/{useAnimeInfoData-BKSrS8eN.js → useAnimeInfoData-BWShDHqE.js} +1 -1
- package/client/dist/assets/{useAsmr-Byj8Qiwp.js → useAsmr-FyfD9G7b.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-CLcWCCXf.js → useAsmrPopup-D_o9-QlR.js} +1 -1
- package/client/dist/assets/useMangaLibrary-BJU5x8Vz.js +1 -0
- package/client/dist/assets/{useMangaPopup-ZonOP5_c.js → useMangaPopup-TFzkC-tG.js} +1 -1
- package/client/dist/assets/{useProviders-CymA42ZB.js → useProviders-DDRxa8vl.js} +1 -1
- package/client/dist/assets/{useTv-CPj6Cf42.js → useTv-Bh6WmNnZ.js} +1 -1
- package/client/dist/assets/{useTvLibrary-COsyN8yu.js → useTvLibrary-_Pqm8re1.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/controllers/data.controller.js +1 -0
- package/server/dist/controllers/insights.controller.js +3 -2
- package/server/dist/controllers/manga-library.controller.js +54 -0
- package/server/dist/controllers/music.controller.js +123 -50
- package/server/dist/controllers/watchlist.controller.js +13 -1
- package/server/dist/lib/anilist.js +36 -3
- package/server/dist/lib/mal.js +69 -0
- package/server/dist/lib/tracker/anilist-tracker.js +66 -0
- package/server/dist/lib/tracker/manga-sync.service.js +792 -0
- package/server/dist/lib/ytmusic.js +15 -2
- package/server/dist/repositories/manga.repository.js +17 -2
- package/server/dist/routes/manga-library.routes.js +2 -0
- package/server/dist/routes/tracker.routes.js +123 -0
- package/server/dist/sync.js +8 -1
- package/server/package.json +1 -1
- package/client/dist/assets/Insights-lQcQoeES.js +0 -1
- package/client/dist/assets/MangaInfoPage-Cat-B487.js +0 -1
- package/client/dist/assets/MangaReadPage-CyLRxzvl.js +0 -1
- package/client/dist/assets/Music-B1swlVLI.js +0 -1
- package/client/dist/assets/Player-SKPWb-o8.js +0 -56
- package/client/dist/assets/Trackers-DLcTEJJW.js +0 -2
- package/client/dist/assets/index-C65i4HWv.js +0 -178
- package/client/dist/assets/useMangaLibrary-U7tUo8nx.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-8R2fFbyN.js";import{M as F}from"./MediaCard-
|
|
1
|
+
import{n as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-8R2fFbyN.js";import{M as F}from"./MediaCard-CAzoxsRS.js";import{L as N}from"./LibraryListPage-B0qWqhb_.js";import{u as _,A as q}from"./useAsmrPopup-D_o9-QlR.js";import{A as z}from"./AsmrResetProgressModal-6Xh71AgR.js";import{e as h}from"./index-D2RkUJIN.js";import{m as O,u as Q,n as Y,o as D,e as G,p as H,q as K,r as Z,A as T,k as J}from"./useAsmr-FyfD9G7b.js";import"./vendor-ui-CUDCvRS_.js";import"./vendor-icons-CDMuNDeL.js";import"./useIsMobile-Dm_b6Ob3.js";import"./SkeletonGrid-BxfgjP4i.js";import"./ErrorMessage-z4f4WGgP.js";import"./Watchlist.module-XGtVQr1d.js";import"./Asmr.module-ChUXDZKx.js";import"./ResetProgressModal-DES5Y-Fl.js";import"./vendor-query-BXRECSI6.js";const V=["All","Continue Listening",...T],A=24;function W(a){const d=a.currentTime??0,i=a.duration??0,r=(a.trackIndex??0)+1;return i>0?`Track ${r} · ${h(d)} / ${h(i)}`:`Track ${r}`}function bt(){const{filter:a="All"}=U(),[d,i]=k(1),[r,m]=k(null);L(()=>{document.title="Listening List - dango"},[]),L(()=>{i(1)},[a]);const o=a==="Continue Listening",n=O(o?"All":a,d,A),l=Q(100),f=Y(),C=D(),{toggle:v,bookmarkedIds:R}=G(),{popup:s,openPopup:I,scheduleClose:c,cancelClose:p,closePopup:B}=_(),P=H(),S=K(),j=Z(),M=E(()=>o?(l.data?.data??[]).map(t=>{const e=t.currentTime??0,g=t.duration??0,b=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:b,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:`Track ${(t.trackIndex??0)+1}`,progressPercent:g>0?Math.min(100,e/g*100):0,progressLabel:W(t),detailTarget:`/asmr/${encodeURIComponent(b)}`}}):(n.data?.data??[]).map(t=>{const e=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:e,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:t.lastTrackIndex!==null&&t.lastTrackIndex!==void 0?`Track ${t.lastTrackIndex+1}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/asmr/${encodeURIComponent(e)}`}}),[o,l.data,n.data]),w=o?l.data?.total??0:n.data?.total??0,x=o?l.isLoading:n.isLoading,$=o?l.error:n.error;return u(N,{headerTitle:"My Listening List",headerSubtitle:"Track and manage your ASMR collection",filters:V,filterBy:a,filterBasePath:"/listening-list",continueFilter:"Continue Listening",statusOptions:[...T],entries:M,total:w,isLoading:x,error:$,page:d,pageSize:A,onPageChange:i,emptyTitle:"Your listening list is looking a bit lonely",emptyFilteredText:"No works match this filter.",emptyAllText:"Let's find something to listen to!",browseLabel:"Browse ASMR",browseTarget:"/asmr",removeListLabel:"Remove from Listening List",listNoun:"listening list",skipConfirmKey:"asmrSkipRemoveConfirmation",onBulkStatus:(t,e)=>P.mutate({ids:t,status:e}),onBulkRemove:t=>{o?j.mutate(t):S.mutate(t)},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate(t),renderCard:t=>u(F,{item:{id:t.libId,title:t.title,thumbnail:t.thumbnail,typeBadge:t.rjCode||void 0,chapterBadge:t.trackLabel??null,isAdult:t.isAdult},linkTo:t.detailTarget,hoverIcon:"info",layout:"horizontal",showInfoButton:!o,progress:t.progressPercent!==void 0&&t.progressLabel?{percent:t.progressPercent,label:t.progressLabel}:void 0,showProgress:o,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:o?()=>m(t):void 0,onOpenDetails:o?void 0:e=>I(e,{rjCode:t.rjCode,title:t.title,thumbnail:t.thumbnail,isAdult:t.isAdult,listenTarget:t.detailTarget,progressLabel:t.progressLabel}),onPopupHoverIntent:e=>e?p():c(),rawThumbnail:!0}),modals:u(y,{children:[u(z,{workId:r?r.libId:null,title:r?.title,onClose:()=>m(null)}),s&&u(q,{data:s.data,anchorRect:s.rect,bookmarked:R.has(J(s.data.rjCode)),onToggleBookmark:()=>v({rjCode:s.data.rjCode,title:s.data.title,thumbnail:s.data.thumbnail||"",isAdult:s.data.isAdult}),onMouseEnter:p,onMouseLeave:c,onRequestClose:B})]})})}export{bt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as te,d as N,T as le,h as C,u as a,l as ne,S as re}from"./vendor-core-8R2fFbyN.js";import{I as T}from"./vendor-icons-CDMuNDeL.js";import{T as se,M as oe,B as q,Q as ie}from"./index-
|
|
1
|
+
import{o as te,d as N,T as le,h as C,u as a,l as ne,S as re}from"./vendor-core-8R2fFbyN.js";import{I as T}from"./vendor-icons-CDMuNDeL.js";import{T as se,M as oe,B as q,Q as ie}from"./index-D2RkUJIN.js";import{E as ce}from"./ErrorMessage-z4f4WGgP.js";import{M as de}from"./MediaCard-CAzoxsRS.js";import{u as ue,M as ge}from"./useMangaPopup-TFzkC-tG.js";import{f as pe,u as he,m as D,i as ve,b as me,c as be}from"./useMangaLibrary-BJU5x8Vz.js";import{u as fe}from"./useProviders-DDRxa8vl.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BXRECSI6.js";import"./vendor-ui-CUDCvRS_.js";import"./useIsMobile-Dm_b6Ob3.js";const Se=[{value:"popular",label:"Popular"},{value:"latest",label:"Latest"},{value:"rating",label:"Top Rated"},{value:"followed",label:"Most Followed"}],ye=[{value:"",label:"Any Status"},{value:"ongoing",label:"Ongoing"},{value:"completed",label:"Completed"},{value:"hiatus",label:"Hiatus"},{value:"cancelled",label:"Cancelled"}],Ne=[{value:"",label:"Any Status"},{value:"publishing",label:"Publishing"},{value:"finished",label:"Finished"},{value:"on hiatus",label:"On Hiatus"},{value:"discontinued",label:"Discontinued"}],Ce=[{value:"",label:"All Types"},{value:"manga",label:"Manga"},{value:"novel",label:"Novel"},{value:"one-shot",label:"One-Shot"},{value:"doujinshi",label:"Doujinshi"}],Te=[{value:"safe",label:"Safe"}],Me=[{value:"safe",label:"Safe"},{value:"suggestive",label:"Suggestive"},{value:"erotica",label:"Erotica"},{value:"pornographic",label:"Pornographic"}],M="agreedToViewMature";function Oe(){const[r,w]=te(),[v,I]=N(()=>localStorage.getItem(M)==="true"),[P,m]=N(!1),[k,L]=N(r.get("q")||""),{options:R,isLoading:$,refetch:z}=fe(),d=le(()=>R.filter(e=>e.kind==="manga").map(e=>({value:e.value,label:e.label})),[R]),b=r.get("provider")||"",i=d.some(e=>e.value===b)?b:d[0]?.value??b,f=r.get("q")||"",u=parseInt(r.get("page")||"1"),B=r.get("sort")||"popular",E=r.get("status")||"",x=r.get("type")||"",g=r.get("rating")||"safe",A=r.get("id")||"";C(()=>{document.title="Manga - dango"},[]),C(()=>{const e=()=>I(localStorage.getItem(M)==="true");return window.addEventListener("focus",e),window.addEventListener("storage",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("storage",e)}},[]);const c=v,S=c?g:"safe",H=c?Me:Te,o=(e,l=!1)=>{const n=new URLSearchParams(r);for(const[h,j]of Object.entries(e))j?n.set(h,j):n.delete(h);l&&n.delete("page"),w(n)},p=pe({provider:i,query:f,page:u,sort:B,status:E,type:x,rating:S,mature:c}),y=p.data?.items??[],G=p.data?.hasNext??!1,{toggle:V,bookmarkedIds:Y}=he(),{popup:s,openPopup:K,scheduleClose:F,cancelClose:O,closePopup:Q}=ue();if(C(()=>{L(f)},[f]),A){const e=new URLSearchParams;c&&g!=="safe"&&e.set("rating",g);const l=r.get("chapter")||"";l&&e.set("chapter",l);const n=e.toString()?`?${e.toString()}`:"",h=`/manga/${i}/${encodeURIComponent(A)}${l?`/read${n}`:n}`;return a(ne,{to:h,replace:!0})}const W=e=>{e.preventDefault(),ie(),o({q:k},!0)},X=e=>{e.target.checked&&!v&&m(!0)},J=()=>{localStorage.setItem(M,"true"),I(!0),m(!1),o({},!0)},U=()=>{m(!1)},_=e=>{const l=new URLSearchParams;c&&g!=="safe"&&l.set("rating",g);const n=l.toString()?`?${l.toString()}`:"";return`/manga/${e.provider}/${encodeURIComponent(e.id)}${n}`},Z=i==="mangapill"?Ne:ye,ee=i==="mangapill",ae=i==="mangadex";return a("div",{className:t.page,children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:[a(T,{name:"book"})," Manga"]}),a("form",{className:t.searchForm,onSubmit:W,children:[a("input",{className:t.searchInput,value:k,onChange:e=>L(e.target.value),placeholder:"Search manga titles...","aria-label":"Search manga"}),a("button",{className:t.searchBtn,type:"submit","aria-label":"Search",children:a(T,{name:"search",size:14})})]}),a("select",{className:t.select,value:i,disabled:d.length===0,onChange:e=>{const l=new URLSearchParams(r);l.set("provider",e.target.value),l.delete("page"),l.delete("id"),l.delete("chapter"),l.delete("status"),l.delete("type"),w(l)},"aria-label":"Manga provider",children:d.length===0?a("option",{value:"",children:$?"Loading providers…":"No providers available"}):d.map(e=>a("option",{value:e.value,children:e.label},e.value))}),d.length===0&&!$&&a("button",{className:t.searchBtn,type:"button",onClick:()=>z(),"aria-label":"Retry loading providers",children:a(T,{name:"redo",size:14})})]}),a("div",{className:t.filterRow,children:[i==="mangadex"&&a("select",{className:t.select,value:B,onChange:e=>o({sort:e.target.value},!0),"aria-label":"Sort manga",children:Se.map(e=>a("option",{value:e.value,children:e.label},e.value))}),a("select",{className:t.select,value:E,onChange:e=>o({status:e.target.value},!0),"aria-label":"Filter by status",children:Z.map(e=>a("option",{value:e.value,children:e.label},e.label))}),ee&&a("select",{className:t.select,value:x,onChange:e=>o({type:e.target.value},!0),"aria-label":"Filter by type",children:Ce.filter(e=>e.value!=="doujinshi"||c).map(e=>a("option",{value:e.value,children:e.label},e.value))}),ae&&a("select",{className:t.select,value:S,onChange:e=>o({rating:e.target.value},!0),"aria-label":"Content rating",children:H.map(e=>a("option",{value:e.value,children:e.label},e.value))}),!v&&a("div",{className:t.matureToggleWrap,children:[a("label",{className:t.matureLabel,htmlFor:"manga-mature-toggle",children:"Mature"}),a(se,{id:"manga-mature-toggle",isChecked:!1,onChange:X})]})]}),p.isError?a(ce,{message:"Failed to load manga. Please try again."}):p.isLoading&&y.length===0?a("div",{className:t.grid,"aria-hidden":!0,children:Array.from({length:12}).map((e,l)=>a("div",{className:t.skeletonCard,children:[a("div",{className:`${t.skeletonThumb} ${t.shimmer}`}),a("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"88%"}}),a("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"55%"}})]},l))}):y.length===0?a("p",{className:t.statusMsg,children:"No titles found. Try another search or provider."}):a(re,{children:[a("div",{className:`${t.grid} ${p.isFetching?t.fetching:""}`,children:y.map(e=>{const l=D(e.provider,e.id);return a(de,{item:{id:l,title:e.title,...be(e),thumbnail:me(e.provider,e.cover),typeBadge:e.type||void 0,chapterBadge:e.latestChapter?`Ch. ${e.latestChapter}`:null,isAdult:ve(e)},linkTo:_(e),hoverIcon:"info",display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:n=>K(n,{provider:e.provider,mangaId:e.id,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:_(e),rating:S,mature:c}),onPopupHoverIntent:n=>n?O():F(),rawThumbnail:!0},`${e.provider}-${e.id}`)})}),a("nav",{className:t.pagination,children:[a("button",{className:t.pageBtn,disabled:u<=1,onClick:()=>o({page:String(u-1)}),children:"Previous"}),a("span",{className:t.pageIndicator,children:["Page ",u]}),a("button",{className:t.pageBtn,disabled:!G,onClick:()=>o({page:String(u+1)}),children:"Next"})]})]}),s&&a(ge,{data:s.data,anchorRect:s.rect,bookmarked:Y.has(D(s.data.provider,s.data.mangaId)),onToggleBookmark:()=>V({id:s.data.mangaId,provider:s.data.provider,title:s.data.title,cover:s.data.cover,altTitle:s.data.altTitle??void 0,contentRating:s.data.contentRating}),onMouseEnter:O,onMouseLeave:F,onRequestClose:Q}),P&&a(oe,{isOpen:P,title:"Content Warning",onClose:U,children:a("div",{style:{padding:"var(--space-4)",textAlign:"center"},children:[a("p",{children:"This section contains mature content intended for adult audiences."}),a("p",{children:["By proceeding, you confirm that you are ",a("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),a("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-secondary)",marginTop:"var(--space-4)"},children:["You can reset this preference at any time in the ",a("strong",{children:"Settings"})," page."]}),a("div",{style:{marginTop:"var(--space-4)",display:"flex",gap:"var(--space-2-5)",justifyContent:"center"},children:[a(q,{variant:"secondary",onClick:U,children:"Go Back"}),a(q,{onClick:J,children:"I'm 18+, Continue"})]})]})})]})}export{Oe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as e,a as D,d as $,S as j,n as G,o as H,h as E,T as M}from"./vendor-core-8R2fFbyN.js";import{I as C}from"./vendor-icons-CDMuNDeL.js";import{B as A,d as Y}from"./index-D2RkUJIN.js";import{E as J}from"./ErrorMessage-z4f4WGgP.js";import{b as q,g as K,f as Q,h as F,j as X,m as R,k as Z,l as ee,n as te,r as ae,o as re,p as ne,q as se,s as ie,M as oe}from"./useMangaLibrary-BJU5x8Vz.js";import{s as r}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BXRECSI6.js";const le=({detail:a,altTitle:c,onBack:x,onOpenChapter:m,bookmarkButton:i,statusSelect:y,primaryAction:g,progressByChapter:w})=>{const l=[a.type,a.status,a.year?String(a.year):"",a.author?`by ${a.author}`:""].filter(Boolean);return e("div",{children:[e("button",{className:r.backBtn,onClick:x,children:[e(C,{name:"chevron-left",size:12})," Back to browse"]}),e("div",{className:r.detail,children:[a.cover&&e("img",{className:r.detailCover,src:q(a.provider,a.cover),alt:a.title,decoding:"async",draggable:!1}),e("div",{className:r.detailInfo,children:[e("h2",{className:r.detailTitle,children:a.title}),c&&e("p",{className:r.detailAltTitle,children:["Also known as: ",c]}),l.length>0&&e("div",{className:r.detailMeta,children:l.map(n=>e("span",{className:r.badge,children:n},n))}),a.genres&&a.genres.length>0&&e("div",{className:r.detailMeta,children:a.genres.map(n=>e("span",{className:r.badge,children:n},n))}),a.description&&e("p",{className:r.detailDesc,children:a.description}),(i||y||g)&&e("div",{className:r.detailActions,children:[g,i,y]})]})]}),e("h3",{className:r.detailTitle,style:{fontSize:"1rem"},children:["Chapters (",a.chapters.length,")"]}),a.chapters.length===0?e("p",{className:r.statusMsg,children:"No chapters found for this title on this provider."}):e("div",{className:r.chapterList,children:a.chapters.map(n=>{const t=w?.get(n.id),h=!!t&&t.pageCount>0&&t.page>=t.pageCount;return e("button",{className:`${r.chapterRow} ${h?r.chapterDone:""}`,onClick:()=>m(n),title:n.externalUrl?"External only — opens on source site":void 0,children:[e("span",{children:["Ch. ",n.number,n.title?` — ${n.title}`:""]}),e("span",{className:r.chapterMeta,children:[t&&t.pageCount>0?h?"read":`p. ${t.page}/${t.pageCount}`:"",n.group,n.externalUrl?"external":""].filter(Boolean).join(" · ")})]},n.id)})})]})},ce=({libId:a,anilistId:c})=>{const x=D(),m=K(a),i=m.data?.item,[y,g]=$(null),[w,l]=$(null),n=y??i?.title??"",t=Q({provider:"mangadex",query:n,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!n),h=Q({provider:"mangapill",query:n,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!n),f=F(),I=X(),u=async o=>{const v=R(o.provider,o.id);l(v);try{await f.mutateAsync({provider:o.provider,mangaId:o.id,title:o.title,cover:o.cover,altTitle:o.altTitle,contentRating:o.contentRating,silent:!0}),await I.mutateAsync({id:v,anilistId:c}),x(`/manga/${o.provider}/${encodeURIComponent(o.id)}`)}catch{return}finally{l(null)}},L=(o,v,T)=>e("div",{style:{marginTop:"12px"},children:[e("div",{style:{fontWeight:600,textTransform:"capitalize",marginBottom:"6px"},children:o}),T?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"Searching…"}):!v||v.length===0?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"No matches."}):v.slice(0,6).map(d=>{const b=R(d.provider,d.id),B=w===b;return e("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderTop:"1px solid var(--border, #223)"},children:[d.cover&&e("img",{src:q(d.provider,d.cover),alt:"",loading:"lazy",style:{width:"34px",height:"48px",objectFit:"cover",borderRadius:"4px"}}),e("div",{style:{flex:1,minWidth:0},children:[e("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.title}),d.latestChapter&&e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.75rem"},children:d.latestChapter})]}),e(A,{onClick:()=>u(d),disabled:B,children:[e(C,{name:"external-link-alt",size:12})," ",B?"Linking…":"Link"]})]},b)})]});return e("div",{children:[e("button",{onClick:()=>x("/manga"),style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",marginBottom:"12px"},children:[e(C,{name:"chevron-left",size:12})," Back to browse"]}),m.isLoading?e("div",{style:{color:"var(--text-tertiary)"},children:"Loading library entry…"}):i?e(j,{children:[e("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[i.cover&&e("img",{src:i.cover,alt:"",style:{width:"64px",height:"90px",objectFit:"cover",borderRadius:"6px"}}),e("div",{children:[e("h2",{style:{margin:"0 0 4px"},children:i.title}),e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:["Tracked on AniList",i.lastChapterNumber?` · Ch. ${i.lastChapterNumber}`:"",i.status?` · ${i.status}`:""]})]})]}),e("p",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem",marginTop:"12px"},children:"AniList doesn't host chapters. Search your providers below and link the matching manga — your AniList status and chapter progress will sync to it from now on."}),e("div",{style:{display:"flex",gap:"8px",marginTop:"8px"},children:e("input",{type:"text",value:y??i.title,onChange:o=>g(o.target.value),placeholder:"Search providers…",style:{flex:1,padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--border, #223)",background:"var(--bg-secondary, transparent)",color:"inherit"}})}),L("mangadex",t.data?.items,t.isLoading),L("mangapill",h.data?.items,h.isLoading)]}):e("div",{style:{color:"var(--text-tertiary)"},children:"This AniList entry is no longer in your library."})]})};function ye(){const{provider:a="",id:c=""}=G(),[x]=H(),m=D(),[i,y]=$(()=>localStorage.getItem("agreedToViewMature")==="true");E(()=>{const s=()=>y(localStorage.getItem("agreedToViewMature")==="true");return window.addEventListener("focus",s),window.addEventListener("storage",s),()=>{window.removeEventListener("focus",s),window.removeEventListener("storage",s)}},[]);const g=x.get("rating")||"safe",w=i?g:"safe",l=a&&c?R(a,c):void 0,n=Z(a||null,c||null,w,i),t=n.data,h=ee(l),f=te(l),{titlePreference:I}=Y(),u=M(()=>t&&{...t,title:ae(t,I)},[t,I]),L=F(),o=re(),v=ne();E(()=>{u&&(document.title=`${u.title} - dango`)},[u]);const T=M(()=>{const s=new Map;for(const p of f.data?.progress??[])s.set(p.chapterId,p);return s},[f.data]),d=a.toLowerCase()==="anilist"&&/^\d+$/.test(c)?parseInt(c,10):null,b=h.data?.inLibrary??!1,B=h.data?.status??"Reading",P=M(()=>(t?.chapters??[]).filter(s=>!s.externalUrl),[t]),k=M(()=>{if(!t)return null;const s=[...f.data?.progress??[]].sort((p,N)=>N.updatedAt-p.updatedAt);for(const p of s){const N=t.chapters.find(S=>S.id===p.chapterId);if(N&&!N.externalUrl)return N;const U=se(p.chapterId);if(U!=null){const S=ie(t.chapters,U);if(S&&!S.externalUrl)return S}}return P[0]??null},[t,f.data,P]),W=k?T.get(k.id):void 0,_=(f.data?.progress?.length??0)>0,O=k&&(W||_)?`Continue Ch. ${k?.number}`:"Start Reading",z=s=>{if(s.externalUrl){window.open(s.externalUrl,"_blank","noopener,noreferrer");return}const p=new URLSearchParams;p.set("chapter",s.id),i&&g!=="safe"&&p.set("rating",g),m(`/manga/${a}/${encodeURIComponent(c)}/read?${p.toString()}`)},V=()=>{!t||!l||(b?o.mutate(l):L.mutate({provider:a,mangaId:c,title:t.title,cover:t.cover,author:t.author,altTitle:t.altTitle,contentRating:t.contentRating}))};return e("div",{className:r.page,children:n.isLoading?e("div",{"aria-hidden":!0,children:[e("div",{className:`${r.skeletonThumb} ${r.shimmer}`,style:{maxWidth:"12rem"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"40%"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"70%"}})]}):n.isError||!t||!u?d!=null&&l?e(ce,{libId:l,anilistId:d}):e(j,{children:[e("button",{className:r.backBtn,onClick:()=>m("/manga"),children:[e(C,{name:"chevron-left",size:12})," Back to browse"]}),e(J,{message:"Failed to load this title. Please try again."})]}):e(le,{detail:u,altTitle:t.altTitle!==u.title?t.altTitle:void 0,onBack:()=>m("/manga"),onOpenChapter:z,progressByChapter:T,primaryAction:k?e(A,{onClick:()=>k&&z(k),children:[e(C,{name:"book",size:13})," ",O]}):void 0,bookmarkButton:e(A,{variant:b?"secondary":"primary",onClick:V,disabled:L.isPending||o.isPending,children:[e(C,{name:"bookmark",size:13})," ",b?"Bookmarked":"Bookmark"]}),statusSelect:b?e("select",{className:r.detailSelect,value:B,onChange:s=>l&&v.mutate({id:l,status:s.target.value}),"aria-label":"Reading status",children:oe.map(s=>e("option",{value:s,children:s},s))}):void 0})})}export{ye as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as F,A as C,q as W,h as g,u as e,S as Y,n as oe,o as ce,a as le,T as de}from"./vendor-core-8R2fFbyN.js";import{E as ge}from"./ErrorMessage-z4f4WGgP.js";import{I as x}from"./vendor-icons-CDMuNDeL.js";import{u as ue}from"./vendor-query-BXRECSI6.js";import{t as he,v as me,m as pe,k as fe,r as ve,n as be,w as Ne,q as ye,s as we}from"./useMangaLibrary-BJU5x8Vz.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import{d as Se}from"./index-D2RkUJIN.js";const G="mangaReadMode",ee="mangaFitMode";function Ce(){try{return localStorage.getItem(G)==="page"?"page":"strip"}catch{return"strip"}}function Ie(){try{return localStorage.getItem(ee)==="height"?"height":"width"}catch{return"width"}}const $e=({provider:d,mangaTitle:h,chapter:p,chapters:b,onBack:N,onOpenChapter:v,initialPage:l=0,onProgress:D,savedPage:$=0})=>{const[c,U]=F(Ce),[i,_]=F(Ie),[u,T]=F(0),[M,m]=F(new Set),[y,I]=F(0),E=C(null),B=C([]),z=ue(),{data:V,isLoading:k,isError:L}=he(d,p.id),a=V?.pages??[],O=a.map(n=>me(d,n)),w=C(0),q=C(0),P=C(!1);q.current=a.length;const s=b.findIndex(n=>n.id===p.id),o=s>0?[...b.slice(0,s)].reverse().find(n=>!n.externalUrl)??null:null,S=s>=0?b.slice(s+1).find(n=>!n.externalUrl)??null:null,R=W(n=>{P.current=!0,T(r=>{const f=r+n;return f<0?(o&&v(o),0):f>=a.length?(S&&v(S),r):f})},[a.length,o,S,v]);g(()=>{P.current=!1,w.current=Math.max(0,l),T(Math.max(0,l)),m(new Set),B.current=[],l<=0&&window.scrollTo(0,0)},[p.id,l]);const Z=C(D);Z.current=D;const j=C("");g(()=>{w.current=u,a.length!==0&&Z.current?.(Math.min(u+1,a.length),a.length)},[u,a.length]),g(()=>{l<=0||P.current||w.current===0&&(P.current=!1,w.current=l,T(l))},[l]),g(()=>{if(c!=="strip"||a.length===0||l<=0)return;const n=`${p.id}:${l}`;if(j.current===n)return;j.current=n;const r=window.setTimeout(()=>{B.current[Math.min(l,a.length-1)]?.scrollIntoView({block:"start"})},150);return()=>window.clearTimeout(r)},[c,a.length,l,p.id]),g(()=>{document.title=`${h} Ch. ${p.number} - dango`},[h,p.number]),g(()=>{try{localStorage.setItem(G,c)}catch{}},[c]),g(()=>{try{localStorage.setItem(ee,i)}catch{}},[i]),g(()=>{c==="page"&&window.scrollTo(0,0)},[c]),g(()=>{if(c!=="page"||a.length===0)return;const n=r=>{r.key==="ArrowRight"||r.key===" "?(r.preventDefault(),R(1)):r.key==="ArrowLeft"&&(r.preventDefault(),R(-1))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[c,a.length,R]),g(()=>{if(c!=="strip"||a.length===0)return;const n=new IntersectionObserver(r=>{for(const f of r)if(f.isIntersecting){const Q=Number(f.target.dataset.pageIndex);Number.isNaN(Q)||(Q!==w.current&&(P.current=!0),T(Q))}},{rootMargin:"-45% 0px -45% 0px",threshold:0});return B.current.forEach(r=>r&&n.observe(r)),()=>n.disconnect()},[c,a.length,V]);const te=n=>{E.current=n.touches[0].clientX},ne=n=>{if(E.current===null)return;const r=n.changedTouches[0].clientX-E.current;E.current=null,!(Math.abs(r)<50)&&R(r<0?1:-1)},K=n=>{n&&v(n)},H=n=>m(r=>{if(r.has(n))return r;const f=new Set(r);return f.add(n),f}),ae=n=>{m(r=>{const f=new Set(r);return f.delete(n),f}),I(r=>r+1)},re=()=>{m(new Set),I(n=>n+1),z.invalidateQueries({queryKey:["mangaPages",d,p.id]})},se=a.length>0&&M.size>=a.length,X=n=>y>0?`${n}&n=${y}`:n,J=n=>e("div",{className:t.deadPage,role:"alert",children:[e("span",{children:["Page ",n+1," failed to load"]}),e("button",{className:t.pageBtn,onClick:()=>ae(n),children:[e(x,{name:"sync-alt",size:12})," Retry"]})]}),A=i==="height",ie=$>0?$-1:-1;return e("div",{className:t.readerShell,children:[e("div",{className:t.readerBar,children:[e("button",{className:t.readerIconBtn,onClick:N,"aria-label":"Back to chapters",children:e(x,{name:"chevron-left",size:14})}),e("span",{className:t.readerTitle,children:[h," — Ch. ",p.number,p.title?` ${p.title}`:""]}),a.length>0&&e("span",{className:t.readerCounter,children:[Math.min(u+1,a.length)," / ",a.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:()=>U("strip"),children:"Strip"}),e("button",{type:"button","aria-pressed":c==="page",className:c==="page"?t.readerSegmentActive:"",onClick:()=>U("page"),children:"Page"})]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Fit mode",children:[e("button",{type:"button","aria-pressed":!A,className:A?"":t.readerSegmentActive,onClick:()=>_("width"),title:"Fit width — best for portrait / phones",children:"Wide"}),e("button",{type:"button","aria-pressed":A,className:A?t.readerSegmentActive:"",onClick:()=>_("height"),title:"Fit height — best for landscape / desktop",children:"Tall"})]}),e("button",{className:t.readerIconBtn,disabled:!o,onClick:()=>K(o),"aria-label":"Previous chapter",children:e(x,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!S,onClick:()=>K(S),"aria-label":"Next chapter",children:e(x,{name:"chevron-right",size:14})})]}),L?e("p",{className:t.statusMsg,children:"Failed to load pages. Please try again."}):k?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))}):a.length===0?e("p",{className:t.statusMsg,children:"No pages found for this chapter."}):se?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:re,children:[e(x,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${A?t.readerPagesTall:""}`,children:O.map((n,r)=>e("div",{ref:f=>{B.current[r]=f},"data-page-index":r,className:t.readerPageWrap,children:[r===ie&&e("div",{className:t.saveMarker,role:"note","aria-label":"Saved reading position",children:[e(x,{name:"bookmark",size:12}),e("span",{children:["Saved · p. ",$]})]}),M.has(r)?J(r):e("img",{className:t.readerPage,src:X(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onError:()=>H(r)})]},`${r}-${a[r].slice(-32)}`))}):e(Y,{children:[e("div",{className:`${t.pageView} ${A?t.pageViewTall:""}`,onTouchStart:te,onTouchEnd:ne,children:[e("button",{className:`${t.tapZone} ${t.tapZoneLeft}`,onClick:()=>R(-1),"aria-label":"Previous page",children:e("span",{className:t.tapChevron,children:e(x,{name:"chevron-left",size:16})})}),M.has(u)?J(u):e("img",{className:t.pageImage,src:X(O[u]),alt:`Page ${u+1} of ${a.length}`,decoding:"async",draggable:!1,onError:()=>H(u)},`${u}-${a[u].slice(-32)}`),e("button",{className:`${t.tapZone} ${t.tapZoneRight}`,onClick:()=>R(1),"aria-label":"Next page",children:e("span",{className:t.tapChevron,children:e(x,{name:"chevron-right",size:16})})})]}),e("nav",{className:t.pagination,"aria-label":"Page navigation",children:[e("button",{className:t.pageBtn,disabled:u<=0,onClick:()=>R(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[u+1," / ",a.length]}),e("button",{className:t.pageBtn,disabled:u>=a.length-1,onClick:()=>R(1),children:"Next page"})]})]}),(o||S)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!o,onClick:()=>K(o),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!S,onClick:()=>K(S),children:"Next chapter"})]})]})},ke=800,Pe=5e3;function Ae(){const{provider:d="",id:h=""}=oe(),[p]=ce(),b=le(),N=p.get("chapter")||"",v=p.get("rating")||"safe",l=typeof localStorage<"u"&&localStorage.getItem("agreedToViewMature")==="true",D=l?v:"safe",$=d&&h?pe(d,h):"",c=d.toLowerCase()==="anilist";g(()=>{c&&h&&b(`/manga/anilist/${encodeURIComponent(h)}`,{replace:!0})},[c,h,b]);const U=fe(!c&&d?d:null,!c&&h?h:null,D,l),i=U.data,{titlePreference:_}=Se(),u=i?ve(i,_):"Manga",T=be($||void 0),M=Ne(),m=i&&N?i.chapters.find(s=>s.id===N)??null:null,y=ye(N),I=y!=null&&i?we(i.chapters,y):null;g(()=>{if(y!=null&&I&&I.id!==N){const s=new URLSearchParams;s.set("chapter",I.id),l&&v!=="safe"&&s.set("rating",v),b(`/manga/${d}/${encodeURIComponent(h)}/read?${s.toString()}`,{replace:!0})}},[y,I,N,l,v,d,h,b]);const E=y!=null&&!!i&&!!I,B=y!=null&&!!i&&!I,z=de(()=>{const s=(T.data?.progress??[]).find(o=>o.chapterId===N);return s&&s.page>0?s.page:0},[T.data,N]),V=z>1?z-1:0,k=C(null),L=C(null),a=W(()=>{k.current&&(clearTimeout(k.current),k.current=null);const s=L.current;L.current=null,s&&$&&M.mutate({mangaId:$,chapterId:s.chapterId,chapterNumber:s.chapterNumber,page:s.page,pageCount:s.pageCount,title:i?.title??null,cover:i?.cover??null,provider:d||null,altTitle:i?.altTitle??null,contentRating:i?.contentRating??null})},[$,M,i?.title,i?.cover,i?.altTitle,i?.contentRating,d]),O=W((s,o)=>{m&&(L.current={chapterId:m.id,chapterNumber:m.number,page:s,pageCount:o},k.current&&clearTimeout(k.current),k.current=setTimeout(a,ke))},[m,a]);g(()=>{a()},[N,a]),g(()=>()=>a(),[a]),g(()=>{const s=window.setInterval(()=>{L.current&&a()},Pe);return()=>window.clearInterval(s)},[a]),g(()=>{const s=()=>{document.visibilityState==="hidden"&&a()},o=()=>a();return document.addEventListener("visibilitychange",s),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",s),window.removeEventListener("pagehide",o)}},[a]);const w=C("");w.current||(w.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),g(()=>{if(!i||!m)return;const s=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{fetch("/api/discord/manga",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i.title,chapterLabel:`Chapter ${m.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:s,sessionId:w.current})}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:w.current})}).catch(()=>{})};o();const S=window.setInterval(o,6e4);return()=>window.clearInterval(S)},[i,m]);const q=s=>{if(a(),s.externalUrl){window.open(s.externalUrl,"_blank","noopener,noreferrer");return}const o=new URLSearchParams;o.set("chapter",s.id),l&&v!=="safe"&&o.set("rating",v),b(`/manga/${d}/${encodeURIComponent(h)}/read?${o.toString()}`)},P=()=>{a();const s=new URLSearchParams;l&&v!=="safe"&&s.set("rating",v);const o=s.toString()?`?${s.toString()}`:"";b(`/manga/${d}/${encodeURIComponent(h)}${o}`)};return c?null:e("div",{className:t.page,children:U.isLoading||E?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((s,o)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},o))}):!i||!m?e(Y,{children:[e("button",{className:t.backBtn,onClick:P,children:"Back to title"}),e(ge,{message:B?`Chapter ${y} isn't available from ${d} for this title.`:"Failed to load this chapter. Please try again."})]}):e($e,{provider:d,mangaTitle:u,chapter:m,chapters:i.chapters,onBack:P,onOpenChapter:q,initialPage:V,onProgress:O,savedPage:z},m.id)})}export{Ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as n,u as l}from"./vendor-core-8R2fFbyN.js";import{R as i}from"./ResetProgressModal-
|
|
1
|
+
import{d as n,u as l}from"./vendor-core-8R2fFbyN.js";import{R as i}from"./ResetProgressModal-DES5Y-Fl.js";import{B as f,o as R}from"./useMangaLibrary-BJU5x8Vz.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 Me,o as ke,h as ue,d as s,T as me,S as he}from"./vendor-core-8R2fFbyN.js";import{b as ge}from"./vendor-query-BXRECSI6.js";import{B as O,M as we,q as E,Q as Fe,z as qe}from"./index-C65i4HWv.js";import{I as pe}from"./vendor-icons-CDMuNDeL.js";import{S as xe,P as ve}from"./SkeletonGrid-C6S7OYHn.js";import{A as Ue}from"./AnimeCard-WlhU88fn.js";import{E as Ye}from"./ErrorMessage-z4f4WGgP.js";import{u as je}from"./useMatureConsent-CT7-KfzG.js";import{u as Ke}from"./useProviders-CymA42ZB.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-BKSrS8eN.js";import"./QueueOptionsButton-CcVP7Vi6.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-DDiYEAm8.js";import"./useIsMobile-Dm_b6Ob3.js";const Qe=({isOpen:u,onClose:i,onGrant:F})=>t(we,{isOpen:u,title:"Content Warning",onClose:i,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:i,children:"Go Back"}),t(O,{onClick:F,children:"I'm 18+, Continue"})]})]})}),Ve="_shrinkSelect_130sm_1",We="_tightGrid_130sm_7",W={shrinkSelect:Ve,tightGrid:We},ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],He=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Je=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Ze=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],Xe={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},et=[{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(i=>i&&i[0].toUpperCase()+i.slice(1)).join(" ");function ft(){const u=Me(),[i,F]=ke(),{hasConsent:q,grant:Se}=je();ue(()=>{document.title="Mature - dango"},[]);const[l,ye]=s(i.get("provider")||"anilist"),[S,z]=s(i.get("query")||""),[I,x]=s(i.get("query")||""),[L,h]=s(parseInt(i.get("page")||"1",10)||1),[T,U]=s(()=>{const e=i.get("sortBy");return e||(l==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[R,H]=s(i.get("sortBy")||""),[y,be]=s(i.get("status")||""),[_,Ce]=s(i.get("season")||"ALL"),[D,Ne]=s(i.get("year")||"ALL"),[g,G]=s(i.get("genre")||i.get("genres")||""),[Y,Ae]=s(i.get("order")||"recent"),[j,Pe]=s(i.get("studio")||""),[$,Ee]=s(i.get("studio")||""),[J,Z]=s([]),[K,Oe]=s(!1),[Ie,X]=s(null),{options:ee}=Ke(),te=me(()=>ee.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[ee]),ae=me(()=>[...ze,...te.map(e=>({value:e.value,label:e.label}))],[te]),{data:B}=ge({queryKey:["mature-filters"],queryFn:()=>E("/api/mature/filters"),enabled:q,staleTime:1/0}),c=l==="anilist"||l==="mal",Q=c?void 0:B?.providers?.[l],N=Q?.browse,A=Q?.genres??[],b=Q?.orders??[],re=b.length>0&&!b.includes(Y)?b[0]:Y,M=!c&&(N?.genre===!0||A.length>0||J.length>0),p=!c&&(N?.order===!0||b.length>0),C=!c&&N?.studio===!0,ie=!c&&N?.sort===!0,k=c?14:N?.pageSize??14,v=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const n=B?.providers?.[e.provider]?.browse,d=B?.providers?.[e.provider]?.orders??[],o=d.length>0&&!d.includes(e.remoteOrder)?d[0]:e.remoteOrder;(!n||n.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!n||n.genre)&&e.genre&&r.set("genre",e.genre),(!n||n.order)&&o!==(d[0]??"recent")&&r.set("order",o),(!n||n.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}F(r,{replace:!0})},f=(e={})=>({provider:l,query:I,page:L,sort:T,remoteSort:R,status:y,season:_,year:D,genre:g,remoteOrder:Y,studio:$,...e}),le=(()=>{const e=new URLSearchParams;return e.set("provider",l),I.trim()&&e.set("query",I.trim()),e.set("page",String(L)),e.set("limit",String(k)),l==="anilist"&&(e.set("sortBy",T),y&&e.set("status",y),_!=="ALL"&&e.set("season",_),D!=="ALL"&&e.set("year",D)),l==="mal"?(e.set("sortBy",T),y&&e.set("status",y)):c||(M&&g&&e.set("genre",g),p&&e.set("order",re),ie&&R&&e.set("sortBy",R),C&&$.trim()&&e.set("studio",$.trim())),e.toString()})(),{data:m,isLoading:Le,isError:Te,error:Re}=ge({queryKey:["mature-search",le],queryFn:()=>E(`/api/mature/search?${le}`),enabled:q});ue(()=>{const e=m?.genres;!c&&A.length===0&&e&&e.length>0&&Z(r=>{const n=new Set(r.map(o=>o.slug)),d=[...r];for(const o of e)o.slug&&!n.has(o.slug)&&(n.add(o.slug),d.push(o));return d.length===r.length?r:d})},[m,l,c,A.length]);const w=(m?.data||[]).map(e=>({...e,isAdult:!0})),se=m?.hasMore??!1,P=()=>{Fe(),h(1);let e=g;!c&&!p&&S.trim()&&(e=""),G(e),C&&Ee(j),x(S),v(f({query:S,page:1,genre:e,studio:C?j:$}))},_e=e=>{ye(e),h(1),H(""),G(""),Z([]),e==="mal"?U("SCORE_DESC"):e==="anilist"&&U("POPULARITY_DESC"),x(S),v(f({provider:e,page:1,remoteSort:"",genre:"",query:S}))},De=e=>{G(e),h(1),e&&(z(""),x("")),v(f({genre:e,page:1,query:e?"":I}))},ne=e=>{h(e),v(f({page:e})),window.scrollTo({top:0,behavior:"smooth"})},Ge=async(e,r)=>{const n=r.id||r._id;if(l!=="mal"&&!/^\d+$/.test(n)&&(e.preventDefault(),e.stopPropagation(),!Ie)){X(n);try{if(l!=="anilist"){let o=!1;try{o=(await E("/api/anilist-status"))?.available===!0}catch{o=!1}if(o){const de=await E(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);u(`/anime/${de.id}`);return}const oe=await fetch("/api/mature/allocate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:l,nativeId:n,title:r.name,thumbnail:r.thumbnail})}),ce=await oe.json().catch(()=>null);if(!oe.ok||!ce?.id)throw new Error("Allocate failed");u(`/anime/${ce.id}`);return}const d=await E(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);u(`/anime/${d.id}`)}catch{qe.error("Could not match this title on AniList")}finally{X(null)}}},V=new Date().getFullYear(),$e=[{value:"ALL",label:"All Years"},...Array.from({length:V-1980+1},(e,r)=>({value:String(V-r),label:String(V-r)}))],Be=A.length>0?A.map(e=>({value:e,label:fe(e)})):J.map(e=>({value:e.slug,label:e.name}));return q?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 ${ae.find(e=>e.value===l)?.label}...`,value:S,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&P()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:l,onChange:e=>_e(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:ae.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:P,className:a.searchBtn,children:"Search"}),c&&t("button",{onClick:()=>Oe(!K),className:`${a.filterToggleBtn} ${K?a.active:""}`,children:[t(pe,{name:"filter"})," Filters"]}),ie&&t("select",{value:R,onChange:e=>{H(e.target.value),h(1),v(f({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(l==="anilist"||l==="mal")&&t("div",{className:`${a.advancedFilters} ${K?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:T,onChange:e=>U(e.currentTarget.value),children:He.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:y,onChange:e=>be(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),l==="anilist"&&t(he,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:_,onChange:e=>Ce(e.currentTarget.value),children:et.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:D,onChange:e=>Ne(e.currentTarget.value),children:$e.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:P,className:a.searchBtn,children:"Apply Filters"})})]}),!c&&!!B&&(M||p||C)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${W.tightGrid}`,children:[p&&t("div",{className:`${a.filterItem} ${W.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:re,onChange:e=>{Ae(e.target.value),h(1),v(f({remoteOrder:e.target.value,page:1}))},children:(b.length>0?b:["recent"]).map(e=>t("option",{value:e,children:Xe[e]||e},e))})]}),M&&t("div",{className:`${a.filterItem} ${W.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:g,onChange:e=>{p?(G(e.target.value),h(1),v(f({genre:e.target.value,page:1}))):De(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),Be.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),C&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:j,onChange:e=>Pe(e.target.value),onKeyDown:e=>{e.key==="Enter"&&P()},className:a.searchInput})]})]}),g&&M&&!p&&t("p",{className:a.pageSubtitle,children:["Browsing the ",fe(g)," genre — search text is ignored while a genre is selected."]}),(p||C)&&t("div",{className:a.filterActions,children:t(O,{onClick:P,className:a.searchBtn,children:"Apply Filters"})})]})]}),Te&&t(Ye,{message:Re?.message||"Search failed"}),Le?t(xe,{count:k}):w.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:[m?.total??w.length," result",(m?.total??w.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(ve,{page:L,totalPages:Math.max(1,Math.ceil((m?.total??0)/k)),canGoNext:se,onChange:ne,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:w.map(e=>t("div",{onClickCapture:r=>Ge(r,e),children:t(Ue,{anime:e})},`${l}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(ve,{page:L,totalPages:Math.max(1,Math.ceil((m?.total??0)/k)),canGoNext:se,onChange:ne,variant:"labeled"})})})]})]}):t(Qe,{isOpen:!0,onClose:()=>u("/"),onGrant:Se})}export{ft as default};
|
|
1
|
+
import{u as t,a as Me,o as ke,h as ue,d as s,T as me,S as he}from"./vendor-core-8R2fFbyN.js";import{b as ge}from"./vendor-query-BXRECSI6.js";import{B as O,M as we,q as E,Q as Fe,z as qe}from"./index-D2RkUJIN.js";import{I as pe}from"./vendor-icons-CDMuNDeL.js";import{S as xe,P as ve}from"./SkeletonGrid-BxfgjP4i.js";import{A as Ue}from"./AnimeCard-URCiiy5W.js";import{E as Ye}from"./ErrorMessage-z4f4WGgP.js";import{u as je}from"./useMatureConsent-CT7-KfzG.js";import{u as Ke}from"./useProviders-DDRxa8vl.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-BWShDHqE.js";import"./QueueOptionsButton-BVZyPyKf.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-CAzoxsRS.js";import"./useIsMobile-Dm_b6Ob3.js";const Qe=({isOpen:u,onClose:i,onGrant:F})=>t(we,{isOpen:u,title:"Content Warning",onClose:i,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:i,children:"Go Back"}),t(O,{onClick:F,children:"I'm 18+, Continue"})]})]})}),Ve="_shrinkSelect_130sm_1",We="_tightGrid_130sm_7",W={shrinkSelect:Ve,tightGrid:We},ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],He=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Je=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Ze=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],Xe={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},et=[{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(i=>i&&i[0].toUpperCase()+i.slice(1)).join(" ");function ft(){const u=Me(),[i,F]=ke(),{hasConsent:q,grant:Se}=je();ue(()=>{document.title="Mature - dango"},[]);const[l,ye]=s(i.get("provider")||"anilist"),[S,z]=s(i.get("query")||""),[I,x]=s(i.get("query")||""),[L,h]=s(parseInt(i.get("page")||"1",10)||1),[T,U]=s(()=>{const e=i.get("sortBy");return e||(l==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[R,H]=s(i.get("sortBy")||""),[y,be]=s(i.get("status")||""),[_,Ce]=s(i.get("season")||"ALL"),[D,Ne]=s(i.get("year")||"ALL"),[g,G]=s(i.get("genre")||i.get("genres")||""),[Y,Ae]=s(i.get("order")||"recent"),[j,Pe]=s(i.get("studio")||""),[$,Ee]=s(i.get("studio")||""),[J,Z]=s([]),[K,Oe]=s(!1),[Ie,X]=s(null),{options:ee}=Ke(),te=me(()=>ee.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[ee]),ae=me(()=>[...ze,...te.map(e=>({value:e.value,label:e.label}))],[te]),{data:B}=ge({queryKey:["mature-filters"],queryFn:()=>E("/api/mature/filters"),enabled:q,staleTime:1/0}),c=l==="anilist"||l==="mal",Q=c?void 0:B?.providers?.[l],N=Q?.browse,A=Q?.genres??[],b=Q?.orders??[],re=b.length>0&&!b.includes(Y)?b[0]:Y,M=!c&&(N?.genre===!0||A.length>0||J.length>0),p=!c&&(N?.order===!0||b.length>0),C=!c&&N?.studio===!0,ie=!c&&N?.sort===!0,k=c?14:N?.pageSize??14,v=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const n=B?.providers?.[e.provider]?.browse,d=B?.providers?.[e.provider]?.orders??[],o=d.length>0&&!d.includes(e.remoteOrder)?d[0]:e.remoteOrder;(!n||n.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!n||n.genre)&&e.genre&&r.set("genre",e.genre),(!n||n.order)&&o!==(d[0]??"recent")&&r.set("order",o),(!n||n.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}F(r,{replace:!0})},f=(e={})=>({provider:l,query:I,page:L,sort:T,remoteSort:R,status:y,season:_,year:D,genre:g,remoteOrder:Y,studio:$,...e}),le=(()=>{const e=new URLSearchParams;return e.set("provider",l),I.trim()&&e.set("query",I.trim()),e.set("page",String(L)),e.set("limit",String(k)),l==="anilist"&&(e.set("sortBy",T),y&&e.set("status",y),_!=="ALL"&&e.set("season",_),D!=="ALL"&&e.set("year",D)),l==="mal"?(e.set("sortBy",T),y&&e.set("status",y)):c||(M&&g&&e.set("genre",g),p&&e.set("order",re),ie&&R&&e.set("sortBy",R),C&&$.trim()&&e.set("studio",$.trim())),e.toString()})(),{data:m,isLoading:Le,isError:Te,error:Re}=ge({queryKey:["mature-search",le],queryFn:()=>E(`/api/mature/search?${le}`),enabled:q});ue(()=>{const e=m?.genres;!c&&A.length===0&&e&&e.length>0&&Z(r=>{const n=new Set(r.map(o=>o.slug)),d=[...r];for(const o of e)o.slug&&!n.has(o.slug)&&(n.add(o.slug),d.push(o));return d.length===r.length?r:d})},[m,l,c,A.length]);const w=(m?.data||[]).map(e=>({...e,isAdult:!0})),se=m?.hasMore??!1,P=()=>{Fe(),h(1);let e=g;!c&&!p&&S.trim()&&(e=""),G(e),C&&Ee(j),x(S),v(f({query:S,page:1,genre:e,studio:C?j:$}))},_e=e=>{ye(e),h(1),H(""),G(""),Z([]),e==="mal"?U("SCORE_DESC"):e==="anilist"&&U("POPULARITY_DESC"),x(S),v(f({provider:e,page:1,remoteSort:"",genre:"",query:S}))},De=e=>{G(e),h(1),e&&(z(""),x("")),v(f({genre:e,page:1,query:e?"":I}))},ne=e=>{h(e),v(f({page:e})),window.scrollTo({top:0,behavior:"smooth"})},Ge=async(e,r)=>{const n=r.id||r._id;if(l!=="mal"&&!/^\d+$/.test(n)&&(e.preventDefault(),e.stopPropagation(),!Ie)){X(n);try{if(l!=="anilist"){let o=!1;try{o=(await E("/api/anilist-status"))?.available===!0}catch{o=!1}if(o){const de=await E(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);u(`/anime/${de.id}`);return}const oe=await fetch("/api/mature/allocate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:l,nativeId:n,title:r.name,thumbnail:r.thumbnail})}),ce=await oe.json().catch(()=>null);if(!oe.ok||!ce?.id)throw new Error("Allocate failed");u(`/anime/${ce.id}`);return}const d=await E(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);u(`/anime/${d.id}`)}catch{qe.error("Could not match this title on AniList")}finally{X(null)}}},V=new Date().getFullYear(),$e=[{value:"ALL",label:"All Years"},...Array.from({length:V-1980+1},(e,r)=>({value:String(V-r),label:String(V-r)}))],Be=A.length>0?A.map(e=>({value:e,label:fe(e)})):J.map(e=>({value:e.slug,label:e.name}));return q?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 ${ae.find(e=>e.value===l)?.label}...`,value:S,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&P()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:l,onChange:e=>_e(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:ae.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:P,className:a.searchBtn,children:"Search"}),c&&t("button",{onClick:()=>Oe(!K),className:`${a.filterToggleBtn} ${K?a.active:""}`,children:[t(pe,{name:"filter"})," Filters"]}),ie&&t("select",{value:R,onChange:e=>{H(e.target.value),h(1),v(f({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(l==="anilist"||l==="mal")&&t("div",{className:`${a.advancedFilters} ${K?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:T,onChange:e=>U(e.currentTarget.value),children:He.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:y,onChange:e=>be(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),l==="anilist"&&t(he,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:_,onChange:e=>Ce(e.currentTarget.value),children:et.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:D,onChange:e=>Ne(e.currentTarget.value),children:$e.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:P,className:a.searchBtn,children:"Apply Filters"})})]}),!c&&!!B&&(M||p||C)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${W.tightGrid}`,children:[p&&t("div",{className:`${a.filterItem} ${W.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:re,onChange:e=>{Ae(e.target.value),h(1),v(f({remoteOrder:e.target.value,page:1}))},children:(b.length>0?b:["recent"]).map(e=>t("option",{value:e,children:Xe[e]||e},e))})]}),M&&t("div",{className:`${a.filterItem} ${W.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:g,onChange:e=>{p?(G(e.target.value),h(1),v(f({genre:e.target.value,page:1}))):De(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),Be.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),C&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:j,onChange:e=>Pe(e.target.value),onKeyDown:e=>{e.key==="Enter"&&P()},className:a.searchInput})]})]}),g&&M&&!p&&t("p",{className:a.pageSubtitle,children:["Browsing the ",fe(g)," genre — search text is ignored while a genre is selected."]}),(p||C)&&t("div",{className:a.filterActions,children:t(O,{onClick:P,className:a.searchBtn,children:"Apply Filters"})})]})]}),Te&&t(Ye,{message:Re?.message||"Search failed"}),Le?t(xe,{count:k}):w.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:[m?.total??w.length," result",(m?.total??w.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(ve,{page:L,totalPages:Math.max(1,Math.ceil((m?.total??0)/k)),canGoNext:se,onChange:ne,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:w.map(e=>t("div",{onClickCapture:r=>Ge(r,e),children:t(Ue,{anime:e})},`${l}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(ve,{page:L,totalPages:Math.max(1,Math.ceil((m?.total??0)/k)),canGoNext:se,onChange:ne,variant:"labeled"})})})]})]}):t(Qe,{isOpen:!0,onClose:()=>u("/"),onGrant:Se})}export{ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as y,g as T,u as e,S as ee,$ as Ne,h as K,A as x,q as d,N as Ee,a as Se,L as Ie}from"./vendor-core-8R2fFbyN.js";import{a as Re,b as Ae,f as $e,s as Le}from"./vendor-ui-CUDCvRS_.js";import{I as v}from"./vendor-icons-CDMuNDeL.js";import{q as ke,d as Oe,u as ze,a as De,f as Ue,M as Ve,B as Q}from"./index-C65i4HWv.js";import{u as Ge}from"./useIsMobile-Dm_b6Ob3.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",ct="_secondaryActions_7glox_184",lt="_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:ct,watchlistBtn:lt,detailsBtn:it,active:dt,loading:ut,spinner:_t},ln=({anchorRect:t,onMouseEnter:a,onMouseLeave:c,onRequestClose:l,children:u})=>{const[i]=y(()=>window.matchMedia("(pointer: coarse)").matches),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Re({placement:"right-start",middleware:[$e({fallbackAxisSideDirection:"start"}),Le({padding:20})],whileElementsMounted:Ae});T.useEffect(()=>{w.setPositionReference(r)},[w,r]),T.useEffect(()=>{if(!i)return;const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C}},[i]);const _=e(ee,{children:[i&&e("div",{className:R.popupBackdrop,onClick:()=>l?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:c,children:e("div",{className:R.popupContent,children:u})})]});return Ne(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[c,l]=y(a);return K(()=>{l(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return ke(`/api/show-meta/${t}`).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&l(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:c}}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",$t="_airTime_w7bu0_234",Lt="_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:$t,adultBadge:Lt,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=x(null),c=x(null),l=x(!1),u=x({x:0,y:0}),i=x(null),r=d(()=>{c.current&&(clearTimeout(c.current),c.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)=>{l.current=p,t(s,p)},[t]),C=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,l.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),c.current=setTimeout(()=>{c.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!c.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"?c.current&&(clearTimeout(c.current),c.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!l.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>l.current?(l.current=!1,!0):!1,[]);return{longPressFiredRef:l,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown:C,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=Ee(({item:t,linkTo:a,hoverIcon:c,progress:l,showProgress:u=!1,metaRow:i,display:r,layout:w="vertical",onRemove:b,showRemoveButton:_,showInfoButton:C=!1,onOpenDetails:B,renderPopup:g,onPopupHoverIntent:P,rawThumbnail:A,enrichedId:s})=>{const p=Se(),m=Ge(),{titlePreference:te}=Oe(),{lowEndMode:M}=ze(),[ne,oe]=y(!1),[re,D]=y(!1),{thumbnail:U}=gt(s,t.thumbnail),[$,V]=y(!1),[G,W]=y(null),Y=o=>{W(o),V(!0)},L=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose(L)},[f,L]),j=f.clearPopupTimeout,se=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},ae=()=>{g&&k()},ce=()=>{j()},le=()=>{g&&k()},ie=o=>{f.handlePointerDown(o,h)},de=o=>{f.handlePointerMove(o)},F=()=>{f.handlePointerUpOrCancel()},ue=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[te]||t.title,N=X.elements?.poster,E=X.elements?.info,_e=(N?.typeBadge??!0)&&!!t.typeBadge,pe=(N?.chapterBadge??!0)&&!!t.chapterBadge,ge=_??N?.removeButton??!!b,me=N?.adultBadge??!0,fe=E?.mobileBadges??!0,he=E?.progress??!0,be=E?.meta??!0,Be=u&&!!l&&l.percent>0,q=!!t.isAdult,[we,ve]=De("agreedToViewMature","false"),ye=we==="true",[H,S]=T.useState(!1),I=T.useRef(null),Ce=()=>{ve("true"),S(!1),I.current&&(p(I.current),I.current=null)},h=q&&!ye,Me=o=>{if(f.consumeLongPressClick()){o.preventDefault(),o.stopPropagation();return}h&&(o.preventDefault(),o.stopPropagation(),I.current=a,S(!0))},xe=c==="book"?e(v,{name:"book",size:28}):c==="play"?e(v,{name:"play",size:28}):c==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),Te=d(o=>{o.preventDefault(),o.stopPropagation(),b&&b(t.id)},[b,t.id]),Pe=A?U??t.thumbnail:Ue(U,M?100:150,M?150:200);return e("div",{className:`${n.cardWrapper} ${M?n.lowEnd:""}`,onMouseEnter:()=>{D(!0),P?.(!0),$&&j()},onMouseLeave:()=>{D(!1),P?.(!1),$&&k()},children:[e(Ie,{to:a,className:`${n.card} ${n[w]} ${h?n.cardButton:""}`,onClick:Me,onContextMenu:ue,onPointerDown:ie,onPointerMove:de,onPointerUp:F,onPointerCancel:F,children:[e("div",{className:n.posterContainer,children:[h&&e("div",{className:`${n.matureOverlay} ${M?n.flat:""}`}),e("img",{src:Pe,alt:O,className:`${n.posterImg} ${ne?n.loaded:""} ${h&&!M?n.blurred:""}`,loading:"lazy",decoding:"async",onLoad:()=>oe(!0)}),!m&&e(ee,{children:[_e&&e("div",{className:n.typeBadge,children:t.typeBadge}),pe&&e("div",{className:n.epBadge,children:[t.chapterBadge,t.airMeta&&e("span",{className:n.airTime,children:t.airMeta})]})]}),me&&q&&e("div",{className:`${n.adultBadge} ${h?n.gated:""}`,children:"18+"}),t.notAired&&e("div",{className:n.notAiredBadge,children:"NOT AIRED"}),!m&&re&&e("div",{className:n.hoverOverlay,children:xe})]}),he&&u&&Be&&l&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${l.percent}%`}})}),e("div",{className:n.timestamp,children:l.label})]}),e("div",{className:n.titleSection,children:[m&&fe&&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(Ve,{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:Ce,children:"I'm 18+, Continue"})]})]})}),ge&&e("button",{className:n.removeBtn,onClick:Te,"aria-label":"Remove",children:e(v,{name:"times",size:10})}),C&&!m&&!h&&e("button",{className:n.infoBtn,onMouseEnter:se,onMouseLeave:ae,"aria-label":"Info",children:e(v,{name:"info",size:11})}),g&&$&&G?g(G,{close:L,onMouseEnter:ce,onMouseLeave:le}):null]})});export{dn as M,ln as a,n as m,R as p};
|
|
1
|
+
import{d as y,g as T,u as e,S as ee,$ as Ne,h as K,A as x,q as d,N as Ee,a as Se,L as Ie}from"./vendor-core-8R2fFbyN.js";import{a as Re,b as Ae,f as $e,s as Le}from"./vendor-ui-CUDCvRS_.js";import{I as v}from"./vendor-icons-CDMuNDeL.js";import{q as ke,d as Oe,u as ze,a as De,f as Ue,M as Ve,B as Q}from"./index-D2RkUJIN.js";import{u as Ge}from"./useIsMobile-Dm_b6Ob3.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",ct="_secondaryActions_7glox_184",lt="_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:ct,watchlistBtn:lt,detailsBtn:it,active:dt,loading:ut,spinner:_t},ln=({anchorRect:t,onMouseEnter:a,onMouseLeave:c,onRequestClose:l,children:u})=>{const[i]=y(()=>window.matchMedia("(pointer: coarse)").matches),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Re({placement:"right-start",middleware:[$e({fallbackAxisSideDirection:"start"}),Le({padding:20})],whileElementsMounted:Ae});T.useEffect(()=>{w.setPositionReference(r)},[w,r]),T.useEffect(()=>{if(!i)return;const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C}},[i]);const _=e(ee,{children:[i&&e("div",{className:R.popupBackdrop,onClick:()=>l?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:c,children:e("div",{className:R.popupContent,children:u})})]});return Ne(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[c,l]=y(a);return K(()=>{l(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return ke(`/api/show-meta/${t}`).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&l(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:c}}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",$t="_airTime_w7bu0_234",Lt="_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:$t,adultBadge:Lt,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=x(null),c=x(null),l=x(!1),u=x({x:0,y:0}),i=x(null),r=d(()=>{c.current&&(clearTimeout(c.current),c.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)=>{l.current=p,t(s,p)},[t]),C=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,l.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),c.current=setTimeout(()=>{c.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!c.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"?c.current&&(clearTimeout(c.current),c.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!l.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>l.current?(l.current=!1,!0):!1,[]);return{longPressFiredRef:l,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown:C,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=Ee(({item:t,linkTo:a,hoverIcon:c,progress:l,showProgress:u=!1,metaRow:i,display:r,layout:w="vertical",onRemove:b,showRemoveButton:_,showInfoButton:C=!1,onOpenDetails:B,renderPopup:g,onPopupHoverIntent:P,rawThumbnail:A,enrichedId:s})=>{const p=Se(),m=Ge(),{titlePreference:te}=Oe(),{lowEndMode:M}=ze(),[ne,oe]=y(!1),[re,D]=y(!1),{thumbnail:U}=gt(s,t.thumbnail),[$,V]=y(!1),[G,W]=y(null),Y=o=>{W(o),V(!0)},L=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose(L)},[f,L]),j=f.clearPopupTimeout,se=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},ae=()=>{g&&k()},ce=()=>{j()},le=()=>{g&&k()},ie=o=>{f.handlePointerDown(o,h)},de=o=>{f.handlePointerMove(o)},F=()=>{f.handlePointerUpOrCancel()},ue=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[te]||t.title,N=X.elements?.poster,E=X.elements?.info,_e=(N?.typeBadge??!0)&&!!t.typeBadge,pe=(N?.chapterBadge??!0)&&!!t.chapterBadge,ge=_??N?.removeButton??!!b,me=N?.adultBadge??!0,fe=E?.mobileBadges??!0,he=E?.progress??!0,be=E?.meta??!0,Be=u&&!!l&&l.percent>0,q=!!t.isAdult,[we,ve]=De("agreedToViewMature","false"),ye=we==="true",[H,S]=T.useState(!1),I=T.useRef(null),Ce=()=>{ve("true"),S(!1),I.current&&(p(I.current),I.current=null)},h=q&&!ye,Me=o=>{if(f.consumeLongPressClick()){o.preventDefault(),o.stopPropagation();return}h&&(o.preventDefault(),o.stopPropagation(),I.current=a,S(!0))},xe=c==="book"?e(v,{name:"book",size:28}):c==="play"?e(v,{name:"play",size:28}):c==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),Te=d(o=>{o.preventDefault(),o.stopPropagation(),b&&b(t.id)},[b,t.id]),Pe=A?U??t.thumbnail:Ue(U,M?100:150,M?150:200);return e("div",{className:`${n.cardWrapper} ${M?n.lowEnd:""}`,onMouseEnter:()=>{D(!0),P?.(!0),$&&j()},onMouseLeave:()=>{D(!1),P?.(!1),$&&k()},children:[e(Ie,{to:a,className:`${n.card} ${n[w]} ${h?n.cardButton:""}`,onClick:Me,onContextMenu:ue,onPointerDown:ie,onPointerMove:de,onPointerUp:F,onPointerCancel:F,children:[e("div",{className:n.posterContainer,children:[h&&e("div",{className:`${n.matureOverlay} ${M?n.flat:""}`}),e("img",{src:Pe,alt:O,className:`${n.posterImg} ${ne?n.loaded:""} ${h&&!M?n.blurred:""}`,loading:"lazy",decoding:"async",onLoad:()=>oe(!0)}),!m&&e(ee,{children:[_e&&e("div",{className:n.typeBadge,children:t.typeBadge}),pe&&e("div",{className:n.epBadge,children:[t.chapterBadge,t.airMeta&&e("span",{className:n.airTime,children:t.airMeta})]})]}),me&&q&&e("div",{className:`${n.adultBadge} ${h?n.gated:""}`,children:"18+"}),t.notAired&&e("div",{className:n.notAiredBadge,children:"NOT AIRED"}),!m&&re&&e("div",{className:n.hoverOverlay,children:xe})]}),he&&u&&Be&&l&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${l.percent}%`}})}),e("div",{className:n.timestamp,children:l.label})]}),e("div",{className:n.titleSection,children:[m&&fe&&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(Ve,{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:Ce,children:"I'm 18+, Continue"})]})]})}),ge&&e("button",{className:n.removeBtn,onClick:Te,"aria-label":"Remove",children:e(v,{name:"times",size:10})}),C&&!m&&!h&&e("button",{className:n.infoBtn,onMouseEnter:se,onMouseLeave:ae,"aria-label":"Info",children:e(v,{name:"info",size:11})}),g&&$&&G?g(G,{close:L,onMouseEnter:ce,onMouseLeave:le}):null]})});export{dn as M,ln as a,n as m,R as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as M,d as b,h as E,g as Ye,u as e,S as w,$ as Ge,o as je,T as z}from"./vendor-core-8R2fFbyN.js";import{q as R,z as C}from"./index-D2RkUJIN.js";import{I as y}from"./vendor-icons-CDMuNDeL.js";import{a}from"./Asmr.module-ChUXDZKx.js";import{r as m}from"./Radio.module-DGSZLpKM.js";import{b as W,u as Me,a as _e}from"./vendor-query-BXRECSI6.js";function Ae(n){if(!Number.isFinite(n)||n<0)return"0:00";const h=Math.floor(n/60),p=Math.floor(n%60);return`${h}:${String(p).padStart(2,"0")}`}const Je=({track:n,shuffle:h,onToggleShuffle:p,onTrackStep:q,onTrackFailed:be,onClose:se,liked:Y,likeVisible:V,likePending:re,onToggleLike:Z})=>{const _=M(null),X=M(!1),[D,I]=b(!1),[he,l]=b(!0),[k,U]=b(!1),[$,A]=b(0),[H,oe]=b(0),[x,K]=b(()=>{const s=parseFloat(localStorage.getItem("musicVolume")||"");return Number.isFinite(s)?s:1}),[F,le]=b(()=>localStorage.getItem("musicAutoplay")!=="false"),G=M(x);G.current=x;const N=M(F);N.current=F;const f=M(0),O=M(0),B=M(null),Q=M("");Q.current||(Q.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`music-${Date.now()}-${Math.random().toString(36).slice(2)}`);const ee=`/api/music/audio?videoId=${encodeURIComponent(n.id)}`,j=()=>{B.current&&(window.clearTimeout(B.current),B.current=null)},te=s=>{const r=_.current;if(!r)return;j(),l(!0),U(!1);const v=()=>{if(r.removeEventListener("loadedmetadata",v),s>5&&Number.isFinite(r.duration)&&s<r.duration-5)try{r.currentTime=s}catch{}};r.addEventListener("loadedmetadata",v),r.src=ee,r.load(),r.volume=G.current,r.play().catch(()=>{})},ve=()=>{l(!1),U(!0),be?.(n),N.current&&q(1)},ce=()=>{if(!B.current){if(O.current>=3){ve();return}O.current+=1,B.current=window.setTimeout(()=>{B.current=null,te(f.current)},5e3)}},ke=()=>{O.current=0,te(f.current)};E(()=>{f.current=0,O.current=0,I(!1),A(0),oe(0);const s=_.current;return te(f.current),()=>{j(),s&&s.removeAttribute("src")}},[ee]),E(()=>{const s=_.current;s&&(s.volume=x)},[x]),E(()=>(document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")),[]);const P=n.thumbnails?.[n.thumbnails.length-1]?.url??null,ne=Ye.useCallback(s=>{const r=_.current;fetch("/api/discord/music",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n.title,artistLabel:n.artists,isPlaying:s,thumbnail:P||"",currentTime:r?.currentTime??0,duration:Number.isFinite(r?.duration??NaN)?r?.duration:0,sessionId:Q.current})}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Q.current})}).catch(()=>{})},[n,P]);E(()=>{ne(D)},[ne,D,n.id]),E(()=>{if(!D)return;const s=window.setInterval(()=>ne(!0),15e3);return()=>window.clearInterval(s)},[D,ne]),E(()=>{const s=Q.current,r=()=>{if(!s)return;const S=JSON.stringify({sessionId:s});navigator.sendBeacon?(navigator.sendBeacon("/api/discord/clear",new Blob([S],{type:"application/json"})),navigator.sendBeacon("/api/discord/heartbeat",new Blob([JSON.stringify({sessionId:s,bye:!0})],{type:"application/json"}))):(fetch("/api/discord/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:S,keepalive:!0}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,bye:!0}),keepalive:!0}).catch(()=>{}))},v=()=>r(),ae=()=>{document.visibilityState==="hidden"&&r()};return window.addEventListener("pagehide",v),window.addEventListener("beforeunload",v),document.addEventListener("visibilitychange",ae),()=>{window.removeEventListener("pagehide",v),window.removeEventListener("beforeunload",v),document.removeEventListener("visibilitychange",ae),r()}},[]);const pe=()=>{const s=_.current;s&&(s.paused?s.play().catch(()=>{}):s.pause())},[Ne,ge]=b(!1);E(()=>{ge(!1)},[P]);const ue=`${n.title} — ${n.artists}`,Se=e(w,{children:[e("div",{className:a.playerButtons,children:[e("button",{className:a.playerBtn,onClick:()=>q(-1),"aria-label":"Previous track",children:e(y,{name:"step-backward"})}),e("button",{className:`${a.playerBtn} ${a.playBtn}`,onClick:pe,"aria-label":D?"Pause":"Play",children:D?e(y,{name:"pause"}):e(y,{name:"play"})}),e("button",{className:a.playerBtn,onClick:()=>q(1),"aria-label":"Next track",children:e(y,{name:"step-forward"})}),k&&e("button",{className:a.playerBtn,onClick:ke,title:"Retry playback","aria-label":"Retry playback",children:e(y,{name:"redo"})})]}),e("div",{className:a.seekRow,children:[e("span",{className:a.timeLabel,children:Ae($)}),e("input",{className:a.seekBar,type:"range",min:0,max:H||0,step:.1,value:Math.min($,H||0),onChange:s=>{const r=_.current;!r||!Number.isFinite(r.duration)||(r.currentTime=parseFloat(s.target.value),A(r.currentTime))},onPointerDown:()=>{X.current=!0},onPointerUp:()=>{X.current=!1},style:{"--played-percent":`${H>0?$/H*100:0}%`},"aria-label":"Seek"}),e("span",{className:a.timeLabel,children:Ae(H)}),he&&!k&&e("span",{className:a.timeLabel,children:"loading…"})]})]}),ye=e(w,{children:[n.thumbnails?.[0]?.url&&!Ne&&e("img",{src:n.thumbnails[0].url,alt:"",className:m.stationThumb,loading:"lazy",decoding:"async",onError:()=>ge(!0)}),e("div",{className:a.playerInfo,children:[e("p",{className:a.playerTitle,title:ue,children:ue}),e("p",{className:a.playerTrack,children:n.artists})]}),e("div",{className:a.playerControls,children:Se}),e("div",{className:a.playerRight,children:[x===0?e(y,{name:"volume-mute",className:a.volumeIcon}):x<.5?e(y,{name:"volume-down",className:a.volumeIcon}):e(y,{name:"volume-up",className:a.volumeIcon}),e("input",{className:a.volumeBar,type:"range",min:0,max:1,step:.01,value:x,onChange:s=>{const r=parseFloat(s.target.value);K(r),localStorage.setItem("musicVolume",String(r))},style:{"--volume-percent":`${x*100}%`},"aria-label":"Volume"})]}),e("div",{className:a.playerActions,children:[V&&Z&&e("button",{className:`${a.playerBtn} ${Y?a.playerBtnActive:""}`,onClick:Z,disabled:re,title:Y?"Remove from Liked Music":"Add to Liked Music","aria-label":Y?"Remove from Liked Music":"Add to Liked Music","aria-pressed":!!Y,children:e(y,{name:"heart"})}),e("button",{className:`${a.playerBtn} ${h?a.playerBtnActive:""}`,onClick:p,title:h?"Shuffle on":"Shuffle off","aria-label":"Toggle shuffle","aria-pressed":h,children:e(y,{name:"shuffle"})}),e("button",{className:`${a.playerBtn} ${F?a.playerBtnActive:""}`,onClick:()=>{le(s=>(localStorage.setItem("musicAutoplay",String(!s)),!s))},title:F?"Autoplay on: next track plays automatically":"Autoplay off","aria-label":"Toggle autoplay","aria-pressed":F,children:e(y,{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(y,{name:"external-link-alt"})}),e("button",{className:a.playerBtn,onClick:se,"aria-label":"Close player",children:e(y,{name:"times"})})]})]});return Ge(e(w,{children:[e("audio",{ref:_,preload:"none",onPlay:()=>{I(!0),l(!1),U(!1),O.current=0,j()},onPause:()=>I(!1),onWaiting:()=>{k||l(!0)},onPlaying:()=>{l(!1),O.current=0,j()},onTimeUpdate:s=>{const r=s.target.currentTime;f.current=r,j(),X.current||A(r)},onStalled:()=>{ce()},onLoadedMetadata:s=>{const r=s.target.duration;Number.isFinite(r)&&oe(r)},onDurationChange:s=>{const r=s.target.duration;Number.isFinite(r)&&oe(r)},onError:()=>{ce()},onEnded:()=>{N.current&&q(1)}}),e("div",{className:a.playerBar,children:ye})]}),document.body)},We=()=>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."})]})]}),me=300*1e3,Ve=()=>W({queryKey:["music-auth"],queryFn:()=>R("/api/music/auth/status"),staleTime:30*1e3,refetchInterval:n=>n.state.data?.authenticated?!1:3e3,retry:1}),Ze=()=>{const n=Me();return _e({mutationFn:h=>R("/api/music/auth/start",{method:"POST",body:JSON.stringify({cookie:h})}),onSuccess:(h,p)=>{localStorage.setItem("ytmusic_cookie",p),n.invalidateQueries({queryKey:["music-auth"]}),n.invalidateQueries({queryKey:["music-library"]})}})},Xe=()=>{const n=Me();return _e({mutationFn:()=>R("/api/music/auth/signout",{method:"POST"}),onSuccess:()=>{n.invalidateQueries({queryKey:["music-auth"]}),n.invalidateQueries({queryKey:["music-library"]})}})},et=n=>W({queryKey:["music-search",n],queryFn:()=>R(`/api/music/search?q=${encodeURIComponent(n)}`),enabled:n.trim().length>0,staleTime:me,retry:1}),tt=n=>W({queryKey:["music-library"],queryFn:()=>R("/api/music/library"),enabled:n,staleTime:me,retry:1}),nt=n=>W({queryKey:["music-track",n],queryFn:()=>R(`/api/music/track?id=${encodeURIComponent(n||"")}`),enabled:!!n,staleTime:me,retry:1}),at=n=>W({queryKey:["music-playlist",n],queryFn:()=>R(`/api/music/playlist?id=${encodeURIComponent(n||"")}`),enabled:!!n,staleTime:me,retry:1}),it=n=>W({queryKey:["music-upnext",n],queryFn:()=>R(`/api/music/upnext?id=${encodeURIComponent(n||"")}`),enabled:!!n,staleTime:me,retry:1}),st=n=>W({queryKey:["music-likes"],queryFn:()=>R("/api/music/likes"),enabled:n,staleTime:120*1e3,retry:1}),rt=()=>{const n=Me();return _e({mutationFn:({id:h,like:p})=>R("/api/music/like",{method:"POST",body:JSON.stringify({id:h,like:p})}),onSuccess:()=>{n.invalidateQueries({queryKey:["music-likes"]}),n.invalidateQueries({queryKey:["music-library"]}),n.invalidateQueries({queryKey:["music-upnext"]})}})},ot="_authRow_10tvv_1",lt="_btn_10tvv_9",ct="_btnGhost_10tvv_42",ut="_cookieForm_10tvv_74",dt="_cookieInput_10tvv_83",mt="_link_10tvv_99",ht="_contentLayout_10tvv_109",pt="_mainCol_10tvv_116",gt="_upnextAside_10tvv_120",yt="_upnextHeader_10tvv_131",ft="_upnextTitle_10tvv_139",bt="_upnextActions_10tvv_149",vt="_nowPlayingLabel_10tvv_156",kt="_nowPlayingWrap_10tvv_168",Nt="_likeBtn_10tvv_172",St="_likeActive_10tvv_196",g={authRow:ot,btn:lt,btnGhost:ct,cookieForm:ut,cookieInput:dt,link:mt,contentLayout:ht,mainCol:pt,upnextAside:gt,upnextHeader:yt,upnextTitle:ft,upnextActions:bt,nowPlayingLabel:vt,nowPlayingWrap:kt,likeBtn:Nt,likeActive:St};function Fe(n){const h=n.trim();if(!h)return null;const p=h.match(/[?&]v=([A-Za-z0-9_-]{11})/)?.[1]??h.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)?.[1]??null;return p||(/^[A-Za-z0-9_-]{11}$/.test(h)?h:null)}const wt="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Pt=()=>{const[n,h]=je(),p=Fe(n.get("v")??""),[q,be]=b(""),[se,Y]=b(""),[V,re]=b(()=>{try{return localStorage.getItem("ytmusic_cookie")??""}catch{return""}}),[Z,_]=b(!1),[X,D]=b(()=>localStorage.getItem("musicShuffle")==="true"),[I,he]=b(()=>localStorage.getItem("musicRadio")!=="false"),[l,k]=b(null),[U,$]=b([]),[A,H]=b(null),[oe,x]=b({}),K=M([]);K.current=U;const F=M(null);F.current=l;const le=M(!1),G=M(new Set),{data:N}=Ve(),f=Ze(),O=Xe(),B=typeof navigator<"u"?navigator.userAgent:"",Q=/android/i.test(B),ee=/firefox|fxios/i.test(B)&&!Q,j=!ee&&!Q&&/chrome|chromium|edg|brave/i.test(B),te=ee||j,ve=()=>{if(Z)return;_(!0);const t=window.setTimeout(()=>{window.removeEventListener("dango:ytmusic-cookie",i),_(!1),C.error("Helper not detected — install the Dango Helper extension first.")},3e3),i=c=>{window.clearTimeout(t),window.removeEventListener("dango:ytmusic-cookie",i),_(!1);try{const o=JSON.parse(c.detail);if(o?.ok&&o.cookie){const d=o.cookie.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(d.includes("…")||d.includes("...")){C.error(`Helper returned a truncated cookie (${d.length} chars) — reload music.youtube.com and Extract again.`);return}re(d),C.success("Cookie extracted from helper — signing in…"),f.mutate(d)}else o?.error==="NO_COOKIE"?C.error("Helper found no YouTube login — log in on a music.youtube.com tab first."):C.error("Helper request failed — try again.")}catch{C.error("Helper request failed — try again.")}};window.addEventListener("dango:ytmusic-cookie",i),window.dispatchEvent(new CustomEvent("dango:get-ytmusic-cookie"))},{data:ce,isLoading:ke}=et(se),{data:P,isLoading:ne,isFetching:pe,error:Ne,refetch:ge}=tt(N?.authenticated===!0),{data:ue,isLoading:Se}=at(A?.id??null),{data:ye,isLoading:we}=it(l?.id??null),{data:s}=st(N?.authenticated===!0),r=rt(),v=z(()=>ce?.tracks||[],[ce]),ae=z(()=>P?.playlists||[],[P]),S=z(()=>P?.tracks||[],[P]),J=z(()=>ue?.tracks||[],[ue]),T=z(()=>{const t=ye?.tracks||[];return l?t.filter(i=>i.id!==l.id):t},[ye,l]),Be=z(()=>new Set(s?.likedIds||[]),[s]),Te=t=>oe[t.id]??(Be.has(t.id)||t.liked===!0);E(()=>{N?.authenticated!==!0&&x({})},[N?.authenticated]);const Ee=z(()=>[...v,...J,...S,...T],[v,J,S,T]),Oe=p&&l?.id!==p&&!Ee.some(t=>t.id===p)?p:null,{data:Pe}=nt(Oe),xe=l?.id;E(()=>{document.title=l?`${l.title} - dango`:"Music - dango"},[l]),E(()=>{if(!p){xe&&k(null);return}if(xe===p)return;const t=o=>{const d=o.find(u=>u.id===p);return d?(k(d),$(u=>u.some(ie=>ie.id===p)?u:o.length>0?o:[d]),!0):!1};if(t(v)||t(J)||t(S))return;const i=T.find(o=>o.id===p);if(i){k(i),$(o=>o.some(d=>d.id===i.id)?o:[i]);return}const c=Pe?.track;c&&c.id===p&&(k(c),$(o=>o.some(d=>d.id===c.id)?o:[c]))},[p,xe,v,J,S,T,Pe]);const Le=(t,i)=>{G.current.delete(t.id),k(t),$(i.length>0?i:[t]),h({v:t.id})},qe=t=>{G.current.add(t.id),C.error(`Couldn't play “${t.title}” — skipped.`)},De=async()=>{if(le.current)return;const t=K.current,i=t[t.length-1]??F.current;if(i){le.current=!0;try{const c=await R(`/api/music/upnext?id=${encodeURIComponent(i.id)}`),o=new Set(t.map(u=>u.id)),d=(c.tracks||[]).filter(u=>!o.has(u.id)&&!G.current.has(u.id));if(d.length===0){const u=K.current[0];u&&(k(u),h({v:u.id}));return}$([...K.current,...d]),k(d[0]),h({v:d[0].id})}catch{const c=K.current[0];c&&(k(c),h({v:c.id}))}finally{le.current=!1}}},Ue=t=>{const i=K.current,c=F.current;if(!c||i.length===0)return;const o=i.findIndex(L=>L.id===c.id);if(t>0&&I&&(o<0||o===i.length-1)){De();return}const d=L=>G.current.has(L.id),u=i.length;let ie;if(X&&u>1){let L=Math.floor(Math.random()*u);for(let Ce=0;Ce<u&&(L===o||d(i[L]));Ce++)L=Math.floor(Math.random()*u);ie=i[L]}else{const L=t>0?1:-1;let fe=(((o<0?L>0?-1:0:o)+L)%u+u)%u;for(let $e=1;$e<u&&d(i[fe]);$e++)fe=((fe+L)%u+u)%u;ie=i[fe]}k(ie),h({v:ie.id})},He=()=>{if(I){he(!1),localStorage.setItem("musicRadio","false");return}const t=F.current;if(!t)return;if(T.length===0){C.error("No radio suggestions for this song yet.");return}const i=new Set,c=[];for(const o of[t,...T])i.has(o.id)||(i.add(o.id),c.push(o));he(!0),localStorage.setItem("musicRadio","true"),$(c),C.success(`Radio started — ${T.length} songs queued.`)},Re=t=>{if(N?.authenticated!==!0){C.error("Sign in to like songs.");return}const i=!Te(t);x(c=>({...c,[t.id]:i})),r.mutate({id:t.id,like:i},{onError:()=>{x(c=>{const o={...c};return delete o[t.id],o}),C.error("Like action failed — try again.")}})},Ke=()=>{D(t=>(localStorage.setItem("musicShuffle",String(!t)),!t))},Qe=t=>e("button",{className:m.stationRow,onClick:()=>H(t),"aria-label":`Open ${t.title}`,children:[t.thumbnails?.[0]?.url?e("img",{src:t.thumbnails[0].url,alt:"",className:m.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:m.stationThumbPlaceholder,children:e(y,{name:"headphones"})}),e("span",{className:m.stationMeta,children:[e("span",{className:m.stationName,children:t.title}),t.subtitle&&e("span",{className:m.stationSub,children:t.subtitle})]})]},t.id),de=(t,i,c)=>{const o=l?.id===t.id,d=Te(t),u=[t.album,t.duration].filter(Boolean).join(" · ");return e("div",{className:`${m.stationRow} ${o?m.stationRowActive:""}`,style:{cursor:"default"},children:[e("button",{onClick:()=>c?c(t):Le(t,i),className:m.stationRow,style:{flex:1,minWidth:0,background:"transparent",border:0,padding:0},"aria-label":`Play ${t.title}`,children:[t.thumbnails?.[0]?.url?e("img",{src:t.thumbnails[0].url,alt:"",className:m.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:m.stationThumbPlaceholder,children:e(y,{name:"headphones"})}),e("span",{className:m.stationMeta,children:[e("span",{className:m.stationName,children:t.title}),e("span",{className:m.stationSub,children:[t.artists,u?` · ${u}`:""]})]})]}),N?.authenticated===!0&&e("button",{className:`${g.likeBtn} ${d?g.likeActive:""}`,onClick:()=>Re(t),disabled:r.isPending,title:d?"Remove from Liked Music":"Add to Liked Music","aria-label":d?`Remove ${t.title} from Liked Music`:`Add ${t.title} to Liked Music`,"aria-pressed":d,children:e(y,{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(y,{name:"external-link-alt"})})]},t.id)},Ie=z(()=>{if(!l)return T;const t=new Set,i=[];for(const c of[l,...T])t.has(c.id)||(t.add(c.id),i.push(c));return i},[l,T]),ze=t=>{Le(t,Ie)};return e("div",{className:`${a.page} ${l?a.pageWithPlayer:""}`,children:[e("div",{className:a.header,children:[e("h1",{className:a.pageTitle,children:[e(y,{name:"headphones"})," Music"]}),e("form",{className:a.searchForm,onSubmit:t=>{t.preventDefault();const i=Fe(q);i?(Y(""),h({v:i})):Y(q)},children:[e("input",{className:a.searchInput,value:q,onChange:t=>be(t.target.value),placeholder:"Search YouTube Music…","aria-label":"Search music"}),e("button",{className:a.searchBtn,type:"submit","aria-label":"Search",children:e(y,{name:"search"})})]})]}),e("div",{className:g.authRow,children:[N?.authenticated?e(w,{children:[e("span",{className:a.statusMsg,children:["Signed in to YouTube Music",P&&` — ${P.tracks.length} songs, ${P.playlists.length} playlists`]}),e("button",{className:g.btnGhost,onClick:()=>O.mutate(),disabled:O.isPending,children:"Sign out"})]}):e(w,{children:[e("form",{onSubmit:t=>{t.preventDefault();const i=V.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(i){if(i.includes("…")||i.includes("...")){C.error("That cookie is truncated (contains …). Right-click the Cookie header → Copy value, not the wrapped preview.");return}i!==V&&re(i),f.mutate(i)}},className:g.cookieForm,children:[e("input",{className:g.cookieInput,value:V,onChange:t=>re(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:f.isPending||!V.trim(),children:f.isPending?"Checking…":"Sign in"}),te&&e("button",{className:g.btnGhost,type:"button",onClick:ve,disabled:Z||f.isPending,title:"Read the YouTube Music cookie via the Dango Helper extension (same zip as AnimePahe/JapaneseASMR)",children:Z?"Extracting…":"Extract from helper"})]}),te&&e("p",{className:a.statusMsg,children:["Two ways to sign in: paste the Cookie header manually (steps below), or download"," ",e("a",{href:wt,target:"_blank",rel:"noreferrer",className:g.link,children:"dango-extension.zip"})," ","then"," ",ee?e(w,{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(w,{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(We,{})]}),f.isSuccess&&e("p",{className:a.statusMsg,children:["Signed in — found ",f.data.tracks," songs and ",f.data.playlists," ","playlists."]}),f.isError&&e("p",{className:a.statusMsg,children:f.error?.message||"Sign-in failed. Paste a fresh Cookie header from music.youtube.com."}),!N?.authenticated&&!f.isError&&!f.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:l?g.contentLayout:void 0,children:[e("div",{className:g.mainCol,children:se?e(w,{children:[e("h2",{className:m.sectionTitle,children:["Results for “",se,"”"]}),ke?e("p",{className:a.statusMsg,children:"Searching…"}):v.length===0?e("p",{className:a.statusMsg,children:"No tracks found."}):e("div",{className:m.stationList,children:v.map(t=>de(t,v))})]}):N?.authenticated?e(w,{children:[e("h2",{className:m.sectionTitle,children:"Your library"}),ne?e("p",{className:a.statusMsg,children:"Loading library…"}):ae.length===0&&S.length===0&&!A?e(w,{children:[e("p",{className:a.statusMsg,children:Ne?"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:()=>{ge()},disabled:pe,"aria-label":"Retry loading library",children:pe?"Retrying…":"Retry"})}),e("p",{className:a.statusMsg,children:"If it keeps happening, sign out and paste a fresh cookie."})]}):e(w,{children:[ae.length>0&&!A&&e(w,{children:[e("h3",{className:m.sectionTitle,children:"Playlists"}),e("div",{className:m.stationList,children:ae.map(t=>Qe(t))})]}),S.length>0&&!A&&e(w,{children:[e("h3",{className:m.sectionTitle,children:["Liked songs (",S.length,")"]}),e("div",{style:{marginBottom:8},children:e("button",{className:g.btnGhost,onClick:()=>Le(S[0],S),"aria-label":"Play all liked songs",children:[e(y,{name:"play"})," Play all"]})}),e("div",{className:m.stationList,children:S.map(t=>de(t,S))})]}),A?e(w,{children:[e("button",{className:g.btnGhost,onClick:()=>H(null),style:{marginBottom:8},children:"← Back to library"}),e("h3",{className:m.sectionTitle,children:A.title}),Se?e("p",{className:a.statusMsg,children:"Loading playlist…"}):J.length===0?e("p",{className:a.statusMsg,children:"No tracks in this playlist."}):e("div",{className:m.stationList,children:J.map(t=>de(t,J))})]}):null]})]}):e("p",{className:a.statusMsg,children:"Search above, or sign in to see your library."})}),l&&e("aside",{className:g.upnextAside,"aria-label":"Up next",children:[e("div",{className:g.upnextHeader,children:e("span",{className:g.upnextTitle,children:[e(y,{name:"list-ul"})," Up Next"]})}),e("div",{className:g.nowPlayingWrap,children:[e("p",{className:g.nowPlayingLabel,children:"Now playing"}),de(l,U.length>0?U:[l])]}),e("div",{className:g.upnextActions,children:e("button",{className:g.btnGhost,onClick:He,disabled:!I&&(we||T.length===0),"aria-pressed":I,title:I?"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:I?"Stop radio":"Start radio"})}),we?e("p",{className:a.statusMsg,children:"Loading suggestions…"}):T.length===0?e("p",{className:a.statusMsg,children:"No suggestions for this song."}):e("div",{className:m.stationList,children:T.map(t=>de(t,Ie,ze))})]})]}),l&&e(Je,{track:l,queue:U,shuffle:X,onToggleShuffle:Ke,onTrackStep:Ue,onTrackFailed:qe,onClose:()=>{k(null),h({})},liked:l?Te(l):!1,likeVisible:N?.authenticated===!0,likePending:r.isPending,onToggleLike:()=>Re(l)})]})};export{Pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as p,d as y,h as S}from"./vendor-core-8R2fFbyN.js";import{I as m}from"./vendor-icons-CDMuNDeL.js";import{M as s,y as b,T as f,B as g,z as k,D as C}from"./AvSyncCalibrator-
|
|
1
|
+
import{u as e,S as p,d as y,h as S}from"./vendor-core-8R2fFbyN.js";import{I as m}from"./vendor-icons-CDMuNDeL.js";import{M as s,y as b,T as f,B as g,z as k,D as C}from"./AvSyncCalibrator-BwCtRW0P.js";const O=({classes:n,title:i,titleTag:o="span",showBack:l=!0,onBack:t,panelRef:d,onPanelClick:a,children:c})=>{const r=o;return e("div",{ref:d,className:n.panel,onClick:a,children:[e("div",{className:n.header,children:[l&&e("button",{className:n.backBtn,onClick:t,children:e(m,{name:"chevron-left"})}),e(r,{className:n.title||void 0,children:i})]}),e("div",{className:n.content,children:c})]})},z=({classes:n,values:i,onChange:o})=>{const l=()=>{const t=C;o("fontSize",t.fontSize),o("position",t.position),o("bgOpacity",t.bgOpacity),o("bgColor",t.bgColor),o("textColor",t.textColor),o("edge",t.edge),o("bold",t.bold)};return e(p,{children:[e(s,{label:"Font Size",display:i.fontSize.toFixed(1),min:.5,max:10,step:.5,value:i.fontSize,percent:(i.fontSize-.5)/9.5*100,onChange:t=>{Number.isFinite(t)&&o("fontSize",t)}}),e(s,{label:"Vertical Position",display:`${i.position}`,min:0,max:100,step:1,value:i.position,percent:i.position,onChange:t=>{Number.isFinite(t)&&o("position",Math.round(t))}}),e(s,{label:"Background Opacity",display:`${Math.round(i.bgOpacity*100)}%`,min:0,max:1,step:.05,value:i.bgOpacity,percent:i.bgOpacity*100,onChange:t=>{Number.isFinite(t)&&o("bgOpacity",t)}}),e(b,{label:"Text Color",colors:f,value:i.textColor,onChange:t=>o("textColor",t)}),e(b,{label:"Background Color",colors:g,value:i.bgColor,onChange:t=>o("bgColor",t)}),e(k,{label:"Text Edge",options:["shadow","outline","none"],value:i.edge,onChange:t=>o("edge",t)}),e("button",{type:"button",className:`${n.item} ${i.bold?n.active:""}`,onClick:()=>o("bold",!i.bold),children:[e("span",{children:"Bold Text"}),i.bold&&e(m,{name:"check",size:12})]}),e("button",{type:"button",className:n.item,onClick:l,children:e("span",{children:"Reset to Defaults"})})]})},M=({classes:n,enabled:i,delayMs:o,onToggle:l,onDelayChange:t,onCalibrate:d})=>{const[a,c]=y(null),r=a??o;S(()=>{c(null)},[o]);const u=()=>{a!==null&&(t(a),c(null))};return e(p,{children:[e("button",{type:"button",className:`${n.item} ${i?n.active:""}`,onClick:()=>l(!i),children:[e("span",{children:"Video delay"}),i&&e(m,{name:"check",size:12})]}),e(s,{label:"Video delay",display:`${r}ms`,min:0,max:500,step:5,value:r,percent:r/500*100,onChange:h=>c(Math.round(h)),onCommit:u}),e("div",{className:n.note,children:"For Bluetooth headsets where audio arrives late. Video is held back via canvas; audio plays untouched."}),d&&e("button",{type:"button",className:n.item,onClick:d,children:e("span",{children:"Calibrate…"})})]})},E=({classes:n,options:i,onSelect:o})=>e(p,{children:i.map(l=>e("button",{type:"button",className:`${n.item} ${l.selected?n.active:""}`,onClick:()=>o(l.key),children:[e("span",{children:l.label}),l.selected&&e(m,{name:"check",size:12})]},l.key))});export{M as A,E as O,O as S,z as a};
|