@serifpersia/dango 4.0.2 → 4.0.3

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 (72) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/AnimeCard-2k8ssFQg.js +1 -0
  3. package/client/dist/assets/{AnimeInfo-DXoNbSao.js → AnimeInfo-DYIMQZ_G.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-CRWoCwXo.js → AnimeInfoPage-BK1gsbaN.js} +2 -2
  5. package/client/dist/assets/{Asmr-z6PNn8Ld.js → Asmr-D562WT1y.js} +2 -2
  6. package/client/dist/assets/{AsmrPopup-Cc-aIYXd.js → AsmrPopup-DSb1jdb1.js} +1 -1
  7. package/client/dist/assets/{AsmrResetProgressModal-D4Mp_-lx.js → AsmrResetProgressModal-Cb30-ErW.js} +1 -1
  8. package/client/dist/assets/Home-DBefqglV.js +1 -0
  9. package/client/dist/assets/Insights-C57WhdmV.js +1 -0
  10. package/client/dist/assets/Insights-Cn3L3buF.css +1 -0
  11. package/client/dist/assets/{LibraryListPage-CNjzasIi.js → LibraryListPage-ByCxrf4V.js} +1 -1
  12. package/client/dist/assets/ListeningList-BJJzg0gb.js +1 -0
  13. package/client/dist/assets/Manga-CW-xSa6W.js +1 -0
  14. package/client/dist/assets/{MangaInfoPage-DnDwJDWC.js → MangaInfoPage-B2eqiI6S.js} +1 -1
  15. package/client/dist/assets/{MangaReadPage-Cq4NYq31.js → MangaReadPage-DU_pWeC4.js} +1 -1
  16. package/client/dist/assets/{MangaResetProgressModal-DaZmK9CX.js → MangaResetProgressModal-BoaCnx2i.js} +1 -1
  17. package/client/dist/assets/Mature-I-5BXxqP.js +1 -0
  18. package/client/dist/assets/{MatureConsentModal-CEoZ_OA0.js → MatureConsentModal-B8mTktfi.js} +1 -1
  19. package/client/dist/assets/MediaCard-Co-j57uA.css +1 -0
  20. package/client/dist/assets/MediaCard-yDEaWmRR.js +1 -0
  21. package/client/dist/assets/MediaPopupShell-BewMMT93.js +1 -0
  22. package/client/dist/assets/MediaPopupShell-D6Emr-co.css +1 -0
  23. package/client/dist/assets/{OptionListMenu-ArbsAjlv.js → OptionListMenu-XTkQ_xrQ.js} +1 -1
  24. package/client/dist/assets/{Player-4wh-a_ee.js → Player-DnWze_gB.js} +2 -2
  25. package/client/dist/assets/{PlayerProvider-CbamWD19.js → PlayerProvider-hfX3WV6K.js} +1 -1
  26. package/client/dist/assets/{PlayerSettings-DehU56D4.js → PlayerSettings-C5n3kYuV.js} +1 -1
  27. package/client/dist/assets/{QueueOptionsButton-DqoDQST5.js → QueueOptionsButton-BMlChzgW.js} +1 -1
  28. package/client/dist/assets/{QueueRail-ClrcV9LL.js → QueueRail-CV0rsdWL.js} +1 -1
  29. package/client/dist/assets/ReadingList-Dadozt41.js +1 -0
  30. package/client/dist/assets/{ResetProgressModal-BdcBPlC1.js → ResetProgressModal-BXkiBRZv.js} +1 -1
  31. package/client/dist/assets/Search-DiUbhvfg.js +1 -0
  32. package/client/dist/assets/{Settings-O0oOrEUd.js → Settings-fCV1C7Pa.js} +1 -1
  33. package/client/dist/assets/{SkeletonGrid-DqN0laN_.js → SkeletonGrid-DHbe7WWt.js} +1 -1
  34. package/client/dist/assets/{Trackers-DxBWYwss.js → Trackers-DvRqGHrx.js} +1 -1
  35. package/client/dist/assets/{Tv-Ox6p6iEx.js → Tv-Dbih_6wX.js} +1 -1
  36. package/client/dist/assets/{TvInfo-DjPQ7BZn.js → TvInfo-BEaENXW9.js} +1 -1
  37. package/client/dist/assets/{TvPopup-CCTQiS84.js → TvPopup-BWvnz3aD.js} +1 -1
  38. package/client/dist/assets/TvSearch-Bu1r0z8j.js +1 -0
  39. package/client/dist/assets/TvWatchlist-DjZxyCqC.js +1 -0
  40. package/client/dist/assets/{VirtualKeyboard-Bf7wvuX3.js → VirtualKeyboard-otEdnEQ2.js} +1 -1
  41. package/client/dist/assets/{WatchAlong-D9NsqbWz.js → WatchAlong-BfHji5Zr.js} +1 -1
  42. package/client/dist/assets/{WatchAlongPanel-DRsYyjM7.js → WatchAlongPanel-Df8EFgd_.js} +1 -1
  43. package/client/dist/assets/Watchlist-D4HJr6pg.js +1 -0
  44. package/client/dist/assets/index-jbfR1Gmm.js +178 -0
  45. package/client/dist/assets/{libraryInvalidation-hcASRQHn.js → libraryInvalidation-Il_DYhmy.js} +1 -1
  46. package/client/dist/assets/{playbackCompletion-D1Gm0GbH.js → playbackCompletion-Diib3fZu.js} +1 -1
  47. package/client/dist/assets/{useAnimeInfoData-BsFz9uiF.js → useAnimeInfoData-DdGnfUWc.js} +1 -1
  48. package/client/dist/assets/{useMangaLibrary-DbvnlYV9.js → useMangaLibrary-DZ-ZzUfI.js} +1 -1
  49. package/client/dist/assets/{useMangaPopup-2lqmdmS5.js → useMangaPopup-QdPYB8yz.js} +1 -1
  50. package/client/dist/assets/{useProviders-BgAgACS8.js → useProviders-7Im8EwZk.js} +1 -1
  51. package/client/dist/assets/{useTv-OX_q_uaI.js → useTv-B6wLwlA4.js} +1 -1
  52. package/client/dist/assets/{useTvLibrary-DaLHYFID.js → useTvLibrary-DUFwbdjO.js} +1 -1
  53. package/client/dist/assets/{useWatchAlongPlayer-B7Yj2s3s.js → useWatchAlongPlayer-C1T1IqCH.js} +1 -1
  54. package/client/dist/index.html +1 -1
  55. package/package.json +2 -2
  56. package/server/dist/server.js +127 -119
  57. package/server/package.json +1 -1
  58. package/client/dist/assets/AnimeCard-B-3qrNhu.js +0 -1
  59. package/client/dist/assets/Home-9ZTaG1WX.js +0 -1
  60. package/client/dist/assets/Insights-Bf92STPA.js +0 -1
  61. package/client/dist/assets/Insights-DEicrokg.css +0 -1
  62. package/client/dist/assets/ListeningList-1mBIfxxH.js +0 -1
  63. package/client/dist/assets/Manga-B3_TdzgY.js +0 -1
  64. package/client/dist/assets/Mature-CbQWqjUS.js +0 -1
  65. package/client/dist/assets/MediaCard-B-TmXdgl.js +0 -1
  66. package/client/dist/assets/MediaCard-BfQaS9n5.css +0 -1
  67. package/client/dist/assets/ReadingList-Cy1BKzJs.js +0 -1
  68. package/client/dist/assets/Search-5PvZ8pAC.js +0 -1
  69. package/client/dist/assets/TvSearch-Baig87wj.js +0 -1
  70. package/client/dist/assets/TvWatchlist-D-yxvaKC.js +0 -1
  71. package/client/dist/assets/Watchlist-oYAx_dFL.js +0 -1
  72. package/client/dist/assets/index-CPhXtUuw.js +0 -178
@@ -0,0 +1,178 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-DBefqglV.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-yDEaWmRR.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-B8mTktfi.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-Co-j57uA.css","assets/AnimeCard-2k8ssFQg.js","assets/useAnimeInfoData-DdGnfUWc.js","assets/QueueOptionsButton-BMlChzgW.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-Diib3fZu.js","assets/SkeletonGrid-DHbe7WWt.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-hMt90aG4.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-BXkiBRZv.js","assets/QueueRail-CV0rsdWL.js","assets/QueueRail-CcHdXRmS.css","assets/useMangaPopup-QdPYB8yz.js","assets/useMangaLibrary-DZ-ZzUfI.js","assets/libraryInvalidation-Il_DYhmy.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-BoaCnx2i.js","assets/useProviders-7Im8EwZk.js","assets/useTv-B6wLwlA4.js","assets/TvPopup-BWvnz3aD.js","assets/useTvLibrary-DUFwbdjO.js","assets/AsmrResetProgressModal-Cb30-ErW.js","assets/AsmrPopup-DSb1jdb1.js","assets/Home-Bmc4hGfd.css","assets/Watchlist-D4HJr6pg.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-fCV1C7Pa.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-B57LhIVH.css","assets/Player-DnWze_gB.js","assets/PlayerProvider-hfX3WV6K.js","assets/PlayerProvider-ZeplRma-.css","assets/useWatchAlongPlayer-C1T1IqCH.js","assets/useWatchAlongPlayer-Dk7zB7P4.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/WatchAlongPanel-Df8EFgd_.js","assets/WatchAlongPanel-DWb8lSzW.css","assets/Player-1LfYnRyR.css","assets/WatchAlong-BfHji5Zr.js","assets/Search-DiUbhvfg.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature-I-5BXxqP.js","assets/Mature-DJmUUtlF.css","assets/Asmr-D562WT1y.js","assets/useAsmrPopup-BBmHrx9v.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Do89pEHG.css","assets/Manga-CW-xSa6W.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-B2eqiI6S.js","assets/MangaReadPage-DU_pWeC4.js","assets/ReadingList-Dadozt41.js","assets/LibraryListPage-ByCxrf4V.js","assets/TvSearch-Bu1r0z8j.js","assets/TvInfo-BEaENXW9.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-Dbih_6wX.js","assets/OptionListMenu-XTkQ_xrQ.js","assets/Tv-C-bNPNTQ.css","assets/TvWatchlist-DjZxyCqC.js","assets/ListeningList-BJJzg0gb.js","assets/Trackers-DvRqGHrx.js","assets/Trackers-BC636V59.css","assets/Insights-C57WhdmV.js","assets/Insights-Cn3L3buF.css","assets/AnimeInfoPage-BK1gsbaN.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-otEdnEQ2.js","assets/VirtualKeyboard-CejCi3pJ.css"])))=>i.map(i=>d[i]);
2
+ import{N as yr,k as oe,A as q,q as V,h as w,S as ye,d as y,u as o,X as be,x as we,T as je,$ as Tn,g as Lt,L as me,a as Pn,c as Je,e as vr,f as br,D as wr,i as _r,P as Jt,j as kr,l as R,m as Yt,z as K,n as Er,B as Sr}from"./vendor-core-DfaOB3Rn.js";import{s as Ae,i as Tr,q as Pr,u as ae,a as pe,b as j,c as ht,Q as Ir,d as Nr}from"./vendor-query-BBT5_sHx.js";import{I as P}from"./vendor-icons-C1Pj_eSX.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();const Cr="modulepreload",xr=function(e){return"/"+e},Zt={},U=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.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");a=l(n.map(u=>{if(u=xr(u),u in Zt)return;Zt[u]=!0;const d=u.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":Cr,d||(h.as="script"),h.crossOrigin="",h.href=u,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};let Or={data:""},Ar=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||Or},Lr=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Rr=/\/\*[^]*?\*\/| +/g,Xt=/\n+/g,Te=(e,t)=>{let n="",r="",a="";for(let s in e){let i=e[s];s[0]=="@"?s[1]=="i"?n=s+" "+i+";":r+=s[1]=="f"?Te(i,s):s+"{"+Te(i,s[1]=="k"?"":t)+"}":typeof i=="object"?r+=Te(i,t?t.replace(/([^,])+/g,c=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):s):i!=null&&(s=s[1]=="-"?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=Te.p?Te.p(s,i):s+":"+i+";")}return n+(t&&a?t+"{"+a+"}":a)+r},Se={},In=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+In(e[n]);return t}return e},qr=(e,t,n,r,a)=>{let s=In(e),i=Se[s]||(Se[s]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(s));if(!Se[i]){let l=s!==e?e:(u=>{let d,m,h=[{}];for(;d=Lr.exec(u.replace(Rr,""));)d[4]?h.shift():d[3]?(m=d[3].replace(Xt," ").trim(),h.unshift(h[0][m]=h[0][m]||{})):h[0][d[1]]=d[2].replace(Xt," ").trim();return h[0]})(e);Se[i]=Te(a?{["@keyframes "+i]:l}:l,n?"":"."+i)}let c=n&&Se.g;return n&&(Se.g=Se[i]),((l,u,d,m)=>{m?u.data=u.data.replace(m,l):u.data.indexOf(l)===-1&&(u.data=d?l+u.data:u.data+l)})(Se[i],t,r,c),i},Dr=(e,t,n)=>e.reduce((r,a,s)=>{let i=t[s];if(i&&i.call){let c=i(n),l=c&&c.props&&c.props.className||/^go/.test(c)&&c;i=l?"."+l:c&&typeof c=="object"?c.props?"":Te(c,""):c===!1?"":c}return r+a+(i??"")},"");function ft(e){let t=this||{},n=e.call?e(t.p):e;return qr(n.unshift?n.raw?Dr(n,[].slice.call(arguments,1),t.p):n.reduce((r,a)=>Object.assign(r,a&&a.call?a(t.p):a),{}):n,Ar(t.target),t.g,t.o,t.k)}let Nn,kt,Et;ft.bind({g:1});let ke=ft.bind({k:1});function $r(e,t,n,r){Te.p=t,Nn=e,kt=n,Et=r}function Ie(e,t){let n=this||{};return function(){let r=arguments;function a(s,i){let c=Object.assign({},s),l=c.className||a.className;n.p=Object.assign({theme:kt&&kt()},c),n.o=/go\d/.test(l),c.className=ft.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),Et&&u[0]&&Et(c),Nn(u,c)}return a}}var jr=e=>typeof e=="function",ut=(e,t)=>jr(e)?e(t):e,Mr=(()=>{let e=0;return()=>(++e).toString()})(),Cn=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Br=20,Rt="default",xn=(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 xn(e,{type:e.toasts.find(i=>i.id===r.id)?1:0,toast:r});case 3:let{toastId:a}=t;return{...e,toasts:e.toasts.map(i=>i.id===a||a===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 s=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+s}))}}},it=[],On={toasts:[],pausedAt:void 0,settings:{toastLimit:Br}},ve={},An=(e,t=Rt)=>{ve[t]=xn(ve[t]||On,e),it.forEach(([n,r])=>{n===t&&r(ve[t])})},Ln=e=>Object.keys(ve).forEach(t=>An(e,t)),Fr=e=>Object.keys(ve).find(t=>ve[t].toasts.some(n=>n.id===e)),gt=(e=Rt)=>t=>{An(t,e)},Wr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Kr=(e={},t=Rt)=>{let[n,r]=y(ve[t]||On),a=q(ve[t]);w(()=>(a.current!==ve[t]&&r(ve[t]),it.push([t,r]),()=>{let i=it.findIndex(([c])=>c===t);i>-1&&it.splice(i,1)}),[t]);let s=n.toasts.map(i=>{var c,l,u;return{...e,...e[i.type],...i,removeDelay:i.removeDelay||((c=e[i.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:i.duration||((l=e[i.type])==null?void 0:l.duration)||e?.duration||Wr[i.type],style:{...e.style,...(u=e[i.type])==null?void 0:u.style,...i.style}}});return{...n,toasts:s}},Ur=(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||Mr()}),Ye=e=>(t,n)=>{let r=Ur(t,e,n);return gt(r.toasterId||Fr(r.id))({type:2,toast:r}),r.id},Y=(e,t)=>Ye("blank")(e,t);Y.error=Ye("error");Y.success=Ye("success");Y.loading=Ye("loading");Y.custom=Ye("custom");Y.dismiss=(e,t)=>{let n={type:3,toastId:e};t?gt(t)(n):Ln(n)};Y.dismissAll=e=>Y.dismiss(void 0,e);Y.remove=(e,t)=>{let n={type:4,toastId:e};t?gt(t)(n):Ln(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(a=>{let s=t.success?ut(t.success,a):void 0;return s?Y.success(s,{id:r,...n,...n?.success}):Y.dismiss(r),a}).catch(a=>{let s=t.error?ut(t.error,a):void 0;s?Y.error(s,{id:r,...n,...n?.error}):Y.dismiss(r)}),e};var Hr=1e3,Qr=(e,t="default")=>{let{toasts:n,pausedAt:r}=Kr(e,t),a=q(new Map).current,s=V((m,h=Hr)=>{if(a.has(m))return;let p=setTimeout(()=>{a.delete(m),i({type:4,toastId:m})},h);a.set(m,p)},[]);w(()=>{if(r)return;let m=Date.now(),h=n.map(p=>{if(p.duration===1/0)return;let g=(p.duration||0)+p.pauseDuration-(m-p.createdAt);if(g<0){p.visible&&Y.dismiss(p.id);return}return setTimeout(()=>Y.dismiss(p.id,t),g)});return()=>{h.forEach(p=>p&&clearTimeout(p))}},[n,r,t]);let i=V(gt(t),[t]),c=V(()=>{i({type:5,time:Date.now()})},[i]),l=V((m,h)=>{i({type:1,toast:{id:m,height:h}})},[i]),u=V(()=>{r&&i({type:6,time:Date.now()})},[r,i]),d=V((m,h)=>{let{reverseOrder:p=!1,gutter:g=8,defaultPosition:k}=h||{},M=n.filter(S=>(S.position||k)===(m.position||k)&&S.height),C=M.findIndex(S=>S.id===m.id),H=M.filter((S,x)=>x<C&&S.visible).length;return M.filter(S=>S.visible).slice(...p?[H+1]:[0,H]).reduce((S,x)=>S+(x.height||0)+g,0)},[n]);return w(()=>{n.forEach(m=>{if(m.dismissed)s(m.id,m.removeDelay);else{let h=a.get(m.id);h&&(clearTimeout(h),a.delete(m.id))}})},[n,s]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},zr=ke`
3
+ from {
4
+ transform: scale(0) rotate(45deg);
5
+ opacity: 0;
6
+ }
7
+ to {
8
+ transform: scale(1) rotate(45deg);
9
+ opacity: 1;
10
+ }`,Vr=ke`
11
+ from {
12
+ transform: scale(0);
13
+ opacity: 0;
14
+ }
15
+ to {
16
+ transform: scale(1);
17
+ opacity: 1;
18
+ }`,Gr=ke`
19
+ from {
20
+ transform: scale(0) rotate(90deg);
21
+ opacity: 0;
22
+ }
23
+ to {
24
+ transform: scale(1) rotate(90deg);
25
+ opacity: 1;
26
+ }`,Jr=Ie("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: ${zr} 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: ${Vr} 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: ${Gr} 0.15s ease-out forwards;
56
+ animation-delay: 180ms;
57
+ transform: rotate(90deg);
58
+ }
59
+ `,Yr=ke`
60
+ from {
61
+ transform: rotate(0deg);
62
+ }
63
+ to {
64
+ transform: rotate(360deg);
65
+ }
66
+ `,Zr=Ie("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: ${Yr} 1s linear infinite;
75
+ `,Xr=ke`
76
+ from {
77
+ transform: scale(0) rotate(45deg);
78
+ opacity: 0;
79
+ }
80
+ to {
81
+ transform: scale(1) rotate(45deg);
82
+ opacity: 1;
83
+ }`,eo=ke`
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
+ }`,to=Ie("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: ${Xr} 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: ${eo} 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
+ `,no=Ie("div")`
125
+ position: absolute;
126
+ `,ro=Ie("div")`
127
+ position: relative;
128
+ display: flex;
129
+ justify-content: center;
130
+ align-items: center;
131
+ min-width: 20px;
132
+ min-height: 20px;
133
+ `,oo=ke`
134
+ from {
135
+ transform: scale(0.6);
136
+ opacity: 0.4;
137
+ }
138
+ to {
139
+ transform: scale(1);
140
+ opacity: 1;
141
+ }`,ao=Ie("div")`
142
+ position: relative;
143
+ transform: scale(0.6);
144
+ opacity: 0.4;
145
+ min-width: 20px;
146
+ animation: ${oo} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
147
+ forwards;
148
+ `,so=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?oe(ao,null,t):t:n==="blank"?null:oe(ro,null,oe(Zr,{...r}),n!=="loading"&&oe(no,null,n==="error"?oe(Jr,{...r}):oe(to,{...r})))},io=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
+ `,co=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
+ `,lo="0%{opacity:0;} 100%{opacity:1;}",uo="0%{opacity:1;} 100%{opacity:0;}",mo=Ie("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
+ `,po=Ie("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
+ `,ho=(e,t)=>{let n=e.includes("top")?1:-1,[r,a]=Cn()?[lo,uo]:[io(n),co(n)];return{animation:t?`${ke(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ke(a)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},fo=yr(({toast:e,position:t,style:n,children:r})=>{let a=e.height?ho(e.position||t||"top-center",e.visible):{opacity:0},s=oe(so,{toast:e}),i=oe(po,{...e.ariaProps},ut(e.message,e));return oe(mo,{className:e.className,style:{...a,...n,...e.style}},typeof r=="function"?r({icon:s,message:i}):oe(ye,null,s,i))});$r(oe);var go=({id:e,className:t,style:n,onHeightUpdate:r,children:a})=>{let s=V(i=>{if(i){let c=()=>{let l=i.getBoundingClientRect().height;r(e,l)};c(),new MutationObserver(c).observe(i,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return oe("div",{ref:s,className:t,style:n},a)},yo=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},a=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Cn()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...a}},vo=ft`
174
+ z-index: 9999;
175
+ > * {
176
+ pointer-events: auto;
177
+ }
178
+ `,et=16,Rn=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:a,toasterId:s,containerStyle:i,containerClassName:c})=>{let{toasts:l,handlers:u}=Qr(n,s);return oe("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:et,left:et,right:et,bottom:et,pointerEvents:"none",...i},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let m=d.position||t,h=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),p=yo(m,h);return oe(go,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?vo:"",style:p},d.type==="custom"?ut(d.message,d):a?a(d):oe(fo,{toast:d,position:m}))}))},I=Y;const bo="_fadeImage_1bp3x_1",wo="_loaded_1bp3x_6",en={fadeImage:bo,loaded:wo},qn=({className:e,onLoad:t,onError:n,...r})=>{const a=r.src,[s,i]=y(null),c=s!==null&&s===a;return o("img",{...r,className:`${e??""} ${en.fadeImage} ${c?en.loaded:""}`,onLoad:l=>{i(a),t?.(l)},onError:l=>{i(a),n?.(l)}})};function yt(e){const t={subscribe(n){let r=null,a=!1,s=!1,i=!1;function c(){if(r===null){i=!0;return}s||(s=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;a||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;a||(a=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;a||(a=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),i&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(_o,t)}};return t}function _o(e,t){return t(e)}function ko(e){const t=new AbortController;return new Promise((n,r)=>{let a=!1;function s(){a||(a=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const i=e.subscribe({next(c){a=!0,n(c),s()},error(c){r(c)},complete(){t.abort(),s()}})})}function Eo(e){return t=>{let n=0,r=null;const a=[];function s(){r||(r=t.subscribe({next(c){for(const u of a){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of a){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of a){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function i(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return yt(c=>(n++,a.push(c),s(),{unsubscribe(){n--,i();const l=a.findIndex(u=>u===c);l>-1&&a.splice(l,1)}}))}}function So(e){let t=e;const n=[],r=i=>{t!==void 0&&i.next(t),n.push(i)},a=i=>{n.splice(n.indexOf(i),1)},s=yt(i=>(r(i),()=>{a(i)}));return s.next=i=>{if(t!==i){t=i;for(const c of n)c.next(i)}},s.get=()=>t,s}function To(e){return yt(t=>{function n(r=0,a=e.op){const s=e.links[r];if(!s)throw new Error("No more links to execute - did you forget to add an ending link?");return s({op:a,next(i){return n(r+1,i)}})}return n().subscribe(t)})}function ze(e){"@babel/helpers - typeof";return ze=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},ze(e)}function Po(e,t){if(ze(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ze(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Io(e){var t=Po(e,"string");return ze(t)=="symbol"?t:t+""}function ce(e,t,n){return(t=Io(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tn(Object(n),!0).forEach(function(r){ce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Pe(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function No(e){return typeof e=="function"}function Co(){return Object.create(null)}const xo=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Oo(e){return xo&&Pe(e)&&Symbol.asyncIterator in e}const Ao=e=>e(),Dn=()=>{},nn=e=>{Object.freeze&&Object.freeze(e)};function $n(e,t,n){var r;const a=t.join(".");return(r=n[a])!==null&&r!==void 0||(n[a]=new Proxy(Dn,{get(s,i){if(!(typeof i!="string"||i==="then"))return $n(e,[...t,i],n)},apply(s,i,c){const l=t[t.length-1];if(l==="valueOf"||l==="toString"||l==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let u={args:c,path:t};return l==="call"?u={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:l==="apply"&&(u={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),nn(u.args),nn(u.path),e(u)}})),n[a]}const jn=e=>$n(e,[],Co()),Lo=e=>new Proxy(Dn,{get(t,n){if(n!=="then")return e(n)}});function Ve(e){"@babel/helpers - typeof";return Ve=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},Ve(e)}function Ro(e,t){if(Ve(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ve(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qo(e){var t=Ro(e,"string");return Ve(t)=="symbol"?t:t+""}function St(e,t,n){return(t=qo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rn(Object(n),!0).forEach(function(r){St(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Do=class extends Error{constructor(e){super($o(e)),Object.assign(this,e)}};function $o(e){if("message"in e)return String(e.message)}function jo(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(Pe(e))return new Do(e)}}var on=class extends Error{constructor(e){var t,n,r;const a=jo(e.cause),s=(t=(n=e.message)!==null&&n!==void 0?n:a?.message)!==null&&t!==void 0?t:e.code;super(s,{cause:a}),St(this,"cause",void 0),St(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=a)}};function Mo(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:tt(tt({},e),{},{error:n})}}return{ok:!0,result:tt(tt({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var wt=class extends Error{constructor(){super("Unable to transform response from server")}};function Bo(e,t){let n;try{n=Mo(e,t)}catch{throw new wt}if(!n.ok&&(!Pe(n.error.error)||typeof n.error.error.code!="number"))throw new wt;if(n.ok&&!Pe(n.result))throw new wt;return n}function Fo(e){return typeof e=="function"}async function Wo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const a=Object.keys(n.lazy).find(s=>t===s||t.startsWith(s+"."));if(!a)return null;await n.lazy[a].load(),r=n.procedures[t]}return r}async function Ko(e){const{type:t,path:n}=e,r=await Wo(e.router,n);if(!r||!Fo(r)||r._def.type!==t&&!e.allowMethodOverride)throw new on({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new on({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function Uo(e){return e instanceof dt}function Ho(e){return Pe(e)&&Pe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function Qo(e,t){return typeof e=="string"?e:Pe(e)&&typeof e.message=="string"?e.message:t}var dt=class ct extends Error{constructor(t,n){var r,a;const s=n?.cause;super(t,{cause:s}),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=s,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(a=n.result)===null||a===void 0?void 0:a.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ct.prototype)}static from(t,n={}){const r=t;return Uo(r)?(n.meta&&(r.meta=Z(Z({},r.meta),n.meta)),r):Ho(r)?new ct(r.error.message,Z(Z({},n),{},{result:r,cause:n.cause})):new ct(Qo(r,"Unknown error"),Z(Z({},n),{},{cause:r}))}};function zo(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 an=e=>typeof e=="function";function Vo(e){if(e)return e;if(typeof window<"u"&&an(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&an(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function Go(...e){const t=new AbortController,n=e.length;let r=0;const a=()=>{++r===n&&t.abort()};for(const s of e)s?.aborted?a():s?.addEventListener("abort",a,{once:!0});return t.signal}function Jo(...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 Yo(e){return{url:e.url.toString(),fetch:e.fetch,transformer:zo(e.transformer),methodOverride:e.methodOverride}}function Zo(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const Xo={query:"GET",mutation:"POST",subscription:"PATCH"};function Mn(e){return"input"in e?e.transformer.input.serialize(e.input):Zo(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Bn=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 a=Mn(e);a!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(a))}`)}return r.length&&(n+="?"+r.join("&")),n},ea=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Mn(e);return t!==void 0?JSON.stringify(t):void 0},ta=e=>aa(Z(Z({},e),{},{contentTypeHeader:"application/json",getUrl:Bn,getBody:ea}));var na=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const ra=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 na};async function oa(e){var t,n;ra(e.signal);const r=e.getUrl(e),a=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:Xo[e.type],i=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=Z(Z(Z({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),i);return Vo(e.fetch)(r,{method:s,signal:e.signal,body:a,headers:c})}async function aa(e){const t={},n=await oa(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const sn=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function cn(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function a(c){const l=[[]];let u=0;for(;;){const h=c[u];if(!h)break;const p=l[l.length-1];if(h.aborted){var d;(d=h.reject)===null||d===void 0||d.call(h,new Error("Aborted")),u++;continue}if(e.validate(p.concat(h).map(g=>g.key))){p.push(h),u++;continue}if(p.length===0){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function s(){const c=a(t);r();for(const l of c){if(!l.length)continue;const u={items:l};for(const d of l)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(h,p)=>{const g=u.items[p];try{var k;const C=await Promise.resolve(h);(k=g.resolve)===null||k===void 0||k.call(g,C)}catch(C){var M;(M=g.reject)===null||M===void 0||M.call(g,C)}g.batch=null,g.reject=null,g.resolve=null}));for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Missing result")),h.batch=null}}).catch(d=>{for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,d),h.batch=null}})}}function i(c){var l;const u={aborted:!1,key:c,batch:null,resolve:sn,reject:sn},d=new Promise((m,h)=>{var p;u.reject=h,u.resolve=m,(p=t)!==null&&p!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(s)),d}return{load:i}}function sa(e){var t,n;const r=Yo(e),a=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,s=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const i=l=>({validate(u){if(a===1/0&&s===1/0)return!0;if(u.length>s)return!1;const d=u.map(h=>h.path).join(","),m=u.map(h=>h.input);return Bn(Z(Z({},r),{},{type:l,path:d,inputs:m,signal:null})).length<=a},async fetch(u){const d=u.map(g=>g.path).join(","),m=u.map(g=>g.input),h=Go(...u.map(g=>g.signal)),p=await ta(Z(Z({},r),{},{path:d,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:h}));return(Array.isArray(p.json)?p.json:u.map(()=>p.json)).map(g=>({meta:p.meta,json:g}))}}),c={query:cn(i("query")),mutation:cn(i("mutation"))};return({op:l})=>yt(u=>{if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const d=new AbortController,m=c[l.type].load(Z(Z({},l),{},{signal:Jo(l.signal,d.signal)}));let h=!1,p;return m.then(g=>{h=!0,p=g;const k=Bo(g.json,r.transformer.output);if(!k.ok){u.error(dt.from(k.error,{meta:g.meta}));return}u.next({context:g.meta,result:k.result}),u.complete()}).catch(g=>{h=!0,u.error(dt.from(g,{meta:p?.meta}))}),()=>{h||d.abort()}})}}const Fn=(e,...t)=>typeof e=="function"?e(...t):e;function ia(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function ca(e){const t=await Fn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function la(e,t){const n={method:"connectionParams",data:await Fn(e)};return t.encode(n)}function ua(e){const{promise:t,resolve:n,reject:r}=ia();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function da(e,{intervalMs:t,pongTimeoutMs:n}){let r,a;function s(){r=setTimeout(()=>{e.send("PING"),a=setTimeout(()=>{e.close()},n)},t)}function i(){clearTimeout(r),s()}function c(){clearTimeout(a),i()}e.addEventListener("open",s),e.addEventListener("message",({data:l})=>{clearTimeout(r),s(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(a)})}var ma=class Tt{constructor(t){var n;if(ce(this,"id",++Tt.connectCount),ce(this,"WebSocketPonyfill",void 0),ce(this,"urlOptions",void 0),ce(this,"keepAliveOpts",void 0),ce(this,"encoder",void 0),ce(this,"wsObservable",So(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=++Tt.connectCount;const t=ca(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&&da(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await ua(n),this.urlOptions.connectionParams&&n.send(await la(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(ma,"connectCount",0);var Wn=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 To({links:this.links,op:Z(Z({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(Eo())}async requestAsPromise(e){try{const t=this.$request(e);return(await ko(t)).result.data}catch(t){throw dt.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 a;(a=n.onConnectionStateChange)===null||a===void 0||a.call(n,r.result);break;case"started":var s;(s=n.onStarted)===null||s===void 0||s.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 a;(a=n.onError)===null||a===void 0||a.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const Kn=Symbol.for("trpc_untypedClient"),pa={query:"query",mutate:"mutation",subscribe:"subscription"},ha=e=>pa[e];function fa(e){const t=jn(({path:n,args:r})=>{const a=[...n],s=ha(a.pop()),i=a.join(".");return e[s](i,...r)});return Lo(n=>n===Kn?e:t[n])}function ga(e){return fa(new Wn(e))}function ya(e){return e[Kn]}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 va(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 ba(e){var t=va(e,"string");return Ge(t)=="symbol"?t:t+""}function wa(e,t,n){return(t=ba(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ln(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ln(Object(n),!0).forEach(function(r){wa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ln(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _a(e){var t,n,r,a=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);a--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new lt(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function lt(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(a){return{value:a,done:r}})}return lt=function(r){this.s=r,this.n=r.next},lt.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var a=this.s.return;return a===void 0?Promise.resolve({value:r,done:!0}):t(a.apply(this.s,arguments))},throw:function(r){var a=this.s.return;return a===void 0?Promise.reject(r):t(a.apply(this.s,arguments))}},new lt(e)}function ka(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 Ea(e,t){if(e==null)return{};var n,r,a=ka(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const Sa=["cursor","direction"];function vt(e){return{path:e.path.join(".")}}function Ta(e){return e.length>=3}function Pa(e){return Ta(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function qt(e,t,n){var r;const a=Pa(e);let s=(r=a.args)===null||r===void 0?void 0:r.input;if(n){var i,c;s=O(O(O({},(i=(c=a.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[a.path.join("."),s,t?.trpc]}async function Ia(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const a=[];var s=!1,i=!1,c;try{for(var l=_a(e),u;s=!(u=await l.next()).done;s=!1){const d=u.value;a.push(d),r.setState({data:[...a]})}}catch(d){i=!0,c=d}finally{try{s&&l.return!=null&&await l.return()}finally{if(i)throw c}}return a}function _e(e){const t=Ao(()=>{const{input:n,type:r}=e,a=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return a.length?[a]:[];if(r==="infinite"&&Pe(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:i}=n;return[a,{input:Ea(n,Sa),type:"infinite"}]}return[a,O(O({},typeof n<"u"&&n!==Ae&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function Un(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Dt(e){return No(e)?e():e}function Na(e){var t;const{input:n,query:r,path:a,queryKey:s,opts:i}=e,c=n===Ae,l=async u=>{var d;const m=O(O({},i),{},{trpc:O(O({},i?.trpc),!(i==null||(d=i.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...qt(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(Tr(O(O({},i??{}),{},{queryKey:s,queryFn:c?Ae:l,initialPageParam:(t=i?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:vt({path:a})})}function Ca(e){var t,n;const{mutate:r,path:a,prefix:s,opts:i,overrides:c}=e,l=Dt(e.queryClient),u=Un({path:a,prefix:(t=i?.keyPrefix)!==null&&t!==void 0?t:s}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),m=(n=c?.onSuccess)!==null&&n!==void 0?n:(p=>p.originalFn()),h=async p=>await r(...qt([...u,{input:p}],i));return O(O({},i),{},{mutationKey:u,mutationFn:h,onSuccess(...p){var g,k;return m({originalFn:()=>{var C,H,S;return(C=i==null||(H=i.onSuccess)===null||H===void 0?void 0:H.call(i,...p))!==null&&C!==void 0?C:d==null||(S=d.onSuccess)===null||S===void 0?void 0:S.call(d,...p)},queryClient:l,meta:(g=(k=i?.meta)!==null&&k!==void 0?k:d?.meta)!==null&&g!==void 0?g:{}})},trpc:vt({path:a})})}function xa(e){const{input:t,query:n,path:r,queryKey:a,opts:s}=e,i=Dt(e.queryClient),c=t===Ae,l=async u=>{var d;const m=O(O({},s),{},{trpc:O(O({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),h=u.queryKey,p=await n(...qt(h,m));return Oo(p)?Ia(p,i,h):p};return Object.assign(Pr(O(O({},s),{},{queryKey:a,queryFn:c?Ae:l})),{trpc:vt({path:r})})}const Oa=e=>{const{subscribe:t,path:n,queryKey:r,input:a,opts:s={}}=e,i="enabled"in s?!!s.enabled:a!==Ae,c=l=>t(n.join("."),a===Ae?void 0:a,l);return O(O({},s),{},{enabled:i,subscribe:c,queryKey:r,trpc:vt({path:n})})};function Aa(e){const t=e.keyPrefix,n=r=>(a,s,i)=>"router"in e?Promise.resolve(Dt(e.ctx)).then(c=>Ko({router:e.router,path:a,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof Wn?e.client:ya(e.client))[r](a,s,i);return jn(({args:r,path:a})=>{const s=[...a],i=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>_e({path:s,type:"any",prefix:t}),pathFilter:()=>O(O({},c),{},{queryKey:_e({path:s,type:"any",prefix:t})}),queryOptions:()=>xa({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:_e({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>_e({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>O(O({},l),{},{queryKey:_e({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>Na({input:c,opts:l,path:s,queryKey:_e({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>_e({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>O(O({},l),{},{queryKey:_e({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return Ca({opts:c,path:s,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>Un({path:s,prefix:t}),subscriptionOptions:()=>Oa({opts:l,path:s,input:c,queryKey:_e({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[i]()})}function La(){const e=be(null),t=be(null),n=s=>{const i=je(()=>Aa({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return oe(e.Provider,{value:s.trpcClient},oe(t.Provider,{value:i},s.children))};n.displayName="TRPCProvider";function r(){const s=we(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function a(){const s=we(e);if(!s)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return s}return{TRPCProvider:n,useTRPC:r,useTRPCClient:a}}const Pt={lan:new Set,animepahe:new Set,jasmr:new Set};function Oe(e){for(const t of[...Pt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function Hn(e,t){return Pt[e].add(t),()=>{Pt[e].delete(t)}}let mt="default";function Qn(){return mt}function Ra(e){mt=e}const qa=new Set(["playerVideoDelayMs","playerVideoDelayEnabled","anime4kEnabled"]);function nt(e){return mt==="default"||qa.has(e)?e:`dango:profile:${mt}:${e}`}const ee={keyFor:nt,getItem:e=>localStorage.getItem(nt(e)),setItem:(e,t)=>localStorage.setItem(nt(e),t),removeItem:e=>localStorage.removeItem(nt(e))};function Da(){localStorage.setItem("dango:profile-session-change",`${Date.now()}-${Math.random()}`),window.location.assign("/")}const $a=(e,t)=>new Promise((n,r)=>{t?.throwIfAborted();const a=()=>{clearTimeout(s),r(t?.reason)},s=setTimeout(()=>{t?.removeEventListener("abort",a),n()},e);t?.addEventListener("abort",a,{once:!0})}),$t=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 a=n?.url??e.toString(),s=a.startsWith("/")&&!a.startsWith("//")||typeof window<"u"&&new URL(a,window.location.origin).origin===window.location.origin;if(s){!a.includes("/api/profiles/status")&&!a.includes("/api/profiles/login")&&!a.includes("/api/auth/app-")&&r.set("x-dango-profile-id",Qn());let m=ee.getItem("animepahe_ua"),h=ee.getItem("animepahe_cookie");h&&m&&m!==navigator.userAgent&&(ee.removeItem("animepahe_cookie"),ee.removeItem("animepahe_ua"),h=null,m=null,I.error("Your browser changed. Verify AnimePahe again to refresh its cookie."),Oe("animepahe"));const p=ee.getItem("jasmr_ua"),g=ee.getItem("jasmr_cookie");m&&r.set("x-animepahe-ua",m),h&&r.set("x-animepahe-cookie",h),p&&r.set("x-jasmr-ua",p),g&&r.set("x-jasmr-cookie",g)}new Headers(t?.headers).forEach((m,h)=>r.set(h,m));const i={...t,headers:r},c=(t?.method??n?.method??"GET").toUpperCase(),l=t?.signal??n?.signal,u=s&&(c==="GET"||c==="HEAD");let d=await fetch(e,i);s&&d.status===409&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_CHANGED"&&window.location.reload(),s&&d.status===401&&!a.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;u&&d.status===503&&d.headers.get("x-dango-not-ready")==="1"&&m<3;m++)await d.body?.cancel(),await $a(500*2**m,l),d=await fetch(e,i);return d},De=async(e,t)=>{const n=await $t(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let a={};try{a=JSON.parse(r)}catch{}const s=typeof a.error=="string"?a.error:"";throw n.status===403&&s==="AUTH_REQUIRED"&&a.provider==="animepahe"&&Oe("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&a.provider==="jasmr"&&Oe("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&Oe("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function ja(e,t){const n=await $t(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Oe("lan")}catch{}return await Ma(n),n}async function Ma(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 a=r?.error;if(!a||typeof a!="object")continue;const s=a.data?.cause;(a.message==="AUTH_REQUIRED"||s?.code==="AUTH_REQUIRED")&&(s?.provider==="animepahe"||s?.provider==="jasmr")&&Oe(s.provider),(a.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&Oe("lan")}}catch{}}const{TRPCProvider:Ba,useTRPC:A}=La(),te=ga({links:[sa({url:"/api/trpc",fetch:ja})]}),Fa="_overlay_5hzq9_1",Wa="_fadeIn_5hzq9_1",Ka="_content_5hzq9_11",Ua="_modalIn_5hzq9_1",Ha="_sm_5hzq9_29",Qa="_md_5hzq9_33",za="_lg_5hzq9_37",Va="_title_5hzq9_41",Ga="_closeButton_5hzq9_48",Ja="_body_5hzq9_74",Ya="_footer_5hzq9_78",$e={overlay:Fa,fadeIn:Wa,content:Ka,modalIn:Ua,sm:Ha,md:Qa,lg:za,title:Va,closeButton:Ga,body:Ja,footer:Ya};function zn({children:e}){return o("h2",{className:$e.title,children:e})}function Vn({children:e}){return o("div",{className:$e.body,children:e})}function Gn({children:e}){return o("div",{className:$e.footer,children:e})}function Me({isOpen:e,onClose:t,title:n,children:r,footer:a,width:s="md"}){const i=q(null),[c,l]=y(document.body);return w(()=>{if(!e)return;const u=()=>l(document.fullscreenElement??document.body);return u(),document.addEventListener("fullscreenchange",u),()=>document.removeEventListener("fullscreenchange",u)},[e]),w(()=>{if(!e)return;const u=m=>{m.key==="Escape"&&t?.()};document.addEventListener("keydown",u);const d=document.body.style.overflow;return document.body.style.overflow="hidden",i.current?.focus(),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=d}},[e,t]),e?Tn(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:$e.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:i,className:`${$e.content} ${$e[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(zn,{children:n}),o(Vn,{children:r}),a&&o(Gn,{children:a})]})]}),c):null}Me.Header=zn;Me.Body=Vn;Me.Actions=Gn;const We=new Map,Za=500,Jn=(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 a=`${r}-${t}-${n}`;if(We.has(a))return We.get(a);let s;if(r.startsWith("https://s4.anilist.co"))s=r,t&&(s+=`${s.includes("?")?"&":"?"}w=${t}`),n&&(s+=`${s.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){s=`/api/image-proxy?url=${encodeURIComponent(r)}`;const i=ee.getItem("animepahe_cookie"),c=ee.getItem("animepahe_ua");i&&(s+=`&cookie=${encodeURIComponent(i)}`),c&&(s+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))s=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;s=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300")}return We.size>Za&&We.clear(),We.set(a,s),s},bu=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 wu(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 _u(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const Xa=(...e)=>e.filter(Boolean).join(" ");function es(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const Yn=be(void 0),Zn=()=>{const e=we(Yn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},N={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"},ku=()=>{const e=A(),t=j({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},Eu=(e="TRENDING_DESC",t=10)=>ht({queryKey:[N.trendingList,e,t],queryFn:({pageParam:n=1})=>te.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Su=(e="TV",t=12)=>ht({queryKey:[N.latestReleases,e,t],queryFn:({pageParam:n=1})=>te.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Tu=(e,t="TV",n=!0)=>{const r=A();return j({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},ts=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],Pu=(e,t,n=14)=>{const r=A(),a=new URLSearchParams(e),s={page:t,limit:n};for(const i of ts){const c=a.get(i);c!==null&&(s[i]=c)}return j({...r.data.search.queryOptions(s),enabled:e!=null})},Iu=()=>{const e=A();return j(e.queue.list.queryOptions())},ns=()=>{const e=A(),t=ae();return pe(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?I.success("Added to queue"):I.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[N.queueRemaining]})},onError:n=>{I.error(`Failed to update queue: ${n.message}`)}}))},Nu=()=>{const e=A(),t=ae();return pe(e.queue.remove.mutationOptions({onSuccess:()=>{I.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[N.queueRemaining]}),t.invalidateQueries({queryKey:[N.continueWatching]})},onError:n=>{I.error(`Failed to remove: ${n.message}`)}}))},Cu=(e,t=!0)=>j({queryKey:[N.queueRemaining,e],queryFn:()=>te.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),xu=()=>{const e=A(),t=ae();return pe(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const a=n.added??r.episodeNumbers.length;I.success(`${a} ${a===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[N.queueRemaining]})},onError:n=>{I.error(`Failed to update queue: ${n.message}`)}}))},Ou=()=>{const e=A(),t=ae();return pe(e.queue.removeMany.mutationOptions({onSuccess:()=>{I.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[N.queueRemaining]}),t.invalidateQueries({queryKey:[N.continueWatching]})},onError:n=>{I.error(`Failed to remove: ${n.message}`)}}))},Au=()=>{const e=A(),t=ae();return pe(e.queue.clear.mutationOptions({onSuccess:()=>{I.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[N.queueRemaining]}),t.invalidateQueries({queryKey:[N.continueWatching]})},onError:n=>{I.error(`Failed to clear queue: ${n.message}`)}}))},Lu=()=>{const e=A(),t=ae(),n=e.queue.list.queryOptions().queryKey;return pe(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const a=t.getQueryData(n);return t.setQueryData(n,s=>{if(!s)return s;const i=new Map(s.map(c=>[c.id,c]));return r.map((c,l)=>{const u=i.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:a}},onError:(r,a,s)=>{s?.previousQueue&&t.setQueryData(n,s.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},rs=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function jt(e,t,n){const r=new URLSearchParams(e),a={page:t,limit:n};for(const s of rs){const i=r.get(s);i!==null&&(a[s]=i)}return a}const Ru=(e,t="",n,r=14)=>j({queryKey:[N.watchlist,e,t,n,r],queryFn:async()=>{const a=new URLSearchParams(t);return a.set("status",e),await te.watchlist.list.query(jt(a.toString(),n,r))}}),qu=(e="")=>ht({queryKey:[N.continueWatching,e],queryFn:async({pageParam:t=1})=>await te.watchlist.continueWatchingAll.query(jt(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)})}),Du=(e="",t,n=14)=>j({queryKey:[N.continueWatching,e,t,n],queryFn:async()=>await te.watchlist.continueWatchingAll.query(jt(e,t,n))}),$u=()=>{const e=A(),t=ae();return pe(e.watchlist.remove.mutationOptions({onSuccess:()=>{I.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[N.watchlist]})},onError:n=>{I.error(`Failed to remove: ${n.message}`)}}))},ju=()=>{const e=A(),t=ae();return pe(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{I.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[N.watchlist]}),t.invalidateQueries({queryKey:[N.continueWatching]})},onError:n=>{I.error(`Failed to update statuses: ${n.message}`)}}))},Mu=()=>{const e=A(),t=ae();return pe(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;I.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[N.watchlist]}),t.invalidateQueries({queryKey:[N.continueWatching]})},onError:n=>{I.error(`Failed to remove: ${n.message}`)}}))},Bu=()=>{const e=A(),t=ae();return pe(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;I.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[N.continueWatching]})},onError:n=>{I.error(`Failed to remove: ${n.message}`)}}))},Xn=(e=!0)=>{const t=A();return j({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},er=(e=!0)=>{const t=A();return j({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},tr=(e=!0)=>{const t=A();return j({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},os=()=>{const e=A(),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:[N.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},as=()=>{const e=A(),t=ae();return pe(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},ss=()=>{const e=A(),t=ae();return pe(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Fu=()=>{const e=A();return j({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},Wu=()=>{const e=A();return j({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},Ku=()=>j({queryKey:[N.genreCards],queryFn:()=>te.insights.genreCards.query()}),is="_container_jzirm_1",cs="_bellBtn_jzirm_7",ls="_badge_jzirm_39",us="_dropdown_jzirm_67",ds="_dropdownHeader_jzirm_98",ms="_headerSubtitle_jzirm_106",ps="_headerActions_jzirm_113",hs="_closeBtn_jzirm_119",fs="_sectionHeading_jzirm_132",gs="_clearAllBtn_jzirm_148",ys="_discoveryStatusRow_jzirm_166",vs="_statusDot_jzirm_177",bs="_statusDotRunning_jzirm_184",ws="_statusDotOk_jzirm_189",_s="_statusDotError_jzirm_197",ks="_statusDotIdle_jzirm_201",Es="_list_jzirm_216",Ss="_item_jzirm_230",Ts="_itemTitleLink_jzirm_241",Ps="_systemItemMeta_jzirm_248",Is="_removeItem_jzirm_249",Ns="_modalButton_jzirm_251",Cs="_systemItem_jzirm_248",xs="_systemIcon_jzirm_264",Os="_thumbWrap_jzirm_275",As="_thumbnail_jzirm_284",Ls="_itemInfo_jzirm_293",Rs="_itemTitle_jzirm_241",qs="_itemMeta_jzirm_309",Ds="_queueItem_jzirm_374",$s="_fullMessage_jzirm_388",js="_emptyState_jzirm_394",Ms="_emptyIcon_jzirm_412",E={container:is,bellBtn:cs,badge:ls,dropdown:us,dropdownHeader:ds,headerSubtitle:ms,headerActions:ps,closeBtn:hs,sectionHeading:fs,clearAllBtn:gs,discoveryStatusRow:ys,statusDot:vs,statusDotRunning:bs,statusDotOk:ws,statusDotError:_s,statusDotIdle:ks,list:Es,item:Ss,itemTitleLink:Ts,systemItemMeta:Ps,removeItem:Is,modalButton:Ns,systemItem:Cs,systemIcon:xs,thumbWrap:Os,thumbnail:As,itemInfo:Ls,itemTitle:Rs,itemMeta:qs,queueItem:Ds,fullMessage:$s,emptyState:js,emptyIcon:Ms},Bs=({notification:e})=>{const t=as(),n=ns(),[r,a]=Lt.useState(!1),s=u=>{u.preventDefault(),u.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},i=u=>{u.preventDefault(),u.stopPropagation(),a(!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(()=>a(!1),1e3)},{titlePreference:c}=Zn(),l=c==="nativeName"?e.nativeName||e.name:c==="englishName"&&e.englishName||e.name;return o("div",{className:E.item,children:[o("span",{className:E.thumbWrap,children:o(qn,{src:Jn(e.thumbnail,48,64),alt:e.name,className:E.thumbnail,loading:"lazy",decoding:"async"})}),o("div",{className:E.itemInfo,children:[o(me,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:E.itemTitleLink,onClick:()=>t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),children:o("span",{className:E.itemTitle,children:l})}),o("span",{className:E.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${E.removeItem} ${E.queueItem}`,onClick:i,title:"Add to queue","aria-label":"Add notification to queue",children:r?o(P,{name:"check"}):o(P,{name:"plus"})}),o("button",{className:E.removeItem,onClick:s,title:"Dismiss","aria-label":"Remove notification",children:o(P,{name:"times"})})]})};function _t({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:a}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...a}})}const Fs=({count:e=3})=>o(ye,{children:Array.from({length:e}).map((t,n)=>o("div",{className:E.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:E.thumbnail,style:{overflow:"hidden"},children:o(_t,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:E.itemInfo,children:[o(_t,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(_t,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),Ws=({onClose:e})=>{const{data:t=[],isLoading:n}=Xn(),{data:r=[]}=er(),{data:a}=tr(),s=ss(),i=ae(),[c,l]=y(null),u=q(null);w(()=>{u.current?.focus();const p=g=>{g.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e]),w(()=>{i.invalidateQueries({queryKey:[N.notifications]})},[i]);const d=r.find(p=>p.id===c)??null,m=t.length+r.length,h=a?.running?a.total>0?`Checking ${Math.min(a.done,a.total)}/${a.total} shows...`:"Checking for new episodes...":a?.state==="complete"?`Discovery complete · checked ${a.total} ${a.total===1?"show":"shows"}`:a?.state==="empty"?"No shows set to Watching":a?.state==="error"?"Last check failed · will retry automatically":a?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-a.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes";return o("div",{id:"notification-panel",ref:u,className:E.dropdown,role:"dialog","aria-label":"Notifications",tabIndex:-1,children:[o("div",{className:E.dropdownHeader,children:[o("div",{children:[o("h4",{children:"Notifications"}),o("span",{className:E.headerSubtitle,children:[m," updates"]})]}),o("div",{className:E.headerActions,children:[t.length>0&&o("button",{className:E.clearAllBtn,onClick:()=>s.mutate(void 0),children:"Clear all"}),o("button",{type:"button",className:E.closeBtn,onClick:e,title:"Close","aria-label":"Close notifications",children:o(P,{name:"times"})})]})]}),o("div",{className:E.discoveryStatusRow,children:[o("span",{className:`${E.statusDot} ${a?.running?E.statusDotRunning:a?.state==="complete"?E.statusDotOk:a?.state==="error"?E.statusDotError:E.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:h})]}),o("div",{className:E.list,children:n&&m===0?o(Fs,{count:4}):o(ye,{children:[r.length>0&&o("section",{"aria-labelledby":"system-notifications-heading",children:[o("h5",{id:"system-notifications-heading",className:E.sectionHeading,children:"App updates"}),r.map(p=>o("div",{className:`${E.item} ${E.systemItem}`,children:[o("div",{className:E.systemIcon,children:o(P,{name:"info-circle",size:20})}),o("div",{className:E.itemInfo,children:[o("span",{className:E.itemTitle,children:p.title}),o("button",{type:"button",className:E.systemItemMeta,onClick:()=>l(p.id),title:"View full message",children:[es(p.message,72,"…")," ",o("span",{children:"Read more"})]})]})]},p.id))]}),t.length>0&&o("section",{"aria-labelledby":"new-episodes-heading",children:[o("h5",{id:"new-episodes-heading",className:E.sectionHeading,children:"New episodes"}),t.map(p=>o(Bs,{notification:p},p.id))]}),!n&&m===0&&o("div",{className:E.emptyState,children:[o("span",{className:E.emptyIcon,children:o(P,{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:()=>l(null),title:d?.title,width:"sm",footer:o("button",{type:"button",className:E.modalButton,onClick:()=>l(null),children:"OK"}),children:d&&o("p",{className:E.fullMessage,children:d.message})})]})},Ks="notification-panel",Us=()=>{const[e,t]=y(!1),n=q(null),r=ae(),a=A(),s=os(),{data:i=[]}=Xn(),{data:c=[]}=er(),{data:l}=tr(),u=i.length+c.length,d=u>9?"9+":u,m=q(!1);w(()=>{const p=g=>{n.current&&!n.current.contains(g.target)&&t(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),w(()=>{const p=!!l?.running;m.current&&!p&&(r.invalidateQueries(a.notifications.pathFilter()),r.invalidateQueries(a.discovery.pathFilter()),r.invalidateQueries({queryKey:[N.continueWatching]}),r.invalidateQueries({queryKey:[N.thisWeekSchedule]}),r.invalidateQueries(a.continueWatching.pathFilter()),r.invalidateQueries({queryKey:[N.notifications]})),m.current=p},[l?.running,r,a]);const h=()=>{const p=!e;t(p),p&&s.mutate()};return o("div",{className:E.container,ref:n,children:[o("button",{className:E.bellBtn,onClick:h,"aria-haspopup":"dialog","aria-expanded":e,"aria-controls":Ks,"aria-label":"Notifications",children:[o(P,{name:"bell"}),u>0&&o("span",{className:E.badge,"aria-hidden":"true",children:d})]}),e&&o(Ws,{onClose:()=>t(!1)})]})},Hs="_logo_hls4o_1",Qs="_img_hls4o_10",zs="_word_hls4o_21",rt={logo:Hs,img:Qs,word:zs},pt=({className:e,collapsed:t})=>o("span",{className:e?`${rt.logo} ${e}`:rt.logo,role:"img","aria-label":"dango",children:[o("img",{src:"/logo-mascot.png",alt:"","aria-hidden":"true",draggable:!1,className:rt.img}),!t&&o("span",{className:rt.word,children:"dango"})]}),nr=be(void 0),Mt=()=>{const e=we(nr);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},rr=be(void 0),Bt=()=>{const e=we(rr);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},It="virtual-keyboard:hide",un="virtual-keyboard:enabled-change",or="virtual_keyboard_enabled",Vs=!1;function dn(){const e=ee.getItem(or);return e===null?Vs:e==="true"}const mn=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function Gs(){window.dispatchEvent(new CustomEvent(It))}function Js(){const[e,t]=y(!1),[n,r]=y(dn),a=q(null);return w(()=>{const s=d=>{n&&mn(d.target)&&(a.current=d.target,t(!0))},i=d=>{d.target===a.current&&window.setTimeout(()=>{if(mn(document.activeElement)){a.current=document.activeElement,t(!0);return}a.current=null,t(!1)},0)},c=()=>{a.current=null,t(!1)},l=d=>{if(d.key!==or)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=dn();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",i),window.addEventListener(It,c),window.addEventListener("storage",l),window.addEventListener(un,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",i),window.removeEventListener(It,c),window.removeEventListener("storage",l),window.removeEventListener(un,u)}},[n]),{activeInputRef:a,isVisible:n&&e,hide:()=>t(!1)}}const Ys={queryKey:[N.syncProfile],queryFn:()=>De("/api/profiles/current"),staleTime:3e4};function Nt({image:e,name:t,size:n=72,radius:r="50%"}){const[a,s]=y(!1);w(()=>s(!1),[e]);const i={width:"100%",height:"100%",maxWidth:n,maxHeight:n,aspectRatio:"1",objectFit:"cover",borderRadius:r};return e&&!a?o("img",{src:e,alt:t,referrerPolicy:"no-referrer",onError:()=>s(!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 Ft=e=>String(e).toLowerCase()==="movie"?"movie":"tv",Uu=(e,t)=>`${Ft(e)}:${t}`,Zs=(e,t)=>{const n=Ft(e);return`/tv/${t}?type=${n}`},Xs=(e,t,n,r)=>{const a=new URLSearchParams;return a.set("type",Ft(e)),n!==void 0&&a.set("s",String(n)),r!==void 0&&a.set("e",String(r)),`/tv/${t}/watch?${a.toString()}`},Hu=e=>e.adult===!0||e.adult===1,Qu={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"},zu={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"},Wt=300*1e3,ei={mangadex:"https://mangadex.org/",mangapill:"https://www.mangapill.com/"},ti="Dango/3.0 (+https://github.com/serifpersia/dango)",ni=(e,t)=>`/api/proxy?url=${encodeURIComponent(t)}&referer=${encodeURIComponent(ei[e])}`,ri=(e,t)=>t&&(e==="mangadex"?`/api/image-proxy?url=${encodeURIComponent(t)}&ua=${encodeURIComponent(ti)}`:e==="mangapill"?ni(e,t):t),Vu=(e,t=!0)=>{const{provider:n,query:r,page:a,sort:s,status:i,type:c,rating:l,mature:u}=e;return j({queryKey:[N.mangaBrowse,n,r,a,s,i,c,l,u],queryFn:()=>te.manga.search.query({provider:n,q:r.trim()||void 0,page:a,sort:s||void 0,status:i||void 0,type:c||void 0,rating:l||void 0,mature:u?"1":void 0}),staleTime:Wt,enabled:t})},Gu=(e,t=14)=>{const{provider:n,query:r,sort:a,status:s,type:i,rating:c,mature:l}=e;return ht({queryKey:[N.mangaBrowseInfinite,n,r,a,s,i,c,l,t],queryFn:({pageParam:u=1})=>te.manga.search.query({provider:n,q:r.trim()||void 0,page:u,limit:t,sort:a||void 0,status:s||void 0,type:i||void 0,rating:c||void 0,mature:l?"1":void 0}),initialPageParam:1,getNextPageParam:(u,d)=>u.hasNext?d.length+1:void 0,staleTime:Wt,enabled:!0})},Ju=(e,t,n="safe",r=!1)=>j({queryKey:[N.mangaDetail,e,t,n,r],queryFn:()=>te.manga.info.query({provider:e||"",id:t||"",rating:n,mature:r?"1":void 0}),enabled:!!e&&!!t,staleTime:Wt}),Yu=(e,t,n)=>j({queryKey:[N.mangaPages,e,t],queryFn:()=>te.manga.pages.query({provider:e||"",id:t||""}),enabled:!!e&&!!t,staleTime:1800*1e3}),Zu=()=>{const e=A(),t=j({...e.manga.trending.queryOptions(),staleTime:600*1e3,retry:1});return{...t,data:t.data}};function oi(e){return String(e||"").trim().toUpperCase()}function pn(e){return oi(e.id||e._id||"")}function Xu(e){return!!e.isAdult}const ai="_header_19a0e_1",si="_hidden_19a0e_24",ii="_scrolled_19a0e_28",ci="_logo_19a0e_37",li="_logoCollapsed_19a0e_57",ui="_logoFull_19a0e_61",di="_headerInner_19a0e_67",mi="_leftSection_19a0e_77",pi="_desktopNav_19a0e_83",hi="_navLink_19a0e_96",fi="_navLinkActive_19a0e_115",gi="_navPill_19a0e_121",yi="_rightSection_19a0e_139",vi="_searchWrapper_19a0e_145",bi="_searchIconButton_19a0e_172",wi="_searchIcon_19a0e_172",_i="_searchInput_19a0e_199",ki="_searchKbd_19a0e_232",Ei="_searchKbdHidden_19a0e_250",Si="_searchButton_19a0e_255",Ti="_profileBtn_19a0e_265",Pi="_profileAvatar_19a0e_300",Ii="_profileName_19a0e_307",Ni="_hamburgerBtn_19a0e_316",Ci="_searchDropdown_19a0e_344",xi="_searchDropdownNoBar_19a0e_376",Oi="_searchDropdownHeader_19a0e_384",Ai="_searchDropdownQuery_19a0e_392",Li="_searchDropdownSeeAll_19a0e_398",Ri="_searchDropdownList_19a0e_415",qi="_searchDropdownItem_19a0e_429",Di="_searchDropdownThumb_19a0e_447",$i="_searchDropdownItemInfo_19a0e_456",ji="_searchDropdownItemTitle_19a0e_463",Mi="_searchDropdownItemMeta_19a0e_472",Bi="_mobileSearchBar_19a0e_511",Fi="_searchIconMobile_19a0e_582",Wi="_mobileSearchBarHidden_19a0e_609",Ki="_mobileSearchInner_19a0e_627",Ui="_mobileSearchIcon_19a0e_643",Hi="_mobileSearchInput_19a0e_650",b={header:ai,hidden:si,scrolled:ii,logo:ci,logoCollapsed:li,logoFull:ui,headerInner:di,leftSection:mi,desktopNav:pi,navLink:hi,navLinkActive:fi,navPill:gi,rightSection:yi,searchWrapper:vi,searchIconButton:bi,searchIcon:wi,searchInput:_i,searchKbd:ki,searchKbdHidden:Ei,searchButton:Si,profileBtn:Ti,profileAvatar:Pi,profileName:Ii,hamburgerBtn:Ni,searchDropdown:Ci,searchDropdownNoBar:xi,searchDropdownHeader:Oi,searchDropdownQuery:Ai,searchDropdownSeeAll:Li,searchDropdownList:Ri,searchDropdownItem:qi,searchDropdownThumb:Di,searchDropdownItemInfo:$i,searchDropdownItemTitle:ji,searchDropdownItemMeta:Mi,mobileSearchBar:Bi,searchIconMobile:Fi,mobileSearchBarHidden:Wi,mobileSearchInner:Ki,mobileSearchIcon:Ui,mobileSearchInput:Hi},hn=300*1e3,Qi=()=>{const{toggleSidebar:e}=Mt(),{contentType:t}=Bt(),n=A(),{titlePreference:r}=Zn(),[a,s]=y(""),[i,c]=y(""),[l,u]=y(!0),[d,m]=y(!1),[h,p]=y(!0),[g,k]=y(!1),[M,C]=y({left:0,width:0,opacity:0}),[H,S]=y(!1),x=Pn(),W=Je(),B=q(null),se=q(!1),v=q(null),L=q(null),D=q(null),Q=q(null),le=q(!1),ne=q(null),ue=q(null),G=q(null),{data:J}=j(Ys),$=i.length>=2,{data:fe}=j({...n.data.search.queryOptions({query:i,page:1,limit:6}),enabled:$&&t==="anime"}),{data:Ze}=j({...n.tv.search.queryOptions({q:i,page:1,type:"multi"}),enabled:$&&t==="tv"}),{data:Ne}=j({queryFn:()=>te.manga.search.query({q:i,page:1,limit:6,rating:"safe"}),queryKey:[N.mangaBrowse,"",i,1,"","","","safe",!1],staleTime:hn,enabled:$&&t==="manga"}),{data:_}=j({queryFn:()=>te.asmr.browse.query({q:i,page:1}),queryKey:[N.asmrBrowse,i,1,"",""],staleTime:hn,enabled:$&&t==="asmr"}),X=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?Jn(f.thumbnail,48,64):void 0,href:`/anime/${f.id}`})):t==="tv"?(Ze?.results??[]).map(f=>({key:`${f.type}-${f.id}`,name:f.title,meta:f.year,thumb:f.image||void 0,href:Zs(f.type,f.id)})):t==="manga"?(Ne?.items??[]).map(f=>({key:`${f.provider}-${f.id}`,name:f.title,meta:f.year,thumb:f.cover?ri(f.provider,f.cover):void 0,href:`/manga/${f.provider}/${encodeURIComponent(f.id)}`})):(_?.shows??[]).map(f=>({key:pn(f),name:f.name,thumb:f.thumbnail||void 0,href:`/asmr/${encodeURIComponent(pn(f))}`}));w(()=>{const f=window.visualViewport;if(!f)return;const re=()=>{Q.current?.style.setProperty("--vv-top",`${f.offsetTop}px`)};return re(),f.addEventListener("scroll",re),f.addEventListener("resize",re),()=>{f.removeEventListener("scroll",re),f.removeEventListener("resize",re)}},[]),w(()=>{const f=()=>{B.current&&(window.clearTimeout(B.current),B.current=null)},re=()=>{f(),!(window.scrollY<=10||d)&&(B.current=window.setTimeout(()=>{le.current||u(!1)},2500))},Xe=()=>{se.current||(se.current=!0,v.current=requestAnimationFrame(()=>{se.current=!1,v.current=null;const de=window.scrollY<=10;p(Ee=>Ee===de?Ee:de),u(Ee=>Ee||!0),re()}))},Fe=de=>{const Ee=de.target,gr=Ee instanceof HTMLElement&&!!Ee.closest('input, textarea, select, button, a, [role="button"], [contenteditable="true"]'),Gt=()=>{f(),u(!0),window.innerWidth<=1200?(k(!0),setTimeout(()=>D.current?.focus({preventScroll:!0}),50)):setTimeout(()=>z.current?.focus({preventScroll:!0}),10)};de.key.toLowerCase()==="s"&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&!gr||(de.metaKey||de.ctrlKey)&&de.key==="k"?(de.preventDefault(),Gt()):de.key==="Escape"&&document.activeElement===z.current&&z.current?.blur()},qe=Q.current,zt=()=>{le.current=!0},Vt=()=>{le.current=!1,re()};return window.addEventListener("scroll",Xe,{passive:!0}),window.addEventListener("keydown",Fe),qe?.addEventListener("pointerenter",zt),qe?.addEventListener("pointerleave",Vt),()=>{window.removeEventListener("scroll",Xe),window.removeEventListener("keydown",Fe),qe?.removeEventListener("pointerenter",zt),qe?.removeEventListener("pointerleave",Vt),f(),v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),se.current=!1}},[d]);const z=Lt.useRef(null);w(()=>{if(ne.current&&window.clearTimeout(ne.current),!a.trim()||a.trim().length<2){c(""),S(!1);return}return ne.current=window.setTimeout(()=>{c(a.trim()),d&&S(!0)},500),()=>{ne.current&&window.clearTimeout(ne.current)}},[a,d]);const he=V(()=>{S(!1)},[]);w(()=>{S(!1),k(!1)},[W.pathname,W.search]),w(()=>{const f=ue.current;if(!f)return;const re=f.querySelector(`.${b.navLinkActive}`);if(!re){C(qe=>({...qe,opacity:0}));return}const Xe=f.getBoundingClientRect(),Fe=re.getBoundingClientRect();C({left:Fe.left-Xe.left,width:Fe.width,opacity:1})},[W.pathname]);const Le=()=>window.innerWidth<=1200,Qt=()=>{u(!0),Le()?(k(!0),setTimeout(()=>D.current?.focus({preventScroll:!0}),50)):z.current?.focus({preventScroll:!0})},Re=f=>{L.current?.contains(f.relatedTarget)||(k(!1),he())},Ce=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"},xe=f=>{Gs();const re=a.trim();re&&(he(),z.current?.blur(),m(!1),x(t==="manga"?`/manga?q=${encodeURIComponent(re)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(re)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(re)}`:`/search?query=${encodeURIComponent(re)}`))};return o(ye,{children:o("header",{ref:Q,className:`${b.header} ${l?"":b.hidden} ${h?"":b.scrolled}`,children:[o("div",{className:b.headerInner,children:[o("div",{className:b.leftSection,children:[o("button",{className:b.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(P,{name:"bars"})}),o(me,{to:"/",className:b.logo,"aria-label":"Ani-Web Home",children:[o(pt,{className:b.logoFull}),o(pt,{collapsed:!0,className:b.logoCollapsed})]}),o("nav",{className:b.desktopNav,ref:ue,children:[o("span",{className:b.navPill,style:M,"aria-hidden":"true"}),o(me,{to:"/",className:`${b.navLink} ${W.pathname==="/"?b.navLinkActive:""}`,children:"Home"}),o(me,{to:Be.to,className:`${b.navLink} ${W.pathname.startsWith(Be.to)?b.navLinkActive:""}`,children:Be.label}),t==="anime"&&o(me,{to:"/insights",className:`${b.navLink} ${W.pathname==="/insights"?b.navLinkActive:""}`,children:"Insights"})]})]}),o("div",{className:b.rightSection,children:[o("div",{className:b.searchWrapper,ref:G,onClick:()=>z.current?.focus(),children:[o("button",{type:"button",className:b.searchIconButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),xe()},children:o(P,{name:"search",className:b.searchIcon})}),o("input",{ref:z,type:"text","data-virtual-keyboard":"true",className:b.searchInput,placeholder:Ce,value:a,onChange:f=>s(f.currentTarget.value),onFocus:()=>{m(!0),u(!0),i.length>=2&&S(!0)},onBlur:f=>{m(!1),G.current?.contains(f.relatedTarget)||he()},onKeyDown:f=>{f.key==="Enter"?xe():f.key==="Escape"&&(he(),z.current?.blur())}}),o("span",{className:`${b.searchKbd} ${a||d?b.searchKbdHidden:""}`,"aria-hidden":"true",children:"Ctrl K"}),o("button",{type:"button",className:b.searchButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),Qt()},children:o(P,{name:"search",className:b.searchIconMobile})}),H&&X.length>0&&o("div",{className:`${b.searchDropdown} ${g?"":b.searchDropdownNoBar}`,onMouseDown:f=>f.preventDefault(),onClick:f=>f.stopPropagation(),children:[o("div",{className:b.searchDropdownHeader,children:[o("span",{className:b.searchDropdownQuery,children:["Results for “",i,"”"]}),o("button",{className:b.searchDropdownSeeAll,onClick:()=>{he(),k(!1),m(!1),xe()},children:"See all"})]}),o("div",{className:b.searchDropdownList,children:X.map(f=>o("button",{className:b.searchDropdownItem,onClick:()=>{he(),k(!1),m(!1),s(""),z.current?.blur(),x(f.href)},children:[f.thumb&&o(qn,{src:f.thumb,alt:f.name,className:b.searchDropdownThumb,loading:"lazy",decoding:"async"}),o("div",{className:b.searchDropdownItemInfo,children:[o("span",{className:b.searchDropdownItemTitle,children:f.name}),f.meta&&o("span",{className:b.searchDropdownItemMeta,children:f.meta})]})]},f.key))})]})]}),o(Us,{}),o(me,{to:"/settings",className:b.profileBtn,"aria-label":`${J?.name??"Profile"} — profile settings`,title:`${J?.name??"Profile"}${J?.owner?" (owner)":""} — profile settings`,children:[o("span",{className:b.profileAvatar,"aria-hidden":"true",children:o(Nt,{image:J?.image,name:J?.name??"Profile"})}),o("span",{className:b.profileName,children:J?.name??"Profile"})]})]})]}),g&&o("div",{className:`${b.mobileSearchBar} ${l?"":b.mobileSearchBarHidden}`,ref:L,onBlur:Re,children:o("div",{className:b.mobileSearchInner,children:[o(P,{name:"search",className:b.mobileSearchIcon}),o("input",{ref:D,type:"text","data-virtual-keyboard":"true",className:b.mobileSearchInput,placeholder:Ce,value:a,onChange:f=>s(f.currentTarget.value),onFocus:()=>{m(!0),u(!0)},onBlur:()=>m(!1),onKeyDown:f=>{f.key==="Enter"?(xe(),k(!1),m(!1)):f.key==="Escape"&&(k(!1),m(!1),he())}})]})})]})})},Ct="agreedToViewMature";function xt(){try{return ee.getItem(Ct)==="true"}catch{return!1}}const Ue=new Set;function ar(e){for(const t of Ue)t(e)}function ot(){ar(xt())}function fn(e){try{e?ee.setItem(Ct,"true"):ee.removeItem(Ct)}catch{}ar(e)}function zi(){const[e,t]=y(xt);w(()=>(Ue.add(t),Ue.size===1&&(window.addEventListener("storage",ot),window.addEventListener("focus",ot)),t(xt()),()=>{Ue.delete(t),Ue.size===0&&(window.removeEventListener("storage",ot),window.removeEventListener("focus",ot))}),[]);const n=V(()=>fn(!0),[]),r=V(()=>fn(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const Vi="_sidebar_1431e_1",Gi="_open_1431e_20",Ji="_sidebarHeader_1431e_25",Yi="_closeBtn_1431e_35",Zi="_logo_1431e_64",Xi="_navSection_1431e_78",ec="_navLink_1431e_85",tc="_active_1431e_115",nc="_overlay_1431e_124",rc="_versionInfo_1431e_145",ge={sidebar:Vi,open:Gi,sidebarHeader:Ji,closeBtn:Yi,logo:Zi,navSection:Xi,navLink:ec,active:tc,overlay:nc,versionInfo:rc},oc="4.0.3",sr={version:oc},ac=()=>{const{isOpen:e,setIsOpen:t}=Mt(),{contentType:n}=Bt(),{hasConsent:r}=zi(),a=()=>{t(!1)},s=n==="manga",i=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(P,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(P,{name:"book"}),label:"Manga"}:i?{to:"/tv-search",icon:o(P,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(P,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(P,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(P,{name:"bookmark"}),label:"Reading List"}:i?{to:"/tv-watchlist",icon:o(P,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(P,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(P,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(P,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(P,{name:"sync-alt"}),label:"Trackers"},...n==="anime"||i?[{to:"/watch-along",icon:o(P,{name:"play"}),label:"Watch along"}]:[],...r?[{to:"/mature",icon:o(P,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(P,{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:a,children:o(pt,{})})}),o("button",{className:ge.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:o(P,{name:"chevron-left",size:18})}),o("nav",{className:ge.navSection,children:l.map(u=>o(vr,{to:u.to,className:({isActive:d})=>`${ge.navLink} ${d?ge.active:""}`,onClick:a,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:ge.versionInfo,children:["v",sr.version]})]}),e&&o("div",{className:ge.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},sc="_footer_13o90_1",ic="_footerInner_13o90_16",cc="_brandSection_13o90_28",lc="_logoRow_13o90_40",uc="_logoText_13o90_54",dc="_brandMeta_13o90_61",mc="_brandTagline_13o90_70",pc="_statusPill_13o90_77",hc="_statusDot_13o90_90",fc="_linksGrid_13o90_98",gc="_linkColumn_13o90_106",yc="_columnTitle_13o90_112",vc="_bottomBar_13o90_136",bc="_copyright_13o90_146",wc="_brand_13o90_28",_c="_heartIcon_13o90_162",kc="_backToTop_13o90_167",F={footer:sc,footerInner:ic,brandSection:cc,logoRow:lc,logoText:uc,brandMeta:dc,brandTagline:mc,statusPill:pc,statusDot:hc,linksGrid:fc,linkColumn:gc,columnTitle:yc,bottomBar:vc,copyright:bc,brand:wc,heartIcon:_c,backToTop:kc},Ec=()=>{const e=new Date().getFullYear(),t=Je(),n=()=>{window.scrollTo({top:0,behavior:"smooth"})},r=a=>{t.pathname==="/"&&(a.preventDefault(),n())};return o("footer",{className:F.footer,children:[o("div",{className:F.footerInner,children:[o("div",{className:F.brandSection,children:[o("div",{className:F.logoRow,children:o(me,{to:"/",onClick:r,"aria-label":"Home",children:o(pt,{collapsed:!0,className:F.logoText})})}),o("div",{className:F.brandMeta,children:[o("div",{className:F.statusPill,children:[o("span",{className:F.statusDot}),o("span",{children:["v",sr.version]})]}),o("p",{className:F.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:F.linksGrid,children:[o("div",{className:F.linkColumn,children:[o("h4",{className:F.columnTitle,children:"Navigation"}),o(me,{to:"/",children:"Home"}),o(me,{to:"/watchlist",children:"Watchlist"}),o(me,{to:"/settings",children:"Settings"})]}),o("div",{className:F.linkColumn,children:[o("h4",{className:F.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:F.linkColumn,children:[o("h4",{className:F.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(P,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(P,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:F.linkColumn,children:[o("h4",{className:F.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:F.bottomBar,children:[o("p",{className:F.copyright,children:["© ",e," ",o("span",{className:F.brand,children:"dango"})," • Crafted with"," ",o(P,{name:"heart",className:F.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:F.backToTop,onClick:n,"aria-label":"Back to top",children:[o(P,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})},bt=e=>{const t=A();return j({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},ir=()=>{const e=A(),t=ae();return pe(e.settings.set.mutationOptions({onSuccess:()=>{I.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[N.settings]})},onError:n=>{I.error(`Failed to update setting: ${n.message}`)}}))};function cr(e){return JSON.stringify({0:e??{}})}function lr(e){return`/api/trpc/${e}?batch=1&_profile=${encodeURIComponent(Qn())}`}function Ot(e,t){const n=cr(t),r=lr(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 ed(e,t){const n=await fetch(lr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:cr(t),keepalive:!0});if(!n.ok)throw new Error(`tRPC request failed (HTTP ${n.status})`)}function td(e){e&&(Ot("discord.clear",{sessionId:e}),Ot("discord.heartbeat",{sessionId:e,bye:!0}))}function Sc(){const e=Je(),{contentType:t}=Bt(),{data:n}=bt("discordRPCEnabled"),r=q("");r.current||(r.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),w(()=>{if(n===!1||n==="false")return;const a=r.current,s=()=>te.discord.heartbeat.mutate({sessionId:a}).catch(()=>{});s();const i=setInterval(s,15e3),c=()=>{Ot("discord.heartbeat",{sessionId:a,bye:!0})};return window.addEventListener("pagehide",c),()=>{clearInterval(i),window.removeEventListener("pagehide",c)}},[n]),w(()=>{if(n===!1||n==="false")return;const a=e.pathname;if(a.startsWith("/watch/")||a.startsWith("/player/"))return;let s="home";a==="/search"||a==="/mature"?s="search-anime":a==="/tv"||a==="/tv-search"?s="search-tv":a==="/manga"?s="search-manga":a==="/asmr"?s="search-asmr":a.startsWith("/watchlist")?s="watchlist":a.startsWith("/anime/")?s="anime":a.startsWith("/insights")?s="insights":a.startsWith("/settings")?s="settings":a.startsWith("/trackers")?s="trackers":a.startsWith("/tv/")?s="tv":a.startsWith("/manga/")?s="manga":a.startsWith("/asmr/")&&(s="asmr"),a==="/"&&(s=`home-${t}`),te.discord.pageStatus.mutate({page:s,sessionId:r.current}).catch(()=>{})},[e.pathname,t,n])}function Kt(e,t){const[n,r]=y(()=>{try{const s=ee.getItem(e);if(s===null)return t;if(typeof t=="string")return s;try{return JSON.parse(s)}catch{return s}}catch{return t}});w(()=>{const s=i=>{if(i.key===ee.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",s),()=>window.removeEventListener("storage",s)},[e,t]);const a=V(s=>{r(i=>{const c=typeof s=="function"?s(i):s;try{typeof c=="string"?ee.setItem(e,c):ee.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,a]}const ur=be(void 0),Tc=()=>{const e=we(ur);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},Pc="_container_e96gf_1",Ic="_field_e96gf_9",Nc="_textarea_e96gf_20",Cc="_input_e96gf_40",xc="_button_e96gf_58",Oc="_secondaryButton_e96gf_78",Ac="_actions_e96gf_95",Lc="_hint_e96gf_104",Rc="_link_e96gf_117",ie={container:Pc,field:Ic,textarea:Nc,input:Cc,button:xc,secondaryButton:Oc,actions:Ac,hint:Lc,link:Rc},qc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Dc=e=>{try{return JSON.parse(e.detail)}catch{return null}},$c=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,a]=y(1),[s,i]=y(navigator.userAgent),[c,l]=y(""),[u,d]=y(!1),m=q(null),h=navigator.userAgent,p=/android/i.test(h),g=/firefox|fxios/i.test(h)&&!p,k=!g&&!p&&/chrome|chromium|edg|brave/i.test(h),M=g||k;w(()=>{e&&(a(1),i(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const C=()=>{window.open("https://animepahe.pw","_blank","noopener,noreferrer"),a(2)},H=()=>{if(u)return;d(!0);const x=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,W=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),I.error("Helper not detected - install it via about:debugging first.")},3e3),B=se=>{const v=Dc(se);if(!(!v||v.requestId!==x))if(window.clearTimeout(W),window.removeEventListener("dango:pahe-cookie",B),m.current=null,d(!1),v?.ok&&v.cookie)l(v.cookie),I.success("Cookie extracted from helper!");else if(v?.error==="NO_COOKIE"){const L=v.debug?.stores?.length??0,D=v.debug?.names??[];I.error(`Helper found no cf_clearance (checked ${L} stores, saw: ${D.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else I.error("Helper request failed - try again.")};m.current=B,window.addEventListener("dango:pahe-cookie",B),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:x}}))},S=()=>{const x=c.trim();if(!x){I.error("Please enter the cf_clearance cookie");return}try{ee.setItem("animepahe_ua",s),ee.setItem("animepahe_cookie",x),I.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{I.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:s,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:C,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."]}),M&&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:qc,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:H,disabled:u,type:"button",children:u?"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:x=>l(x.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:()=>a(1),children:"Back"}),o("button",{className:ie.button,onClick:S,children:"Submit"})]})]})})})};function gn(){const[e,t]=y(!1);return w(()=>{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 jc="_screen_1pca0_1",Mc="_icon_1pca0_14",Bc="_title_1pca0_20",Fc="_text_1pca0_24",Wc="_button_1pca0_29",Ke={screen:jc,icon:Mc,title:Bc,text:Fc,button:Wc};async function Kc(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 Uc extends br{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n),Kc(t,n)}render(){return this.state.hasError?o("div",{className:Ke.screen,children:[o(P,{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(P,{name:"home"}),"Go back Home"]})]}):this.props.children}}const dr=be(void 0),Hc=()=>{const e=we(dr);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Qc=({children:e})=>{const[t,n]=y(!1),r=V(()=>n(!0),[]),a=V(()=>n(!1),[]);return w(()=>Hn("lan",r),[r]),o(dr.Provider,{value:{isOpen:t,openModal:r,closeModal:a},children:e})},zc="_container_88bss_1",Vc="_field_88bss_8",Gc="_input_88bss_19",Jc="_actions_88bss_37",at={container:zc,field:Vc,input:Gc,actions:Jc},He=wr(({variant:e="primary",size:t="md",loading:n,children:r,className:a="",disabled:s,...i},c)=>{const l=Xa("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",a);return o("button",{className:l,disabled:s||n,ref:c,...i,children:n?o("span",{className:"btn-spinner"}):r})}),mr=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,a]=y(""),[s,i]=y(!1);Lt.useEffect(()=>{e&&a("")},[e]);const c=async()=>{if(!r){I.error("Please enter your password");return}i(!0);try{const l=await $t("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){I.error(u.error||"Login failed");return}I.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{I.error("Network error")}finally{i(!1)}};return o(Me,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:at.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:at.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>a(l.currentTarget.value),placeholder:"Enter password...",className:at.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:at.actions,children:[o(He,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(He,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},Yc="_notice_1d75r_1",Zc={notice:Yc},Xc=2600,el=1e4,tl={anilist:"Updating AniList…",mal:"Updating MyAnimeList…"};function nl({enabled:e=!0}){const[t,n]=y(!1),[r,a]=y("mal"),[s,i]=y(document.fullscreenElement);return w(()=>{const c=()=>i(document.fullscreenElement);return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[]),w(()=>{if(!e||typeof EventSource>"u")return;const c=new EventSource("/api/tracker/activity"),l=new Map;let u;const d=new Set;let m=-1/0;const h=p=>{let g;try{g=JSON.parse(p.data)}catch{return}const k=g.provider;k!=="anilist"&&k!=="mal"||(g.updating===!0?(clearTimeout(l.get(k)),d.size===0&&Date.now()-m>=el&&(m=Date.now(),a(k),n(!0),clearTimeout(u),u=setTimeout(()=>n(!1),Xc)),d.add(k)):g.updating===!1&&(clearTimeout(l.get(k)),l.set(k,setTimeout(()=>d.delete(k),1500))))};return c.addEventListener("tracker-activity",h),()=>{c.removeEventListener("tracker-activity",h),c.close(),clearTimeout(u);for(const p of l.values())clearTimeout(p);n(!1)}},[e]),!e||!t?null:Tn(o("div",{className:Zc.notice,role:"status","aria-live":"polite","aria-atomic":"true",children:[o(P,{name:r==="anilist"?"anilist":"myanimelist",size:15}),o("span",{children:tl[r]})]}),s||document.body)}const rl=K(()=>U(()=>import("./Home-DBefqglV.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]))),ol=K(()=>U(()=>import("./Watchlist-D4HJr6pg.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]))),al=K(()=>U(()=>import("./Settings-fCV1C7Pa.js"),__vite__mapDeps([42,1,2,4,43,44,16,9,10,45]))),yn=K(()=>U(()=>import("./Player-DnWze_gB.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]))),sl=K(()=>U(()=>import("./WatchAlong-BfHji5Zr.js"),__vite__mapDeps([58,1,55,56,2,4]))),il=K(()=>U(()=>import("./Search-DiUbhvfg.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]))),cl=K(()=>U(()=>import("./Mature-I-5BXxqP.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]))),vn=K(()=>U(()=>import("./Asmr-D562WT1y.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]))),ll=K(()=>U(()=>import("./Manga-CW-xSa6W.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]))),ul=K(()=>U(()=>import("./MangaInfoPage-B2eqiI6S.js"),__vite__mapDeps([72,1,4,19,20,70,71,25,2,26,66,67]))),dl=K(()=>U(()=>import("./MangaReadPage-DU_pWeC4.js"),__vite__mapDeps([73,1,19,4,20,2,70,71,25,26,66,67]))),ml=K(()=>U(()=>import("./ReadingList-Dadozt41.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]))),bn=K(()=>U(()=>import("./TvSearch-Bu1r0z8j.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]))),pl=K(()=>U(()=>import("./TvInfo-BEaENXW9.js"),__vite__mapDeps([77,1,4,32,2,26,78]))),hl=K(()=>U(()=>import("./Tv-Dbih_6wX.js"),__vite__mapDeps([79,1,47,4,48,2,49,16,50,80,9,10,29,32,26,7,53,54,55,56,81]))),fl=K(()=>U(()=>import("./TvWatchlist-DjZxyCqC.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]))),gl=K(()=>U(()=>import("./ListeningList-BJJzg0gb.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]))),yl=K(()=>U(()=>import("./Trackers-DvRqGHrx.js"),__vite__mapDeps([84,1,2,4,85]))),vl=K(()=>U(()=>import("./Insights-C57WhdmV.js"),__vite__mapDeps([86,1,2,4,5,6,7,8,9,10,87]))),bl=K(()=>U(()=>import("./AnimeInfoPage-BK1gsbaN.js"),__vite__mapDeps([88,1,2,4]))),wl=K(()=>U(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([89,1]))),_l=K(()=>U(()=>import("./VirtualKeyboard-otEdnEQ2.js"),__vite__mapDeps([90,1,2,4,91])));function kl(){const{isOpen:e,closeModal:t,onSuccess:n}=Tc(),{isOpen:r,setIsOpen:a}=Mt(),{isOpen:s,openModal:i,closeModal:c}=Hc(),l=Je(),u=_r(),d=q(new Map),m=q(l.pathname),h=q(l.key),p=q(null),[g,k]=y(!1),M=Js();Sc();const{data:C}=bt("frozenMode"),H=C==="true"||C===!0,[S,x]=y(!1);w(()=>{const v=new AbortController;return De("/api/auth/app-status",{signal:v.signal}).then(L=>{L.hasPassword&&!L.isAuthenticated&&(x(!0),i())}).catch(()=>{v.signal.aborted||I.error("Could not check server access. The server may still be starting; reload to retry.")}),()=>v.abort()},[i]);const[W,B]=Kt("lan_auth_notice_shown","false"),se=q(!1);return w(()=>{if(W==="true"||se.current)return;se.current=!0,B("true");const v=setTimeout(()=>{I("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(v)},[W,B]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const v=l.key,L=d.current;if(u==="POP"){const D=L.get(v)??0;window.scrollTo({top:D,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{L.set(v,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const v=()=>{k(!0),p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{k(!1),p.current=null},1e4)},L=Q=>{if(Q.defaultPrevented||Q.button!==0||Q.metaKey||Q.ctrlKey||Q.shiftKey||Q.altKey)return;const le=Q.target;if(!(le instanceof Element))return;const ne=le.closest("a[href]");if(!ne||ne.hasAttribute("download")||ne.getAttribute("target")==="_blank")return;const ue=new URL(ne.href,window.location.href);ue.origin===window.location.origin&&`${ue.pathname}${ue.search}${ue.hash}`!=`${window.location.pathname}${window.location.search}${window.location.hash}`&&v()},D=()=>v();return document.addEventListener("click",L,!0),window.addEventListener("popstate",D),()=>{document.removeEventListener("click",L,!0),window.removeEventListener("popstate",D),p.current!==null&&(window.clearTimeout(p.current),p.current=null)}},[]),w(()=>{h.current!==l.key&&(h.current=l.key,g&&(p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{k(!1),p.current=null},500)))},[l.key,g]),w(()=>{const v=L=>{r&&L.key==="Escape"&&a(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v),document.body.classList.remove("sidebar-open")}},[r,a]),o("div",{className:"app-container",children:[o($c,{isOpen:e,onClose:t,onSuccess:n}),o(mr,{isOpen:s,onClose:S?()=>{}:c,onSuccess:()=>{x(!1),c()}}),o(Rn,{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(gn,{}),H&&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(nl,{enabled:!S&&!s}),o(Qi,{}),o(ac,{}),o("main",{className:"main-content",children:o(Uc,{children:o(Jt,{fallback:o(gn,{}),children:o(kr,{children:[o(R,{path:"/",element:o(rl,{})}),o(R,{path:"/watchlist/:filter?",element:o(ol,{})}),o(R,{path:"/reading-list/:filter?",element:o(ml,{})}),o(R,{path:"/search",element:o(il,{})}),o(R,{path:"/mature",element:o(cl,{})}),o(R,{path:"/asmr",element:o(vn,{})}),o(R,{path:"/asmr/:rj",element:o(vn,{})}),o(R,{path:"/manga",element:o(ll,{})}),o(R,{path:"/manga/:provider/:id",element:o(ul,{})}),o(R,{path:"/manga/:provider/:id/read",element:o(dl,{})}),o(R,{path:"/tv",element:o(bn,{})}),o(R,{path:"/tv/:id",element:o(pl,{})}),o(R,{path:"/tv/:id/watch",element:o(hl,{})}),o(R,{path:"/tv-search",element:o(bn,{})}),o(R,{path:"/tv-watchlist/:filter?",element:o(fl,{})}),o(R,{path:"/listening-list/:filter?",element:o(gl,{})}),o(R,{path:"/settings",element:o(al,{})}),o(R,{path:"/trackers",element:o(yl,{})}),o(R,{path:"/mal",element:o(Yt,{to:"/trackers",replace:!0})}),o(R,{path:"/insights",element:o(vl,{})}),o(R,{path:"/anime/:id",element:o(bl,{})}),o(R,{path:"/watch/:id",element:o(yn,{})}),o(R,{path:"/watch-along",element:o(sl,{})}),o(R,{path:"/watch/:id/:episodeNumber",element:o(yn,{})}),o(R,{path:"/player/:id/:episodeNumber?",element:o(wl,{})}),o(R,{path:"*",element:o(Yt,{to:"/",replace:!0})})]})})})}),o(Ec,{}),M.isVisible&&o(Jt,{fallback:null,children:o(_l,{activeInputRef:M.activeInputRef,isVisible:M.isVisible,onClose:M.hide})})]})}function El(){return o(Qc,{children:o(kl,{})})}const Sl=({children:e})=>{const[t,n]=y(!1),r=V(()=>{n(s=>!s)},[]),a=je(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(nr.Provider,{value:a,children:e})},Tl=({children:e})=>{const[t,n]=Kt("dango_content_type","anime"),r=je(()=>({contentType:t,setContentType:n}),[t,n]);return o(rr.Provider,{value:r,children:e})},Pl=({children:e})=>{const[t,n]=y("englishName"),[r,a]=y(!0);w(()=>{(async()=>{try{const c=await te.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{a(!1)}})()},[]);const s=je(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(Yn.Provider,{value:s,children:e})},pr=be(void 0),nd=()=>{const e=we(pr);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},Il=({children:e})=>{const{data:t,isLoading:n}=bt("lowEndMode"),r=ir(),a=ae(),[s,i]=y(!1);w(()=>{const u=a.getDefaultOptions();a.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,a]),w(()=>{t!==void 0&&i(t==="true"||t===!0)},[t]),w(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=V(u=>{i(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=je(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(pr.Provider,{value:l,children:e})},hr=be(void 0),rd=()=>{const e=we(hr);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},od=[{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"}],Nl=["iris","mochi","sakura"];function wn(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Cl=({children:e})=>{const{data:t,isLoading:n}=bt("theme"),r=ir(),[a,s]=y("iris");w(()=>{typeof t=="string"&&Nl.includes(t)&&s(t)},[t]),w(()=>{wn(a)},[a]);const i=V(l=>{l!==a&&(s(l),wn(l),r.mutate({key:"theme",value:l}))},[r,a]),c=je(()=>({theme:a,setTheme:i,loading:n}),[a,i,n]);return o(hr.Provider,{value:c,children:e})},xl=({children:e})=>{const[t,n]=y(!1),[r,a]=y(void 0),s=V(c=>{a(()=>c),n(!0)},[]),i=V(()=>{n(!1),a(void 0)},[]);return w(()=>Hn("animepahe",()=>s()),[s]),o(ur.Provider,{value:{isOpen:t,openModal:s,closeModal:i,onSuccess:r},children:e})},Ol="_gate_1ex8w_1",Al="_gateExiting_1ex8w_21",Ll="_appEntering_1ex8w_27",Rl="_gateInner_1ex8w_100",ql="_connecting_1ex8w_110",Dl="_connectingLogo_1ex8w_118",$l="_connectingDots_1ex8w_128",jl="_gateTitle_1ex8w_149",Ml="_profileGrid_1ex8w_157",Bl="_profileCard_1ex8w_165",Fl="_profileCardAvatar_1ex8w_216",Wl="_addAvatar_1ex8w_245",Kl="_profileCardName_1ex8w_255",Ul="_ownerTag_1ex8w_265",Hl="_lockBadge_1ex8w_273",Ql="_gatePanel_1ex8w_288",zl="_panelAvatar_1ex8w_302",Vl="_panelTitle_1ex8w_308",Gl="_gateForm_1ex8w_314",Jl="_gateField_1ex8w_320",Yl="_gateHint_1ex8w_346",Zl="_gateError_1ex8w_353",Xl="_backButton_1ex8w_359",eu="_form_1ex8w_444",tu="_field_1ex8w_457",nu="_avatarRow_1ex8w_474",ru="_uploadButton_1ex8w_486",ou="_fileInput_1ex8w_515",au="_profileList_1ex8w_528",su="_smallAvatar_1ex8w_541",iu="_profileName_1ex8w_546",T={gate:Ol,gateExiting:Al,appEntering:Ll,gateInner:Rl,connecting:ql,connectingLogo:Dl,connectingDots:$l,gateTitle:jl,profileGrid:Ml,profileCard:Bl,profileCardAvatar:Fl,addAvatar:Wl,profileCardName:Kl,ownerTag:Ul,lockBadge:Hl,gatePanel:Ql,panelAvatar:zl,panelTitle:Vl,gateForm:Gl,gateField:Jl,gateHint:Yl,gateError:Zl,backButton:Xl,form:eu,field:tu,avatarRow:nu,uploadButton:ru,fileInput:ou,profileList:au,smallAvatar:su,profileName:iu},Ut="dango:entering-profile";function cu(){try{return!!sessionStorage.getItem(Ut)}catch{return!1}}function _n(){try{sessionStorage.setItem(Ut,String(Date.now()))}catch{}}function lu({children:e}){const[t,n]=y(!1),[r,a]=y(!1),[s,i]=y(()=>cu()),[c,l]=y(!0),[u,d]=y(!1),[m,h]=y(!1),[p,g]=y([]),[k,M]=y(""),[C,H]=y("pick"),[S,x]=y(""),[W,B]=y(""),[se,v]=y(!1),[L,D]=y(0),[Q,le]=y(""),[ne,ue]=y(""),[G,J]=y("");w(()=>{let _=!1,X;B(""),l(!0),d(!1);let z=!1;const he=setTimeout(()=>{_||(z=!0,d(!0))},500),Le=()=>{he&&clearTimeout(he),d(!1)};return(async()=>{const Re=await De("/api/auth/app-status");if(_)return;if(Re.hasPassword&&!Re.isAuthenticated){h(!0),Le(),l(!1);return}const Ce=await De("/api/profiles/status");if(!_)if(Ce.current){Ra(Ce.current.id);const Be=window.matchMedia("(prefers-reduced-motion: reduce)").matches,xe=z&&!Be;xe&&a(!0),X=setTimeout(()=>{if(!_){Le(),n(!0),a(!1),l(!1);try{sessionStorage.removeItem(Ut)}catch{}}},xe?280:0)}else Le(),g(Ce.profiles),M(Ce.profiles[0]?.id??""),l(!1)})().catch(Re=>{_||(Le(),B(Re.message),l(!1))}),()=>{_=!0,X&&clearTimeout(X),he&&clearTimeout(he)}},[L]),w(()=>{const _=z=>{z.key==="dango:profile-session-change"&&(_n(),window.location.reload())},X=()=>{n(!1),a(!1),i(!1),D(z=>z+1)};return window.addEventListener("storage",_),window.addEventListener("dango:profile-auth-required",X),()=>{window.removeEventListener("storage",_),window.removeEventListener("dango:profile-auth-required",X)}},[]);const $=async(_,X)=>{v(!0),B("");try{await De("/api/profiles/login",{method:"POST",body:JSON.stringify({id:_,password:X})}),_n(),Da()}catch(z){B(z.message),v(!1)}},fe=_=>{B(""),x(""),M(_.id),_.protected?H("password"):$(_.id,"")},Ze=()=>{H("pick"),x(""),B("")};if(t)return s?o("div",{className:T.appEntering,children:e}):e;const Ne=p.find(_=>_.id===k);return c&&!u&&!W&&!m?o("div",{className:T.gate,"aria-hidden":"true"}):o("div",{className:`${T.gate}${r?` ${T.gateExiting}`:""}`,children:[o(Rn,{}),o(mr,{isOpen:m,onClose:()=>{},onSuccess:()=>{h(!1),D(_=>_+1)}}),C==="pick"&&c&&u&&!p.length&&!W&&!m&&o("section",{className:T.gateInner,"aria-busy":"true","aria-label":"Connecting to Dango",children:o("div",{className:T.connecting,children:[o("span",{className:T.connectingLogo,"aria-hidden":"true"}),o("h1",{className:T.gateTitle,children:"Connecting to Dango"}),o("span",{className:T.connectingDots,"aria-hidden":"true",children:[o("span",{}),o("span",{}),o("span",{})]})]})}),C==="pick"&&!c&&o("section",{className:T.gateInner,children:[o("h1",{className:T.gateTitle,children:p.length?"Who's watching?":"Dango"}),p.length>0&&o("div",{className:T.profileGrid,children:[p.map(_=>o("button",{type:"button",className:T.profileCard,disabled:se,onClick:()=>fe(_),children:[o("span",{className:T.profileCardAvatar,children:[o(Nt,{image:_.avatar??_.cloudAvatar,name:_.name,size:"100%",radius:"var(--radius-sm)"}),_.protected&&o("span",{className:T.lockBadge,"aria-hidden":"true",children:o(P,{name:"lock",size:"0.85rem"})})]}),o("span",{className:T.profileCardName,children:[_.name,_.owner&&o("span",{className:T.ownerTag,children:"Owner"})]})]},_.id)),o("button",{type:"button",className:T.profileCard,disabled:se,onClick:()=>{B(""),H("create")},children:[o("span",{className:`${T.profileCardAvatar} ${T.addAvatar}`,children:o(P,{name:"plus",size:40})}),o("span",{className:T.profileCardName,children:"Add profile"})]})]}),W&&o(ye,{children:[o("p",{role:"alert",className:T.gateError,children:W}),!p.length&&o(He,{variant:"secondary",onClick:()=>D(_=>_+1),children:"Retry"})]})]}),C==="password"&&Ne&&o("section",{className:T.gatePanel,children:[o("button",{type:"button",className:T.backButton,onClick:Ze,children:[o(P,{name:"chevron-left"}),"Back"]}),o("div",{className:T.panelAvatar,children:o(Nt,{image:Ne.avatar??Ne.cloudAvatar,name:Ne.name,size:"100%",radius:"18%"})}),o("h2",{className:T.panelTitle,children:Ne.name}),o("form",{className:T.gateForm,onSubmit:_=>{_.preventDefault(),$(k,S)},children:[o("label",{className:T.gateField,children:["Password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:S,onChange:_=>x(_.currentTarget.value)})]}),o(He,{type:"submit",className:"btn-block",loading:se,children:"Continue"})]}),W&&o("p",{role:"alert",className:T.gateError,children:W})]},"password"),C==="create"&&o("section",{className:T.gatePanel,children:[o("button",{type:"button",className:T.backButton,onClick:Ze,children:[o(P,{name:"chevron-left"}),"Back"]}),o("h2",{className:T.panelTitle,children:"Add a profile"}),o("p",{className:T.gateHint,children:"Enter the owner password to create a new profile."}),o("form",{className:T.gateForm,onSubmit:async _=>{_.preventDefault(),v(!0),B("");try{const X=await De("/api/profiles/create",{method:"POST",body:JSON.stringify({name:ne,password:G,ownerPassword:Q})});g(z=>[...z,X]),le(""),ue(""),J(""),H("pick"),M(X.id),X.protected?H("password"):await $(X.id,"")}catch(X){B(X.message)}finally{v(!1)}},children:[o("label",{className:T.gateField,children:["Owner password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:Q,onChange:_=>le(_.currentTarget.value)})]}),o("label",{className:T.gateField,children:["Profile name",o("input",{required:!0,maxLength:60,value:ne,onChange:_=>ue(_.currentTarget.value)})]}),o("label",{className:T.gateField,children:["Profile password (optional)",o("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:G,onChange:_=>J(_.currentTarget.value)})]}),o(He,{type:"submit",className:"btn-block",loading:se,children:"Create profile"})]}),W&&o("p",{role:"alert",className:T.gateError,children:W})]},"create")]})}const fr=be(null);function ad(){const e=we(fr);if(!e)throw new Error("WatchAlongProvider is missing");return e}const uu=/^[0-9a-f-]{36}$/,du=/^[0-9a-f]{64}$/;function sd(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 id(e,t){return e.position+(e.playing?Math.max(0,t-e.updatedAt)/1e3*e.rate:0)}const At="dango-watch-along",Ht="dango-watch-along-host";function kn(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=Qe(`${t.id}.${t.guestToken}`,""),r=Qe(`${t.id}.${t.token}`,"");return{...n,token:r.token,host:t.host===!0}}function mu(){try{return kn(JSON.parse(sessionStorage.getItem(At)||"null"))??kn(JSON.parse(localStorage.getItem(Ht)||"null"))}catch{return null}}function pu(e){try{e?sessionStorage.setItem(At,JSON.stringify(e)):sessionStorage.removeItem(At),e?.host&&localStorage.setItem(Ht,JSON.stringify(e))}catch{}}function st(){try{localStorage.removeItem(Ht)}catch{}}function hu(e){return e.kind==="tv"||e.kind==="movie"?Xs(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 Qe(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,a,s]=n.split(".");if(!uu.test(r||"")||!du.test(a||"")||s!==void 0)throw new Error("Paste a complete watch-along invite link or room code.");return{id:r,token:a,guestToken:a,host:!1}}function fu({children:e}){const t=Pn(),n=Je(),[r,a]=Kt("watchAlongName",""),[s,i]=y(mu),[c,l]=y(null),[u,d]=y(!1),[m,h]=y(""),[p,g]=y(""),[k,M]=y({offset:0,latency:0}),C=q(null),{data:H}=j({queryKey:["watch-along-config"],queryFn:()=>te.settings.watchAlong.query()}),S=H?.workerUrl.replace(/\/$/,"")||"";w(()=>{pu(s)},[s]);const x=V(v=>{C.current?.readyState===WebSocket.OPEN&&C.current.send(JSON.stringify(v))},[]);w(()=>{if(!u)return;const v=setTimeout(()=>x({type:"name",name:r}),250);return()=>clearTimeout(v)},[u,p,r,x]);const W=V(()=>{s?.host&&x({type:"end"}),C.current?.close(1e3,"Left room"),st(),i(null),l(null),d(!1),h("")},[x,s]),B=async v=>{if(!S)throw new Error("Watch along is unavailable. Check your server configuration.");const L=await fetch(`${S}/rooms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v),signal:AbortSignal.timeout(15e3)}),D=await L.json();if(!L.ok)throw new Error(D.error||"Could not create room");const Q=Qe(`${D.id}.${D.guestToken}`,S),le=Qe(`${D.id}.${D.hostToken}`,S);h(""),l(null),i({...Q,token:le.token,host:!0})},se=v=>{if(!S)throw new Error("Watch along is unavailable. Check your server configuration.");const L=Qe(v,S);st(),h(""),l(null),i(L)};return w(()=>{if(!s||!S)return;let v=!1,L=0,D,Q,le=Date.now();const ne=async()=>{if(v)return;try{const J=await fetch(`${S}/rooms/${s.id}`,{headers:{Authorization:`Bearer ${s.token}`},signal:AbortSignal.timeout(1e4)});if(v)return;if(!J.ok){const $=await J.json();if([403,404,409].includes(J.status)){h($.error||"Unable to join room"),st(),i(null),l(null);return}throw new Error($.error||"Room service unavailable")}}catch{if(v)return;h("Cannot reach the room service. Retrying…"),D=setTimeout(ne,Math.min(15e3,1e3*2**Math.min(L++,4)));return}const ue=new URL(`${S}/rooms/${s.id}/ws`);ue.protocol=ue.protocol==="https:"?"wss:":"ws:";const G=new WebSocket(ue,["dango-watch-along",s.token]);C.current=G,G.onopen=()=>{le=Date.now()},G.onmessage=J=>{if(!(v||C.current!==G)){le=Date.now();try{const $=JSON.parse(J.data);if($.type==="joined"){if($.host!==s.host){G.close(4003,"Invalid role");return}L=0,d(!0),h(""),g($.id),G.send(JSON.stringify({type:"ping",sentAt:Date.now()}))}else if($.type==="state")l(fe=>fe&&fe.revision>$.state.revision?fe:$.state);else if($.type==="pong"){const fe=Date.now()-$.sentAt;M({offset:$.serverTime-($.sentAt+fe/2),latency:fe/2})}else $.type==="error"&&h($.error)}catch{h("Invalid response from the room service.")}}},G.onclose=J=>{if(!(v||C.current!==G)){if(clearInterval(Q),d(!1),[4003,4004,4009].includes(J.code)){h(J.reason||"Room closed"),J.code!==4009&&st(),i(null),l(null);return}h("Connection lost. Reconnecting…"),D=setTimeout(ne,Math.min(15e3,1e3*2**Math.min(L++,4)))}},G.onerror=()=>G.close(),Q=setInterval(()=>{Date.now()-le>25e3?G.close():G.readyState===WebSocket.OPEN&&G.send(JSON.stringify({type:"ping",sentAt:Date.now()}))},1e4)};return ne(),()=>{v=!0,clearTimeout(D),clearInterval(Q),C.current?.close(1e3,"Leaving connection"),C.current=null,d(!1)}},[s,S]),w(()=>{if(!s||s.host||!c)return;const v=hu(c.selection);`${n.pathname}${n.search}`!==v&&t(v,{replace:!0})},[s,c,n.pathname,n.search,t]),o(fr.Provider,{value:{workerUrl:S,displayName:r,setDisplayName:a,session:s,room:c,connected:u,error:m,selfId:p,clock:k,create:B,join:se,leave:W,send:x},children:e})}try{window.history.scrollRestoration="manual"}catch{}const En=new Ir({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),Sn=document.getElementById("root");Sn&&Er(o(lu,{children:o(Sr,{children:o(Ba,{trpcClient:te,queryClient:En,children:o(Nr,{client:En,children:o(xl,{children:o(Sl,{children:o(Tl,{children:o(Pl,{children:o(Il,{children:o(Cl,{children:o(fu,{children:o(El,{})})})})})})})})})})})}),Sn);export{od as $,Lu as A,He as B,Fu as C,qu as D,ku as E,qn as F,Zu as G,Wu as H,Du as I,Ru as J,I as K,bt as L,zu as M,ir as N,Mu as O,Bu as P,ju as Q,Me as R,Ys as S,Qu as T,De as U,T as V,Nt as W,Da as X,$t as Y,Y as Z,rd as _,Kt as a,dn as a0,or as a1,un as a2,U as a3,_t as a4,_u as a5,ie as a6,ad as a7,$c as a8,Pu as a9,Gs as aa,oi as ab,td as ac,Hn as ad,Xu as ae,Vu as af,Ju as ag,Yu as ah,ni as ai,Ft as aj,Uu as ak,$e as al,ed as am,sd as an,id as ao,Mt as ap,Ku as aq,gn as ar,xu as as,Ou as at,Cu as au,Eu as b,Su as c,Zn as d,zi as e,Jn as f,Gu as g,bu as h,Xs as i,Hu as j,Zs as k,es as l,ri as m,pn as n,A as o,ee as p,N as q,Tu as r,wu as s,te as t,nd as u,Bt as v,$u as w,Iu as x,Nu as y,Au as z};
@@ -1 +1 @@
1
- import{q as r}from"./index-CPhXtUuw.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-jbfR1Gmm.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-CPhXtUuw.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-jbfR1Gmm.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-CPhXtUuw.js";import{u as Q}from"./QueueOptionsButton-DqoDQST5.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-jbfR1Gmm.js";import{u as Q}from"./QueueOptionsButton-BMlChzgW.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-CPhXtUuw.js";import{i as c}from"./libraryInvalidation-hcASRQHn.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-jbfR1Gmm.js";import{i as c}from"./libraryInvalidation-Il_DYhmy.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-CPhXtUuw.js";import{r as y}from"./useMangaLibrary-DbvnlYV9.js";import{a as h}from"./MediaCard-B-TmXdgl.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-jbfR1Gmm.js";import{r as y}from"./useMangaLibrary-DZ-ZzUfI.js";import{a as h}from"./MediaCard-yDEaWmRR.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-CPhXtUuw.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-jbfR1Gmm.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-B-TmXdgl.js";import{T as g}from"./TvPopup-CCTQiS84.js";import{k as m,j as f,o as i}from"./index-CPhXtUuw.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-yDEaWmRR.js";import{T as g}from"./TvPopup-BWvnz3aD.js";import{k as m,j as f,o as i}from"./index-jbfR1Gmm.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-CPhXtUuw.js";import{i as u}from"./libraryInvalidation-hcASRQHn.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-jbfR1Gmm.js";import{i as u}from"./libraryInvalidation-Il_DYhmy.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};