@serifpersia/dango 3.9.5 → 3.9.6

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 (58) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-Bxo3dYi6.js → AnimeCard-BMhqfrkR.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-BVfj052Q.js → AnimeInfo-Dpvt4Bfs.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-V0Kmrgoa.js → AnimeInfoPage-CE1CxT-q.js} +2 -2
  5. package/client/dist/assets/{Asmr-C_uiD3nU.js → Asmr-Doj5jfXK.js} +1 -1
  6. package/client/dist/assets/{AsmrPopup-BqQpgR1K.js → AsmrPopup-Dj-Fzc8U.js} +1 -1
  7. package/client/dist/assets/{AsmrResetProgressModal-Csv4GiEL.js → AsmrResetProgressModal-DgFLBUSO.js} +1 -1
  8. package/client/dist/assets/{ErrorMessage-DAxegITP.js → ErrorMessage-hMt90aG4.js} +1 -1
  9. package/client/dist/assets/{Home-BVuZXbYG.js → Home-D163aa5L.js} +1 -1
  10. package/client/dist/assets/{Insights-CzqiUsSq.js → Insights-C1P7cKeY.js} +1 -1
  11. package/client/dist/assets/{LibraryListPage-CIqBrHf2.js → LibraryListPage-D-SFU6Ob.js} +1 -1
  12. package/client/dist/assets/{ListeningList-DBEOg6Pf.js → ListeningList-oyVVadHX.js} +1 -1
  13. package/client/dist/assets/{Manga-CMsgHNRo.js → Manga-B3jtSBx5.js} +1 -1
  14. package/client/dist/assets/{MangaInfoPage-BtoWZDAH.js → MangaInfoPage-DRVn2mAe.js} +1 -1
  15. package/client/dist/assets/{MangaReadPage-C5s5sOKl.js → MangaReadPage-BnlHoZaL.js} +1 -1
  16. package/client/dist/assets/{MangaResetProgressModal-BBIVaAVA.js → MangaResetProgressModal-BUz2MLDA.js} +1 -1
  17. package/client/dist/assets/{Mature-C5nVO-pD.js → Mature-C_6AL77P.js} +1 -1
  18. package/client/dist/assets/{MatureConsentModal-GDXcsFKz.js → MatureConsentModal-CC0bqpsd.js} +1 -1
  19. package/client/dist/assets/{MediaCard-DMGlm3fW.js → MediaCard-CeCsiCpy.js} +1 -1
  20. package/client/dist/assets/{OptionListMenu-DpPePCh7.js → OptionListMenu-BRI8vna9.js} +1 -1
  21. package/client/dist/assets/{Player-CGfFv0_G.js → Player-CWw0u5o2.js} +2 -2
  22. package/client/dist/assets/{PlayerProvider-zJDJ7w2h.js → PlayerProvider-9AfeIQ6B.js} +1 -1
  23. package/client/dist/assets/{PlayerSettings-B7FQWSSv.js → PlayerSettings-C9Tk-5ye.js} +1 -1
  24. package/client/dist/assets/{QueueOptionsButton-C40FPjKy.js → QueueOptionsButton-COnNd8B1.js} +1 -1
  25. package/client/dist/assets/{QueueRail-CCI5UE3V.js → QueueRail-C3V7Dxkj.js} +1 -1
  26. package/client/dist/assets/{ReadingList-CwbpzTqQ.js → ReadingList-CHjjXLoX.js} +1 -1
  27. package/client/dist/assets/{ResetProgressModal-CRmjBIiM.js → ResetProgressModal-2EZzznJV.js} +1 -1
  28. package/client/dist/assets/{Search-DqXagx5u.js → Search-3BVWhbFk.js} +1 -1
  29. package/client/dist/assets/Settings-BTFQ9byk.js +21 -0
  30. package/client/dist/assets/{SkeletonGrid-DSalPIgd.js → SkeletonGrid-B3ip19ry.js} +1 -1
  31. package/client/dist/assets/{Trackers-DPwyOrMr.js → Trackers-DQRyjPAR.js} +1 -1
  32. package/client/dist/assets/{Tv-DkMAx_ki.js → Tv-BTz52FUb.js} +1 -1
  33. package/client/dist/assets/{TvInfo-C9qnEHLF.js → TvInfo-BKOS8AmG.js} +1 -1
  34. package/client/dist/assets/{TvPopup-DmQw1air.js → TvPopup-DRGj0Mk8.js} +1 -1
  35. package/client/dist/assets/{TvSearch-Di-AdNgM.js → TvSearch-BjA0C3q7.js} +1 -1
  36. package/client/dist/assets/{TvWatchlist-CmW1Mevf.js → TvWatchlist-DG1RbmE4.js} +1 -1
  37. package/client/dist/assets/{VirtualKeyboard-CTTIG7Wy.js → VirtualKeyboard-BIXYg3GQ.js} +1 -1
  38. package/client/dist/assets/{WatchAlong-6Zw0uSo2.js → WatchAlong-XefYySuV.js} +1 -1
  39. package/client/dist/assets/{WatchAlongPanel-CBk19tnW.js → WatchAlongPanel-C2JcUz-e.js} +1 -1
  40. package/client/dist/assets/{Watchlist-DLNTPzcr.js → Watchlist-D7u_6_Rx.js} +1 -1
  41. package/client/dist/assets/index-BVkDKnzf.js +178 -0
  42. package/client/dist/assets/{index-TGvIXMUj.css → index-COFMCQUU.css} +1 -1
  43. package/client/dist/assets/{libraryInvalidation-CXA8qvJE.js → libraryInvalidation-ar7SX0CJ.js} +1 -1
  44. package/client/dist/assets/{playbackCompletion-Dz5SRhiZ.js → playbackCompletion-Bgy18e-S.js} +1 -1
  45. package/client/dist/assets/{useAnimeInfoData-B3zX9ouO.js → useAnimeInfoData-Bf5W2JqV.js} +1 -1
  46. package/client/dist/assets/{useMangaLibrary-BN6UWIDi.js → useMangaLibrary-CD_MzvM_.js} +1 -1
  47. package/client/dist/assets/{useMangaPopup-iiJ4p_Bv.js → useMangaPopup-C1YDuijt.js} +1 -1
  48. package/client/dist/assets/{useProviders-D0h-Ecgo.js → useProviders-CrYpQhz2.js} +1 -1
  49. package/client/dist/assets/{useTv-CjT0wz2W.js → useTv-ChpwVixu.js} +1 -1
  50. package/client/dist/assets/{useTvLibrary-C5s5jt9x.js → useTvLibrary-DqLFBTa7.js} +1 -1
  51. package/client/dist/assets/{useWatchAlongPlayer-C1iSTWOt.js → useWatchAlongPlayer-BTSgNMqR.js} +1 -1
  52. package/client/dist/assets/{vendor-icons-DrybRNxP.js → vendor-icons-C1Pj_eSX.js} +1 -1
  53. package/client/dist/index.html +3 -3
  54. package/package.json +2 -2
  55. package/server/dist/server.js +129 -129
  56. package/server/package.json +1 -1
  57. package/client/dist/assets/Settings-DBZG18um.js +0 -21
  58. package/client/dist/assets/index-CuAIqL2m.js +0 -178
@@ -1 +1 @@
1
- import{X as Ee,x as we,u as d,A as x,q as de,h as X,d as ae,T as oe,_ as Te,C as me}from"./vendor-core-DfaOB3Rn.js";import{I as te}from"./vendor-icons-DrybRNxP.js";import{a2 as Pe,p as pe,h as be}from"./index-CuAIqL2m.js";const ye=Ee(null);function j(){const n=we(ye);if(!n)throw new Error("Player controls must be inside a PlayerProvider.");return n}function ve(n,i){const t=j(),r=x(i);r.current=i;const l=n?.url,m=n?.hls,s=de(k=>{t.mediaRef.current=k,t.connect()},[t]);return X(()=>{if(l)return t.loadSource({url:l,hls:m},r.current)},[t,l,m]),s}function Ye({source:n,sourceOptions:i,...t}){const r=ve(n,i);return d("video",{playsInline:!0,...t,ref:r})}function Ze({source:n,sourceOptions:i,...t}){const r=ve(n,i);return d("audio",{...t,ref:r})}const Se="_shell_qjnah_1",Le="_stage_qjnah_38",Fe="_topBarTitleInfo_qjnah_59",_e="_streamDetails_qjnah_65",Re="_modeTag_qjnah_86",Me="_shellFill_qjnah_122",xe="_shellFullscreen_qjnah_130",Ce="_uiLayer_qjnah_145",Be="_engineStatus_qjnah_156",Ae="_volumeWrap_qjnah_169",De="_volumeSlider_qjnah_175",se={shell:Se,stage:Le,topBarTitleInfo:Fe,streamDetails:_e,modeTag:Re,shellFill:Me,shellFullscreen:xe,uiLayer:Ce,engineStatus:Be,volumeWrap:Ae,volumeSlider:De},Ie=({classes:n,videoRef:i,duration:t,formatTime:r,isScrubbing:l,buffered:m="auto",onSeek:s,onScrubStart:k,onScrubMove:v,onScrubEnd:_,timeLabelRef:E,children:w})=>{const p=x(null),S=x(null),P=x(null),g=x(null),h=x(null),a=x(!1),f=x(l);f.current=l;const b=x({onScrubMove:v,onScrubEnd:_});b.current={onScrubMove:v,onScrubEnd:_};const[A,$]=ae({time:0,position:null});X(()=>{const c=i.current;if(!c)return;const y=C=>{const V=C/t*100||0;p.current?.setAttribute("aria-valuenow",String(Math.round(C))),p.current?.setAttribute("aria-valuetext",`${r(C)} of ${r(t)}`),S.current&&(S.current.style.width=`${V}%`),P.current&&(P.current.style.left=`${V}%`),E?.current&&(E.current.innerText=`${r(C)} / ${r(t)}`)},R=()=>{l||y(c.currentTime)},D=()=>{if(m==="auto"&&c.buffered.length>0){const V=c.buffered.end(c.buffered.length-1)/t*100||0;g.current&&(g.current.style.width=`${V}%`)}};return y(c.currentTime),D(),c.addEventListener("timeupdate",R),c.addEventListener("progress",D),()=>{c.removeEventListener("timeupdate",R),c.removeEventListener("progress",D)}},[i,t,l,m,r,E]);const I=c=>{if(!p.current)return 0;const y=p.current.getBoundingClientRect();return y.width<=0?0:Math.min(1,Math.max(0,(c-y.left)/y.width))},Q=c=>{const y=c*t;p.current?.setAttribute("aria-valuenow",String(Math.round(y))),p.current?.setAttribute("aria-valuetext",`${r(y)} of ${r(t)}`);const R=y/t*100||0;S.current&&(S.current.style.width=`${R}%`),P.current&&(P.current.style.left=`${R}%`),E?.current&&(E.current.innerText=`${r(y)} / ${r(t)}`);const D=p.current?.getBoundingClientRect();$({time:y,position:D?c*D.width:null})};X(()=>{if(!l){h.current=null;return}const c=R=>{if(h.current!==null&&R.pointerId!==h.current||!t)return;const D=I(R.clientX);b.current.onScrubMove(D);const C=D*t;p.current?.setAttribute("aria-valuenow",String(Math.round(C))),p.current?.setAttribute("aria-valuetext",`${r(C)} of ${r(t)}`);const V=C/t*100||0;S.current&&(S.current.style.width=`${V}%`),P.current&&(P.current.style.left=`${V}%`),E?.current&&(E.current.innerText=`${r(C)} / ${r(t)}`);const e=p.current?.getBoundingClientRect();$({time:C,position:e?D*e.width:null})},y=R=>{h.current!==null&&R.pointerId!==h.current||(h.current=null,a.current=!0,R.pointerType!=="mouse"&&$({time:0,position:null}),b.current.onScrubEnd())};return document.addEventListener("pointermove",c),document.addEventListener("pointerup",y),document.addEventListener("pointercancel",y),()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",y),document.removeEventListener("pointercancel",y)}},[l,t,r,E]);const ne=c=>{if(c.pointerType==="mouse"&&c.button!==0||!i.current||!t)return;c.preventDefault(),h.current=c.pointerId;try{p.current?.setPointerCapture(c.pointerId)}catch{}f.current||(f.current=!0,k());const y=I(c.clientX);v(y),Q(y)},G=c=>{if(!t||f.current||c.pointerType!=="mouse")return;const y=I(c.clientX);$({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},Z=c=>{if(!(h.current!==null&&c.pointerId!==h.current)&&f.current){h.current=null,a.current=!0,c.pointerType!=="mouse"&&$({time:0,position:null});try{p.current?.hasPointerCapture(c.pointerId)&&p.current.releasePointerCapture(c.pointerId)}catch{}_()}};return d("div",{className:`${n.container} ${l&&n.scrubbing?n.scrubbing:""}`,ref:p,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round(i.current?.currentTime||0),"aria-disabled":!t,tabIndex:0,onClick:c=>{if(a.current){a.current=!1;return}!i.current||isNaN(t)||t===0||s(I(c.clientX))},onPointerDown:ne,onPointerMove:G,onPointerUp:Z,onPointerCancel:Z,onMouseMove:c=>{if(l||!t)return;const y=I(c.clientX);$({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{l||$({time:0,position:null})},onKeyDown:c=>{if(!(!i.current||!t)&&((c.key==="Home"||c.key==="End")&&(c.preventDefault(),s(c.key==="Home"?0:1)),c.key==="ArrowRight"||c.key==="ArrowLeft")){c.preventDefault();const y=(c.key==="ArrowRight"?5:-5)/t,R=i.current.currentTime/t||0;s(Math.min(1,Math.max(0,R+y)))}},children:[A.position!==null&&d("div",{className:n.timeBubble,style:{left:A.position},children:r(A.time)}),d("div",{className:n.bar,children:[d("div",{className:n.buffered,ref:g,style:m==="full"?{width:"100%"}:void 0}),d("div",{className:n.watched,ref:S}),d("div",{className:n.thumb,ref:P,onMouseDown:c=>{c.preventDefault(),i.current&&(f.current||k())}}),w]})]})};function re(){try{if(typeof window>"u")return!1;const n=window.matchMedia?.("(pointer: coarse)").matches??!1,t=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return n||t}catch{return!1}}function $e(){const[n,i]=ae(re);return X(()=>{i(re());let t=null;const r=()=>i(re());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",r):t.addListener(r)}catch{}return window.addEventListener("touchstart",r,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",r):t.removeListener(r))}catch{}window.removeEventListener("touchstart",r)}},[]),n}const Ne=450,qe=({muted:n,volume:i,volumeIcon:t,buttonClassName:r,sliderClassName:l,onToggleMute:m,onVolumeChange:s,onExpandedChange:k})=>{const v=$e(),[_,E]=ae(!1),w=x(null),p=x(!1),S=x(null),P=de(b=>{E(b),k?.(b)},[k]);X(()=>()=>{w.current&&window.clearTimeout(w.current)},[]),X(()=>{if(!_)return;const b=A=>{S.current&&!S.current.contains(A.target)&&P(!1)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[_,P]);const g=n?0:i,h=()=>{p.current=!1,w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{p.current=!0,P(!0)},Ne)},a=()=>{w.current&&(window.clearTimeout(w.current),w.current=null)},f=b=>{if(b.stopPropagation(),p.current){p.current=!1;return}if(v){_?m():P(!0);return}m()};return d("div",{ref:S,className:se.volumeWrap,"data-expanded":_?"true":"false",onContextMenu:b=>b.preventDefault(),children:[d("button",{type:"button",className:r,onClick:f,onPointerDown:h,onPointerUp:a,onPointerLeave:a,onContextMenu:b=>b.preventDefault(),"aria-label":n?"Unmute":"Mute","aria-expanded":_,children:t}),d("input",{type:"range",min:"0",max:"1",step:"0.05",value:g,onChange:b=>s(parseFloat(b.currentTarget.value)),onClick:b=>b.stopPropagation(),onPointerDown:b=>b.stopPropagation(),onContextMenu:b=>b.preventDefault(),className:`${se.volumeSlider} ${l??""}`,style:{"--volume-percent":`${g*100}%`},"aria-label":"Volume"})]})};let ee=null,ie=null;async function je(){return ee||(ie||(ie=Pe(()=>import("./hls-BOLXTnjL.js"),[]).then(n=>(ee=n.default,ee)).catch(()=>null)),ie)}function Ve(n){return n.canPlayType("application/vnd.apple.mpegurl")!==""||n.canPlayType("application/x-mpegURL")!==""}function ue(){return document}function le(n){const i=ue();if(document.fullscreenElement)return document.fullscreenElement;if(i.webkitFullscreenElement)return i.webkitFullscreenElement;const t=n;return t?.webkitDisplayingFullscreen?t:null}function ke(n){return le(n)!==null}async function Ue(n,i){if(le(i))return;const t=n;try{if(typeof n.requestFullscreen=="function"){await n.requestFullscreen();return}if(typeof t.webkitRequestFullscreen=="function"){await t.webkitRequestFullscreen();return}if(typeof t.webkitRequestFullScreen=="function"){await t.webkitRequestFullScreen();return}}catch{}const r=i;if(r&&typeof r.webkitEnterFullscreen=="function"){if(r.webkitSupportsFullscreen===!1)return;try{await r.webkitEnterFullscreen()}catch{}}}async function He(n){const i=ue();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(i.webkitFullscreenElement&&typeof i.webkitExitFullscreen=="function"){await i.webkitExitFullscreen();return}}catch{}const t=n;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof i.webkitCancelFullScreen=="function"?i.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??i.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function Ke(n,i){!n&&!i||(ke(i)?await He(i):n&&await Ue(n,i))}function Oe(n,i){const t=()=>{try{i(ke(n()))}catch{}},r=ue(),l=t;r.addEventListener("fullscreenchange",t),r.addEventListener("webkitfullscreenchange",l),r.addEventListener("webkitbeginfullscreen",l,!0),r.addEventListener("webkitendfullscreen",l,!0);const m=n();return m?.addEventListener("webkitbeginfullscreen",l),m?.addEventListener("webkitendfullscreen",l),()=>{r.removeEventListener("fullscreenchange",t),r.removeEventListener("webkitfullscreenchange",l),r.removeEventListener("webkitbeginfullscreen",l,!0),r.removeEventListener("webkitendfullscreen",l,!0),m?.removeEventListener("webkitbeginfullscreen",l),m?.removeEventListener("webkitendfullscreen",l)}}let H=null;function fe(n){try{return n?pe.getItem(n):null}catch{return null}}function Y(n,i){try{n&&pe.setItem(n,String(i))}catch{}}function We(n={}){const i=Number.parseFloat(fe(n.volumeKey)??"");let t={isPlaying:!1,isBuffering:!1,isMuted:fe(n.mutedKey)==="true",volume:Number.isFinite(i)?Math.max(0,Math.min(1,i)):1,duration:0,playbackRate:1,isScrubbing:!1,isFullscreen:!1,showControls:!0,isSpeedBoostActive:!1,audioTracks:[],subtitleTracks:[],qualities:[],activeAudioTrack:-1,activeSubtitleTrack:-1,activeQuality:-1,error:null,playBlocked:!1,playbackLocked:!1},r={currentTime:0,bufferedEnd:0};const l=new Set,m=new Set,s={current:null},k={current:null};let v=null,_=()=>{},E=()=>{},w=0,p=!1,S=1,P=!1,g=null,h=!1;function a(e){Object.entries(e).every(([u,o])=>Object.is(t[u],o))||(t={...t,...e},l.forEach(u=>u()))}function f(e){r.currentTime===e.currentTime&&r.bufferedEnd===e.bufferedEnd||(r=e,m.forEach(u=>u()))}function b(e){if(!e)return;let u=0;for(let o=0;o<e.buffered.length;o++)if(e.buffered.start(o)<=e.currentTime&&e.buffered.end(o)>=e.currentTime){u=e.buffered.end(o);break}f({currentTime:Number.isFinite(e.currentTime)?e.currentTime:0,bufferedEnd:u})}function A(){b(s.current)}function $(){const e=s.current;if(v===e||(v&&(H===v&&(H=e),b(v),E(),v.pause(),v.removeAttribute("src"),v.load()),_(),v=e,!e))return;P=!1,H||(H=e),e.volume=t.volume,e.muted=t.isMuted,e.playbackRate=t.playbackRate;const u=()=>{const T=Array.from(e.textTracks);if(!T.length)return;const U=T.findIndex(W=>W.mode==="showing");a({subtitleTracks:T.map((W,z)=>({id:z,label:W.label||W.language||`Track ${z+1}`,language:W.language})),...U>=0?{activeSubtitleTrack:U}:{}})},o={play:()=>{H=e,a({isPlaying:!0,playBlocked:!1,error:null})},playing:()=>a({isPlaying:!0,isBuffering:!1,playBlocked:!1}),pause:()=>a({isPlaying:!1,isBuffering:!1}),ended:()=>{a({isPlaying:!1,isBuffering:!1}),A()},waiting:()=>{!e.paused&&(e.readyState<3||e.seeking)&&a({isBuffering:!0})},canplay:()=>a({isBuffering:!1}),seeking:()=>{e.paused||a({isBuffering:!0}),A()},seeked:()=>{a({isBuffering:!1}),A()},timeupdate:()=>{A(),!e.paused&&!e.seeking&&a({isBuffering:!1})},progress:A,loadedmetadata:()=>{e.playbackRate=t.playbackRate,a({duration:Number.isFinite(e.duration)?e.duration:0}),u()},durationchange:()=>a({duration:Number.isFinite(e.duration)?e.duration:0}),ratechange:()=>{t.isSpeedBoostActive||(S=e.playbackRate),e.defaultPlaybackRate!==e.playbackRate&&(e.defaultPlaybackRate=e.playbackRate),a({playbackRate:e.playbackRate})},volumechange:()=>{a({volume:e.volume,isMuted:e.muted}),Y(n.volumeKey,e.volume),Y(n.mutedKey,e.muted)},error:()=>a({error:e.error?.message||"Unable to play this source.",isPlaying:!1,isBuffering:!1})};Object.entries(o).forEach(([T,U])=>e.addEventListener(T,U)),e.textTracks.addEventListener("addtrack",u),e.textTracks.addEventListener("removetrack",u),e.textTracks.addEventListener("change",u);const L=()=>e.tagName==="VIDEO"?e:null,O=()=>{const T=le(L());a({isFullscreen:T!==null&&(T===e||T===k.current)})},B=typeof document>"u"?()=>{}:Oe(L,O);typeof document<"u"&&O(),_=()=>{Object.entries(o).forEach(([T,U])=>e.removeEventListener(T,U)),B(),e.textTracks.removeEventListener("addtrack",u),e.textTracks.removeEventListener("removetrack",u),e.textTracks.removeEventListener("change",u)}}async function I(){if(t.playbackLocked&&!h)return!1;const e=s.current;if(!e)return!1;H=e;const u=w;try{return await e.play(),u===w}catch(o){if(u===w){const L=o instanceof Error&&o.name==="NotAllowedError",O=o instanceof Error&&o.name==="AbortError";a({isPlaying:!1,isBuffering:!1,playBlocked:L,...!L&&!O?{error:o instanceof Error?o.message:"Playback failed."}:{}})}return!1}}function Q(){t.playbackLocked&&!h||s.current?.pause()}function ne(){s.current?.paused?I():Q()}function G(e){if(t.playbackLocked&&!h)return;const u=s.current;if(!u||!Number.isFinite(e))return;let o=Math.max(0,e);if(Number.isFinite(u.duration))o=Math.min(u.duration,o);else if(u.seekable.length)for(let L=0;L<u.seekable.length;L++){if(o<=u.seekable.end(L)){o=Math.max(u.seekable.start(L),o);break}L===u.seekable.length-1&&(o=u.seekable.end(L))}u.currentTime=o,A()}function Z(e){G((s.current?.currentTime??r.currentTime)+e)}function c(e){if(!Number.isFinite(e))return;const u=Math.max(0,Math.min(1,e));a({volume:u,isMuted:u===0}),s.current&&(s.current.volume=u,s.current.muted=u===0),Y(n.volumeKey,u),Y(n.mutedKey,u===0)}function y(){const e=!t.isMuted;!e&&t.volume===0&&c(.5),a({isMuted:e}),s.current&&(s.current.muted=e),Y(n.mutedKey,e)}function R(e){if(t.playbackLocked&&!h||!Number.isFinite(e)||e<.25||e>4)return;S=e;const u=t.isSpeedBoostActive?2:e;a({playbackRate:u}),s.current&&(s.current.playbackRate=u)}function D(){t.playbackLocked||t.isScrubbing||(p=!!s.current&&!s.current.paused,a({isScrubbing:!0}),Q())}function C(){t.isScrubbing&&(a({isScrubbing:!1}),p&&I(),p=!1)}function V(e,u={}){E(),$();const o=s.current,L=++w;if(!o)return()=>{};let O=!1,B=null;const T=()=>!O&&w===L&&s.current===o;o.pause(),o.removeAttribute("src"),o.load(),a({duration:0,isPlaying:!1,isBuffering:!0,isScrubbing:!1,error:null,playBlocked:!1,audioTracks:[],subtitleTracks:[],qualities:[],activeAudioTrack:-1,activeSubtitleTrack:-1,activeQuality:-1}),f({currentTime:0,bufferedEnd:0});const U=()=>{T()&&u.initialTime&&u.initialTime>0&&G(u.initialTime)};o.addEventListener("loadedmetadata",U,{once:!0});const W=()=>{T()&&(u.onReady?.(),u.autoPlay&&T()&&I())},z=F=>{if(!T())return;const N=F instanceof Error?F:new Error(String(F));a({error:N.message,isPlaying:!1,isBuffering:!1}),u.onError?.(N)},J=()=>{O||(O=!0,o.removeEventListener("loadedmetadata",U),o.removeEventListener("error",ce),B?.destroy(),g===B&&(g=null),B=null,w===L&&w++)},ce=()=>{z(new Error(o.error?.message||"Unable to play this source.")),J()};return o.addEventListener("error",ce),E=J,(async()=>{if(e.hls){const F=await je();if(!T())return;if(F?.isSupported()){B=new F({enableWorker:!0,startPosition:u.initialTime??-1,...u.hlsConfig}),g=B;const N=B,he=()=>{T()&&a({audioTracks:N.audioTracks.map((M,q)=>({id:q,label:M.name||M.lang||`Track ${q+1}`,language:M.lang})),...o.querySelector("track")?{}:{subtitleTracks:N.subtitleTracks.map((M,q)=>({id:q,label:M.name||M.lang||`Track ${q+1}`,language:M.lang}))},qualities:N.levels.map((M,q)=>({id:q,label:M.height?`${M.height}p`:`${Math.round(M.bitrate/1e3)}k`})),activeAudioTrack:N.audioTrack,...o.querySelector("track")?{}:{activeSubtitleTrack:N.subtitleTrack},activeQuality:N.currentLevel})};for(const M of[F.Events.MANIFEST_PARSED,F.Events.AUDIO_TRACKS_UPDATED,F.Events.AUDIO_TRACK_SWITCHED,F.Events.SUBTITLE_TRACKS_UPDATED,F.Events.SUBTITLE_TRACK_SWITCH,F.Events.LEVEL_SWITCHED])N.on(M,he);if(B.on(F.Events.ERROR,(M,q)=>{q.fatal&&T()&&(z(new Error(`Stream failed (${q.details}). Try another source or reload.`)),J())}),B.once(F.Events.MANIFEST_PARSED,W),u.onHls?.(B,F),!T())return;B.loadSource(e.url),B.attachMedia(o);return}if(!Ve(o))throw new Error("HLS playback is unavailable in this browser.")}T()&&(o.src=e.url,o.load(),W())})().catch(F=>{z(F),J()}),J}return{mediaRef:s,containerRef:k,connect:$,getState:()=>t,getTimeline:()=>r,getHls:()=>g,isActive:()=>H===s.current,subscribe:e=>(l.add(e),()=>{l.delete(e)}),subscribeTimeline:e=>(m.add(e),()=>{m.delete(e)}),play:I,pause:Q,togglePlay:ne,seek:G,seekRelative:Z,setVolume:c,toggleMute:y,setPlaybackRate:R,setPlaybackLocked:e=>a({playbackLocked:e}),applyRemotePlayback:(e,u,o)=>{h=!0;try{e!==void 0&&G(e),Math.abs(t.playbackRate-o)>.001&&R(o),u&&s.current?.paused?I():!u&&!s.current?.paused&&Q()}finally{h=!1}},setAudioTrack:e=>{g&&t.audioTracks.some(u=>u.id===e)&&(g.audioTrack=e,a({activeAudioTrack:e}))},setSubtitleTrack:e=>{if(e!==-1&&!t.subtitleTracks.some(o=>o.id===e))return;const u=s.current;u?.querySelector("track")?Array.from(u.textTracks).forEach((o,L)=>{o.mode=L===e?"showing":"disabled"}):g&&(g.subtitleTrack=e),a({activeSubtitleTrack:e})},setQuality:e=>{g&&(e===-1||t.qualities.some(u=>u.id===e))&&(g.currentLevel=e,a({activeQuality:e}))},setSpeedBoost:e=>{if(t.playbackLocked)return;const u=e?2:S;a({isSpeedBoostActive:e,playbackRate:u}),s.current&&(s.current.playbackRate=u)},setShowControls:e=>a({showControls:e}),startScrubbing:D,endScrubbing:C,loadSource:V,unload:()=>{const e=s.current;b(e),E(),e&&(e.pause(),e.removeAttribute("src"),e.load()),a({isPlaying:!1,isBuffering:!1,duration:0,error:null}),f({currentTime:0,bufferedEnd:0})},toggleFullscreen:()=>{const e=s.current;Ke(k.current,e?.tagName==="VIDEO"?e:null).catch(u=>a({error:u instanceof Error?u.message:"Fullscreen failed."}))},reset:()=>{a({duration:0,isBuffering:!1,error:null}),f({currentTime:0,bufferedEnd:0})},destroy:()=>{if(P)return;P=!0;const e=v??s.current;b(e),_(),v=null,E(),e?.pause(),e?.removeAttribute("src"),e?.load(),H===e&&(H=null)}}}function K(n){return me(n.subscribe,n.getState)}function ge(n){return me(n.subscribeTimeline,n.getTimeline)}function et(n={}){const i=x(n),t=oe(()=>We(i.current),[]);return Te(()=>{t.connect()}),X(()=>()=>t.destroy(),[t]),oe(()=>({engine:t,mediaRef:t.mediaRef}),[t])}function Xe({children:n,...i}){const t=j(),{isPlaying:r,playbackLocked:l}=K(t);return d("button",{type:"button","aria-label":r?"Pause":"Play",...i,disabled:l||i.disabled,onClick:t.togglePlay,children:n??d(te,{name:r?"pause":"play"})})}function tt({seconds:n,children:i,...t}){const r=j(),{playbackLocked:l}=K(r);return d("button",{type:"button","aria-label":`Seek ${n<0?"back":"forward"} ${Math.abs(n)} seconds`,...t,disabled:l||t.disabled,onClick:()=>r.seekRelative(n),children:i??d(te,{name:n<0?"replay-10":"forward-10"})})}function nt(n){const i=j(),{isFullscreen:t}=K(i);return d("button",{type:"button","aria-label":t?"Exit Fullscreen":"Fullscreen",...n,onClick:i.toggleFullscreen,children:d(te,{name:t?"compress":"expand"})})}function rt({buttonClassName:n,onExpandedChange:i}){const t=j(),{isMuted:r,volume:l}=K(t);return d(qe,{muted:r,volume:l,volumeIcon:d(te,{name:r||l===0?"volume-mute":l<.5?"volume-down":"volume-up"}),buttonClassName:n,onToggleMute:t.toggleMute,onVolumeChange:t.setVolume,onExpandedChange:i})}function it({className:n}){const i=j(),{volume:t,isMuted:r}=K(i);return d("input",{type:"range",min:0,max:1,step:.01,value:r?0:t,onChange:l=>i.setVolume(Number(l.currentTarget.value)),className:n,style:{"--volume-percent":`${(r?0:t)*100}%`},"aria-label":"Volume"})}function at({classes:n,timeLabelRef:i,children:t}){const r=j(),{duration:l,isScrubbing:m,playbackLocked:s}=K(r);return d("div",{inert:s||void 0,style:{display:"contents"},children:d(Ie,{classes:n,videoRef:r.mediaRef,duration:l,formatTime:be,isScrubbing:m,onSeek:k=>r.seek(k*l),onScrubStart:r.startScrubbing,onScrubMove:k=>r.seek(k*l),onScrubEnd:r.endScrubbing,timeLabelRef:i,children:t})})}function ut({className:n}){const i=j(),{currentTime:t,bufferedEnd:r}=ge(i),{duration:l,playbackLocked:m}=K(i),s=l?Math.min(100,t/l*100):0,k=l?Math.min(100,Math.max(s,r/l*100)):0;return d("input",{type:"range",disabled:m,min:0,max:l,step:.1,value:Math.min(t,l),onChange:v=>i.seek(Number(v.currentTarget.value)),onPointerDown:v=>{v.currentTarget.setPointerCapture(v.pointerId),i.startScrubbing()},onPointerUp:i.endScrubbing,onPointerCancel:i.endScrubbing,onLostPointerCapture:i.endScrubbing,className:n,style:{"--played-percent":`${s}%`,"--buffered-percent":`${k}%`},"aria-label":"Seek"})}function lt({className:n,durationOnly:i=!1}){const t=j(),{currentTime:r}=ge(t),{duration:l}=K(t);return d("span",{className:n,children:be(i?l:r)})}function ct(){const n=j(),{error:i,playBlocked:t,isBuffering:r,playbackLocked:l}=K(n);return i?d("div",{role:"alert",children:i}):t&&l?d("span",{children:"Enable playback from the watch-along panel."}):t?d(Xe,{children:"Tap to play"}):r?d("div",{role:"status","aria-label":"Buffering",children:"Loading…"}):null}const Qe='input, textarea, button, select, a, [role="button"], [role="slider"], [contenteditable]:not([contenteditable="false"]), [data-player-ui="true"], [data-speed-boost-ignore="true"]';function ot(n,i,t=!0){const r=x(i);r.current=i,X(()=>{if(!t)return;let l=!1,m=!1,s=!1,k,v,_=!1;const E=()=>{const a=m||s;a!==_&&(_=a,n.setSpeedBoost(a))},w=a=>a instanceof Element&&!!a.closest(Qe),p=a=>{if(!n.isActive()||!n.mediaRef.current||a.defaultPrevented||a.ctrlKey||a.metaKey||a.altKey||w(a.target))return;if(a.code==="Space"){if(a.preventDefault(),l)return;l=!0,k=setTimeout(()=>{k=void 0,m=!0,E()},180),r.current();return}const f=a.key.toLowerCase();["k","j","l","arrowleft","arrowright","arrowup","arrowdown","m","f"].includes(f)&&(a.preventDefault(),!(a.repeat&&["k","m","f"].includes(f))&&(f==="k"&&n.togglePlay(),(f==="j"||f==="arrowleft")&&n.seekRelative(-10),(f==="l"||f==="arrowright")&&n.seekRelative(10),f==="arrowup"&&n.setVolume(n.getState().volume+.1),f==="arrowdown"&&n.setVolume(n.getState().volume-.1),f==="m"&&n.toggleMute(),f==="f"&&n.toggleFullscreen(),r.current()))},S=a=>{a.code!=="Space"||!l||(a.preventDefault(),l=!1,clearTimeout(k),k=void 0,m?(m=!1,E()):n.togglePlay(),r.current())},P=a=>{const f=a.target;a.button!==0||!(f instanceof Element)||w(f)||!n.containerRef.current?.contains(f)||(clearTimeout(v),v=setTimeout(()=>{v=void 0,s=!0,E()},180))},g=()=>{clearTimeout(v),v=void 0,s=!1,E()},h=()=>{clearTimeout(k),k=void 0,l=!1,m=!1,g()};return document.addEventListener("keydown",p),document.addEventListener("keyup",S),document.addEventListener("pointerdown",P),document.addEventListener("pointerup",g),document.addEventListener("pointercancel",g),window.addEventListener("blur",h),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",S),document.removeEventListener("pointerdown",P),document.removeEventListener("pointerup",g),document.removeEventListener("pointercancel",g),window.removeEventListener("blur",h),h()}},[n,t])}function st({engine:n,children:i}){return d(ye.Provider,{value:n,children:i})}export{nt as F,at as P,tt as S,it as V,Xe as a,rt as b,Ye as c,st as d,j as e,K as f,ge as g,ot as h,lt as i,ut as j,ct as k,Ze as l,$e as m,ke as n,se as s,et as u};
1
+ import{X as Ee,x as we,u as d,A as x,q as de,h as X,d as ae,T as oe,_ as Te,C as me}from"./vendor-core-DfaOB3Rn.js";import{I as te}from"./vendor-icons-C1Pj_eSX.js";import{a2 as Pe,p as pe,h as be}from"./index-BVkDKnzf.js";const ye=Ee(null);function j(){const n=we(ye);if(!n)throw new Error("Player controls must be inside a PlayerProvider.");return n}function ve(n,i){const t=j(),r=x(i);r.current=i;const l=n?.url,m=n?.hls,s=de(k=>{t.mediaRef.current=k,t.connect()},[t]);return X(()=>{if(l)return t.loadSource({url:l,hls:m},r.current)},[t,l,m]),s}function Ye({source:n,sourceOptions:i,...t}){const r=ve(n,i);return d("video",{playsInline:!0,...t,ref:r})}function Ze({source:n,sourceOptions:i,...t}){const r=ve(n,i);return d("audio",{...t,ref:r})}const Se="_shell_qjnah_1",Le="_stage_qjnah_38",Fe="_topBarTitleInfo_qjnah_59",_e="_streamDetails_qjnah_65",Re="_modeTag_qjnah_86",Me="_shellFill_qjnah_122",xe="_shellFullscreen_qjnah_130",Ce="_uiLayer_qjnah_145",Be="_engineStatus_qjnah_156",Ae="_volumeWrap_qjnah_169",De="_volumeSlider_qjnah_175",se={shell:Se,stage:Le,topBarTitleInfo:Fe,streamDetails:_e,modeTag:Re,shellFill:Me,shellFullscreen:xe,uiLayer:Ce,engineStatus:Be,volumeWrap:Ae,volumeSlider:De},Ie=({classes:n,videoRef:i,duration:t,formatTime:r,isScrubbing:l,buffered:m="auto",onSeek:s,onScrubStart:k,onScrubMove:v,onScrubEnd:_,timeLabelRef:E,children:w})=>{const p=x(null),S=x(null),P=x(null),g=x(null),h=x(null),a=x(!1),f=x(l);f.current=l;const b=x({onScrubMove:v,onScrubEnd:_});b.current={onScrubMove:v,onScrubEnd:_};const[A,$]=ae({time:0,position:null});X(()=>{const c=i.current;if(!c)return;const y=C=>{const V=C/t*100||0;p.current?.setAttribute("aria-valuenow",String(Math.round(C))),p.current?.setAttribute("aria-valuetext",`${r(C)} of ${r(t)}`),S.current&&(S.current.style.width=`${V}%`),P.current&&(P.current.style.left=`${V}%`),E?.current&&(E.current.innerText=`${r(C)} / ${r(t)}`)},R=()=>{l||y(c.currentTime)},D=()=>{if(m==="auto"&&c.buffered.length>0){const V=c.buffered.end(c.buffered.length-1)/t*100||0;g.current&&(g.current.style.width=`${V}%`)}};return y(c.currentTime),D(),c.addEventListener("timeupdate",R),c.addEventListener("progress",D),()=>{c.removeEventListener("timeupdate",R),c.removeEventListener("progress",D)}},[i,t,l,m,r,E]);const I=c=>{if(!p.current)return 0;const y=p.current.getBoundingClientRect();return y.width<=0?0:Math.min(1,Math.max(0,(c-y.left)/y.width))},Q=c=>{const y=c*t;p.current?.setAttribute("aria-valuenow",String(Math.round(y))),p.current?.setAttribute("aria-valuetext",`${r(y)} of ${r(t)}`);const R=y/t*100||0;S.current&&(S.current.style.width=`${R}%`),P.current&&(P.current.style.left=`${R}%`),E?.current&&(E.current.innerText=`${r(y)} / ${r(t)}`);const D=p.current?.getBoundingClientRect();$({time:y,position:D?c*D.width:null})};X(()=>{if(!l){h.current=null;return}const c=R=>{if(h.current!==null&&R.pointerId!==h.current||!t)return;const D=I(R.clientX);b.current.onScrubMove(D);const C=D*t;p.current?.setAttribute("aria-valuenow",String(Math.round(C))),p.current?.setAttribute("aria-valuetext",`${r(C)} of ${r(t)}`);const V=C/t*100||0;S.current&&(S.current.style.width=`${V}%`),P.current&&(P.current.style.left=`${V}%`),E?.current&&(E.current.innerText=`${r(C)} / ${r(t)}`);const e=p.current?.getBoundingClientRect();$({time:C,position:e?D*e.width:null})},y=R=>{h.current!==null&&R.pointerId!==h.current||(h.current=null,a.current=!0,R.pointerType!=="mouse"&&$({time:0,position:null}),b.current.onScrubEnd())};return document.addEventListener("pointermove",c),document.addEventListener("pointerup",y),document.addEventListener("pointercancel",y),()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",y),document.removeEventListener("pointercancel",y)}},[l,t,r,E]);const ne=c=>{if(c.pointerType==="mouse"&&c.button!==0||!i.current||!t)return;c.preventDefault(),h.current=c.pointerId;try{p.current?.setPointerCapture(c.pointerId)}catch{}f.current||(f.current=!0,k());const y=I(c.clientX);v(y),Q(y)},G=c=>{if(!t||f.current||c.pointerType!=="mouse")return;const y=I(c.clientX);$({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},Z=c=>{if(!(h.current!==null&&c.pointerId!==h.current)&&f.current){h.current=null,a.current=!0,c.pointerType!=="mouse"&&$({time:0,position:null});try{p.current?.hasPointerCapture(c.pointerId)&&p.current.releasePointerCapture(c.pointerId)}catch{}_()}};return d("div",{className:`${n.container} ${l&&n.scrubbing?n.scrubbing:""}`,ref:p,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round(i.current?.currentTime||0),"aria-disabled":!t,tabIndex:0,onClick:c=>{if(a.current){a.current=!1;return}!i.current||isNaN(t)||t===0||s(I(c.clientX))},onPointerDown:ne,onPointerMove:G,onPointerUp:Z,onPointerCancel:Z,onMouseMove:c=>{if(l||!t)return;const y=I(c.clientX);$({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{l||$({time:0,position:null})},onKeyDown:c=>{if(!(!i.current||!t)&&((c.key==="Home"||c.key==="End")&&(c.preventDefault(),s(c.key==="Home"?0:1)),c.key==="ArrowRight"||c.key==="ArrowLeft")){c.preventDefault();const y=(c.key==="ArrowRight"?5:-5)/t,R=i.current.currentTime/t||0;s(Math.min(1,Math.max(0,R+y)))}},children:[A.position!==null&&d("div",{className:n.timeBubble,style:{left:A.position},children:r(A.time)}),d("div",{className:n.bar,children:[d("div",{className:n.buffered,ref:g,style:m==="full"?{width:"100%"}:void 0}),d("div",{className:n.watched,ref:S}),d("div",{className:n.thumb,ref:P,onMouseDown:c=>{c.preventDefault(),i.current&&(f.current||k())}}),w]})]})};function re(){try{if(typeof window>"u")return!1;const n=window.matchMedia?.("(pointer: coarse)").matches??!1,t=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return n||t}catch{return!1}}function $e(){const[n,i]=ae(re);return X(()=>{i(re());let t=null;const r=()=>i(re());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",r):t.addListener(r)}catch{}return window.addEventListener("touchstart",r,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",r):t.removeListener(r))}catch{}window.removeEventListener("touchstart",r)}},[]),n}const Ne=450,qe=({muted:n,volume:i,volumeIcon:t,buttonClassName:r,sliderClassName:l,onToggleMute:m,onVolumeChange:s,onExpandedChange:k})=>{const v=$e(),[_,E]=ae(!1),w=x(null),p=x(!1),S=x(null),P=de(b=>{E(b),k?.(b)},[k]);X(()=>()=>{w.current&&window.clearTimeout(w.current)},[]),X(()=>{if(!_)return;const b=A=>{S.current&&!S.current.contains(A.target)&&P(!1)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[_,P]);const g=n?0:i,h=()=>{p.current=!1,w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{p.current=!0,P(!0)},Ne)},a=()=>{w.current&&(window.clearTimeout(w.current),w.current=null)},f=b=>{if(b.stopPropagation(),p.current){p.current=!1;return}if(v){_?m():P(!0);return}m()};return d("div",{ref:S,className:se.volumeWrap,"data-expanded":_?"true":"false",onContextMenu:b=>b.preventDefault(),children:[d("button",{type:"button",className:r,onClick:f,onPointerDown:h,onPointerUp:a,onPointerLeave:a,onContextMenu:b=>b.preventDefault(),"aria-label":n?"Unmute":"Mute","aria-expanded":_,children:t}),d("input",{type:"range",min:"0",max:"1",step:"0.05",value:g,onChange:b=>s(parseFloat(b.currentTarget.value)),onClick:b=>b.stopPropagation(),onPointerDown:b=>b.stopPropagation(),onContextMenu:b=>b.preventDefault(),className:`${se.volumeSlider} ${l??""}`,style:{"--volume-percent":`${g*100}%`},"aria-label":"Volume"})]})};let ee=null,ie=null;async function je(){return ee||(ie||(ie=Pe(()=>import("./hls-BOLXTnjL.js"),[]).then(n=>(ee=n.default,ee)).catch(()=>null)),ie)}function Ve(n){return n.canPlayType("application/vnd.apple.mpegurl")!==""||n.canPlayType("application/x-mpegURL")!==""}function ue(){return document}function le(n){const i=ue();if(document.fullscreenElement)return document.fullscreenElement;if(i.webkitFullscreenElement)return i.webkitFullscreenElement;const t=n;return t?.webkitDisplayingFullscreen?t:null}function ke(n){return le(n)!==null}async function Ue(n,i){if(le(i))return;const t=n;try{if(typeof n.requestFullscreen=="function"){await n.requestFullscreen();return}if(typeof t.webkitRequestFullscreen=="function"){await t.webkitRequestFullscreen();return}if(typeof t.webkitRequestFullScreen=="function"){await t.webkitRequestFullScreen();return}}catch{}const r=i;if(r&&typeof r.webkitEnterFullscreen=="function"){if(r.webkitSupportsFullscreen===!1)return;try{await r.webkitEnterFullscreen()}catch{}}}async function He(n){const i=ue();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(i.webkitFullscreenElement&&typeof i.webkitExitFullscreen=="function"){await i.webkitExitFullscreen();return}}catch{}const t=n;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof i.webkitCancelFullScreen=="function"?i.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??i.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function Ke(n,i){!n&&!i||(ke(i)?await He(i):n&&await Ue(n,i))}function Oe(n,i){const t=()=>{try{i(ke(n()))}catch{}},r=ue(),l=t;r.addEventListener("fullscreenchange",t),r.addEventListener("webkitfullscreenchange",l),r.addEventListener("webkitbeginfullscreen",l,!0),r.addEventListener("webkitendfullscreen",l,!0);const m=n();return m?.addEventListener("webkitbeginfullscreen",l),m?.addEventListener("webkitendfullscreen",l),()=>{r.removeEventListener("fullscreenchange",t),r.removeEventListener("webkitfullscreenchange",l),r.removeEventListener("webkitbeginfullscreen",l,!0),r.removeEventListener("webkitendfullscreen",l,!0),m?.removeEventListener("webkitbeginfullscreen",l),m?.removeEventListener("webkitendfullscreen",l)}}let H=null;function fe(n){try{return n?pe.getItem(n):null}catch{return null}}function Y(n,i){try{n&&pe.setItem(n,String(i))}catch{}}function We(n={}){const i=Number.parseFloat(fe(n.volumeKey)??"");let t={isPlaying:!1,isBuffering:!1,isMuted:fe(n.mutedKey)==="true",volume:Number.isFinite(i)?Math.max(0,Math.min(1,i)):1,duration:0,playbackRate:1,isScrubbing:!1,isFullscreen:!1,showControls:!0,isSpeedBoostActive:!1,audioTracks:[],subtitleTracks:[],qualities:[],activeAudioTrack:-1,activeSubtitleTrack:-1,activeQuality:-1,error:null,playBlocked:!1,playbackLocked:!1},r={currentTime:0,bufferedEnd:0};const l=new Set,m=new Set,s={current:null},k={current:null};let v=null,_=()=>{},E=()=>{},w=0,p=!1,S=1,P=!1,g=null,h=!1;function a(e){Object.entries(e).every(([u,o])=>Object.is(t[u],o))||(t={...t,...e},l.forEach(u=>u()))}function f(e){r.currentTime===e.currentTime&&r.bufferedEnd===e.bufferedEnd||(r=e,m.forEach(u=>u()))}function b(e){if(!e)return;let u=0;for(let o=0;o<e.buffered.length;o++)if(e.buffered.start(o)<=e.currentTime&&e.buffered.end(o)>=e.currentTime){u=e.buffered.end(o);break}f({currentTime:Number.isFinite(e.currentTime)?e.currentTime:0,bufferedEnd:u})}function A(){b(s.current)}function $(){const e=s.current;if(v===e||(v&&(H===v&&(H=e),b(v),E(),v.pause(),v.removeAttribute("src"),v.load()),_(),v=e,!e))return;P=!1,H||(H=e),e.volume=t.volume,e.muted=t.isMuted,e.playbackRate=t.playbackRate;const u=()=>{const T=Array.from(e.textTracks);if(!T.length)return;const U=T.findIndex(W=>W.mode==="showing");a({subtitleTracks:T.map((W,z)=>({id:z,label:W.label||W.language||`Track ${z+1}`,language:W.language})),...U>=0?{activeSubtitleTrack:U}:{}})},o={play:()=>{H=e,a({isPlaying:!0,playBlocked:!1,error:null})},playing:()=>a({isPlaying:!0,isBuffering:!1,playBlocked:!1}),pause:()=>a({isPlaying:!1,isBuffering:!1}),ended:()=>{a({isPlaying:!1,isBuffering:!1}),A()},waiting:()=>{!e.paused&&(e.readyState<3||e.seeking)&&a({isBuffering:!0})},canplay:()=>a({isBuffering:!1}),seeking:()=>{e.paused||a({isBuffering:!0}),A()},seeked:()=>{a({isBuffering:!1}),A()},timeupdate:()=>{A(),!e.paused&&!e.seeking&&a({isBuffering:!1})},progress:A,loadedmetadata:()=>{e.playbackRate=t.playbackRate,a({duration:Number.isFinite(e.duration)?e.duration:0}),u()},durationchange:()=>a({duration:Number.isFinite(e.duration)?e.duration:0}),ratechange:()=>{t.isSpeedBoostActive||(S=e.playbackRate),e.defaultPlaybackRate!==e.playbackRate&&(e.defaultPlaybackRate=e.playbackRate),a({playbackRate:e.playbackRate})},volumechange:()=>{a({volume:e.volume,isMuted:e.muted}),Y(n.volumeKey,e.volume),Y(n.mutedKey,e.muted)},error:()=>a({error:e.error?.message||"Unable to play this source.",isPlaying:!1,isBuffering:!1})};Object.entries(o).forEach(([T,U])=>e.addEventListener(T,U)),e.textTracks.addEventListener("addtrack",u),e.textTracks.addEventListener("removetrack",u),e.textTracks.addEventListener("change",u);const L=()=>e.tagName==="VIDEO"?e:null,O=()=>{const T=le(L());a({isFullscreen:T!==null&&(T===e||T===k.current)})},B=typeof document>"u"?()=>{}:Oe(L,O);typeof document<"u"&&O(),_=()=>{Object.entries(o).forEach(([T,U])=>e.removeEventListener(T,U)),B(),e.textTracks.removeEventListener("addtrack",u),e.textTracks.removeEventListener("removetrack",u),e.textTracks.removeEventListener("change",u)}}async function I(){if(t.playbackLocked&&!h)return!1;const e=s.current;if(!e)return!1;H=e;const u=w;try{return await e.play(),u===w}catch(o){if(u===w){const L=o instanceof Error&&o.name==="NotAllowedError",O=o instanceof Error&&o.name==="AbortError";a({isPlaying:!1,isBuffering:!1,playBlocked:L,...!L&&!O?{error:o instanceof Error?o.message:"Playback failed."}:{}})}return!1}}function Q(){t.playbackLocked&&!h||s.current?.pause()}function ne(){s.current?.paused?I():Q()}function G(e){if(t.playbackLocked&&!h)return;const u=s.current;if(!u||!Number.isFinite(e))return;let o=Math.max(0,e);if(Number.isFinite(u.duration))o=Math.min(u.duration,o);else if(u.seekable.length)for(let L=0;L<u.seekable.length;L++){if(o<=u.seekable.end(L)){o=Math.max(u.seekable.start(L),o);break}L===u.seekable.length-1&&(o=u.seekable.end(L))}u.currentTime=o,A()}function Z(e){G((s.current?.currentTime??r.currentTime)+e)}function c(e){if(!Number.isFinite(e))return;const u=Math.max(0,Math.min(1,e));a({volume:u,isMuted:u===0}),s.current&&(s.current.volume=u,s.current.muted=u===0),Y(n.volumeKey,u),Y(n.mutedKey,u===0)}function y(){const e=!t.isMuted;!e&&t.volume===0&&c(.5),a({isMuted:e}),s.current&&(s.current.muted=e),Y(n.mutedKey,e)}function R(e){if(t.playbackLocked&&!h||!Number.isFinite(e)||e<.25||e>4)return;S=e;const u=t.isSpeedBoostActive?2:e;a({playbackRate:u}),s.current&&(s.current.playbackRate=u)}function D(){t.playbackLocked||t.isScrubbing||(p=!!s.current&&!s.current.paused,a({isScrubbing:!0}),Q())}function C(){t.isScrubbing&&(a({isScrubbing:!1}),p&&I(),p=!1)}function V(e,u={}){E(),$();const o=s.current,L=++w;if(!o)return()=>{};let O=!1,B=null;const T=()=>!O&&w===L&&s.current===o;o.pause(),o.removeAttribute("src"),o.load(),a({duration:0,isPlaying:!1,isBuffering:!0,isScrubbing:!1,error:null,playBlocked:!1,audioTracks:[],subtitleTracks:[],qualities:[],activeAudioTrack:-1,activeSubtitleTrack:-1,activeQuality:-1}),f({currentTime:0,bufferedEnd:0});const U=()=>{T()&&u.initialTime&&u.initialTime>0&&G(u.initialTime)};o.addEventListener("loadedmetadata",U,{once:!0});const W=()=>{T()&&(u.onReady?.(),u.autoPlay&&T()&&I())},z=F=>{if(!T())return;const N=F instanceof Error?F:new Error(String(F));a({error:N.message,isPlaying:!1,isBuffering:!1}),u.onError?.(N)},J=()=>{O||(O=!0,o.removeEventListener("loadedmetadata",U),o.removeEventListener("error",ce),B?.destroy(),g===B&&(g=null),B=null,w===L&&w++)},ce=()=>{z(new Error(o.error?.message||"Unable to play this source.")),J()};return o.addEventListener("error",ce),E=J,(async()=>{if(e.hls){const F=await je();if(!T())return;if(F?.isSupported()){B=new F({enableWorker:!0,startPosition:u.initialTime??-1,...u.hlsConfig}),g=B;const N=B,he=()=>{T()&&a({audioTracks:N.audioTracks.map((M,q)=>({id:q,label:M.name||M.lang||`Track ${q+1}`,language:M.lang})),...o.querySelector("track")?{}:{subtitleTracks:N.subtitleTracks.map((M,q)=>({id:q,label:M.name||M.lang||`Track ${q+1}`,language:M.lang}))},qualities:N.levels.map((M,q)=>({id:q,label:M.height?`${M.height}p`:`${Math.round(M.bitrate/1e3)}k`})),activeAudioTrack:N.audioTrack,...o.querySelector("track")?{}:{activeSubtitleTrack:N.subtitleTrack},activeQuality:N.currentLevel})};for(const M of[F.Events.MANIFEST_PARSED,F.Events.AUDIO_TRACKS_UPDATED,F.Events.AUDIO_TRACK_SWITCHED,F.Events.SUBTITLE_TRACKS_UPDATED,F.Events.SUBTITLE_TRACK_SWITCH,F.Events.LEVEL_SWITCHED])N.on(M,he);if(B.on(F.Events.ERROR,(M,q)=>{q.fatal&&T()&&(z(new Error(`Stream failed (${q.details}). Try another source or reload.`)),J())}),B.once(F.Events.MANIFEST_PARSED,W),u.onHls?.(B,F),!T())return;B.loadSource(e.url),B.attachMedia(o);return}if(!Ve(o))throw new Error("HLS playback is unavailable in this browser.")}T()&&(o.src=e.url,o.load(),W())})().catch(F=>{z(F),J()}),J}return{mediaRef:s,containerRef:k,connect:$,getState:()=>t,getTimeline:()=>r,getHls:()=>g,isActive:()=>H===s.current,subscribe:e=>(l.add(e),()=>{l.delete(e)}),subscribeTimeline:e=>(m.add(e),()=>{m.delete(e)}),play:I,pause:Q,togglePlay:ne,seek:G,seekRelative:Z,setVolume:c,toggleMute:y,setPlaybackRate:R,setPlaybackLocked:e=>a({playbackLocked:e}),applyRemotePlayback:(e,u,o)=>{h=!0;try{e!==void 0&&G(e),Math.abs(t.playbackRate-o)>.001&&R(o),u&&s.current?.paused?I():!u&&!s.current?.paused&&Q()}finally{h=!1}},setAudioTrack:e=>{g&&t.audioTracks.some(u=>u.id===e)&&(g.audioTrack=e,a({activeAudioTrack:e}))},setSubtitleTrack:e=>{if(e!==-1&&!t.subtitleTracks.some(o=>o.id===e))return;const u=s.current;u?.querySelector("track")?Array.from(u.textTracks).forEach((o,L)=>{o.mode=L===e?"showing":"disabled"}):g&&(g.subtitleTrack=e),a({activeSubtitleTrack:e})},setQuality:e=>{g&&(e===-1||t.qualities.some(u=>u.id===e))&&(g.currentLevel=e,a({activeQuality:e}))},setSpeedBoost:e=>{if(t.playbackLocked)return;const u=e?2:S;a({isSpeedBoostActive:e,playbackRate:u}),s.current&&(s.current.playbackRate=u)},setShowControls:e=>a({showControls:e}),startScrubbing:D,endScrubbing:C,loadSource:V,unload:()=>{const e=s.current;b(e),E(),e&&(e.pause(),e.removeAttribute("src"),e.load()),a({isPlaying:!1,isBuffering:!1,duration:0,error:null}),f({currentTime:0,bufferedEnd:0})},toggleFullscreen:()=>{const e=s.current;Ke(k.current,e?.tagName==="VIDEO"?e:null).catch(u=>a({error:u instanceof Error?u.message:"Fullscreen failed."}))},reset:()=>{a({duration:0,isBuffering:!1,error:null}),f({currentTime:0,bufferedEnd:0})},destroy:()=>{if(P)return;P=!0;const e=v??s.current;b(e),_(),v=null,E(),e?.pause(),e?.removeAttribute("src"),e?.load(),H===e&&(H=null)}}}function K(n){return me(n.subscribe,n.getState)}function ge(n){return me(n.subscribeTimeline,n.getTimeline)}function et(n={}){const i=x(n),t=oe(()=>We(i.current),[]);return Te(()=>{t.connect()}),X(()=>()=>t.destroy(),[t]),oe(()=>({engine:t,mediaRef:t.mediaRef}),[t])}function Xe({children:n,...i}){const t=j(),{isPlaying:r,playbackLocked:l}=K(t);return d("button",{type:"button","aria-label":r?"Pause":"Play",...i,disabled:l||i.disabled,onClick:t.togglePlay,children:n??d(te,{name:r?"pause":"play"})})}function tt({seconds:n,children:i,...t}){const r=j(),{playbackLocked:l}=K(r);return d("button",{type:"button","aria-label":`Seek ${n<0?"back":"forward"} ${Math.abs(n)} seconds`,...t,disabled:l||t.disabled,onClick:()=>r.seekRelative(n),children:i??d(te,{name:n<0?"replay-10":"forward-10"})})}function nt(n){const i=j(),{isFullscreen:t}=K(i);return d("button",{type:"button","aria-label":t?"Exit Fullscreen":"Fullscreen",...n,onClick:i.toggleFullscreen,children:d(te,{name:t?"compress":"expand"})})}function rt({buttonClassName:n,onExpandedChange:i}){const t=j(),{isMuted:r,volume:l}=K(t);return d(qe,{muted:r,volume:l,volumeIcon:d(te,{name:r||l===0?"volume-mute":l<.5?"volume-down":"volume-up"}),buttonClassName:n,onToggleMute:t.toggleMute,onVolumeChange:t.setVolume,onExpandedChange:i})}function it({className:n}){const i=j(),{volume:t,isMuted:r}=K(i);return d("input",{type:"range",min:0,max:1,step:.01,value:r?0:t,onChange:l=>i.setVolume(Number(l.currentTarget.value)),className:n,style:{"--volume-percent":`${(r?0:t)*100}%`},"aria-label":"Volume"})}function at({classes:n,timeLabelRef:i,children:t}){const r=j(),{duration:l,isScrubbing:m,playbackLocked:s}=K(r);return d("div",{inert:s||void 0,style:{display:"contents"},children:d(Ie,{classes:n,videoRef:r.mediaRef,duration:l,formatTime:be,isScrubbing:m,onSeek:k=>r.seek(k*l),onScrubStart:r.startScrubbing,onScrubMove:k=>r.seek(k*l),onScrubEnd:r.endScrubbing,timeLabelRef:i,children:t})})}function ut({className:n}){const i=j(),{currentTime:t,bufferedEnd:r}=ge(i),{duration:l,playbackLocked:m}=K(i),s=l?Math.min(100,t/l*100):0,k=l?Math.min(100,Math.max(s,r/l*100)):0;return d("input",{type:"range",disabled:m,min:0,max:l,step:.1,value:Math.min(t,l),onChange:v=>i.seek(Number(v.currentTarget.value)),onPointerDown:v=>{v.currentTarget.setPointerCapture(v.pointerId),i.startScrubbing()},onPointerUp:i.endScrubbing,onPointerCancel:i.endScrubbing,onLostPointerCapture:i.endScrubbing,className:n,style:{"--played-percent":`${s}%`,"--buffered-percent":`${k}%`},"aria-label":"Seek"})}function lt({className:n,durationOnly:i=!1}){const t=j(),{currentTime:r}=ge(t),{duration:l}=K(t);return d("span",{className:n,children:be(i?l:r)})}function ct(){const n=j(),{error:i,playBlocked:t,isBuffering:r,playbackLocked:l}=K(n);return i?d("div",{role:"alert",children:i}):t&&l?d("span",{children:"Enable playback from the watch-along panel."}):t?d(Xe,{children:"Tap to play"}):r?d("div",{role:"status","aria-label":"Buffering",children:"Loading…"}):null}const Qe='input, textarea, button, select, a, [role="button"], [role="slider"], [contenteditable]:not([contenteditable="false"]), [data-player-ui="true"], [data-speed-boost-ignore="true"]';function ot(n,i,t=!0){const r=x(i);r.current=i,X(()=>{if(!t)return;let l=!1,m=!1,s=!1,k,v,_=!1;const E=()=>{const a=m||s;a!==_&&(_=a,n.setSpeedBoost(a))},w=a=>a instanceof Element&&!!a.closest(Qe),p=a=>{if(!n.isActive()||!n.mediaRef.current||a.defaultPrevented||a.ctrlKey||a.metaKey||a.altKey||w(a.target))return;if(a.code==="Space"){if(a.preventDefault(),l)return;l=!0,k=setTimeout(()=>{k=void 0,m=!0,E()},180),r.current();return}const f=a.key.toLowerCase();["k","j","l","arrowleft","arrowright","arrowup","arrowdown","m","f"].includes(f)&&(a.preventDefault(),!(a.repeat&&["k","m","f"].includes(f))&&(f==="k"&&n.togglePlay(),(f==="j"||f==="arrowleft")&&n.seekRelative(-10),(f==="l"||f==="arrowright")&&n.seekRelative(10),f==="arrowup"&&n.setVolume(n.getState().volume+.1),f==="arrowdown"&&n.setVolume(n.getState().volume-.1),f==="m"&&n.toggleMute(),f==="f"&&n.toggleFullscreen(),r.current()))},S=a=>{a.code!=="Space"||!l||(a.preventDefault(),l=!1,clearTimeout(k),k=void 0,m?(m=!1,E()):n.togglePlay(),r.current())},P=a=>{const f=a.target;a.button!==0||!(f instanceof Element)||w(f)||!n.containerRef.current?.contains(f)||(clearTimeout(v),v=setTimeout(()=>{v=void 0,s=!0,E()},180))},g=()=>{clearTimeout(v),v=void 0,s=!1,E()},h=()=>{clearTimeout(k),k=void 0,l=!1,m=!1,g()};return document.addEventListener("keydown",p),document.addEventListener("keyup",S),document.addEventListener("pointerdown",P),document.addEventListener("pointerup",g),document.addEventListener("pointercancel",g),window.addEventListener("blur",h),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",S),document.removeEventListener("pointerdown",P),document.removeEventListener("pointerup",g),document.removeEventListener("pointercancel",g),window.removeEventListener("blur",h),h()}},[n,t])}function st({engine:n,children:i}){return d(ye.Provider,{value:n,children:i})}export{nt as F,at as P,tt as S,it as V,Xe as a,rt as b,Ye as c,st as d,j as e,K as f,ge as g,ot as h,lt as i,ut as j,ct as k,Ze as l,$e as m,ke as n,se as s,et as u};
@@ -1 +1 @@
1
- import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{u as ae,p as se}from"./index-CuAIqL2m.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as le,O as A,a as ie,A as ce,b as re}from"./OptionListMenu-DpPePCh7.js";import"./vendor-query-BBT5_sHx.js";import"./useWatchAlongPlayer-C1iSTWOt.js";import"./PlayerProvider-zJDJ7w2h.js";import"./playbackCompletion-Dz5SRhiZ.js";const oe="_settingsPanel_mcacu_1",me="_header_mcacu_35",de="_backBtn_mcacu_58",ue="_contentWrapper_mcacu_78",he="_menuContent_mcacu_84",pe="_menuItem_mcacu_91",be="_selected_mcacu_116",ge="_currentValue_mcacu_136",ke="_menuNote_mcacu_143",ve="_menuError_mcacu_152",n={settingsPanel:oe,header:me,backBtn:de,contentWrapper:ue,menuContent:he,menuItem:pe,selected:be,currentValue:ge,menuNote:ke,menuError:ve},ye=($,P)=>{const{isOpen:g,onClose:Ce,videoSources:fe,currentSource:C,currentLink:f,onSourceChange:V,subtitles:O,activeSubtitleTrack:k,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:v,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:N,anime4kProfile:c,onAnime4kProfileChange:h,anime4kInitializing:L,anime4kError:S,videoDelayEnabled:_,onVideoDelayToggle:M,videoDelayMs:I,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:m,onAutoSkipChange:W,isAutoplayEnabled:d,onAutoplayChange:G,fallbackChoice:p,onFallbackChoiceChange:j,isTheaterMode:q,ambientSettings:b,onAmbientChange:y}=$,{lowEndMode:F}=ae(),[a,i]=ne("main");w.useEffect(()=>{if(!g){const t=setTimeout(()=>i("main"),300);return()=>clearTimeout(t)}},[g]);const Q=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>i("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:f?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:k||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),F&&e("button",{className:`${n.menuItem} ${v?n.selected:""}`,onClick:()=>{const t=!v;U(t),se.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),v&&e(o,{name:"check",size:12})]}),N&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),N&&u&&e("button",{className:n.menuItem,onClick:()=>i("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>i("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:_?`${I}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[m?"Auto-skip On":null,d?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]}),q&&b&&y&&e("button",{className:n.menuItem,onClick:()=>i("ambient"),children:[e("span",{children:"Ambient Light"}),e("span",{className:n.currentValue,children:b.enabled?"On":"Off"})]})]}),R=()=>{const t=[...C?.links??[]].sort((s,r)=>(parseInt(r.resolutionStr)||0)-(parseInt(s.resolutionStr)||0));return e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.link,label:s.resolutionStr,selected:f?.link===s.link})),onSelect:s=>{const r=t.find(l=>l.link===s);r&&V(C,r)}})})},H=()=>e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:k==="off"},...O.map(t=>({key:t.label||t.lang,label:t.label,selected:k===(t.label||t.lang)}))],onSelect:t=>E(t)})}),K=()=>e("div",{className:n.menuContent,children:e(ie,{classes:{item:n.menuItem,active:n.selected},values:z,onChange:T})}),J=te(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const r=navigator.userAgent.toLowerCase();return r.includes("chrome")||r.includes("chromium")||r.includes("edg")}catch{return!0}},[]),X=()=>e("div",{className:n.menuContent,children:[L&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),S&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",S]}),!J&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${c==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),c==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),c==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),c==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),c==="denoise"&&e(o,{name:"check",size:12})]})]}),Y=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>W(!m),"aria-pressed":m,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>G(!d),"aria-pressed":d,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>j(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),Z=()=>e("div",{className:n.menuContent,children:e(ce,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:_,delayMs:I,onToggle:M,onDelayChange:D,onCalibrate:x})}),ee=()=>b&&y?e("div",{className:n.menuContent,children:e(re,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:y})}):null;return g?e(le,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a==="ambient"?"Ambient Light":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>i("main"),panelRef:P,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&Q(),a==="quality"&&R(),a==="subtitles"&&H(),a==="subtitle-style"&&K(),a==="upscaler"&&X(),a==="av-sync"&&Z(),a==="playback"&&Y(),a==="ambient"&&ee()]}):null},Ve=w.forwardRef(ye);export{Ve as default};
1
+ import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{u as ae,p as se}from"./index-BVkDKnzf.js";import{I as o}from"./vendor-icons-C1Pj_eSX.js";import{S as le,O as A,a as ie,A as ce,b as re}from"./OptionListMenu-BRI8vna9.js";import"./vendor-query-BBT5_sHx.js";import"./useWatchAlongPlayer-BTSgNMqR.js";import"./PlayerProvider-9AfeIQ6B.js";import"./playbackCompletion-Bgy18e-S.js";const oe="_settingsPanel_mcacu_1",me="_header_mcacu_35",de="_backBtn_mcacu_58",ue="_contentWrapper_mcacu_78",he="_menuContent_mcacu_84",pe="_menuItem_mcacu_91",be="_selected_mcacu_116",ge="_currentValue_mcacu_136",ke="_menuNote_mcacu_143",ve="_menuError_mcacu_152",n={settingsPanel:oe,header:me,backBtn:de,contentWrapper:ue,menuContent:he,menuItem:pe,selected:be,currentValue:ge,menuNote:ke,menuError:ve},ye=($,P)=>{const{isOpen:g,onClose:Ce,videoSources:fe,currentSource:C,currentLink:f,onSourceChange:V,subtitles:O,activeSubtitleTrack:k,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:v,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:N,anime4kProfile:c,onAnime4kProfileChange:h,anime4kInitializing:L,anime4kError:S,videoDelayEnabled:_,onVideoDelayToggle:M,videoDelayMs:I,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:m,onAutoSkipChange:W,isAutoplayEnabled:d,onAutoplayChange:G,fallbackChoice:p,onFallbackChoiceChange:j,isTheaterMode:q,ambientSettings:b,onAmbientChange:y}=$,{lowEndMode:F}=ae(),[a,i]=ne("main");w.useEffect(()=>{if(!g){const t=setTimeout(()=>i("main"),300);return()=>clearTimeout(t)}},[g]);const Q=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>i("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:f?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:k||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),F&&e("button",{className:`${n.menuItem} ${v?n.selected:""}`,onClick:()=>{const t=!v;U(t),se.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),v&&e(o,{name:"check",size:12})]}),N&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),N&&u&&e("button",{className:n.menuItem,onClick:()=>i("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>i("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:_?`${I}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[m?"Auto-skip On":null,d?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]}),q&&b&&y&&e("button",{className:n.menuItem,onClick:()=>i("ambient"),children:[e("span",{children:"Ambient Light"}),e("span",{className:n.currentValue,children:b.enabled?"On":"Off"})]})]}),R=()=>{const t=[...C?.links??[]].sort((s,r)=>(parseInt(r.resolutionStr)||0)-(parseInt(s.resolutionStr)||0));return e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.link,label:s.resolutionStr,selected:f?.link===s.link})),onSelect:s=>{const r=t.find(l=>l.link===s);r&&V(C,r)}})})},H=()=>e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:k==="off"},...O.map(t=>({key:t.label||t.lang,label:t.label,selected:k===(t.label||t.lang)}))],onSelect:t=>E(t)})}),K=()=>e("div",{className:n.menuContent,children:e(ie,{classes:{item:n.menuItem,active:n.selected},values:z,onChange:T})}),J=te(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const r=navigator.userAgent.toLowerCase();return r.includes("chrome")||r.includes("chromium")||r.includes("edg")}catch{return!0}},[]),X=()=>e("div",{className:n.menuContent,children:[L&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),S&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",S]}),!J&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${c==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),c==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),c==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),c==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),c==="denoise"&&e(o,{name:"check",size:12})]})]}),Y=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>W(!m),"aria-pressed":m,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>G(!d),"aria-pressed":d,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>j(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),Z=()=>e("div",{className:n.menuContent,children:e(ce,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:_,delayMs:I,onToggle:M,onDelayChange:D,onCalibrate:x})}),ee=()=>b&&y?e("div",{className:n.menuContent,children:e(re,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:y})}):null;return g?e(le,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a==="ambient"?"Ambient Light":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>i("main"),panelRef:P,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&Q(),a==="quality"&&R(),a==="subtitles"&&H(),a==="subtitle-style"&&K(),a==="upscaler"&&X(),a==="av-sync"&&Z(),a==="playback"&&Y(),a==="ambient"&&ee()]}):null},Ve=w.forwardRef(ye);export{Ve as default};
@@ -1 +1 @@
1
- import{b as T}from"./vendor-query-BBT5_sHx.js";import{q as z,t as A,x as J,as as W,at as X,au as Y}from"./index-CuAIqL2m.js";import{d as Z,T as R,q as r,u as t,$ as w,S as ee}from"./vendor-core-DfaOB3Rn.js";import{a as te,c as ne,d as se,b as ae,o as oe,f as ie,s as re}from"./vendor-ui-3qrARCPr.js";import{I as u}from"./vendor-icons-DrybRNxP.js";function Ee(n){return T({queryKey:[z.showMeta,n],queryFn:async()=>n?A.data.showMeta.query({id:n}):{},enabled:!!n,staleTime:3e4})}const ue="_trigger_1vova_6",me="_triggerBtn_1vova_11",le="_chevron_1vova_25",ce="_menu_1vova_34",pe="_menuTitle_1vova_51",de="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",o={trigger:ue,triggerBtn:me,chevron:le,menu:ce,menuTitle:pe,menuItem:de,removeItem:ge,menuEmpty:fe},ve=8,Pe=({showId:n,showName:v,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:D="",activeClassName:F="",align:M="right",onMenuOpenChange:d})=>{const{data:q=[]}=J(),E=W(),P=X(),[m,f]=Z(!1),{refs:Q,floatingStyles:x,context:C}=te({open:m,onOpenChange:e=>{e||(f(!1),d?.(!1))},placement:M==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ie({padding:8}),re({padding:8})],whileElementsMounted:ae}),I=ne(C,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:S,getFloatingProps:K}=se([I]),l=R(()=>q.filter(e=>e.showId===n),[q,n]),{data:L}=T({queryKey:[z.suggestedEpisode,n],queryFn:()=>A.watchlist.queueSuggested.query({showId:n}),enabled:!!n}),{data:$,isFetching:N}=Y(n,m),s=R(()=>$?.episodes||[],[$]),k=r(()=>{f(!0),d?.(!0)},[d]),c=r(()=>{f(!1),d?.(!1)},[d]),p=l.length>0,a=s.length>0,g=L?.episodeNumber,i=r(e=>{!n||e.length===0||(E.mutate({showId:n,episodeNumbers:e,showName:v,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,v,h,y,_,b,E,c]),O=r(()=>{!n||l.length===0||(P.mutate({showId:n,episodeNumbers:l.map(e=>e.episodeNumber)}),c())},[n,l,P,c]),U=r(()=>{a?i([s[0]]):g&&i([String(g)])},[a,s,g,i]),G=r(()=>{a&&i(s.slice(0,3))},[a,s,i]),V=r(()=>{a&&i([...s])},[a,s,i]),B=s[0],j=s[Math.min(2,s.length-1)],H=t("div",{className:o.trigger,ref:Q.setReference,children:t("span",{className:`${o.triggerBtn} ${D} ${p?F:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,"aria-label":p?"Queued":"Queue",...S(),onClick:e=>{e.preventDefault(),e.stopPropagation(),m?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),m?c():k())},children:[p?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),p?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:o.chevron})]})});return t(ee,{children:[H,m&&w(t("div",{ref:Q.setFloating,className:o.menu,style:x,role:"menu",...K(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:o.menuTitle,children:"Queue episodes"}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a&&!g,onClick:e=>{e.stopPropagation(),U()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+1 — EP ${B}`:`+1 — EP ${g||"?"}`})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),G()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+3 — EP ${B}${s.length>1?`-${j}`:""}`:"+3"})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),V()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:o.menuEmpty,children:p?"All episodes are already queued":"No remaining unwatched episodes"}),p&&t("button",{className:`${o.menuItem} ${o.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",l.length>0?` (${l.length})`:""]})]})]}),document.body)]})};export{Pe as Q,Ee as u};
1
+ import{b as T}from"./vendor-query-BBT5_sHx.js";import{q as z,t as A,x as J,as as W,at as X,au as Y}from"./index-BVkDKnzf.js";import{d as Z,T as R,q as r,u as t,$ as w,S as ee}from"./vendor-core-DfaOB3Rn.js";import{a as te,c as ne,d as se,b as ae,o as oe,f as ie,s as re}from"./vendor-ui-3qrARCPr.js";import{I as u}from"./vendor-icons-C1Pj_eSX.js";function Ee(n){return T({queryKey:[z.showMeta,n],queryFn:async()=>n?A.data.showMeta.query({id:n}):{},enabled:!!n,staleTime:3e4})}const ue="_trigger_1vova_6",me="_triggerBtn_1vova_11",le="_chevron_1vova_25",ce="_menu_1vova_34",pe="_menuTitle_1vova_51",de="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",o={trigger:ue,triggerBtn:me,chevron:le,menu:ce,menuTitle:pe,menuItem:de,removeItem:ge,menuEmpty:fe},ve=8,Pe=({showId:n,showName:v,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:D="",activeClassName:F="",align:M="right",onMenuOpenChange:d})=>{const{data:q=[]}=J(),E=W(),P=X(),[m,f]=Z(!1),{refs:Q,floatingStyles:x,context:C}=te({open:m,onOpenChange:e=>{e||(f(!1),d?.(!1))},placement:M==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ie({padding:8}),re({padding:8})],whileElementsMounted:ae}),I=ne(C,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:S,getFloatingProps:K}=se([I]),l=R(()=>q.filter(e=>e.showId===n),[q,n]),{data:L}=T({queryKey:[z.suggestedEpisode,n],queryFn:()=>A.watchlist.queueSuggested.query({showId:n}),enabled:!!n}),{data:$,isFetching:N}=Y(n,m),s=R(()=>$?.episodes||[],[$]),k=r(()=>{f(!0),d?.(!0)},[d]),c=r(()=>{f(!1),d?.(!1)},[d]),p=l.length>0,a=s.length>0,g=L?.episodeNumber,i=r(e=>{!n||e.length===0||(E.mutate({showId:n,episodeNumbers:e,showName:v,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,v,h,y,_,b,E,c]),O=r(()=>{!n||l.length===0||(P.mutate({showId:n,episodeNumbers:l.map(e=>e.episodeNumber)}),c())},[n,l,P,c]),U=r(()=>{a?i([s[0]]):g&&i([String(g)])},[a,s,g,i]),G=r(()=>{a&&i(s.slice(0,3))},[a,s,i]),V=r(()=>{a&&i([...s])},[a,s,i]),B=s[0],j=s[Math.min(2,s.length-1)],H=t("div",{className:o.trigger,ref:Q.setReference,children:t("span",{className:`${o.triggerBtn} ${D} ${p?F:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,"aria-label":p?"Queued":"Queue",...S(),onClick:e=>{e.preventDefault(),e.stopPropagation(),m?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),m?c():k())},children:[p?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),p?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:o.chevron})]})});return t(ee,{children:[H,m&&w(t("div",{ref:Q.setFloating,className:o.menu,style:x,role:"menu",...K(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:o.menuTitle,children:"Queue episodes"}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a&&!g,onClick:e=>{e.stopPropagation(),U()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+1 — EP ${B}`:`+1 — EP ${g||"?"}`})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),G()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+3 — EP ${B}${s.length>1?`-${j}`:""}`:"+3"})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),V()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:o.menuEmpty,children:p?"All episodes are already queued":"No remaining unwatched episodes"}),p&&t("button",{className:`${o.menuItem} ${o.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",l.length>0?` (${l.length})`:""]})]})]}),document.body)]})};export{Pe as Q,Ee as u};
@@ -1 +1 @@
1
- import{g as s,u as n,a as X}from"./vendor-core-DfaOB3Rn.js";import{I as D}from"./vendor-icons-DrybRNxP.js";import{d as Y,f as L}from"./index-CuAIqL2m.js";const z="_section_5peha_1",F="_header_5peha_10",O="_headerToggle_5peha_20",j="_headerActions_5peha_34",J="_title_5peha_40",K="_badge_5peha_50",V="_clearBtn_5peha_65",W="_nextBtn_5peha_83",Z="_list_5peha_101",ee="_item_5peha_115",ne="_active_5peha_135",te="_dragging_5peha_143",re="_dragHandle_5peha_150",ae="_thumbnail_5peha_168",oe="_meta_5peha_176",ce="_name_5peha_183",se="_episode_5peha_205",ie="_iconBtn_5peha_211",le="_metaGap_5peha_257",r={section:z,header:F,headerToggle:O,headerActions:j,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ae,meta:oe,name:ce,episode:se,iconBtn:ie,metaGap:le},ue=({item:a,isActive:w,index:g,onRemove:v,onTouchPointerDown:x,onTouchPointerMove:B,onTouchPointerUp:I,onTouchPointerCancel:y,shouldIgnoreClick:_,onDragStart:R,onDragEnter:f,onDragEnd:c,isDragging:b})=>{const o=X(),{titlePreference:i}=Y(),l=a[i]||a.name||"Unknown show";return n("div",{"data-queue-index":g,className:`${r.item} ${w?r.active:""} ${b?r.dragging:""}`,draggable:!0,onDragStart:R,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:c,onPointerDown:u=>x(g,u),onPointerMove:B,onPointerUp:I,onPointerCancel:y,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(D,{name:"bars"})}),n("img",{className:r.thumbnail,src:L(a.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||o(`/watch/${a.showId}/${a.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",a.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||v(a)},"aria-label":`Remove ${l} episode ${a.episodeNumber} from queue`,children:n(D,{name:"times"})})]})},me=({title:a="Queue",eyebrow:w,items:g,currentShowId:v,currentEpisode:x,onRemove:B,onReorder:I,onNextQueue:y,onClear:_,showClearAll:R=!1,defaultExpanded:f=!0})=>{const[c,b]=s.useState([]),[o,i]=s.useState(null),[l,u]=s.useState(f),N=s.useRef(null),T=s.useRef(null),d=s.useRef(null),h=s.useRef(!1),C=s.useRef(!1);s.useEffect(()=>{b(g)},[g]),s.useEffect(()=>{u(f)},[f]);const $=e=>{i(e)},k=e=>{if(o===null||o===e)return;const t=[...c],p=t[o];t.splice(o,1),t.splice(e,0,p),i(e),b(t)},A=()=>{o!==null&&I(c.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},E=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&h.current&&(I(c.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),C.current=!0,window.setTimeout(()=>{C.current=!1},0)),N.current=null,T.current=null,h.current=!1,i(null)},Q=(e,t)=>{if(t.pointerType==="mouse")return;const p=t.currentTarget,m=t.pointerId;N.current=t.pointerId,T.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{h.current=!0,i(e);try{p.setPointerCapture(m)}catch{}},220)},S=e=>{if(e.pointerType==="mouse"||N.current!==e.pointerId)return;if(!h.current&&T.current){const H=Math.abs(e.clientX-T.current.x),G=Math.abs(e.clientY-T.current.y);(H>8||G>8)&&E(!1);return}if(!h.current)return;e.preventDefault();const p=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),m=p?Number(p.dataset.queueIndex):NaN;if(Number.isNaN(m)||o===null||m===o)return;const P=[...c],U=P[o];P.splice(o,1),P.splice(m,0,U),i(m),b(P)},q=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(h.current)},M=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(!1)};return c.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${a}`:`Expand ${a}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[w&&n("div",{className:"section-eyebrow",children:w}),n("span",{children:a})]}),n("span",{className:r.badge,children:c.length})]}),l?n(D,{name:"chevron-up"}):n(D,{name:"chevron-down"})]}),R&&_&&n("div",{className:r.headerActions,children:[y&&c.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:y,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:c.map((e,t)=>n(ue,{item:e,isActive:e.showId===v&&e.episodeNumber===x,index:t,onRemove:B,onTouchPointerDown:Q,onTouchPointerMove:S,onTouchPointerUp:q,onTouchPointerCancel:M,shouldIgnoreClick:()=>C.current,onDragStart:()=>$(t),onDragEnter:()=>k(t),onDragEnd:A,isDragging:o===t},e.id))})]})};export{me as Q,r as s};
1
+ import{g as s,u as n,a as X}from"./vendor-core-DfaOB3Rn.js";import{I as D}from"./vendor-icons-C1Pj_eSX.js";import{d as Y,f as L}from"./index-BVkDKnzf.js";const z="_section_5peha_1",F="_header_5peha_10",O="_headerToggle_5peha_20",j="_headerActions_5peha_34",J="_title_5peha_40",K="_badge_5peha_50",V="_clearBtn_5peha_65",W="_nextBtn_5peha_83",Z="_list_5peha_101",ee="_item_5peha_115",ne="_active_5peha_135",te="_dragging_5peha_143",re="_dragHandle_5peha_150",ae="_thumbnail_5peha_168",oe="_meta_5peha_176",ce="_name_5peha_183",se="_episode_5peha_205",ie="_iconBtn_5peha_211",le="_metaGap_5peha_257",r={section:z,header:F,headerToggle:O,headerActions:j,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ae,meta:oe,name:ce,episode:se,iconBtn:ie,metaGap:le},ue=({item:a,isActive:w,index:g,onRemove:v,onTouchPointerDown:x,onTouchPointerMove:B,onTouchPointerUp:I,onTouchPointerCancel:y,shouldIgnoreClick:_,onDragStart:R,onDragEnter:f,onDragEnd:c,isDragging:b})=>{const o=X(),{titlePreference:i}=Y(),l=a[i]||a.name||"Unknown show";return n("div",{"data-queue-index":g,className:`${r.item} ${w?r.active:""} ${b?r.dragging:""}`,draggable:!0,onDragStart:R,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:c,onPointerDown:u=>x(g,u),onPointerMove:B,onPointerUp:I,onPointerCancel:y,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(D,{name:"bars"})}),n("img",{className:r.thumbnail,src:L(a.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||o(`/watch/${a.showId}/${a.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",a.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||v(a)},"aria-label":`Remove ${l} episode ${a.episodeNumber} from queue`,children:n(D,{name:"times"})})]})},me=({title:a="Queue",eyebrow:w,items:g,currentShowId:v,currentEpisode:x,onRemove:B,onReorder:I,onNextQueue:y,onClear:_,showClearAll:R=!1,defaultExpanded:f=!0})=>{const[c,b]=s.useState([]),[o,i]=s.useState(null),[l,u]=s.useState(f),N=s.useRef(null),T=s.useRef(null),d=s.useRef(null),h=s.useRef(!1),C=s.useRef(!1);s.useEffect(()=>{b(g)},[g]),s.useEffect(()=>{u(f)},[f]);const $=e=>{i(e)},k=e=>{if(o===null||o===e)return;const t=[...c],p=t[o];t.splice(o,1),t.splice(e,0,p),i(e),b(t)},A=()=>{o!==null&&I(c.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},E=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&h.current&&(I(c.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),C.current=!0,window.setTimeout(()=>{C.current=!1},0)),N.current=null,T.current=null,h.current=!1,i(null)},Q=(e,t)=>{if(t.pointerType==="mouse")return;const p=t.currentTarget,m=t.pointerId;N.current=t.pointerId,T.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{h.current=!0,i(e);try{p.setPointerCapture(m)}catch{}},220)},S=e=>{if(e.pointerType==="mouse"||N.current!==e.pointerId)return;if(!h.current&&T.current){const H=Math.abs(e.clientX-T.current.x),G=Math.abs(e.clientY-T.current.y);(H>8||G>8)&&E(!1);return}if(!h.current)return;e.preventDefault();const p=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),m=p?Number(p.dataset.queueIndex):NaN;if(Number.isNaN(m)||o===null||m===o)return;const P=[...c],U=P[o];P.splice(o,1),P.splice(m,0,U),i(m),b(P)},q=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(h.current)},M=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(!1)};return c.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${a}`:`Expand ${a}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[w&&n("div",{className:"section-eyebrow",children:w}),n("span",{children:a})]}),n("span",{className:r.badge,children:c.length})]}),l?n(D,{name:"chevron-up"}):n(D,{name:"chevron-down"})]}),R&&_&&n("div",{className:r.headerActions,children:[y&&c.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:y,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:c.map((e,t)=>n(ue,{item:e,isActive:e.showId===v&&e.episodeNumber===x,index:t,onRemove:B,onTouchPointerDown:Q,onTouchPointerMove:S,onTouchPointerUp:q,onTouchPointerCancel:M,shouldIgnoreClick:()=>C.current,onDragStart:()=>$(t),onDragEnter:()=>k(t),onDragEnd:A,isDragging:o===t},e.id))})]})};export{me as Q,r as s};
@@ -1 +1 @@
1
- import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-DMGlm3fW.js";import{L as F}from"./LibraryListPage-CIqBrHf2.js";import{u as _,M as q}from"./useMangaPopup-iiJ4p_Bv.js";import{M as D}from"./MangaResetProgressModal-BBIVaAVA.js";import{m as G}from"./index-CuAIqL2m.js";import{n as O,b as Q,h as Y,j,u as z,o as H,q as K,s as V,M as R,m as Z,i as J,a as W}from"./useMangaLibrary-BN6UWIDi.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-GDXcsFKz.js";import"./SkeletonGrid-DSalPIgd.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-CRmjBIiM.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-CXA8qvJE.js";const X=["All","Continue Reading",...R],h=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function Ra(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=O(r?"All":e,g,h),s=Q(100),I=Y(),T=j(),{toggle:L,bookmarkedIds:C}=z(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:f}=_(),M=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.watchlistStatus??"",contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),$=r?s.data?.total??0:n.data?.total??0,A=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...R],entries:S,total:$,isLoading:A,error:N,page:g,pageSize:h,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>M.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate({ids:a}):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:G(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:J(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(q,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:f}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{Ra as default};
1
+ import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-CeCsiCpy.js";import{L as F}from"./LibraryListPage-D-SFU6Ob.js";import{u as _,M as q}from"./useMangaPopup-C1YDuijt.js";import{M as D}from"./MangaResetProgressModal-BUz2MLDA.js";import{m as G}from"./index-BVkDKnzf.js";import{n as O,b as Q,h as Y,j,u as z,o as H,q as K,s as V,M as R,m as Z,i as J,a as W}from"./useMangaLibrary-CD_MzvM_.js";import"./vendor-icons-C1Pj_eSX.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-CC0bqpsd.js";import"./SkeletonGrid-B3ip19ry.js";import"./ErrorMessage-hMt90aG4.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-2EZzznJV.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-ar7SX0CJ.js";const X=["All","Continue Reading",...R],h=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function Ra(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=O(r?"All":e,g,h),s=Q(100),I=Y(),T=j(),{toggle:L,bookmarkedIds:C}=z(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:f}=_(),M=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.watchlistStatus??"",contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),$=r?s.data?.total??0:n.data?.total??0,A=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...R],entries:S,total:$,isLoading:A,error:N,page:g,pageSize:h,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>M.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate({ids:a}):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:G(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:J(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(q,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:f}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{Ra as default};
@@ -1 +1 @@
1
- import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{Q as a,B as c}from"./index-CuAIqL2m.js";const g=({isOpen:o,itemName:n,progressKind:d,listLabel:i,onClose:s,onConfirm:h})=>{const[l,r]=f(!1);return u(()=>{o&&r(!1)},[o]),e(a,{isOpen:o,onClose:()=>{r(!1),s()},title:"Reset Progress",children:[e(a.Body,{children:[e("p",{children:["Are you sure you want to remove your ",d,' progress for "',n,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:l,onChange:t=>r(t.currentTarget.checked)}),"Also remove from ",i]})]}),e(a.Actions,{children:[e(c,{variant:"secondary",onClick:()=>{r(!1),s()},children:"No"}),e(c,{variant:"danger",onClick:()=>{const t=l;r(!1),h(t),s()},children:"Yes"})]})]})};export{g as R};
1
+ import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{Q as a,B as c}from"./index-BVkDKnzf.js";const g=({isOpen:o,itemName:n,progressKind:d,listLabel:i,onClose:s,onConfirm:h})=>{const[l,r]=f(!1);return u(()=>{o&&r(!1)},[o]),e(a,{isOpen:o,onClose:()=>{r(!1),s()},title:"Reset Progress",children:[e(a.Body,{children:[e("p",{children:["Are you sure you want to remove your ",d,' progress for "',n,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:l,onChange:t=>r(t.currentTarget.checked)}),"Also remove from ",i]})]}),e(a.Actions,{children:[e(c,{variant:"secondary",onClick:()=>{r(!1),s()},children:"No"}),e(c,{variant:"danger",onClick:()=>{const t=l;r(!1),h(t),s()},children:"Yes"})]})]})};export{g as R};
@@ -1 +1 @@
1
- import{h as Y,p as pe,a as fe,d as c,A as ge,g as Le,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as f}from"./vendor-icons-DrybRNxP.js";import{P as te}from"./MediaCard-DMGlm3fW.js";import{A as Ae}from"./AnimeCard-Bxo3dYi6.js";import{S as Se}from"./SkeletonGrid-DSalPIgd.js";import{t as ye,u as be,G as Ce,a9 as le,B as U,aa as Ne}from"./index-CuAIqL2m.js";import{E as Te}from"./ErrorMessage-DAxegITP.js";import{A as Ee}from"./ActiveFilterChips-olGfwxle.js";import{s as t}from"./Search.module-C_qwCdHS.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-GDXcsFKz.js";import"./useAnimeInfoData-B3zX9ouO.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-C40FPjKy.js";import"./playbackCompletion-Dz5SRhiZ.js";const Re=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Pe=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ie=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],De=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Oe=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function We(){Y(()=>{document.title="Search - dango"},[]);const[r,se]=pe(),k=fe(),[d,$]=c(r.get("query")||""),[v,F]=c(parseInt(r.get("page")||"1")),[h,g]=c(r.get("type")||"ALL"),[L,A]=c(r.get("season")||"ALL"),[S,y]=c(r.get("year")||"ALL"),[M,D]=c(r.get("country")||"ALL"),[V,re]=c(r.get("provider")||"anilist"),[j,O]=c(r.get("sortBy")||"POPULARITY_DESC"),[q,w]=c(r.get("status")||""),[b,ne]=c(!1),[ie,z]=c(null);Y(()=>{let e=!1;return ye.data.anilistStatus.query().then(s=>{e||z(s.available)}).catch(()=>{e||z(!0)}),()=>{e=!0}},[]);const{lowEndMode:oe}=be(),_=ge(null),{data:ce}=Ce(),H=ce?.genres||[],[C,N]=c(()=>{const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],i=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return s.forEach(l=>l&&(e[l]="include")),i.forEach(l=>l&&(e[l]="exclude")),e}),W=new URLSearchParams(r);W.delete("page");const J=W.toString(),{data:p=[],isLoading:T,isError:ue,error:de}=le(J,v,14),{data:K}=le(J,v+1,14),[x,he]=c(!1),E=Le.useMemo(()=>V==="anilist"&&h==="ADULT"||x?p:p.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[p,x,V,h]);Y(()=>{$(r.get("query")||""),g(r.get("type")||"ALL"),A(r.get("season")||"ALL"),y(r.get("year")||"ALL"),D(r.get("country")||"ALL"),re(r.get("provider")||"anilist"),O(r.get("sortBy")||"POPULARITY_DESC"),w(r.get("status")||""),F(parseInt(r.get("page")||"1"));const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],i=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];s.forEach(l=>l&&(e[l]="include")),i.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const u=(e=1,s={})=>{Ne();const i=s.type??h,l=s.status??q,R=s.season??L,P=s.year??S,Z=s.country??M,I=s.sort??j,ee=s.genreState??C,ve=s.showMature??x,o=new URLSearchParams;d.trim()&&o.set("query",d.trim()),i!=="ALL"&&o.set("type",i),l&&o.set("status",l),R!=="ALL"&&o.set("season",R),P!=="ALL"&&o.set("year",P),Z!=="ALL"&&o.set("country",Z),I!=="POPULARITY_DESC"&&o.set("sortBy",I);const G=Object.entries(ee).filter(([,n])=>n==="include").map(([n])=>n),ae=Object.entries(ee).filter(([,n])=>n==="exclude").map(([n])=>n);if(G.some(n=>n.toLowerCase()==="hentai")){const n=new URLSearchParams;n.set("provider","anilist"),d.trim()&&n.set("query",d.trim()),l&&n.set("status",l),R!=="ALL"&&n.set("season",R),P!=="ALL"&&n.set("year",P),I!=="POPULARITY_DESC"&&n.set("sortBy",I),k(`/mature?${n.toString()}`);return}G.length>0&&o.set("genres",G.join(",")),ae.length>0&&o.set("excludeGenres",ae.join(",")),i!=="ADULT"&&!ve&&o.set("adult","false"),o.set("provider","anilist"),e>1&&o.set("page",e.toString()),se(o),e!==v&&F(e)},Q=e=>{if(u(e),_.current){const s=_.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:s,behavior:"smooth"})}},B=new Date().getFullYear(),me=[{value:"ALL",label:"All Years"},...Array.from({length:B-1980+1},(e,s)=>({value:String(B-s),label:String(B-s)}))],X=p.length>=14&&K&&K.length>0,m=[];h!=="ALL"&&m.push({key:"type",label:`Type: ${h}`,onRemove:()=>{g("ALL"),u(1,{type:"ALL"})}}),L!=="ALL"&&m.push({key:"season",label:`Season: ${L}`,onRemove:()=>{A("ALL"),u(1,{season:"ALL"})}}),S!=="ALL"&&m.push({key:"year",label:`Year: ${S}`,onRemove:()=>{y("ALL"),u(1,{year:"ALL"})}});for(const[e,s]of Object.entries(C))m.push({key:e,label:s==="include"?`+ ${e}`:`-${e}`,tone:s==="include"?"primary":"danger",onRemove:()=>{const i={...C};delete i[e],N(i),u(1,{genreState:i})}});return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(f,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:d,onInput:e=>$(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&u()})]}),a("div",{className:t.searchActions,children:[a(U,{onClick:()=>u(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${b?t.active:""}`,onClick:()=>ne(!b),children:[a(f,{name:"filter",size:14}),a("span",{children:"Filters"}),b?a(f,{name:"chevron-up",size:12}):a(f,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${b?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:h,onChange:e=>{if(e.currentTarget.value==="ADULT"){k("/mature?provider=mal");return}g(e.currentTarget.value)},children:Re.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:q,onChange:e=>w(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Oe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:L,onChange:e=>A(e.currentTarget.value),children:Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:S,onChange:e=>y(e.currentTarget.value),children:me.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",ie===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only - ignored by fallback providers"})]}),a("select",{value:M,onChange:e=>D(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:j,onChange:e=>O(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),H.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:H.map(e=>a("button",{className:`${t.genreButton} ${t[C[e]||""]}`,onClick:()=>{N(s=>{const i=s[e],l={...s};return i==="include"?l[e]="exclude":i==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(U,{variant:"secondary",onClick:()=>{N({}),g("ALL"),A("ALL"),y("ALL"),D("ALL"),O("POPULARITY_DESC"),w(""),he(!1),u(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(U,{onClick:()=>u(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ue&&a(Te,{message:de?.message||"Error"}),m.length>0&&a(Ee,{chips:m}),a("div",{className:t.resultsHeader,ref:_,children:[a("h2",{className:t.resultsTitle,children:d?`Search Results for "${d}"`:"Discover Anime"}),E.length>0&&a(te,{page:v,canGoNext:X,onChange:Q,isLoading:T})]}),a("div",{className:`${t.resultsGrid} ${oe?t.lowEnd:""}`,children:T?a(Se,{}):E.map(e=>a(Ae,{anime:e},e._id))}),!T&&E.length===0&&a("div",{className:t.noResults,children:[a(f,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),E.length>0&&a("div",{className:t.bottomPagination,children:a(te,{page:v,canGoNext:X,onChange:Q,isLoading:T,variant:"labeled"})})]})}export{We as default};
1
+ import{h as Y,p as pe,a as fe,d as c,A as ge,g as Le,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as f}from"./vendor-icons-C1Pj_eSX.js";import{P as te}from"./MediaCard-CeCsiCpy.js";import{A as Ae}from"./AnimeCard-BMhqfrkR.js";import{S as Se}from"./SkeletonGrid-B3ip19ry.js";import{t as ye,u as be,G as Ce,a9 as le,B as U,aa as Ne}from"./index-BVkDKnzf.js";import{E as Te}from"./ErrorMessage-hMt90aG4.js";import{A as Ee}from"./ActiveFilterChips-olGfwxle.js";import{s as t}from"./Search.module-C_qwCdHS.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-CC0bqpsd.js";import"./useAnimeInfoData-Bf5W2JqV.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-COnNd8B1.js";import"./playbackCompletion-Bgy18e-S.js";const Re=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Pe=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ie=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],De=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Oe=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function We(){Y(()=>{document.title="Search - dango"},[]);const[r,se]=pe(),k=fe(),[d,$]=c(r.get("query")||""),[v,F]=c(parseInt(r.get("page")||"1")),[h,g]=c(r.get("type")||"ALL"),[L,A]=c(r.get("season")||"ALL"),[S,y]=c(r.get("year")||"ALL"),[M,D]=c(r.get("country")||"ALL"),[V,re]=c(r.get("provider")||"anilist"),[j,O]=c(r.get("sortBy")||"POPULARITY_DESC"),[q,w]=c(r.get("status")||""),[b,ne]=c(!1),[ie,z]=c(null);Y(()=>{let e=!1;return ye.data.anilistStatus.query().then(s=>{e||z(s.available)}).catch(()=>{e||z(!0)}),()=>{e=!0}},[]);const{lowEndMode:oe}=be(),_=ge(null),{data:ce}=Ce(),H=ce?.genres||[],[C,N]=c(()=>{const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],i=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return s.forEach(l=>l&&(e[l]="include")),i.forEach(l=>l&&(e[l]="exclude")),e}),W=new URLSearchParams(r);W.delete("page");const J=W.toString(),{data:p=[],isLoading:T,isError:ue,error:de}=le(J,v,14),{data:K}=le(J,v+1,14),[x,he]=c(!1),E=Le.useMemo(()=>V==="anilist"&&h==="ADULT"||x?p:p.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[p,x,V,h]);Y(()=>{$(r.get("query")||""),g(r.get("type")||"ALL"),A(r.get("season")||"ALL"),y(r.get("year")||"ALL"),D(r.get("country")||"ALL"),re(r.get("provider")||"anilist"),O(r.get("sortBy")||"POPULARITY_DESC"),w(r.get("status")||""),F(parseInt(r.get("page")||"1"));const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],i=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];s.forEach(l=>l&&(e[l]="include")),i.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const u=(e=1,s={})=>{Ne();const i=s.type??h,l=s.status??q,R=s.season??L,P=s.year??S,Z=s.country??M,I=s.sort??j,ee=s.genreState??C,ve=s.showMature??x,o=new URLSearchParams;d.trim()&&o.set("query",d.trim()),i!=="ALL"&&o.set("type",i),l&&o.set("status",l),R!=="ALL"&&o.set("season",R),P!=="ALL"&&o.set("year",P),Z!=="ALL"&&o.set("country",Z),I!=="POPULARITY_DESC"&&o.set("sortBy",I);const G=Object.entries(ee).filter(([,n])=>n==="include").map(([n])=>n),ae=Object.entries(ee).filter(([,n])=>n==="exclude").map(([n])=>n);if(G.some(n=>n.toLowerCase()==="hentai")){const n=new URLSearchParams;n.set("provider","anilist"),d.trim()&&n.set("query",d.trim()),l&&n.set("status",l),R!=="ALL"&&n.set("season",R),P!=="ALL"&&n.set("year",P),I!=="POPULARITY_DESC"&&n.set("sortBy",I),k(`/mature?${n.toString()}`);return}G.length>0&&o.set("genres",G.join(",")),ae.length>0&&o.set("excludeGenres",ae.join(",")),i!=="ADULT"&&!ve&&o.set("adult","false"),o.set("provider","anilist"),e>1&&o.set("page",e.toString()),se(o),e!==v&&F(e)},Q=e=>{if(u(e),_.current){const s=_.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:s,behavior:"smooth"})}},B=new Date().getFullYear(),me=[{value:"ALL",label:"All Years"},...Array.from({length:B-1980+1},(e,s)=>({value:String(B-s),label:String(B-s)}))],X=p.length>=14&&K&&K.length>0,m=[];h!=="ALL"&&m.push({key:"type",label:`Type: ${h}`,onRemove:()=>{g("ALL"),u(1,{type:"ALL"})}}),L!=="ALL"&&m.push({key:"season",label:`Season: ${L}`,onRemove:()=>{A("ALL"),u(1,{season:"ALL"})}}),S!=="ALL"&&m.push({key:"year",label:`Year: ${S}`,onRemove:()=>{y("ALL"),u(1,{year:"ALL"})}});for(const[e,s]of Object.entries(C))m.push({key:e,label:s==="include"?`+ ${e}`:`-${e}`,tone:s==="include"?"primary":"danger",onRemove:()=>{const i={...C};delete i[e],N(i),u(1,{genreState:i})}});return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(f,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:d,onInput:e=>$(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&u()})]}),a("div",{className:t.searchActions,children:[a(U,{onClick:()=>u(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${b?t.active:""}`,onClick:()=>ne(!b),children:[a(f,{name:"filter",size:14}),a("span",{children:"Filters"}),b?a(f,{name:"chevron-up",size:12}):a(f,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${b?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:h,onChange:e=>{if(e.currentTarget.value==="ADULT"){k("/mature?provider=mal");return}g(e.currentTarget.value)},children:Re.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:q,onChange:e=>w(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Oe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:L,onChange:e=>A(e.currentTarget.value),children:Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:S,onChange:e=>y(e.currentTarget.value),children:me.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",ie===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only - ignored by fallback providers"})]}),a("select",{value:M,onChange:e=>D(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:j,onChange:e=>O(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),H.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:H.map(e=>a("button",{className:`${t.genreButton} ${t[C[e]||""]}`,onClick:()=>{N(s=>{const i=s[e],l={...s};return i==="include"?l[e]="exclude":i==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(U,{variant:"secondary",onClick:()=>{N({}),g("ALL"),A("ALL"),y("ALL"),D("ALL"),O("POPULARITY_DESC"),w(""),he(!1),u(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(U,{onClick:()=>u(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ue&&a(Te,{message:de?.message||"Error"}),m.length>0&&a(Ee,{chips:m}),a("div",{className:t.resultsHeader,ref:_,children:[a("h2",{className:t.resultsTitle,children:d?`Search Results for "${d}"`:"Discover Anime"}),E.length>0&&a(te,{page:v,canGoNext:X,onChange:Q,isLoading:T})]}),a("div",{className:`${t.resultsGrid} ${oe?t.lowEnd:""}`,children:T?a(Se,{}):E.map(e=>a(Ae,{anime:e},e._id))}),!T&&E.length===0&&a("div",{className:t.noResults,children:[a(f,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),E.length>0&&a("div",{className:t.bottomPagination,children:a(te,{page:v,canGoNext:X,onChange:Q,isLoading:T,variant:"labeled"})})]})}export{We as default};
@@ -0,0 +1,21 @@
1
+ import{d as r,u as e,S as le,A as Z,h as z,q as pe,T as Ee,p as Ke,g as Ce,_ as Ue}from"./vendor-core-DfaOB3Rn.js";import{b as fe,u as te}from"./vendor-query-BBT5_sHx.js";import{R as ee,S as V,U as E,V as ke,B as C,W as Fe,Q as U,d as $e,L as Le,t as k,v as Pe,o as We,J as Se,X,q as H,Y as Ne,Z as He,_ as Be,u as je,e as Qe,$ as Ve,K as de,p as Ye,a0 as Je,a1 as Xe}from"./index-BVkDKnzf.js";import{I as j}from"./vendor-icons-C1Pj_eSX.js";import{T as F}from"./ToggleSwitch-CN_ppEc9.js";import{l as Ze,s as et}from"./playbackCompletion-Bgy18e-S.js";import{M as tt}from"./MatureConsentModal-CC0bqpsd.js";const at="_sectionCard_1vuib_1",nt="_dangerCard_1vuib_20",rt="_settingRow_1vuib_31",T={sectionCard:at,dangerCard:nt,settingRow:rt};function st(){const{data:t}=fe(ee),{data:s}=fe({queryKey:["profiles"],queryFn:()=>V("/api/profiles/status"),enabled:!!t?.owner}),c=te(),[g,f]=r(null),[d,S]=r(""),[m,i]=r(""),[a,p]=r(""),[v,u]=r(""),[P,l]=r(""),[y,_]=r(!1),[L,M]=r(null),[I,w]=r(null),[x,O]=r(""),G=async o=>{_(!0),l("");try{await V("/api/profiles/update",{method:"POST",body:JSON.stringify(o)}),await c.invalidateQueries({queryKey:ee.queryKey}),S(""),i(""),l("Profile saved")}catch(R){l(R.message)}finally{_(!1)}};return t?e("section",{className:T.sectionCard,children:[e("h3",{children:"Your profile"}),e("p",{children:"Keep using this profile, rename it, or add another person with their own library and connections."}),e("div",{className:E.avatarRow,children:[e(ke,{image:t.image,name:t.name}),e("label",{className:E.uploadButton,children:[e(j,{name:"upload"}),e("span",{children:"Upload image"}),e("input",{className:E.fileInput,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",disabled:y,onChange:async o=>{const R=o.currentTarget.files?.[0];if(o.currentTarget.value="",!R)return;if(R.size>2*1024*1024){l("Image must be smaller than 2 MB");return}const A=new FileReader;A.onerror=()=>l("Could not read image"),A.onload=()=>{G({avatar:A.result})},A.readAsDataURL(R)}})]}),t.avatar&&e(C,{variant:"secondary",disabled:y,onClick:()=>G({avatar:null}),children:"Clear uploaded image"})]}),e("p",{children:"Your uploaded image takes priority, followed by your active cloud account image, then the default user icon."}),e("form",{className:E.form,onSubmit:o=>{o.preventDefault(),G({name:g??t.name})},children:[e("label",{className:E.field,children:["Profile name",e("input",{value:g??t.name,maxLength:60,required:!0,onChange:o=>f(o.currentTarget.value)})]}),e(C,{type:"submit",disabled:y,children:"Save name"})]}),e("form",{className:E.form,onSubmit:o=>{o.preventDefault(),G({password:d,currentPassword:m})},children:[t.protected&&e("label",{className:E.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:m,required:!0,maxLength:256,onChange:o=>i(o.currentTarget.value)})]}),e("label",{className:E.field,children:[t.protected?"New password (empty removes protection)":"Protect this profile",e("input",{type:"password",autoComplete:"new-password",value:d,minLength:8,maxLength:256,onChange:o=>S(o.currentTarget.value)})]}),e(C,{type:"submit",disabled:y,children:"Save password"})]}),e(C,{variant:"secondary",disabled:y,onClick:async()=>{_(!0);try{await V("/api/profiles/logout",{method:"POST"}),Fe()}catch(o){l(o.message),_(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:E.form,onSubmit:async o=>{o.preventDefault(),_(!0),l("");try{await V("/api/profiles/create",{method:"POST",body:JSON.stringify({name:a,password:v})}),p(""),u(""),await c.invalidateQueries({queryKey:["profiles"]}),l("Profile created. Sign out to switch to it.")}catch(R){l(R.message)}finally{_(!1)}},children:[e("h3",{children:"Add another profile"}),e("p",{children:"Protect your owner profile first. New profiles start empty and do not inherit your accounts. A profile without a password is accessible to anyone who passes the LAN lock."}),e("label",{className:E.field,children:["Name",e("input",{required:!0,maxLength:60,value:a,onChange:o=>p(o.currentTarget.value)})]}),e("label",{className:E.field,children:["Password (optional)",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:v,onChange:o=>u(o.currentTarget.value)})]}),e(C,{type:"submit",disabled:y||!t.protected,children:"Create profile"})]}),t.owner&&s?.profiles.some(o=>!o.owner)&&e(le,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:E.profileList,children:s.profiles.filter(o=>!o.owner).map(o=>e("li",{children:[e("span",{className:E.smallAvatar,children:e(ke,{image:o.avatar??o.cloudAvatar,name:o.name})}),e("span",{className:E.profileName,children:o.name}),e(C,{variant:"secondary",size:"sm",disabled:y,onClick:()=>{l(""),O(""),w(o)},children:"Reset password"}),e(C,{variant:"danger",size:"sm",disabled:y,onClick:()=>{l(""),M(o)},children:"Delete"})]},o.id))})]}),e(U,{isOpen:!!I,onClose:y?void 0:()=>w(null),title:"Reset password",width:"sm",footer:e(le,{children:[e(C,{variant:"secondary",disabled:y,onClick:()=>w(null),children:"Cancel"}),e(C,{loading:y,onClick:async()=>{if(I){_(!0),l("");try{await V("/api/profiles/reset-password",{method:"POST",body:JSON.stringify({id:I.id,password:x})}),await c.invalidateQueries({queryKey:["profiles"]}),w(null),O(""),l("Password updated. The profile has been signed out.")}catch(o){l(o.message)}finally{_(!1)}}},children:"Save password"})]}),children:[e("p",{children:["Set a new password for ",e("strong",{children:I?.name}),". They will be signed out and must use the new password next time."]}),e("label",{className:E.field,children:["New password",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,placeholder:"Leave empty to remove their password",value:x,onChange:o=>O(o.currentTarget.value)})]})]}),e(U,{isOpen:!!L,onClose:y?void 0:()=>M(null),title:"Delete profile?",width:"sm",footer:e(le,{children:[e(C,{variant:"secondary",disabled:y,onClick:()=>M(null),children:"Cancel"}),e(C,{variant:"danger",loading:y,onClick:async()=>{if(L){_(!0);try{await V("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:L.id,confirm:!0})}),await c.invalidateQueries({queryKey:["profiles"]}),M(null),l("Profile deleted. Local files will be removed when Dango restarts.")}catch(o){l(o.message),M(null)}finally{_(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:L?.name}),"? This signs them out immediately. Their local libraries, settings and connections will be removed when Dango next restarts."]}),e("p",{children:"Cloud backups and tracker lists will stay intact. Export any library you want to keep before deleting."})]}),P&&e("p",{role:"status",children:P})]}):null}const ue={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},he=["name","nativeName","englishName"],ge={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},it=()=>{const{titlePreference:t,setTitlePreference:s,loading:c}=$e(),g=Le(),[f,d]=r(ge[t]),[S,m]=r(!1),i=Z(null);z(()=>{c||d(ge[t])},[t,c]);const a=async()=>{if(S)return;m(!0);const v=(he.indexOf(t)+1)%he.length,u=he[v],P=ge[u];i.current&&(i.current.style.transform="translateX(-100%)",i.current.style.opacity="0"),setTimeout(async()=>{d(P),s(u),i.current&&(i.current.style.transition="none",i.current.style.transform="translateX(100%)",i.current.style.opacity="0",i.current.offsetWidth,i.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",i.current.style.transform="translateX(0)",i.current.style.opacity="1");try{await g.mutateAsync({key:"titlePreference",value:u})}catch(l){console.error("Error saving title preference:",l)}finally{m(!1)}},300)};return c?e("p",{children:"Loading title preference..."}):e("div",{className:ue["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:ue["toggle-button"],disabled:S,children:e("span",{ref:i,className:ue["toggle-label"],children:f})})]})},ot="_settingsHeader_gfwoa_1",lt="_pageTitle_gfwoa_6",ct="_pageSubtitle_gfwoa_14",dt="_settingsLayout_gfwoa_20",ut="_sidebar_gfwoa_27",ht="_sidebarIndicator_gfwoa_35",gt="_sidebarItem_gfwoa_50",mt="_active_gfwoa_72",pt="_mainContent_gfwoa_80",ft="_tabContent_gfwoa_85",yt="_settingItem_gfwoa_103",vt="_shortcutContainer_gfwoa_108",wt="_shortcutGroup_gfwoa_115",bt="_shortcutGroupTitle_gfwoa_121",Ct="_shortcutGrid_gfwoa_130",kt="_shortcutCard_gfwoa_136",St="_controls_gfwoa_170",Nt="_status_gfwoa_176",h={settingsHeader:ot,pageTitle:lt,pageSubtitle:ct,settingsLayout:dt,sidebar:ut,sidebarIndicator:ht,sidebarItem:gt,active:mt,mainContent:pt,tabContent:ft,settingItem:yt,shortcutContainer:vt,shortcutGroup:wt,shortcutGroupTitle:bt,shortcutGrid:Ct,shortcutCard:kt,controls:St,status:Nt},_t="_title_tm30b_11",Tt="_signIn_tm30b_18",Lt="_userInfo_tm30b_25",Pt="_warning_tm30b_47",It="_formGroup_tm30b_54",xt="_label_tm30b_58",Rt="_inputWrapper_tm30b_68",Dt="_input_tm30b_68",Ot="_select_tm30b_92",At="_actions_tm30b_109",Gt="_hr_tm30b_117",b={title:_t,signIn:Tt,userInfo:Lt,warning:Pt,formGroup:It,label:xt,inputWrapper:Rt,input:Dt,select:Ot,actions:At,hr:Gt},Mt=()=>{const t=te(),[s,c]=r(!0),[g,f]=r(!1),[d,S]=r(!1),[m,i]=r(null),[a,p]=r({status:"idle"}),[v,u]=r(!1),[P,l]=r(""),[y,_]=r(!1),L=Z(null),[M,I]=r({show:!1,message:"",type:"info"}),w=()=>{L.current&&(window.clearInterval(L.current),L.current=null)},x=pe(N=>{S(N.authenticated),i(N.user||N.device.user||null),p(N.device),u(!!N.hasCustomClientId)},[]),O=pe(async()=>{const N=await k.auth.githubStatus.query();x(N)},[x]),G=async()=>{try{const N=await k.auth.githubPoll.query();p(N),N.status==="success"?(w(),await t.invalidateQueries({queryKey:ee.queryKey}),await O(),I({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):N.status==="error"&&(w(),I({show:!0,message:N.error||"GitHub authentication failed.",type:"error"}))}catch{w(),I({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},o=(N=5)=>{w(),L.current=window.setInterval(G,Math.max(N,5)*1e3)};z(()=>(O().catch(()=>{I({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>c(!1)),w),[O]);const R=async()=>{f(!0);try{const N=await k.auth.githubStart.mutate();p(N),o(N.verification?.interval)}catch(N){I({show:!0,message:N instanceof Error?N.message:"Failed to start GitHub authentication.",type:"error"})}finally{f(!1)}},A=async()=>{try{await k.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:ee.queryKey}),S(!1),i(null),p({status:"idle"}),I({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{I({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},$=async()=>{_(!0);try{await k.auth.saveGithubAuth.mutate({clientId:P}),l(""),await O(),I({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{I({show:!0,message:"Failed to save override.",type:"error"})}finally{_(!1)}},Q=async()=>{_(!0);try{await k.auth.saveGithubAuth.mutate({clientId:""}),l(""),await O(),I({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{I({show:!0,message:"Failed to clear override.",type:"error"})}finally{_(!1)}};return s?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:T.sectionCard,children:[e("h3",{className:b.title,children:"GitHub Cloud Sync"}),e("p",{className:b.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),d&&m?e("div",{className:b.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:m.name||m.login})]}),e(C,{variant:"danger",onClick:A,children:"Sign Out"})]}):e("div",{className:b.signIn,children:e(C,{onClick:R,disabled:g||a.status==="pending",children:g||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.verification&&e(le,{children:[e("hr",{className:b.hr}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Verification URL"}),e("div",{className:b.inputWrapper,children:[e("input",{className:b.input,value:a.verification.verification_uri,readOnly:!0}),e(C,{onClick:()=>{const N=a.verification?.verification_uri;N&&/^https?:\/\//i.test(N)&&window.open(N,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Device Code"}),e("input",{className:b.input,value:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:b.warning,children:a.error}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",v?"(override active)":""]}),e("div",{className:b.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:b.label,children:"Client ID (optional)"}),e("input",{className:b.input,value:P,onChange:N=>l(N.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:b.actions,children:[e(C,{onClick:$,disabled:y,children:"Save override"}),e(C,{variant:"secondary",onClick:Q,disabled:y,children:"Use dango defaults"})]})]}),e(U,{isOpen:M.show,onClose:()=>I(N=>({...N,show:!1})),width:"sm",children:[e(U.Body,{children:e("p",{children:M.message})}),e(U.Actions,{children:e(C,{onClick:()=>I(N=>({...N,show:!1})),children:"OK"})})]})]})},qt=()=>{const[t,s]=r(!0),[c,g]=r(null),[f,d]=r(!1),[S,m]=r(!1),[i,a]=r(""),[p,v]=r(""),[u,P]=r(""),[l,y]=r(!1),[_,L]=r({show:!1,message:"",type:"info"}),M=async()=>{try{const R=await k.auth.user.query();g(R?.email?R:null)}catch{g(null)}},I=async()=>{try{const[o,R]=await Promise.all([k.auth.configStatus.query(),k.auth.googleAuth.query()]);d(!!o.hasConfig),m(!!(R.hasCustomWorkerUrl||R.hasCustomClientId||R.hasClientSecret))}catch(o){console.error("Failed to fetch config status",o)}};z(()=>{(async()=>{s(!0),await Promise.all([M(),I()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await M(),window.history.replaceState(null,"",window.location.pathname))}catch{}s(!1)})();const R=A=>{A.origin===window.location.origin&&typeof A.data=="object"&&A.data!==null&&A.data.type==="GOOGLE_AUTH_SUCCESS"&&(g(A.data.user),window.location.reload())};return window.addEventListener("message",R),()=>window.removeEventListener("message",R)},[]);const w=async()=>{try{const o=await k.auth.googleLogin.mutate();if(o.authenticated){window.location.reload();return}if(o.url){if(typeof window.DangoBridge<"u"){window.location.href=o.url;return}const A=600,$=700,Q=window.innerWidth/2-A/2,N=window.innerHeight/2-$/2;window.open(o.url,"GoogleAuth",`width=${A},height=${$},top=${N},left=${Q}`)}else throw new Error("Auth URL not available")}catch{L({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},x=async()=>{try{await k.auth.logout.mutate(),g(null),L({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(o){console.error("Sign out failed",o),L({show:!0,message:"Failed to sign out.",type:"error"})}},O=async()=>{y(!0);try{await k.auth.saveGoogleAuth.mutate({workerUrl:i,clientId:p,clientSecret:u}),a(""),v(""),P(""),await I(),L({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{L({show:!0,message:"Failed to save override.",type:"error"})}finally{y(!1)}},G=async()=>{y(!0);try{await k.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),a(""),v(""),P(""),await I(),L({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{L({show:!0,message:"Failed to clear override.",type:"error"})}finally{y(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:T.sectionCard,children:[e("h3",{className:b.title,children:"Google Drive Sync"}),c?e("div",{className:b.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:c.name})," (",c.email,")"]}),e(C,{variant:"danger",onClick:x,children:"Sign Out"})]}):e("div",{className:b.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(C,{onClick:w,disabled:!f,children:"Sign in with Google"}),!f&&e("p",{className:b.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",S?"(override active)":""]}),e("div",{className:b.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:b.label,children:"Worker URL (optional)"}),e("input",{className:b.input,value:i,onChange:o=>a(o.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Client ID (optional)"}),e("input",{className:b.input,value:p,onChange:o=>v(o.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:b.input,value:u,onChange:o=>P(o.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:b.actions,children:[e(C,{onClick:O,disabled:l,children:"Save override"}),e(C,{variant:"secondary",onClick:G,disabled:l,children:"Use dango defaults"})]})]}),e(U,{isOpen:_.show,onClose:()=>L(o=>({...o,show:!1})),width:"sm",children:[e(U.Body,{children:e("p",{children:_.message})}),e(U.Actions,{children:e(C,{onClick:()=>L(o=>({...o,show:!1})),children:"OK"})})]})]})},zt="_settingItem_3qq0n_1",Et="_modalOverlay_3qq0n_6",Kt="_modal_3qq0n_6",Ut="_modalActions_3qq0n_41",Ft="_modalSecondary_3qq0n_47",$t="_modalPrimary_3qq0n_57",B={settingItem:zt,modalOverlay:Et,modal:Kt,modalActions:Ut,modalSecondary:Ft,modalPrimary:$t},Wt={anime:{heading:"Watchlist Preferences",blurb:"Customize your experience when managing your watchlist and series entries.",skipKey:"skipRemoveConfirmation",ignoreKey:"ignoreAdultContent",listOnlyKey:"cwWatchlistOnly",skipLabel:"Skip confirmation when removing from watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in watchlist",listNoun:"watchlist",continueNoun:"continue watching",adultCountUrl:"/api/continue-watching/adult-count",purgeUrl:"/api/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["allContinueWatching"]]},manga:{heading:"Reading List Preferences",blurb:"Customize your experience when managing your reading list and manga entries.",skipKey:"mangaSkipRemoveConfirmation",ignoreKey:"mangaIgnoreAdultContent",listOnlyKey:"mangaCwWatchlistOnly",skipLabel:"Skip confirmation when removing from reading list",ignoreLabel:"Hide adult content from continue reading",listOnlyLabel:"Only show continue reading for manga in reading list",listNoun:"reading list",continueNoun:"continue reading",adultCountUrl:"/api/manga/continue-reading/adult-count",purgeUrl:"/api/manga/continue-reading/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue reading`,invalidateKeys:[["manga-continue-reading"]]},tv:{heading:"TV Watchlist Preferences",blurb:"Customize your experience when managing your TV watchlist and series entries.",skipKey:"tvSkipRemoveConfirmation",ignoreKey:"tvIgnoreAdultContent",listOnlyKey:"tvCwWatchlistOnly",skipLabel:"Skip confirmation when removing from TV watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in TV watchlist",listNoun:"TV watchlist",continueNoun:"continue watching",adultCountUrl:"/api/tv/continue-watching/adult-count",purgeUrl:"/api/tv/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["tv-continue-watching"]]},asmr:{heading:"Listening List Preferences",blurb:"Customize your experience when managing your listening list and work entries.",skipKey:"asmrSkipRemoveConfirmation",ignoreKey:"asmrIgnoreAdultContent",listOnlyKey:"asmrCwWatchlistOnly",skipLabel:"Skip confirmation when removing from listening list",ignoreLabel:"Hide adult content from continue listening",listOnlyLabel:"Only show continue listening for works in listening list",listNoun:"listening list",continueNoun:"continue listening",adultCountUrl:"/api/asmr/continue-listening/adult-count",purgeUrl:"/api/asmr/continue-listening/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue listening`,invalidateKeys:[["asmr-continue-listening"]]}},Ht=(t,s)=>{if(t==null)return s;const c=String(t);return c==="true"||c==="1"?!0:c==="false"||c==="0"?!1:s},_e=(t,s,c)=>{const[g,f]=r(s),[d,S]=r(!1),m=te();return z(()=>{(async()=>{try{const p=await k.settings.getByKey.query({key:t});f(Ht(p.value,s))}catch(p){console.error("Failed to fetch setting",p)}})()},[t,s]),{value:g,setValue:f,isUpdating:d,toggle:async()=>{if(d)return;S(!0);const a=!g;f(a);try{await k.settings.set.mutate({key:t,value:a});for(const p of c)m.invalidateQueries({queryKey:p})}catch(p){console.error("Error saving setting:",p),f(!a)}finally{S(!1)}}}},Bt=()=>{const{contentType:t}=Pe(),s=Wt[t],[c,g]=r(!1),[f,d]=r(!0),[S,m]=r(!1),i=_e(s.ignoreKey,!0,s.invalidateKeys),a=_e(s.listOnlyKey,!1,s.invalidateKeys),[p,v]=r(null),[u,P]=r(!1),l=te(),y=We();z(()=>{d(!0),(async()=>{try{const x=await k.settings.getByKey.query({key:s.skipKey});String(x.value)==="true"||String(x.value)==="1"?g(!0):g(!1)}catch(x){console.error("Failed to fetch setting",x)}finally{d(!1)}})()},[s.skipKey]);const _=async()=>{if(S)return;m(!0);const w=!c;g(w);try{await k.settings.set.mutate({key:s.skipKey,value:w})}catch(x){console.error("Error saving setting:",x),g(!w)}finally{m(!1)}},L=async()=>{if(!i.isUpdating){if(i.value)try{let w;if(t==="anime"?w=(await k.continueWatching.adultCount.query()).count:t==="manga"?w=(await k.mangaProgress.adultCount.query()).count:t==="asmr"?w=(await k.asmrProgress.adultCount.query()).count:w=(await k.tvProgress.adultCount.query()).count,typeof w=="number"&&w>0){v(w);return}}catch(w){console.error("Failed to fetch adult count",w)}i.toggle()}},M=()=>{v(null),i.toggle()},I=async()=>{if(!u){P(!0);try{let w;t==="anime"?w=(await k.continueWatching.purgeAdult.mutate()).removed:t==="manga"?w=(await k.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?w=(await k.asmrProgress.purgeAdult.mutate()).removed:w=(await k.tvProgress.purgeAdult.mutate()).removed,Se.success(s.purgeDoneText(w??0));for(const x of s.invalidateKeys)l.invalidateQueries({queryKey:x});t==="anime"&&l.invalidateQueries(y.continueWatching.pathFilter()),t==="manga"&&l.invalidateQueries(y.mangaProgress.pathFilter()),t==="asmr"&&l.invalidateQueries(y.asmrProgress.pathFilter()),t==="tv"&&l.invalidateQueries(y.tvProgress.pathFilter())}catch(w){console.error("Failed to purge adult entries",w),Se.error("Failed to remove adult entries")}finally{P(!1),v(null)}i.toggle()}};return f?e("div",{children:"Loading settings..."}):e("div",{className:T.sectionCard,children:[e("h3",{children:s.heading}),e("p",{children:s.blurb}),e("div",{className:B.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:s.skipLabel}),e(F,{isChecked:c,onChange:_,id:"skip-confirmation-toggle",disabled:S})]})}),e("div",{className:B.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:s.ignoreLabel}),e(F,{isChecked:i.value,onChange:L,id:"ignore-adult-toggle",disabled:i.isUpdating})]})}),e("div",{className:B.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:s.listOnlyLabel}),e(F,{isChecked:a.value,onChange:a.toggle,id:"cw-watchlist-only-toggle",disabled:a.isUpdating})]})}),p!==null&&e("div",{className:B.modalOverlay,onClick:()=>v(null),children:e("div",{className:B.modal,onClick:w=>w.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[p," adult ",p===1?"entry":"entries"," not in your"," ",s.listNoun," ",p===1?"is":"are"," currently hidden from"," ",s.continueNoun,". You can purge ",p===1?"it":"them"," from the database instead of showing ",p===1?"it":"them","."]}),e("div",{className:B.modalActions,children:[e("button",{type:"button",className:B.modalSecondary,onClick:M,disabled:u,children:"Show them"}),e("button",{type:"button",className:B.modalPrimary,onClick:I,disabled:u,children:u?"Purging...":`Purge ${p}`})]})]})})]})},jt="_statsGrid_o4nf0_1",Qt="_statCard_o4nf0_8",Vt="_statLabel_o4nf0_18",Yt="_statValue_o4nf0_26",Jt="_statMeta_o4nf0_32",Xt="_statusBanner_o4nf0_38",Zt="_statusSuccess_o4nf0_49",ea="_statusUpdating_o4nf0_55",ta="_statusError_o4nf0_61",aa="_sha_o4nf0_67",na="_settingItem_o4nf0_74",ra="_settingTitle_o4nf0_79",sa="_settingSubtitle_o4nf0_85",ia="_actionsRow_o4nf0_92",D={statsGrid:jt,statCard:Qt,statLabel:Vt,statValue:Yt,statMeta:Jt,statusBanner:Xt,statusSuccess:Zt,statusUpdating:ea,statusError:ta,sha:aa,settingItem:na,settingTitle:ra,settingSubtitle:sa,actionsRow:ia},oa=()=>{const[t,s]=r(null),[c,g]=r(!0),[f,d]=r(!1),[S,m]=r(!1),i=Z(null),a=async()=>{try{const l=await k.settings.offlineDbInfo.query();return s(l),l}catch(l){console.error("Failed to fetch offline DB info:",l)}finally{g(!1)}return null};z(()=>(a(),()=>{i.current&&window.clearInterval(i.current)}),[]),z(()=>{t?.isRefreshing?i.current||(i.current=window.setInterval(async()=>{const l=await a();l&&!l.isRefreshing&&i.current&&(window.clearInterval(i.current),i.current=null)},2e3)):i.current&&(window.clearInterval(i.current),i.current=null)},[t?.isRefreshing]);const p=async()=>{if(!t||f)return;const l=!t.autoUpdateEnabled;d(!0),s({...t,autoUpdateEnabled:l});try{await k.settings.setOfflineDbAutoUpdate.mutate({enabled:l})}catch(y){console.error("Failed to update auto update setting:",y),s({...t,autoUpdateEnabled:!l})}finally{d(!1)}},v=async()=>{if(!(t?.isRefreshing||S)){m(!0);try{await k.settings.triggerOfflineDbUpdate.mutate(),s(l=>l?{...l,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(l){console.error("Failed to trigger offline DB update:",l)}finally{m(!1)}}},u=l=>{if(!l)return"Never";try{return new Date(l).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return l}},P=t?.isRefreshing||S;return e("div",{className:T.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:D.statsGrid,children:[e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"MAL Mapped"}),e("span",{className:D.statValue,children:c?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Release"}),e("span",{className:D.statMeta,children:c?"-":t?.releaseTag??"Never"})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Checked"}),e("span",{className:D.statMeta,children:c?"-":u(t?.lastCheckedAt??null)})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Updated"}),e("span",{className:D.statMeta,children:c?"-":u(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${D.statusBanner} ${t.lastStatus==="failed"?D.statusError:t.lastStatus==="updating"?D.statusUpdating:D.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:D.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:D.settingItem,children:e("div",{className:T.settingRow,children:[e("div",{children:[e("span",{className:D.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:D.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(F,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:p,disabled:c||f})]})}),e("div",{className:D.actionsRow,children:e(C,{onClick:v,disabled:c||P,children:P?"Updating Database...":"Update Offline Database Now"})})]})},la="_status_1wbo0_1",ca="_warningText_1wbo0_7",da="_ackLabel_1wbo0_11",me={status:la,warningText:ca,ackLabel:da},ua=()=>{const t=te(),[s,c]=r(!1),[g,f]=r(!1),[d,S]=r(!1),[m,i]=r(""),a=()=>{f(!1),i(""),c(!0)},p=()=>{d||(c(!1),f(!1))},v=async()=>{if(!(!g||d)){S(!0),i("");try{const u=await X("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),P=await u.json();if(!u.ok)throw new Error(P.error||"Failed to clear database");const l=P.deleted,y=P.deletedManga,_=P.deletedTv,L=P.deletedAsmr,M=Object.values(l).reduce((O,G)=>O+(G||0),0)+Object.values(y??{}).reduce((O,G)=>O+(G||0),0)+Object.values(_??{}).reduce((O,G)=>O+(G||0),0)+Object.values(L??{}).reduce((O,G)=>O+(G||0),0),I=(y?.manga_library??0)+(y?.manga_progress??0),w=(_?.tv_library??0)+(_?.tv_progress??0),x=(L?.asmr_library??0)+(L?.asmr_progress??0);i(`Library cleared - ${l.watchlist??0} watchlist entries, ${I} manga rows, ${w} TV rows, ${x} ASMR rows and ${M} total rows removed.`),t.invalidateQueries({queryKey:[H.watchlist]}),t.invalidateQueries({queryKey:[H.continueWatching]}),t.invalidateQueries({queryKey:[H.mangaLibrary]}),t.invalidateQueries({queryKey:[H.mangaContinueReading]}),t.invalidateQueries({queryKey:[H.tvLibrary]}),t.invalidateQueries({queryKey:[H.tvContinueWatching]}),t.invalidateQueries({queryKey:[H.asmrLibrary]}),t.invalidateQueries({queryKey:[H.asmrContinueListening]}),c(!1)}catch(u){i(u.message)}finally{S(!1),f(!1)}}};return e("div",{className:`${T.sectionCard} ${T.dangerCard}`,children:[e("h3",{children:"Danger Zone"}),e("p",{children:"Permanently delete your library (watchlist, watched episodes, queue, cached show metadata, manga reading list and reading progress, TV watchlist and watch progress, ASMR listening list and listening progress) to start fresh. Your settings, sync state and the offline metadata cache are preserved."}),e(C,{variant:"danger",onClick:a,children:"Clear Library Data"}),m&&e("p",{className:me.status,children:m}),e(U,{isOpen:s,onClose:p,title:"Clear library data?",width:"sm",children:[e(U.Body,{children:[e("p",{className:me.warningText,children:"This permanently deletes everything in your library. It acts on the active database (dev or prod, per server config) and cannot be undone. Settings, sync state and the offline metadata cache are kept."}),e("label",{className:me.ackLabel,children:[e("input",{type:"checkbox",checked:g,onChange:u=>f(u.currentTarget.checked),disabled:d}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(U.Actions,{children:[e(C,{variant:"secondary",onClick:p,disabled:d,children:"Cancel"}),e(C,{variant:"danger",onClick:v,disabled:!g||d,children:d?"Clearing...":"Yes, delete everything"})]})]})]})},ha=()=>{const[t,s]=r(""),[c,g]=r([]),[f,d]=r(null),[S,m]=r(!0),[i,a]=r({show:!1,message:"",type:"info"}),p=async()=>{try{m(!0);const u=await k.auth.rcloneSettings.query();s(u.remote||""),g(u.availableRemotes||[]),d(u.activeRemote||null)}catch(u){console.error("Failed to fetch Rclone settings",u)}finally{m(!1)}};z(()=>{p()},[]);const v=async()=>{try{await k.auth.saveRclone.mutate({remote:t}),a({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),p()}catch{a({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return S?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:T.sectionCard,children:[e("h3",{className:b.title,children:"Rclone Cloud Sync"}),e("p",{className:b.signIn,children:"Configure which Rclone remote to use for database synchronization."}),f?e("div",{className:b.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:f})]})}):e("p",{className:b.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Remote Name"}),e("div",{className:b.inputWrapper,children:e("select",{className:b.select,value:t,onChange:u=>s(u.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),c.map(u=>e("option",{value:u,children:u},u)),t&&!c.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:b.warning,style:{marginTop:"12px"},children:[e("strong",{children:"Note:"})," You can choose which provider is active using the selector at the top of the page."]})]}),e("div",{className:b.actions,children:e(C,{onClick:v,children:"Save Rclone Settings"})}),e(U,{isOpen:i.show,onClose:()=>a(u=>({...u,show:!1})),width:"sm",children:[e(U.Body,{children:e("p",{children:i.message})}),e(U.Actions,{children:e(C,{onClick:()=>a(u=>({...u,show:!1})),children:"OK"})})]})]})},ga=()=>{const t=te(),[s,c]=r(null),[g,f]=r(!0),d=async()=>{try{const a=await k.auth.syncSettings.query();c(a)}catch(a){console.error("Failed to fetch sync settings",a)}finally{f(!1)}};z(()=>{d()},[]);const S=async a=>{const p=a.currentTarget.value;try{const v=await k.auth.saveSyncProvider.mutate({provider:p});c(u=>u?{...u,activeProvider:v.activeProvider}:null),await d(),await t.invalidateQueries({queryKey:ee.queryKey}),Ne.success(`Sync provider updated to ${p==="default"?"Default Order":p}`)}catch{Ne.error("Failed to update sync provider")}};if(g||!s)return null;const m=[{value:"default",label:"Default (Priority Based)"}];s.authenticatedProviders.github&&m.push({value:"github",label:"GitHub"}),s.authenticatedProviders.google&&m.push({value:"google",label:"Google Drive"}),s.authenticatedProviders.rclone&&m.push({value:"rclone",label:"Rclone"}),m.push({value:"none",label:"None (Local Only)"});const i=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:T.sectionCard,children:[e("h3",{children:"Active Sync Provider"}),e("p",{children:'Choose which provider to use for synchronization. "Default" uses the first available provider you are logged into.'}),e("div",{style:{marginBottom:"1.5rem",padding:"0.75rem",background:"rgba(255, 255, 255, 0.03)",borderRadius:"var(--radius-md)",borderLeft:"4px solid var(--accent)",fontSize:"var(--font-size-sm)"},children:["Current Status:"," ",e("strong",{style:{color:"var(--accent-light)",textTransform:"capitalize"},children:i(s.actualActiveProvider)})]}),e("div",{className:T.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:s.activeProvider,onChange:S,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:m.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function ma(){return"javascript:"+encodeURIComponent(`(function(){
2
+ if(!/(^|\\.)discord\\.com$/.test(location.hostname)){alert('Dango: use this bookmarklet while on discord.com');return}
3
+ var t=null;
4
+ try{
5
+ window.webpackChunkdiscord_app.push([[Symbol()],{},function(req){
6
+ if(!req.c)return;
7
+ var ms=Object.values(req.c);
8
+ for(var i=0;i<ms.length;i++){var m=ms[i];
9
+ try{
10
+ if(!m.exports||m.exports===window)continue;
11
+ if(typeof m.exports.getToken==='function'){var x=m.exports.getToken();if(x){t=x;return}}
12
+ for(var k in m.exports){try{var ex=m.exports[k];if(ex&&typeof ex.getToken==='function'&&ex[Symbol.toStringTag]!=='IntlMessagesProxy'){var y=ex.getToken();if(y){t=y;return}}}catch(e1){}}
13
+ }catch(e2){}}
14
+ }]);
15
+ window.webpackChunkdiscord_app.pop();
16
+ }catch(e3){}
17
+ if(!t){alert('Dango: could not grab your token. Make sure you are logged in to Discord in this tab, then run the bookmarklet again.');return}
18
+ function copyFallback(){var a=document.createElement('textarea');a.value=t;a.style.position='fixed';a.style.opacity='0';document.body.appendChild(a);a.select();try{document.execCommand('copy')}catch(e4){}document.body.removeChild(a)}
19
+ var done=function(){window.close();setTimeout(function(){if(!window.closed){alert('Dango: token copied to clipboard! Could not close this tab, so just close it, go back to Dango Settings, paste the token and press Save.')}},250)};
20
+ if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(t).then(done,function(){copyFallback();done()})}else{copyFallback();done()}
21
+ })()`)}const pa=()=>{const t=Ee(ma,[]);return 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:"Grab the token automatically (bookmarklet)"}),e("p",{style:{margin:"0 0 0.6rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Set this up once and you never have to dig through DevTools: the bookmarklet copies your Discord token to the clipboard and closes the Discord tab - then you just paste it above and press Save."}),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:["Drag the ",e("strong",{style:{color:"var(--text-primary)"},children:"Dango Token Grabber"})," ","button below onto your bookmarks bar (press ",e("kbd",{children:"Ctrl"}),"+",e("kbd",{children:"Shift"}),"+",e("kbd",{children:"B"})," ","first if the bar is hidden)."]}),e("li",{children:["Click ",e("strong",{style:{color:"var(--text-primary)"},children:"Open Discord"})," and log in (skip this if you are already logged in)."]}),e("li",{children:["On the Discord tab, click the"," ",e("strong",{style:{color:"var(--text-primary)"},children:"Dango Token Grabber"})," bookmark. The token lands in your clipboard and the tab closes on its own - come back here, paste it above and press ",e("strong",{children:"Save"}),"."]})]}),e("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",flexWrap:"wrap"},children:[e("a",{href:t,onClick:g=>{g.preventDefault(),alert("Drag this button onto your bookmarks bar instead of clicking it, then click it while you are on discord.com.")},title:"Drag me to your bookmarks bar",draggable:!0,style:{display:"inline-flex",alignItems:"center",padding:"0.4rem 0.8rem",borderRadius:"999px",border:"1px dashed var(--accent)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"0.85rem",textDecoration:"none",cursor:"grab",userSelect:"none"},children:[e(j,{name:"bookmark",style:{marginRight:"0.45rem",color:"var(--accent)"}}),"Dango Token Grabber"]}),e("a",{className:"btn btn-secondary btn-sm",href:"https://discord.com/channels/@me",target:"_blank",rel:"noopener noreferrer",children:"Open Discord"}),e(C,{variant:"ghost",size:"sm",onClick:async()=>{try{await navigator.clipboard.writeText(t),alert('Bookmarklet code copied. Create a new bookmark on your bookmarks bar, name it "Dango Token" and paste the code as its URL.')}catch{alert(`Could not copy automatically. Right-click the "Dango Token Grabber" button and choose "Copy link address" instead, then paste that into a new bookmark's URL.`)}},children:"Copy code"})]}),e("p",{style:{margin:"0.5rem 0 0",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:`"Copy code" is a fallback for browsers that won't drag bookmarklets: create any bookmark, then paste the copied code as its URL.`})]})},fa="_settingItem_68mz3_1",ya="_field_68mz3_6",va="_input_68mz3_19",wa="_actions_68mz3_39",ba="_status_68mz3_45",q={settingItem:fa,field:ya,input:va,actions:wa,status:ba},Ca=()=>{const[t,s]=r(!1),[c,g]=r(""),[f,d]=r(""),[S,m]=r(!0),[i,a]=r(!1),[p,v]=r("");z(()=>{(async()=>{try{const L=await(await X("/api/auth/app-status")).json();s(L.hasPassword)}catch{console.error("Failed to fetch LAN auth status")}finally{m(!1)}})()},[]);const u=async()=>{if(v(""),c!==f){v("Passwords do not match");return}if(c.length<4){v("Password must be at least 4 characters");return}a(!0);try{const y=await X("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:c})}),_=await y.json();if(!y.ok){v(_.error||"Failed to update password");return}s(_.hasPassword),g(""),d(""),v(_.hasPassword?"Password set successfully":"Password removed")}catch{v("Network error")}finally{a(!1)}},P=async()=>{a(!0);try{const y=await X("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:""})}),_=await y.json();if(!y.ok){v(_.error||"Failed to remove password");return}s(!1),g(""),d(""),v("Password removed")}catch{v("Network error")}finally{a(!1)}},l=async()=>{a(!0);try{await X("/api/auth/app-logout",{method:"POST"}),v("Logged out"),window.location.reload()}catch{v("Logout failed")}finally{a(!1)}};return S?e("div",{className:T.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:T.sectionCard,children:[e("h3",{children:"LAN Lock"}),e("p",{children:"Require a password to access this instance from any device, including this one. Sessions persist across server restarts until logout or password change."}),e("div",{className:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"lan-password",children:"New Password"}),e("input",{id:"lan-password",type:"password",value:c,onChange:y=>g(y.currentTarget.value),placeholder:t?"Leave empty to keep current password":"Enter a password...",className:q.input})]}),e("div",{className:q.field,children:[e("label",{htmlFor:"lan-confirm-password",children:"Confirm Password"}),e("input",{id:"lan-confirm-password",type:"password",value:f,onChange:y=>d(y.currentTarget.value),placeholder:"Confirm password...",className:q.input})]}),e("div",{className:q.actions,children:[e(C,{variant:"primary",onClick:u,loading:i,disabled:i,children:t?"Update Password":"Set Password"}),t&&e(C,{variant:"danger",onClick:l,loading:i,disabled:i,children:"Logout"}),t&&e(C,{variant:"secondary",onClick:P,loading:i,disabled:i,children:"Remove Password"})]}),p&&e("p",{className:q.status,children:p})]})]})},ka=()=>{const[t,s]=r(""),[c,g]=r(!0),[f,d]=r(!1),[S,m]=r("");z(()=>{V("/api/auth/app-status").then(a=>s(String(a.port??3e3))).catch(()=>m("Failed to load current port")).finally(()=>g(!1))},[]);const i=async()=>{const a=Number(t);if(!Number.isInteger(a)||a<1||a>65535){m("Enter a port between 1 and 65535");return}d(!0),m("");try{await k.auth.setServerPort.mutate({port:a}),m(`Saved. Restart dango, then open http://localhost:${a} - this overrides the PORT environment variable.`)}catch(p){m(p.message)}finally{d(!1)}};return c?e("div",{className:T.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:T.sectionCard,children:[e("h3",{children:"Server Port"}),e("p",{children:"Port the backend listens on. Takes effect after a restart. Google and AniList sign-in need the matching redirect URI registered with the provider."}),e("div",{className:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"server-port",children:"Port"}),e("input",{id:"server-port",type:"number",min:1,max:65535,value:t,onChange:a=>s(a.currentTarget.value),className:q.input})]}),e("div",{className:q.actions,children:e(C,{variant:"primary",onClick:i,loading:f,disabled:f,children:"Save Port"})}),S&&e("p",{className:q.status,children:S})]})]})},Sa=()=>{const[t,s]=r(""),[c,g]=r(!0),[f,d]=r(!1),[S,m]=r("");z(()=>{k.auth.allowedOrigins.query().then(a=>s(a.origins.join(", "))).catch(()=>m("Failed to load allowed origins")).finally(()=>g(!1))},[]);const i=async()=>{d(!0),m("");try{const a=await k.auth.setAllowedOrigins.mutate({origins:t});s(a.origins.join(", ")),m("Saved.")}catch(a){m(a.message)}finally{d(!1)}};return c?e("div",{className:T.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:T.sectionCard,children:[e("h3",{children:"Allowed Origins"}),e("p",{children:["Extra browser origins allowed to call the API, comma-separated. Include the scheme (e.g."," ",e("code",{children:"https://example.com"}),"). Same-origin access and reverse proxies that forward X-Forwarded-Host/X-Forwarded-Proto work automatically."]}),e("div",{className:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"allowed-origins",children:"Origins"}),e("input",{id:"allowed-origins",value:t,onChange:a=>s(a.currentTarget.value),className:q.input,placeholder:"https://example.com"})]}),e("div",{className:q.actions,children:e(C,{variant:"primary",onClick:i,loading:f,disabled:f,children:"Save Origins"})}),S&&e("p",{className:q.status,children:S})]})]})},Na=()=>{const{theme:t,setTheme:s,loading:c}=He();return e("div",{children:[e("h4",{style:{margin:"0 0 0.25rem",fontSize:"1rem"},children:"Palette"}),e("p",{style:{margin:"0 0 0.75rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Taro is the default. Pick a palette that suits you."}),e("div",{role:"radiogroup","aria-label":"Palette",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"0.6rem"},children:Be.map(g=>{const f=t===g.id;return e("button",{role:"radio","aria-checked":f,disabled:c,onClick:()=>s(g.id),style:{display:"flex",gap:"0.6rem",alignItems:"center",textAlign:"left",padding:"0.65rem 0.75rem",borderRadius:"10px",cursor:"pointer",background:f?"var(--accent-subtle)":"var(--bg-tertiary)",border:f?"1px solid var(--accent)":"1px solid var(--border-primary)",color:"var(--text-primary)"},children:[e("span",{"aria-hidden":!0,style:{width:26,height:26,borderRadius:"50%",flex:"none",background:g.swatch,border:"1px solid rgba(0,0,0,0.35)"}}),e("span",{style:{minWidth:0},children:[e("span",{style:{display:"block",fontSize:"0.85rem",fontWeight:700},children:g.label}),e("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g.blurb})]})]},g.id)})})]})};function _a({variant:t="info",children:s,className:c=""}){return e("div",{className:`alert alert-${t} ${c}`,children:s})}const Ta={anime:"Watchlist",manga:"Reading List",tv:"TV Watchlist",asmr:"Listening List"},Te=["general","presence","server","sync","watchlist","database"],Aa=()=>{const{data:t}=fe(ee),[s,c]=Ke(),{contentType:g}=Pe(),f=s.get("tab"),[d,S]=r(f&&Te.includes(f)?f:"general"),[m,i]=r(""),a=Z(null),p=Z(null),v=Z(new Map),[u,P]=r({top:0,height:0,left:0,width:0}),{lowEndMode:l,setLowEndMode:y}=je(),{hasConsent:_,grant:L,revoke:M}=Qe(),[I,w]=r(!1),[x,O]=r(Ve),[G,o]=r(Ze),[R,A]=r(!0),{data:$}=de("discordRPCEnabled"),Q=Le(),[N,ye]=r(!0),{data:ie}=de("dangoGaze"),[Ie,ve]=r(!0),{data:ae}=de("discordRPCHideMature"),[we,oe]=r(""),[ne,ce]=r(null);z(()=>{t?.owner&&k.discord.gatewayStatus.query().then(n=>{ce(n),n.masked&&n.masked!=="none"&&oe(n.masked)}).catch(()=>{})},[t?.owner]),z(()=>{$!==void 0&&A($==="true"||$===!0||$===null)},[$]),z(()=>{ae!==void 0&&ve(ae==="true"||ae===!0||ae===null)},[ae]);const xe=n=>{A(n),Q.mutate({key:"discordRPCEnabled",value:String(n)})};z(()=>{ie!==void 0&&ye(ie!=="false"&&ie!==!1)},[ie]);const Re=n=>{ye(n),Q.mutate({key:"dangoGaze",value:String(n)})},De=n=>{ve(n),Q.mutate({key:"discordRPCHideMature",value:String(n)})},Oe=n=>{O(n),Ye.setItem(Je,String(n)),window.dispatchEvent(new CustomEvent(Xe))},Ae=n=>{o(n),et(n)};Ce.useEffect(()=>{document.title="Settings - dango"},[]),Ce.useEffect(()=>{const n=s.get("tab");n&&Te.includes(n)&&S(n)},[s]);const Y=n=>{S(n),c(n==="general"?{}:{tab:n})},re=pe(()=>{const n=v.current.get(d),K=p.current;if(n&&K){const J=K.getBoundingClientRect(),W=n.getBoundingClientRect(),se=window.matchMedia("(max-width: 900px)").matches;P(se?{top:W.top-J.top,height:W.height,left:W.left-J.left,width:W.width}:{top:W.top-J.top,height:W.height,left:0,width:0})}},[d]);Ue(()=>{re()},[d,re]),z(()=>{const n=()=>re();window.addEventListener("resize",n);let K=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{K||re()}),()=>{K=!0,window.removeEventListener("resize",n)}},[d,re]);const Ge=()=>{i("Exporting databases...");const n=window.DangoBridge;if(n?.downloadFile){n.downloadFile("/api/backup-db","dango-backup.json"),setTimeout(()=>{i("Databases exported successfully!")},1500);return}const K=document.createElement("a");K.href="/api/backup-db",K.download="dango-backup.json",document.body.appendChild(K),K.click(),K.remove(),setTimeout(()=>{i("Databases exported successfully!")},1500)},Me=async n=>{const K=n.currentTarget.files?.[0];if(!K)return;i("Importing databases...");const J=new FormData;J.append("dbfile",K);try{const W=await X("/api/restore-db",{method:"POST",body:J}),se=await W.json();if(W.ok){const be=Array.isArray(se.restored)?se.restored.join(", "):null;i(be?`Databases imported successfully (${be})!`:"Database imported successfully!"),setTimeout(()=>window.location.reload(),2e3)}else i(`Import failed: ${se.error}`)}catch{i("Import failed: An unexpected error occurred.")}finally{n.currentTarget.value=""}},qe=()=>{a.current?.click()},ze=()=>{switch(d){case"general":return e("div",{className:h.tabContent,children:[e(st,{}),e("div",{className:T.sectionCard,children:[e("h3",{children:"Appearance & Preferences"}),e("p",{children:"Configure how titles are displayed and other general preferences."}),e("div",{className:h.settingItem,children:e(it,{})}),e("div",{className:h.settingItem,style:{marginTop:"1.5rem"},children:e(Na,{})}),e("div",{className:h.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:T.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Low End Mode"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Disables animations and heavy visual effects for better performance on older hardware."})]}),e(F,{isChecked:l,onChange:n=>y(n.currentTarget.checked),id:"low-end-mode"})]})}),e("div",{className:h.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:T.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Watched Episode Overlay"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Shows watched and completed episodes as an overlay on the player. Turn this off to use a popup instead."})]}),e(F,{isChecked:G,onChange:n=>Ae(n.currentTarget.checked),id:"watched-overlay-enabled"})]})}),e("div",{className:h.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:T.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Dango Animations"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Lets the dango logo look around, blink and react when you pet it. Always off in Low End Mode."})]}),e(F,{isChecked:N,onChange:n=>Re(n.currentTarget.checked),id:"dango-gaze"})]})}),e("div",{className:h.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:T.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Virtual Keyboard"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Shows an on-screen keyboard when text search fields are focused."})]}),e(F,{isChecked:x,onChange:n=>Oe(n.currentTarget.checked),id:"virtual-keyboard-enabled"})]})})]}),e("section",{className:T.sectionCard,children:[e("h3",{children:"Keyboard Shortcuts"}),e("p",{children:"Use S or Ctrl+K to focus search anywhere, or use player keys while watching."}),e("div",{className:h.shortcutContainer,children:[e("div",{className:h.shortcutGroup,children:[e("h4",{className:h.shortcutGroupTitle,children:"Search"}),e("div",{className:h.shortcutGrid,children:[e("div",{className:h.shortcutCard,children:[e("kbd",{children:"S"}),e("span",{children:"Focus search"})]}),e("div",{className:h.shortcutCard,children:[e("kbd",{children:"Ctrl + K / ⌘ + K"}),e("span",{children:"Focus search"})]})]})]}),e("div",{className:h.shortcutGroup,children:[e("h4",{className:h.shortcutGroupTitle,children:"Player"}),e("div",{className:h.shortcutGrid,children:[e("div",{className:h.shortcutCard,children:[e("kbd",{children:"Space / K"}),e("span",{children:"Play / pause"})]}),e("div",{className:h.shortcutCard,children:[e("kbd",{children:"J / L · ← / →"}),e("span",{children:"Seek back / fwd"})]}),e("div",{className:h.shortcutCard,children:[e("kbd",{children:"↑ / ↓"}),e("span",{children:"Adjust volume"})]}),e("div",{className:h.shortcutCard,children:[e("kbd",{children:"M / F"}),e("span",{children:"Mute / fullscreen"})]}),e("div",{className:h.shortcutCard,children:[e("kbd",{children:"N / P"}),e("span",{children:"Next / prev episode"})]}),e("div",{className:h.shortcutCard,children:[e("kbd",{children:"T"}),e("span",{children:"Theater mode"})]})]})]})]})]})]});case"presence":return e("div",{className:h.tabContent,children:e("div",{className:T.sectionCard,children:[e("h3",{children:"Presence & Content"}),e("p",{children:"Control what Dango shares on Discord and your mature-content preference."}),t?.owner&&e("div",{className:h.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:T.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Discord Rich Presence"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Show your current anime and watch progress on your Discord profile status."})]}),e(F,{isChecked:R,onChange:n=>xe(n.currentTarget.checked),id:"discord-rpc-enabled"})]})}),t?.owner&&R&&e("div",{className:h.settingItem,style:{marginTop:"1rem"},children:e("div",{className:T.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Hide Mature Content"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Hide mature content (18+) from Discord Rich Presence."})]}),e(F,{isChecked:Ie,onChange:n=>De(n.currentTarget.checked),id:"discord-hide-mature"})]})}),t?.owner&&e("div",{className:h.settingItem,style:{marginTop:"1.5rem",background:"var(--bg-tertiary)",padding:"1rem",borderRadius:"8px",border:"1px solid var(--border-color)"},children:[e("div",{className:T.settingRow,children:e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Discord Mobile Presence (Gateway)"}),e("p",{style:{margin:"0.25rem 0 0.75rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Paste your Discord authentication token to enable presence on mobile devices. If no token is saved, the default desktop Rich Presence is used. The token is stored locally in your configuration and never shared."})]})}),e(_a,{variant:"warning",style:{marginTop:"1.25rem",paddingTop:"1.25rem"},children:[e("strong",{children:"Use at your own risk."})," This feature uses the Discord Gateway API with your user token, which violates Discord's Terms of Service. Discord may detect this usage and take action against your account, including phone number locks, temporary suspensions, or permanent bans. While the risk is generally low, it is not zero. Only use this if you understand and accept the risks."]}),e("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.5rem",alignItems:"center",flexWrap:"wrap"},children:[e("input",{type:"password",value:we,onChange:n=>oe(n.currentTarget.value),placeholder:"Paste Discord token here...",style:{flex:"1 1 200px",padding:"0.5rem",borderRadius:"4px",border:"1px solid var(--border-color)",background:"var(--bg-primary)",color:"var(--text-primary)",fontFamily:"monospace",minWidth:0}}),e(C,{variant:"primary",size:"sm",onClick:async()=>{try{const n=await k.discord.gatewaySave.mutate({token:we});ce({hasToken:!0,masked:n.masked,enabled:!0}),oe(n.masked)}catch(n){alert(n instanceof Error?n.message:"Failed to save token")}},children:"Save"}),e(C,{variant:"secondary",size:"sm",onClick:async()=>{await k.discord.gatewayRemove.mutate().catch(()=>{}),oe(""),ce({hasToken:!1,masked:null,enabled:!1})},children:"Remove"})]}),ne&&e("p",{style:{marginTop:"0.5rem",fontSize:"0.8rem",color:ne.hasToken?"green":"var(--text-secondary)"},children:["Status:"," ",ne.hasToken?`Token saved (${ne.masked})`:"No token saved",ne.enabled?" - Gateway active":""]}),t?.owner&&e(pa,{})]}),e("div",{className:h.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:T.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Mature Content"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Allow mature content intended for adults 18 and older. Turning this off restores filtering and blur gates."})]}),e(F,{isChecked:_,onChange:n=>{n.currentTarget.checked?w(!0):(M(),window.location.reload())},id:"mature-content-enabled"})]})})]})});case"server":return e("div",{className:h.tabContent,children:[t?.owner&&e(Ca,{}),t?.owner&&e(ka,{}),t?.owner&&e(Sa,{})]});case"sync":return e("div",{className:h.tabContent,children:[e(ga,{}),e(Mt,{}),e(qt,{}),t?.owner&&e(ha,{})]});case"watchlist":return e("div",{className:h.tabContent,children:e(Bt,{})});case"database":return e("div",{className:h.tabContent,children:[e("div",{className:T.sectionCard,children:[e("h3",{children:"Database Management"}),e("p",{children:"Download a backup of all databases (anime, manga, TV and ASMR) or restore from a backup file. Legacy single-file anime (.db) backups can still be restored."}),e("div",{className:h.controls,children:[e(C,{onClick:Ge,children:"Backup Database"}),e(C,{variant:"secondary",onClick:qe,children:"Restore Database"})]}),e("input",{type:"file",ref:a,onChange:Me,style:{position:"absolute",width:1,height:1,opacity:0,overflow:"hidden"},accept:".json,.db,application/octet-stream"}),m&&e("p",{className:h.status,children:m})]}),t?.owner&&e(oa,{}),e(ua,{})]});default:return null}};return e("div",{className:"page-container",children:[e("div",{className:h.settingsHeader,children:[e("h1",{className:h.pageTitle,children:"Settings"}),e("p",{className:h.pageSubtitle,children:"Manage your preferences and data synchronization"})]}),e("div",{className:h.settingsLayout,children:[e("aside",{className:h.sidebar,ref:p,children:[e("div",{className:h.sidebarIndicator,style:{top:u.top,height:u.height,left:u.left,...u.width?{width:u.width}:{}}}),e("button",{ref:n=>{n&&v.current.set("general",n)},className:`${h.sidebarItem} ${d==="general"?h.active:""}`,onClick:()=>Y("general"),children:[e(j,{name:"cog"})," ",e("span",{children:"General"})]}),e("button",{ref:n=>{n&&v.current.set("presence",n)},className:`${h.sidebarItem} ${d==="presence"?h.active:""}`,onClick:()=>Y("presence"),children:[e(j,{name:"discord"})," ",e("span",{children:"Presence"})]}),e("button",{ref:n=>{n&&v.current.set("server",n)},className:`${h.sidebarItem} ${d==="server"?h.active:""}`,onClick:()=>Y("server"),children:[e(j,{name:"server"})," ",e("span",{children:"Server"})]}),e("button",{ref:n=>{n&&v.current.set("sync",n)},className:`${h.sidebarItem} ${d==="sync"?h.active:""}`,onClick:()=>Y("sync"),children:[e(j,{name:"cloud"})," ",e("span",{children:"Synchronization"})]}),e("button",{ref:n=>{n&&v.current.set("watchlist",n)},className:`${h.sidebarItem} ${d==="watchlist"?h.active:""}`,onClick:()=>Y("watchlist"),children:[e(j,{name:"list"})," ",e("span",{children:Ta[g]})]}),e("button",{ref:n=>{n&&v.current.set("database",n)},className:`${h.sidebarItem} ${d==="database"?h.active:""}`,onClick:()=>Y("database"),children:[e(j,{name:"database"})," ",e("span",{children:"Database"})]})]}),e("main",{className:h.mainContent,children:e("div",{className:h.tabContent,children:ze()},d)})]}),e(tt,{isOpen:I,onClose:()=>w(!1),onGrant:()=>{L(),w(!1)},scope:"section"})]})};export{Aa as default};
@@ -1 +1 @@
1
- import{u as o,g as r}from"./vendor-core-DfaOB3Rn.js";import{u as l}from"./index-CuAIqL2m.js";const a="_skeletonCard_qtypb_1",i="_poster_qtypb_11",d="_line_qtypb_20",c="_info_qtypb_38",_="_short_qtypb_54",m="_lowEnd_qtypb_69",e={skeletonCard:a,poster:i,line:d,"skeleton-wave":"_skeleton-wave_qtypb_1",info:c,short:_,lowEnd:m},p=({layout:n="vertical"})=>{const{lowEndMode:t}=l();return o("div",{className:`${e.skeletonCard} ${e[n]} ${t?e.lowEnd:""}`,children:[o("div",{className:e.poster}),o("div",{className:e.info,children:[o("div",{className:e.line}),o("div",{className:`${e.line} ${e.short}`})]})]})},v=({count:n=14,layout:t="vertical"})=>o("div",{className:"grid-container",children:Array.from({length:n}).map((k,s)=>o(p,{layout:t},s))}),w=r.memo(v);export{p as A,w as S};
1
+ import{u as o,g as r}from"./vendor-core-DfaOB3Rn.js";import{u as l}from"./index-BVkDKnzf.js";const a="_skeletonCard_qtypb_1",i="_poster_qtypb_11",d="_line_qtypb_20",c="_info_qtypb_38",_="_short_qtypb_54",m="_lowEnd_qtypb_69",e={skeletonCard:a,poster:i,line:d,"skeleton-wave":"_skeleton-wave_qtypb_1",info:c,short:_,lowEnd:m},p=({layout:n="vertical"})=>{const{lowEndMode:t}=l();return o("div",{className:`${e.skeletonCard} ${e[n]} ${t?e.lowEnd:""}`,children:[o("div",{className:e.poster}),o("div",{className:e.info,children:[o("div",{className:e.line}),o("div",{className:`${e.line} ${e.short}`})]})]})},v=({count:n=14,layout:t="vertical"})=>o("div",{className:"grid-container",children:Array.from({length:n}).map((k,s)=>o(p,{layout:t},s))}),w=r.memo(v);export{p as A,w as S};