@serifpersia/dango 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-CJy1SXH3.js → AnimeCard-B0oMgXBm.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-BoXlVvZ-.js → AnimeInfo-o0Udf0og.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-BxbA_7AV.js → AnimeInfoPage-CojMIEuf.js} +2 -2
  5. package/client/dist/assets/{Asmr--Zc8G9zv.js → Asmr-2V3yCCiK.js} +1 -1
  6. package/client/dist/assets/{AsmrResetProgressModal-CKYm-8cp.js → AsmrResetProgressModal-C9R7HlNa.js} +1 -1
  7. package/client/dist/assets/{AvSyncCalibrator-3yjZS7s6.js → AvSyncCalibrator-Bo3820j3.js} +1 -1
  8. package/client/dist/assets/{Home-rrhOGQcg.js → Home-C8uXTzIM.js} +1 -1
  9. package/client/dist/assets/{Insights-Bay90Yeg.js → Insights-CRqBfZuK.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-HzuDavbb.js → LibraryListPage-B_r51cRi.js} +1 -1
  11. package/client/dist/assets/{ListeningList-DYcQnnsG.js → ListeningList-BWnwvJTt.js} +1 -1
  12. package/client/dist/assets/{Manga-D8CT9aO0.js → Manga-CI5cZg3h.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-DGK6CYp1.js → MangaInfoPage-BtkOrO34.js} +1 -1
  14. package/client/dist/assets/{MangaReadPage-B9XoDKF9.js → MangaReadPage-Uv72AYdY.js} +1 -1
  15. package/client/dist/assets/{MangaResetProgressModal-QjZyIAjl.js → MangaResetProgressModal-CPMEqZyi.js} +1 -1
  16. package/client/dist/assets/{Mature-CHt_-Hz5.js → Mature-DXHWvoY5.js} +1 -1
  17. package/client/dist/assets/{MediaCard-B5584Cq9.js → MediaCard-DzA336CA.js} +1 -1
  18. package/client/dist/assets/{Music-HeLrEZ2d.js → Music-C4dM0BQx.js} +1 -1
  19. package/client/dist/assets/{OptionListMenu-CJ90CdwI.js → OptionListMenu-CpwxAC3J.js} +1 -1
  20. package/client/dist/assets/{Player-BYtEax_z.js → Player-CpMvWTkH.js} +2 -2
  21. package/client/dist/assets/{PlayerSettings-4-cUAY4B.js → PlayerSettings-pMU85k7p.js} +1 -1
  22. package/client/dist/assets/{QueueOptionsButton-Ba0dg_82.js → QueueOptionsButton-1M7MdKzM.js} +1 -1
  23. package/client/dist/assets/{QueueRail-O7f4RqjB.js → QueueRail-Bpla2xD8.js} +1 -1
  24. package/client/dist/assets/{Radio-DPZxQnyD.js → Radio-DlmTC-qG.js} +1 -1
  25. package/client/dist/assets/{ReadingList-n6rr8ygy.js → ReadingList-wJMDUybm.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal-CcStlbhP.js → ResetProgressModal-CByRM1Fh.js} +1 -1
  27. package/client/dist/assets/{Search-C2wrWOdy.js → Search-B94D0tRM.js} +1 -1
  28. package/client/dist/assets/{Settings-CluUYs8U.js → Settings-CcU3oNY8.js} +1 -1
  29. package/client/dist/assets/{SkeletonGrid-CLEPY9nP.js → SkeletonGrid-BJyZkg_K.js} +1 -1
  30. package/client/dist/assets/{Trackers-CTGPxs0V.js → Trackers-vz-gqxtm.js} +1 -1
  31. package/client/dist/assets/{Tv-BwHlDdi8.js → Tv-Rji_lvQo.js} +1 -1
  32. package/client/dist/assets/{TvInfo-CXnrLekr.js → TvInfo-Ciujd6os.js} +1 -1
  33. package/client/dist/assets/{TvPopup-BekfiNcX.js → TvPopup-CqlVRF-Y.js} +1 -1
  34. package/client/dist/assets/{TvSearch-DuqR-z3v.js → TvSearch-BcKXQue9.js} +1 -1
  35. package/client/dist/assets/{TvWatchlist-CBvgFrA0.js → TvWatchlist-sjsiup2h.js} +1 -1
  36. package/client/dist/assets/{Watchlist-mj8mTOam.js → Watchlist-DAMdvt7Z.js} +1 -1
  37. package/client/dist/assets/{hls-Boje3IOE.js → hls-Do_n10_Y.js} +1 -1
  38. package/client/dist/assets/{index-BXwhFWB_.js → index-B5SLDCAi.js} +2 -2
  39. package/client/dist/assets/{useAnimeInfoData-DJ7A4B4T.js → useAnimeInfoData-DU9X90no.js} +1 -1
  40. package/client/dist/assets/{useAsmr-DIwIsJXF.js → useAsmr-D6cSjbvt.js} +1 -1
  41. package/client/dist/assets/{useAsmrPopup-e4zNN9ig.js → useAsmrPopup-DK1Vx-HV.js} +1 -1
  42. package/client/dist/assets/{useMangaLibrary-C9Lci5N4.js → useMangaLibrary-DcxPn0RM.js} +1 -1
  43. package/client/dist/assets/{useMangaPopup-B8nnpvyi.js → useMangaPopup-BLwvRZn0.js} +1 -1
  44. package/client/dist/assets/{useProviders-B5Qr4I1y.js → useProviders-D3L1Chqc.js} +1 -1
  45. package/client/dist/assets/{useTv-Dm8MCYlL.js → useTv-B546u-Rx.js} +1 -1
  46. package/client/dist/assets/{useTvLibrary-B7jEk2Q7.js → useTvLibrary-C2rPeCVT.js} +1 -1
  47. package/client/dist/index.html +1 -1
  48. package/package.json +6 -2
  49. package/server/package.json +1 -1
@@ -1 +1 @@
1
- import{a as ie,d as N,h as re,u as e}from"./vendor-core-8R2fFbyN.js";import{I as h}from"./vendor-icons-CDMuNDeL.js";import{P as E,S as de}from"./SkeletonGrid-CLEPY9nP.js";import{E as oe}from"./ErrorMessage-z4f4WGgP.js";import{x as me,y as he,M as C,B as q}from"./index-BXwhFWB_.js";import{s as l}from"./Watchlist.module-XGtVQr1d.js";function fe({headerTitle:H,headerSubtitle:O,filters:U,filterBy:r,filterBasePath:V,continueFilter:W,statusOptions:$,entries:d,total:o,isLoading:S,error:A,page:M,pageSize:u,onPageChange:x,emptyTitle:Y,emptyFilteredText:j,emptyAllText:F,browseLabel:J,browseTarget:Q,removeListLabel:I,listNoun:f,skipConfirmKey:w,onBulkStatus:X,onBulkRemove:B,onStatusChange:Z,onRemoveItem:R,renderCard:_,modals:K}){const z=ie(),[g,P]=N(!1),[t,i]=N(new Set),[n,p]=N(null),[T,b]=N(!1),{data:y}=me(w),L=he();re(()=>{i(new Set),P(!1)},[r]);const m=r===W,G=String(y)==="true"||String(y)==="1",ee=()=>{P(a=>(a&&i(new Set),!a))},ae=a=>{i(s=>{const c=new Set(s);return c.has(a)?c.delete(a):c.add(a),c})},v=d.map(a=>a.libId),k=v.length>0&&v.every(a=>t.has(a)),le=()=>{i(a=>{const s=new Set(a);if(k)for(const c of v)s.delete(c);else for(const c of v)s.add(c);return s})},te=a=>{t.size!==0&&(X([...t],a),i(new Set))},se=()=>{t.size!==0&&(m||G?(B([...t]),i(new Set)):p({ids:[...t]}))},ne=a=>{m||G?R(a.libId):p({ids:[a.libId],title:a.title})},ce=()=>{n&&(T&&L.mutate({key:w,value:!0}),n.ids.length===1?R(n.ids[0]):B(n.ids),i(new Set),p(null),b(!1))},D=()=>{p(null),b(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:H}),e("p",{className:l.subtitle,children:O})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:U.map(a=>e("button",{className:`${l.filterBtn} ${r===a?l.active:""}`,onClick:()=>z(`${V}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[r,e("span",{className:l.itemCount,children:["(",o," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:ee,children:[e(h,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),o>0&&e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:x,isLoading:S})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:le,children:[e("span",{className:`${l.selectAllBox} ${k?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:k?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[t.size," selected"]}),e("div",{className:l.manageSpacer}),!m&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&te(a.currentTarget.value)},disabled:t.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:t.size===0,children:[e(h,{name:"trash",size:13}),e("span",{children:m?"Reset Selected":"Remove Selected"})]})]}),S?e(de,{}):A?e(oe,{message:A.message}):d.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:Y}),e("p",{className:l.emptyText,children:r!=="All"?j:F}),e("button",{className:l.emptyBtn,onClick:()=>z(Q),children:[e(h,{name:"search",size:14}),e("span",{children:J})]})]}):e("div",{className:l.grid,children:d.map(a=>e("div",{className:`${l.itemWrapper} ${t.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ae(a.libId),title:t.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:t.has(a.libId)?e(h,{name:"check",size:12}):null})}),_(a),!m&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:s=>Z(a.libId,s.currentTarget.value),children:$.map(s=>e("option",{value:s,children:s},s))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:I,"aria-label":I,children:e(h,{name:"trash",size:12})})]})]},a.key))}),o>0&&e("div",{className:l.bottomPagination,children:e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:x,isLoading:S,variant:"labeled"})}),K,e(C,{isOpen:!!n,onClose:D,title:`Remove from ${f}`,children:[e(C.Body,{children:[e("p",{children:n&&n.ids.length===1?`Are you sure you want to remove "${n.title}" from your ${f}?`:`Are you sure you want to remove ${n?.ids.length??0} selected items from your ${f}?`}),e("label",{children:[e("input",{type:"checkbox",checked:T,onChange:a=>b(a.target.checked)}),"Don't ask again"]})]}),e(C.Actions,{children:[e(q,{variant:"secondary",onClick:D,children:"No"}),e(q,{variant:"danger",onClick:ce,children:"Yes"})]})]})]})}export{fe as L};
1
+ import{a as ie,d as N,h as re,u as e}from"./vendor-core-8R2fFbyN.js";import{I as h}from"./vendor-icons-CDMuNDeL.js";import{P as E,S as de}from"./SkeletonGrid-BJyZkg_K.js";import{E as oe}from"./ErrorMessage-z4f4WGgP.js";import{x as me,y as he,M as C,B as q}from"./index-B5SLDCAi.js";import{s as l}from"./Watchlist.module-XGtVQr1d.js";function fe({headerTitle:H,headerSubtitle:O,filters:U,filterBy:r,filterBasePath:V,continueFilter:W,statusOptions:$,entries:d,total:o,isLoading:S,error:A,page:M,pageSize:u,onPageChange:x,emptyTitle:Y,emptyFilteredText:j,emptyAllText:F,browseLabel:J,browseTarget:Q,removeListLabel:I,listNoun:f,skipConfirmKey:w,onBulkStatus:X,onBulkRemove:B,onStatusChange:Z,onRemoveItem:R,renderCard:_,modals:K}){const z=ie(),[g,P]=N(!1),[t,i]=N(new Set),[n,p]=N(null),[T,b]=N(!1),{data:y}=me(w),L=he();re(()=>{i(new Set),P(!1)},[r]);const m=r===W,G=String(y)==="true"||String(y)==="1",ee=()=>{P(a=>(a&&i(new Set),!a))},ae=a=>{i(s=>{const c=new Set(s);return c.has(a)?c.delete(a):c.add(a),c})},v=d.map(a=>a.libId),k=v.length>0&&v.every(a=>t.has(a)),le=()=>{i(a=>{const s=new Set(a);if(k)for(const c of v)s.delete(c);else for(const c of v)s.add(c);return s})},te=a=>{t.size!==0&&(X([...t],a),i(new Set))},se=()=>{t.size!==0&&(m||G?(B([...t]),i(new Set)):p({ids:[...t]}))},ne=a=>{m||G?R(a.libId):p({ids:[a.libId],title:a.title})},ce=()=>{n&&(T&&L.mutate({key:w,value:!0}),n.ids.length===1?R(n.ids[0]):B(n.ids),i(new Set),p(null),b(!1))},D=()=>{p(null),b(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:H}),e("p",{className:l.subtitle,children:O})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:U.map(a=>e("button",{className:`${l.filterBtn} ${r===a?l.active:""}`,onClick:()=>z(`${V}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[r,e("span",{className:l.itemCount,children:["(",o," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:ee,children:[e(h,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),o>0&&e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:x,isLoading:S})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:le,children:[e("span",{className:`${l.selectAllBox} ${k?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:k?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[t.size," selected"]}),e("div",{className:l.manageSpacer}),!m&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&te(a.currentTarget.value)},disabled:t.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:t.size===0,children:[e(h,{name:"trash",size:13}),e("span",{children:m?"Reset Selected":"Remove Selected"})]})]}),S?e(de,{}):A?e(oe,{message:A.message}):d.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:Y}),e("p",{className:l.emptyText,children:r!=="All"?j:F}),e("button",{className:l.emptyBtn,onClick:()=>z(Q),children:[e(h,{name:"search",size:14}),e("span",{children:J})]})]}):e("div",{className:l.grid,children:d.map(a=>e("div",{className:`${l.itemWrapper} ${t.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ae(a.libId),title:t.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:t.has(a.libId)?e(h,{name:"check",size:12}):null})}),_(a),!m&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:s=>Z(a.libId,s.currentTarget.value),children:$.map(s=>e("option",{value:s,children:s},s))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:I,"aria-label":I,children:e(h,{name:"trash",size:12})})]})]},a.key))}),o>0&&e("div",{className:l.bottomPagination,children:e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:x,isLoading:S,variant:"labeled"})}),K,e(C,{isOpen:!!n,onClose:D,title:`Remove from ${f}`,children:[e(C.Body,{children:[e("p",{children:n&&n.ids.length===1?`Are you sure you want to remove "${n.title}" from your ${f}?`:`Are you sure you want to remove ${n?.ids.length??0} selected items from your ${f}?`}),e("label",{children:[e("input",{type:"checkbox",checked:T,onChange:a=>b(a.target.checked)}),"Don't ask again"]})]}),e(C.Actions,{children:[e(q,{variant:"secondary",onClick:D,children:"No"}),e(q,{variant:"danger",onClick:ce,children:"Yes"})]})]})]})}export{fe as L};
@@ -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-B5584Cq9.js";import{L as N}from"./LibraryListPage-HzuDavbb.js";import{u as _,A as q}from"./useAsmrPopup-e4zNN9ig.js";import{A as z}from"./AsmrResetProgressModal-CKYm-8cp.js";import{e as h}from"./index-BXwhFWB_.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-DIwIsJXF.js";import"./vendor-ui-CUDCvRS_.js";import"./vendor-icons-CDMuNDeL.js";import"./useIsMobile-Dm_b6Ob3.js";import"./SkeletonGrid-CLEPY9nP.js";import"./ErrorMessage-z4f4WGgP.js";import"./Watchlist.module-XGtVQr1d.js";import"./Asmr.module-ChUXDZKx.js";import"./ResetProgressModal-CcStlbhP.js";import"./vendor-query-BUTye89G.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({ids:t}):S.mutate({ids:t})},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate({id: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
+ 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-DzA336CA.js";import{L as N}from"./LibraryListPage-B_r51cRi.js";import{u as _,A as q}from"./useAsmrPopup-DK1Vx-HV.js";import{A as z}from"./AsmrResetProgressModal-C9R7HlNa.js";import{e as h}from"./index-B5SLDCAi.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-D6cSjbvt.js";import"./vendor-ui-CUDCvRS_.js";import"./vendor-icons-CDMuNDeL.js";import"./useIsMobile-Dm_b6Ob3.js";import"./SkeletonGrid-BJyZkg_K.js";import"./ErrorMessage-z4f4WGgP.js";import"./Watchlist.module-XGtVQr1d.js";import"./Asmr.module-ChUXDZKx.js";import"./ResetProgressModal-CByRM1Fh.js";import"./vendor-query-BUTye89G.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({ids:t}):S.mutate({ids:t})},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate({id: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,R as ie}from"./index-BXwhFWB_.js";import{E as ce}from"./ErrorMessage-z4f4WGgP.js";import{M as de}from"./MediaCard-B5584Cq9.js";import{u as ue,M as ge}from"./useMangaPopup-B8nnpvyi.js";import{f as pe,u as he,m as D,i as ve,b as me,c as be}from"./useMangaLibrary-C9Lci5N4.js";import{u as fe}from"./useProviders-B5Qr4I1y.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BUTye89G.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:W}=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 X=e=>{e.preventDefault(),ie(),o({q:k},!0)},Q=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:X,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:Q})]})]}),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:W}),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};
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,R as ie}from"./index-B5SLDCAi.js";import{E as ce}from"./ErrorMessage-z4f4WGgP.js";import{M as de}from"./MediaCard-DzA336CA.js";import{u as ue,M as ge}from"./useMangaPopup-BLwvRZn0.js";import{f as pe,u as he,m as D,i as ve,b as me,c as be}from"./useMangaLibrary-DcxPn0RM.js";import{u as fe}from"./useProviders-D3L1Chqc.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BUTye89G.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:W}=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 X=e=>{e.preventDefault(),ie(),o({q:k},!0)},Q=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:X,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:Q})]})]}),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:W}),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};
@@ -1 +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-BXwhFWB_.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-C9Lci5N4.js";import{s as r}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BUTye89G.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};
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-B5SLDCAi.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-DcxPn0RM.js";import{s as r}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BUTye89G.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};
@@ -1 +1 @@
1
- import{d as F,A as I,q as Z,h as u,u as e,S as J,n as ce,o as le,a as de,T as ue}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 he}from"./vendor-query-BUTye89G.js";import{t as me,v as pe,m as fe,k as ve,r as be,n as Ne,w as we,q as ye,s as Ce}from"./useMangaLibrary-C9Lci5N4.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import{d as Ie,t as G}from"./index-BXwhFWB_.js";const ee="mangaReadMode",te="mangaFitMode";function Se(){try{return localStorage.getItem(ee)==="page"?"page":"strip"}catch{return"strip"}}function $e(){try{return localStorage.getItem(te)==="height"?"height":"width"}catch{return"width"}}const ke=({provider:d,mangaTitle:h,chapter:p,chapters:b,onBack:N,onOpenChapter:v,initialPage:l=0,onProgress:D,savedPage:$=0})=>{const[c,U]=F(Se),[i,_]=F($e),[g,M]=F(0),[T,m]=F(new Set),[w,S]=F(0),E=I(null),B=I([]),z=he(),{data:V,isLoading:k,isError:L}=me(d,p.id),a=V?.pages??[],K=a.map(n=>pe(d,n)),y=I(0),Q=I(0),P=I(!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,C=s>=0?b.slice(s+1).find(n=>!n.externalUrl)??null:null,R=Z(n=>{P.current=!0,M(r=>{const f=r+n;return f<0?(o&&v(o),0):f>=a.length?(C&&v(C),r):f})},[a.length,o,C,v]);u(()=>{P.current=!1,y.current=Math.max(0,l),M(Math.max(0,l)),m(new Set),B.current=[],l<=0&&window.scrollTo(0,0)},[p.id,l]);const H=I(D);H.current=D;const X=I("");u(()=>{y.current=g,a.length!==0&&H.current?.(Math.min(g+1,a.length),a.length)},[g,a.length]),u(()=>{l<=0||P.current||y.current===0&&(P.current=!1,y.current=l,M(l))},[l]),u(()=>{if(c!=="strip"||a.length===0||l<=0)return;const n=`${p.id}:${l}`;if(X.current===n)return;X.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]),u(()=>{document.title=`${h} Ch. ${p.number} - dango`},[h,p.number]),u(()=>{try{localStorage.setItem(ee,c)}catch{}},[c]),u(()=>{try{localStorage.setItem(te,i)}catch{}},[i]),u(()=>{c==="page"&&window.scrollTo(0,0)},[c]),u(()=>{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]),u(()=>{if(c!=="strip"||a.length===0)return;const n=new IntersectionObserver(r=>{for(const f of r)if(f.isIntersecting){const W=Number(f.target.dataset.pageIndex);Number.isNaN(W)||(W!==y.current&&(P.current=!0),M(W))}},{rootMargin:"-45% 0px -45% 0px",threshold:0});return B.current.forEach(r=>r&&n.observe(r)),()=>n.disconnect()},[c,a.length,V]);const ne=n=>{E.current=n.touches[0].clientX},ae=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)},q=n=>{n&&v(n)},O=n=>m(r=>{if(r.has(n))return r;const f=new Set(r);return f.add(n),f}),re=n=>{m(r=>{const f=new Set(r);return f.delete(n),f}),S(r=>r+1)},se=()=>{m(new Set),S(n=>n+1),z.invalidateQueries({queryKey:["mangaPages",d,p.id]})},ie=a.length>0&&T.size>=a.length,Y=n=>w>0?`${n}&n=${w}`: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:()=>re(n),children:[e(x,{name:"sync-alt",size:12})," Retry"]})]}),A=i==="height",oe=$>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(g+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:()=>q(o),"aria-label":"Previous chapter",children:e(x,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!C,onClick:()=>q(C),"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."}):ie?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:se,children:[e(x,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${A?t.readerPagesTall:""}`,children:K.map((n,r)=>e("div",{ref:f=>{B.current[r]=f},"data-page-index":r,className:t.readerPageWrap,children:[r===oe&&e("div",{className:t.saveMarker,role:"note","aria-label":"Saved reading position",children:[e(x,{name:"bookmark",size:12}),e("span",{children:["Saved · p. ",$]})]}),T.has(r)?j(r):e("img",{className:t.readerPage,src:Y(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onError:()=>O(r)})]},`${r}-${a[r].slice(-32)}`))}):e(J,{children:[e("div",{className:`${t.pageView} ${A?t.pageViewTall:""}`,onTouchStart:ne,onTouchEnd:ae,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})})}),T.has(g)?j(g):e("img",{className:t.pageImage,src:Y(K[g]),alt:`Page ${g+1} of ${a.length}`,decoding:"async",draggable:!1,onError:()=>O(g)},`${g}-${a[g].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:g<=0,onClick:()=>R(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[g+1," / ",a.length]}),e("button",{className:t.pageBtn,disabled:g>=a.length-1,onClick:()=>R(1),children:"Next page"})]})]}),(o||C)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!o,onClick:()=>q(o),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!C,onClick:()=>q(C),children:"Next chapter"})]})]})},Pe=800,Re=5e3;function Ue(){const{provider:d="",id:h=""}=ce(),[p]=le(),b=de(),N=p.get("chapter")||"",v=p.get("rating")||"safe",l=typeof localStorage<"u"&&localStorage.getItem("agreedToViewMature")==="true",D=l?v:"safe",$=d&&h?fe(d,h):"",c=d.toLowerCase()==="anilist";u(()=>{c&&h&&b(`/manga/anilist/${encodeURIComponent(h)}`,{replace:!0})},[c,h,b]);const U=ve(!c&&d?d:null,!c&&h?h:null,D,l),i=U.data,{titlePreference:_}=Ie(),g=i?be(i,_):"Manga",M=Ne($||void 0),T=we(),m=i&&N?i.chapters.find(s=>s.id===N)??null:null,w=ye(N),S=w!=null&&i?Ce(i.chapters,w):null;u(()=>{if(w!=null&&S&&S.id!==N){const s=new URLSearchParams;s.set("chapter",S.id),l&&v!=="safe"&&s.set("rating",v),b(`/manga/${d}/${encodeURIComponent(h)}/read?${s.toString()}`,{replace:!0})}},[w,S,N,l,v,d,h,b]);const E=w!=null&&!!i&&!!S,B=w!=null&&!!i&&!S,z=ue(()=>{const s=(M.data?.progress??[]).find(o=>o.chapterId===N);return s&&s.page>0?s.page:0},[M.data,N]),V=z>1?z-1:0,k=I(null),L=I(null),a=Z(()=>{k.current&&(clearTimeout(k.current),k.current=null);const s=L.current;L.current=null,s&&$&&T.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})},[$,T,i?.title,i?.cover,i?.altTitle,i?.contentRating,d]),K=Z((s,o)=>{m&&(L.current={chapterId:m.id,chapterNumber:m.number,page:s,pageCount:o},k.current&&clearTimeout(k.current),k.current=setTimeout(a,Pe))},[m,a]);u(()=>{a()},[N,a]),u(()=>()=>a(),[a]),u(()=>{const s=window.setInterval(()=>{L.current&&a()},Re);return()=>window.clearInterval(s)},[a]),u(()=>{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 y=I("");y.current||(y.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),u(()=>{if(!i||!m)return;const s=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{G.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${m.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:s,sessionId:y.current}).catch(()=>{}),G.discord.heartbeat.mutate({sessionId:y.current}).catch(()=>{})};o();const C=window.setInterval(o,6e4);return()=>window.clearInterval(C)},[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(J,{children:[e("button",{className:t.backBtn,onClick:P,children:"Back to title"}),e(ge,{message:B?`Chapter ${w} isn't available from ${d} for this title.`:"Failed to load this chapter. Please try again."})]}):e(ke,{provider:d,mangaTitle:g,chapter:m,chapters:i.chapters,onBack:P,onOpenChapter:Q,initialPage:V,onProgress:K,savedPage:z},m.id)})}export{Ue as default};
1
+ import{d as F,A as I,q as Z,h as u,u as e,S as J,n as ce,o as le,a as de,T as ue}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 he}from"./vendor-query-BUTye89G.js";import{t as me,v as pe,m as fe,k as ve,r as be,n as Ne,w as we,q as ye,s as Ce}from"./useMangaLibrary-DcxPn0RM.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import{d as Ie,t as G}from"./index-B5SLDCAi.js";const ee="mangaReadMode",te="mangaFitMode";function Se(){try{return localStorage.getItem(ee)==="page"?"page":"strip"}catch{return"strip"}}function $e(){try{return localStorage.getItem(te)==="height"?"height":"width"}catch{return"width"}}const ke=({provider:d,mangaTitle:h,chapter:p,chapters:b,onBack:N,onOpenChapter:v,initialPage:l=0,onProgress:D,savedPage:$=0})=>{const[c,U]=F(Se),[i,_]=F($e),[g,M]=F(0),[T,m]=F(new Set),[w,S]=F(0),E=I(null),B=I([]),z=he(),{data:V,isLoading:k,isError:L}=me(d,p.id),a=V?.pages??[],K=a.map(n=>pe(d,n)),y=I(0),Q=I(0),P=I(!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,C=s>=0?b.slice(s+1).find(n=>!n.externalUrl)??null:null,R=Z(n=>{P.current=!0,M(r=>{const f=r+n;return f<0?(o&&v(o),0):f>=a.length?(C&&v(C),r):f})},[a.length,o,C,v]);u(()=>{P.current=!1,y.current=Math.max(0,l),M(Math.max(0,l)),m(new Set),B.current=[],l<=0&&window.scrollTo(0,0)},[p.id,l]);const H=I(D);H.current=D;const X=I("");u(()=>{y.current=g,a.length!==0&&H.current?.(Math.min(g+1,a.length),a.length)},[g,a.length]),u(()=>{l<=0||P.current||y.current===0&&(P.current=!1,y.current=l,M(l))},[l]),u(()=>{if(c!=="strip"||a.length===0||l<=0)return;const n=`${p.id}:${l}`;if(X.current===n)return;X.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]),u(()=>{document.title=`${h} Ch. ${p.number} - dango`},[h,p.number]),u(()=>{try{localStorage.setItem(ee,c)}catch{}},[c]),u(()=>{try{localStorage.setItem(te,i)}catch{}},[i]),u(()=>{c==="page"&&window.scrollTo(0,0)},[c]),u(()=>{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]),u(()=>{if(c!=="strip"||a.length===0)return;const n=new IntersectionObserver(r=>{for(const f of r)if(f.isIntersecting){const W=Number(f.target.dataset.pageIndex);Number.isNaN(W)||(W!==y.current&&(P.current=!0),M(W))}},{rootMargin:"-45% 0px -45% 0px",threshold:0});return B.current.forEach(r=>r&&n.observe(r)),()=>n.disconnect()},[c,a.length,V]);const ne=n=>{E.current=n.touches[0].clientX},ae=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)},q=n=>{n&&v(n)},O=n=>m(r=>{if(r.has(n))return r;const f=new Set(r);return f.add(n),f}),re=n=>{m(r=>{const f=new Set(r);return f.delete(n),f}),S(r=>r+1)},se=()=>{m(new Set),S(n=>n+1),z.invalidateQueries({queryKey:["mangaPages",d,p.id]})},ie=a.length>0&&T.size>=a.length,Y=n=>w>0?`${n}&n=${w}`: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:()=>re(n),children:[e(x,{name:"sync-alt",size:12})," Retry"]})]}),A=i==="height",oe=$>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(g+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:()=>q(o),"aria-label":"Previous chapter",children:e(x,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!C,onClick:()=>q(C),"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."}):ie?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:se,children:[e(x,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${A?t.readerPagesTall:""}`,children:K.map((n,r)=>e("div",{ref:f=>{B.current[r]=f},"data-page-index":r,className:t.readerPageWrap,children:[r===oe&&e("div",{className:t.saveMarker,role:"note","aria-label":"Saved reading position",children:[e(x,{name:"bookmark",size:12}),e("span",{children:["Saved · p. ",$]})]}),T.has(r)?j(r):e("img",{className:t.readerPage,src:Y(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onError:()=>O(r)})]},`${r}-${a[r].slice(-32)}`))}):e(J,{children:[e("div",{className:`${t.pageView} ${A?t.pageViewTall:""}`,onTouchStart:ne,onTouchEnd:ae,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})})}),T.has(g)?j(g):e("img",{className:t.pageImage,src:Y(K[g]),alt:`Page ${g+1} of ${a.length}`,decoding:"async",draggable:!1,onError:()=>O(g)},`${g}-${a[g].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:g<=0,onClick:()=>R(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[g+1," / ",a.length]}),e("button",{className:t.pageBtn,disabled:g>=a.length-1,onClick:()=>R(1),children:"Next page"})]})]}),(o||C)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!o,onClick:()=>q(o),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!C,onClick:()=>q(C),children:"Next chapter"})]})]})},Pe=800,Re=5e3;function Ue(){const{provider:d="",id:h=""}=ce(),[p]=le(),b=de(),N=p.get("chapter")||"",v=p.get("rating")||"safe",l=typeof localStorage<"u"&&localStorage.getItem("agreedToViewMature")==="true",D=l?v:"safe",$=d&&h?fe(d,h):"",c=d.toLowerCase()==="anilist";u(()=>{c&&h&&b(`/manga/anilist/${encodeURIComponent(h)}`,{replace:!0})},[c,h,b]);const U=ve(!c&&d?d:null,!c&&h?h:null,D,l),i=U.data,{titlePreference:_}=Ie(),g=i?be(i,_):"Manga",M=Ne($||void 0),T=we(),m=i&&N?i.chapters.find(s=>s.id===N)??null:null,w=ye(N),S=w!=null&&i?Ce(i.chapters,w):null;u(()=>{if(w!=null&&S&&S.id!==N){const s=new URLSearchParams;s.set("chapter",S.id),l&&v!=="safe"&&s.set("rating",v),b(`/manga/${d}/${encodeURIComponent(h)}/read?${s.toString()}`,{replace:!0})}},[w,S,N,l,v,d,h,b]);const E=w!=null&&!!i&&!!S,B=w!=null&&!!i&&!S,z=ue(()=>{const s=(M.data?.progress??[]).find(o=>o.chapterId===N);return s&&s.page>0?s.page:0},[M.data,N]),V=z>1?z-1:0,k=I(null),L=I(null),a=Z(()=>{k.current&&(clearTimeout(k.current),k.current=null);const s=L.current;L.current=null,s&&$&&T.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})},[$,T,i?.title,i?.cover,i?.altTitle,i?.contentRating,d]),K=Z((s,o)=>{m&&(L.current={chapterId:m.id,chapterNumber:m.number,page:s,pageCount:o},k.current&&clearTimeout(k.current),k.current=setTimeout(a,Pe))},[m,a]);u(()=>{a()},[N,a]),u(()=>()=>a(),[a]),u(()=>{const s=window.setInterval(()=>{L.current&&a()},Re);return()=>window.clearInterval(s)},[a]),u(()=>{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 y=I("");y.current||(y.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),u(()=>{if(!i||!m)return;const s=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{G.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${m.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:s,sessionId:y.current}).catch(()=>{}),G.discord.heartbeat.mutate({sessionId:y.current}).catch(()=>{})};o();const C=window.setInterval(o,6e4);return()=>window.clearInterval(C)},[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(J,{children:[e("button",{className:t.backBtn,onClick:P,children:"Back to title"}),e(ge,{message:B?`Chapter ${w} isn't available from ${d} for this title.`:"Failed to load this chapter. Please try again."})]}):e(ke,{provider:d,mangaTitle:g,chapter:m,chapters:i.chapters,onBack:P,onOpenChapter:Q,initialPage:V,onProgress:K,savedPage:z},m.id)})}export{Ue as default};
@@ -1 +1 @@
1
- import{d as n,u as l}from"./vendor-core-8R2fFbyN.js";import{R as i}from"./ResetProgressModal-CcStlbhP.js";import{B as f,o as R}from"./useMangaLibrary-C9Lci5N4.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
+ import{d as n,u as l}from"./vendor-core-8R2fFbyN.js";import{R as i}from"./ResetProgressModal-CByRM1Fh.js";import{B as f,o as R}from"./useMangaLibrary-DcxPn0RM.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 we,o as ke,h as de,d as l,T as ue,S as me}from"./vendor-core-8R2fFbyN.js";import{b as he}from"./vendor-query-BUTye89G.js";import{B as O,M as $e,g as qe,R as Fe,t as x,z as xe}from"./index-BXwhFWB_.js";import{I as ge}from"./vendor-icons-CDMuNDeL.js";import{S as Ue,P as pe}from"./SkeletonGrid-CLEPY9nP.js";import{A as Ye}from"./AnimeCard-CJy1SXH3.js";import{E as Ve}from"./ErrorMessage-z4f4WGgP.js";import{u as We}from"./useMatureConsent-CT7-KfzG.js";import{u as je}from"./useProviders-B5Qr4I1y.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-DJ7A4B4T.js";import"./QueueOptionsButton-Ba0dg_82.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-B5584Cq9.js";import"./useIsMobile-Dm_b6Ob3.js";const He=({isOpen:u,onClose:c,onGrant:s})=>t($e,{isOpen:u,title:"Content Warning",onClose:c,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(O,{variant:"secondary",onClick:c,children:"Go Back"}),t(O,{onClick:s,children:"I'm 18+, Continue"})]})]})}),Ke="_shrinkSelect_130sm_1",Qe="_tightGrid_130sm_7",Q={shrinkSelect:Ke,tightGrid:Qe},ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],Ze=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Je=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Xe=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],et={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},tt=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],ve=u=>u.split("-").map(c=>c&&c[0].toUpperCase()+c.slice(1)).join(" "),at=new Set(["page","limit","year","minScore","minEpisodes"]),rt=new Set(["provider","query","page","limit","type","status","season","year","country","genres","genre","excludeGenres","sortBy","order","studio","blacklist","minScore","minEpisodes"]);function st(u){const c=new URLSearchParams(u),s={};for(const[y,b]of c.entries())rt.has(y)&&(at.has(y)?s[y]=Number(b)||0:s[y]=b);return s}function Ct(){const u=we(),c=qe(),[s,y]=ke(),{hasConsent:b,grant:fe}=We();de(()=>{document.title="Mature - dango"},[]);const[i,Se]=l(s.get("provider")||"anilist"),[C,z]=l(s.get("query")||""),[T,U]=l(s.get("query")||""),[I,g]=l(parseInt(s.get("page")||"1",10)||1),[_,Y]=l(()=>{const e=s.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[M,Z]=l(s.get("sortBy")||""),[N,ye]=l(s.get("status")||""),[D,be]=l(s.get("season")||"ALL"),[G,Ce]=l(s.get("year")||"ALL"),[p,B]=l(s.get("genre")||s.get("genres")||""),[V,Ne]=l(s.get("order")||"recent"),[W,Ae]=l(s.get("studio")||""),[w,Ee]=l(s.get("studio")||""),[J,X]=l([]),[j,Pe]=l(!1),[Re,ee]=l(null),{options:te}=je(),ae=ue(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=ue(()=>[...ze,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:k}=he({...c.data.matureFilters.queryOptions(),enabled:b,staleTime:1/0}),d=i==="anilist"||i==="mal",H=d?void 0:k?.providers?.[i],P=H?.browse,R=H?.genres??[],A=H?.orders??[],se=A.length>0&&!A.includes(V)?A[0]:V,$=!d&&(P?.genre===!0||R.length>0||J.length>0),v=!d&&(P?.order===!0||A.length>0),E=!d&&P?.studio===!0,ie=!d&&P?.sort===!0,q=d?14:P?.pageSize??14,f=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const n=k?.providers?.[e.provider]?.browse,m=k?.providers?.[e.provider]?.orders??[],o=m.length>0&&!m.includes(e.remoteOrder)?m[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!==(m[0]??"recent")&&r.set("order",o),(!n||n.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}y(r,{replace:!0})},S=(e={})=>({provider:i,query:T,page:I,sort:_,remoteSort:M,status:N,season:D,year:G,genre:p,remoteOrder:V,studio:w,...e}),Le=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(I)),e.set("limit",String(q)),i==="anilist"&&(e.set("sortBy",_),N&&e.set("status",N),D!=="ALL"&&e.set("season",D),G!=="ALL"&&e.set("year",G)),i==="mal"?(e.set("sortBy",_),N&&e.set("status",N)):d||($&&p&&e.set("genre",p),v&&e.set("order",se),ie&&M&&e.set("sortBy",M),E&&w.trim()&&e.set("studio",w.trim())),e.toString()})(),{data:h,isLoading:Oe,isError:Te,error:Ie}=he({...c.data.matureSearch.queryOptions(st(Le)),enabled:b});de(()=>{const e=h?.genres;!d&&R.length===0&&e&&e.length>0&&X(r=>{const n=new Set(r.map(o=>o.slug)),m=[...r];for(const o of e)o.slug&&!n.has(o.slug)&&(n.add(o.slug),m.push(o));return m.length===r.length?r:m})},[h,i,d,R.length]);const F=(h?.data||[]).map(e=>({...e,isAdult:!0})),le=h?.hasMore??!1,L=()=>{Fe(),g(1);let e=p;!d&&!v&&C.trim()&&(e=""),B(e),E&&Ee(W),U(C),f(S({query:C,page:1,genre:e,studio:E?W:w}))},_e=e=>{Se(e),g(1),Z(""),B(""),X([]),e==="mal"?Y("SCORE_DESC"):e==="anilist"&&Y("POPULARITY_DESC"),U(C),f(S({provider:e,page:1,remoteSort:"",genre:"",query:C}))},Me=e=>{B(e),g(1),e&&(z(""),U("")),f(S({genre:e,page:1,query:e?"":T}))},ne=e=>{g(e),f(S({page:e})),window.scrollTo({top:0,behavior:"smooth"})},De=async(e,r)=>{const n=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(n)&&(e.preventDefault(),e.stopPropagation(),!Re)){ee(n);try{if(i!=="anilist"){let o=!1;try{o=(await x.data.anilistStatus.query())?.available===!0}catch{o=!1}if(o){const ce=await x.data.matureResolve.query({title:r.name});u(`/anime/${ce.id}`);return}const oe=await x.data.matureAllocate.mutate({provider:i,nativeId:n,title:r.name,thumbnail:r.thumbnail});if(!oe?.id)throw new Error("Allocate failed");u(`/anime/${oe.id}`);return}const m=await x.data.matureResolve.query({title:r.name});u(`/anime/${m.id}`)}catch{xe.error("Could not match this title on AniList")}finally{ee(null)}}},K=new Date().getFullYear(),Ge=[{value:"ALL",label:"All Years"},...Array.from({length:K-1980+1},(e,r)=>({value:String(K-r),label:String(K-r)}))],Be=R.length>0?R.map(e=>({value:e,label:ve(e)})):J.map(e=>({value:e.slug,label:e.name}));return b?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(ge,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:C,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>_e(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:L,className:a.searchBtn,children:"Search"}),d&&t("button",{onClick:()=>Pe(!j),className:`${a.filterToggleBtn} ${j?a.active:""}`,children:[t(ge,{name:"filter"})," Filters"]}),ie&&t("select",{value:M,onChange:e=>{Z(e.target.value),g(1),f(S({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${j?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:_,onChange:e=>Y(e.currentTarget.value),children:Ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:N,onChange:e=>ye(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(me,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:D,onChange:e=>be(e.currentTarget.value),children:tt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:G,onChange:e=>Ce(e.currentTarget.value),children:Ge.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]}),!d&&!!k&&($||v||E)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${Q.tightGrid}`,children:[v&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:se,onChange:e=>{Ne(e.target.value),g(1),f(S({remoteOrder:e.target.value,page:1}))},children:(A.length>0?A:["recent"]).map(e=>t("option",{value:e,children:et[e]||e},e))})]}),$&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:p,onChange:e=>{v?(B(e.target.value),g(1),f(S({genre:e.target.value,page:1}))):Me(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),Be.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),E&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:W,onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]})]}),p&&$&&!v&&t("p",{className:a.pageSubtitle,children:["Browsing the ",ve(p)," genre — search text is ignored while a genre is selected."]}),(v||E)&&t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]})]}),Te&&t(Ve,{message:Ie?.message||"Search failed"}),Oe?t(Ue,{count:q}):F.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(me,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[h?.total??F.length," result",(h?.total??F.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:F.map(e=>t("div",{onClickCapture:r=>De(r,e),children:t(Ye,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})})]})]}):t(He,{isOpen:!0,onClose:()=>u("/"),onGrant:fe})}export{Ct as default};
1
+ import{u as t,a as we,o as ke,h as de,d as l,T as ue,S as me}from"./vendor-core-8R2fFbyN.js";import{b as he}from"./vendor-query-BUTye89G.js";import{B as O,M as $e,g as qe,R as Fe,t as x,z as xe}from"./index-B5SLDCAi.js";import{I as ge}from"./vendor-icons-CDMuNDeL.js";import{S as Ue,P as pe}from"./SkeletonGrid-BJyZkg_K.js";import{A as Ye}from"./AnimeCard-B0oMgXBm.js";import{E as Ve}from"./ErrorMessage-z4f4WGgP.js";import{u as We}from"./useMatureConsent-CT7-KfzG.js";import{u as je}from"./useProviders-D3L1Chqc.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-DU9X90no.js";import"./QueueOptionsButton-1M7MdKzM.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-DzA336CA.js";import"./useIsMobile-Dm_b6Ob3.js";const He=({isOpen:u,onClose:c,onGrant:s})=>t($e,{isOpen:u,title:"Content Warning",onClose:c,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(O,{variant:"secondary",onClick:c,children:"Go Back"}),t(O,{onClick:s,children:"I'm 18+, Continue"})]})]})}),Ke="_shrinkSelect_130sm_1",Qe="_tightGrid_130sm_7",Q={shrinkSelect:Ke,tightGrid:Qe},ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],Ze=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Je=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Xe=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],et={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},tt=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],ve=u=>u.split("-").map(c=>c&&c[0].toUpperCase()+c.slice(1)).join(" "),at=new Set(["page","limit","year","minScore","minEpisodes"]),rt=new Set(["provider","query","page","limit","type","status","season","year","country","genres","genre","excludeGenres","sortBy","order","studio","blacklist","minScore","minEpisodes"]);function st(u){const c=new URLSearchParams(u),s={};for(const[y,b]of c.entries())rt.has(y)&&(at.has(y)?s[y]=Number(b)||0:s[y]=b);return s}function Ct(){const u=we(),c=qe(),[s,y]=ke(),{hasConsent:b,grant:fe}=We();de(()=>{document.title="Mature - dango"},[]);const[i,Se]=l(s.get("provider")||"anilist"),[C,z]=l(s.get("query")||""),[T,U]=l(s.get("query")||""),[I,g]=l(parseInt(s.get("page")||"1",10)||1),[_,Y]=l(()=>{const e=s.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[M,Z]=l(s.get("sortBy")||""),[N,ye]=l(s.get("status")||""),[D,be]=l(s.get("season")||"ALL"),[G,Ce]=l(s.get("year")||"ALL"),[p,B]=l(s.get("genre")||s.get("genres")||""),[V,Ne]=l(s.get("order")||"recent"),[W,Ae]=l(s.get("studio")||""),[w,Ee]=l(s.get("studio")||""),[J,X]=l([]),[j,Pe]=l(!1),[Re,ee]=l(null),{options:te}=je(),ae=ue(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=ue(()=>[...ze,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:k}=he({...c.data.matureFilters.queryOptions(),enabled:b,staleTime:1/0}),d=i==="anilist"||i==="mal",H=d?void 0:k?.providers?.[i],P=H?.browse,R=H?.genres??[],A=H?.orders??[],se=A.length>0&&!A.includes(V)?A[0]:V,$=!d&&(P?.genre===!0||R.length>0||J.length>0),v=!d&&(P?.order===!0||A.length>0),E=!d&&P?.studio===!0,ie=!d&&P?.sort===!0,q=d?14:P?.pageSize??14,f=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const n=k?.providers?.[e.provider]?.browse,m=k?.providers?.[e.provider]?.orders??[],o=m.length>0&&!m.includes(e.remoteOrder)?m[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!==(m[0]??"recent")&&r.set("order",o),(!n||n.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}y(r,{replace:!0})},S=(e={})=>({provider:i,query:T,page:I,sort:_,remoteSort:M,status:N,season:D,year:G,genre:p,remoteOrder:V,studio:w,...e}),Le=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(I)),e.set("limit",String(q)),i==="anilist"&&(e.set("sortBy",_),N&&e.set("status",N),D!=="ALL"&&e.set("season",D),G!=="ALL"&&e.set("year",G)),i==="mal"?(e.set("sortBy",_),N&&e.set("status",N)):d||($&&p&&e.set("genre",p),v&&e.set("order",se),ie&&M&&e.set("sortBy",M),E&&w.trim()&&e.set("studio",w.trim())),e.toString()})(),{data:h,isLoading:Oe,isError:Te,error:Ie}=he({...c.data.matureSearch.queryOptions(st(Le)),enabled:b});de(()=>{const e=h?.genres;!d&&R.length===0&&e&&e.length>0&&X(r=>{const n=new Set(r.map(o=>o.slug)),m=[...r];for(const o of e)o.slug&&!n.has(o.slug)&&(n.add(o.slug),m.push(o));return m.length===r.length?r:m})},[h,i,d,R.length]);const F=(h?.data||[]).map(e=>({...e,isAdult:!0})),le=h?.hasMore??!1,L=()=>{Fe(),g(1);let e=p;!d&&!v&&C.trim()&&(e=""),B(e),E&&Ee(W),U(C),f(S({query:C,page:1,genre:e,studio:E?W:w}))},_e=e=>{Se(e),g(1),Z(""),B(""),X([]),e==="mal"?Y("SCORE_DESC"):e==="anilist"&&Y("POPULARITY_DESC"),U(C),f(S({provider:e,page:1,remoteSort:"",genre:"",query:C}))},Me=e=>{B(e),g(1),e&&(z(""),U("")),f(S({genre:e,page:1,query:e?"":T}))},ne=e=>{g(e),f(S({page:e})),window.scrollTo({top:0,behavior:"smooth"})},De=async(e,r)=>{const n=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(n)&&(e.preventDefault(),e.stopPropagation(),!Re)){ee(n);try{if(i!=="anilist"){let o=!1;try{o=(await x.data.anilistStatus.query())?.available===!0}catch{o=!1}if(o){const ce=await x.data.matureResolve.query({title:r.name});u(`/anime/${ce.id}`);return}const oe=await x.data.matureAllocate.mutate({provider:i,nativeId:n,title:r.name,thumbnail:r.thumbnail});if(!oe?.id)throw new Error("Allocate failed");u(`/anime/${oe.id}`);return}const m=await x.data.matureResolve.query({title:r.name});u(`/anime/${m.id}`)}catch{xe.error("Could not match this title on AniList")}finally{ee(null)}}},K=new Date().getFullYear(),Ge=[{value:"ALL",label:"All Years"},...Array.from({length:K-1980+1},(e,r)=>({value:String(K-r),label:String(K-r)}))],Be=R.length>0?R.map(e=>({value:e,label:ve(e)})):J.map(e=>({value:e.slug,label:e.name}));return b?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(ge,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:C,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>_e(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:L,className:a.searchBtn,children:"Search"}),d&&t("button",{onClick:()=>Pe(!j),className:`${a.filterToggleBtn} ${j?a.active:""}`,children:[t(ge,{name:"filter"})," Filters"]}),ie&&t("select",{value:M,onChange:e=>{Z(e.target.value),g(1),f(S({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${j?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:_,onChange:e=>Y(e.currentTarget.value),children:Ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:N,onChange:e=>ye(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(me,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:D,onChange:e=>be(e.currentTarget.value),children:tt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:G,onChange:e=>Ce(e.currentTarget.value),children:Ge.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]}),!d&&!!k&&($||v||E)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${Q.tightGrid}`,children:[v&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:se,onChange:e=>{Ne(e.target.value),g(1),f(S({remoteOrder:e.target.value,page:1}))},children:(A.length>0?A:["recent"]).map(e=>t("option",{value:e,children:et[e]||e},e))})]}),$&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:p,onChange:e=>{v?(B(e.target.value),g(1),f(S({genre:e.target.value,page:1}))):Me(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),Be.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),E&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:W,onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]})]}),p&&$&&!v&&t("p",{className:a.pageSubtitle,children:["Browsing the ",ve(p)," genre — search text is ignored while a genre is selected."]}),(v||E)&&t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]})]}),Te&&t(Ve,{message:Ie?.message||"Search failed"}),Oe?t(Ue,{count:q}):F.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(me,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[h?.total??F.length," result",(h?.total??F.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:F.map(e=>t("div",{onClickCapture:r=>De(r,e),children:t(Ye,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})})]})]}):t(He,{isOpen:!0,onClose:()=>u("/"),onGrant:fe})}export{Ct 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 Le,s as $e}from"./vendor-ui-CUDCvRS_.js";import{I as v}from"./vendor-icons-CDMuNDeL.js";import{t as ke,d as Oe,u as ze,a as De,f as Ue,M as Ve,B as Q}from"./index-BXwhFWB_.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",lt="_secondaryActions_7glox_184",ct="_watchlistBtn_7glox_189",it="_detailsBtn_7glox_190",dt="_active_7glox_216",ut="_loading_7glox_227",_t="_spinner_7glox_237",R={popupPortal:We,popupContent:Ye,popupBackdrop:je,mobile:Fe,header:Xe,title:qe,body:He,metaRow:Je,metaItem:Ke,scoreIcon:Qe,synopsis:Ze,details:et,detailItem:tt,genres:nt,genre:ot,footer:rt,primaryAction:st,watchBtn:at,secondaryActions:lt,watchlistBtn:ct,detailsBtn:it,active:dt,loading:ut,spinner:_t},cn=({anchorRect:t,onMouseEnter:a,onMouseLeave:l,onRequestClose:c,children:u})=>{const[i]=y(()=>window.matchMedia("(pointer: coarse)").matches),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Re({placement:"right-start",middleware:[Le({fallbackAxisSideDirection:"start"}),$e({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:()=>c?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:l,children:e("div",{className:R.popupContent,children:u})})]});return Ne(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[l,c]=y(a);return K(()=>{c(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return ke.data.showMeta.query({id:t}).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&c(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:l}}const mt="_cardWrapper_w7bu0_1",ft="_card_w7bu0_1",ht="_cardButton_w7bu0_35",bt="_hoverOverlay_w7bu0_60",Bt="_matureOverlay_w7bu0_81",wt="_posterContainer_w7bu0_91",vt="_horizontal_w7bu0_100",yt="_posterImg_w7bu0_104",Ct="_blurred_w7bu0_116",Mt="_flat_w7bu0_139",xt="_loaded_w7bu0_143",Tt="_posterGradient_w7bu0_147",Pt="_progressSection_w7bu0_167",Nt="_titleSection_w7bu0_174",Et="_title_w7bu0_174",St="_titleText_w7bu0_193",It="_badge_w7bu0_205",Rt="_typeBadge_w7bu0_216 _badge_w7bu0_205",At="_epBadge_w7bu0_225 _badge_w7bu0_205",Lt="_airTime_w7bu0_234",$t="_adultBadge_w7bu0_241 _badge_w7bu0_205",kt="_gated_w7bu0_254",Ot="_notAiredBadge_w7bu0_260 _badge_w7bu0_205",zt="_metaRow_w7bu0_275",Dt="_metaItem_w7bu0_286",Ut="_progressContainer_w7bu0_303",Vt="_progressBar_w7bu0_311",Gt="_timestamp_w7bu0_318",Wt="_removeBtn_w7bu0_323",Yt="_infoBtn_w7bu0_324",jt="_mobileBadges_w7bu0_375",Ft="_mobileBadgeBase_w7bu0_382",Xt="_mobileType_w7bu0_390 _mobileBadgeBase_w7bu0_382",qt="_mobileEp_w7bu0_397 _mobileBadgeBase_w7bu0_382",Ht="_vertical_w7bu0_489",Jt="_placeholder_w7bu0_504",Kt="_placeholderText_w7bu0_513",Qt="_lowEnd_w7bu0_520",n={cardWrapper:mt,card:ft,cardButton:ht,hoverOverlay:bt,matureOverlay:Bt,posterContainer:wt,horizontal:vt,posterImg:yt,blurred:Ct,flat:Mt,loaded:xt,posterGradient:Tt,progressSection:Pt,titleSection:Nt,title:Et,titleText:St,badge:It,typeBadge:Rt,epBadge:At,airTime:Lt,adultBadge:$t,gated:kt,notAiredBadge:Ot,metaRow:zt,metaItem:Dt,progressContainer:Ut,progressBar:Vt,timestamp:Gt,removeBtn:Wt,infoBtn:Yt,mobileBadges:jt,mobileBadgeBase:Ft,mobileType:Xt,mobileEp:qt,vertical:Ht,placeholder:Jt,placeholderText:Kt,lowEnd:Qt},Zt=500,Z=20,en=300;function tn(t){const a=x(null),l=x(null),c=x(!1),u=x({x:0,y:0}),i=x(null),r=d(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),w=d(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),b=d(s=>{a.current&&clearTimeout(a.current),a.current=setTimeout(s,en)},[]),_=d((s,p=!1)=>{c.current=p,t(s,p)},[t]),C=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,c.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),l.current=setTimeout(()=>{l.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!l.current)return;const p=Math.abs(s.clientX-u.current.x),m=Math.abs(s.clientY-u.current.y);(p>Z||m>Z)&&r()},[r]),g=d(()=>{r(),i.current=null},[r]),P=d((s,p)=>{s.preventDefault(),s.stopPropagation(),i.current==="touch"?l.current&&(clearTimeout(l.current),l.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!c.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>c.current?(c.current=!1,!0):!1,[]);return{longPressFiredRef:c,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown: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:l,progress:c,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),[L,V]=y(!1),[G,W]=y(null),Y=o=>{W(o),V(!0)},$=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose($)},[f,$]),j=f.clearPopupTimeout,se=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},ae=()=>{g&&k()},le=()=>{j()},ce=()=>{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&&!!c&&c.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=l==="book"?e(v,{name:"book",size:28}):l==="play"?e(v,{name:"play",size:28}):l==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),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),L&&j()},onMouseLeave:()=>{D(!1),P?.(!1),L&&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&&c&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${c.percent}%`}})}),e("div",{className:n.timestamp,children:c.label})]}),e("div",{className:n.titleSection,children:[m&&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&&L&&G?g(G,{close:$,onMouseEnter:le,onMouseLeave:ce}):null]})});export{dn as M,cn 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 Le,s as $e}from"./vendor-ui-CUDCvRS_.js";import{I as v}from"./vendor-icons-CDMuNDeL.js";import{t as ke,d as Oe,u as ze,a as De,f as Ue,M as Ve,B as Q}from"./index-B5SLDCAi.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",lt="_secondaryActions_7glox_184",ct="_watchlistBtn_7glox_189",it="_detailsBtn_7glox_190",dt="_active_7glox_216",ut="_loading_7glox_227",_t="_spinner_7glox_237",R={popupPortal:We,popupContent:Ye,popupBackdrop:je,mobile:Fe,header:Xe,title:qe,body:He,metaRow:Je,metaItem:Ke,scoreIcon:Qe,synopsis:Ze,details:et,detailItem:tt,genres:nt,genre:ot,footer:rt,primaryAction:st,watchBtn:at,secondaryActions:lt,watchlistBtn:ct,detailsBtn:it,active:dt,loading:ut,spinner:_t},cn=({anchorRect:t,onMouseEnter:a,onMouseLeave:l,onRequestClose:c,children:u})=>{const[i]=y(()=>window.matchMedia("(pointer: coarse)").matches),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Re({placement:"right-start",middleware:[Le({fallbackAxisSideDirection:"start"}),$e({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:()=>c?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:l,children:e("div",{className:R.popupContent,children:u})})]});return Ne(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[l,c]=y(a);return K(()=>{c(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return ke.data.showMeta.query({id:t}).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&c(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:l}}const mt="_cardWrapper_w7bu0_1",ft="_card_w7bu0_1",ht="_cardButton_w7bu0_35",bt="_hoverOverlay_w7bu0_60",Bt="_matureOverlay_w7bu0_81",wt="_posterContainer_w7bu0_91",vt="_horizontal_w7bu0_100",yt="_posterImg_w7bu0_104",Ct="_blurred_w7bu0_116",Mt="_flat_w7bu0_139",xt="_loaded_w7bu0_143",Tt="_posterGradient_w7bu0_147",Pt="_progressSection_w7bu0_167",Nt="_titleSection_w7bu0_174",Et="_title_w7bu0_174",St="_titleText_w7bu0_193",It="_badge_w7bu0_205",Rt="_typeBadge_w7bu0_216 _badge_w7bu0_205",At="_epBadge_w7bu0_225 _badge_w7bu0_205",Lt="_airTime_w7bu0_234",$t="_adultBadge_w7bu0_241 _badge_w7bu0_205",kt="_gated_w7bu0_254",Ot="_notAiredBadge_w7bu0_260 _badge_w7bu0_205",zt="_metaRow_w7bu0_275",Dt="_metaItem_w7bu0_286",Ut="_progressContainer_w7bu0_303",Vt="_progressBar_w7bu0_311",Gt="_timestamp_w7bu0_318",Wt="_removeBtn_w7bu0_323",Yt="_infoBtn_w7bu0_324",jt="_mobileBadges_w7bu0_375",Ft="_mobileBadgeBase_w7bu0_382",Xt="_mobileType_w7bu0_390 _mobileBadgeBase_w7bu0_382",qt="_mobileEp_w7bu0_397 _mobileBadgeBase_w7bu0_382",Ht="_vertical_w7bu0_489",Jt="_placeholder_w7bu0_504",Kt="_placeholderText_w7bu0_513",Qt="_lowEnd_w7bu0_520",n={cardWrapper:mt,card:ft,cardButton:ht,hoverOverlay:bt,matureOverlay:Bt,posterContainer:wt,horizontal:vt,posterImg:yt,blurred:Ct,flat:Mt,loaded:xt,posterGradient:Tt,progressSection:Pt,titleSection:Nt,title:Et,titleText:St,badge:It,typeBadge:Rt,epBadge:At,airTime:Lt,adultBadge:$t,gated:kt,notAiredBadge:Ot,metaRow:zt,metaItem:Dt,progressContainer:Ut,progressBar:Vt,timestamp:Gt,removeBtn:Wt,infoBtn:Yt,mobileBadges:jt,mobileBadgeBase:Ft,mobileType:Xt,mobileEp:qt,vertical:Ht,placeholder:Jt,placeholderText:Kt,lowEnd:Qt},Zt=500,Z=20,en=300;function tn(t){const a=x(null),l=x(null),c=x(!1),u=x({x:0,y:0}),i=x(null),r=d(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),w=d(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),b=d(s=>{a.current&&clearTimeout(a.current),a.current=setTimeout(s,en)},[]),_=d((s,p=!1)=>{c.current=p,t(s,p)},[t]),C=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,c.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),l.current=setTimeout(()=>{l.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!l.current)return;const p=Math.abs(s.clientX-u.current.x),m=Math.abs(s.clientY-u.current.y);(p>Z||m>Z)&&r()},[r]),g=d(()=>{r(),i.current=null},[r]),P=d((s,p)=>{s.preventDefault(),s.stopPropagation(),i.current==="touch"?l.current&&(clearTimeout(l.current),l.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!c.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>c.current?(c.current=!1,!0):!1,[]);return{longPressFiredRef:c,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown: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:l,progress:c,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),[L,V]=y(!1),[G,W]=y(null),Y=o=>{W(o),V(!0)},$=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose($)},[f,$]),j=f.clearPopupTimeout,se=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},ae=()=>{g&&k()},le=()=>{j()},ce=()=>{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&&!!c&&c.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=l==="book"?e(v,{name:"book",size:28}):l==="play"?e(v,{name:"play",size:28}):l==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),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),L&&j()},onMouseLeave:()=>{D(!1),P?.(!1),L&&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&&c&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${c.percent}%`}})}),e("div",{className:n.timestamp,children:c.label})]}),e("div",{className:n.titleSection,children:[m&&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&&L&&G?g(G,{close:$,onMouseEnter:le,onMouseLeave:ce}):null]})});export{dn as M,cn as a,n as m,R as p};
@@ -1 +1 @@
1
- import{A as _,d as b,h as E,g as We,u as e,S as w,$ as je,o as Ve,T as Q}from"./vendor-core-8R2fFbyN.js";import{t as _e,g as F,z as M}from"./index-BXwhFWB_.js";import{I as g}from"./vendor-icons-CDMuNDeL.js";import{a as n}from"./Asmr.module-ChUXDZKx.js";import{r as h}from"./Radio.module-DGSZLpKM.js";import{b as J,u as Ce,a as Pe}from"./vendor-query-BUTye89G.js";function Be(a){if(!Number.isFinite(a)||a<0)return"0:00";const r=Math.floor(a/60),y=Math.floor(a%60);return`${r}:${String(y).padStart(2,"0")}`}const Je=({track:a,shuffle:r,onToggleShuffle:y,onTrackStep:R,onTrackFailed:be,onClose:se,liked:G,likeVisible:Z,likePending:re,onToggleLike:K})=>{const C=_(null),X=_(!1),[q,I]=b(!1),[he,c]=b(!0),[k,H]=b(!1),[$,A]=b(0),[U,oe]=b(0),[x,z]=b(()=>{const s=parseFloat(localStorage.getItem("musicVolume")||"");return Number.isFinite(s)?s:1}),[B,le]=b(()=>localStorage.getItem("musicAutoplay")!=="false"),W=_(x);W.current=x;const N=_(B);N.current=B;const f=_(0),D=_(0),O=_(null),Y=_("");Y.current||(Y.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(a.id)}`,j=()=>{O.current&&(window.clearTimeout(O.current),O.current=null)},te=s=>{const o=C.current;if(!o)return;j(),c(!0),H(!1);const v=()=>{if(o.removeEventListener("loadedmetadata",v),s>5&&Number.isFinite(o.duration)&&s<o.duration-5)try{o.currentTime=s}catch{}};o.addEventListener("loadedmetadata",v),o.src=ee,o.load(),o.volume=W.current,o.play().catch(()=>{})},ve=()=>{c(!1),H(!0),be?.(a),N.current&&R(1)},ce=()=>{if(!O.current){if(D.current>=3){ve();return}D.current+=1,O.current=window.setTimeout(()=>{O.current=null,te(f.current)},5e3)}},ke=()=>{D.current=0,te(f.current)};E(()=>{f.current=0,D.current=0,I(!1),A(0),oe(0);const s=C.current;return te(f.current),()=>{j(),s&&s.removeAttribute("src")}},[ee]),E(()=>{const s=C.current;s&&(s.volume=x)},[x]),E(()=>(document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")),[]);const P=a.thumbnails?.[a.thumbnails.length-1]?.url??null,ne=We.useCallback(s=>{const o=C.current;_e.discord.musicPresence.mutate({title:a.title,artistLabel:a.artists,isPlaying:s,thumbnail:P||"",currentTime:o?.currentTime??0,duration:Number.isFinite(o?.duration??NaN)?o?.duration:0,sessionId:Y.current}).catch(()=>{}),_e.discord.heartbeat.mutate({sessionId:Y.current}).catch(()=>{})},[a,P]);E(()=>{ne(q)},[ne,q,a.id]),E(()=>{if(!q)return;const s=window.setInterval(()=>ne(!0),15e3);return()=>window.clearInterval(s)},[q,ne]),E(()=>{const s=Y.current,o=()=>{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=()=>o(),ae=()=>{document.visibilityState==="hidden"&&o()};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),o()}},[]);const pe=()=>{const s=C.current;s&&(s.paused?s.play().catch(()=>{}):s.pause())},[Ne,ge]=b(!1);E(()=>{ge(!1)},[P]);const ue=`${a.title} — ${a.artists}`,Se=e(w,{children:[e("div",{className:n.playerButtons,children:[e("button",{className:n.playerBtn,onClick:()=>R(-1),"aria-label":"Previous track",children:e(g,{name:"step-backward"})}),e("button",{className:`${n.playerBtn} ${n.playBtn}`,onClick:pe,"aria-label":q?"Pause":"Play",children:q?e(g,{name:"pause"}):e(g,{name:"play"})}),e("button",{className:n.playerBtn,onClick:()=>R(1),"aria-label":"Next track",children:e(g,{name:"step-forward"})}),k&&e("button",{className:n.playerBtn,onClick:ke,title:"Retry playback","aria-label":"Retry playback",children:e(g,{name:"redo"})})]}),e("div",{className:n.seekRow,children:[e("span",{className:n.timeLabel,children:Be($)}),e("input",{className:n.seekBar,type:"range",min:0,max:U||0,step:.1,value:Math.min($,U||0),onChange:s=>{const o=C.current;!o||!Number.isFinite(o.duration)||(o.currentTime=parseFloat(s.target.value),A(o.currentTime))},onPointerDown:()=>{X.current=!0},onPointerUp:()=>{X.current=!1},style:{"--played-percent":`${U>0?$/U*100:0}%`},"aria-label":"Seek"}),e("span",{className:n.timeLabel,children:Be(U)}),he&&!k&&e("span",{className:n.timeLabel,children:"loading…"})]})]}),ye=e(w,{children:[a.thumbnails?.[0]?.url&&!Ne&&e("img",{src:a.thumbnails[0].url,alt:"",className:h.stationThumb,loading:"lazy",decoding:"async",onError:()=>ge(!0)}),e("div",{className:n.playerInfo,children:[e("p",{className:n.playerTitle,title:ue,children:ue}),e("p",{className:n.playerTrack,children:a.artists})]}),e("div",{className:n.playerControls,children:Se}),e("div",{className:n.playerRight,children:[x===0?e(g,{name:"volume-mute",className:n.volumeIcon}):x<.5?e(g,{name:"volume-down",className:n.volumeIcon}):e(g,{name:"volume-up",className:n.volumeIcon}),e("input",{className:n.volumeBar,type:"range",min:0,max:1,step:.01,value:x,onChange:s=>{const o=parseFloat(s.target.value);z(o),localStorage.setItem("musicVolume",String(o))},style:{"--volume-percent":`${x*100}%`},"aria-label":"Volume"})]}),e("div",{className:n.playerActions,children:[Z&&K&&e("button",{className:`${n.playerBtn} ${G?n.playerBtnActive:""}`,onClick:K,disabled:re,title:G?"Remove from Liked Music":"Add to Liked Music","aria-label":G?"Remove from Liked Music":"Add to Liked Music","aria-pressed":!!G,children:e(g,{name:"heart"})}),e("button",{className:`${n.playerBtn} ${r?n.playerBtnActive:""}`,onClick:y,title:r?"Shuffle on":"Shuffle off","aria-label":"Toggle shuffle","aria-pressed":r,children:e(g,{name:"shuffle"})}),e("button",{className:`${n.playerBtn} ${B?n.playerBtnActive:""}`,onClick:()=>{le(s=>(localStorage.setItem("musicAutoplay",String(!s)),!s))},title:B?"Autoplay on: next track plays automatically":"Autoplay off","aria-label":"Toggle autoplay","aria-pressed":B,children:e(g,{name:"forward"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(a.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":"Open in YouTube Music",className:n.playerBtn,style:{display:"inline-flex",alignItems:"center"},children:e(g,{name:"external-link-alt"})}),e("button",{className:n.playerBtn,onClick:se,"aria-label":"Close player",children:e(g,{name:"times"})})]})]});return je(e(w,{children:[e("audio",{ref:C,preload:"none",onPlay:()=>{I(!0),c(!1),H(!1),D.current=0,j()},onPause:()=>I(!1),onWaiting:()=>{k||c(!0)},onPlaying:()=>{c(!1),D.current=0,j()},onTimeUpdate:s=>{const o=s.target.currentTime;f.current=o,j(),X.current||A(o)},onStalled:()=>{ce()},onLoadedMetadata:s=>{const o=s.target.duration;Number.isFinite(o)&&oe(o)},onDurationChange:s=>{const o=s.target.duration;Number.isFinite(o)&&oe(o)},onError:()=>{ce()},onEnded:()=>{N.current&&R(1)}}),e("div",{className:n.playerBar,children:ye})]}),document.body)},Ze=()=>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,Ke=()=>{const a=F();return J({...a.music.authStatus.queryOptions(),staleTime:30*1e3,refetchInterval:r=>r.state.data?.authenticated?!1:3e3,retry:1})},Xe=()=>{const a=F(),r=Ce();return Pe(a.music.authStart.mutationOptions({onSuccess:(y,R)=>{localStorage.setItem("ytmusic_cookie",R.cookie??""),r.invalidateQueries(a.music.pathFilter())}}))},et=()=>{const a=F(),r=Ce();return Pe(a.music.signOut.mutationOptions({onSuccess:()=>{r.invalidateQueries(a.music.pathFilter())}}))},tt=a=>{const r=F();return J({...r.music.search.queryOptions({q:a}),enabled:a.trim().length>0,staleTime:me,retry:1})},nt=a=>{const r=F();return J({...r.music.library.queryOptions(),enabled:a,staleTime:me,retry:1})},at=a=>{const r=F();return J({...r.music.track.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},it=a=>{const r=F();return J({...r.music.playlist.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},st=a=>{const r=F();return J({...r.music.upnext.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},rt=a=>{const r=F();return J({...r.music.likes.queryOptions(),enabled:a,staleTime:120*1e3,retry:1})},ot=()=>{const a=F(),r=Ce();return Pe(a.music.like.mutationOptions({onSuccess:()=>{r.invalidateQueries(a.music.pathFilter())}}))},lt="_authRow_10tvv_1",ct="_btn_10tvv_9",ut="_btnGhost_10tvv_42",dt="_cookieForm_10tvv_74",mt="_cookieInput_10tvv_83",ht="_link_10tvv_99",pt="_contentLayout_10tvv_109",gt="_mainCol_10tvv_116",yt="_upnextAside_10tvv_120",ft="_upnextHeader_10tvv_131",bt="_upnextTitle_10tvv_139",vt="_upnextActions_10tvv_149",kt="_nowPlayingLabel_10tvv_156",Nt="_nowPlayingWrap_10tvv_168",St="_likeBtn_10tvv_172",wt="_likeActive_10tvv_196",p={authRow:lt,btn:ct,btnGhost:ut,cookieForm:dt,cookieInput:mt,link:ht,contentLayout:pt,mainCol:gt,upnextAside:yt,upnextHeader:ft,upnextTitle:bt,upnextActions:vt,nowPlayingLabel:kt,nowPlayingWrap:Nt,likeBtn:St,likeActive:wt};function Oe(a){const r=a.trim();if(!r)return null;const y=r.match(/[?&]v=([A-Za-z0-9_-]{11})/)?.[1]??r.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)?.[1]??null;return y||(/^[A-Za-z0-9_-]{11}$/.test(r)?r:null)}const Tt="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Rt=()=>{const[a,r]=Ve(),y=Oe(a.get("v")??""),[R,be]=b(""),[se,G]=b(""),[Z,re]=b(()=>{try{return localStorage.getItem("ytmusic_cookie")??""}catch{return""}}),[K,C]=b(!1),[X,q]=b(()=>localStorage.getItem("musicShuffle")==="true"),[I,he]=b(()=>localStorage.getItem("musicRadio")!=="false"),[c,k]=b(null),[H,$]=b([]),[A,U]=b(null),[oe,x]=b({}),z=_([]);z.current=H;const B=_(null);B.current=c;const le=_(!1),W=_(new Set),{data:N}=Ke(),f=Xe(),D=et(),O=typeof navigator<"u"?navigator.userAgent:"",Y=/android/i.test(O),ee=/firefox|fxios/i.test(O)&&!Y,j=!ee&&!Y&&/chrome|chromium|edg|brave/i.test(O),te=ee||j,ve=()=>{if(K)return;C(!0);const t=window.setTimeout(()=>{window.removeEventListener("dango:ytmusic-cookie",i),C(!1),M.error("Helper not detected — install the Dango Helper extension first.")},3e3),i=u=>{window.clearTimeout(t),window.removeEventListener("dango:ytmusic-cookie",i),C(!1);try{const l=JSON.parse(u.detail);if(l?.ok&&l.cookie){const m=l.cookie.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(m.includes("…")||m.includes("...")){M.error(`Helper returned a truncated cookie (${m.length} chars) — reload music.youtube.com and Extract again.`);return}re(m),M.success("Cookie extracted from helper — signing in…"),f.mutate({cookie:m})}else l?.error==="NO_COOKIE"?M.error("Helper found no YouTube login — log in on a music.youtube.com tab first."):M.error("Helper request failed — try again.")}catch{M.error("Helper request failed — try again.")}};window.addEventListener("dango:ytmusic-cookie",i),window.dispatchEvent(new CustomEvent("dango:get-ytmusic-cookie"))},{data:ce,isLoading:ke}=tt(se),{data:P,isLoading:ne,isFetching:pe,error:Ne,refetch:ge}=nt(N?.authenticated===!0),{data:ue,isLoading:Se}=it(A?.id??null),{data:ye,isLoading:we}=st(c?.id??null),{data:s}=rt(N?.authenticated===!0),o=ot(),v=Q(()=>ce?.tracks||[],[ce]),ae=Q(()=>P?.playlists||[],[P]),S=Q(()=>P?.tracks||[],[P]),V=Q(()=>ue?.tracks||[],[ue]),T=Q(()=>{const t=ye?.tracks||[];return c?t.filter(i=>i.id!==c.id):t},[ye,c]),Ee=Q(()=>new Set(s?.likedIds||[]),[s]),Te=t=>oe[t.id]??(Ee.has(t.id)||t.liked===!0);E(()=>{N?.authenticated!==!0&&x({})},[N?.authenticated]);const Fe=Q(()=>[...v,...V,...S,...T],[v,V,S,T]),De=y&&c?.id!==y&&!Fe.some(t=>t.id===y)?y:null,{data:Re}=at(De),xe=c?.id;E(()=>{document.title=c?`${c.title} - dango`:"Music - dango"},[c]),E(()=>{if(!y){xe&&k(null);return}if(xe===y)return;const t=l=>{const m=l.find(d=>d.id===y);return m?(k(m),$(d=>d.some(ie=>ie.id===y)?d:l.length>0?l:[m]),!0):!1};if(t(v)||t(V)||t(S))return;const i=T.find(l=>l.id===y);if(i){k(i),$(l=>l.some(m=>m.id===i.id)?l:[i]);return}const u=Re?.track;u&&u.id===y&&(k(u),$(l=>l.some(m=>m.id===u.id)?l:[u]))},[y,xe,v,V,S,T,Re]);const Le=(t,i)=>{W.current.delete(t.id),k(t),$(i.length>0?i:[t]),r({v:t.id})},qe=t=>{W.current.add(t.id),M.error(`Couldn't play “${t.title}” — skipped.`)},He=async()=>{if(le.current)return;const t=z.current,i=t[t.length-1]??B.current;if(i){le.current=!0;try{const u=await _e.music.upnext.query({id:i.id}),l=new Set(t.map(d=>d.id)),m=(u.tracks||[]).filter(d=>!l.has(d.id)&&!W.current.has(d.id));if(m.length===0){const d=z.current[0];d&&(k(d),r({v:d.id}));return}$([...z.current,...m]),k(m[0]),r({v:m[0].id})}catch{const u=z.current[0];u&&(k(u),r({v:u.id}))}finally{le.current=!1}}},Ue=t=>{const i=z.current,u=B.current;if(!u||i.length===0)return;const l=i.findIndex(L=>L.id===u.id);if(t>0&&I&&(l<0||l===i.length-1)){He();return}const m=L=>W.current.has(L.id),d=i.length;let ie;if(X&&d>1){let L=Math.floor(Math.random()*d);for(let Me=0;Me<d&&(L===l||m(i[L]));Me++)L=Math.floor(Math.random()*d);ie=i[L]}else{const L=t>0?1:-1;let fe=(((l<0?L>0?-1:0:l)+L)%d+d)%d;for(let Ae=1;Ae<d&&m(i[fe]);Ae++)fe=((fe+L)%d+d)%d;ie=i[fe]}k(ie),r({v:ie.id})},ze=()=>{if(I){he(!1),localStorage.setItem("musicRadio","false");return}const t=B.current;if(!t)return;if(T.length===0){M.error("No radio suggestions for this song yet.");return}const i=new Set,u=[];for(const l of[t,...T])i.has(l.id)||(i.add(l.id),u.push(l));he(!0),localStorage.setItem("musicRadio","true"),$(u),M.success(`Radio started — ${T.length} songs queued.`)},Ie=t=>{if(N?.authenticated!==!0){M.error("Sign in to like songs.");return}const i=!Te(t);x(u=>({...u,[t.id]:i})),o.mutate({id:t.id,like:i},{onError:()=>{x(u=>{const l={...u};return delete l[t.id],l}),M.error("Like action failed — try again.")}})},Ye=()=>{q(t=>(localStorage.setItem("musicShuffle",String(!t)),!t))},Qe=t=>e("button",{className:h.stationRow,onClick:()=>U(t),"aria-label":`Open ${t.title}`,children:[t.thumbnails?.[0]?.url?e("img",{src:t.thumbnails[0].url,alt:"",className:h.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:h.stationThumbPlaceholder,children:e(g,{name:"headphones"})}),e("span",{className:h.stationMeta,children:[e("span",{className:h.stationName,children:t.title}),t.subtitle&&e("span",{className:h.stationSub,children:t.subtitle})]})]},t.id),de=(t,i,u)=>{const l=c?.id===t.id,m=Te(t),d=[t.album,t.duration].filter(Boolean).join(" · ");return e("div",{className:`${h.stationRow} ${l?h.stationRowActive:""}`,style:{cursor:"default"},children:[e("button",{onClick:()=>u?u(t):Le(t,i),className:h.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:h.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:h.stationThumbPlaceholder,children:e(g,{name:"headphones"})}),e("span",{className:h.stationMeta,children:[e("span",{className:h.stationName,children:t.title}),e("span",{className:h.stationSub,children:[t.artists,d?` · ${d}`:""]})]})]}),N?.authenticated===!0&&e("button",{className:`${p.likeBtn} ${m?p.likeActive:""}`,onClick:()=>Ie(t),disabled:o.isPending,title:m?"Remove from Liked Music":"Add to Liked Music","aria-label":m?`Remove ${t.title} from Liked Music`:`Add ${t.title} to Liked Music`,"aria-pressed":m,children:e(g,{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(g,{name:"external-link-alt"})})]},t.id)},$e=Q(()=>{if(!c)return T;const t=new Set,i=[];for(const u of[c,...T])t.has(u.id)||(t.add(u.id),i.push(u));return i},[c,T]),Ge=t=>{Le(t,$e)};return e("div",{className:`${n.page} ${c?n.pageWithPlayer:""}`,children:[e("div",{className:n.header,children:[e("h1",{className:n.pageTitle,children:[e(g,{name:"headphones"})," Music"]}),e("form",{className:n.searchForm,onSubmit:t=>{t.preventDefault();const i=Oe(R);i?(G(""),r({v:i})):G(R)},children:[e("input",{className:n.searchInput,value:R,onChange:t=>be(t.target.value),placeholder:"Search YouTube Music…","aria-label":"Search music"}),e("button",{className:n.searchBtn,type:"submit","aria-label":"Search",children:e(g,{name:"search"})})]})]}),e("div",{className:p.authRow,children:[N?.authenticated?e(w,{children:[e("span",{className:n.statusMsg,children:["Signed in to YouTube Music",P&&` — ${P.tracks.length} songs, ${P.playlists.length} playlists`]}),e("button",{className:p.btnGhost,onClick:()=>D.mutate(),disabled:D.isPending,children:"Sign out"})]}):e(w,{children:[e("form",{onSubmit:t=>{t.preventDefault();const i=Z.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(i){if(i.includes("…")||i.includes("...")){M.error("That cookie is truncated (contains …). Right-click the Cookie header → Copy value, not the wrapped preview.");return}i!==Z&&re(i),f.mutate({cookie:i})}},className:p.cookieForm,children:[e("input",{className:p.cookieInput,value:Z,onChange:t=>re(t.target.value),placeholder:"Paste music.youtube.com Cookie header…","aria-label":"YouTube Music cookie",type:"password"}),e("button",{className:p.btn,type:"submit",disabled:f.isPending||!Z.trim(),children:f.isPending?"Checking…":"Sign in"}),te&&e("button",{className:p.btnGhost,type:"button",onClick:ve,disabled:K||f.isPending,title:"Read the YouTube Music cookie via the Dango Helper extension (same zip as AnimePahe/JapaneseASMR)",children:K?"Extracting…":"Extract from helper"})]}),te&&e("p",{className:n.statusMsg,children:["Two ways to sign in: paste the Cookie header manually (steps below), or download"," ",e("a",{href:Tt,target:"_blank",rel:"noreferrer",className:p.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(Ze,{})]}),f.isSuccess&&e("p",{className:n.statusMsg,children:["Signed in — found ",f.data.tracks," songs and ",f.data.playlists," ","playlists."]}),f.isError&&e("p",{className:n.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:n.statusMsg,children:"Sign in with your YouTube Music cookie to see your library. Search and playback work without sign-in."})]}),e("div",{className:c?p.contentLayout:void 0,children:[e("div",{className:p.mainCol,children:se?e(w,{children:[e("h2",{className:h.sectionTitle,children:["Results for “",se,"”"]}),ke?e("p",{className:n.statusMsg,children:"Searching…"}):v.length===0?e("p",{className:n.statusMsg,children:"No tracks found."}):e("div",{className:h.stationList,children:v.map(t=>de(t,v))})]}):N?.authenticated?e(w,{children:[e("h2",{className:h.sectionTitle,children:"Your library"}),ne?e("p",{className:n.statusMsg,children:"Loading library…"}):ae.length===0&&S.length===0&&!A?e(w,{children:[e("p",{className:n.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:p.btnGhost,onClick:()=>{ge()},disabled:pe,"aria-label":"Retry loading library",children:pe?"Retrying…":"Retry"})}),e("p",{className:n.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:h.sectionTitle,children:"Playlists"}),e("div",{className:h.stationList,children:ae.map(t=>Qe(t))})]}),S.length>0&&!A&&e(w,{children:[e("h3",{className:h.sectionTitle,children:["Liked songs (",S.length,")"]}),e("div",{style:{marginBottom:8},children:e("button",{className:p.btnGhost,onClick:()=>Le(S[0],S),"aria-label":"Play all liked songs",children:[e(g,{name:"play"})," Play all"]})}),e("div",{className:h.stationList,children:S.map(t=>de(t,S))})]}),A?e(w,{children:[e("button",{className:p.btnGhost,onClick:()=>U(null),style:{marginBottom:8},children:"← Back to library"}),e("h3",{className:h.sectionTitle,children:A.title}),Se?e("p",{className:n.statusMsg,children:"Loading playlist…"}):V.length===0?e("p",{className:n.statusMsg,children:"No tracks in this playlist."}):e("div",{className:h.stationList,children:V.map(t=>de(t,V))})]}):null]})]}):e("p",{className:n.statusMsg,children:"Search above, or sign in to see your library."})}),c&&e("aside",{className:p.upnextAside,"aria-label":"Up next",children:[e("div",{className:p.upnextHeader,children:e("span",{className:p.upnextTitle,children:[e(g,{name:"list-ul"})," Up Next"]})}),e("div",{className:p.nowPlayingWrap,children:[e("p",{className:p.nowPlayingLabel,children:"Now playing"}),de(c,H.length>0?H:[c])]}),e("div",{className:p.upnextActions,children:e("button",{className:p.btnGhost,onClick:ze,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:n.statusMsg,children:"Loading suggestions…"}):T.length===0?e("p",{className:n.statusMsg,children:"No suggestions for this song."}):e("div",{className:h.stationList,children:T.map(t=>de(t,$e,Ge))})]})]}),c&&e(Je,{track:c,queue:H,shuffle:X,onToggleShuffle:Ye,onTrackStep:Ue,onTrackFailed:qe,onClose:()=>{k(null),r({})},liked:c?Te(c):!1,likeVisible:N?.authenticated===!0,likePending:o.isPending,onToggleLike:()=>Ie(c)})]})};export{Rt as default};
1
+ import{A as _,d as b,h as E,g as We,u as e,S as w,$ as je,o as Ve,T as Q}from"./vendor-core-8R2fFbyN.js";import{t as _e,g as F,z as M}from"./index-B5SLDCAi.js";import{I as g}from"./vendor-icons-CDMuNDeL.js";import{a as n}from"./Asmr.module-ChUXDZKx.js";import{r as h}from"./Radio.module-DGSZLpKM.js";import{b as J,u as Ce,a as Pe}from"./vendor-query-BUTye89G.js";function Be(a){if(!Number.isFinite(a)||a<0)return"0:00";const r=Math.floor(a/60),y=Math.floor(a%60);return`${r}:${String(y).padStart(2,"0")}`}const Je=({track:a,shuffle:r,onToggleShuffle:y,onTrackStep:R,onTrackFailed:be,onClose:se,liked:G,likeVisible:Z,likePending:re,onToggleLike:K})=>{const C=_(null),X=_(!1),[q,I]=b(!1),[he,c]=b(!0),[k,H]=b(!1),[$,A]=b(0),[U,oe]=b(0),[x,z]=b(()=>{const s=parseFloat(localStorage.getItem("musicVolume")||"");return Number.isFinite(s)?s:1}),[B,le]=b(()=>localStorage.getItem("musicAutoplay")!=="false"),W=_(x);W.current=x;const N=_(B);N.current=B;const f=_(0),D=_(0),O=_(null),Y=_("");Y.current||(Y.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(a.id)}`,j=()=>{O.current&&(window.clearTimeout(O.current),O.current=null)},te=s=>{const o=C.current;if(!o)return;j(),c(!0),H(!1);const v=()=>{if(o.removeEventListener("loadedmetadata",v),s>5&&Number.isFinite(o.duration)&&s<o.duration-5)try{o.currentTime=s}catch{}};o.addEventListener("loadedmetadata",v),o.src=ee,o.load(),o.volume=W.current,o.play().catch(()=>{})},ve=()=>{c(!1),H(!0),be?.(a),N.current&&R(1)},ce=()=>{if(!O.current){if(D.current>=3){ve();return}D.current+=1,O.current=window.setTimeout(()=>{O.current=null,te(f.current)},5e3)}},ke=()=>{D.current=0,te(f.current)};E(()=>{f.current=0,D.current=0,I(!1),A(0),oe(0);const s=C.current;return te(f.current),()=>{j(),s&&s.removeAttribute("src")}},[ee]),E(()=>{const s=C.current;s&&(s.volume=x)},[x]),E(()=>(document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")),[]);const P=a.thumbnails?.[a.thumbnails.length-1]?.url??null,ne=We.useCallback(s=>{const o=C.current;_e.discord.musicPresence.mutate({title:a.title,artistLabel:a.artists,isPlaying:s,thumbnail:P||"",currentTime:o?.currentTime??0,duration:Number.isFinite(o?.duration??NaN)?o?.duration:0,sessionId:Y.current}).catch(()=>{}),_e.discord.heartbeat.mutate({sessionId:Y.current}).catch(()=>{})},[a,P]);E(()=>{ne(q)},[ne,q,a.id]),E(()=>{if(!q)return;const s=window.setInterval(()=>ne(!0),15e3);return()=>window.clearInterval(s)},[q,ne]),E(()=>{const s=Y.current,o=()=>{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=()=>o(),ae=()=>{document.visibilityState==="hidden"&&o()};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),o()}},[]);const pe=()=>{const s=C.current;s&&(s.paused?s.play().catch(()=>{}):s.pause())},[Ne,ge]=b(!1);E(()=>{ge(!1)},[P]);const ue=`${a.title} — ${a.artists}`,Se=e(w,{children:[e("div",{className:n.playerButtons,children:[e("button",{className:n.playerBtn,onClick:()=>R(-1),"aria-label":"Previous track",children:e(g,{name:"step-backward"})}),e("button",{className:`${n.playerBtn} ${n.playBtn}`,onClick:pe,"aria-label":q?"Pause":"Play",children:q?e(g,{name:"pause"}):e(g,{name:"play"})}),e("button",{className:n.playerBtn,onClick:()=>R(1),"aria-label":"Next track",children:e(g,{name:"step-forward"})}),k&&e("button",{className:n.playerBtn,onClick:ke,title:"Retry playback","aria-label":"Retry playback",children:e(g,{name:"redo"})})]}),e("div",{className:n.seekRow,children:[e("span",{className:n.timeLabel,children:Be($)}),e("input",{className:n.seekBar,type:"range",min:0,max:U||0,step:.1,value:Math.min($,U||0),onChange:s=>{const o=C.current;!o||!Number.isFinite(o.duration)||(o.currentTime=parseFloat(s.target.value),A(o.currentTime))},onPointerDown:()=>{X.current=!0},onPointerUp:()=>{X.current=!1},style:{"--played-percent":`${U>0?$/U*100:0}%`},"aria-label":"Seek"}),e("span",{className:n.timeLabel,children:Be(U)}),he&&!k&&e("span",{className:n.timeLabel,children:"loading…"})]})]}),ye=e(w,{children:[a.thumbnails?.[0]?.url&&!Ne&&e("img",{src:a.thumbnails[0].url,alt:"",className:h.stationThumb,loading:"lazy",decoding:"async",onError:()=>ge(!0)}),e("div",{className:n.playerInfo,children:[e("p",{className:n.playerTitle,title:ue,children:ue}),e("p",{className:n.playerTrack,children:a.artists})]}),e("div",{className:n.playerControls,children:Se}),e("div",{className:n.playerRight,children:[x===0?e(g,{name:"volume-mute",className:n.volumeIcon}):x<.5?e(g,{name:"volume-down",className:n.volumeIcon}):e(g,{name:"volume-up",className:n.volumeIcon}),e("input",{className:n.volumeBar,type:"range",min:0,max:1,step:.01,value:x,onChange:s=>{const o=parseFloat(s.target.value);z(o),localStorage.setItem("musicVolume",String(o))},style:{"--volume-percent":`${x*100}%`},"aria-label":"Volume"})]}),e("div",{className:n.playerActions,children:[Z&&K&&e("button",{className:`${n.playerBtn} ${G?n.playerBtnActive:""}`,onClick:K,disabled:re,title:G?"Remove from Liked Music":"Add to Liked Music","aria-label":G?"Remove from Liked Music":"Add to Liked Music","aria-pressed":!!G,children:e(g,{name:"heart"})}),e("button",{className:`${n.playerBtn} ${r?n.playerBtnActive:""}`,onClick:y,title:r?"Shuffle on":"Shuffle off","aria-label":"Toggle shuffle","aria-pressed":r,children:e(g,{name:"shuffle"})}),e("button",{className:`${n.playerBtn} ${B?n.playerBtnActive:""}`,onClick:()=>{le(s=>(localStorage.setItem("musicAutoplay",String(!s)),!s))},title:B?"Autoplay on: next track plays automatically":"Autoplay off","aria-label":"Toggle autoplay","aria-pressed":B,children:e(g,{name:"forward"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(a.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":"Open in YouTube Music",className:n.playerBtn,style:{display:"inline-flex",alignItems:"center"},children:e(g,{name:"external-link-alt"})}),e("button",{className:n.playerBtn,onClick:se,"aria-label":"Close player",children:e(g,{name:"times"})})]})]});return je(e(w,{children:[e("audio",{ref:C,preload:"none",onPlay:()=>{I(!0),c(!1),H(!1),D.current=0,j()},onPause:()=>I(!1),onWaiting:()=>{k||c(!0)},onPlaying:()=>{c(!1),D.current=0,j()},onTimeUpdate:s=>{const o=s.target.currentTime;f.current=o,j(),X.current||A(o)},onStalled:()=>{ce()},onLoadedMetadata:s=>{const o=s.target.duration;Number.isFinite(o)&&oe(o)},onDurationChange:s=>{const o=s.target.duration;Number.isFinite(o)&&oe(o)},onError:()=>{ce()},onEnded:()=>{N.current&&R(1)}}),e("div",{className:n.playerBar,children:ye})]}),document.body)},Ze=()=>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,Ke=()=>{const a=F();return J({...a.music.authStatus.queryOptions(),staleTime:30*1e3,refetchInterval:r=>r.state.data?.authenticated?!1:3e3,retry:1})},Xe=()=>{const a=F(),r=Ce();return Pe(a.music.authStart.mutationOptions({onSuccess:(y,R)=>{localStorage.setItem("ytmusic_cookie",R.cookie??""),r.invalidateQueries(a.music.pathFilter())}}))},et=()=>{const a=F(),r=Ce();return Pe(a.music.signOut.mutationOptions({onSuccess:()=>{r.invalidateQueries(a.music.pathFilter())}}))},tt=a=>{const r=F();return J({...r.music.search.queryOptions({q:a}),enabled:a.trim().length>0,staleTime:me,retry:1})},nt=a=>{const r=F();return J({...r.music.library.queryOptions(),enabled:a,staleTime:me,retry:1})},at=a=>{const r=F();return J({...r.music.track.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},it=a=>{const r=F();return J({...r.music.playlist.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},st=a=>{const r=F();return J({...r.music.upnext.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},rt=a=>{const r=F();return J({...r.music.likes.queryOptions(),enabled:a,staleTime:120*1e3,retry:1})},ot=()=>{const a=F(),r=Ce();return Pe(a.music.like.mutationOptions({onSuccess:()=>{r.invalidateQueries(a.music.pathFilter())}}))},lt="_authRow_10tvv_1",ct="_btn_10tvv_9",ut="_btnGhost_10tvv_42",dt="_cookieForm_10tvv_74",mt="_cookieInput_10tvv_83",ht="_link_10tvv_99",pt="_contentLayout_10tvv_109",gt="_mainCol_10tvv_116",yt="_upnextAside_10tvv_120",ft="_upnextHeader_10tvv_131",bt="_upnextTitle_10tvv_139",vt="_upnextActions_10tvv_149",kt="_nowPlayingLabel_10tvv_156",Nt="_nowPlayingWrap_10tvv_168",St="_likeBtn_10tvv_172",wt="_likeActive_10tvv_196",p={authRow:lt,btn:ct,btnGhost:ut,cookieForm:dt,cookieInput:mt,link:ht,contentLayout:pt,mainCol:gt,upnextAside:yt,upnextHeader:ft,upnextTitle:bt,upnextActions:vt,nowPlayingLabel:kt,nowPlayingWrap:Nt,likeBtn:St,likeActive:wt};function Oe(a){const r=a.trim();if(!r)return null;const y=r.match(/[?&]v=([A-Za-z0-9_-]{11})/)?.[1]??r.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)?.[1]??null;return y||(/^[A-Za-z0-9_-]{11}$/.test(r)?r:null)}const Tt="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Rt=()=>{const[a,r]=Ve(),y=Oe(a.get("v")??""),[R,be]=b(""),[se,G]=b(""),[Z,re]=b(()=>{try{return localStorage.getItem("ytmusic_cookie")??""}catch{return""}}),[K,C]=b(!1),[X,q]=b(()=>localStorage.getItem("musicShuffle")==="true"),[I,he]=b(()=>localStorage.getItem("musicRadio")!=="false"),[c,k]=b(null),[H,$]=b([]),[A,U]=b(null),[oe,x]=b({}),z=_([]);z.current=H;const B=_(null);B.current=c;const le=_(!1),W=_(new Set),{data:N}=Ke(),f=Xe(),D=et(),O=typeof navigator<"u"?navigator.userAgent:"",Y=/android/i.test(O),ee=/firefox|fxios/i.test(O)&&!Y,j=!ee&&!Y&&/chrome|chromium|edg|brave/i.test(O),te=ee||j,ve=()=>{if(K)return;C(!0);const t=window.setTimeout(()=>{window.removeEventListener("dango:ytmusic-cookie",i),C(!1),M.error("Helper not detected — install the Dango Helper extension first.")},3e3),i=u=>{window.clearTimeout(t),window.removeEventListener("dango:ytmusic-cookie",i),C(!1);try{const l=JSON.parse(u.detail);if(l?.ok&&l.cookie){const m=l.cookie.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(m.includes("…")||m.includes("...")){M.error(`Helper returned a truncated cookie (${m.length} chars) — reload music.youtube.com and Extract again.`);return}re(m),M.success("Cookie extracted from helper — signing in…"),f.mutate({cookie:m})}else l?.error==="NO_COOKIE"?M.error("Helper found no YouTube login — log in on a music.youtube.com tab first."):M.error("Helper request failed — try again.")}catch{M.error("Helper request failed — try again.")}};window.addEventListener("dango:ytmusic-cookie",i),window.dispatchEvent(new CustomEvent("dango:get-ytmusic-cookie"))},{data:ce,isLoading:ke}=tt(se),{data:P,isLoading:ne,isFetching:pe,error:Ne,refetch:ge}=nt(N?.authenticated===!0),{data:ue,isLoading:Se}=it(A?.id??null),{data:ye,isLoading:we}=st(c?.id??null),{data:s}=rt(N?.authenticated===!0),o=ot(),v=Q(()=>ce?.tracks||[],[ce]),ae=Q(()=>P?.playlists||[],[P]),S=Q(()=>P?.tracks||[],[P]),V=Q(()=>ue?.tracks||[],[ue]),T=Q(()=>{const t=ye?.tracks||[];return c?t.filter(i=>i.id!==c.id):t},[ye,c]),Ee=Q(()=>new Set(s?.likedIds||[]),[s]),Te=t=>oe[t.id]??(Ee.has(t.id)||t.liked===!0);E(()=>{N?.authenticated!==!0&&x({})},[N?.authenticated]);const Fe=Q(()=>[...v,...V,...S,...T],[v,V,S,T]),De=y&&c?.id!==y&&!Fe.some(t=>t.id===y)?y:null,{data:Re}=at(De),xe=c?.id;E(()=>{document.title=c?`${c.title} - dango`:"Music - dango"},[c]),E(()=>{if(!y){xe&&k(null);return}if(xe===y)return;const t=l=>{const m=l.find(d=>d.id===y);return m?(k(m),$(d=>d.some(ie=>ie.id===y)?d:l.length>0?l:[m]),!0):!1};if(t(v)||t(V)||t(S))return;const i=T.find(l=>l.id===y);if(i){k(i),$(l=>l.some(m=>m.id===i.id)?l:[i]);return}const u=Re?.track;u&&u.id===y&&(k(u),$(l=>l.some(m=>m.id===u.id)?l:[u]))},[y,xe,v,V,S,T,Re]);const Le=(t,i)=>{W.current.delete(t.id),k(t),$(i.length>0?i:[t]),r({v:t.id})},qe=t=>{W.current.add(t.id),M.error(`Couldn't play “${t.title}” — skipped.`)},He=async()=>{if(le.current)return;const t=z.current,i=t[t.length-1]??B.current;if(i){le.current=!0;try{const u=await _e.music.upnext.query({id:i.id}),l=new Set(t.map(d=>d.id)),m=(u.tracks||[]).filter(d=>!l.has(d.id)&&!W.current.has(d.id));if(m.length===0){const d=z.current[0];d&&(k(d),r({v:d.id}));return}$([...z.current,...m]),k(m[0]),r({v:m[0].id})}catch{const u=z.current[0];u&&(k(u),r({v:u.id}))}finally{le.current=!1}}},Ue=t=>{const i=z.current,u=B.current;if(!u||i.length===0)return;const l=i.findIndex(L=>L.id===u.id);if(t>0&&I&&(l<0||l===i.length-1)){He();return}const m=L=>W.current.has(L.id),d=i.length;let ie;if(X&&d>1){let L=Math.floor(Math.random()*d);for(let Me=0;Me<d&&(L===l||m(i[L]));Me++)L=Math.floor(Math.random()*d);ie=i[L]}else{const L=t>0?1:-1;let fe=(((l<0?L>0?-1:0:l)+L)%d+d)%d;for(let Ae=1;Ae<d&&m(i[fe]);Ae++)fe=((fe+L)%d+d)%d;ie=i[fe]}k(ie),r({v:ie.id})},ze=()=>{if(I){he(!1),localStorage.setItem("musicRadio","false");return}const t=B.current;if(!t)return;if(T.length===0){M.error("No radio suggestions for this song yet.");return}const i=new Set,u=[];for(const l of[t,...T])i.has(l.id)||(i.add(l.id),u.push(l));he(!0),localStorage.setItem("musicRadio","true"),$(u),M.success(`Radio started — ${T.length} songs queued.`)},Ie=t=>{if(N?.authenticated!==!0){M.error("Sign in to like songs.");return}const i=!Te(t);x(u=>({...u,[t.id]:i})),o.mutate({id:t.id,like:i},{onError:()=>{x(u=>{const l={...u};return delete l[t.id],l}),M.error("Like action failed — try again.")}})},Ye=()=>{q(t=>(localStorage.setItem("musicShuffle",String(!t)),!t))},Qe=t=>e("button",{className:h.stationRow,onClick:()=>U(t),"aria-label":`Open ${t.title}`,children:[t.thumbnails?.[0]?.url?e("img",{src:t.thumbnails[0].url,alt:"",className:h.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:h.stationThumbPlaceholder,children:e(g,{name:"headphones"})}),e("span",{className:h.stationMeta,children:[e("span",{className:h.stationName,children:t.title}),t.subtitle&&e("span",{className:h.stationSub,children:t.subtitle})]})]},t.id),de=(t,i,u)=>{const l=c?.id===t.id,m=Te(t),d=[t.album,t.duration].filter(Boolean).join(" · ");return e("div",{className:`${h.stationRow} ${l?h.stationRowActive:""}`,style:{cursor:"default"},children:[e("button",{onClick:()=>u?u(t):Le(t,i),className:h.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:h.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:h.stationThumbPlaceholder,children:e(g,{name:"headphones"})}),e("span",{className:h.stationMeta,children:[e("span",{className:h.stationName,children:t.title}),e("span",{className:h.stationSub,children:[t.artists,d?` · ${d}`:""]})]})]}),N?.authenticated===!0&&e("button",{className:`${p.likeBtn} ${m?p.likeActive:""}`,onClick:()=>Ie(t),disabled:o.isPending,title:m?"Remove from Liked Music":"Add to Liked Music","aria-label":m?`Remove ${t.title} from Liked Music`:`Add ${t.title} to Liked Music`,"aria-pressed":m,children:e(g,{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(g,{name:"external-link-alt"})})]},t.id)},$e=Q(()=>{if(!c)return T;const t=new Set,i=[];for(const u of[c,...T])t.has(u.id)||(t.add(u.id),i.push(u));return i},[c,T]),Ge=t=>{Le(t,$e)};return e("div",{className:`${n.page} ${c?n.pageWithPlayer:""}`,children:[e("div",{className:n.header,children:[e("h1",{className:n.pageTitle,children:[e(g,{name:"headphones"})," Music"]}),e("form",{className:n.searchForm,onSubmit:t=>{t.preventDefault();const i=Oe(R);i?(G(""),r({v:i})):G(R)},children:[e("input",{className:n.searchInput,value:R,onChange:t=>be(t.target.value),placeholder:"Search YouTube Music…","aria-label":"Search music"}),e("button",{className:n.searchBtn,type:"submit","aria-label":"Search",children:e(g,{name:"search"})})]})]}),e("div",{className:p.authRow,children:[N?.authenticated?e(w,{children:[e("span",{className:n.statusMsg,children:["Signed in to YouTube Music",P&&` — ${P.tracks.length} songs, ${P.playlists.length} playlists`]}),e("button",{className:p.btnGhost,onClick:()=>D.mutate(),disabled:D.isPending,children:"Sign out"})]}):e(w,{children:[e("form",{onSubmit:t=>{t.preventDefault();const i=Z.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(i){if(i.includes("…")||i.includes("...")){M.error("That cookie is truncated (contains …). Right-click the Cookie header → Copy value, not the wrapped preview.");return}i!==Z&&re(i),f.mutate({cookie:i})}},className:p.cookieForm,children:[e("input",{className:p.cookieInput,value:Z,onChange:t=>re(t.target.value),placeholder:"Paste music.youtube.com Cookie header…","aria-label":"YouTube Music cookie",type:"password"}),e("button",{className:p.btn,type:"submit",disabled:f.isPending||!Z.trim(),children:f.isPending?"Checking…":"Sign in"}),te&&e("button",{className:p.btnGhost,type:"button",onClick:ve,disabled:K||f.isPending,title:"Read the YouTube Music cookie via the Dango Helper extension (same zip as AnimePahe/JapaneseASMR)",children:K?"Extracting…":"Extract from helper"})]}),te&&e("p",{className:n.statusMsg,children:["Two ways to sign in: paste the Cookie header manually (steps below), or download"," ",e("a",{href:Tt,target:"_blank",rel:"noreferrer",className:p.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(Ze,{})]}),f.isSuccess&&e("p",{className:n.statusMsg,children:["Signed in — found ",f.data.tracks," songs and ",f.data.playlists," ","playlists."]}),f.isError&&e("p",{className:n.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:n.statusMsg,children:"Sign in with your YouTube Music cookie to see your library. Search and playback work without sign-in."})]}),e("div",{className:c?p.contentLayout:void 0,children:[e("div",{className:p.mainCol,children:se?e(w,{children:[e("h2",{className:h.sectionTitle,children:["Results for “",se,"”"]}),ke?e("p",{className:n.statusMsg,children:"Searching…"}):v.length===0?e("p",{className:n.statusMsg,children:"No tracks found."}):e("div",{className:h.stationList,children:v.map(t=>de(t,v))})]}):N?.authenticated?e(w,{children:[e("h2",{className:h.sectionTitle,children:"Your library"}),ne?e("p",{className:n.statusMsg,children:"Loading library…"}):ae.length===0&&S.length===0&&!A?e(w,{children:[e("p",{className:n.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:p.btnGhost,onClick:()=>{ge()},disabled:pe,"aria-label":"Retry loading library",children:pe?"Retrying…":"Retry"})}),e("p",{className:n.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:h.sectionTitle,children:"Playlists"}),e("div",{className:h.stationList,children:ae.map(t=>Qe(t))})]}),S.length>0&&!A&&e(w,{children:[e("h3",{className:h.sectionTitle,children:["Liked songs (",S.length,")"]}),e("div",{style:{marginBottom:8},children:e("button",{className:p.btnGhost,onClick:()=>Le(S[0],S),"aria-label":"Play all liked songs",children:[e(g,{name:"play"})," Play all"]})}),e("div",{className:h.stationList,children:S.map(t=>de(t,S))})]}),A?e(w,{children:[e("button",{className:p.btnGhost,onClick:()=>U(null),style:{marginBottom:8},children:"← Back to library"}),e("h3",{className:h.sectionTitle,children:A.title}),Se?e("p",{className:n.statusMsg,children:"Loading playlist…"}):V.length===0?e("p",{className:n.statusMsg,children:"No tracks in this playlist."}):e("div",{className:h.stationList,children:V.map(t=>de(t,V))})]}):null]})]}):e("p",{className:n.statusMsg,children:"Search above, or sign in to see your library."})}),c&&e("aside",{className:p.upnextAside,"aria-label":"Up next",children:[e("div",{className:p.upnextHeader,children:e("span",{className:p.upnextTitle,children:[e(g,{name:"list-ul"})," Up Next"]})}),e("div",{className:p.nowPlayingWrap,children:[e("p",{className:p.nowPlayingLabel,children:"Now playing"}),de(c,H.length>0?H:[c])]}),e("div",{className:p.upnextActions,children:e("button",{className:p.btnGhost,onClick:ze,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:n.statusMsg,children:"Loading suggestions…"}):T.length===0?e("p",{className:n.statusMsg,children:"No suggestions for this song."}):e("div",{className:h.stationList,children:T.map(t=>de(t,$e,Ge))})]})]}),c&&e(Je,{track:c,queue:H,shuffle:X,onToggleShuffle:Ye,onTrackStep:Ue,onTrackFailed:qe,onClose:()=>{k(null),r({})},liked:c?Te(c):!1,likeVisible:N?.authenticated===!0,likePending:o.isPending,onToggleLike:()=>Ie(c)})]})};export{Rt 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 g,B as f,z as k,D as C}from"./AvSyncCalibrator-3yjZS7s6.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,"data-speed-boost-ignore":"true",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:g,value:i.textColor,onChange:t=>o("textColor",t)}),e(b,{label:"Background Color",colors:f,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};
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 g,B as f,z as k,D as C}from"./AvSyncCalibrator-Bo3820j3.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,"data-speed-boost-ignore":"true",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:g,value:i.textColor,onChange:t=>o("textColor",t)}),e(b,{label:"Background Color",colors:f,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};