@serifpersia/dango 4.0.4 → 4.0.5

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 (53) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-Dj2gXZQ_.js → AnimeCard-Dejl41Y9.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-FTnsxEMu.js → AnimeInfo-Knd2smb5.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-DaoQEHyi.js → AnimeInfoPage-CJ-sJXzb.js} +2 -2
  5. package/client/dist/assets/{Asmr-Dj290riM.js → Asmr-D2BKNSNd.js} +1 -1
  6. package/client/dist/assets/{AsmrPopup-DCxF-0FD.js → AsmrPopup-gLM0JlGP.js} +1 -1
  7. package/client/dist/assets/{AsmrResetProgressModal-BFgtJIjq.js → AsmrResetProgressModal-cCyCqM0y.js} +1 -1
  8. package/client/dist/assets/{Home-BvAHDt_3.js → Home-CsMgWycR.js} +1 -1
  9. package/client/dist/assets/{Insights-xaMU0gDH.js → Insights-BEpf49rM.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-y1J_sbu3.js → LibraryListPage-BUkJ9MFn.js} +1 -1
  11. package/client/dist/assets/{ListeningList-DxPvvTGs.js → ListeningList-H-WkS0VL.js} +1 -1
  12. package/client/dist/assets/{Manga-Dc9QLjTm.js → Manga-6FX-ny6n.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-BHnn83Zv.js → MangaInfoPage-C6xCfHOM.js} +1 -1
  14. package/client/dist/assets/{MangaReadPage-CDQJ6lwj.js → MangaReadPage-BjqdvaOh.js} +1 -1
  15. package/client/dist/assets/{MangaResetProgressModal-Cw4txoU9.js → MangaResetProgressModal-BFAJChnc.js} +1 -1
  16. package/client/dist/assets/{Mature-DdHf-knG.js → Mature-Bwpv7C--.js} +1 -1
  17. package/client/dist/assets/{MatureConsentModal-BuJjdQ5N.js → MatureConsentModal-DNd8p-k1.js} +1 -1
  18. package/client/dist/assets/{MediaCard-FQr72c16.js → MediaCard-Bffh2g9C.js} +1 -1
  19. package/client/dist/assets/{OptionListMenu-CAjFAq0c.js → OptionListMenu-NiWeAIHX.js} +1 -1
  20. package/client/dist/assets/{Player-DO3lmGMJ.js → Player-NNpxqQwi.js} +2 -2
  21. package/client/dist/assets/{PlayerProvider-1nQxpPbi.js → PlayerProvider-NhvkxBzK.js} +1 -1
  22. package/client/dist/assets/{PlayerSettings-BxmbpvrQ.js → PlayerSettings-Dw7NDCnm.js} +1 -1
  23. package/client/dist/assets/{QueueOptionsButton-Tsij7x21.js → QueueOptionsButton-CRl4Dhom.js} +1 -1
  24. package/client/dist/assets/{QueueRail-DHSBCDXc.js → QueueRail-J8ert-Ey.js} +1 -1
  25. package/client/dist/assets/{ReadingList-Bl-49YU7.js → ReadingList-JpAZ_9Mj.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal-DIn1j8Qp.js → ResetProgressModal-CU2ithpX.js} +1 -1
  27. package/client/dist/assets/{Search-uY6VQ4os.js → Search-D-DnJTst.js} +1 -1
  28. package/client/dist/assets/{Settings-CHkvGAxk.js → Settings-F4CGjK1n.js} +1 -1
  29. package/client/dist/assets/{SkeletonGrid-xUVpcN5T.js → SkeletonGrid-B3sPNp5O.js} +1 -1
  30. package/client/dist/assets/{Trackers-DXrxbGg1.js → Trackers-CUlPOXTN.js} +1 -1
  31. package/client/dist/assets/{Tv-DFrBiMVQ.js → Tv-DPBpdr3A.js} +1 -1
  32. package/client/dist/assets/{TvInfo-eLmiGzwb.js → TvInfo-zdAQ3Wup.js} +1 -1
  33. package/client/dist/assets/{TvPopup-CaXs4L6B.js → TvPopup-BQPSFeCs.js} +1 -1
  34. package/client/dist/assets/{TvSearch-D_IGBBD8.js → TvSearch-BuNWu2c4.js} +1 -1
  35. package/client/dist/assets/{TvWatchlist-Ol8QK-C9.js → TvWatchlist-BpCDLs_Z.js} +1 -1
  36. package/client/dist/assets/{VirtualKeyboard-Bp-M8SVt.js → VirtualKeyboard-RZ5whICJ.js} +1 -1
  37. package/client/dist/assets/{WatchAlong-qJzs9_fD.js → WatchAlong-BQEEQ8qq.js} +1 -1
  38. package/client/dist/assets/{WatchAlongPanel-DLuYT4hH.js → WatchAlongPanel-COrLE1p0.js} +1 -1
  39. package/client/dist/assets/{Watchlist-DcAUYWtZ.js → Watchlist-McU_iHmN.js} +1 -1
  40. package/client/dist/assets/index-BkgRRmBf.js +179 -0
  41. package/client/dist/assets/{libraryInvalidation-Cv-7EfU1.js → libraryInvalidation-Ch1g3QJS.js} +1 -1
  42. package/client/dist/assets/{playbackCompletion-BTwrTq5S.js → playbackCompletion-B_Zin5ZR.js} +1 -1
  43. package/client/dist/assets/{useAnimeInfoData-tmC_S41n.js → useAnimeInfoData-BJmkWDD2.js} +1 -1
  44. package/client/dist/assets/{useMangaLibrary-CPluPl_T.js → useMangaLibrary-BMPk0isK.js} +1 -1
  45. package/client/dist/assets/{useMangaPopup-DRDWlEcN.js → useMangaPopup-Dp5HcQJ-.js} +1 -1
  46. package/client/dist/assets/{useProviders-aA8vRBov.js → useProviders-Byo6s6Ss.js} +1 -1
  47. package/client/dist/assets/{useTv-Dl0TYap6.js → useTv-zmGPcjV-.js} +1 -1
  48. package/client/dist/assets/{useTvLibrary-BCgO-d_K.js → useTvLibrary-DV4KK5BN.js} +1 -1
  49. package/client/dist/assets/{useWatchAlongPlayer-DfbkmL7h.js → useWatchAlongPlayer-B4f1qXt_.js} +1 -1
  50. package/client/dist/index.html +1 -1
  51. package/package.json +2 -2
  52. package/server/package.json +1 -1
  53. package/client/dist/assets/index-CkZCduQZ.js +0 -178
@@ -0,0 +1,179 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-CsMgWycR.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-Bffh2g9C.js","assets/vendor-icons-C1Pj_eSX.js","assets/MediaPopupShell-BewMMT93.js","assets/vendor-ui-3qrARCPr.js","assets/useIsMobile-Dvx1uJ82.js","assets/MediaPopupShell-D6Emr-co.css","assets/MatureConsentModal-DNd8p-k1.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-Co-j57uA.css","assets/AnimeCard-Dejl41Y9.js","assets/useAnimeInfoData-BJmkWDD2.js","assets/QueueOptionsButton-CRl4Dhom.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-B_Zin5ZR.js","assets/SkeletonGrid-B3sPNp5O.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-hMt90aG4.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-CU2ithpX.js","assets/QueueRail-J8ert-Ey.js","assets/QueueRail-CcHdXRmS.css","assets/useMangaPopup-Dp5HcQJ-.js","assets/useMangaLibrary-BMPk0isK.js","assets/libraryInvalidation-Ch1g3QJS.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-BFAJChnc.js","assets/useProviders-Byo6s6Ss.js","assets/useTv-zmGPcjV-.js","assets/TvPopup-BQPSFeCs.js","assets/useTvLibrary-DV4KK5BN.js","assets/AsmrResetProgressModal-cCyCqM0y.js","assets/AsmrPopup-gLM0JlGP.js","assets/Home-Bmc4hGfd.css","assets/Watchlist-McU_iHmN.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-F4CGjK1n.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-B57LhIVH.css","assets/Player-NNpxqQwi.js","assets/PlayerProvider-NhvkxBzK.js","assets/PlayerProvider-ZeplRma-.css","assets/useWatchAlongPlayer-B4f1qXt_.js","assets/useWatchAlongPlayer-Dk7zB7P4.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/WatchAlongPanel-COrLE1p0.js","assets/WatchAlongPanel-DWb8lSzW.css","assets/Player-1LfYnRyR.css","assets/WatchAlong-BQEEQ8qq.js","assets/Search-D-DnJTst.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature-Bwpv7C--.js","assets/Mature-DJmUUtlF.css","assets/Asmr-D2BKNSNd.js","assets/useAsmrPopup-BBmHrx9v.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Do89pEHG.css","assets/Manga-6FX-ny6n.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-C6xCfHOM.js","assets/MangaReadPage-BjqdvaOh.js","assets/ReadingList-JpAZ_9Mj.js","assets/LibraryListPage-BUkJ9MFn.js","assets/TvSearch-BuNWu2c4.js","assets/TvInfo-zdAQ3Wup.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-DPBpdr3A.js","assets/OptionListMenu-NiWeAIHX.js","assets/Tv-C-bNPNTQ.css","assets/TvWatchlist-BpCDLs_Z.js","assets/ListeningList-H-WkS0VL.js","assets/Trackers-CUlPOXTN.js","assets/Trackers-BC636V59.css","assets/Insights-BEpf49rM.js","assets/Insights-Cn3L3buF.css","assets/AnimeInfoPage-CJ-sJXzb.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-RZ5whICJ.js","assets/VirtualKeyboard-CejCi3pJ.css"])))=>i.map(i=>d[i]);
2
+ import{N as kr,k as re,A as j,q as V,h as S,S as ye,d as y,u as o,X as be,x as we,T as je,$ as On,g as Ot,L as me,a as Ln,c as Ze,e as Tr,f as Pr,D as Ir,i as Nr,P as Gt,j as Cr,l as $,m as Jt,z as U,n as xr,B as Ar}from"./vendor-core-DfaOB3Rn.js";import{s as Ae,i as Or,q as Lr,u as ae,a as pe,b as F,c as ht,Q as Rr,d as qr}from"./vendor-query-BBT5_sHx.js";import{I}from"./vendor-icons-C1Pj_eSX.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();const Dr="modulepreload",$r=function(e){return"/"+e},Yt={},H=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");s=u(n.map(l=>{if(l=$r(l),l in Yt)return;Yt[l]=!0;const d=l.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Dr,d||(p.as="script"),p.crossOrigin="",p.href=l,c&&p.setAttribute("nonce",c),document.head.appendChild(p),d)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return s.then(i=>{for(const c of i||[])c.status==="rejected"&&a(c.reason);return t().catch(a)})};let jr={data:""},Mr=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||jr},Br=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Fr=/\/\*[^]*?\*\/| +/g,Zt=/\n+/g,Te=(e,t)=>{let n="",r="",s="";for(let a in e){let i=e[a];a[0]=="@"?a[1]=="i"?n=a+" "+i+";":r+=a[1]=="f"?Te(i,a):a+"{"+Te(i,a[1]=="k"?"":t)+"}":typeof i=="object"?r+=Te(i,t?t.replace(/([^,])+/g,c=>a.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,c):c?c+" "+u:u)):a):i!=null&&(a=a[1]=="-"?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Te.p?Te.p(a,i):a+":"+i+";")}return n+(t&&s?t+"{"+s+"}":s)+r},ke={},Rn=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+Rn(e[n]);return t}return e},Wr=(e,t,n,r,s)=>{let a=Rn(e),i=ke[a]||(ke[a]=(u=>{let l=0,d=11;for(;l<u.length;)d=101*d+u.charCodeAt(l++)>>>0;return"go"+d})(a));if(!ke[i]){let u=a!==e?e:(l=>{let d,m,p=[{}];for(;d=Br.exec(l.replace(Fr,""));)d[4]?p.shift():d[3]?(m=d[3].replace(Zt," ").trim(),p.unshift(p[0][m]=p[0][m]||{})):p[0][d[1]]=d[2].replace(Zt," ").trim();return p[0]})(e);ke[i]=Te(s?{["@keyframes "+i]:u}:u,n?"":"."+i)}let c=n&&ke.g;return n&&(ke.g=ke[i]),((u,l,d,m)=>{m?l.data=l.data.replace(m,u):l.data.indexOf(u)===-1&&(l.data=d?u+l.data:l.data+u)})(ke[i],t,r,c),i},Kr=(e,t,n)=>e.reduce((r,s,a)=>{let i=t[a];if(i&&i.call){let c=i(n),u=c&&c.props&&c.props.className||/^go/.test(c)&&c;i=u?"."+u:c&&typeof c=="object"?c.props?"":Te(c,""):c===!1?"":c}return r+s+(i??"")},"");function ft(e){let t=this||{},n=e.call?e(t.p):e;return Wr(n.unshift?n.raw?Kr(n,[].slice.call(arguments,1),t.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(t.p):s),{}):n,Mr(t.target),t.g,t.o,t.k)}let qn,_t,St;ft.bind({g:1});let Se=ft.bind({k:1});function Ur(e,t,n,r){Te.p=t,qn=e,_t=n,St=r}function Pe(e,t){let n=this||{};return function(){let r=arguments;function s(a,i){let c=Object.assign({},a),u=c.className||s.className;n.p=Object.assign({theme:_t&&_t()},c),n.o=/go\d/.test(u),c.className=ft.apply(n,r)+(u?" "+u:"");let l=e;return e[0]&&(l=c.as||e,delete c.as),St&&l[0]&&St(c),qn(l,c)}return s}}var Hr=e=>typeof e=="function",dt=(e,t)=>Hr(e)?e(t):e,zr=(()=>{let e=0;return()=>(++e).toString()})(),Dn=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Qr=20,Lt="default",$n=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(i=>i.id===t.toast.id?{...i,...t.toast}:i)};case 2:let{toast:r}=t;return $n(e,{type:e.toasts.find(i=>i.id===r.id)?1:0,toast:r});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(i=>i.id===s||s===void 0?{...i,dismissed:!0,visible:!1}:i)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(i=>i.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let a=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+a}))}}},ct=[],jn={toasts:[],pausedAt:void 0,settings:{toastLimit:Qr}},ve={},Mn=(e,t=Lt)=>{ve[t]=$n(ve[t]||jn,e),ct.forEach(([n,r])=>{n===t&&r(ve[t])})},Bn=e=>Object.keys(ve).forEach(t=>Mn(e,t)),Vr=e=>Object.keys(ve).find(t=>ve[t].toasts.some(n=>n.id===e)),gt=(e=Lt)=>t=>{Mn(t,e)},Gr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Jr=(e={},t=Lt)=>{let[n,r]=y(ve[t]||jn),s=j(ve[t]);S(()=>(s.current!==ve[t]&&r(ve[t]),ct.push([t,r]),()=>{let i=ct.findIndex(([c])=>c===t);i>-1&&ct.splice(i,1)}),[t]);let a=n.toasts.map(i=>{var c,u,l;return{...e,...e[i.type],...i,removeDelay:i.removeDelay||((c=e[i.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:i.duration||((u=e[i.type])==null?void 0:u.duration)||e?.duration||Gr[i.type],style:{...e.style,...(l=e[i.type])==null?void 0:l.style,...i.style}}});return{...n,toasts:a}},Yr=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:n?.id||zr()}),Xe=e=>(t,n)=>{let r=Yr(t,e,n);return gt(r.toasterId||Vr(r.id))({type:2,toast:r}),r.id},Y=(e,t)=>Xe("blank")(e,t);Y.error=Xe("error");Y.success=Xe("success");Y.loading=Xe("loading");Y.custom=Xe("custom");Y.dismiss=(e,t)=>{let n={type:3,toastId:e};t?gt(t)(n):Bn(n)};Y.dismissAll=e=>Y.dismiss(void 0,e);Y.remove=(e,t)=>{let n={type:4,toastId:e};t?gt(t)(n):Bn(n)};Y.removeAll=e=>Y.remove(void 0,e);Y.promise=(e,t,n)=>{let r=Y.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let a=t.success?dt(t.success,s):void 0;return a?Y.success(a,{id:r,...n,...n?.success}):Y.dismiss(r),s}).catch(s=>{let a=t.error?dt(t.error,s):void 0;a?Y.error(a,{id:r,...n,...n?.error}):Y.dismiss(r)}),e};var Zr=1e3,Xr=(e,t="default")=>{let{toasts:n,pausedAt:r}=Jr(e,t),s=j(new Map).current,a=V((m,p=Zr)=>{if(s.has(m))return;let h=setTimeout(()=>{s.delete(m),i({type:4,toastId:m})},p);s.set(m,h)},[]);S(()=>{if(r)return;let m=Date.now(),p=n.map(h=>{if(h.duration===1/0)return;let g=(h.duration||0)+h.pauseDuration-(m-h.createdAt);if(g<0){h.visible&&Y.dismiss(h.id);return}return setTimeout(()=>Y.dismiss(h.id,t),g)});return()=>{p.forEach(h=>h&&clearTimeout(h))}},[n,r,t]);let i=V(gt(t),[t]),c=V(()=>{i({type:5,time:Date.now()})},[i]),u=V((m,p)=>{i({type:1,toast:{id:m,height:p}})},[i]),l=V(()=>{r&&i({type:6,time:Date.now()})},[r,i]),d=V((m,p)=>{let{reverseOrder:h=!1,gutter:g=8,defaultPosition:b}=p||{},A=n.filter(E=>(E.position||b)===(m.position||b)&&E.height),v=A.findIndex(E=>E.id===m.id),O=A.filter((E,N)=>N<v&&E.visible).length;return A.filter(E=>E.visible).slice(...h?[O+1]:[0,O]).reduce((E,N)=>E+(N.height||0)+g,0)},[n]);return S(()=>{n.forEach(m=>{if(m.dismissed)a(m.id,m.removeDelay);else{let p=s.get(m.id);p&&(clearTimeout(p),s.delete(m.id))}})},[n,a]),{toasts:n,handlers:{updateHeight:u,startPause:c,endPause:l,calculateOffset:d}}},eo=Se`
3
+ from {
4
+ transform: scale(0) rotate(45deg);
5
+ opacity: 0;
6
+ }
7
+ to {
8
+ transform: scale(1) rotate(45deg);
9
+ opacity: 1;
10
+ }`,to=Se`
11
+ from {
12
+ transform: scale(0);
13
+ opacity: 0;
14
+ }
15
+ to {
16
+ transform: scale(1);
17
+ opacity: 1;
18
+ }`,no=Se`
19
+ from {
20
+ transform: scale(0) rotate(90deg);
21
+ opacity: 0;
22
+ }
23
+ to {
24
+ transform: scale(1) rotate(90deg);
25
+ opacity: 1;
26
+ }`,ro=Pe("div")`
27
+ width: 20px;
28
+ opacity: 0;
29
+ height: 20px;
30
+ border-radius: 10px;
31
+ background: ${e=>e.primary||"#ff4b4b"};
32
+ position: relative;
33
+ transform: rotate(45deg);
34
+
35
+ animation: ${eo} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
36
+ forwards;
37
+ animation-delay: 100ms;
38
+
39
+ &:after,
40
+ &:before {
41
+ content: '';
42
+ animation: ${to} 0.15s ease-out forwards;
43
+ animation-delay: 150ms;
44
+ position: absolute;
45
+ border-radius: 3px;
46
+ opacity: 0;
47
+ background: ${e=>e.secondary||"#fff"};
48
+ bottom: 9px;
49
+ left: 4px;
50
+ height: 2px;
51
+ width: 12px;
52
+ }
53
+
54
+ &:before {
55
+ animation: ${no} 0.15s ease-out forwards;
56
+ animation-delay: 180ms;
57
+ transform: rotate(90deg);
58
+ }
59
+ `,oo=Se`
60
+ from {
61
+ transform: rotate(0deg);
62
+ }
63
+ to {
64
+ transform: rotate(360deg);
65
+ }
66
+ `,ao=Pe("div")`
67
+ width: 12px;
68
+ height: 12px;
69
+ box-sizing: border-box;
70
+ border: 2px solid;
71
+ border-radius: 100%;
72
+ border-color: ${e=>e.secondary||"#e0e0e0"};
73
+ border-right-color: ${e=>e.primary||"#616161"};
74
+ animation: ${oo} 1s linear infinite;
75
+ `,so=Se`
76
+ from {
77
+ transform: scale(0) rotate(45deg);
78
+ opacity: 0;
79
+ }
80
+ to {
81
+ transform: scale(1) rotate(45deg);
82
+ opacity: 1;
83
+ }`,io=Se`
84
+ 0% {
85
+ height: 0;
86
+ width: 0;
87
+ opacity: 0;
88
+ }
89
+ 40% {
90
+ height: 0;
91
+ width: 6px;
92
+ opacity: 1;
93
+ }
94
+ 100% {
95
+ opacity: 1;
96
+ height: 10px;
97
+ }`,co=Pe("div")`
98
+ width: 20px;
99
+ opacity: 0;
100
+ height: 20px;
101
+ border-radius: 10px;
102
+ background: ${e=>e.primary||"#61d345"};
103
+ position: relative;
104
+ transform: rotate(45deg);
105
+
106
+ animation: ${so} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
107
+ forwards;
108
+ animation-delay: 100ms;
109
+ &:after {
110
+ content: '';
111
+ box-sizing: border-box;
112
+ animation: ${io} 0.2s ease-out forwards;
113
+ opacity: 0;
114
+ animation-delay: 200ms;
115
+ position: absolute;
116
+ border-right: 2px solid;
117
+ border-bottom: 2px solid;
118
+ border-color: ${e=>e.secondary||"#fff"};
119
+ bottom: 6px;
120
+ left: 6px;
121
+ height: 10px;
122
+ width: 6px;
123
+ }
124
+ `,lo=Pe("div")`
125
+ position: absolute;
126
+ `,uo=Pe("div")`
127
+ position: relative;
128
+ display: flex;
129
+ justify-content: center;
130
+ align-items: center;
131
+ min-width: 20px;
132
+ min-height: 20px;
133
+ `,mo=Se`
134
+ from {
135
+ transform: scale(0.6);
136
+ opacity: 0.4;
137
+ }
138
+ to {
139
+ transform: scale(1);
140
+ opacity: 1;
141
+ }`,po=Pe("div")`
142
+ position: relative;
143
+ transform: scale(0.6);
144
+ opacity: 0.4;
145
+ min-width: 20px;
146
+ animation: ${mo} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
147
+ forwards;
148
+ `,ho=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?re(po,null,t):t:n==="blank"?null:re(uo,null,re(ao,{...r}),n!=="loading"&&re(lo,null,n==="error"?re(ro,{...r}):re(co,{...r})))},fo=e=>`
149
+ 0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
150
+ 100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
151
+ `,go=e=>`
152
+ 0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
153
+ 100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
154
+ `,yo="0%{opacity:0;} 100%{opacity:1;}",vo="0%{opacity:1;} 100%{opacity:0;}",bo=Pe("div")`
155
+ display: flex;
156
+ align-items: center;
157
+ background: #fff;
158
+ color: #363636;
159
+ line-height: 1.3;
160
+ will-change: transform;
161
+ box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
162
+ max-width: 350px;
163
+ pointer-events: auto;
164
+ padding: 8px 10px;
165
+ border-radius: 8px;
166
+ `,wo=Pe("div")`
167
+ display: flex;
168
+ justify-content: center;
169
+ margin: 4px 10px;
170
+ color: inherit;
171
+ flex: 1 1 auto;
172
+ white-space: pre-line;
173
+ `,_o=(e,t)=>{let n=e.includes("top")?1:-1,[r,s]=Dn()?[yo,vo]:[fo(n),go(n)];return{animation:t?`${Se(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${Se(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},So=kr(({toast:e,position:t,style:n,children:r})=>{let s=e.height?_o(e.position||t||"top-center",e.visible):{opacity:0},a=re(ho,{toast:e}),i=re(wo,{...e.ariaProps},dt(e.message,e));return re(bo,{className:e.className,style:{...s,...n,...e.style}},typeof r=="function"?r({icon:a,message:i}):re(ye,null,a,i))});Ur(re);var Eo=({id:e,className:t,style:n,onHeightUpdate:r,children:s})=>{let a=V(i=>{if(i){let c=()=>{let u=i.getBoundingClientRect().height;r(e,u)};c(),new MutationObserver(c).observe(i,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return re("div",{ref:a,className:t,style:n},s)},ko=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Dn()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...s}},To=ft`
174
+ z-index: 9999;
175
+ > * {
176
+ pointer-events: auto;
177
+ }
178
+ `,nt=16,Fn=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:s,toasterId:a,containerStyle:i,containerClassName:c})=>{let{toasts:u,handlers:l}=Xr(n,a);return re("div",{"data-rht-toaster":a||"",style:{position:"fixed",zIndex:9999,top:nt,left:nt,right:nt,bottom:nt,pointerEvents:"none",...i},className:c,onMouseEnter:l.startPause,onMouseLeave:l.endPause},u.map(d=>{let m=d.position||t,p=l.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),h=ko(m,p);return re(Eo,{id:d.id,key:d.id,onHeightUpdate:l.updateHeight,className:d.visible?To:"",style:h},d.type==="custom"?dt(d.message,d):s?s(d):re(So,{toast:d,position:m}))}))},C=Y;const Po="_fadeImage_1bp3x_1",Io="_loaded_1bp3x_6",Xt={fadeImage:Po,loaded:Io},Wn=({className:e,onLoad:t,onError:n,...r})=>{const s=r.src,[a,i]=y(null),c=a!==null&&a===s;return o("img",{...r,className:`${e??""} ${Xt.fadeImage} ${c?Xt.loaded:""}`,onLoad:u=>{i(s),t?.(u)},onError:u=>{i(s),n?.(u)}})};function yt(e){const t={subscribe(n){let r=null,s=!1,a=!1,i=!1;function c(){if(r===null){i=!0;return}a||(a=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(u){var l;s||(l=n.next)===null||l===void 0||l.call(n,u)},error(u){var l;s||(s=!0,(l=n.error)===null||l===void 0||l.call(n,u),c())},complete(){var u;s||(s=!0,(u=n.complete)===null||u===void 0||u.call(n),c())}}),i&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(No,t)}};return t}function No(e,t){return t(e)}function Co(e){const t=new AbortController;return new Promise((n,r)=>{let s=!1;function a(){s||(s=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const i=e.subscribe({next(c){s=!0,n(c),a()},error(c){r(c)},complete(){t.abort(),a()}})})}function xo(e){return t=>{let n=0,r=null;const s=[];function a(){r||(r=t.subscribe({next(c){for(const l of s){var u;(u=l.next)===null||u===void 0||u.call(l,c)}},error(c){for(const l of s){var u;(u=l.error)===null||u===void 0||u.call(l,c)}},complete(){for(const u of s){var c;(c=u.complete)===null||c===void 0||c.call(u)}}}))}function i(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return yt(c=>(n++,s.push(c),a(),{unsubscribe(){n--,i();const u=s.findIndex(l=>l===c);u>-1&&s.splice(u,1)}}))}}function Ao(e){let t=e;const n=[],r=i=>{t!==void 0&&i.next(t),n.push(i)},s=i=>{n.splice(n.indexOf(i),1)},a=yt(i=>(r(i),()=>{s(i)}));return a.next=i=>{if(t!==i){t=i;for(const c of n)c.next(i)}},a.get=()=>t,a}function Oo(e){return yt(t=>{function n(r=0,s=e.op){const a=e.links[r];if(!a)throw new Error("No more links to execute - did you forget to add an ending link?");return a({op:s,next(i){return n(r+1,i)}})}return n().subscribe(t)})}function Ge(e){"@babel/helpers - typeof";return Ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(e)}function Lo(e,t){if(Ge(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ge(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ro(e){var t=Lo(e,"string");return Ge(t)=="symbol"?t:t+""}function ce(e,t,n){return(t=Ro(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function en(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?en(Object(n),!0).forEach(function(r){ce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):en(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $e(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function qo(e){return typeof e=="function"}function Do(){return Object.create(null)}const $o=typeof Symbol=="function"&&!!Symbol.asyncIterator;function jo(e){return $o&&$e(e)&&Symbol.asyncIterator in e}const Et=e=>e(),Kn=()=>{},tn=e=>{Object.freeze&&Object.freeze(e)};function Un(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(Kn,{get(a,i){if(!(typeof i!="string"||i==="then"))return Un(e,[...t,i],n)},apply(a,i,c){const u=t[t.length-1];if(u==="valueOf"||u==="toString"||u==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let l={args:c,path:t};return u==="call"?l={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:u==="apply"&&(l={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),tn(l.args),tn(l.path),e(l)}})),n[s]}const Hn=e=>Un(e,[],Do()),Mo=e=>new Proxy(Kn,{get(t,n){if(n!=="then")return e(n)}});function Je(e){"@babel/helpers - typeof";return Je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(e)}function Bo(e,t){if(Je(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Je(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fo(e){var t=Bo(e,"string");return Je(t)=="symbol"?t:t+""}function nn(e,t,n){return(t=Fo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wo=class extends Error{constructor(e){super(Ko(e)),Object.assign(this,e)}};function Ko(e){if("message"in e)return String(e.message)}function Uo(e){if(e instanceof Error)return e;const t=typeof e;if(!(t==="undefined"||t==="function"||e===null)){if(t!=="object")return new Error(String(e));if($e(e))return new Wo(e)}}var rn=class extends Error{constructor(e){var t,n,r;const s=Uo(e.cause),a=(t=(n=e.message)!==null&&n!==void 0?n:s?.message)!==null&&t!==void 0?t:e.code;super(a,{cause:s}),nn(this,"cause",void 0),nn(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=s)}};function Ho(e){return typeof e=="function"}async function zo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const s=Object.keys(n.lazy).find(a=>t===a||t.startsWith(a+"."));if(!s)return null;await n.lazy[s].load(),r=n.procedures[t]}return r}async function Qo(e){const{type:t,path:n}=e,r=await zo(e.router,n);if(!r||!Ho(r)||r._def.type!==t&&!e.allowMethodOverride)throw new rn({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new rn({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}var on,an,sn,cn;(an=(on=Symbol).dispose)!==null&&an!==void 0||(on.dispose=Symbol());(cn=(sn=Symbol).asyncDispose)!==null&&cn!==void 0||(sn.asyncDispose=Symbol());function Vo(e,t){const n=e,r=n[Symbol.dispose];return n[Symbol.dispose]=()=>{t(),r?.call(n)},n}function ln(){var e=typeof SuppressedError=="function"?SuppressedError:function(s,a){var i=Error();return i.name="SuppressedError",i.error=s,i.suppressed=a,i},t={},n=[];function r(s,a){if(a!=null){if(Object(a)!==a)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(s)var i=a[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(i===void 0&&(i=a[Symbol.dispose||Symbol.for("Symbol.dispose")],s))var c=i;if(typeof i!="function")throw new TypeError("Object is not disposable.");c&&(i=function(){try{c.call(a)}catch(l){return Promise.reject(l)}}),n.push({v:a,d:i,a:s})}else s&&n.push({d:a,a:s});return a}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var a,i=this.e,c=0;function u(){for(;a=n.pop();)try{if(!a.a&&c===1)return c=0,n.push(a),Promise.resolve().then(u);if(a.d){var d=a.d.call(a.v);if(a.a)return c|=2,Promise.resolve(d).then(u,l)}else c|=1}catch(m){return l(m)}if(c===1)return i!==t?Promise.reject(i):Promise.resolve();if(i!==t)throw i}function l(d){return i=i!==t?new e(d,i):d,u()}return u()}}}function zn(e,t){this.v=e,this.k=t}function Go(e){return new zn(e,0)}function Jo(e){return function(){return new Ue(e.apply(this,arguments))}}function Ue(e){var t,n;function r(a,i){try{var c=e[a](i),u=c.value,l=u instanceof zn;Promise.resolve(l?u.v:u).then(function(d){if(l){var m=a==="return"?"return":"next";if(!u.k||d.done)return r(m,d);d=e[m](d).value}s(c.done?"return":"normal",d)},function(d){r("throw",d)})}catch(d){s("throw",d)}}function s(a,i){switch(a){case"return":t.resolve({value:i,done:!0});break;case"throw":t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(a,i){return new Promise(function(c,u){var l={key:a,arg:i,resolve:c,reject:u,next:null};n?n=n.next=l:(t=n=l,r(a,i))})},typeof e.return!="function"&&(this.return=void 0)}Ue.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Ue.prototype.next=function(e){return this._invoke("next",e)},Ue.prototype.throw=function(e){return this._invoke("throw",e)},Ue.prototype.return=function(e){return this._invoke("return",e)};function Yo(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const Zo=0,Xo=1,ea=0,ta=1,na=0,ra=1,oa=2;var un=class extends Error{constructor(e){super("Received error from server"),this.data=e}};const aa=e=>({getReader(){return new ReadableStream({start(t){e.on("data",n=>{t.enqueue(n)}),e.on("end",()=>{t.close()}),e.on("error",n=>{t.error(n)})}}).getReader()}});function sa(e){const t="getReader"in e?e.getReader():aa(e).getReader();let n="";return new ReadableStream({async pull(r){const{done:s,value:a}=await t.read();s?r.close():r.enqueue(a)},cancel(){return t.cancel()}}).pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform(r,s){var a;n+=r;const i=n.split(`
179
+ `);n=(a=i.pop())!==null&&a!==void 0?a:"";for(const c of i)s.enqueue(c)}}))}function ia(e){const t=sa(e);let n=!1;return t.pipeThrough(new TransformStream({transform(r,s){if(n){const a=JSON.parse(r);s.enqueue(a)}else{const a=JSON.parse(r);s.enqueue(a),n=!0}}}))}function ca(e){const t=new Map;function n(){return Array.from(t.values()).every(c=>c.closed)}function r(){let c;const u=new ReadableStream({start(m){c=m}}),l={enqueue:m=>c.enqueue(m),close:()=>{c.close(),d(),n()&&e.abort()},closed:!1,getReaderResource:()=>{const m=u.getReader();return Vo(m,()=>{l.close(),m.releaseLock()})},error:m=>{c.error(m),d()}};function d(){Object.assign(l,{closed:!0,close:()=>{},enqueue:()=>{},getReaderResource:null,error:()=>{}})}return l}function s(c){let u=t.get(c);return u||(u=r(),t.set(c,u)),u}function a(c){for(const u of t.values())u.error(c)}function i(){for(const c of t.values())c.close()}return{getOrCreate:s,cancelAll:a,closeAll:i}}async function la(e){const{deserialize:t=l=>l}=e;let n=ia(e.from);t&&(n=n.pipeThrough(new TransformStream({transform(l,d){d.enqueue(t(l))}})));let r=Yo();const s=ca(e.abortController);function a(l){const[d,m,p]=l,h=s.getOrCreate(p);switch(m){case Zo:return Et(async()=>{try{var g=ln();const{value:v}=await g.u(h.getReaderResource()).read(),[O,E,N]=v;switch(E){case ea:return i(N);case ta:var b,A;throw(b=(A=e.formatError)===null||A===void 0?void 0:A.call(e,{error:N}))!==null&&b!==void 0?b:new un(N)}}catch(v){g.e=v}finally{g.d()}});case Xo:return Et(Jo(function*(){try{var g=ln();const v=g.u(h.getReaderResource());for(;;){const{value:O}=yield Go(v.read()),[E,N,L]=O;switch(N){case ra:yield i(L);break;case na:return i(L);case oa:var b,A;throw(b=(A=e.formatError)===null||A===void 0?void 0:A.call(e,{error:L}))!==null&&b!==void 0?b:new un(L)}}}catch(v){g.e=v}finally{g.d()}}))}}function i(l){const[[d],...m]=l;for(const p of m){const[h]=p,g=a(p);if(h===null)return g;d[h]=g}return d}const c=()=>{r&&(r.reject(new Error("Stream closed before head was received")),r=null),s.closeAll()},u=l=>{r?.reject(l),r=null,s.cancelAll(l)};return n.pipeTo(new WritableStream({write(l){if(r){const p=l;for(const[h,g]of Object.entries(l))p[h]=i(g);r.resolve(p),r=null;return}const d=l,[m]=d;s.getOrCreate(m).enqueue(d)},close:c,abort:u})).catch(l=>{var d;(d=e.onError)===null||d===void 0||d.call(e,{error:l}),u(l)}),[await r.promise]}function ua(e){return e instanceof ze}function da(e){return $e(e)&&$e(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function ma(e,t){return typeof e=="string"?e:$e(e)&&typeof e.message=="string"?e.message:t}var ze=class lt extends Error{constructor(t,n){var r,s;const a=n?.cause;super(t,{cause:a}),ce(this,"cause",void 0),ce(this,"shape",void 0),ce(this,"data",void 0),ce(this,"meta",void 0),this.meta=n?.meta,this.cause=a,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(s=n.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,lt.prototype)}static from(t,n={}){const r=t;return ua(r)?(n.meta&&(r.meta=oe(oe({},r.meta),n.meta)),r):da(r)?new lt(r.error.message,oe(oe({},n),{},{result:r,cause:n.cause})):new lt(ma(r,"Unknown error"),oe(oe({},n),{},{cause:r}))}};function pa(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const dn=e=>typeof e=="function";function ha(e){if(e)return e;if(typeof window<"u"&&dn(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&dn(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function fa(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const a of e)a?.aborted?s():a?.addEventListener("abort",s,{once:!0});return t.signal}function mn(...e){const t=new AbortController;for(const n of e)n?.aborted?t.abort():n?.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}function ga(e){return{url:e.url.toString(),fetch:e.fetch,transformer:pa(e.transformer),methodOverride:e.methodOverride}}function ya(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const va={query:"GET",mutation:"POST",subscription:"PATCH"};function Qn(e){return"input"in e?e.transformer.input.serialize(e.input):ya(e.inputs.map(t=>e.transformer.input.serialize(t)))}const pn=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const r=[];if(t[1]&&r.push(t[1]),"inputs"in e&&r.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=Qn(e);s!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return r.length&&(n+="?"+r.join("&")),n},ba=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Qn(e);return t!==void 0?JSON.stringify(t):void 0};var wa=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const _a=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new wa};async function Sa(e){var t,n;_a(e.signal);const r=e.getUrl(e),s=e.getBody(e),a=(t=e.methodOverride)!==null&&t!==void 0?t:va[e.type],i=await(async()=>{const u=await e.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),c=oe(oe(oe({},e.contentTypeHeader&&a!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),i);return ha(e.fetch)(r,{method:a,signal:e.signal,body:s,headers:c})}const hn=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function fn(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(c){const u=[[]];let l=0;for(;;){const p=c[l];if(!p)break;const h=u[u.length-1];if(p.aborted){var d;(d=p.reject)===null||d===void 0||d.call(p,new Error("Aborted")),l++;continue}if(e.validate(h.concat(p).map(g=>g.key))){h.push(p),l++;continue}if(h.length===0){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Input is too big for a single dispatch")),l++;continue}u.push([])}return u}function a(){const c=s(t);r();for(const u of c){if(!u.length)continue;const l={items:u};for(const d of u)d.batch=l;e.fetch(l.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(p,h)=>{const g=l.items[h];try{var b;const v=await Promise.resolve(p);(b=g.resolve)===null||b===void 0||b.call(g,v)}catch(v){var A;(A=g.reject)===null||A===void 0||A.call(g,v)}g.batch=null,g.reject=null,g.resolve=null}));for(const p of l.items){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Missing result")),p.batch=null}}).catch(d=>{for(const p of l.items){var m;(m=p.reject)===null||m===void 0||m.call(p,d),p.batch=null}})}}function i(c){var u;const l={aborted:!1,key:c,batch:null,resolve:hn,reject:hn},d=new Promise((m,p)=>{var h;l.reject=p,l.resolve=m,(h=t)!==null&&h!==void 0||(t=[]),t.push(l)});return(u=n)!==null&&u!==void 0||(n=setTimeout(a)),d}return{load:i}}const Vn=(e,...t)=>typeof e=="function"?e(...t):e;function Ea(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function ka(e){const t=await Vn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function Ta(e,t){const n={method:"connectionParams",data:await Vn(e)};return t.encode(n)}function Pa(e){const{promise:t,resolve:n,reject:r}=Ea();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function Ia(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function a(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}function i(){clearTimeout(r),a()}function c(){clearTimeout(s),i()}e.addEventListener("open",a),e.addEventListener("message",({data:u})=>{clearTimeout(r),a(),u==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var Na=class kt{constructor(t){var n;if(ce(this,"id",++kt.connectCount),ce(this,"WebSocketPonyfill",void 0),ce(this,"urlOptions",void 0),ce(this,"keepAliveOpts",void 0),ce(this,"encoder",void 0),ce(this,"wsObservable",Ao(null)),ce(this,"openPromise",null),this.WebSocketPonyfill=(n=t.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++kt.connectCount;const t=ka(this.urlOptions).then(n=>new this.WebSocketPonyfill(n));this.openPromise=t.then(async n=>{this.ws=n,n.binaryType="arraybuffer",n.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&Ia(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await Pa(n),this.urlOptions.connectionParams&&n.send(await Ta(this.urlOptions.connectionParams,this.encoder))});try{await this.openPromise}finally{this.openPromise=null}}async close(){try{await this.openPromise}finally{var t;(t=this.ws)===null||t===void 0||t.close()}}};ce(Na,"connectCount",0);var Gn=class{constructor(e){ce(this,"links",void 0),ce(this,"runtime",void 0),ce(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Oo({links:this.links,op:oe(oe({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(xo())}async requestAsPromise(e){try{const t=this.$request(e);return(await Co(t)).result.data}catch(t){throw ze.from(t)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(r){switch(r.result.type){case"state":var s;(s=n.onConnectionStateChange)===null||s===void 0||s.call(n,r.result);break;case"started":var a;(a=n.onStarted)===null||a===void 0||a.call(n,{context:r.context});break;case"stopped":var i;(i=n.onStopped)===null||i===void 0||i.call(n);break;case"data":case void 0:var c;(c=n.onData)===null||c===void 0||c.call(n,r.result.data)}},error(r){var s;(s=n.onError)===null||s===void 0||s.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const Jn=Symbol.for("trpc_untypedClient"),Ca={query:"query",mutate:"mutation",subscribe:"subscription"},xa=e=>Ca[e];function Aa(e){const t=Hn(({path:n,args:r})=>{const s=[...n],a=xa(s.pop()),i=s.join(".");return e[a](i,...r)});return Mo(n=>n===Jn?e:t[n])}function Oa(e){return Aa(new Gn(e))}function La(e){return e[Jn]}function Ra(e){var t,n;const r=ga(e),s=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,a=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const i=u=>({validate(l){if(s===1/0&&a===1/0)return!0;if(l.length>a)return!1;const d=l.map(p=>p.path).join(","),m=l.map(p=>p.input);return pn(oe(oe({},r),{},{type:u,path:d,inputs:m,signal:null})).length<=s},async fetch(l){var d;const m=l.map(v=>v.path).join(","),p=l.map(v=>v.input),h=fa(...l.map(v=>v.signal)),g=new AbortController,b=await Sa(oe(oe({},r),{},{signal:mn(h,g.signal),type:u,contentTypeHeader:"application/json",trpcAcceptHeader:"application/jsonl",trpcAcceptHeaderKey:(d=e.streamHeader)!==null&&d!==void 0?d:"trpc-accept",getUrl:pn,getBody:ba,inputs:p,path:m,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:l}):e.headers:{}}}));if(!b.ok){const v=await b.json();return"error"in v&&(v.error=r.transformer.output.deserialize(v.error)),l.map(()=>Promise.resolve({json:v,meta:{response:b}}))}const[A]=await la({from:b.body,deserialize:v=>r.transformer.output.deserialize(v),formatError(v){const O=v.error;return ze.from({error:O})},abortController:g});return Object.keys(l).map(async v=>{let O=await Promise.resolve(A[v]);if("result"in O){const E=await Promise.resolve(O.result);O={result:{data:await Promise.resolve(E.data)}}}return{json:O,meta:{response:b}}})}}),c={query:fn(i("query")),mutation:fn(i("mutation"))};return({op:u})=>yt(l=>{if(u.type==="subscription")throw new Error("Subscriptions are unsupported by `httpBatchStreamLink` - use `httpSubscriptionLink` or `wsLink`");const d=new AbortController,m=c[u.type].load(oe(oe({},u),{},{signal:mn(u.signal,d.signal)}));let p=!1,h;return m.then(g=>{if(p=!0,h=g,"error"in g.json){l.error(ze.from(g.json,{meta:g.meta}));return}else if("result"in g.json){l.next({context:g.meta,result:g.json.result}),l.complete();return}l.complete()}).catch(g=>{p=!0,l.error(ze.from(g,{meta:h?.meta}))}),()=>{p||d.abort()}})}}function Ye(e){"@babel/helpers - typeof";return Ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ye(e)}function qa(e,t){if(Ye(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ye(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Da(e){var t=qa(e,"string");return Ye(t)=="symbol"?t:t+""}function $a(e,t,n){return(t=Da(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gn(Object(n),!0).forEach(function(r){$a(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ja(e){var t,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new ut(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function ut(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return ut=function(r){this.s=r,this.n=r.next},ut.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return s===void 0?Promise.resolve({value:r,done:!0}):t(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return s===void 0?Promise.reject(r):t(s.apply(this.s,arguments))}},new ut(e)}function Ma(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Ba(e,t){if(e==null)return{};var n,r,s=Ma(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const Fa=["cursor","direction"];function vt(e){return{path:e.path.join(".")}}function Wa(e){return e.length>=3}function Ka(e){return Wa(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function Rt(e,t,n){var r;const s=Ka(e);let a=(r=s.args)===null||r===void 0?void 0:r.input;if(n){var i,c;a=R(R(R({},(i=(c=s.args)===null||c===void 0?void 0:c.input)!==null&&i!==void 0?i:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[s.path.join("."),a,t?.trpc]}async function Ua(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const s=[];var a=!1,i=!1,c;try{for(var u=ja(e),l;a=!(l=await u.next()).done;a=!1){const d=l.value;s.push(d),r.setState({data:[...s]})}}catch(d){i=!0,c=d}finally{try{a&&u.return!=null&&await u.return()}finally{if(i)throw c}}return s}function _e(e){const t=Et(()=>{const{input:n,type:r}=e,s=e.path.flatMap(a=>a.split("."));if(!n&&r==="any")return s.length?[s]:[];if(r==="infinite"&&$e(n)&&("direction"in n||"cursor"in n)){const{cursor:a,direction:i}=n;return[s,{input:Ba(n,Fa),type:"infinite"}]}return[s,R(R({},typeof n<"u"&&n!==Ae&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function Yn(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function qt(e){return qo(e)?e():e}function Ha(e){var t;const{input:n,query:r,path:s,queryKey:a,opts:i}=e,c=n===Ae,u=async l=>{var d;const m=R(R({},i),{},{trpc:R(R({},i?.trpc),!(i==null||(d=i.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:l.signal}:{signal:null})});return await r(...Rt(a,m,{direction:l.direction,pageParam:l.pageParam}))};return Object.assign(Or(R(R({},i??{}),{},{queryKey:a,queryFn:c?Ae:u,initialPageParam:(t=i?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:vt({path:s})})}function za(e){var t,n;const{mutate:r,path:s,prefix:a,opts:i,overrides:c}=e,u=qt(e.queryClient),l=Yn({path:s,prefix:(t=i?.keyPrefix)!==null&&t!==void 0?t:a}),d=u.defaultMutationOptions(u.getMutationDefaults(l)),m=(n=c?.onSuccess)!==null&&n!==void 0?n:(h=>h.originalFn()),p=async h=>await r(...Rt([...l,{input:h}],i));return R(R({},i),{},{mutationKey:l,mutationFn:p,onSuccess(...h){var g,b;return m({originalFn:()=>{var v,O,E;return(v=i==null||(O=i.onSuccess)===null||O===void 0?void 0:O.call(i,...h))!==null&&v!==void 0?v:d==null||(E=d.onSuccess)===null||E===void 0?void 0:E.call(d,...h)},queryClient:u,meta:(g=(b=i?.meta)!==null&&b!==void 0?b:d?.meta)!==null&&g!==void 0?g:{}})},trpc:vt({path:s})})}function Qa(e){const{input:t,query:n,path:r,queryKey:s,opts:a}=e,i=qt(e.queryClient),c=t===Ae,u=async l=>{var d;const m=R(R({},a),{},{trpc:R(R({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:l.signal}:{signal:null})}),p=l.queryKey,h=await n(...Rt(p,m));return jo(h)?Ua(h,i,p):h};return Object.assign(Lr(R(R({},a),{},{queryKey:s,queryFn:c?Ae:u})),{trpc:vt({path:r})})}const Va=e=>{const{subscribe:t,path:n,queryKey:r,input:s,opts:a={}}=e,i="enabled"in a?!!a.enabled:s!==Ae,c=u=>t(n.join("."),s===Ae?void 0:s,u);return R(R({},a),{},{enabled:i,subscribe:c,queryKey:r,trpc:vt({path:n})})};function Ga(e){const t=e.keyPrefix,n=r=>(s,a,i)=>"router"in e?Promise.resolve(qt(e.ctx)).then(c=>Qo({router:e.router,path:s,getRawInput:async()=>a,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof Gn?e.client:La(e.client))[r](s,a,i);return Hn(({args:r,path:s})=>{const a=[...s],i=a.pop(),[c,u]=r;return{"~types":void 0,pathKey:()=>_e({path:a,type:"any",prefix:t}),pathFilter:()=>R(R({},c),{},{queryKey:_e({path:a,type:"any",prefix:t})}),queryOptions:()=>Qa({input:c,opts:u,path:a,queryClient:e.queryClient,queryKey:_e({path:a,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>_e({path:a,input:c,type:"query",prefix:t}),queryFilter:()=>R(R({},u),{},{queryKey:_e({path:a,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>Ha({input:c,opts:u,path:a,queryKey:_e({path:a,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>_e({path:a,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>R(R({},u),{},{queryKey:_e({path:a,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var l;return za({opts:c,path:a,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(l=e.overrides)===null||l===void 0?void 0:l.mutations})},mutationKey:()=>Yn({path:a,prefix:t}),subscriptionOptions:()=>Va({opts:u,path:a,input:c,queryKey:_e({path:a,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[i]()})}function Ja(){const e=be(null),t=be(null),n=a=>{const i=je(()=>Ga({client:a.trpcClient,queryClient:a.queryClient,keyPrefix:a.keyPrefix}),[a.trpcClient,a.queryClient,a.keyPrefix]);return re(e.Provider,{value:a.trpcClient},re(t.Provider,{value:i},a.children))};n.displayName="TRPCProvider";function r(){const a=we(t);if(!a)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return a}function s(){const a=we(e);if(!a)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return a}return{TRPCProvider:n,useTRPC:r,useTRPCClient:s}}const Tt={lan:new Set,animepahe:new Set,jasmr:new Set};function xe(e){for(const t of[...Tt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function Zn(e,t){return Tt[e].add(t),()=>{Tt[e].delete(t)}}let mt="default";function Xn(){return mt}function Ya(e){mt=e}const Za=new Set(["playerVideoDelayMs","playerVideoDelayEnabled","anime4kEnabled"]);function rt(e){return mt==="default"||Za.has(e)?e:`dango:profile:${mt}:${e}`}const X={keyFor:rt,getItem:e=>localStorage.getItem(rt(e)),setItem:(e,t)=>localStorage.setItem(rt(e),t),removeItem:e=>localStorage.removeItem(rt(e))};function Xa(){localStorage.setItem("dango:profile-session-change",`${Date.now()}-${Math.random()}`),window.location.assign("/")}const es=(e,t)=>new Promise((n,r)=>{t?.throwIfAborted();const s=()=>{clearTimeout(a),r(t?.reason)},a=setTimeout(()=>{t?.removeEventListener("abort",s),n()},e);t?.addEventListener("abort",s,{once:!0})}),Dt=async(e,t)=>{const n=e instanceof Request?e:void 0,r=new Headers(n?.headers);(!t?.body||!(t.body instanceof FormData))&&r.set("Content-Type","application/json");const s=n?.url??e.toString(),a=s.startsWith("/")&&!s.startsWith("//")||typeof window<"u"&&new URL(s,window.location.origin).origin===window.location.origin;if(a){!s.includes("/api/profiles/status")&&!s.includes("/api/profiles/login")&&!s.includes("/api/auth/app-")&&r.set("x-dango-profile-id",Xn());let m=X.getItem("animepahe_ua"),p=X.getItem("animepahe_cookie");p&&m&&m!==navigator.userAgent&&(X.removeItem("animepahe_cookie"),X.removeItem("animepahe_ua"),p=null,m=null,C.error("Your browser changed. Verify AnimePahe again to refresh its cookie."),xe("animepahe"));const h=X.getItem("jasmr_ua"),g=X.getItem("jasmr_cookie");m&&r.set("x-animepahe-ua",m),p&&r.set("x-animepahe-cookie",p),h&&r.set("x-jasmr-ua",h),g&&r.set("x-jasmr-cookie",g)}new Headers(t?.headers).forEach((m,p)=>r.set(p,m));const i={...t,headers:r},c=(t?.method??n?.method??"GET").toUpperCase(),u=t?.signal??n?.signal,l=a&&(c==="GET"||c==="HEAD");let d=await fetch(e,i);a&&d.status===409&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_CHANGED"&&window.location.reload(),a&&d.status===401&&!s.includes("/api/profiles/")&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_AUTH_REQUIRED"&&window.dispatchEvent(new Event("dango:profile-auth-required"));for(let m=0;l&&d.status===503&&d.headers.get("x-dango-not-ready")==="1"&&m<3;m++)await d.body?.cancel(),await es(500*2**m,u),d=await fetch(e,i);return d},qe=async(e,t)=>{const n=await Dt(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let s={};try{s=JSON.parse(r)}catch{}const a=typeof s.error=="string"?s.error:"";throw n.status===403&&a==="AUTH_REQUIRED"&&s.provider==="animepahe"&&xe("animepahe"),n.status===403&&a==="AUTH_REQUIRED"&&s.provider==="jasmr"&&xe("jasmr"),n.status===401&&a==="LAN_AUTH_REQUIRED"&&xe("lan"),new Error(a||`Failed to fetch from ${e}`)}return n.json()};async function ts(e,t){const n=await Dt(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&xe("lan")}catch{}return ns(n),n}async function ns(e){try{if(!e.headers.get("content-type")?.includes("json"))return;const t=await e.clone().json(),n=Array.isArray(t)?t:[t];for(const r of n){const s=r?.error;if(!s||typeof s!="object")continue;const a=s.data?.cause;(s.message==="AUTH_REQUIRED"||a?.code==="AUTH_REQUIRED")&&(a?.provider==="animepahe"||a?.provider==="jasmr")&&xe(a.provider),(s.message==="LAN_AUTH_REQUIRED"||a?.code==="LAN_AUTH_REQUIRED")&&xe("lan")}}catch{}}const{TRPCProvider:rs,useTRPC:q}=Ja(),ee=Oa({links:[Ra({url:"/api/trpc",fetch:ts,headers:{"x-no-compression":"1"}})]}),os="_overlay_5hzq9_1",as="_fadeIn_5hzq9_1",ss="_content_5hzq9_11",is="_modalIn_5hzq9_1",cs="_sm_5hzq9_29",ls="_md_5hzq9_33",us="_lg_5hzq9_37",ds="_title_5hzq9_41",ms="_closeButton_5hzq9_48",ps="_body_5hzq9_74",hs="_footer_5hzq9_78",De={overlay:os,fadeIn:as,content:ss,modalIn:is,sm:cs,md:ls,lg:us,title:ds,closeButton:ms,body:ps,footer:hs};function er({children:e}){return o("h2",{className:De.title,children:e})}function tr({children:e}){return o("div",{className:De.body,children:e})}function nr({children:e}){return o("div",{className:De.footer,children:e})}function Me({isOpen:e,onClose:t,title:n,children:r,footer:s,width:a="md"}){const i=j(null),[c,u]=y(document.body);return S(()=>{if(!e)return;const l=()=>u(document.fullscreenElement??document.body);return l(),document.addEventListener("fullscreenchange",l),()=>document.removeEventListener("fullscreenchange",l)},[e]),S(()=>{if(!e)return;const l=m=>{m.key==="Escape"&&t?.()};document.addEventListener("keydown",l);const d=document.body.style.overflow;return document.body.style.overflow="hidden",i.current?.focus(),()=>{document.removeEventListener("keydown",l),document.body.style.overflow=d}},[e,t]),e?On(o("div",{role:"presentation",onMouseDown:l=>l.stopPropagation(),children:[o("div",{className:De.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:i,className:`${De.content} ${De[a]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(er,{children:n}),o(tr,{children:r}),s&&o(nr,{children:s})]})]}),c):null}Me.Header=er;Me.Body=tr;Me.Actions=nr;const We=new Map,fs=500,rr=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let i=e;if(t&&!i.includes("w=")){const c=i.includes("?")?"&":"?";i+=`${c}w=${t}`}if(n&&!i.includes("h=")){const c=i.includes("?")?"&":"?";i+=`${c}h=${n}`}return i}let r=e;r.includes("aln.youtube-anime.com")&&(r=r.replace(/https?:\/\/allanime\.day\/aln\.youtube-anime\.com/,"https://aln.youtube-anime.com"),r.includes("/images/mcovers")&&(r=r.replace("/images/mcovers","/mcovers")),r.includes("/images/images2")&&(r=r.replace("/images/images2","/images2"))),r.includes("allanime.day/s4.anilist.co")&&(r=r.replace(/https?:\/\/allanime\.day\/s4\.anilist\.co/,"https://s4.anilist.co")),r.includes("wp.youtube-anime.com/s4.anilist.co")&&(r=r.replace(/https?:\/\/wp\.youtube-anime\.com\/s4\.anilist\.co/,"https://s4.anilist.co"));const s=`${r}-${t}-${n}`;if(We.has(s))return We.get(s);let a;if(r.startsWith("https://s4.anilist.co"))a=r,t&&(a+=`${a.includes("?")?"&":"?"}w=${t}`),n&&(a+=`${a.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){a=`/api/image-proxy?url=${encodeURIComponent(r)}`;const i=X.getItem("animepahe_cookie"),c=X.getItem("animepahe_ua");i&&(a+=`&cookie=${encodeURIComponent(i)}`),c&&(a+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))a=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(a+=`&w=${t}`),n?a+=`&h=${n}`:t||(a+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;a=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(a+=`&w=${t}`),n?a+=`&h=${n}`:t||(a+="&w=300")}return We.size>fs&&We.clear(),We.set(s,a),a},Du=e=>{if(isNaN(e)||e<=0)return"00:00";const t=new Date(e*1e3).toISOString().slice(11,19);return parseInt(t.slice(0,2),10)>0?t:t.slice(3)};function $u(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").trim():""}function ju(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const gs=(...e)=>e.filter(Boolean).join(" ");function ys(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const or=be(void 0),ar=()=>{const e=we(or);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},x={watchlist:"watchlist",continueWatching:"allContinueWatching",queueRemaining:"queue-remaining",suggestedEpisode:"suggestedEpisode",trendingList:"trendingList",latestReleases:"latestReleases",thisWeekSchedule:"thisWeekSchedule",schedule:"schedule",genreCards:"genreCards",queue:"queue",playerData:"player-data",showData:"show-data",showMeta:"show-meta",videoSources:"video-sources",tvSources:"tv-sources",tvLibrary:"tv-library",tvContinueWatching:"tv-continue-watching",tvProgress:"tv-progress",mangaLibrary:"manga-library",mangaContinueReading:"manga-continue-reading",mangaProgress:"manga-progress",mangaBrowse:"mangaBrowse",mangaBrowseInfinite:"mangaBrowseInfinite",mangaDetail:"mangaDetail",mangaPages:"mangaPages",asmrLibrary:"asmr-library",asmrContinueListening:"asmr-continue-listening",asmrProgress:"asmr-progress",asmrBrowse:"asmrBrowse",asmrWork:"asmrWork",trackerStatus:"trackerStatus",anilistClientId:"anilistClientId",malClientConfig:"malClientConfig",notifications:"notifications",settings:"settings",insights:"insights",insightsDay:"insights-day",insightsRecommendations:"insights-recommendations",providers:"providers",syncProfile:"sync-profile"},Mu=()=>{const e=q(),t=F({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},Bu=(e="TRENDING_DESC",t=10)=>ht({queryKey:[x.trendingList,e,t],queryFn:({pageParam:n=1})=>ee.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Fu=(e="TV",t=12)=>ht({queryKey:[x.latestReleases,e,t],queryFn:({pageParam:n=1})=>ee.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Wu=(e,t="TV",n=!0)=>{const r=q();return F({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},vs=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],Ku=(e,t,n=14)=>{const r=q(),s=new URLSearchParams(e),a={page:t,limit:n};for(const i of vs){const c=s.get(i);c!==null&&(a[i]=c)}return F({...r.data.search.queryOptions(a),enabled:e!=null})},Uu=()=>{const e=q();return F(e.queue.list.queryOptions())},bs=()=>{const e=q(),t=ae();return pe(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?C.success("Added to queue"):C.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[x.queueRemaining]})},onError:n=>{C.error(`Failed to update queue: ${n.message}`)}}))},Hu=()=>{const e=q(),t=ae();return pe(e.queue.remove.mutationOptions({onSuccess:()=>{C.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[x.queueRemaining]}),t.invalidateQueries({queryKey:[x.continueWatching]})},onError:n=>{C.error(`Failed to remove: ${n.message}`)}}))},zu=(e,t=!0)=>F({queryKey:[x.queueRemaining,e],queryFn:()=>ee.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),Qu=()=>{const e=q(),t=ae();return pe(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const s=n.added??r.episodeNumbers.length;C.success(`${s} ${s===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[x.queueRemaining]})},onError:n=>{C.error(`Failed to update queue: ${n.message}`)}}))},Vu=()=>{const e=q(),t=ae();return pe(e.queue.removeMany.mutationOptions({onSuccess:()=>{C.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[x.queueRemaining]}),t.invalidateQueries({queryKey:[x.continueWatching]})},onError:n=>{C.error(`Failed to remove: ${n.message}`)}}))},Gu=()=>{const e=q(),t=ae();return pe(e.queue.clear.mutationOptions({onSuccess:()=>{C.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[x.queueRemaining]}),t.invalidateQueries({queryKey:[x.continueWatching]})},onError:n=>{C.error(`Failed to clear queue: ${n.message}`)}}))},Ju=()=>{const e=q(),t=ae(),n=e.queue.list.queryOptions().queryKey;return pe(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const s=t.getQueryData(n);return t.setQueryData(n,a=>{if(!a)return a;const i=new Map(a.map(c=>[c.id,c]));return r.map((c,u)=>{const l=i.get(c.id??-1);return l?{...l,queue_order:u}:void 0}).filter(c=>!!c)}),{previousQueue:s}},onError:(r,s,a)=>{a?.previousQueue&&t.setQueryData(n,a.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},ws=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function $t(e,t,n){const r=new URLSearchParams(e),s={page:t,limit:n};for(const a of ws){const i=r.get(a);i!==null&&(s[a]=i)}return s}const Yu=(e,t="",n,r=14)=>F({queryKey:[x.watchlist,e,t,n,r],queryFn:async()=>{const s=new URLSearchParams(t);return s.set("status",e),await ee.watchlist.list.query($t(s.toString(),n,r))}}),Zu=(e="")=>ht({queryKey:[x.continueWatching,e],queryFn:async({pageParam:t=1})=>await ee.watchlist.continueWatchingAll.query($t(e,t,14)),initialPageParam:1,getNextPageParam:t=>{if(!(t.data.length===0||t.page*t.limit>=t.total))return t.page+1},select:t=>({...t,pages:t.pages.flatMap(n=>n.data)})}),Xu=(e="",t,n=14)=>F({queryKey:[x.continueWatching,e,t,n],queryFn:async()=>await ee.watchlist.continueWatchingAll.query($t(e,t,n))}),ed=()=>{const e=q(),t=ae();return pe(e.watchlist.remove.mutationOptions({onSuccess:()=>{C.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[x.watchlist]})},onError:n=>{C.error(`Failed to remove: ${n.message}`)}}))},td=()=>{const e=q(),t=ae();return pe(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{C.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[x.watchlist]}),t.invalidateQueries({queryKey:[x.continueWatching]})},onError:n=>{C.error(`Failed to update statuses: ${n.message}`)}}))},nd=()=>{const e=q(),t=ae();return pe(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;C.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[x.watchlist]}),t.invalidateQueries({queryKey:[x.continueWatching]})},onError:n=>{C.error(`Failed to remove: ${n.message}`)}}))},rd=()=>{const e=q(),t=ae();return pe(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;C.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[x.continueWatching]})},onError:n=>{C.error(`Failed to remove: ${n.message}`)}}))},sr=(e=!0)=>{const t=q();return F({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},ir=(e=!0)=>{const t=q();return F({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},cr=(e=!0)=>{const t=q();return F({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},_s=()=>{const e=q(),t=ae(),n=e.discovery.status.queryOptions().queryKey;return pe(e.discovery.refresh.mutationOptions({onSuccess:r=>{t.setQueryData(n,{running:r.running,state:r.state,total:r.total,done:r.done,lastRunAt:r.lastRunAt}),t.invalidateQueries(e.notifications.pathFilter()),t.invalidateQueries({queryKey:[x.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},Ss=()=>{const e=q(),t=ae();return pe(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Es=()=>{const e=q(),t=ae();return pe(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},od=()=>{const e=q();return F({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},ad=()=>{const e=q();return F({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},sd=()=>F({queryKey:[x.genreCards],queryFn:()=>ee.insights.genreCards.query()}),ks="_container_jzirm_1",Ts="_bellBtn_jzirm_7",Ps="_badge_jzirm_39",Is="_dropdown_jzirm_67",Ns="_dropdownHeader_jzirm_98",Cs="_headerSubtitle_jzirm_106",xs="_headerActions_jzirm_113",As="_closeBtn_jzirm_119",Os="_sectionHeading_jzirm_132",Ls="_clearAllBtn_jzirm_148",Rs="_discoveryStatusRow_jzirm_166",qs="_statusDot_jzirm_177",Ds="_statusDotRunning_jzirm_184",$s="_statusDotOk_jzirm_189",js="_statusDotError_jzirm_197",Ms="_statusDotIdle_jzirm_201",Bs="_list_jzirm_216",Fs="_item_jzirm_230",Ws="_itemTitleLink_jzirm_241",Ks="_systemItemMeta_jzirm_248",Us="_removeItem_jzirm_249",Hs="_modalButton_jzirm_251",zs="_systemItem_jzirm_248",Qs="_systemIcon_jzirm_264",Vs="_thumbWrap_jzirm_275",Gs="_thumbnail_jzirm_284",Js="_itemInfo_jzirm_293",Ys="_itemTitle_jzirm_241",Zs="_itemMeta_jzirm_309",Xs="_queueItem_jzirm_374",ei="_fullMessage_jzirm_388",ti="_emptyState_jzirm_394",ni="_emptyIcon_jzirm_412",T={container:ks,bellBtn:Ts,badge:Ps,dropdown:Is,dropdownHeader:Ns,headerSubtitle:Cs,headerActions:xs,closeBtn:As,sectionHeading:Os,clearAllBtn:Ls,discoveryStatusRow:Rs,statusDot:qs,statusDotRunning:Ds,statusDotOk:$s,statusDotError:js,statusDotIdle:Ms,list:Bs,item:Fs,itemTitleLink:Ws,systemItemMeta:Ks,removeItem:Us,modalButton:Hs,systemItem:zs,systemIcon:Qs,thumbWrap:Vs,thumbnail:Gs,itemInfo:Js,itemTitle:Ys,itemMeta:Zs,queueItem:Xs,fullMessage:ei,emptyState:ti,emptyIcon:ni},ri=({notification:e})=>{const t=Ss(),n=bs(),[r,s]=Ot.useState(!1),a=l=>{l.preventDefault(),l.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},i=l=>{l.preventDefault(),l.stopPropagation(),s(!0),n.mutate({showId:e.showId,episodeNumber:e.episodeNumber,showName:e.name,showThumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName}),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),window.setTimeout(()=>s(!1),1e3)},{titlePreference:c}=ar(),u=c==="nativeName"?e.nativeName||e.name:c==="englishName"&&e.englishName||e.name;return o("div",{className:T.item,children:[o("span",{className:T.thumbWrap,children:o(Wn,{src:rr(e.thumbnail,48,64),alt:e.name,className:T.thumbnail,loading:"lazy",decoding:"async"})}),o("div",{className:T.itemInfo,children:[o(me,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:T.itemTitleLink,onClick:()=>t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),children:o("span",{className:T.itemTitle,children:u})}),o("span",{className:T.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${T.removeItem} ${T.queueItem}`,onClick:i,title:"Add to queue","aria-label":"Add notification to queue",children:r?o(I,{name:"check"}):o(I,{name:"plus"})}),o("button",{className:T.removeItem,onClick:a,title:"Dismiss","aria-label":"Remove notification",children:o(I,{name:"times"})})]})};function wt({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:s}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...s}})}const oi=({count:e=3})=>o(ye,{children:Array.from({length:e}).map((t,n)=>o("div",{className:T.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:T.thumbnail,style:{overflow:"hidden"},children:o(wt,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:T.itemInfo,children:[o(wt,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(wt,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),ai=({onClose:e})=>{const{data:t=[],isLoading:n}=sr(),{data:r=[]}=ir(),{data:s}=cr(),a=Es(),i=ae(),[c,u]=y(null),l=j(null);S(()=>{l.current?.focus();const h=g=>{g.key==="Escape"&&e()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e]),S(()=>{i.invalidateQueries({queryKey:[x.notifications]})},[i]);const d=r.find(h=>h.id===c)??null,m=t.length+r.length,p=s?.running?s.total>0?`Checking ${Math.min(s.done,s.total)}/${s.total} shows...`:"Checking for new episodes...":s?.state==="complete"?`Discovery complete · checked ${s.total} ${s.total===1?"show":"shows"}`:s?.state==="empty"?"No shows set to Watching":s?.state==="error"?"Last check failed · will retry automatically":s?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-s.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes";return o("div",{id:"notification-panel",ref:l,className:T.dropdown,role:"dialog","aria-label":"Notifications",tabIndex:-1,children:[o("div",{className:T.dropdownHeader,children:[o("div",{children:[o("h4",{children:"Notifications"}),o("span",{className:T.headerSubtitle,children:[m," updates"]})]}),o("div",{className:T.headerActions,children:[t.length>0&&o("button",{className:T.clearAllBtn,onClick:()=>a.mutate(void 0),children:"Clear all"}),o("button",{type:"button",className:T.closeBtn,onClick:e,title:"Close","aria-label":"Close notifications",children:o(I,{name:"times"})})]})]}),o("div",{className:T.discoveryStatusRow,children:[o("span",{className:`${T.statusDot} ${s?.running?T.statusDotRunning:s?.state==="complete"?T.statusDotOk:s?.state==="error"?T.statusDotError:T.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:p})]}),o("div",{className:T.list,children:n&&m===0?o(oi,{count:4}):o(ye,{children:[r.length>0&&o("section",{"aria-labelledby":"system-notifications-heading",children:[o("h5",{id:"system-notifications-heading",className:T.sectionHeading,children:"App updates"}),r.map(h=>o("div",{className:`${T.item} ${T.systemItem}`,children:[o("div",{className:T.systemIcon,children:o(I,{name:"info-circle",size:20})}),o("div",{className:T.itemInfo,children:[o("span",{className:T.itemTitle,children:h.title}),o("button",{type:"button",className:T.systemItemMeta,onClick:()=>u(h.id),title:"View full message",children:[ys(h.message,72,"…")," ",o("span",{children:"Read more"})]})]})]},h.id))]}),t.length>0&&o("section",{"aria-labelledby":"new-episodes-heading",children:[o("h5",{id:"new-episodes-heading",className:T.sectionHeading,children:"New episodes"}),t.map(h=>o(ri,{notification:h},h.id))]}),!n&&m===0&&o("div",{className:T.emptyState,children:[o("span",{className:T.emptyIcon,children:o(I,{name:"bell",size:22})}),o("strong",{children:"You’re all caught up"}),o("span",{children:"New episode alerts and app updates will show up here."})]})]})}),o(Me,{isOpen:!!d,onClose:()=>u(null),title:d?.title,width:"sm",footer:o("button",{type:"button",className:T.modalButton,onClick:()=>u(null),children:"OK"}),children:d&&o("p",{className:T.fullMessage,children:d.message})})]})},si="notification-panel",ii=()=>{const[e,t]=y(!1),n=j(null),r=ae(),s=q(),a=_s(),{data:i=[]}=sr(),{data:c=[]}=ir(),{data:u}=cr(),l=i.length+c.length,d=l>9?"9+":l,m=j(!1);S(()=>{const h=g=>{n.current&&!n.current.contains(g.target)&&t(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]),S(()=>{const h=!!u?.running;m.current&&!h&&(r.invalidateQueries(s.notifications.pathFilter()),r.invalidateQueries(s.discovery.pathFilter()),r.invalidateQueries({queryKey:[x.continueWatching]}),r.invalidateQueries({queryKey:[x.thisWeekSchedule]}),r.invalidateQueries(s.continueWatching.pathFilter()),r.invalidateQueries({queryKey:[x.notifications]})),m.current=h},[u?.running,r,s]);const p=()=>{const h=!e;t(h),h&&a.mutate()};return o("div",{className:T.container,ref:n,children:[o("button",{className:T.bellBtn,onClick:p,"aria-haspopup":"dialog","aria-expanded":e,"aria-controls":si,"aria-label":"Notifications",children:[o(I,{name:"bell"}),l>0&&o("span",{className:T.badge,"aria-hidden":"true",children:d})]}),e&&o(ai,{onClose:()=>t(!1)})]})},ci="_logo_hls4o_1",li="_img_hls4o_10",ui="_word_hls4o_21",ot={logo:ci,img:li,word:ui},pt=({className:e,collapsed:t})=>o("span",{className:e?`${ot.logo} ${e}`:ot.logo,role:"img","aria-label":"dango",children:[o("img",{src:"/logo-mascot.png",alt:"","aria-hidden":"true",draggable:!1,className:ot.img}),!t&&o("span",{className:ot.word,children:"dango"})]}),lr=be(void 0),jt=()=>{const e=we(lr);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},ur=be(void 0),Mt=()=>{const e=we(ur);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},Pt="virtual-keyboard:hide",yn="virtual-keyboard:enabled-change",dr="virtual_keyboard_enabled",di=!1;function vn(){const e=X.getItem(dr);return e===null?di:e==="true"}const bn=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function mi(){window.dispatchEvent(new CustomEvent(Pt))}function pi(){const[e,t]=y(!1),[n,r]=y(vn),s=j(null);return S(()=>{const a=d=>{n&&bn(d.target)&&(s.current=d.target,t(!0))},i=d=>{d.target===s.current&&window.setTimeout(()=>{if(bn(document.activeElement)){s.current=document.activeElement,t(!0);return}s.current=null,t(!1)},0)},c=()=>{s.current=null,t(!1)},u=d=>{if(d.key!==dr)return;const m=d.newValue==="true";r(m),m||c()},l=()=>{const d=vn();r(d),d||c()};return document.addEventListener("focusin",a),document.addEventListener("focusout",i),window.addEventListener(Pt,c),window.addEventListener("storage",u),window.addEventListener(yn,l),()=>{document.removeEventListener("focusin",a),document.removeEventListener("focusout",i),window.removeEventListener(Pt,c),window.removeEventListener("storage",u),window.removeEventListener(yn,l)}},[n]),{activeInputRef:s,isVisible:n&&e,hide:()=>t(!1)}}const hi={queryKey:[x.syncProfile],queryFn:()=>qe("/api/profiles/current"),staleTime:3e4};function It({image:e,name:t,size:n=72,radius:r="50%"}){const[s,a]=y(!1);S(()=>a(!1),[e]);const i={width:"100%",height:"100%",maxWidth:n,maxHeight:n,aspectRatio:"1",objectFit:"cover",borderRadius:r};return e&&!s?o("img",{src:e,alt:t,referrerPolicy:"no-referrer",onError:()=>a(!0),style:i}):o("svg",{viewBox:"0 0 24 24",role:"img","aria-label":t,style:i,fill:"currentColor",children:[o("circle",{cx:"12",cy:"8",r:"4"}),o("path",{d:"M4 21v-2a8 8 0 0 1 16 0v2z"})]})}const Bt=e=>String(e).toLowerCase()==="movie"?"movie":"tv",id=(e,t)=>`${Bt(e)}:${t}`,fi=(e,t)=>{const n=Bt(e);return`/tv/${t}?type=${n}`},gi=(e,t,n,r)=>{const s=new URLSearchParams;return s.set("type",Bt(e)),n!==void 0&&s.set("s",String(n)),r!==void 0&&s.set("e",String(r)),`/tv/${t}/watch?${s.toString()}`},cd=e=>e.adult===!0||e.adult===1,ld={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",10762:"Kids",9648:"Mystery",10765:"Sci-Fi & Fantasy",37:"Western"},ud={28:"Action",12:"Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",14:"Fantasy",36:"History",27:"Horror",9648:"Mystery",10749:"Romance",878:"Sci-Fi",53:"Thriller",10752:"War",37:"Western"},Ft=300*1e3,yi={mangadex:"https://mangadex.org/",mangapill:"https://www.mangapill.com/"},vi="Dango/3.0 (+https://github.com/serifpersia/dango)",bi=(e,t)=>`/api/proxy?url=${encodeURIComponent(t)}&referer=${encodeURIComponent(yi[e])}`,wi=(e,t)=>t&&(e==="mangadex"?`/api/image-proxy?url=${encodeURIComponent(t)}&ua=${encodeURIComponent(vi)}`:e==="mangapill"?bi(e,t):t),dd=(e,t=!0)=>{const{provider:n,query:r,page:s,sort:a,status:i,type:c,rating:u,mature:l}=e;return F({queryKey:[x.mangaBrowse,n,r,s,a,i,c,u,l],queryFn:()=>ee.manga.search.query({provider:n,q:r.trim()||void 0,page:s,sort:a||void 0,status:i||void 0,type:c||void 0,rating:u||void 0,mature:l?"1":void 0}),staleTime:Ft,enabled:t})},md=(e,t=14)=>{const{provider:n,query:r,sort:s,status:a,type:i,rating:c,mature:u}=e;return ht({queryKey:[x.mangaBrowseInfinite,n,r,s,a,i,c,u,t],queryFn:({pageParam:l=1})=>ee.manga.search.query({provider:n,q:r.trim()||void 0,page:l,limit:t,sort:s||void 0,status:a||void 0,type:i||void 0,rating:c||void 0,mature:u?"1":void 0}),initialPageParam:1,getNextPageParam:(l,d)=>l.hasNext?d.length+1:void 0,staleTime:Ft,enabled:!0})},pd=(e,t,n="safe",r=!1)=>F({queryKey:[x.mangaDetail,e,t,n,r],queryFn:()=>ee.manga.info.query({provider:e||"",id:t||"",rating:n,mature:r?"1":void 0}),enabled:!!e&&!!t,staleTime:Ft}),hd=(e,t,n)=>F({queryKey:[x.mangaPages,e,t],queryFn:()=>ee.manga.pages.query({provider:e||"",id:t||""}),enabled:!!e&&!!t,staleTime:1800*1e3}),fd=()=>{const e=q(),t=F({...e.manga.trending.queryOptions(),staleTime:600*1e3,retry:1});return{...t,data:t.data}};function _i(e){return String(e||"").trim().toUpperCase()}function wn(e){return _i(e.id||e._id||"")}function gd(e){return!!e.isAdult}const Si="_header_19a0e_1",Ei="_hidden_19a0e_24",ki="_scrolled_19a0e_28",Ti="_logo_19a0e_37",Pi="_logoCollapsed_19a0e_57",Ii="_logoFull_19a0e_61",Ni="_headerInner_19a0e_67",Ci="_leftSection_19a0e_77",xi="_desktopNav_19a0e_83",Ai="_navLink_19a0e_96",Oi="_navLinkActive_19a0e_115",Li="_navPill_19a0e_121",Ri="_rightSection_19a0e_139",qi="_searchWrapper_19a0e_145",Di="_searchIconButton_19a0e_172",$i="_searchIcon_19a0e_172",ji="_searchInput_19a0e_199",Mi="_searchKbd_19a0e_232",Bi="_searchKbdHidden_19a0e_250",Fi="_searchButton_19a0e_255",Wi="_profileBtn_19a0e_265",Ki="_profileAvatar_19a0e_300",Ui="_profileName_19a0e_307",Hi="_hamburgerBtn_19a0e_316",zi="_searchDropdown_19a0e_344",Qi="_searchDropdownNoBar_19a0e_376",Vi="_searchDropdownHeader_19a0e_384",Gi="_searchDropdownQuery_19a0e_392",Ji="_searchDropdownSeeAll_19a0e_398",Yi="_searchDropdownList_19a0e_415",Zi="_searchDropdownItem_19a0e_429",Xi="_searchDropdownThumb_19a0e_447",ec="_searchDropdownItemInfo_19a0e_456",tc="_searchDropdownItemTitle_19a0e_463",nc="_searchDropdownItemMeta_19a0e_472",rc="_mobileSearchBar_19a0e_511",oc="_searchIconMobile_19a0e_582",ac="_mobileSearchBarHidden_19a0e_609",sc="_mobileSearchInner_19a0e_627",ic="_mobileSearchIcon_19a0e_643",cc="_mobileSearchInput_19a0e_650",_={header:Si,hidden:Ei,scrolled:ki,logo:Ti,logoCollapsed:Pi,logoFull:Ii,headerInner:Ni,leftSection:Ci,desktopNav:xi,navLink:Ai,navLinkActive:Oi,navPill:Li,rightSection:Ri,searchWrapper:qi,searchIconButton:Di,searchIcon:$i,searchInput:ji,searchKbd:Mi,searchKbdHidden:Bi,searchButton:Fi,profileBtn:Wi,profileAvatar:Ki,profileName:Ui,hamburgerBtn:Hi,searchDropdown:zi,searchDropdownNoBar:Qi,searchDropdownHeader:Vi,searchDropdownQuery:Gi,searchDropdownSeeAll:Ji,searchDropdownList:Yi,searchDropdownItem:Zi,searchDropdownThumb:Xi,searchDropdownItemInfo:ec,searchDropdownItemTitle:tc,searchDropdownItemMeta:nc,mobileSearchBar:rc,searchIconMobile:oc,mobileSearchBarHidden:ac,mobileSearchInner:sc,mobileSearchIcon:ic,mobileSearchInput:cc},_n=300*1e3,lc=()=>{const{toggleSidebar:e}=jt(),{contentType:t}=Mt(),n=q(),{titlePreference:r}=ar(),[s,a]=y(""),[i,c]=y(""),[u,l]=y(!0),[d,m]=y(!1),[p,h]=y(!0),[g,b]=y(!1),[A,v]=y({left:0,width:0,opacity:0}),[O,E]=y(!1),N=Ln(),L=Ze(),W=j(null),se=j(!1),w=j(null),D=j(null),M=j(null),z=j(null),le=j(!1),te=j(null),ue=j(null),G=j(null),{data:J}=F(hi),B=i.length>=2,{data:fe}=F({...n.data.search.queryOptions({query:i,page:1,limit:6}),enabled:B&&t==="anime"}),{data:et}=F({...n.tv.search.queryOptions({q:i,page:1,type:"multi"}),enabled:B&&t==="tv"}),{data:Ie}=F({queryFn:()=>ee.manga.search.query({q:i,page:1,limit:6,rating:"safe"}),queryKey:[x.mangaBrowse,"",i,1,"","","","safe",!1],staleTime:_n,enabled:B&&t==="manga"}),{data:k}=F({queryFn:()=>ee.asmr.browse.query({q:i,page:1}),queryKey:[x.asmrBrowse,i,1,"",""],staleTime:_n,enabled:B&&t==="asmr"}),Z=t==="anime"?(fe??[]).map(f=>({key:String(f.id),name:r==="nativeName"?f.nativeName||f.name:r==="englishName"&&f.englishName||f.name,meta:f.year,thumb:f.thumbnail?rr(f.thumbnail,48,64):void 0,href:`/anime/${f.id}`})):t==="tv"?(et?.results??[]).map(f=>({key:`${f.type}-${f.id}`,name:f.title,meta:f.year,thumb:f.image||void 0,href:fi(f.type,f.id)})):t==="manga"?(Ie?.items??[]).map(f=>({key:`${f.provider}-${f.id}`,name:f.title,meta:f.year,thumb:f.cover?wi(f.provider,f.cover):void 0,href:`/manga/${f.provider}/${encodeURIComponent(f.id)}`})):(k?.shows??[]).map(f=>({key:wn(f),name:f.name,thumb:f.thumbnail||void 0,href:`/asmr/${encodeURIComponent(wn(f))}`}));S(()=>{const f=window.visualViewport;if(!f)return;const ne=()=>{z.current?.style.setProperty("--vv-top",`${f.offsetTop}px`)};return ne(),f.addEventListener("scroll",ne),f.addEventListener("resize",ne),()=>{f.removeEventListener("scroll",ne),f.removeEventListener("resize",ne)}},[]),S(()=>{const f=()=>{W.current&&(window.clearTimeout(W.current),W.current=null)},ne=()=>{f(),!(window.scrollY<=10||d)&&(W.current=window.setTimeout(()=>{le.current||l(!1)},2500))},tt=()=>{se.current||(se.current=!0,w.current=requestAnimationFrame(()=>{se.current=!1,w.current=null;const de=window.scrollY<=10;h(Ee=>Ee===de?Ee:de),l(Ee=>Ee||!0),ne()}))},Fe=de=>{const Ee=de.target,Er=Ee instanceof HTMLElement&&!!Ee.closest('input, textarea, select, button, a, [role="button"], [contenteditable="true"]'),Vt=()=>{f(),l(!0),window.innerWidth<=1200?(b(!0),setTimeout(()=>M.current?.focus({preventScroll:!0}),50)):setTimeout(()=>Q.current?.focus({preventScroll:!0}),10)};de.key.toLowerCase()==="s"&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&!Er||(de.metaKey||de.ctrlKey)&&de.key==="k"?(de.preventDefault(),Vt()):de.key==="Escape"&&document.activeElement===Q.current&&Q.current?.blur()},Re=z.current,zt=()=>{le.current=!0},Qt=()=>{le.current=!1,ne()};return window.addEventListener("scroll",tt,{passive:!0}),window.addEventListener("keydown",Fe),Re?.addEventListener("pointerenter",zt),Re?.addEventListener("pointerleave",Qt),()=>{window.removeEventListener("scroll",tt),window.removeEventListener("keydown",Fe),Re?.removeEventListener("pointerenter",zt),Re?.removeEventListener("pointerleave",Qt),f(),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null),se.current=!1}},[d]);const Q=Ot.useRef(null);S(()=>{if(te.current&&window.clearTimeout(te.current),!s.trim()||s.trim().length<2){c(""),E(!1);return}return te.current=window.setTimeout(()=>{c(s.trim()),d&&E(!0)},500),()=>{te.current&&window.clearTimeout(te.current)}},[s,d]);const he=V(()=>{E(!1)},[]);S(()=>{E(!1),b(!1)},[L.pathname,L.search]),S(()=>{const f=ue.current;if(!f)return;const ne=f.querySelector(`.${_.navLinkActive}`);if(!ne){v(Re=>({...Re,opacity:0}));return}const tt=f.getBoundingClientRect(),Fe=ne.getBoundingClientRect();v({left:Fe.left-tt.left,width:Fe.width,opacity:1})},[L.pathname]);const Oe=()=>window.innerWidth<=1200,Ht=()=>{l(!0),Oe()?(b(!0),setTimeout(()=>M.current?.focus({preventScroll:!0}),50)):Q.current?.focus({preventScroll:!0})},Le=f=>{D.current?.contains(f.relatedTarget)||(b(!1),he())},Ne=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",Be=t==="manga"?{to:"/reading-list",label:"Reading List"}:t==="tv"?{to:"/tv-watchlist",label:"TV Watchlist"}:t==="asmr"?{to:"/listening-list",label:"Listening List"}:{to:"/watchlist",label:"Watchlist"},Ce=f=>{mi();const ne=s.trim();ne&&(he(),Q.current?.blur(),m(!1),N(t==="manga"?`/manga?q=${encodeURIComponent(ne)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(ne)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(ne)}`:`/search?query=${encodeURIComponent(ne)}`))};return o(ye,{children:o("header",{ref:z,className:`${_.header} ${u?"":_.hidden} ${p?"":_.scrolled}`,children:[o("div",{className:_.headerInner,children:[o("div",{className:_.leftSection,children:[o("button",{className:_.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(I,{name:"bars"})}),o(me,{to:"/",className:_.logo,"aria-label":"Ani-Web Home",children:[o(pt,{className:_.logoFull}),o(pt,{collapsed:!0,className:_.logoCollapsed})]}),o("nav",{className:_.desktopNav,ref:ue,children:[o("span",{className:_.navPill,style:A,"aria-hidden":"true"}),o(me,{to:"/",className:`${_.navLink} ${L.pathname==="/"?_.navLinkActive:""}`,children:"Home"}),o(me,{to:Be.to,className:`${_.navLink} ${L.pathname.startsWith(Be.to)?_.navLinkActive:""}`,children:Be.label}),t==="anime"&&o(me,{to:"/insights",className:`${_.navLink} ${L.pathname==="/insights"?_.navLinkActive:""}`,children:"Insights"})]})]}),o("div",{className:_.rightSection,children:[o("div",{className:_.searchWrapper,ref:G,onClick:()=>Q.current?.focus(),children:[o("button",{type:"button",className:_.searchIconButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),Ce()},children:o(I,{name:"search",className:_.searchIcon})}),o("input",{ref:Q,type:"text","data-virtual-keyboard":"true",className:_.searchInput,placeholder:Ne,value:s,onChange:f=>a(f.currentTarget.value),onFocus:()=>{m(!0),l(!0),i.length>=2&&E(!0)},onBlur:f=>{m(!1),G.current?.contains(f.relatedTarget)||he()},onKeyDown:f=>{f.key==="Enter"?Ce():f.key==="Escape"&&(he(),Q.current?.blur())}}),o("span",{className:`${_.searchKbd} ${s||d?_.searchKbdHidden:""}`,"aria-hidden":"true",children:"Ctrl K"}),o("button",{type:"button",className:_.searchButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),Ht()},children:o(I,{name:"search",className:_.searchIconMobile})}),O&&Z.length>0&&o("div",{className:`${_.searchDropdown} ${g?"":_.searchDropdownNoBar}`,onMouseDown:f=>f.preventDefault(),onClick:f=>f.stopPropagation(),children:[o("div",{className:_.searchDropdownHeader,children:[o("span",{className:_.searchDropdownQuery,children:["Results for “",i,"”"]}),o("button",{className:_.searchDropdownSeeAll,onClick:()=>{he(),b(!1),m(!1),Ce()},children:"See all"})]}),o("div",{className:_.searchDropdownList,children:Z.map(f=>o("button",{className:_.searchDropdownItem,onClick:()=>{he(),b(!1),m(!1),a(""),Q.current?.blur(),N(f.href)},children:[f.thumb&&o(Wn,{src:f.thumb,alt:f.name,className:_.searchDropdownThumb,loading:"lazy",decoding:"async"}),o("div",{className:_.searchDropdownItemInfo,children:[o("span",{className:_.searchDropdownItemTitle,children:f.name}),f.meta&&o("span",{className:_.searchDropdownItemMeta,children:f.meta})]})]},f.key))})]})]}),o(ii,{}),o(me,{to:"/settings",className:_.profileBtn,"aria-label":`${J?.name??"Profile"} — profile settings`,title:`${J?.name??"Profile"}${J?.owner?" (owner)":""} — profile settings`,children:[o("span",{className:_.profileAvatar,"aria-hidden":"true",children:o(It,{image:J?.image,name:J?.name??"Profile"})}),o("span",{className:_.profileName,children:J?.name??"Profile"})]})]})]}),g&&o("div",{className:`${_.mobileSearchBar} ${u?"":_.mobileSearchBarHidden}`,ref:D,onBlur:Le,children:o("div",{className:_.mobileSearchInner,children:[o(I,{name:"search",className:_.mobileSearchIcon}),o("input",{ref:M,type:"text","data-virtual-keyboard":"true",className:_.mobileSearchInput,placeholder:Ne,value:s,onChange:f=>a(f.currentTarget.value),onFocus:()=>{m(!0),l(!0)},onBlur:()=>m(!1),onKeyDown:f=>{f.key==="Enter"?(Ce(),b(!1),m(!1)):f.key==="Escape"&&(b(!1),m(!1),he())}})]})})]})})},Nt="agreedToViewMature";function Ct(){try{return X.getItem(Nt)==="true"}catch{return!1}}const He=new Set;function mr(e){for(const t of He)t(e)}function at(){mr(Ct())}function Sn(e){try{e?X.setItem(Nt,"true"):X.removeItem(Nt)}catch{}mr(e)}function uc(){const[e,t]=y(Ct);S(()=>(He.add(t),He.size===1&&(window.addEventListener("storage",at),window.addEventListener("focus",at)),t(Ct()),()=>{He.delete(t),He.size===0&&(window.removeEventListener("storage",at),window.removeEventListener("focus",at))}),[]);const n=V(()=>Sn(!0),[]),r=V(()=>Sn(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const dc="_sidebar_1nmyv_1",mc="_open_1nmyv_20",pc="_sidebarHeader_1nmyv_25",hc="_closeBtn_1nmyv_35",fc="_logo_1nmyv_64",gc="_navSection_1nmyv_78",yc="_navLink_1nmyv_85",vc="_active_1nmyv_115",bc="_overlay_1nmyv_124",wc="_versionInfo_1nmyv_145",ge={sidebar:dc,open:mc,sidebarHeader:pc,closeBtn:hc,logo:fc,navSection:gc,navLink:yc,active:vc,overlay:bc,versionInfo:wc},_c="4.0.5",pr={version:_c},Sc=()=>{const{isOpen:e,setIsOpen:t}=jt(),{contentType:n}=Mt(),{hasConsent:r}=uc(),s=()=>{t(!1)},a=n==="manga",i=n==="tv",c=n==="asmr",u=[{to:"/",icon:o(I,{name:"home"}),label:"Home"},a?{to:"/manga",icon:o(I,{name:"book"}),label:"Manga"}:i?{to:"/tv-search",icon:o(I,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(I,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(I,{name:"search"}),label:"Search"},a?{to:"/reading-list",icon:o(I,{name:"bookmark"}),label:"Reading List"}:i?{to:"/tv-watchlist",icon:o(I,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(I,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(I,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(I,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(I,{name:"sync-alt"}),label:"Trackers"},...n==="anime"||i?[{to:"/watch-along",icon:o(I,{name:"play"}),label:"Watch along"}]:[],...r?[{to:"/mature",icon:o(I,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(I,{name:"cog"}),label:"Settings"}];return o(ye,{children:[o("aside",{className:`${ge.sidebar} ${e?ge.open:""} sidebar`,children:[o("div",{className:ge.sidebarHeader,children:o(me,{to:"/",className:ge.logo,onClick:s,children:o(pt,{})})}),o("button",{className:ge.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:o(I,{name:"chevron-left",size:18})}),o("nav",{className:ge.navSection,children:u.map(l=>o(Tr,{to:l.to,className:({isActive:d})=>`${ge.navLink} ${d?ge.active:""}`,onClick:s,end:l.to==="/",children:[l.icon,o("span",{children:l.label})]},l.to))}),o("div",{className:ge.versionInfo,children:["v",pr.version]})]}),e&&o("div",{className:ge.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},Ec="_footer_13o90_1",kc="_footerInner_13o90_16",Tc="_brandSection_13o90_28",Pc="_logoRow_13o90_40",Ic="_logoText_13o90_54",Nc="_brandMeta_13o90_61",Cc="_brandTagline_13o90_70",xc="_statusPill_13o90_77",Ac="_statusDot_13o90_90",Oc="_linksGrid_13o90_98",Lc="_linkColumn_13o90_106",Rc="_columnTitle_13o90_112",qc="_bottomBar_13o90_136",Dc="_copyright_13o90_146",$c="_brand_13o90_28",jc="_heartIcon_13o90_162",Mc="_backToTop_13o90_167",K={footer:Ec,footerInner:kc,brandSection:Tc,logoRow:Pc,logoText:Ic,brandMeta:Nc,brandTagline:Cc,statusPill:xc,statusDot:Ac,linksGrid:Oc,linkColumn:Lc,columnTitle:Rc,bottomBar:qc,copyright:Dc,brand:$c,heartIcon:jc,backToTop:Mc},Bc=()=>{const e=new Date().getFullYear(),t=Ze(),n=()=>{window.scrollTo({top:0,behavior:"smooth"})},r=s=>{t.pathname==="/"&&(s.preventDefault(),n())};return o("footer",{className:K.footer,children:[o("div",{className:K.footerInner,children:[o("div",{className:K.brandSection,children:[o("div",{className:K.logoRow,children:o(me,{to:"/",onClick:r,"aria-label":"Home",children:o(pt,{collapsed:!0,className:K.logoText})})}),o("div",{className:K.brandMeta,children:[o("div",{className:K.statusPill,children:[o("span",{className:K.statusDot}),o("span",{children:["v",pr.version]})]}),o("p",{className:K.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:K.linksGrid,children:[o("div",{className:K.linkColumn,children:[o("h4",{className:K.columnTitle,children:"Navigation"}),o(me,{to:"/",children:"Home"}),o(me,{to:"/watchlist",children:"Watchlist"}),o(me,{to:"/settings",children:"Settings"})]}),o("div",{className:K.linkColumn,children:[o("h4",{className:K.columnTitle,children:"Features"}),o(me,{to:"/search",children:"Search Anime"}),o(me,{to:"/trackers",children:"Trackers"}),o(me,{to:"/insights",children:"Insights"})]}),o("div",{className:K.linkColumn,children:[o("h4",{className:K.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(I,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(I,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:K.linkColumn,children:[o("h4",{className:K.columnTitle,children:"Project"}),o("a",{href:"https://github.com/serifpersia/dango/releases",target:"_blank",rel:"noopener noreferrer",children:"Releases"}),o("a",{href:"https://github.com/serifpersia/dango/issues",target:"_blank",rel:"noopener noreferrer",children:"Feedback"})]})]})]}),o("div",{className:K.bottomBar,children:[o("p",{className:K.copyright,children:["© ",e," ",o("span",{className:K.brand,children:"dango"})," • Crafted with"," ",o(I,{name:"heart",className:K.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:K.backToTop,onClick:n,"aria-label":"Back to top",children:[o(I,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})},bt=e=>{const t=q();return F({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},hr=()=>{const e=q(),t=ae();return pe(e.settings.set.mutationOptions({onSuccess:()=>{C.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[x.settings]})},onError:n=>{C.error(`Failed to update setting: ${n.message}`)}}))};function fr(e){return JSON.stringify({0:e??{}})}function gr(e){return`/api/trpc/${e}?batch=1&_profile=${encodeURIComponent(Xn())}`}function xt(e,t){const n=fr(t),r=gr(e);try{if(navigator.sendBeacon){navigator.sendBeacon(r,new Blob([n],{type:"application/json"}));return}}catch{}fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}).catch(()=>{})}async function yd(e,t){const n=await fetch(gr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:fr(t),keepalive:!0});if(!n.ok)throw new Error(`tRPC request failed (HTTP ${n.status})`)}function vd(e){e&&(xt("discord.clear",{sessionId:e}),xt("discord.heartbeat",{sessionId:e,bye:!0}))}function Fc(){const e=Ze(),{contentType:t}=Mt(),{data:n}=bt("discordRPCEnabled"),r=j("");r.current||(r.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),S(()=>{if(n===!1||n==="false")return;const s=r.current,a=()=>ee.discord.heartbeat.mutate({sessionId:s}).catch(()=>{});a();const i=setInterval(a,15e3),c=()=>{xt("discord.heartbeat",{sessionId:s,bye:!0})};return window.addEventListener("pagehide",c),()=>{clearInterval(i),window.removeEventListener("pagehide",c)}},[n]),S(()=>{if(n===!1||n==="false")return;const s=e.pathname;if(s.startsWith("/watch/")||s.startsWith("/player/"))return;let a="home";s==="/search"||s==="/mature"?a="search-anime":s==="/tv"||s==="/tv-search"?a="search-tv":s==="/manga"?a="search-manga":s==="/asmr"?a="search-asmr":s.startsWith("/watchlist")?a="watchlist":s.startsWith("/anime/")?a="anime":s.startsWith("/insights")?a="insights":s.startsWith("/settings")?a="settings":s.startsWith("/trackers")?a="trackers":s.startsWith("/tv/")?a="tv":s.startsWith("/manga/")?a="manga":s.startsWith("/asmr/")&&(a="asmr"),s==="/"&&(a=`home-${t}`),ee.discord.pageStatus.mutate({page:a,sessionId:r.current}).catch(()=>{})},[e.pathname,t,n])}function Wt(e,t){const[n,r]=y(()=>{try{const a=X.getItem(e);if(a===null)return t;if(typeof t=="string")return a;try{return JSON.parse(a)}catch{return a}}catch{return t}});S(()=>{const a=i=>{if(i.key===X.keyFor(e))try{if(i.newValue===null){r(t);return}if(typeof t=="string"){r(i.newValue);return}try{r(JSON.parse(i.newValue))}catch{r(i.newValue)}}catch{}};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[e,t]);const s=V(a=>{r(i=>{const c=typeof a=="function"?a(i):a;try{typeof c=="string"?X.setItem(e,c):X.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,s]}const yr=be(void 0),Wc=()=>{const e=we(yr);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},Kc="_container_e96gf_1",Uc="_field_e96gf_9",Hc="_textarea_e96gf_20",zc="_input_e96gf_40",Qc="_button_e96gf_58",Vc="_secondaryButton_e96gf_78",Gc="_actions_e96gf_95",Jc="_hint_e96gf_104",Yc="_link_e96gf_117",ie={container:Kc,field:Uc,textarea:Hc,input:zc,button:Qc,secondaryButton:Vc,actions:Gc,hint:Jc,link:Yc},Zc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Xc=e=>{try{return JSON.parse(e.detail)}catch{return null}},el=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=y(1),[a,i]=y(navigator.userAgent),[c,u]=y(""),[l,d]=y(!1),m=j(null),p=navigator.userAgent,h=/android/i.test(p),g=/firefox|fxios/i.test(p)&&!h,b=!g&&!h&&/chrome|chromium|edg|brave/i.test(p),A=g||b;S(()=>{e&&(s(1),i(navigator.userAgent),u(""),d(!1))},[e]),S(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const v=()=>{window.open("https://animepahe.pw","_blank","noopener,noreferrer"),s(2)},O=()=>{if(l)return;d(!0);const N=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,L=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),C.error("Helper not detected - install it via about:debugging first.")},3e3),W=se=>{const w=Xc(se);if(!(!w||w.requestId!==N))if(window.clearTimeout(L),window.removeEventListener("dango:pahe-cookie",W),m.current=null,d(!1),w?.ok&&w.cookie)u(w.cookie),C.success("Cookie extracted from helper!");else if(w?.error==="NO_COOKIE"){const D=w.debug?.stores?.length??0,M=w.debug?.names??[];C.error(`Helper found no cf_clearance (checked ${D} stores, saw: ${M.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else C.error("Helper request failed - try again.")};m.current=W,window.addEventListener("dango:pahe-cookie",W),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:N}}))},E=()=>{const N=c.trim();if(!N){C.error("Please enter the cf_clearance cookie");return}try{X.setItem("animepahe_ua",a),X.setItem("animepahe_cookie",N),C.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{C.error("Failed to save cookie")}};return o(Me,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:ie.container,children:r===1?o(ye,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:ie.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:a,readOnly:!0,rows:3,className:ie.textarea})]}),o("div",{className:ie.actions,children:[o("button",{className:ie.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ie.button,onClick:v,children:"Start Verification (Opens AnimePahe)"})]})]}):o(ye,{children:[o("p",{children:["1. Solve the challenge on the ",o("strong",{children:"AnimePahe tab"})," (keep that tab open).",o("br",{}),"2. Copy the ",o("strong",{children:"cf_clearance"})," cookie value using one of these:",o("br",{}),o("br",{}),o("strong",{children:"Chrome / Edge — DevTools:"})," press ",o("code",{children:"F12"})," →"," ",o("strong",{children:"Application"})," → ",o("strong",{children:"Cookies"})," →"," ",o("code",{children:"https://animepahe.pw"}),". Find ",o("strong",{children:"cf_clearance"}),", double-click its ",o("strong",{children:"Value"})," to select it, then copy.",o("br",{}),o("br",{}),o("strong",{children:"Firefox — Storage Inspector:"})," press ",o("code",{children:"F12"})," →"," ",o("strong",{children:"Storage"})," → ",o("strong",{children:"Cookies"})," →"," ",o("code",{children:"https://animepahe.pw"}),". Find ",o("strong",{children:"cf_clearance"}),", right-click the value → ",o("strong",{children:"Copy Value"}),".",o("br",{}),o("br",{}),o("strong",{children:"Either browser — extension:"})," open"," ",o("strong",{children:"Cookie Manager"})," while on the AnimePahe tab, find"," ",o("strong",{children:"cf_clearance"}),", and copy its value (or use the extension's export).",o("br",{}),o("br",{}),"3. Paste it below. Copy ",o("strong",{children:"only the value"})," — remove any"," ",o("code",{children:"cf_clearance="})," prefix or quotes if they were included."]}),A&&o("div",{className:ie.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",g?o(ye,{children:["type ",o("code",{children:"about:debugging"})," in the address bar →"," ",o("strong",{children:"This Firefox"})," → ",o("strong",{children:"Load Temporary Add-on"})," ","→ open the ",o("code",{children:"dango-extension/firefox"})," folder and pick"," ",o("code",{children:"manifest.json"}),". (Temporary helpers unload when Firefox closes - repeat after a restart.)"]}):o(ye,{children:["type ",o("code",{children:"chrome://extensions"})," in the address bar → enable"," ",o("strong",{children:"Developer mode"})," → ",o("strong",{children:"Load unpacked"})," → open the ",o("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice - expected.)"]})," ","Use this link to download the extension and extract it:"," ",o("a",{href:Zc,target:"_blank",rel:"noreferrer",className:ie.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:ie.actions,children:o("button",{className:ie.button,onClick:O,disabled:l,type:"button",children:l?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:ie.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:N=>u(N.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:ie.input})]}),o("div",{className:ie.actions,children:[o("button",{className:ie.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ie.secondaryButton,onClick:()=>s(1),children:"Back"}),o("button",{className:ie.button,onClick:E,children:"Submit"})]})]})})})};function En(){const[e,t]=y(!1);return S(()=>{const n=window.setTimeout(()=>t(!0),120);return()=>window.clearTimeout(n)},[]),e?o("div",{className:"top-progress-bar",role:"progressbar","aria-label":"Loading"}):null}const tl="_screen_1pca0_1",nl="_icon_1pca0_14",rl="_title_1pca0_20",ol="_text_1pca0_24",al="_button_1pca0_29",Ke={screen:tl,icon:nl,title:rl,text:ol,button:al};async function sl(e,t){const n={message:e.message,stack:e.stack,componentStack:t.componentStack,url:typeof window<"u"?window.location.href:"",timestamp:new Date().toISOString()},r=JSON.stringify(n);try{if(navigator.sendBeacon){navigator.sendBeacon("/api/internal/client-error",new Blob([r],{type:"application/json"}));return}}catch{}fetch("/api/internal/client-error",{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}).catch(()=>{})}class il extends Pr{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n),sl(t,n)}render(){return this.state.hasError?o("div",{className:Ke.screen,children:[o(I,{name:"exclamation-triangle",className:Ke.icon}),o("h1",{className:Ke.title,children:"Something went wrong"}),o("p",{className:Ke.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Ke.button,children:[o(I,{name:"home"}),"Go back Home"]})]}):this.props.children}}const vr=be(void 0),cl=()=>{const e=we(vr);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},ll=({children:e})=>{const[t,n]=y(!1),r=V(()=>n(!0),[]),s=V(()=>n(!1),[]);return S(()=>Zn("lan",r),[r]),o(vr.Provider,{value:{isOpen:t,openModal:r,closeModal:s},children:e})},ul="_container_88bss_1",dl="_field_88bss_8",ml="_input_88bss_19",pl="_actions_88bss_37",st={container:ul,field:dl,input:ml,actions:pl},Qe=Ir(({variant:e="primary",size:t="md",loading:n,children:r,className:s="",disabled:a,...i},c)=>{const u=gs("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",s);return o("button",{className:u,disabled:a||n,ref:c,...i,children:n?o("span",{className:"btn-spinner"}):r})}),br=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=y(""),[a,i]=y(!1);Ot.useEffect(()=>{e&&s("")},[e]);const c=async()=>{if(!r){C.error("Please enter your password");return}i(!0);try{const u=await Dt("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),l=await u.json().catch(()=>({}));if(!u.ok){C.error(l.error||"Login failed");return}C.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{C.error("Network error")}finally{i(!1)}};return o(Me,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:st.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:st.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:u=>s(u.currentTarget.value),placeholder:"Enter password...",className:st.input,onKeyDown:u=>u.key==="Enter"&&c()})]}),o("div",{className:st.actions,children:[o(Qe,{variant:"secondary",onClick:t,disabled:a,children:"Cancel"}),o(Qe,{variant:"primary",onClick:c,loading:a,children:"Unlock"})]})]})})},hl="_notice_1d75r_1",fl={notice:hl},gl=2600,yl=1e4,vl={anilist:"Updating AniList…",mal:"Updating MyAnimeList…"};function bl({enabled:e=!0}){const[t,n]=y(!1),[r,s]=y("mal"),[a,i]=y(document.fullscreenElement);return S(()=>{const c=()=>i(document.fullscreenElement);return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[]),S(()=>{if(!e||typeof EventSource>"u")return;const c=new EventSource("/api/tracker/activity"),u=new Map;let l;const d=new Set;let m=-1/0;const p=h=>{let g;try{g=JSON.parse(h.data)}catch{return}const b=g.provider;b!=="anilist"&&b!=="mal"||(g.updating===!0?(clearTimeout(u.get(b)),d.size===0&&Date.now()-m>=yl&&(m=Date.now(),s(b),n(!0),clearTimeout(l),l=setTimeout(()=>n(!1),gl)),d.add(b)):g.updating===!1&&(clearTimeout(u.get(b)),u.set(b,setTimeout(()=>d.delete(b),1500))))};return c.addEventListener("tracker-activity",p),()=>{c.removeEventListener("tracker-activity",p),c.close(),clearTimeout(l);for(const h of u.values())clearTimeout(h);n(!1)}},[e]),!e||!t?null:On(o("div",{className:fl.notice,role:"status","aria-live":"polite","aria-atomic":"true",children:[o(I,{name:r==="anilist"?"anilist":"myanimelist",size:15}),o("span",{children:vl[r]})]}),a||document.body)}const wl=U(()=>H(()=>import("./Home-CsMgWycR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),_l=U(()=>H(()=>import("./Watchlist-McU_iHmN.js"),__vite__mapDeps([36,1,2,4,12,13,14,6,15,3,5,7,8,9,10,11,16,17,18,19,20,37,38,39,40,41]))),Sl=U(()=>H(()=>import("./Settings-F4CGjK1n.js"),__vite__mapDeps([42,1,2,4,43,44,16,9,10,45]))),kn=U(()=>H(()=>import("./Player-NNpxqQwi.js"),__vite__mapDeps([46,1,47,4,48,2,49,16,50,9,10,7,22,23,14,6,15,29,51,52,53,54,55,56,57]))),El=U(()=>H(()=>import("./WatchAlong-BQEEQ8qq.js"),__vite__mapDeps([58,1,55,56,2,4]))),kl=U(()=>H(()=>import("./Search-D-DnJTst.js"),__vite__mapDeps([59,1,4,3,5,6,7,8,9,10,11,12,13,2,14,15,16,17,18,19,20,39,40,60,61]))),Tl=U(()=>H(()=>import("./Mature-Bwpv7C--.js"),__vite__mapDeps([62,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,29,60,61,63]))),Tn=U(()=>H(()=>import("./Asmr-D2BKNSNd.js"),__vite__mapDeps([64,1,4,2,43,44,9,10,3,5,6,7,8,11,34,26,65,27,47,48,66,67,68]))),Pl=U(()=>H(()=>import("./Manga-6FX-ny6n.js"),__vite__mapDeps([69,1,4,43,44,9,10,19,20,3,5,6,7,8,11,24,25,2,26,27,29,70,71,66,67]))),Il=U(()=>H(()=>import("./MangaInfoPage-C6xCfHOM.js"),__vite__mapDeps([72,1,4,19,20,70,71,25,2,26,66,67]))),Nl=U(()=>H(()=>import("./MangaReadPage-BjqdvaOh.js"),__vite__mapDeps([73,1,19,4,20,2,70,71,25,26,66,67]))),Cl=U(()=>H(()=>import("./ReadingList-JpAZ_9Mj.js"),__vite__mapDeps([74,1,3,4,5,6,7,8,9,10,11,75,17,18,19,20,37,38,24,25,2,26,27,28,21]))),Pn=U(()=>H(()=>import("./TvSearch-BuNWu2c4.js"),__vite__mapDeps([76,1,4,3,5,6,7,8,9,10,11,30,31,32,2,26,17,18,19,20,60,61]))),xl=U(()=>H(()=>import("./TvInfo-zdAQ3Wup.js"),__vite__mapDeps([77,1,4,32,2,26,78]))),Al=U(()=>H(()=>import("./Tv-DPBpdr3A.js"),__vite__mapDeps([79,1,47,4,48,2,49,16,50,80,9,10,29,32,26,7,53,54,55,56,81]))),Ol=U(()=>H(()=>import("./TvWatchlist-BpCDLs_Z.js"),__vite__mapDeps([82,1,3,4,5,6,7,8,9,10,11,75,17,18,19,20,37,38,21,31,32,2,26]))),Ll=U(()=>H(()=>import("./ListeningList-H-WkS0VL.js"),__vite__mapDeps([83,1,3,4,5,6,7,8,9,10,11,75,17,18,19,20,37,38,34,2,26,65,27,33,21]))),Rl=U(()=>H(()=>import("./Trackers-CUlPOXTN.js"),__vite__mapDeps([84,1,2,4,85]))),ql=U(()=>H(()=>import("./Insights-BEpf49rM.js"),__vite__mapDeps([86,1,2,4,5,6,7,8,9,10,87]))),Dl=U(()=>H(()=>import("./AnimeInfoPage-CJ-sJXzb.js"),__vite__mapDeps([88,1,2,4]))),$l=U(()=>H(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([89,1]))),jl=U(()=>H(()=>import("./VirtualKeyboard-RZ5whICJ.js"),__vite__mapDeps([90,1,2,4,91])));function Ml(){const{isOpen:e,closeModal:t,onSuccess:n}=Wc(),{isOpen:r,setIsOpen:s}=jt(),{isOpen:a,openModal:i,closeModal:c}=cl(),u=Ze(),l=Nr(),d=j(new Map),m=j(u.pathname),p=j(u.key),h=j(null),[g,b]=y(!1),A=pi();Fc();const{data:v}=bt("frozenMode"),O=v==="true"||v===!0,[E,N]=y(!1);S(()=>{const w=new AbortController;return qe("/api/auth/app-status",{signal:w.signal}).then(D=>{D.hasPassword&&!D.isAuthenticated&&(N(!0),i())}).catch(()=>{w.signal.aborted||C.error("Could not check server access. The server may still be starting; reload to retry.")}),()=>w.abort()},[i]);const[L,W]=Wt("lan_auth_notice_shown","false"),se=j(!1);return S(()=>{if(L==="true"||se.current)return;se.current=!0,W("true");const w=setTimeout(()=>{C("Optional LAN lock is available. Set a password in Settings to protect access from other devices on your network.",{duration:1e4,icon:"🔒"})},3e3);return()=>clearTimeout(w)},[L,W]),S(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),S(()=>{const w=u.key,D=d.current;if(l==="POP"){const M=D.get(w)??0;window.scrollTo({top:M,behavior:"instant"})}else u.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=u.pathname,()=>{D.set(w,window.scrollY)}},[u.key,u.pathname,l]),S(()=>{const w=()=>{b(!0),h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{b(!1),h.current=null},1e4)},D=z=>{if(z.defaultPrevented||z.button!==0||z.metaKey||z.ctrlKey||z.shiftKey||z.altKey)return;const le=z.target;if(!(le instanceof Element))return;const te=le.closest("a[href]");if(!te||te.hasAttribute("download")||te.getAttribute("target")==="_blank")return;const ue=new URL(te.href,window.location.href);ue.origin===window.location.origin&&`${ue.pathname}${ue.search}${ue.hash}`!=`${window.location.pathname}${window.location.search}${window.location.hash}`&&w()},M=()=>w();return document.addEventListener("click",D,!0),window.addEventListener("popstate",M),()=>{document.removeEventListener("click",D,!0),window.removeEventListener("popstate",M),h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[]),S(()=>{p.current!==u.key&&(p.current=u.key,g&&(h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{b(!1),h.current=null},500)))},[u.key,g]),S(()=>{const w=D=>{r&&D.key==="Escape"&&s(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w),document.body.classList.remove("sidebar-open")}},[r,s]),o("div",{className:"app-container",children:[o(el,{isOpen:e,onClose:t,onSuccess:n}),o(br,{isOpen:a,onClose:E?()=>{}:c,onSuccess:()=>{N(!1),c()}}),o(Fn,{position:"top-center",toastOptions:{style:{background:"var(--bg-elevated)",color:"var(--text-primary)",border:"1px solid var(--border-primary)"},success:{style:{background:"var(--accent)",color:"var(--accent-text)"},iconTheme:{primary:"var(--accent-text)",secondary:"var(--accent)"}},error:{style:{background:"rgba(153, 42, 42, 0.95)",color:"#fff"}}}}),g&&o(En,{}),O&&o("div",{style:{padding:"0.5rem 1rem",background:"var(--bg-tertiary)",borderBottom:"1px solid var(--border-color)",fontSize:"0.85rem",textAlign:"center"},children:[o("strong",{children:"Frozen Mode:"})," nothing is being saved or synced."]}),o(bl,{enabled:!E&&!a}),o(lc,{}),o(Sc,{}),o("main",{className:"main-content",children:o(il,{children:o(Gt,{fallback:o(En,{}),children:o(Cr,{children:[o($,{path:"/",element:o(wl,{})}),o($,{path:"/watchlist/:filter?",element:o(_l,{})}),o($,{path:"/reading-list/:filter?",element:o(Cl,{})}),o($,{path:"/search",element:o(kl,{})}),o($,{path:"/mature",element:o(Tl,{})}),o($,{path:"/asmr",element:o(Tn,{})}),o($,{path:"/asmr/:rj",element:o(Tn,{})}),o($,{path:"/manga",element:o(Pl,{})}),o($,{path:"/manga/:provider/:id",element:o(Il,{})}),o($,{path:"/manga/:provider/:id/read",element:o(Nl,{})}),o($,{path:"/tv",element:o(Pn,{})}),o($,{path:"/tv/:id",element:o(xl,{})}),o($,{path:"/tv/:id/watch",element:o(Al,{})}),o($,{path:"/tv-search",element:o(Pn,{})}),o($,{path:"/tv-watchlist/:filter?",element:o(Ol,{})}),o($,{path:"/listening-list/:filter?",element:o(Ll,{})}),o($,{path:"/settings",element:o(Sl,{})}),o($,{path:"/trackers",element:o(Rl,{})}),o($,{path:"/mal",element:o(Jt,{to:"/trackers",replace:!0})}),o($,{path:"/insights",element:o(ql,{})}),o($,{path:"/anime/:id",element:o(Dl,{})}),o($,{path:"/watch/:id",element:o(kn,{})}),o($,{path:"/watch-along",element:o(El,{})}),o($,{path:"/watch/:id/:episodeNumber",element:o(kn,{})}),o($,{path:"/player/:id/:episodeNumber?",element:o($l,{})}),o($,{path:"*",element:o(Jt,{to:"/",replace:!0})})]})})})}),o(Bc,{}),A.isVisible&&o(Gt,{fallback:null,children:o(jl,{activeInputRef:A.activeInputRef,isVisible:A.isVisible,onClose:A.hide})})]})}function Bl(){return o(ll,{children:o(Ml,{})})}const Fl=({children:e})=>{const[t,n]=y(!1),r=V(()=>{n(a=>!a)},[]),s=je(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(lr.Provider,{value:s,children:e})},Wl=({children:e})=>{const[t,n]=Wt("dango_content_type","anime"),r=je(()=>({contentType:t,setContentType:n}),[t,n]);return o(ur.Provider,{value:r,children:e})},Kl=({children:e})=>{const[t,n]=y("englishName"),[r,s]=y(!0);S(()=>{(async()=>{try{const c=await ee.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{s(!1)}})()},[]);const a=je(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(or.Provider,{value:a,children:e})},wr=be(void 0),bd=()=>{const e=we(wr);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},Ul=({children:e})=>{const{data:t,isLoading:n}=bt("lowEndMode"),r=hr(),s=ae(),[a,i]=y(!1);S(()=>{const l=s.getDefaultOptions();s.setDefaultOptions({...l,queries:{...l.queries,gcTime:a?900*1e3:1800*1e3}})},[a,s]),S(()=>{t!==void 0&&i(t==="true"||t===!0)},[t]),S(()=>{a?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[a]);const c=V(l=>{i(l),r.mutate({key:"lowEndMode",value:String(l)})},[r]),u=je(()=>({lowEndMode:a,setLowEndMode:c,loading:n}),[a,c,n]);return o(wr.Provider,{value:u,children:e})},_r=be(void 0),wd=()=>{const e=we(_r);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},_d=[{id:"iris",label:"Taro (default)",blurb:"Deep purple",swatch:"#7d6df0"},{id:"sakura",label:"Sakura",blurb:"Soft pink",swatch:"#e0b0e0"},{id:"mochi",label:"Mochi",blurb:"Monochrome pearl",swatch:"#f0f0f0"}],Hl=["iris","mochi","sakura"];function In(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const zl=({children:e})=>{const{data:t,isLoading:n}=bt("theme"),r=hr(),[s,a]=y("iris");S(()=>{typeof t=="string"&&Hl.includes(t)&&a(t)},[t]),S(()=>{In(s)},[s]);const i=V(u=>{u!==s&&(a(u),In(u),r.mutate({key:"theme",value:u}))},[r,s]),c=je(()=>({theme:s,setTheme:i,loading:n}),[s,i,n]);return o(_r.Provider,{value:c,children:e})},Ql=({children:e})=>{const[t,n]=y(!1),[r,s]=y(void 0),a=V(c=>{s(()=>c),n(!0)},[]),i=V(()=>{n(!1),s(void 0)},[]);return S(()=>Zn("animepahe",()=>a()),[a]),o(yr.Provider,{value:{isOpen:t,openModal:a,closeModal:i,onSuccess:r},children:e})},Vl="_gate_1ex8w_1",Gl="_gateExiting_1ex8w_21",Jl="_appEntering_1ex8w_27",Yl="_gateInner_1ex8w_100",Zl="_connecting_1ex8w_110",Xl="_connectingLogo_1ex8w_118",eu="_connectingDots_1ex8w_128",tu="_gateTitle_1ex8w_149",nu="_profileGrid_1ex8w_157",ru="_profileCard_1ex8w_165",ou="_profileCardAvatar_1ex8w_216",au="_addAvatar_1ex8w_245",su="_profileCardName_1ex8w_255",iu="_ownerTag_1ex8w_265",cu="_lockBadge_1ex8w_273",lu="_gatePanel_1ex8w_288",uu="_panelAvatar_1ex8w_302",du="_panelTitle_1ex8w_308",mu="_gateForm_1ex8w_314",pu="_gateField_1ex8w_320",hu="_gateHint_1ex8w_346",fu="_gateError_1ex8w_353",gu="_backButton_1ex8w_359",yu="_form_1ex8w_444",vu="_field_1ex8w_457",bu="_avatarRow_1ex8w_474",wu="_uploadButton_1ex8w_486",_u="_fileInput_1ex8w_515",Su="_profileList_1ex8w_528",Eu="_smallAvatar_1ex8w_541",ku="_profileName_1ex8w_546",P={gate:Vl,gateExiting:Gl,appEntering:Jl,gateInner:Yl,connecting:Zl,connectingLogo:Xl,connectingDots:eu,gateTitle:tu,profileGrid:nu,profileCard:ru,profileCardAvatar:ou,addAvatar:au,profileCardName:su,ownerTag:iu,lockBadge:cu,gatePanel:lu,panelAvatar:uu,panelTitle:du,gateForm:mu,gateField:pu,gateHint:hu,gateError:fu,backButton:gu,form:yu,field:vu,avatarRow:bu,uploadButton:wu,fileInput:_u,profileList:Su,smallAvatar:Eu,profileName:ku},Kt="dango:entering-profile";function Tu(){try{return!!sessionStorage.getItem(Kt)}catch{return!1}}function Nn(){try{sessionStorage.setItem(Kt,String(Date.now()))}catch{}}function Pu({children:e}){const[t,n]=y(!1),[r,s]=y(!1),[a,i]=y(()=>Tu()),[c,u]=y(!0),[l,d]=y(!1),[m,p]=y(!1),[h,g]=y([]),[b,A]=y(""),[v,O]=y("pick"),[E,N]=y(""),[L,W]=y(""),[se,w]=y(!1),[D,M]=y(0),[z,le]=y(""),[te,ue]=y(""),[G,J]=y("");S(()=>{let k=!1,Z;W(""),u(!0),d(!1);let Q=!1;const he=setTimeout(()=>{k||(Q=!0,d(!0))},500),Oe=()=>{he&&clearTimeout(he),d(!1)};return(async()=>{const Le=await qe("/api/auth/app-status");if(k)return;if(Le.hasPassword&&!Le.isAuthenticated){p(!0),Oe(),u(!1);return}const Ne=await qe("/api/profiles/status");if(!k)if(Ne.current){Ya(Ne.current.id);const Be=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ce=Q&&!Be;Ce&&s(!0),Z=setTimeout(()=>{if(!k){Oe(),n(!0),s(!1),u(!1);try{sessionStorage.removeItem(Kt)}catch{}}},Ce?280:0)}else Oe(),g(Ne.profiles),A(Ne.profiles[0]?.id??""),u(!1)})().catch(Le=>{k||(Oe(),W(Le.message),u(!1))}),()=>{k=!0,Z&&clearTimeout(Z),he&&clearTimeout(he)}},[D]),S(()=>{const k=Q=>{Q.key==="dango:profile-session-change"&&(Nn(),window.location.reload())},Z=()=>{n(!1),s(!1),i(!1),M(Q=>Q+1)};return window.addEventListener("storage",k),window.addEventListener("dango:profile-auth-required",Z),()=>{window.removeEventListener("storage",k),window.removeEventListener("dango:profile-auth-required",Z)}},[]);const B=async(k,Z)=>{w(!0),W("");try{await qe("/api/profiles/login",{method:"POST",body:JSON.stringify({id:k,password:Z})}),Nn(),Xa()}catch(Q){W(Q.message),w(!1)}},fe=k=>{W(""),N(""),A(k.id),k.protected?O("password"):B(k.id,"")},et=()=>{O("pick"),N(""),W("")};if(t)return a?o("div",{className:P.appEntering,children:e}):e;const Ie=h.find(k=>k.id===b);return c&&!l&&!L&&!m?o("div",{className:P.gate,"aria-hidden":"true"}):o("div",{className:`${P.gate}${r?` ${P.gateExiting}`:""}`,children:[o(Fn,{}),o(br,{isOpen:m,onClose:()=>{},onSuccess:()=>{p(!1),M(k=>k+1)}}),v==="pick"&&c&&l&&!h.length&&!L&&!m&&o("section",{className:P.gateInner,"aria-busy":"true","aria-label":"Connecting to Dango",children:o("div",{className:P.connecting,children:[o("span",{className:P.connectingLogo,"aria-hidden":"true"}),o("h1",{className:P.gateTitle,children:"Connecting to Dango"}),o("span",{className:P.connectingDots,"aria-hidden":"true",children:[o("span",{}),o("span",{}),o("span",{})]})]})}),v==="pick"&&!c&&o("section",{className:P.gateInner,children:[o("h1",{className:P.gateTitle,children:h.length?"Who's watching?":"Dango"}),h.length>0&&o("div",{className:P.profileGrid,children:[h.map(k=>o("button",{type:"button",className:P.profileCard,disabled:se,onClick:()=>fe(k),children:[o("span",{className:P.profileCardAvatar,children:[o(It,{image:k.avatar??k.cloudAvatar,name:k.name,size:"100%",radius:"var(--radius-sm)"}),k.protected&&o("span",{className:P.lockBadge,"aria-hidden":"true",children:o(I,{name:"lock",size:"0.85rem"})})]}),o("span",{className:P.profileCardName,children:[k.name,k.owner&&o("span",{className:P.ownerTag,children:"Owner"})]})]},k.id)),o("button",{type:"button",className:P.profileCard,disabled:se,onClick:()=>{W(""),O("create")},children:[o("span",{className:`${P.profileCardAvatar} ${P.addAvatar}`,children:o(I,{name:"plus",size:40})}),o("span",{className:P.profileCardName,children:"Add profile"})]})]}),L&&o(ye,{children:[o("p",{role:"alert",className:P.gateError,children:L}),!h.length&&o(Qe,{variant:"secondary",onClick:()=>M(k=>k+1),children:"Retry"})]})]}),v==="password"&&Ie&&o("section",{className:P.gatePanel,children:[o("button",{type:"button",className:P.backButton,onClick:et,children:[o(I,{name:"chevron-left"}),"Back"]}),o("div",{className:P.panelAvatar,children:o(It,{image:Ie.avatar??Ie.cloudAvatar,name:Ie.name,size:"100%",radius:"18%"})}),o("h2",{className:P.panelTitle,children:Ie.name}),o("form",{className:P.gateForm,onSubmit:k=>{k.preventDefault(),B(b,E)},children:[o("label",{className:P.gateField,children:["Password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:E,onChange:k=>N(k.currentTarget.value)})]}),o(Qe,{type:"submit",className:"btn-block",loading:se,children:"Continue"})]}),L&&o("p",{role:"alert",className:P.gateError,children:L})]},"password"),v==="create"&&o("section",{className:P.gatePanel,children:[o("button",{type:"button",className:P.backButton,onClick:et,children:[o(I,{name:"chevron-left"}),"Back"]}),o("h2",{className:P.panelTitle,children:"Add a profile"}),o("p",{className:P.gateHint,children:"Enter the owner password to create a new profile."}),o("form",{className:P.gateForm,onSubmit:async k=>{k.preventDefault(),w(!0),W("");try{const Z=await qe("/api/profiles/create",{method:"POST",body:JSON.stringify({name:te,password:G,ownerPassword:z})});g(Q=>[...Q,Z]),le(""),ue(""),J(""),O("pick"),A(Z.id),Z.protected?O("password"):await B(Z.id,"")}catch(Z){W(Z.message)}finally{w(!1)}},children:[o("label",{className:P.gateField,children:["Owner password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:z,onChange:k=>le(k.currentTarget.value)})]}),o("label",{className:P.gateField,children:["Profile name",o("input",{required:!0,maxLength:60,value:te,onChange:k=>ue(k.currentTarget.value)})]}),o("label",{className:P.gateField,children:["Profile password (optional)",o("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:G,onChange:k=>J(k.currentTarget.value)})]}),o(Qe,{type:"submit",className:"btn-block",loading:se,children:"Create profile"})]}),L&&o("p",{role:"alert",className:P.gateError,children:L})]},"create")]})}const Sr=be(null);function Sd(){const e=we(Sr);if(!e)throw new Error("WatchAlongProvider is missing");return e}const Iu=/^[0-9a-f-]{36}$/,Nu=/^[0-9a-f]{64}$/;function Ed(e,t){return(e.kind??"anime")===(t.kind??"anime")&&e.season===t.season&&e.showId===t.showId&&e.episode===t.episode&&e.provider===t.provider&&e.mode===t.mode&&e.source===t.source}function kd(e,t){return e.position+(e.playing?Math.max(0,t-e.updatedAt)/1e3*e.rate:0)}const At="dango-watch-along",Ut="dango-watch-along-host";function Cn(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.token!="string"||typeof t.guestToken!="string")return null;const n=Ve(`${t.id}.${t.guestToken}`,""),r=Ve(`${t.id}.${t.token}`,"");return{...n,token:r.token,host:t.host===!0}}function Cu(){try{return Cn(JSON.parse(sessionStorage.getItem(At)||"null"))??Cn(JSON.parse(localStorage.getItem(Ut)||"null"))}catch{return null}}function xu(e){try{e?sessionStorage.setItem(At,JSON.stringify(e)):sessionStorage.removeItem(At),e?.host&&localStorage.setItem(Ut,JSON.stringify(e))}catch{}}function it(){try{localStorage.removeItem(Ut)}catch{}}function Au(e){return e.kind==="tv"||e.kind==="movie"?gi(e.kind,e.showId,e.kind==="tv"?e.season:void 0,e.kind==="tv"?Number(e.episode):void 0):`/watch/${encodeURIComponent(e.showId)}/${encodeURIComponent(e.episode)}`}function Ve(e,t){let n=e.trim().replace(/^#/,"");if(n.includes("://")){const i=new URL(n);if(i.origin!==new URL(t).origin||!["/join","/watch-along"].includes(i.pathname))throw new Error("Use an invite from this dango watch-along service.");n=i.hash.slice(1)}const[r,s,a]=n.split(".");if(!Iu.test(r||"")||!Nu.test(s||"")||a!==void 0)throw new Error("Paste a complete watch-along invite link or room code.");return{id:r,token:s,guestToken:s,host:!1}}function Ou({children:e}){const t=Ln(),n=Ze(),[r,s]=Wt("watchAlongName",""),[a,i]=y(Cu),[c,u]=y(null),[l,d]=y(!1),[m,p]=y(""),[h,g]=y(""),[b,A]=y({offset:0,latency:0}),v=j(null),{data:O}=F({queryKey:["watch-along-config"],queryFn:()=>ee.settings.watchAlong.query()}),E=O?.workerUrl.replace(/\/$/,"")||"";S(()=>{xu(a)},[a]);const N=V(w=>{v.current?.readyState===WebSocket.OPEN&&v.current.send(JSON.stringify(w))},[]);S(()=>{if(!l)return;const w=setTimeout(()=>N({type:"name",name:r}),250);return()=>clearTimeout(w)},[l,h,r,N]);const L=V(()=>{a?.host&&N({type:"end"}),v.current?.close(1e3,"Left room"),it(),i(null),u(null),d(!1),p("")},[N,a]),W=async w=>{if(!E)throw new Error("Watch along is unavailable. Check your server configuration.");const D=await fetch(`${E}/rooms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w),signal:AbortSignal.timeout(15e3)}),M=await D.json();if(!D.ok)throw new Error(M.error||"Could not create room");const z=Ve(`${M.id}.${M.guestToken}`,E),le=Ve(`${M.id}.${M.hostToken}`,E);p(""),u(null),i({...z,token:le.token,host:!0})},se=w=>{if(!E)throw new Error("Watch along is unavailable. Check your server configuration.");const D=Ve(w,E);it(),p(""),u(null),i(D)};return S(()=>{if(!a||!E)return;let w=!1,D=0,M,z,le=Date.now();const te=async()=>{if(w)return;try{const J=await fetch(`${E}/rooms/${a.id}`,{headers:{Authorization:`Bearer ${a.token}`},signal:AbortSignal.timeout(1e4)});if(w)return;if(!J.ok){const B=await J.json();if([403,404,409].includes(J.status)){p(B.error||"Unable to join room"),it(),i(null),u(null);return}throw new Error(B.error||"Room service unavailable")}}catch{if(w)return;p("Cannot reach the room service. Retrying…"),M=setTimeout(te,Math.min(15e3,1e3*2**Math.min(D++,4)));return}const ue=new URL(`${E}/rooms/${a.id}/ws`);ue.protocol=ue.protocol==="https:"?"wss:":"ws:";const G=new WebSocket(ue,["dango-watch-along",a.token]);v.current=G,G.onopen=()=>{le=Date.now()},G.onmessage=J=>{if(!(w||v.current!==G)){le=Date.now();try{const B=JSON.parse(J.data);if(B.type==="joined"){if(B.host!==a.host){G.close(4003,"Invalid role");return}D=0,d(!0),p(""),g(B.id),G.send(JSON.stringify({type:"ping",sentAt:Date.now()}))}else if(B.type==="state")u(fe=>fe&&fe.revision>B.state.revision?fe:B.state);else if(B.type==="pong"){const fe=Date.now()-B.sentAt;A({offset:B.serverTime-(B.sentAt+fe/2),latency:fe/2})}else B.type==="error"&&p(B.error)}catch{p("Invalid response from the room service.")}}},G.onclose=J=>{if(!(w||v.current!==G)){if(clearInterval(z),d(!1),[4003,4004,4009].includes(J.code)){p(J.reason||"Room closed"),J.code!==4009&&it(),i(null),u(null);return}p("Connection lost. Reconnecting…"),M=setTimeout(te,Math.min(15e3,1e3*2**Math.min(D++,4)))}},G.onerror=()=>G.close(),z=setInterval(()=>{Date.now()-le>25e3?G.close():G.readyState===WebSocket.OPEN&&G.send(JSON.stringify({type:"ping",sentAt:Date.now()}))},1e4)};return te(),()=>{w=!0,clearTimeout(M),clearInterval(z),v.current?.close(1e3,"Leaving connection"),v.current=null,d(!1)}},[a,E]),S(()=>{if(!a||a.host||!c)return;const w=Au(c.selection);`${n.pathname}${n.search}`!==w&&t(w,{replace:!0})},[a,c,n.pathname,n.search,t]),o(Sr.Provider,{value:{workerUrl:E,displayName:r,setDisplayName:s,session:a,room:c,connected:l,error:m,selfId:h,clock:b,create:W,join:se,leave:L,send:N},children:e})}try{window.history.scrollRestoration="manual"}catch{}const xn=new Rr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),An=document.getElementById("root");An&&xr(o(Pu,{children:o(Ar,{children:o(rs,{trpcClient:ee,queryClient:xn,children:o(qr,{client:xn,children:o(Ql,{children:o(Fl,{children:o(Wl,{children:o(Kl,{children:o(Ul,{children:o(zl,{children:o(Ou,{children:o(Bl,{})})})})})})})})})})})}),An);export{_d as $,Ju as A,Qe as B,od as C,Zu as D,Mu as E,Wn as F,fd as G,ad as H,Xu as I,Yu as J,C as K,bt as L,ud as M,hr as N,nd as O,rd as P,td as Q,Me as R,hi as S,ld as T,qe as U,P as V,It as W,Xa as X,Dt as Y,Y as Z,wd as _,Wt as a,vn as a0,dr as a1,yn as a2,H as a3,wt as a4,ju as a5,ie as a6,Sd as a7,el as a8,Ku as a9,mi as aa,_i as ab,vd as ac,Zn as ad,gd as ae,dd as af,pd as ag,hd as ah,bi as ai,Bt as aj,id as ak,De as al,yd as am,Ed as an,kd as ao,jt as ap,sd as aq,En as ar,Qu as as,Vu as at,zu as au,Bu as b,Fu as c,ar as d,uc as e,rr as f,md as g,Du as h,gi as i,cd as j,fi as k,ys as l,wi as m,wn as n,q as o,X as p,x as q,Wu as r,$u as s,ee as t,bd as u,Mt as v,ed as w,Uu as x,Hu as y,Gu as z};
@@ -1 +1 @@
1
- import{q as r}from"./index-CkZCduQZ.js";const s={tv:{library:r.tvLibrary,continue:r.tvContinueWatching,progress:r.tvProgress},manga:{library:r.mangaLibrary,continue:r.mangaContinueReading,progress:r.mangaProgress},asmr:{library:r.asmrLibrary,continue:r.asmrContinueListening,progress:r.asmrProgress}};function t(a,e,n=!1){const i=s[e];n&&a.invalidateQueries({queryKey:[i.progress]}),a.invalidateQueries({queryKey:[i.library]}),a.invalidateQueries({queryKey:[i.continue]})}export{t as i};
1
+ import{q as r}from"./index-BkgRRmBf.js";const s={tv:{library:r.tvLibrary,continue:r.tvContinueWatching,progress:r.tvProgress},manga:{library:r.mangaLibrary,continue:r.mangaContinueReading,progress:r.mangaProgress},asmr:{library:r.asmrLibrary,continue:r.asmrContinueListening,progress:r.asmrProgress}};function t(a,e,n=!1){const i=s[e];n&&a.invalidateQueries({queryKey:[i.progress]}),a.invalidateQueries({queryKey:[i.library]}),a.invalidateQueries({queryKey:[i.continue]})}export{t as i};
@@ -1 +1 @@
1
- import{p as s}from"./index-CkZCduQZ.js";const r=.8,o=5,a="autoplayEnabled",E="watchedOverlayEnabled",S=(t,e)=>e>0&&t>=e*r,c=new Set(["FINISHED","ENDED","COMPLETED","CANCELED","CANCELLED","RELEASED"]),d=t=>!!t&&c.has(t.trim().toUpperCase()),n=.25,h=(t,e)=>e>0&&Number.isFinite(e)&&t>=e-n,C=t=>t>o,D=()=>{try{return s.getItem(a)==="true"}catch{return!1}},O=t=>{try{s.setItem(a,String(t))}catch{}},i=()=>{try{return s.getItem(E)!=="false"}catch{return!0}},y=t=>{try{s.setItem(E,String(t))}catch{}};export{r as C,D as a,d as b,O as c,h as d,C as h,S as i,i as l,y as s};
1
+ import{p as s}from"./index-BkgRRmBf.js";const r=.8,o=5,a="autoplayEnabled",E="watchedOverlayEnabled",S=(t,e)=>e>0&&t>=e*r,c=new Set(["FINISHED","ENDED","COMPLETED","CANCELED","CANCELLED","RELEASED"]),d=t=>!!t&&c.has(t.trim().toUpperCase()),n=.25,h=(t,e)=>e>0&&Number.isFinite(e)&&t>=e-n,C=t=>t>o,D=()=>{try{return s.getItem(a)==="true"}catch{return!1}},O=t=>{try{s.setItem(a,String(t))}catch{}},i=()=>{try{return s.getItem(E)!=="false"}catch{return!0}},y=t=>{try{s.setItem(E,String(t))}catch{}};export{r as C,D as a,d as b,O as c,h as d,C as h,S as i,i as l,y as s};
@@ -1 +1 @@
1
- import{q as g}from"./vendor-core-DfaOB3Rn.js";import{u as p,b as q,a as M}from"./vendor-query-BBT5_sHx.js";import{o as v,K as h,q as K,t as y}from"./index-CkZCduQZ.js";import{u as Q}from"./QueueOptionsButton-Tsij7x21.js";function k(t){const s=p(),c=v(),{data:i,isLoading:w,error:u}=Q(t),n=c.watchlist.check.queryOptions({showId:t??""}).queryKey,{data:d}=q({...c.watchlist.check.queryOptions({showId:t??""}),enabled:!!t}),r=d?.inWatchlist??!1,{mutateAsync:l}=M({mutationFn:async({wasIn:e,meta:a})=>{if(!t)throw new Error("Missing showId");if(e)await y.watchlist.remove.mutate({id:t});else{const o=a?.names,m=a?.name||o?.romaji;if(!m)throw new Error("Missing show name");await y.watchlist.add.mutate({id:t,name:m,thumbnail:a?.thumbnail,nativeName:o?.native,englishName:o?.english,type:a?.type,isAdult:a?.isAdult})}return!e},onMutate:async({wasIn:e})=>{await s.cancelQueries({queryKey:n}),s.setQueryData(n,a=>({...a,inWatchlist:!e,status:a?.status??""}))},onError:e=>{s.invalidateQueries({queryKey:n}),h.error(e instanceof Error?e.message:"Failed to update watchlist")},onSuccess:e=>{h.success(e?"Added to watchlist":"Removed from watchlist"),s.invalidateQueries({queryKey:[K.watchlist]})}}),f=g(async()=>{!t||!i||await l({wasIn:r,meta:i})},[t,i,r,l]);return{showMeta:i,inWatchlist:r,loadingMeta:w,error:u?u.message:null,toggleWatchlist:f}}export{k as u};
1
+ import{q as g}from"./vendor-core-DfaOB3Rn.js";import{u as p,b as q,a as M}from"./vendor-query-BBT5_sHx.js";import{o as v,K as h,q as K,t as y}from"./index-BkgRRmBf.js";import{u as Q}from"./QueueOptionsButton-CRl4Dhom.js";function k(t){const s=p(),c=v(),{data:i,isLoading:w,error:u}=Q(t),n=c.watchlist.check.queryOptions({showId:t??""}).queryKey,{data:d}=q({...c.watchlist.check.queryOptions({showId:t??""}),enabled:!!t}),r=d?.inWatchlist??!1,{mutateAsync:l}=M({mutationFn:async({wasIn:e,meta:a})=>{if(!t)throw new Error("Missing showId");if(e)await y.watchlist.remove.mutate({id:t});else{const o=a?.names,m=a?.name||o?.romaji;if(!m)throw new Error("Missing show name");await y.watchlist.add.mutate({id:t,name:m,thumbnail:a?.thumbnail,nativeName:o?.native,englishName:o?.english,type:a?.type,isAdult:a?.isAdult})}return!e},onMutate:async({wasIn:e})=>{await s.cancelQueries({queryKey:n}),s.setQueryData(n,a=>({...a,inWatchlist:!e,status:a?.status??""}))},onError:e=>{s.invalidateQueries({queryKey:n}),h.error(e instanceof Error?e.message:"Failed to update watchlist")},onSuccess:e=>{h.success(e?"Added to watchlist":"Removed from watchlist"),s.invalidateQueries({queryKey:[K.watchlist]})}}),f=g(async()=>{!t||!i||await l({wasIn:r,meta:i})},[t,i,r,l]);return{showMeta:i,inWatchlist:r,loadingMeta:w,error:u?u.message:null,toggleWatchlist:f}}export{k as u};
@@ -1 +1 @@
1
- import{T as d}from"./vendor-core-DfaOB3Rn.js";import{b as g,u as i,a as u}from"./vendor-query-BBT5_sHx.js";import{o as s,K as r,q as p}from"./index-CkZCduQZ.js";import{i as c}from"./libraryInvalidation-Cv-7EfU1.js";const F=e=>e.contentRating==="erotica"||e.contentRating==="pornographic"||e.type==="doujinshi";function q(e,t){const a=e.titles??{};return t==="englishName"?a.en||e.title:t==="nativeName"&&(a.native||a.romaji||e.altTitle)||e.title}function C(e){return{englishName:e.titles?.en??e.title,nativeName:e.titles?.native??e.titles?.romaji??e.altTitle??void 0}}const y=/^anilist:ch:(\d+)$/;function P(e){if(!e)return null;const t=y.exec(e.trim());if(!t)return null;const a=Number.parseInt(t[1],10);return Number.isFinite(a)?a:null}function R(e,t){const a=String(t),n=e.find(m=>(m.number??"").trim()===a);return n||(e.find(m=>{const o=Number.parseFloat((m.number??"").trim());return Number.isFinite(o)&&o===t})??null)}const O=["Reading","Completed","On-Hold","Dropped","Planned"],v=(e,t)=>`${e.toLowerCase()}:${t}`,T=(e="All",t=1,a=24)=>{const n=s();return g(n.mangaLibrary.list.queryOptions({status:e,page:t,limit:a}))},b=()=>{const e=s();return g({...e.mangaLibrary.ids.queryOptions(),staleTime:1e3*60})},$=e=>{const t=s();return g({...t.mangaLibrary.check.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},E=e=>{const t=s();return g({...t.mangaLibrary.entry.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},Q=()=>{const e=s(),t=i();return u(e.mangaLibrary.link.mutationOptions({onSuccess:a=>{r.success(a?.progressMigrated?"Linked - chapter progress carried over":"Linked to AniList entry"),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to link: ${a.message}`)}}))},N=(e=24)=>{const t=s();return g(t.mangaProgress.continueReading.queryOptions({limit:e}))},A=e=>{const t=s();return g({...t.mangaProgress.byManga.queryOptions({mangaId:e??""}),enabled:!!e})},L=()=>{const e=s(),t=i();return u(e.mangaLibrary.add.mutationOptions({onSuccess:(a,n)=>{n.silent||r.success("Bookmarked"),t.invalidateQueries(e.mangaLibrary.pathFilter()),t.invalidateQueries({queryKey:[p.mangaLibrary]})},onError:a=>{r.error(`Failed to bookmark: ${a.message}`)}}))},M=()=>{const e=s(),t=i();return u(e.mangaLibrary.remove.mutationOptions({onSuccess:()=>{r.success("Bookmark removed"),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to remove: ${a.message}`)}}))},B=()=>{const e=s(),t=i();return u(e.mangaLibrary.setStatus.mutationOptions({onSuccess:()=>{r.success("Status updated"),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to update status: ${a.message}`)}}))},I=()=>{const e=s(),t=i();return u(e.mangaProgress.save.mutationOptions({onSuccess:()=>{c(t,"manga",!0),t.invalidateQueries(e.mangaProgress.pathFilter())}}))},_=()=>{const e=s(),t=i();return u(e.mangaProgress.remove.mutationOptions({onSuccess:()=>{r.success("Progress reset"),c(t,"manga",!0),t.invalidateQueries(e.mangaProgress.pathFilter())},onError:a=>{r.error(`Failed to reset progress: ${a.message}`)}}))},j=()=>{const e=s(),t=i();return u(e.mangaLibrary.batchStatus.mutationOptions({onSuccess:a=>{r.success(`Status updated for ${a.updated??0} items`),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to update statuses: ${a.message}`)}}))},w=()=>{const e=s(),t=i();return u(e.mangaLibrary.removeMany.mutationOptions({onSuccess:a=>{const n=a.removed??0;r.success(`Removed ${n} ${n===1?"item":"items"} from reading list`),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to remove: ${a.message}`)}}))},x=()=>{const e=s(),t=i();return u(e.mangaProgress.removeMany.mutationOptions({onSuccess:a=>{const n=a.removed??0;r.success(`Reset progress for ${n} ${n===1?"item":"items"}`),c(t,"manga",!0),t.invalidateQueries(e.mangaProgress.pathFilter())},onError:a=>{r.error(`Failed to reset progress: ${a.message}`)}}))},H=()=>{const e=L(),t=M(),{data:a}=b(),n=d(()=>new Set(a?.ids||[]),[a]);return{toggle:o=>{const l=v(o.provider,o.id);n.has(l)?t.mutate(l):e.mutate({provider:o.provider,mangaId:o.id,title:o.title,cover:o.cover,altTitle:o.altTitle,contentRating:o.contentRating})},bookmarkedIds:n,pending:e.isPending||t.isPending}};export{O as M,C as a,N as b,E as c,L as d,Q as e,$ as f,A as g,M as h,F as i,B as j,R as k,I as l,v as m,T as n,j as o,P as p,w as q,q as r,x as s,_ as t,H as u};
1
+ import{T as d}from"./vendor-core-DfaOB3Rn.js";import{b as g,u as i,a as u}from"./vendor-query-BBT5_sHx.js";import{o as s,K as r,q as p}from"./index-BkgRRmBf.js";import{i as c}from"./libraryInvalidation-Ch1g3QJS.js";const F=e=>e.contentRating==="erotica"||e.contentRating==="pornographic"||e.type==="doujinshi";function q(e,t){const a=e.titles??{};return t==="englishName"?a.en||e.title:t==="nativeName"&&(a.native||a.romaji||e.altTitle)||e.title}function C(e){return{englishName:e.titles?.en??e.title,nativeName:e.titles?.native??e.titles?.romaji??e.altTitle??void 0}}const y=/^anilist:ch:(\d+)$/;function P(e){if(!e)return null;const t=y.exec(e.trim());if(!t)return null;const a=Number.parseInt(t[1],10);return Number.isFinite(a)?a:null}function R(e,t){const a=String(t),n=e.find(m=>(m.number??"").trim()===a);return n||(e.find(m=>{const o=Number.parseFloat((m.number??"").trim());return Number.isFinite(o)&&o===t})??null)}const O=["Reading","Completed","On-Hold","Dropped","Planned"],v=(e,t)=>`${e.toLowerCase()}:${t}`,T=(e="All",t=1,a=24)=>{const n=s();return g(n.mangaLibrary.list.queryOptions({status:e,page:t,limit:a}))},b=()=>{const e=s();return g({...e.mangaLibrary.ids.queryOptions(),staleTime:1e3*60})},$=e=>{const t=s();return g({...t.mangaLibrary.check.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},E=e=>{const t=s();return g({...t.mangaLibrary.entry.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},Q=()=>{const e=s(),t=i();return u(e.mangaLibrary.link.mutationOptions({onSuccess:a=>{r.success(a?.progressMigrated?"Linked - chapter progress carried over":"Linked to AniList entry"),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to link: ${a.message}`)}}))},N=(e=24)=>{const t=s();return g(t.mangaProgress.continueReading.queryOptions({limit:e}))},A=e=>{const t=s();return g({...t.mangaProgress.byManga.queryOptions({mangaId:e??""}),enabled:!!e})},L=()=>{const e=s(),t=i();return u(e.mangaLibrary.add.mutationOptions({onSuccess:(a,n)=>{n.silent||r.success("Bookmarked"),t.invalidateQueries(e.mangaLibrary.pathFilter()),t.invalidateQueries({queryKey:[p.mangaLibrary]})},onError:a=>{r.error(`Failed to bookmark: ${a.message}`)}}))},M=()=>{const e=s(),t=i();return u(e.mangaLibrary.remove.mutationOptions({onSuccess:()=>{r.success("Bookmark removed"),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to remove: ${a.message}`)}}))},B=()=>{const e=s(),t=i();return u(e.mangaLibrary.setStatus.mutationOptions({onSuccess:()=>{r.success("Status updated"),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to update status: ${a.message}`)}}))},I=()=>{const e=s(),t=i();return u(e.mangaProgress.save.mutationOptions({onSuccess:()=>{c(t,"manga",!0),t.invalidateQueries(e.mangaProgress.pathFilter())}}))},_=()=>{const e=s(),t=i();return u(e.mangaProgress.remove.mutationOptions({onSuccess:()=>{r.success("Progress reset"),c(t,"manga",!0),t.invalidateQueries(e.mangaProgress.pathFilter())},onError:a=>{r.error(`Failed to reset progress: ${a.message}`)}}))},j=()=>{const e=s(),t=i();return u(e.mangaLibrary.batchStatus.mutationOptions({onSuccess:a=>{r.success(`Status updated for ${a.updated??0} items`),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to update statuses: ${a.message}`)}}))},w=()=>{const e=s(),t=i();return u(e.mangaLibrary.removeMany.mutationOptions({onSuccess:a=>{const n=a.removed??0;r.success(`Removed ${n} ${n===1?"item":"items"} from reading list`),t.invalidateQueries(e.mangaLibrary.pathFilter()),c(t,"manga")},onError:a=>{r.error(`Failed to remove: ${a.message}`)}}))},x=()=>{const e=s(),t=i();return u(e.mangaProgress.removeMany.mutationOptions({onSuccess:a=>{const n=a.removed??0;r.success(`Reset progress for ${n} ${n===1?"item":"items"}`),c(t,"manga",!0),t.invalidateQueries(e.mangaProgress.pathFilter())},onError:a=>{r.error(`Failed to reset progress: ${a.message}`)}}))},H=()=>{const e=L(),t=M(),{data:a}=b(),n=d(()=>new Set(a?.ids||[]),[a]);return{toggle:o=>{const l=v(o.provider,o.id);n.has(l)?t.mutate(l):e.mutate({provider:o.provider,mangaId:o.id,title:o.title,cover:o.cover,altTitle:o.altTitle,contentRating:o.contentRating})},bookmarkedIds:n,pending:e.isPending||t.isPending}};export{O as M,C as a,N as b,E as c,L as d,Q as e,$ as f,A as g,M as h,F as i,B as j,R as k,I as l,v as m,T as n,j as o,P as p,w as q,q as r,x as s,_ as t,H as u};
@@ -1 +1 @@
1
- import{u as T}from"./vendor-core-DfaOB3Rn.js";import{ag as d,d as k}from"./index-CkZCduQZ.js";import{r as y}from"./useMangaLibrary-CPluPl_T.js";import{a as h}from"./MediaCard-FQr72c16.js";import{u as M}from"./usePopup-DS9jMzp6.js";const B=({data:e,anchorRect:i,bookmarked:l,onToggleBookmark:n,onMouseEnter:p,onMouseLeave:c,onRequestClose:m})=>{const{data:o,isLoading:u}=d(e.provider,e.mangaId,e.rating||"safe",e.mature||!1),{titlePreference:g}=k(),s=o?.chapters.length??0,a=y({title:e.title,altTitle:o?.altTitle??e.altTitle},g),t=[],r=[o?.status,o?.type].filter(Boolean).join(" · ");r&&t.push({icon:"book",label:r}),s>0&&t.push({label:`${s} chapter${s===1?"":"s"}`}),e.progressLabel&&t.push({icon:"bookmark",label:e.progressLabel});const b=Array.isArray(o?.genres)?o.genres.filter(Boolean).slice(0,4).map(f=>f):[];return T(h,{anchorRect:i,title:a,subtitle:o?.altTitle&&o.altTitle!==a?`Also known as: ${o.altTitle}`:void 0,loading:u,meta:t,genres:b,synopsis:o?.description?o.description:"No synopsis available.",primaryAction:{to:e.readTarget,label:"Read now",icon:"book"},secondaryAction:{to:`/manga/${e.provider}/${encodeURIComponent(e.mangaId)}`,label:"Read more"},bookmarked:l,bookmarkLabel:"Bookmark",onToggleBookmark:n,onMouseEnter:p,onMouseLeave:c,onRequestClose:m})},I=()=>M();export{B as M,I as u};
1
+ import{u as T}from"./vendor-core-DfaOB3Rn.js";import{ag as d,d as k}from"./index-BkgRRmBf.js";import{r as y}from"./useMangaLibrary-BMPk0isK.js";import{a as h}from"./MediaCard-Bffh2g9C.js";import{u as M}from"./usePopup-DS9jMzp6.js";const B=({data:e,anchorRect:i,bookmarked:l,onToggleBookmark:n,onMouseEnter:p,onMouseLeave:c,onRequestClose:m})=>{const{data:o,isLoading:u}=d(e.provider,e.mangaId,e.rating||"safe",e.mature||!1),{titlePreference:g}=k(),s=o?.chapters.length??0,a=y({title:e.title,altTitle:o?.altTitle??e.altTitle},g),t=[],r=[o?.status,o?.type].filter(Boolean).join(" · ");r&&t.push({icon:"book",label:r}),s>0&&t.push({label:`${s} chapter${s===1?"":"s"}`}),e.progressLabel&&t.push({icon:"bookmark",label:e.progressLabel});const b=Array.isArray(o?.genres)?o.genres.filter(Boolean).slice(0,4).map(f=>f):[];return T(h,{anchorRect:i,title:a,subtitle:o?.altTitle&&o.altTitle!==a?`Also known as: ${o.altTitle}`:void 0,loading:u,meta:t,genres:b,synopsis:o?.description?o.description:"No synopsis available.",primaryAction:{to:e.readTarget,label:"Read now",icon:"book"},secondaryAction:{to:`/manga/${e.provider}/${encodeURIComponent(e.mangaId)}`,label:"Read more"},bookmarked:l,bookmarkLabel:"Bookmark",onToggleBookmark:n,onMouseEnter:p,onMouseLeave:c,onRequestClose:m})},I=()=>M();export{B as M,I as u};
@@ -1 +1 @@
1
- import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{q as i,U as n}from"./index-CkZCduQZ.js";const l=300*1e3,c=()=>{const e=a({queryKey:[i.providers],queryFn:()=>n("/api/providers"),staleTime:l,retry:1}),r=Array.isArray(e.data)?e.data:null,s=o(()=>r&&r.length>0?r.filter(t=>t.loaded):[],[r]);return{...e,options:s,isFallback:!r||r.length===0}};export{c as u};
1
+ import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{q as i,U as n}from"./index-BkgRRmBf.js";const l=300*1e3,c=()=>{const e=a({queryKey:[i.providers],queryFn:()=>n("/api/providers"),staleTime:l,retry:1}),r=Array.isArray(e.data)?e.data:null,s=o(()=>r&&r.length>0?r.filter(t=>t.loaded):[],[r]);return{...e,options:s,isFallback:!r||r.length===0}};export{c as u};
@@ -1 +1 @@
1
- import{N as c,u as o,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-C1Pj_eSX.js";import{M as T}from"./MediaCard-FQr72c16.js";import{T as g}from"./TvPopup-CaXs4L6B.js";import{k as m,j as f,o as i}from"./index-CkZCduQZ.js";import{b as u}from"./vendor-query-BBT5_sHx.js";const P=c(({item:e})=>{const a=e.type==="tv"||e.type==="tvSeries"||e.type==="tvMiniSeries",s=m(e.type,e.id);return o(T,{item:{id:String(e.id),title:e.title,thumbnail:e.image,typeBadge:a?"TV":"Movie",isAdult:f(e)},linkTo:s,hoverIcon:"info",showInfoButton:!0,metaRow:o(d,{children:[e.year&&o("span",{style:{opacity:.75},children:e.year}),e.vote_average!=null&&o("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[o(v,{name:"star",size:10}),Number(e.vote_average).toFixed(1)]})]}),renderPopup:(n,t)=>o(g,{item:e,anchorRect:n,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onRequestClose:t.close})})}),p=1e3*60*5,_=e=>{const a=i(),{query:s,type:n,genre:t,year:r,sort_by:y,page:l}=e;return u({...a.tv.search.queryOptions({q:s?.trim()||"",type:n||"multi",genre:t||"",year:r&&r!=="ALL"?r:"",sortBy:y||"popularity.desc",page:l||1}),staleTime:p,retry:1})},b=(e="all",a="week",s=1,n=!0)=>{const t=i(),r=u({...t.tv.trending.queryOptions({mediaType:e,timeWindow:a,page:s}),enabled:n,staleTime:p,retry:1});return{...r,data:r.data}};export{P as T,_ as a,b as u};
1
+ import{N as c,u as o,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-C1Pj_eSX.js";import{M as T}from"./MediaCard-Bffh2g9C.js";import{T as g}from"./TvPopup-BQPSFeCs.js";import{k as m,j as f,o as i}from"./index-BkgRRmBf.js";import{b as u}from"./vendor-query-BBT5_sHx.js";const P=c(({item:e})=>{const a=e.type==="tv"||e.type==="tvSeries"||e.type==="tvMiniSeries",s=m(e.type,e.id);return o(T,{item:{id:String(e.id),title:e.title,thumbnail:e.image,typeBadge:a?"TV":"Movie",isAdult:f(e)},linkTo:s,hoverIcon:"info",showInfoButton:!0,metaRow:o(d,{children:[e.year&&o("span",{style:{opacity:.75},children:e.year}),e.vote_average!=null&&o("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[o(v,{name:"star",size:10}),Number(e.vote_average).toFixed(1)]})]}),renderPopup:(n,t)=>o(g,{item:e,anchorRect:n,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onRequestClose:t.close})})}),p=1e3*60*5,_=e=>{const a=i(),{query:s,type:n,genre:t,year:r,sort_by:y,page:l}=e;return u({...a.tv.search.queryOptions({q:s?.trim()||"",type:n||"multi",genre:t||"",year:r&&r!=="ALL"?r:"",sortBy:y||"popularity.desc",page:l||1}),staleTime:p,retry:1})},b=(e="all",a="week",s=1,n=!0)=>{const t=i(),r=u({...t.tv.trending.queryOptions({mediaType:e,timeWindow:a,page:s}),enabled:n,staleTime:p,retry:1});return{...r,data:r.data}};export{P as T,_ as a,b as u};
@@ -1 +1 @@
1
- import{T as p}from"./vendor-core-DfaOB3Rn.js";import{b as c,u as i,a as n}from"./vendor-query-BBT5_sHx.js";import{o as a,K as o,q as m,t as y,ak as g}from"./index-CkZCduQZ.js";import{i as u}from"./libraryInvalidation-Cv-7EfU1.js";const q=["Watching","Completed","On-Hold","Dropped","Planned"],b=(t,e)=>g(t,e),C=(t="All",e=1,r=24)=>{const s=a();return c(s.tvLibrary.list.queryOptions({status:t,page:e,limit:r}))},T=()=>{const t=a();return c({...t.tvLibrary.ids.queryOptions(),staleTime:1e3*60})},O=t=>{const e=a();return c({...e.tvLibrary.check.queryOptions({id:t||""}),enabled:!!t,staleTime:1e3*60})},k=(t=24)=>{const e=a();return c(e.tvProgress.continueWatching.queryOptions({limit:t}))},$=t=>{const e=a();return c({...e.tvProgress.getByMedia.queryOptions({mediaId:t||""}),enabled:!!t})},f=(t,e,r)=>{const s=a();return c({...s.tvProgress.latest.queryOptions({mediaId:t||"",season:e,episode:r}),enabled:!!t,staleTime:0})},h=()=>{const t=a(),e=i();return n({mutationFn:async r=>{const{silent:s,...d}=r;return y.tvLibrary.add.mutate(d)},onSuccess:(r,s)=>{s.silent||o.success("Added to TV watchlist"),e.invalidateQueries({queryKey:[m.tvLibrary]}),e.invalidateQueries(t.tvLibrary.pathFilter())},onError:r=>{o.error(`Failed to add: ${r.message}`)}})},L=()=>{const t=a(),e=i();return n(t.tvLibrary.remove.mutationOptions({onSuccess:()=>{o.success("Removed from TV watchlist"),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to remove: ${r.message}`)}}))},R=()=>{const t=a(),e=i();return n(t.tvLibrary.setStatus.mutationOptions({onSuccess:()=>{o.success("Status updated"),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to update status: ${r.message}`)}}))},B=()=>{const t=a(),e=i();return n(t.tvProgress.save.mutationOptions({onSuccess:()=>{u(e,"tv",!0),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())}}))},E=()=>{const t=a(),e=i();return n(t.tvProgress.remove.mutationOptions({onSuccess:()=>{o.success("Progress reset"),u(e,"tv",!0),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to reset progress: ${r.message}`)}}))},I=()=>{const t=a(),e=i();return n(t.tvLibrary.batchStatus.mutationOptions({onSuccess:r=>{o.success(`Status updated for ${r.updated??0} items`),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to update statuses: ${r.message}`)}}))},A=()=>{const t=a(),e=i();return n(t.tvLibrary.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;o.success(`Removed ${s} ${s===1?"item":"items"} from TV watchlist`),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to remove: ${r.message}`)}}))},w=()=>{const t=a(),e=i();return n(t.tvProgress.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;o.success(`Reset progress for ${s} ${s===1?"item":"items"}`),u(e,"tv",!0),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to reset progress: ${r.message}`)}}))},M=()=>{const t=h(),e=L(),{data:r}=T(),s=p(()=>new Set(r?.ids||[]),[r]);return{toggle:v=>{const l=b(v.mediaType,v.tmdbId);s.has(l)?e.mutate(l):t.mutate({...v,poster:v.poster||""})},bookmarkedIds:s,pending:t.isPending||e.isPending}};export{q as T,L as a,E as b,O as c,M as d,B as e,R as f,h as g,f as h,$ as i,C as j,I as k,A as l,w as m,k as u};
1
+ import{T as p}from"./vendor-core-DfaOB3Rn.js";import{b as c,u as i,a as n}from"./vendor-query-BBT5_sHx.js";import{o as a,K as o,q as m,t as y,ak as g}from"./index-BkgRRmBf.js";import{i as u}from"./libraryInvalidation-Ch1g3QJS.js";const q=["Watching","Completed","On-Hold","Dropped","Planned"],b=(t,e)=>g(t,e),C=(t="All",e=1,r=24)=>{const s=a();return c(s.tvLibrary.list.queryOptions({status:t,page:e,limit:r}))},T=()=>{const t=a();return c({...t.tvLibrary.ids.queryOptions(),staleTime:1e3*60})},O=t=>{const e=a();return c({...e.tvLibrary.check.queryOptions({id:t||""}),enabled:!!t,staleTime:1e3*60})},k=(t=24)=>{const e=a();return c(e.tvProgress.continueWatching.queryOptions({limit:t}))},$=t=>{const e=a();return c({...e.tvProgress.getByMedia.queryOptions({mediaId:t||""}),enabled:!!t})},f=(t,e,r)=>{const s=a();return c({...s.tvProgress.latest.queryOptions({mediaId:t||"",season:e,episode:r}),enabled:!!t,staleTime:0})},h=()=>{const t=a(),e=i();return n({mutationFn:async r=>{const{silent:s,...d}=r;return y.tvLibrary.add.mutate(d)},onSuccess:(r,s)=>{s.silent||o.success("Added to TV watchlist"),e.invalidateQueries({queryKey:[m.tvLibrary]}),e.invalidateQueries(t.tvLibrary.pathFilter())},onError:r=>{o.error(`Failed to add: ${r.message}`)}})},L=()=>{const t=a(),e=i();return n(t.tvLibrary.remove.mutationOptions({onSuccess:()=>{o.success("Removed from TV watchlist"),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to remove: ${r.message}`)}}))},R=()=>{const t=a(),e=i();return n(t.tvLibrary.setStatus.mutationOptions({onSuccess:()=>{o.success("Status updated"),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to update status: ${r.message}`)}}))},B=()=>{const t=a(),e=i();return n(t.tvProgress.save.mutationOptions({onSuccess:()=>{u(e,"tv",!0),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())}}))},E=()=>{const t=a(),e=i();return n(t.tvProgress.remove.mutationOptions({onSuccess:()=>{o.success("Progress reset"),u(e,"tv",!0),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to reset progress: ${r.message}`)}}))},I=()=>{const t=a(),e=i();return n(t.tvLibrary.batchStatus.mutationOptions({onSuccess:r=>{o.success(`Status updated for ${r.updated??0} items`),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to update statuses: ${r.message}`)}}))},A=()=>{const t=a(),e=i();return n(t.tvLibrary.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;o.success(`Removed ${s} ${s===1?"item":"items"} from TV watchlist`),u(e,"tv"),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to remove: ${r.message}`)}}))},w=()=>{const t=a(),e=i();return n(t.tvProgress.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;o.success(`Reset progress for ${s} ${s===1?"item":"items"}`),u(e,"tv",!0),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{o.error(`Failed to reset progress: ${r.message}`)}}))},M=()=>{const t=h(),e=L(),{data:r}=T(),s=p(()=>new Set(r?.ids||[]),[r]);return{toggle:v=>{const l=b(v.mediaType,v.tmdbId);s.has(l)?e.mutate(l):t.mutate({...v,poster:v.poster||""})},bookmarkedIds:s,pending:t.isPending||e.isPending}};export{q as T,L as a,E as b,O as c,M as d,B as e,R as f,h as g,f as h,$ as i,C as j,I as k,A as l,w as m,k as u};