@serifpersia/dango 3.7.2 → 3.7.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.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-CoPx634q.js → AnimeCard-BVufFeLC.js} +1 -1
- package/client/dist/assets/{AnimeInfo-COVCRujg.js → AnimeInfo-Dihook4h.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-BwlKpRXY.js → AnimeInfoPage-K0ErjilQ.js} +2 -2
- package/client/dist/assets/{Asmr-nOUcDsWe.js → Asmr-CP7vVwsh.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-Mj1PYE2c.js → AsmrResetProgressModal-cYO4Sr2k.js} +1 -1
- package/client/dist/assets/{Home-wi0a_BDQ.js → Home-BYuAVKgx.js} +1 -1
- package/client/dist/assets/{Insights-MLCDyTnY.js → Insights-Bx01GySp.js} +1 -1
- package/client/dist/assets/{LibraryListPage-CRqv737t.js → LibraryListPage-BnrEDG8j.js} +1 -1
- package/client/dist/assets/{ListeningList-8dzhiDeb.js → ListeningList-kRSLAo3B.js} +1 -1
- package/client/dist/assets/{Manga-dkD-uWJk.js → Manga-COhyMd3K.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-nCeWZNcO.js → MangaInfoPage-LTEvl_nL.js} +1 -1
- package/client/dist/assets/{MangaReadPage-NdDNCyLg.js → MangaReadPage-sEwzyBQ7.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-C28AiLJl.js → MangaResetProgressModal-CbMR36Zu.js} +1 -1
- package/client/dist/assets/{Mature-D5WSkhIJ.js → Mature-CMvs_-gf.js} +1 -1
- package/client/dist/assets/{MatureConsentModal-BsdpNeXA.js → MatureConsentModal-BnB-RHYQ.js} +1 -1
- package/client/dist/assets/{MediaCard-C1jNesfK.js → MediaCard-hWGCEHWx.js} +1 -1
- package/client/dist/assets/OptionListMenu-onM2KK2X.js +1 -0
- package/client/dist/assets/Player-2YKevlG4.js +56 -0
- package/client/dist/assets/PlayerSettings-BfSv-hut.js +1 -0
- package/client/dist/assets/{QueueOptionsButton-DNzKPzPw.js → QueueOptionsButton-B4Re8F3V.js} +1 -1
- package/client/dist/assets/{QueueRail-BWcDVSHd.js → QueueRail-Dkx_M6ng.js} +1 -1
- package/client/dist/assets/{ReadingList-zkFp3wpF.js → ReadingList-C--ZvTe2.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-BYNYqwwl.js → ResetProgressModal-BuESoxbY.js} +1 -1
- package/client/dist/assets/{Search-yDP_wGJ1.js → Search-CEErwr88.js} +1 -1
- package/client/dist/assets/{Settings-BpKwWesn.js → Settings-C-QEEujv.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-CYJeh04P.js → SkeletonGrid-QWMGLCGp.js} +1 -1
- package/client/dist/assets/{Trackers-D2KUt71k.js → Trackers-1i4Hd5D3.js} +1 -1
- package/client/dist/assets/Tv-C6F9655r.js +4 -0
- package/client/dist/assets/{TvInfo-D_4QdgV4.js → TvInfo-BajXP7JJ.js} +1 -1
- package/client/dist/assets/{TvPopup-DHXB5ZSF.js → TvPopup-DZtX79Ol.js} +1 -1
- package/client/dist/assets/{TvSearch-COwVoGru.js → TvSearch-DcWcxRb1.js} +1 -1
- package/client/dist/assets/{TvWatchlist-CU3r-NO5.js → TvWatchlist-Cf_25dKi.js} +1 -1
- package/client/dist/assets/{Watchlist-DHyuTLJG.js → Watchlist-DBmU8PNR.js} +1 -1
- package/client/dist/assets/{hls-DOAVt6Ry.js → hls-Bi-DS5KL.js} +1 -1
- package/client/dist/assets/{index-BLh_CXtu.js → index-DB81Su4I.js} +2 -2
- package/client/dist/assets/{libraryInvalidation-AzFLnbjH.js → libraryInvalidation-DI-v-DQ1.js} +1 -1
- package/client/dist/assets/playbackCompletion-IPHm9fp5.js +1 -0
- package/client/dist/assets/{useAnimeInfoData-MPNJXLaM.js → useAnimeInfoData-DpUA78Mv.js} +1 -1
- package/client/dist/assets/{useAsmr-2dFEmQD_.js → useAsmr-BwyYDnlP.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-N2vUf3Pw.js → useAsmrPopup-BrrEaBlV.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-B3Ni34a7.js → useMangaLibrary-BAUaug-u.js} +1 -1
- package/client/dist/assets/{useMangaPopup-h8NHEPUk.js → useMangaPopup-3Lx5tEub.js} +1 -1
- package/client/dist/assets/usePlaybackEnd-CuDnNZ8o.js +10 -0
- package/client/dist/assets/{useProviders-z8L8GKy0.js → useProviders-CKqOSX5-.js} +1 -1
- package/client/dist/assets/{useTv-D4zQ1BsQ.js → useTv-CZB47zUF.js} +1 -1
- package/client/dist/assets/{useTvLibrary-B4vcRzQc.js → useTvLibrary-BGz7Unv_.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/server.js +2 -2
- package/server/package.json +1 -1
- package/client/dist/assets/AvSyncCalibrator-C5GxpyPE.js +0 -10
- package/client/dist/assets/OptionListMenu-CIvW5WmO.js +0 -1
- package/client/dist/assets/Player-PGj8YYO8.js +0 -56
- package/client/dist/assets/PlayerSettings-CAYfF0sA.js +0 -1
- package/client/dist/assets/Tv-Ul3jFq-x.js +0 -4
- package/client/dist/assets/playbackCompletion-DuUs8u-8.js +0 -1
- /package/client/dist/assets/{AvSyncCalibrator-BtUHM1mW.css → usePlaybackEnd-BtUHM1mW.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-BYuAVKgx.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-hWGCEHWx.js","assets/vendor-icons-DrybRNxP.js","assets/vendor-ui-3qrARCPr.js","assets/useIsMobile-Dvx1uJ82.js","assets/MatureConsentModal-BnB-RHYQ.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-B0PJStxp.css","assets/AnimeCard-BVufFeLC.js","assets/useAnimeInfoData-DpUA78Mv.js","assets/QueueOptionsButton-B4Re8F3V.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-IPHm9fp5.js","assets/SkeletonGrid-QWMGLCGp.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-DAxegITP.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-BuESoxbY.js","assets/QueueRail-Dkx_M6ng.js","assets/QueueRail-Bkh4VZls.css","assets/useMangaPopup-3Lx5tEub.js","assets/useMangaLibrary-BAUaug-u.js","assets/libraryInvalidation-DI-v-DQ1.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-CbMR36Zu.js","assets/useProviders-CKqOSX5-.js","assets/useTv-CZB47zUF.js","assets/TvPopup-DZtX79Ol.js","assets/useTvLibrary-BGz7Unv_.js","assets/AsmrResetProgressModal-cYO4Sr2k.js","assets/useAsmr-BwyYDnlP.js","assets/Home-C5eTe3jP.css","assets/Watchlist-DBmU8PNR.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-C-QEEujv.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-BEHII_8K.css","assets/Player-2YKevlG4.js","assets/usePlaybackEnd-CuDnNZ8o.js","assets/usePlaybackEnd-BtUHM1mW.css","assets/hls-Bi-DS5KL.js","assets/AnimeMetaDetails-D8WIiO4b.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/Player-D-sQfjcx.css","assets/Search-CEErwr88.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature-CMvs_-gf.js","assets/Mature-DJmUUtlF.css","assets/Asmr-CP7vVwsh.js","assets/useAsmrPopup-BrrEaBlV.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Dl1EZqaI.css","assets/Manga-COhyMd3K.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-LTEvl_nL.js","assets/MangaReadPage-sEwzyBQ7.js","assets/ReadingList-C--ZvTe2.js","assets/LibraryListPage-BnrEDG8j.js","assets/TvSearch-DcWcxRb1.js","assets/TvInfo-BajXP7JJ.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-C6F9655r.js","assets/OptionListMenu-onM2KK2X.js","assets/Tv-D3vXCsSC.css","assets/TvWatchlist-Cf_25dKi.js","assets/ListeningList-kRSLAo3B.js","assets/Trackers-1i4Hd5D3.js","assets/Trackers-D5XBOCDp.css","assets/Insights-Bx01GySp.js","assets/Insights-D0qrep0K.css","assets/AnimeInfoPage-K0ErjilQ.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-DeP7fb3P.js","assets/VirtualKeyboard-BaUll8Yv.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{N as Un,k as Q,A as W,q as K,h as w,S as z,d as E,X as ce,x as le,T as xe,g as ft,u as o,L as Z,$ as rn,a as Hn,c as yt,e as Vn,f as zn,D as Gn,i as Yn,P as Pt,j as Jn,l as N,m as xt,z as R,n as Zn,B as Xn}from"./vendor-core-DfaOB3Rn.js";import{s as ge,i as er,q as tr,u as U,a as ee,b as G,c as vt,Q as nr,d as rr}from"./vendor-query-BBT5_sHx.js";import{I as _}from"./vendor-icons-DrybRNxP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const or="modulepreload",ir=function(e){return"/"+e},Tt={},j=function(t,n,r){let i=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 a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=l(n.map(u=>{if(u=ir(u),u in Tt)return;Tt[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":or,d||(h.as="script"),h.crossOrigin="",h.href=u,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((p,f)=>{h.addEventListener("load",p),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};let sr={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||sr},cr=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,lr=/\/\*[^]*?\*\/| +/g,It=/\n+/g,he=(e,t)=>{let n="",r="",i="";for(let s in e){let a=e[s];s[0]=="@"?s[1]=="i"?n=s+" "+a+";":r+=s[1]=="f"?he(a,s):s+"{"+he(a,s[1]=="k"?"":t)+"}":typeof a=="object"?r+=he(a,t?t.replace(/([^,])+/g,c=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):s):a!=null&&(s=s[1]=="-"?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=he.p?he.p(s,a):s+":"+a+";")}return n+(t&&i?t+"{"+i+"}":i)+r},me={},on=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+on(e[n]);return t}return e},ur=(e,t,n,r,i)=>{let s=on(e),a=me[s]||(me[s]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(s));if(!me[a]){let l=s!==e?e:(u=>{let d,m,h=[{}];for(;d=cr.exec(u.replace(lr,""));)d[4]?h.shift():d[3]?(m=d[3].replace(It," ").trim(),h.unshift(h[0][m]=h[0][m]||{})):h[0][d[1]]=d[2].replace(It," ").trim();return h[0]})(e);me[a]=he(i?{["@keyframes "+a]:l}:l,n?"":"."+a)}let c=n&&me.g;return n&&(me.g=me[a]),((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)})(me[a],t,r,c),a},dr=(e,t,n)=>e.reduce((r,i,s)=>{let a=t[s];if(a&&a.call){let c=a(n),l=c&&c.props&&c.props.className||/^go/.test(c)&&c;a=l?"."+l:c&&typeof c=="object"?c.props?"":he(c,""):c===!1?"":c}return r+i+(a??"")},"");function ze(e){let t=this||{},n=e.call?e(t.p):e;return ur(n.unshift?n.raw?dr(n,[].slice.call(arguments,1),t.p):n.reduce((r,i)=>Object.assign(r,i&&i.call?i(t.p):i),{}):n,ar(t.target),t.g,t.o,t.k)}let sn,it,st;ze.bind({g:1});let ue=ze.bind({k:1});function mr(e,t,n,r){he.p=t,sn=e,it=n,st=r}function fe(e,t){let n=this||{};return function(){let r=arguments;function i(s,a){let c=Object.assign({},s),l=c.className||i.className;n.p=Object.assign({theme:it&&it()},c),n.o=/go\d/.test(l),c.className=ze.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),st&&u[0]&&st(c),sn(u,c)}return i}}var hr=e=>typeof e=="function",He=(e,t)=>hr(e)?e(t):e,pr=(()=>{let e=0;return()=>(++e).toString()})(),an=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),fr=20,gt="default",cn=(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(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:r}=t;return cn(e,{type:e.toasts.find(a=>a.id===r.id)?1:0,toast:r});case 3:let{toastId:i}=t;return{...e,toasts:e.toasts.map(a=>a.id===i||i===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.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(a=>({...a,pauseDuration:a.pauseDuration+s}))}}},Qe=[],ln={toasts:[],pausedAt:void 0,settings:{toastLimit:fr}},oe={},un=(e,t=gt)=>{oe[t]=cn(oe[t]||ln,e),Qe.forEach(([n,r])=>{n===t&&r(oe[t])})},dn=e=>Object.keys(oe).forEach(t=>un(e,t)),yr=e=>Object.keys(oe).find(t=>oe[t].toasts.some(n=>n.id===e)),Ge=(e=gt)=>t=>{un(t,e)},vr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},gr=(e={},t=gt)=>{let[n,r]=E(oe[t]||ln),i=W(oe[t]);w(()=>(i.current!==oe[t]&&r(oe[t]),Qe.push([t,r]),()=>{let a=Qe.findIndex(([c])=>c===t);a>-1&&Qe.splice(a,1)}),[t]);let s=n.toasts.map(a=>{var c,l,u;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((c=e[a.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:a.duration||((l=e[a.type])==null?void 0:l.duration)||e?.duration||vr[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...n,toasts:s}},br=(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||pr()}),Re=e=>(t,n)=>{let r=br(t,e,n);return Ge(r.toasterId||yr(r.id))({type:2,toast:r}),r.id},F=(e,t)=>Re("blank")(e,t);F.error=Re("error");F.success=Re("success");F.loading=Re("loading");F.custom=Re("custom");F.dismiss=(e,t)=>{let n={type:3,toastId:e};t?Ge(t)(n):dn(n)};F.dismissAll=e=>F.dismiss(void 0,e);F.remove=(e,t)=>{let n={type:4,toastId:e};t?Ge(t)(n):dn(n)};F.removeAll=e=>F.remove(void 0,e);F.promise=(e,t,n)=>{let r=F.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(i=>{let s=t.success?He(t.success,i):void 0;return s?F.success(s,{id:r,...n,...n?.success}):F.dismiss(r),i}).catch(i=>{let s=t.error?He(t.error,i):void 0;s?F.error(s,{id:r,...n,...n?.error}):F.dismiss(r)}),e};var _r=1e3,wr=(e,t="default")=>{let{toasts:n,pausedAt:r}=gr(e,t),i=W(new Map).current,s=K((m,h=_r)=>{if(i.has(m))return;let p=setTimeout(()=>{i.delete(m),a({type:4,toastId:m})},h);i.set(m,p)},[]);w(()=>{if(r)return;let m=Date.now(),h=n.map(p=>{if(p.duration===1/0)return;let f=(p.duration||0)+p.pauseDuration-(m-p.createdAt);if(f<0){p.visible&&F.dismiss(p.id);return}return setTimeout(()=>F.dismiss(p.id,t),f)});return()=>{h.forEach(p=>p&&clearTimeout(p))}},[n,r,t]);let a=K(Ge(t),[t]),c=K(()=>{a({type:5,time:Date.now()})},[a]),l=K((m,h)=>{a({type:1,toast:{id:m,height:h}})},[a]),u=K(()=>{r&&a({type:6,time:Date.now()})},[r,a]),d=K((m,h)=>{let{reverseOrder:p=!1,gutter:f=8,defaultPosition:T}=h||{},P=n.filter(k=>(k.position||T)===(m.position||T)&&k.height),L=P.findIndex(k=>k.id===m.id),A=P.filter((k,$)=>$<L&&k.visible).length;return P.filter(k=>k.visible).slice(...p?[A+1]:[0,A]).reduce((k,$)=>k+($.height||0)+f,0)},[n]);return w(()=>{n.forEach(m=>{if(m.dismissed)s(m.id,m.removeDelay);else{let h=i.get(m.id);h&&(clearTimeout(h),i.delete(m.id))}})},[n,s]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},kr=ue`
|
|
3
3
|
from {
|
|
4
4
|
transform: scale(0) rotate(45deg);
|
|
@@ -175,4 +175,4 @@ to {
|
|
|
175
175
|
> * {
|
|
176
176
|
pointer-events: auto;
|
|
177
177
|
}
|
|
178
|
-
`,$e=16,Vr=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=wr(n,s);return Q("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:$e,left:$e,right:$e,bottom:$e,pointerEvents:"none",...a},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=Ur(m,h);return Q(Kr,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?Hr:"",style:p},d.type==="custom"?He(d.message,d):i?i(d):Q(Qr,{toast:d,position:m}))}))},g=F;function Ye(e){const t={subscribe(n){let r=null,i=!1,s=!1,a=!1;function c(){if(r===null){a=!0;return}s||(s=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;i||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;i||(i=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;i||(i=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),a&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(zr,t)}};return t}function zr(e,t){return t(e)}function Gr(e){const t=new AbortController;return new Promise((n,r)=>{let i=!1;function s(){i||(i=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const a=e.subscribe({next(c){i=!0,n(c),s()},error(c){r(c)},complete(){t.abort(),s()}})})}function Yr(e){return t=>{let n=0,r=null;const i=[];function s(){r||(r=t.subscribe({next(c){for(const u of i){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of i){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of i){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function a(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return Ye(c=>(n++,i.push(c),s(),{unsubscribe(){n--,a();const l=i.findIndex(u=>u===c);l>-1&&i.splice(l,1)}}))}}function Jr(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},i=a=>{n.splice(n.indexOf(a),1)},s=Ye(a=>(r(a),()=>{i(a)}));return s.next=a=>{if(t!==a){t=a;for(const c of n)c.next(a)}},s.get=()=>t,s}function Zr(e){return Ye(t=>{function n(r=0,i=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:i,next(a){return n(r+1,a)}})}return n().subscribe(t)})}function Ae(e){"@babel/helpers - typeof";return Ae=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},Ae(e)}function Xr(e,t){if(Ae(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ae(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eo(e){var t=Xr(e,"string");return Ae(t)=="symbol"?t:t+""}function V(e,t,n){return(t=eo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nt(Object(n),!0).forEach(function(r){V(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nt(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 to(e){return typeof e=="function"}function no(){return Object.create(null)}const ro=typeof Symbol=="function"&&!!Symbol.asyncIterator;function oo(e){return ro&&pe(e)&&Symbol.asyncIterator in e}const io=e=>e(),mn=()=>{},Ot=e=>{Object.freeze&&Object.freeze(e)};function hn(e,t,n){var r;const i=t.join(".");return(r=n[i])!==null&&r!==void 0||(n[i]=new Proxy(mn,{get(s,a){if(!(typeof a!="string"||a==="then"))return hn(e,[...t,a],n)},apply(s,a,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)}),Ot(u.args),Ot(u.path),e(u)}})),n[i]}const pn=e=>hn(e,[],no()),so=e=>new Proxy(mn,{get(t,n){if(n!=="then")return e(n)}});function qe(e){"@babel/helpers - typeof";return qe=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},qe(e)}function ao(e,t){if(qe(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function co(e){var t=ao(e,"string");return qe(t)=="symbol"?t:t+""}function at(e,t,n){return(t=co(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ct(Object(n),!0).forEach(function(r){at(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var lo=class extends Error{constructor(e){super(uo(e)),Object.assign(this,e)}};function uo(e){if("message"in e)return String(e.message)}function mo(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 lo(e)}}var At=class extends Error{constructor(e){var t,n,r;const i=mo(e.cause),s=(t=(n=e.message)!==null&&n!==void 0?n:i?.message)!==null&&t!==void 0?t:e.code;super(s,{cause:i}),at(this,"cause",void 0),at(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=i)}};function ho(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Me(Me({},e),{},{error:n})}}return{ok:!0,result:Me(Me({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var Xe=class extends Error{constructor(){super("Unable to transform response from server")}};function po(e,t){let n;try{n=ho(e,t)}catch{throw new Xe}if(!n.ok&&(!pe(n.error.error)||typeof n.error.error.code!="number"))throw new Xe;if(n.ok&&!pe(n.result))throw new Xe;return n}function fo(e){return typeof e=="function"}async function yo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const i=Object.keys(n.lazy).find(s=>t===s||t.startsWith(s+"."));if(!i)return null;await n.lazy[i].load(),r=n.procedures[t]}return r}async function vo(e){const{type:t,path:n}=e,r=await yo(e.router,n);if(!r||!fo(r)||r._def.type!==t&&!e.allowMethodOverride)throw new At({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new At({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function go(e){return e instanceof Ve}function bo(e){return pe(e)&&pe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function _o(e,t){return typeof e=="string"?e:pe(e)&&typeof e.message=="string"?e.message:t}var Ve=class Ke extends Error{constructor(t,n){var r,i;const s=n?.cause;super(t,{cause:s}),V(this,"cause",void 0),V(this,"shape",void 0),V(this,"data",void 0),V(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||(i=n.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Ke.prototype)}static from(t,n={}){const r=t;return go(r)?(n.meta&&(r.meta=B(B({},r.meta),n.meta)),r):bo(r)?new Ke(r.error.message,B(B({},n),{},{result:r,cause:n.cause})):new Ke(_o(r,"Unknown error"),B(B({},n),{},{cause:r}))}};function wo(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 qt=e=>typeof e=="function";function ko(e){if(e)return e;if(typeof window<"u"&&qt(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&qt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function Eo(...e){const t=new AbortController,n=e.length;let r=0;const i=()=>{++r===n&&t.abort()};for(const s of e)s?.aborted?i():s?.addEventListener("abort",i,{once:!0});return t.signal}function So(...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 Po(e){return{url:e.url.toString(),fetch:e.fetch,transformer:wo(e.transformer),methodOverride:e.methodOverride}}function xo(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const To={query:"GET",mutation:"POST",subscription:"PATCH"};function fn(e){return"input"in e?e.transformer.input.serialize(e.input):xo(e.inputs.map(t=>e.transformer.input.serialize(t)))}const yn=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 i=fn(e);i!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return r.length&&(n+="?"+r.join("&")),n},Io=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=fn(e);return t!==void 0?JSON.stringify(t):void 0},No=e=>qo(B(B({},e),{},{contentTypeHeader:"application/json",getUrl:yn,getBody:Io}));var Oo=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Co=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 Oo};async function Ao(e){var t,n;Co(e.signal);const r=e.getUrl(e),i=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:To[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=B(B(B({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),a);return ko(e.fetch)(r,{method:s,signal:e.signal,body:i,headers:c})}async function qo(e){const t={},n=await Ao(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const Lt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Rt(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function i(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(f=>f.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=i(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 f=u.items[p];try{var T;const L=await Promise.resolve(h);(T=f.resolve)===null||T===void 0||T.call(f,L)}catch(L){var P;(P=f.reject)===null||P===void 0||P.call(f,L)}f.batch=null,f.reject=null,f.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 a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:Lt,reject:Lt},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:a}}function Lo(e){var t,n;const r=Po(e),i=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,s=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const a=l=>({validate(u){if(i===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 yn(B(B({},r),{},{type:l,path:d,inputs:m,signal:null})).length<=i},async fetch(u){const d=u.map(f=>f.path).join(","),m=u.map(f=>f.input),h=Eo(...u.map(f=>f.signal)),p=await No(B(B({},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(f=>({meta:p.meta,json:f}))}}),c={query:Rt(a("query")),mutation:Rt(a("mutation"))};return({op:l})=>Ye(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(B(B({},l),{},{signal:So(l.signal,d.signal)}));let h=!1,p;return m.then(f=>{h=!0,p=f;const T=po(f.json,r.transformer.output);if(!T.ok){u.error(Ve.from(T.error,{meta:f.meta}));return}u.next({context:f.meta,result:T.result}),u.complete()}).catch(f=>{h=!0,u.error(Ve.from(f,{meta:p?.meta}))}),()=>{h||d.abort()}})}}const vn=(e,...t)=>typeof e=="function"?e(...t):e;function Ro(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function jo(e){const t=await vn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function Do(e,t){const n={method:"connectionParams",data:await vn(e)};return t.encode(n)}function $o(e){const{promise:t,resolve:n,reject:r}=Ro();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function Mo(e,{intervalMs:t,pongTimeoutMs:n}){let r,i;function s(){r=setTimeout(()=>{e.send("PING"),i=setTimeout(()=>{e.close()},n)},t)}function a(){clearTimeout(r),s()}function c(){clearTimeout(i),a()}e.addEventListener("open",s),e.addEventListener("message",({data:l})=>{clearTimeout(r),s(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(i)})}var Fo=class ct{constructor(t){var n;if(V(this,"id",++ct.connectCount),V(this,"WebSocketPonyfill",void 0),V(this,"urlOptions",void 0),V(this,"keepAliveOpts",void 0),V(this,"encoder",void 0),V(this,"wsObservable",Jr(null)),V(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=++ct.connectCount;const t=jo(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&&Mo(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await $o(n),this.urlOptions.connectionParams&&n.send(await Do(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()}}};V(Fo,"connectCount",0);var gn=class{constructor(e){V(this,"links",void 0),V(this,"runtime",void 0),V(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Zr({links:this.links,op:B(B({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(Yr())}async requestAsPromise(e){try{const t=this.$request(e);return(await Gr(t)).result.data}catch(t){throw Ve.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 i;(i=n.onConnectionStateChange)===null||i===void 0||i.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 a;(a=n.onStopped)===null||a===void 0||a.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 i;(i=n.onError)===null||i===void 0||i.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const bn=Symbol.for("trpc_untypedClient"),Bo={query:"query",mutate:"mutation",subscribe:"subscription"},Wo=e=>Bo[e];function Qo(e){const t=pn(({path:n,args:r})=>{const i=[...n],s=Wo(i.pop()),a=i.join(".");return e[s](a,...r)});return so(n=>n===bn?e:t[n])}function Ko(e){return Qo(new gn(e))}function Uo(e){return e[bn]}function Le(e){"@babel/helpers - typeof";return Le=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},Le(e)}function Ho(e,t){if(Le(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Le(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vo(e){var t=Ho(e,"string");return Le(t)=="symbol"?t:t+""}function zo(e,t,n){return(t=Vo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jt(Object(n),!0).forEach(function(r){zo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Go(e){var t,n,r,i=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Ue(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ue(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(i){return{value:i,done:r}})}return Ue=function(r){this.s=r,this.n=r.next},Ue.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var i=this.s.return;return i===void 0?Promise.resolve({value:r,done:!0}):t(i.apply(this.s,arguments))},throw:function(r){var i=this.s.return;return i===void 0?Promise.reject(r):t(i.apply(this.s,arguments))}},new Ue(e)}function Yo(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 Jo(e,t){if(e==null)return{};var n,r,i=Yo(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)&&(i[n]=e[n])}return i}const Zo=["cursor","direction"];function Je(e){return{path:e.path.join(".")}}function Xo(e){return e.length>=3}function ei(e){return Xo(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function bt(e,t,n){var r;const i=ei(e);let s=(r=i.args)===null||r===void 0?void 0:r.input;if(n){var a,c;s=x(x(x({},(a=(c=i.args)===null||c===void 0?void 0:c.input)!==null&&a!==void 0?a:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[i.path.join("."),s,t?.trpc]}async function ti(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const i=[];var s=!1,a=!1,c;try{for(var l=Go(e),u;s=!(u=await l.next()).done;s=!1){const d=u.value;i.push(d),r.setState({data:[...i]})}}catch(d){a=!0,c=d}finally{try{s&&l.return!=null&&await l.return()}finally{if(a)throw c}}return i}function se(e){const t=io(()=>{const{input:n,type:r}=e,i=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return i.length?[i]:[];if(r==="infinite"&&pe(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:a}=n;return[i,{input:Jo(n,Zo),type:"infinite"}]}return[i,x(x({},typeof n<"u"&&n!==ge&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function _n(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function _t(e){return to(e)?e():e}function ni(e){var t;const{input:n,query:r,path:i,queryKey:s,opts:a}=e,c=n===ge,l=async u=>{var d;const m=x(x({},a),{},{trpc:x(x({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...bt(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(er(x(x({},a??{}),{},{queryKey:s,queryFn:c?ge:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:Je({path:i})})}function ri(e){var t,n;const{mutate:r,path:i,prefix:s,opts:a,overrides:c}=e,l=_t(e.queryClient),u=_n({path:i,prefix:(t=a?.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(...bt([...u,{input:p}],a));return x(x({},a),{},{mutationKey:u,mutationFn:h,onSuccess(...p){var f,T;return m({originalFn:()=>{var L,A,k;return(L=a==null||(A=a.onSuccess)===null||A===void 0?void 0:A.call(a,...p))!==null&&L!==void 0?L:d==null||(k=d.onSuccess)===null||k===void 0?void 0:k.call(d,...p)},queryClient:l,meta:(f=(T=a?.meta)!==null&&T!==void 0?T:d?.meta)!==null&&f!==void 0?f:{}})},trpc:Je({path:i})})}function oi(e){const{input:t,query:n,path:r,queryKey:i,opts:s}=e,a=_t(e.queryClient),c=t===ge,l=async u=>{var d;const m=x(x({},s),{},{trpc:x(x({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),h=u.queryKey,p=await n(...bt(h,m));return oo(p)?ti(p,a,h):p};return Object.assign(tr(x(x({},s),{},{queryKey:i,queryFn:c?ge:l})),{trpc:Je({path:r})})}const ii=e=>{const{subscribe:t,path:n,queryKey:r,input:i,opts:s={}}=e,a="enabled"in s?!!s.enabled:i!==ge,c=l=>t(n.join("."),i===ge?void 0:i,l);return x(x({},s),{},{enabled:a,subscribe:c,queryKey:r,trpc:Je({path:n})})};function si(e){const t=e.keyPrefix,n=r=>(i,s,a)=>"router"in e?Promise.resolve(_t(e.ctx)).then(c=>vo({router:e.router,path:i,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof gn?e.client:Uo(e.client))[r](i,s,a);return pn(({args:r,path:i})=>{const s=[...i],a=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>se({path:s,type:"any",prefix:t}),pathFilter:()=>x(x({},c),{},{queryKey:se({path:s,type:"any",prefix:t})}),queryOptions:()=>oi({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:se({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>se({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>x(x({},l),{},{queryKey:se({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>ni({input:c,opts:l,path:s,queryKey:se({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>se({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>x(x({},l),{},{queryKey:se({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return ri({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:()=>_n({path:s,prefix:t}),subscriptionOptions:()=>ii({opts:l,path:s,input:c,queryKey:se({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function ai(){const e=ce(null),t=ce(null),n=s=>{const a=xe(()=>si({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return Q(e.Provider,{value:s.trpcClient},Q(t.Provider,{value:a},s.children))};n.displayName="TRPCProvider";function r(){const s=le(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function i(){const s=le(e);if(!s)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return s}return{TRPCProvider:n,useTRPC:r,useTRPCClient:i}}const lt={lan:new Set,animepahe:new Set,jasmr:new Set};function Ee(e){for(const t of[...lt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function wn(e,t){return lt[e].add(t),()=>{lt[e].delete(t)}}const ci=e=>new Promise(t=>setTimeout(t,e)),wt=async(e,t)=>{const n={};(!t?.body||!(t.body instanceof FormData))&&(n["Content-Type"]="application/json");const r=typeof e=="string"?e:e.toString();if(r.startsWith("/")||typeof window<"u"&&r.startsWith(window.location.origin)){const a=localStorage.getItem("animepahe_ua"),c=localStorage.getItem("animepahe_cookie"),l=localStorage.getItem("jasmr_ua"),u=localStorage.getItem("jasmr_cookie");a&&(n["x-animepahe-ua"]=a),c&&(n["x-animepahe-cookie"]=c),l&&(n["x-jasmr-ua"]=l),u&&(n["x-jasmr-cookie"]=u)}let s=await fetch(e,{...t,headers:{...n,...t?.headers}});for(let a=0;s.status===503&&a<8;a++)await ci(Math.min(500*2**a,4e3)),s=await fetch(e,{...t,headers:{...n,...t?.headers}});return s},li=async(e,t)=>{const n=await wt(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let i={};try{i=JSON.parse(r)}catch{}const s=typeof i.error=="string"?i.error:"";throw n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="animepahe"&&Ee("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="jasmr"&&Ee("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&Ee("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function ui(e,t){const n=await wt(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Ee("lan")}catch{}return await di(n),n}async function di(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 i=r?.error;if(!i||typeof i!="object")continue;const s=i.data?.cause;(i.message==="AUTH_REQUIRED"||s?.code==="AUTH_REQUIRED")&&(s?.provider==="animepahe"||s?.provider==="jasmr")&&Ee(s.provider),(i.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&Ee("lan")}}catch{}}const{TRPCProvider:mi,useTRPC:C}=ai(),X=Ko({links:[Lo({url:"/api/trpc",fetch:ui})]}),Ie=new Map,hi=500,pi=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let a=e;if(t&&!a.includes("w=")){const c=a.includes("?")?"&":"?";a+=`${c}w=${t}`}if(n&&!a.includes("h=")){const c=a.includes("?")?"&":"?";a+=`${c}h=${n}`}return a}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 i=`${r}-${t}-${n}`;if(Ie.has(i))return Ie.get(i);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 a=localStorage.getItem("animepahe_cookie"),c=localStorage.getItem("animepahe_ua");a&&(s+=`&cookie=${encodeURIComponent(a)}`),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 Ie.size>hi&&Ie.clear(),Ie.set(i,s),s},sl=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 al(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim():""}function cl(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const fi=(...e)=>e.filter(Boolean).join(" ");function yi(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const kn=ce(void 0),vi=()=>{const e=le(kn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},O={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",notifications:"notifications",settings:"settings",insights:"insights",insightsRecommendations:"insights-recommendations",providers:"providers",syncProfile:"sync-profile"},ll=()=>{const e=C(),t=G({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},ul=(e="TRENDING_DESC",t=10)=>vt({queryKey:[O.trendingList,e,t],queryFn:({pageParam:n=1})=>X.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),dl=(e="TV",t=12)=>vt({queryKey:[O.latestReleases,e,t],queryFn:({pageParam:n=1})=>X.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),ml=(e,t="TV",n=!0)=>{const r=C();return G({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},gi=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],hl=(e,t,n=14)=>{const r=C(),i=new URLSearchParams(e),s={page:t,limit:n};for(const a of gi){const c=i.get(a);c!==null&&(s[a]=c)}return G({...r.data.search.queryOptions(s),enabled:e!=null})},pl=()=>{const e=C();return G(e.queue.list.queryOptions())},bi=()=>{const e=C(),t=U();return ee(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?g.success("Added to queue"):g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},fl=()=>{const e=C(),t=U();return ee(e.queue.remove.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},yl=(e,t=!0)=>G({queryKey:[O.queueRemaining,e],queryFn:()=>X.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),vl=()=>{const e=C(),t=U();return ee(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const i=n.added??r.episodeNumbers.length;g.success(`${i} ${i===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},gl=()=>{const e=C(),t=U();return ee(e.queue.removeMany.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},bl=()=>{const e=C(),t=U();return ee(e.queue.clear.mutationOptions({onSuccess:()=>{g.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to clear queue: ${n.message}`)}}))},_l=()=>{const e=C(),t=U(),n=e.queue.list.queryOptions().queryKey;return ee(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const i=t.getQueryData(n);return t.setQueryData(n,s=>{if(!s)return s;const a=new Map(s.map(c=>[c.id,c]));return r.map((c,l)=>{const u=a.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:i}},onError:(r,i,s)=>{s?.previousQueue&&t.setQueryData(n,s.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},_i=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function kt(e,t,n){const r=new URLSearchParams(e),i={page:t,limit:n};for(const s of _i){const a=r.get(s);a!==null&&(i[s]=a)}return i}const wl=(e,t="",n,r=14)=>G({queryKey:[O.watchlist,e,t,n,r],queryFn:async()=>{const i=new URLSearchParams(t);return i.set("status",e),await X.watchlist.list.query(kt(i.toString(),n,r))}}),kl=(e="")=>vt({queryKey:[O.continueWatching,e],queryFn:async({pageParam:t=1})=>await X.watchlist.continueWatchingAll.query(kt(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)})}),El=(e="",t,n=14)=>G({queryKey:[O.continueWatching,e,t,n],queryFn:async()=>await X.watchlist.continueWatchingAll.query(kt(e,t,n))}),Sl=()=>{const e=C(),t=U();return ee(e.watchlist.remove.mutationOptions({onSuccess:()=>{g.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[O.watchlist]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Pl=()=>{const e=C(),t=U();return ee(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{g.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[O.watchlist]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to update statuses: ${n.message}`)}}))},xl=()=>{const e=C(),t=U();return ee(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[O.watchlist]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Tl=()=>{const e=C(),t=U();return ee(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},En=(e=!0)=>{const t=C();return G({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},Sn=(e=!0)=>{const t=C();return G({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},Pn=(e=!0)=>{const t=C();return G({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},wi=()=>{const e=C(),t=U(),n=e.discovery.status.queryOptions().queryKey;return ee(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:[O.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},ki=()=>{const e=C(),t=U();return ee(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Ei=()=>{const e=C(),t=U();return ee(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Il=()=>{const e=C();return G({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},Nl=()=>{const e=C();return G({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},Ol=()=>G({queryKey:[O.genreCards],queryFn:()=>X.insights.genreCards.query()}),Si="_container_vk8jv_1",Pi="_bellBtn_vk8jv_7",xi="_badge_vk8jv_56",Ti="_dropdown_vk8jv_96",Ii="_dropdownHeader_vk8jv_127",Ni="_clearAllBtn_vk8jv_141",Oi="_discoveryStatusRow_vk8jv_159",Ci="_statusDot_vk8jv_170",Ai="_statusDotRunning_vk8jv_177",qi="_statusDotOk_vk8jv_182",Li="_statusDotInfo_vk8jv_186",Ri="_statusDotError_vk8jv_190",ji="_statusDotIdle_vk8jv_194",Di="_list_vk8jv_208",$i="_item_vk8jv_222",Mi="_thumbnail_vk8jv_237",Fi="_itemInfo_vk8jv_246",Bi="_itemTitle_vk8jv_251",Wi="_itemMeta_vk8jv_262",Qi="_systemItemMeta_vk8jv_272",Ki="_removeItem_vk8jv_289",Ui="_queueItem_vk8jv_319",Hi="_emptyState_vk8jv_323",Vi="_notificationDivider_vk8jv_371",v={container:Si,bellBtn:Pi,badge:xi,dropdown:Ti,dropdownHeader:Ii,clearAllBtn:Ni,discoveryStatusRow:Oi,statusDot:Ci,statusDotRunning:Ai,statusDotOk:qi,statusDotInfo:Li,statusDotError:Ri,statusDotIdle:ji,list:Di,item:$i,thumbnail:Mi,itemInfo:Fi,itemTitle:Bi,itemMeta:Wi,systemItemMeta:Qi,removeItem:Ki,queueItem:Ui,emptyState:Hi,notificationDivider:Vi},zi=({notification:e})=>{const t=ki(),n=bi(),[r,i]=ft.useState(!1),s=d=>{d.preventDefault(),d.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},a=()=>{t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},c=d=>{d.preventDefault(),d.stopPropagation(),i(!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(()=>i(!1),1e3)},{titlePreference:l}=vi(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(Z,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:v.item,onClick:a,children:[o("img",{src:pi(e.thumbnail,48,64),alt:e.name,className:v.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:u}),o("span",{className:v.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${v.removeItem} ${v.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(_,{name:"check"}):o(_,{name:"plus"})}),o("button",{className:v.removeItem,onClick:s,"aria-label":"Remove notification",children:o(_,{name:"times"})})]})};function et({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:i}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...i}})}const Gi=({count:e=3})=>o(z,{children:Array.from({length:e}).map((t,n)=>o("div",{className:v.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:v.thumbnail,style:{overflow:"hidden"},children:o(et,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:v.itemInfo,children:[o(et,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(et,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),Yi=()=>{const{data:e=[],isLoading:t}=En(),{data:n=[]}=Sn(),{data:r}=Pn(),i=Ei(),s=U(),[a,c]=E(null);w(()=>{s.invalidateQueries({queryKey:[O.notifications]})},[s]);const l=()=>{i.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:v.dropdown,children:[o("div",{className:v.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:v.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:v.discoveryStatusRow,children:r?.running?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotRunning}`,"aria-hidden":"true"}),o("span",{children:r.total>0?`Checking ${Math.min(r.done,r.total)}/${r.total} shows...`:"Checking for new episodes..."})]}):r?.state==="complete"?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete - checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching - nothing to check"})]}):r?.state==="error"?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed - will retry automatically"})]}):o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:r?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-r.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes"})]})}),o("div",{className:v.list,children:t&&n.length===0?o(Gi,{count:4}):o(z,{children:[n.map(d=>o("div",{className:v.item,children:[o("div",{className:v.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(_,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:d.title}),o("button",{type:"button",className:v.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:yi(d.message,40,"…")})]}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(_,{name:"plus"})}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(_,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:v.notificationDivider}),e.length>0?e.map(d=>o(zi,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:v.emptyState,children:"No new notifications"})]})}),u&&rn(o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem",backdropFilter:"blur(3px)"},onClick:()=>c(null),children:o("div",{style:{backgroundColor:"var(--bg-secondary)",padding:"1.5rem",borderRadius:"var(--radius-lg)",maxWidth:"420px",width:"100%",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border-primary)"},onClick:d=>d.stopPropagation(),children:[o("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem"},children:[o(_,{name:"info-circle",color:"#6c9fff"}),o("span",{style:{color:"#fff",fontWeight:600,fontSize:"1rem"},children:u.title})]}),o("p",{style:{color:"var(--text-secondary)",marginBottom:"1.5rem",lineHeight:1.5},children:u.message}),o("div",{style:{display:"flex",justifyContent:"flex-end"},children:o("button",{type:"button",onClick:()=>c(null),style:{background:"var(--accent)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},Ji=()=>{const[e,t]=E(!1),n=W(null),r=U(),i=C(),s=wi(),{data:a=[]}=En(),{data:c=[]}=Sn(),{data:l}=Pn(),u=a.length+c.length,d=u>5?"5+":u,m=W(!1);w(()=>{const p=f=>{n.current&&!n.current.contains(f.target)&&t(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),w(()=>{const p=!!l?.running;m.current&&!p&&(r.invalidateQueries(i.notifications.pathFilter()),r.invalidateQueries(i.discovery.pathFilter())),m.current=p},[l?.running,r,i]);const h=()=>{const p=!e;t(p),p&&s.mutate()};return o("div",{className:v.container,ref:n,children:[o("button",{className:v.bellBtn,onClick:h,"aria-label":"Notifications",children:[o(_,{name:"bell"}),u>0&&o("span",{className:v.badge,children:d})]}),e&&o(Yi,{})]})},Ze=e=>{const t=C();return G({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},xn=()=>{const e=C(),t=U();return ee(e.settings.set.mutationOptions({onSuccess:()=>{g.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[O.settings]})},onError:n=>{g.error(`Failed to update setting: ${n.message}`)}}))},Tn=ce(void 0),Zi=()=>{const e=le(Tn);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},ie={x:-2.8,y:-2,w:48.6,h:14},ut=15,Pe={w:13.6,h:10.2},ae=[{x:0,y:.5},{x:ut,y:-.9},{x:ut*2,y:.3}],Dt={x:Pe.w/2,y:Pe.h/2-.5},tt={y:Pe.h/2,x1:-2,x2:ut*2+Pe.w+1.4},$t=(e,t,n,r=0)=>{if(n.width<=0)return-1;const i=n.width/ie.w,s=(e-n.left)/i+ie.x,a=(t-n.top)/i+ie.y;for(let c=0;c<ae.length;c++){const l=s-ae[c].x,u=a-ae[c].y;if(l>=-r&&l<=Pe.w+r&&u>=-r&&u<=Pe.h+r)return c}return-1},Mt=7.5,Ft=e=>Math.max(-1,Math.min(1,e)),Xi=(e,t,n,r)=>{const i=n.width/ie.w,s=(e-n.left)/i+ie.x-r.x-Dt.x,a=(t-n.top)/i+ie.y-r.y-Dt.y;return{x:Ft(s/Mt),y:Ft(a/Mt)}},es=["normal","squint"],ts={normal:.72,squint:.28},Bt=(e=Math.random(),t)=>{let n=0;for(const r of es)if(n+=ts[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},ns="pet",rs="sleep",os=6e3,is=420,ss=.5,Wt=3e3,as=3e3,cs=ae.map((e,t)=>t*260),nt={from:ae.length-2,to:ae.length-1,after:400},Qt="data-dango-face",rt="data-dango-hover",ot="data-dango-cheer",Kt="data-dango-nudge",ls=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),Fe=()=>document.querySelectorAll("[data-dango-face-slot]"),us=e=>e.querySelectorAll("[data-dango-eye]"),ds=()=>document.querySelectorAll("[data-dango-eye]"),In=()=>{const{data:e}=Ze("dangoGaze"),{lowEndMode:t}=Zi();return e!=="false"&&!t},ms=()=>{const e=In();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=ae.map(()=>"normal");let n=-1,r=-1,i=!1,s=-1,a=0,c=0,l=0,u=0,d=0;const m=[],h=(y,I)=>{const b=window.setTimeout(()=>{m.splice(m.indexOf(b),1),y()},I);m.push(b)},p=(y,I,b)=>{Fe().forEach(D=>{Number(D.getAttribute("data-dango-face-slot"))===y&&(b?D.setAttribute(I,""):D.removeAttribute(I))})},f=y=>Fe().forEach(I=>I.removeAttribute(y)),T=(y,I,b)=>{f(I),requestAnimationFrame(()=>{p(y,I,!0),h(()=>f(I),b)})},P=()=>{Fe().forEach(y=>{const I=Number(y.getAttribute("data-dango-face-slot"));y.setAttribute(Qt,r===I?ns:t[I]),n===I?y.setAttribute(rt,""):y.removeAttribute(rt)})},L=y=>{y!==r&&(r>=0&&p(r,ot,!1),r=y,y>=0&&p(y,ot,!0))},A=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{L(-1),P()},is)},k=()=>{window.clearTimeout(d),L(-1)},$=()=>{i=!1,cs.forEach((y,I)=>{h(()=>{t[I]=Bt(),I===nt.from&&h(()=>T(nt.to,Kt,520),nt.after),P()},y)})},de=()=>{i=!0,t.fill(rs),k(),P()},Y=()=>{window.clearTimeout(u),u=window.setTimeout(de,os)},be=()=>{i||(s=(s+1)%t.length,t[s]=Bt(Math.random(),t[s]),P()),h(be,Wt+Math.random()*as)},te=()=>{const y=Array.from(ls(),J=>[J,J.getBoundingClientRect()]);y.forEach(([J,De])=>{us(J).forEach(ke=>{const{x:ne,y:ve}=Xi(c,l,De,ae[Number(ke.getAttribute("data-dango-eye"))]);ke.style.setProperty("--dango-gaze-x",ne.toFixed(3)),ke.style.setProperty("--dango-gaze-y",ve.toFixed(3))})});const I=y.find(([,J])=>c>=J.left&&c<=J.right&&l>=J.top&&l<=J.bottom)?.[1]??null,b=n,D=r,we=I?$t(c,l,I):-1,Te=we>=0?we:I?$t(c,l,I,ss):-1;n=we,Te>=0?(L(Te),A()):k(),(b!==n||D!==r)&&P(),i&&$(),Y()},_e=y=>{c=y.clientX,l=y.clientY,!a&&(a=requestAnimationFrame(()=>{a=0,te()}))},ye=y=>{y.relatedTarget||(n=-1,k(),P(),Y())};return P(),Y(),h(be,Wt),window.addEventListener("pointermove",_e,{passive:!0}),window.addEventListener("pointerout",ye),()=>{cancelAnimationFrame(a),window.clearTimeout(u),window.clearTimeout(d),m.forEach(window.clearTimeout),window.removeEventListener("pointermove",_e),window.removeEventListener("pointerout",ye),ds().forEach(y=>{y.style.removeProperty("--dango-gaze-x"),y.style.removeProperty("--dango-gaze-y")}),Fe().forEach(y=>{y.setAttribute(Qt,"normal"),y.removeAttribute(rt),y.removeAttribute(ot),y.removeAttribute(Kt)})}},[e])},Nn=ce(void 0),Cl=()=>{const e=le(Nn);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},Al=[{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"}],hs={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},ps="_logo_t3il2_1",fs="_skewer_t3il2_8",ys="_gaze_t3il2_15",vs="_face_t3il2_20",gs="_faceNormal_t3il2_25",bs="_facePet_t3il2_26",_s="_faceSquint_t3il2_27",ws="_faceSleep_t3il2_28",ks="_line_t3il2_36",Es="_sway_t3il2_44",Ss="_weight_t3il2_58",Ps="_shift_t3il2_73",xs="_rock_t3il2_87",Ts="_glance_t3il2_105",Is="_blinkDouble_t3il2_129 _blink_t3il2_124",Ns="_blinkSlow_t3il2_153 _blink_t3il2_124",Os="_bump_t3il2_172",Cs="_heart_t3il2_189",M={logo:ps,skewer:fs,gaze:ys,face:vs,faceNormal:gs,facePet:bs,faceSquint:_s,faceSleep:ws,line:ks,sway:Es,weight:Ss,shift:Ps,rock:xs,glance:Ts,blinkDouble:Is,blinkSlow:Ns,bump:Os,heart:Cs},Ut="var(--logo-ink)",As="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z",qs="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z",Ls="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z",Rs={pet:"M 4.85,5.15 Q 5.285,4.0 5.72,5.15 M 8.25,5.15 Q 8.618,4.0 8.99,5.15",squint:"M 4.82,3.9 L 5.6,4.62 L 4.82,5.34 M 9.08,3.9 L 8.3,4.62 L 9.08,5.34",sleep:"M 4.9,4.72 Q 5.285,5.28 5.67,4.72 M 8.25,4.72 Q 8.618,5.28 9.0,4.72"},On=[{lag:.8,hue:"iris",blink:"double",motion:"weight",glances:!1},{lag:1.4,hue:"sakura",blink:"slow",motion:"shift",glances:!1},{lag:1,hue:"mochi",blink:"slow",motion:"rock",glances:!0}],Ne=(e,t)=>e+Math.random()*(t-e),js=On.map(()=>({blinkDelay:-Ne(0,9),blinkDuration:Ne(3.4,8.6),motionDelay:-Ne(0,9),motionDuration:Ne(5.5,11),glanceDelay:-Ne(0,11)})),Ds={double:M.blinkDouble,slow:M.blinkSlow},$s={weight:M.weight,shift:M.shift,rock:M.rock},Ms={normal:M.faceNormal,pet:M.facePet,squint:M.faceSquint,sleep:M.faceSleep},Fs=["normal","pet","squint","sleep"],Bs=[{x:7,y:4.2,delay:0,drift:"0px"},{x:9.6,y:6.4,delay:-.3,drift:"-0.9px"},{x:4.6,y:6.1,delay:-.6,drift:"0.8px"},{x:8.2,y:3.4,delay:-.9,drift:"-0.4px"}],Et=({className:e})=>{const t=In();return o("svg",{viewBox:`${ie.x} ${ie.y} ${ie.w} ${ie.h}`,className:e?`${M.logo} ${e}`:M.logo,role:"img","aria-label":"dango","data-dango-gaze-origin":"",children:o("g",{className:t?M.sway:void 0,children:[o("path",{className:M.skewer,d:`M ${tt.x1},${tt.y} H ${tt.x2}`}),On.map((n,r)=>{const{x:i,y:s}=ae[r],a=js[r],{fill:c,stroke:l}=hs[n.hue],u=o("g",{"data-dango-eye":r,className:M.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:Fs.map(d=>o("g",{className:`${M.face} ${Ms[d]}`,children:o("g",{className:t&&d==="normal"?Ds[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${a.blinkDelay}s`,animationDuration:`${a.blinkDuration}s`}:void 0,children:d==="normal"?o(z,{children:[o("path",{fill:Ut,d:qs}),o("path",{fill:Ut,d:Ls})]}):o("path",{className:M.line,d:Rs[d]})})},d))});return o("g",{transform:`translate(${i} ${s})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?$s[n.motion]:void 0,style:t?{animationDelay:`${a.motionDelay}s`,animationDuration:`${a.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:As}),o("g",{className:M.bump,children:[t&&n.glances?o("g",{className:M.glance,style:{animationDelay:`${a.glanceDelay}s`},children:u}):u,t&&o("g",{children:Bs.map(d=>o("text",{className:M.heart,x:d.x,y:d.y,fill:"var(--color-danger)",style:{"--drift":d.drift,animationDelay:`${d.delay}s`},children:"♥"},d.x))})]})]})},n.hue)})]})})},Cn=ce(void 0),St=()=>{const e=le(Cn);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},An=ce(void 0),qn=()=>{const e=le(An);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},dt="virtual-keyboard:hide",Ht="virtual-keyboard:enabled-change",Ln="virtual_keyboard_enabled",Ws=!1;function Vt(){const e=localStorage.getItem(Ln);return e===null?Ws:e==="true"}const zt=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function Qs(){window.dispatchEvent(new CustomEvent(dt))}function Ks(){const[e,t]=E(!1),[n,r]=E(Vt),i=W(null);return w(()=>{const s=d=>{n&&zt(d.target)&&(i.current=d.target,t(!0))},a=d=>{d.target===i.current&&window.setTimeout(()=>{if(zt(document.activeElement)){i.current=document.activeElement,t(!0);return}i.current=null,t(!1)},0)},c=()=>{i.current=null,t(!1)},l=d=>{if(d.key!==Ln)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=Vt();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),window.addEventListener(dt,c),window.addEventListener("storage",l),window.addEventListener(Ht,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a),window.removeEventListener(dt,c),window.removeEventListener("storage",l),window.removeEventListener(Ht,u)}},[n]),{activeInputRef:i,isVisible:n&&e,hide:()=>t(!1)}}const Us="_header_q6huj_1",Hs="_hidden_q6huj_21",Vs="_scrolled_q6huj_25",zs="_logo_q6huj_31",Gs="_headerInner_q6huj_44",Ys="_leftSection_q6huj_54",Js="_desktopNav_q6huj_60",Zs="_navLink_q6huj_67",Xs="_navLinkActive_q6huj_83",ea="_rightSection_q6huj_102",ta="_searchWrapper_q6huj_108",na="_searchInput_q6huj_114",ra="_searchButton_q6huj_144",oa="_searchIcon_q6huj_168",ia="_profileBtn_q6huj_178",sa="_profileImg_q6huj_211",aa="_hamburgerBtn_q6huj_217",ca="_mobileSearchBar_q6huj_244",la="_mobileSearchBarHidden_q6huj_271",ua="_mobileSearchInner_q6huj_288",da="_mobileSearchIcon_q6huj_304",ma="_mobileSearchInput_q6huj_311",S={header:Us,hidden:Hs,scrolled:Vs,logo:zs,headerInner:Gs,leftSection:Ys,desktopNav:Js,navLink:Zs,navLinkActive:Xs,rightSection:ea,searchWrapper:ta,searchInput:na,searchButton:ra,searchIcon:oa,profileBtn:ia,profileImg:sa,hamburgerBtn:aa,mobileSearchBar:ca,mobileSearchBarHidden:la,mobileSearchInner:ua,mobileSearchIcon:da,mobileSearchInput:ma},ha=async()=>{let e;try{e=await X.auth.syncSettings.query()}catch{return null}const t=e.actualActiveProvider;if(t==="github")try{const n=await X.auth.githubStatus.query();if(n.authenticated&&n.user)return{name:n.user.name||n.user.login,picture:n.user.avatarUrl??void 0,provider:"github"}}catch{}if(t==="google")try{const n=await X.auth.user.query();if(n)return{name:n.name,picture:n.picture,email:n.email,provider:"google"}}catch{}return null},pa=()=>{const{toggleSidebar:e}=St(),{contentType:t}=qn(),[n,r]=E(""),[i,s]=E(!0),[a,c]=E(!1),[l,u]=E(!0),[d,m]=E(!1),h=Hn(),p=yt(),f=W(null),T=W(!1),P=W(null),L=W(null),A=W(null),k=W(null),$=W(!1),{data:de}=G({queryKey:[O.syncProfile],queryFn:ha,staleTime:3e4});w(()=>{const b=window.visualViewport;if(!b)return;const D=()=>{k.current?.style.setProperty("--vv-top",`${b.offsetTop}px`)};return D(),b.addEventListener("scroll",D),b.addEventListener("resize",D),()=>{b.removeEventListener("scroll",D),b.removeEventListener("resize",D)}},[]),w(()=>{const b=()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},D=()=>{b(),!(window.scrollY<=10)&&(f.current=window.setTimeout(()=>{$.current||s(!1)},2500))},we=()=>{T.current||(T.current=!0,P.current=requestAnimationFrame(()=>{T.current=!1,P.current=null;const ne=window.scrollY<=10;u(ve=>ve===ne?ve:ne),s(ve=>ve||!0),D()}))},Te=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"?(ne.preventDefault(),Y.current?.focus({preventScroll:!0})):ne.key==="Escape"&&document.activeElement===Y.current&&Y.current?.blur()},J=k.current,De=()=>{$.current=!0},ke=()=>{$.current=!1,D()};return window.addEventListener("scroll",we,{passive:!0}),window.addEventListener("keydown",Te),J?.addEventListener("pointerenter",De),J?.addEventListener("pointerleave",ke),()=>{window.removeEventListener("scroll",we),window.removeEventListener("keydown",Te),J?.removeEventListener("pointerenter",De),J?.removeEventListener("pointerleave",ke),b(),P.current!==null&&(cancelAnimationFrame(P.current),P.current=null),T.current=!1}},[a]);const Y=ft.useRef(null),be=()=>window.innerWidth<=1024,te=()=>{be()?(m(!0),setTimeout(()=>A.current?.focus({preventScroll:!0}),50)):document.activeElement===Y.current&&n.trim()?I():Y.current?.focus({preventScroll:!0})},_e=b=>{L.current?.contains(b.relatedTarget)||m(!1)},ye=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",y=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"},I=b=>{Qs();const D=n.trim();D&&h(t==="manga"?`/manga?q=${encodeURIComponent(D)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(D)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(D)}`:`/search?query=${encodeURIComponent(D)}`)};return o(z,{children:o("header",{ref:k,className:`${S.header} ${i?"":S.hidden} ${l?"":S.scrolled}`,children:[o("div",{className:S.headerInner,children:[o("div",{className:S.leftSection,children:[o("button",{className:S.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(_,{name:"bars"})}),o(Z,{to:"/",className:S.logo,"aria-label":"Ani-Web Home",children:o(Et,{})}),o("nav",{className:S.desktopNav,children:[o(Z,{to:"/",className:`${S.navLink} ${p.pathname==="/"?S.navLinkActive:""}`,children:"Home"}),o(Z,{to:y.to,className:`${S.navLink} ${p.pathname.startsWith(y.to)?S.navLinkActive:""}`,children:y.label}),t==="anime"&&o(Z,{to:"/insights",className:`${S.navLink} ${p.pathname==="/insights"?S.navLinkActive:""}`,children:"Insights"}),o(Z,{to:"/settings",className:`${S.navLink} ${p.pathname.startsWith("/settings")?S.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:S.rightSection,children:[o("div",{className:S.searchWrapper,children:[o("input",{ref:Y,type:"text","data-virtual-keyboard":"true",className:S.searchInput,placeholder:ye,value:n,onChange:b=>r(b.currentTarget.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:b=>{b.key==="Enter"&&I()}}),o("button",{type:"button",className:S.searchButton,"aria-label":"Search",onMouseDown:b=>b.preventDefault(),onClick:te,children:o(_,{name:"search",className:S.searchIcon})})]}),o(Ji,{}),o(Z,{to:"/settings?tab=sync",className:S.profileBtn,"aria-label":"Sync settings",children:de?.picture?o("img",{src:de.picture,alt:de.name,className:S.profileImg,referrerPolicy:"no-referrer",decoding:"async"}):de?.provider==="github"?o(_,{name:"github"}):o(_,{name:"cloud"})})]})]}),d&&o("div",{className:`${S.mobileSearchBar} ${i?"":S.mobileSearchBarHidden}`,ref:L,onBlur:_e,children:o("div",{className:S.mobileSearchInner,children:[o(_,{name:"search",className:S.mobileSearchIcon}),o("input",{ref:A,type:"text","data-virtual-keyboard":"true",className:S.mobileSearchInput,placeholder:ye,value:n,onChange:b=>r(b.currentTarget.value),onKeyDown:b=>{b.key==="Enter"?(I(),m(!1)):b.key==="Escape"&&m(!1)}})]})})]})})},mt="agreedToViewMature";function ht(){try{return localStorage.getItem(mt)==="true"}catch{return!1}}const Ce=new Set;function Rn(e){for(const t of Ce)t(e)}function Be(){Rn(ht())}function Gt(e){try{e?localStorage.setItem(mt,"true"):localStorage.removeItem(mt)}catch{}Rn(e)}function fa(){const[e,t]=E(ht);w(()=>(Ce.add(t),Ce.size===1&&(window.addEventListener("storage",Be),window.addEventListener("focus",Be)),t(ht()),()=>{Ce.delete(t),Ce.size===0&&(window.removeEventListener("storage",Be),window.removeEventListener("focus",Be))}),[]);const n=K(()=>Gt(!0),[]),r=K(()=>Gt(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const ya="_sidebar_153jc_1",va="_open_153jc_20",ga="_sidebarHeader_153jc_25",ba="_closeBtn_153jc_33",_a="_logo_153jc_57",wa="_navSection_153jc_69",ka="_navLink_153jc_75",Ea="_active_153jc_108",Sa="_overlay_153jc_118",Pa="_versionInfo_153jc_138",re={sidebar:ya,open:va,sidebarHeader:ga,closeBtn:ba,logo:_a,navSection:wa,navLink:ka,active:Ea,overlay:Sa,versionInfo:Pa},xa="3.7.2",jn={version:xa},Ta=()=>{const{isOpen:e,setIsOpen:t}=St(),{contentType:n}=qn(),{hasConsent:r}=fa(),i=()=>{t(!1)},s=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(_,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(_,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(_,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(_,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(_,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(_,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(_,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(_,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(_,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(_,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(_,{name:"sync-alt"}),label:"Trackers"},...r?[{to:"/mature",icon:o(_,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(_,{name:"cog"}),label:"Settings"}];return o(z,{children:[o("aside",{className:`${re.sidebar} ${e?re.open:""} sidebar`,children:[o("div",{className:re.sidebarHeader,children:[o("button",{className:re.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(Z,{to:"/",className:re.logo,onClick:i,children:o(Et,{})})]}),o("nav",{className:re.navSection,children:l.map(u=>o(Vn,{to:u.to,className:({isActive:d})=>`${re.navLink} ${d?re.active:""}`,onClick:i,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:re.versionInfo,children:["v",jn.version]})]}),e&&o("div",{className:re.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},Ia="_footer_1c905_1",Na="_footerInner_1c905_15",Oa="_brandSection_1c905_27",Ca="_logoRow_1c905_39",Aa="_logoText_1c905_45",qa="_brandMeta_1c905_51",La="_brandTagline_1c905_60",Ra="_statusPill_1c905_67",ja="_statusDot_1c905_80",Da="_linksGrid_1c905_88",$a="_linkColumn_1c905_96",Ma="_columnTitle_1c905_102",Fa="_bottomBar_1c905_126",Ba="_copyright_1c905_136",Wa="_brand_1c905_27",Qa="_heartIcon_1c905_152",Ka="_backToTop_1c905_157",q={footer:Ia,footerInner:Na,brandSection:Oa,logoRow:Ca,logoText:Aa,brandMeta:qa,brandTagline:La,statusPill:Ra,statusDot:ja,linksGrid:Da,linkColumn:$a,columnTitle:Ma,bottomBar:Fa,copyright:Ba,brand:Wa,heartIcon:Qa,backToTop:Ka},Ua=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:q.footer,children:[o("div",{className:q.footerInner,children:[o("div",{className:q.brandSection,children:[o("div",{className:q.logoRow,children:o(Et,{className:q.logoText})}),o("div",{className:q.brandMeta,children:[o("div",{className:q.statusPill,children:[o("span",{className:q.statusDot}),o("span",{children:["v",jn.version]})]}),o("p",{className:q.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:q.linksGrid,children:[o("div",{className:q.linkColumn,children:[o("h4",{className:q.columnTitle,children:"Navigation"}),o(Z,{to:"/",children:"Home"}),o(Z,{to:"/watchlist",children:"Watchlist"}),o(Z,{to:"/settings",children:"Settings"})]}),o("div",{className:q.linkColumn,children:[o("h4",{className:q.columnTitle,children:"Features"}),o(Z,{to:"/search",children:"Search Anime"}),o(Z,{to:"/trackers",children:"Trackers"}),o(Z,{to:"/insights",children:"Insights"})]}),o("div",{className:q.linkColumn,children:[o("h4",{className:q.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(_,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(_,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:q.linkColumn,children:[o("h4",{className:q.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:q.bottomBar,children:[o("p",{className:q.copyright,children:["© ",e," ",o("span",{className:q.brand,children:"dango"})," • Crafted with"," ",o(_,{name:"heart",className:q.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:q.backToTop,onClick:t,"aria-label":"Back to top",children:[o(_,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Dn(e){return JSON.stringify({0:e??{}})}function $n(e){return`/api/trpc/${e}?batch=1`}function pt(e,t){const n=Dn(t),r=$n(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 ql(e,t){await fetch($n(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Dn(t),keepalive:!0})}function Ll(e){e&&(pt("discord.clear",{sessionId:e}),pt("discord.heartbeat",{sessionId:e,bye:!0}))}function Ha(){const e=yt(),{data:t}=Ze("discordRPCEnabled"),n=W("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),w(()=>{if(t===!1||t==="false")return;const r=n.current,i=()=>X.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});i();const s=setInterval(i,15e3),a=()=>{pt("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(s),window.removeEventListener("pagehide",a)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let i="home";r.startsWith("/search")||r.startsWith("/mature")?i="search":r.startsWith("/watchlist")?i="watchlist":r.startsWith("/anime/")?i="anime":r.startsWith("/insights")?i="insights":r.startsWith("/settings")?i="settings":r.startsWith("/trackers")?i="trackers":r.startsWith("/asmr")?i="asmr":r.startsWith("/manga")?i="manga":r.startsWith("/tv")&&(i="tv"),X.discord.pageStatus.mutate({page:i}).catch(()=>{})},[e.pathname,t])}function Mn(e,t){const[n,r]=E(()=>{try{const s=localStorage.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=a=>{if(a.key===e)try{if(a.newValue===null){r(t);return}if(typeof t=="string"){r(a.newValue);return}try{r(JSON.parse(a.newValue))}catch{r(a.newValue)}}catch{}};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[e,t]);const i=K(s=>{r(a=>{const c=typeof s=="function"?s(a):s;try{typeof c=="string"?localStorage.setItem(e,c):localStorage.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,i]}const Fn=ce(void 0),Va=()=>{const e=le(Fn);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},za="_overlay_1juub_1",Ga="_fadeIn_1juub_1",Ya="_content_1juub_11",Ja="_modalIn_1juub_1",Za="_sm_1juub_29",Xa="_md_1juub_33",ec="_lg_1juub_37",tc="_title_1juub_41",nc="_body_1juub_48",rc="_footer_1juub_52",Se={overlay:za,fadeIn:Ga,content:Ya,modalIn:Ja,sm:Za,md:Xa,lg:ec,title:tc,body:nc,footer:rc};function Bn({children:e}){return o("h2",{className:Se.title,children:e})}function Wn({children:e}){return o("div",{className:Se.body,children:e})}function Qn({children:e}){return o("div",{className:Se.footer,children:e})}function je({isOpen:e,onClose:t,title:n,children:r,footer:i,width:s="md"}){const a=W(null),[c,l]=E(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",a.current?.focus(),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=d}},[e,t]),e?rn(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:Se.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${Se.content} ${Se[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(Bn,{children:n}),o(Wn,{children:r}),i&&o(Qn,{children:i})]})]}),c):null}je.Header=Bn;je.Body=Wn;je.Actions=Qn;const oc="_container_e96gf_1",ic="_field_e96gf_9",sc="_textarea_e96gf_20",ac="_input_e96gf_40",cc="_button_e96gf_58",lc="_secondaryButton_e96gf_78",uc="_actions_e96gf_95",dc="_hint_e96gf_104",mc="_link_e96gf_117",H={container:oc,field:ic,textarea:sc,input:ac,button:cc,secondaryButton:lc,actions:uc,hint:dc,link:mc},hc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",pc=e=>{try{return JSON.parse(e.detail)}catch{return null}},fc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=E(1),[s,a]=E(navigator.userAgent),[c,l]=E(""),[u,d]=E(!1),m=W(null),h=navigator.userAgent,p=/android/i.test(h),f=/firefox|fxios/i.test(h)&&!p,T=!f&&!p&&/chrome|chromium|edg|brave/i.test(h),P=f||T;w(()=>{e&&(i(1),a(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const L=()=>{localStorage.setItem("animepahe_ua",s),window.open("https://animepahe.pw","_blank","noopener,noreferrer"),i(2)},A=()=>{if(u)return;d(!0);const $=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,de=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),g.error("Helper not detected - install it via about:debugging first.")},3e3),Y=be=>{const te=pc(be);if(!(!te||te.requestId!==$))if(window.clearTimeout(de),window.removeEventListener("dango:pahe-cookie",Y),m.current=null,d(!1),te?.ok&&te.cookie)l(te.cookie),g.success("Cookie extracted from helper!");else if(te?.error==="NO_COOKIE"){const _e=te.debug?.stores?.length??0,ye=te.debug?.names??[];g.error(`Helper found no cf_clearance (checked ${_e} stores, saw: ${ye.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else g.error("Helper request failed - try again.")};m.current=Y,window.addEventListener("dango:pahe-cookie",Y),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:$}}))},k=()=>{const $=c.trim();if(!$){g.error("Please enter the cf_clearance cookie");return}try{localStorage.setItem("animepahe_cookie",$),g.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{g.error("Failed to save cookie")}};return o(je,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:H.container,children:r===1?o(z,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:H.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:s,readOnly:!0,rows:3,className:H.textarea})]}),o("div",{className:H.actions,children:[o("button",{className:H.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:H.button,onClick:L,children:"Start Verification (Opens AnimePahe)"})]})]}):o(z,{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."]}),P&&o("div",{className:H.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",f?o(z,{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(z,{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:hc,target:"_blank",rel:"noreferrer",className:H.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:H.actions,children:o("button",{className:H.button,onClick:A,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:H.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:$=>l($.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:H.input})]}),o("div",{className:H.actions,children:[o("button",{className:H.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:H.secondaryButton,onClick:()=>i(1),children:"Back"}),o("button",{className:H.button,onClick:k,children:"Submit"})]})]})})})};function yc(){const[e,t]=E(!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 vc="_screen_1pca0_1",gc="_icon_1pca0_14",bc="_title_1pca0_20",_c="_text_1pca0_24",wc="_button_1pca0_29",Oe={screen:vc,icon:gc,title:bc,text:_c,button:wc};class kc extends zn{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?o("div",{className:Oe.screen,children:[o(_,{name:"exclamation-triangle",className:Oe.icon}),o("h1",{className:Oe.title,children:"Something went wrong"}),o("p",{className:Oe.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Oe.button,children:[o(_,{name:"home"}),"Go back Home"]})]}):this.props.children}}const Kn=ce(void 0),Ec=()=>{const e=le(Kn);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Sc=({children:e})=>{const[t,n]=E(!1),r=K(()=>n(!0),[]),i=K(()=>n(!1),[]);return w(()=>wn("lan",r),[r]),o(Kn.Provider,{value:{isOpen:t,openModal:r,closeModal:i},children:e})},Pc="_container_88bss_1",xc="_field_88bss_8",Tc="_input_88bss_19",Ic="_actions_88bss_37",We={container:Pc,field:xc,input:Tc,actions:Ic},Yt=Gn(({variant:e="primary",size:t="md",loading:n,children:r,className:i="",disabled:s,...a},c)=>{const l=fi("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",i);return o("button",{className:l,disabled:s||n,ref:c,...a,children:n?o("span",{className:"btn-spinner"}):r})}),Nc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=E(""),[s,a]=E(!1);ft.useEffect(()=>{e&&i("")},[e]);const c=async()=>{if(!r){g.error("Please enter your password");return}a(!0);try{const l=await wt("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){g.error(u.error||"Login failed");return}g.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{g.error("Network error")}finally{a(!1)}};return o(je,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:We.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:We.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>i(l.currentTarget.value),placeholder:"Enter password...",className:We.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:We.actions,children:[o(Yt,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(Yt,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},Oc=R(()=>j(()=>import("./Home-wi0a_BDQ.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]))),Cc=R(()=>j(()=>import("./Watchlist-DHyuTLJG.js"),__vite__mapDeps([34,1,2,4,10,11,12,5,13,3,6,7,8,9,14,15,16,17,18,35,36,37,38,39]))),Ac=R(()=>j(()=>import("./Settings-BpKwWesn.js"),__vite__mapDeps([40,1,2,41,42,4,43]))),Jt=R(()=>j(()=>import("./Player-PGj8YYO8.js"),__vite__mapDeps([44,1,2,45,4,46,14,7,8,6,20,21,12,5,13,27,47,48,49,50,51,52]))),qc=R(()=>j(()=>import("./Search-yDP_wGJ1.js"),__vite__mapDeps([53,1,4,3,5,6,7,8,9,10,11,2,12,13,14,15,16,17,18,37,38,54,55]))),Lc=R(()=>j(()=>import("./Mature-D5WSkhIJ.js"),__vite__mapDeps([56,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,27,54,55,57]))),Zt=R(()=>j(()=>import("./Asmr-nOUcDsWe.js"),__vite__mapDeps([58,1,4,2,41,42,7,8,3,5,6,9,32,24,59,25,47,60,61,62]))),Rc=R(()=>j(()=>import("./Manga-dkD-uWJk.js"),__vite__mapDeps([63,1,4,41,42,7,8,17,18,3,5,6,9,22,23,2,24,25,27,64,65,60,61]))),jc=R(()=>j(()=>import("./MangaInfoPage-nCeWZNcO.js"),__vite__mapDeps([66,1,4,17,18,23,2,24,64,65,60,61]))),Dc=R(()=>j(()=>import("./MangaReadPage-NdDNCyLg.js"),__vite__mapDeps([67,1,17,4,18,2,23,24,64,65,60,61]))),$c=R(()=>j(()=>import("./ReadingList-zkFp3wpF.js"),__vite__mapDeps([68,1,3,4,5,6,7,8,9,69,15,16,17,18,35,36,22,23,2,24,25,26,19]))),Xt=R(()=>j(()=>import("./TvSearch-COwVoGru.js"),__vite__mapDeps([70,1,4,3,5,6,7,8,9,28,29,30,2,24,15,16,17,18,54,55]))),Mc=R(()=>j(()=>import("./TvInfo-D_4QdgV4.js"),__vite__mapDeps([71,1,4,30,2,24,72]))),Fc=R(()=>j(()=>import("./Tv-Ul3jFq-x.js"),__vite__mapDeps([73,1,2,4,45,46,74,7,8,27,30,24,14,47,6,50,51,75]))),Bc=R(()=>j(()=>import("./TvWatchlist-CU3r-NO5.js"),__vite__mapDeps([76,1,3,4,5,6,7,8,9,69,15,16,17,18,35,36,19,29,30,2,24]))),Wc=R(()=>j(()=>import("./ListeningList-8dzhiDeb.js"),__vite__mapDeps([77,1,3,4,5,6,7,8,9,69,15,16,17,18,35,36,59,32,2,24,25,31,19]))),Qc=R(()=>j(()=>import("./Trackers-D2KUt71k.js"),__vite__mapDeps([78,1,2,4,79]))),Kc=R(()=>j(()=>import("./Insights-MLCDyTnY.js"),__vite__mapDeps([80,1,2,4,81]))),Uc=R(()=>j(()=>import("./AnimeInfoPage-BwlKpRXY.js"),__vite__mapDeps([82,1,2,4]))),Hc=R(()=>j(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([83,1]))),Vc=R(()=>j(()=>import("./VirtualKeyboard-DeP7fb3P.js"),__vite__mapDeps([84,1,85])));function zc(){ms();const{isOpen:e,closeModal:t,onSuccess:n}=Va(),{isOpen:r,setIsOpen:i}=St(),{isOpen:s,openModal:a,closeModal:c}=Ec(),l=yt(),u=Yn(),d=W(new Map),m=W(l.pathname),h=Ks();Ha();const[p,f]=E(!1);w(()=>{li("/api/auth/app-status").then(A=>{A.hasPassword&&!A.isAuthenticated&&(f(!0),a())}).catch(()=>{})},[a]);const[T,P]=Mn("lan_auth_notice_shown","false"),L=W(!1);return w(()=>{if(T==="true"||L.current)return;L.current=!0,P("true");const A=setTimeout(()=>{g("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(A)},[T,P]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const A=l.key,k=d.current;if(u==="POP"){const $=k.get(A)??0;window.scrollTo({top:$,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{k.set(A,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const A=k=>{r&&k.key==="Escape"&&i(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A),document.body.classList.remove("sidebar-open")}},[r,i]),o("div",{className:"app-container",children:[o(fc,{isOpen:e,onClose:t,onSuccess:n}),o(Nc,{isOpen:s,onClose:p?()=>{}:c,onSuccess:()=>{f(!1),c()}}),o(Vr,{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"}}}}),o(pa,{}),o(Ta,{}),o("main",{className:"main-content",children:o(kc,{children:o(Pt,{fallback:o(yc,{}),children:o(Jn,{children:[o(N,{path:"/",element:o(Oc,{})}),o(N,{path:"/watchlist/:filter?",element:o(Cc,{})}),o(N,{path:"/reading-list/:filter?",element:o($c,{})}),o(N,{path:"/search",element:o(qc,{})}),o(N,{path:"/mature",element:o(Lc,{})}),o(N,{path:"/asmr",element:o(Zt,{})}),o(N,{path:"/asmr/:rj",element:o(Zt,{})}),o(N,{path:"/manga",element:o(Rc,{})}),o(N,{path:"/manga/:provider/:id",element:o(jc,{})}),o(N,{path:"/manga/:provider/:id/read",element:o(Dc,{})}),o(N,{path:"/tv",element:o(Xt,{})}),o(N,{path:"/tv/:id",element:o(Mc,{})}),o(N,{path:"/tv/:id/watch",element:o(Fc,{})}),o(N,{path:"/tv-search",element:o(Xt,{})}),o(N,{path:"/tv-watchlist/:filter?",element:o(Bc,{})}),o(N,{path:"/listening-list/:filter?",element:o(Wc,{})}),o(N,{path:"/settings",element:o(Ac,{})}),o(N,{path:"/trackers",element:o(Qc,{})}),o(N,{path:"/mal",element:o(xt,{to:"/trackers",replace:!0})}),o(N,{path:"/insights",element:o(Kc,{})}),o(N,{path:"/anime/:id",element:o(Uc,{})}),o(N,{path:"/watch/:id",element:o(Jt,{})}),o(N,{path:"/watch/:id/:episodeNumber",element:o(Jt,{})}),o(N,{path:"/player/:id/:episodeNumber?",element:o(Hc,{})}),o(N,{path:"*",element:o(xt,{to:"/",replace:!0})})]})})})}),o(Ua,{}),h.isVisible&&o(Pt,{fallback:null,children:o(Vc,{activeInputRef:h.activeInputRef,isVisible:h.isVisible,onClose:h.hide})})]})}function Gc(){return o(Sc,{children:o(zc,{})})}const Yc=({children:e})=>{const[t,n]=E(!1),r=K(()=>{n(s=>!s)},[]),i=xe(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(Cn.Provider,{value:i,children:e})},Jc=({children:e})=>{const[t,n]=Mn("dango_content_type","anime"),r=xe(()=>({contentType:t,setContentType:n}),[t,n]);return o(An.Provider,{value:r,children:e})},Zc=({children:e})=>{const[t,n]=E("englishName"),[r,i]=E(!0);w(()=>{(async()=>{try{const c=await X.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{i(!1)}})()},[]);const s=xe(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(kn.Provider,{value:s,children:e})},Xc=({children:e})=>{const{data:t,isLoading:n}=Ze("lowEndMode"),r=xn(),i=U(),[s,a]=E(!1);w(()=>{const u=i.getDefaultOptions();i.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,i]),w(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),w(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=K(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=xe(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(Tn.Provider,{value:l,children:e})},el=["iris","mochi","sakura"];function en(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const tl=({children:e})=>{const{data:t,isLoading:n}=Ze("theme"),r=xn(),[i,s]=E("iris");w(()=>{typeof t=="string"&&el.includes(t)&&s(t)},[t]),w(()=>{en(i)},[i]);const a=K(l=>{l!==i&&(s(l),en(l),r.mutate({key:"theme",value:l}))},[r,i]),c=xe(()=>({theme:i,setTheme:a,loading:n}),[i,a,n]);return o(Nn.Provider,{value:c,children:e})},nl=({children:e})=>{const[t,n]=E(!1),[r,i]=E(void 0),s=K(c=>{i(()=>c),n(!0)},[]),a=K(()=>{n(!1),i(void 0)},[]);return w(()=>wn("animepahe",()=>s()),[s]),o(Fn.Provider,{value:{isOpen:t,openModal:s,closeModal:a,onSuccess:r},children:e})};try{window.history.scrollRestoration="manual"}catch{}const tn=new nr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),nn=document.getElementById("root");nn&&Zn(o(Xn,{children:o(mi,{trpcClient:X,queryClient:tn,children:o(rr,{client:tn,children:o(nl,{children:o(Yc,{children:o(Jc,{children:o(Zc,{children:o(Xc,{children:o(tl,{children:o(Gc,{})})})})})})})})})}),nn);export{Ol as $,g as A,Yt as B,Ze as C,xn as D,xl as E,Tl as F,Pl as G,wt as H,F as I,li as J,Cl as K,Vt as L,je as M,Ht as N,cl as O,H as P,fc as Q,hl as R,et as S,Al as T,Qs as U,Ln as V,Ll as W,wn as X,ql as Y,St as Z,j as _,Mn as a,yc as a0,vl as a1,gl as a2,yl as a3,ul as b,dl as c,vi as d,fa as e,pi as f,sl as g,yi as h,C as i,ml as j,qn as k,Sl as l,pl as m,fl as n,bl as o,_l as p,O as q,Il as r,al as s,X as t,Zi as u,kl as v,ll as w,Nl as x,El as y,wl as z};
|
|
178
|
+
`,$e=16,Vr=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=wr(n,s);return Q("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:$e,left:$e,right:$e,bottom:$e,pointerEvents:"none",...a},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=Ur(m,h);return Q(Kr,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?Hr:"",style:p},d.type==="custom"?He(d.message,d):i?i(d):Q(Qr,{toast:d,position:m}))}))},g=F;function Ye(e){const t={subscribe(n){let r=null,i=!1,s=!1,a=!1;function c(){if(r===null){a=!0;return}s||(s=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;i||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;i||(i=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;i||(i=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),a&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(zr,t)}};return t}function zr(e,t){return t(e)}function Gr(e){const t=new AbortController;return new Promise((n,r)=>{let i=!1;function s(){i||(i=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const a=e.subscribe({next(c){i=!0,n(c),s()},error(c){r(c)},complete(){t.abort(),s()}})})}function Yr(e){return t=>{let n=0,r=null;const i=[];function s(){r||(r=t.subscribe({next(c){for(const u of i){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of i){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of i){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function a(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return Ye(c=>(n++,i.push(c),s(),{unsubscribe(){n--,a();const l=i.findIndex(u=>u===c);l>-1&&i.splice(l,1)}}))}}function Jr(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},i=a=>{n.splice(n.indexOf(a),1)},s=Ye(a=>(r(a),()=>{i(a)}));return s.next=a=>{if(t!==a){t=a;for(const c of n)c.next(a)}},s.get=()=>t,s}function Zr(e){return Ye(t=>{function n(r=0,i=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:i,next(a){return n(r+1,a)}})}return n().subscribe(t)})}function Ae(e){"@babel/helpers - typeof";return Ae=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},Ae(e)}function Xr(e,t){if(Ae(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ae(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eo(e){var t=Xr(e,"string");return Ae(t)=="symbol"?t:t+""}function V(e,t,n){return(t=eo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nt(Object(n),!0).forEach(function(r){V(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nt(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 to(e){return typeof e=="function"}function no(){return Object.create(null)}const ro=typeof Symbol=="function"&&!!Symbol.asyncIterator;function oo(e){return ro&&pe(e)&&Symbol.asyncIterator in e}const io=e=>e(),mn=()=>{},Ot=e=>{Object.freeze&&Object.freeze(e)};function hn(e,t,n){var r;const i=t.join(".");return(r=n[i])!==null&&r!==void 0||(n[i]=new Proxy(mn,{get(s,a){if(!(typeof a!="string"||a==="then"))return hn(e,[...t,a],n)},apply(s,a,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)}),Ot(u.args),Ot(u.path),e(u)}})),n[i]}const pn=e=>hn(e,[],no()),so=e=>new Proxy(mn,{get(t,n){if(n!=="then")return e(n)}});function qe(e){"@babel/helpers - typeof";return qe=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},qe(e)}function ao(e,t){if(qe(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function co(e){var t=ao(e,"string");return qe(t)=="symbol"?t:t+""}function at(e,t,n){return(t=co(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ct(Object(n),!0).forEach(function(r){at(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var lo=class extends Error{constructor(e){super(uo(e)),Object.assign(this,e)}};function uo(e){if("message"in e)return String(e.message)}function mo(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 lo(e)}}var At=class extends Error{constructor(e){var t,n,r;const i=mo(e.cause),s=(t=(n=e.message)!==null&&n!==void 0?n:i?.message)!==null&&t!==void 0?t:e.code;super(s,{cause:i}),at(this,"cause",void 0),at(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=i)}};function ho(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Me(Me({},e),{},{error:n})}}return{ok:!0,result:Me(Me({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var Xe=class extends Error{constructor(){super("Unable to transform response from server")}};function po(e,t){let n;try{n=ho(e,t)}catch{throw new Xe}if(!n.ok&&(!pe(n.error.error)||typeof n.error.error.code!="number"))throw new Xe;if(n.ok&&!pe(n.result))throw new Xe;return n}function fo(e){return typeof e=="function"}async function yo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const i=Object.keys(n.lazy).find(s=>t===s||t.startsWith(s+"."));if(!i)return null;await n.lazy[i].load(),r=n.procedures[t]}return r}async function vo(e){const{type:t,path:n}=e,r=await yo(e.router,n);if(!r||!fo(r)||r._def.type!==t&&!e.allowMethodOverride)throw new At({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new At({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function go(e){return e instanceof Ve}function bo(e){return pe(e)&&pe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function _o(e,t){return typeof e=="string"?e:pe(e)&&typeof e.message=="string"?e.message:t}var Ve=class Ke extends Error{constructor(t,n){var r,i;const s=n?.cause;super(t,{cause:s}),V(this,"cause",void 0),V(this,"shape",void 0),V(this,"data",void 0),V(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||(i=n.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Ke.prototype)}static from(t,n={}){const r=t;return go(r)?(n.meta&&(r.meta=B(B({},r.meta),n.meta)),r):bo(r)?new Ke(r.error.message,B(B({},n),{},{result:r,cause:n.cause})):new Ke(_o(r,"Unknown error"),B(B({},n),{},{cause:r}))}};function wo(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 qt=e=>typeof e=="function";function ko(e){if(e)return e;if(typeof window<"u"&&qt(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&qt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function Eo(...e){const t=new AbortController,n=e.length;let r=0;const i=()=>{++r===n&&t.abort()};for(const s of e)s?.aborted?i():s?.addEventListener("abort",i,{once:!0});return t.signal}function So(...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 Po(e){return{url:e.url.toString(),fetch:e.fetch,transformer:wo(e.transformer),methodOverride:e.methodOverride}}function xo(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const To={query:"GET",mutation:"POST",subscription:"PATCH"};function fn(e){return"input"in e?e.transformer.input.serialize(e.input):xo(e.inputs.map(t=>e.transformer.input.serialize(t)))}const yn=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 i=fn(e);i!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return r.length&&(n+="?"+r.join("&")),n},Io=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=fn(e);return t!==void 0?JSON.stringify(t):void 0},No=e=>qo(B(B({},e),{},{contentTypeHeader:"application/json",getUrl:yn,getBody:Io}));var Oo=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Co=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 Oo};async function Ao(e){var t,n;Co(e.signal);const r=e.getUrl(e),i=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:To[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=B(B(B({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),a);return ko(e.fetch)(r,{method:s,signal:e.signal,body:i,headers:c})}async function qo(e){const t={},n=await Ao(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const Lt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Rt(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function i(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(f=>f.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=i(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 f=u.items[p];try{var T;const L=await Promise.resolve(h);(T=f.resolve)===null||T===void 0||T.call(f,L)}catch(L){var P;(P=f.reject)===null||P===void 0||P.call(f,L)}f.batch=null,f.reject=null,f.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 a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:Lt,reject:Lt},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:a}}function Lo(e){var t,n;const r=Po(e),i=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,s=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const a=l=>({validate(u){if(i===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 yn(B(B({},r),{},{type:l,path:d,inputs:m,signal:null})).length<=i},async fetch(u){const d=u.map(f=>f.path).join(","),m=u.map(f=>f.input),h=Eo(...u.map(f=>f.signal)),p=await No(B(B({},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(f=>({meta:p.meta,json:f}))}}),c={query:Rt(a("query")),mutation:Rt(a("mutation"))};return({op:l})=>Ye(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(B(B({},l),{},{signal:So(l.signal,d.signal)}));let h=!1,p;return m.then(f=>{h=!0,p=f;const T=po(f.json,r.transformer.output);if(!T.ok){u.error(Ve.from(T.error,{meta:f.meta}));return}u.next({context:f.meta,result:T.result}),u.complete()}).catch(f=>{h=!0,u.error(Ve.from(f,{meta:p?.meta}))}),()=>{h||d.abort()}})}}const vn=(e,...t)=>typeof e=="function"?e(...t):e;function Ro(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function jo(e){const t=await vn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function Do(e,t){const n={method:"connectionParams",data:await vn(e)};return t.encode(n)}function $o(e){const{promise:t,resolve:n,reject:r}=Ro();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function Mo(e,{intervalMs:t,pongTimeoutMs:n}){let r,i;function s(){r=setTimeout(()=>{e.send("PING"),i=setTimeout(()=>{e.close()},n)},t)}function a(){clearTimeout(r),s()}function c(){clearTimeout(i),a()}e.addEventListener("open",s),e.addEventListener("message",({data:l})=>{clearTimeout(r),s(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(i)})}var Fo=class ct{constructor(t){var n;if(V(this,"id",++ct.connectCount),V(this,"WebSocketPonyfill",void 0),V(this,"urlOptions",void 0),V(this,"keepAliveOpts",void 0),V(this,"encoder",void 0),V(this,"wsObservable",Jr(null)),V(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=++ct.connectCount;const t=jo(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&&Mo(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await $o(n),this.urlOptions.connectionParams&&n.send(await Do(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()}}};V(Fo,"connectCount",0);var gn=class{constructor(e){V(this,"links",void 0),V(this,"runtime",void 0),V(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Zr({links:this.links,op:B(B({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(Yr())}async requestAsPromise(e){try{const t=this.$request(e);return(await Gr(t)).result.data}catch(t){throw Ve.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 i;(i=n.onConnectionStateChange)===null||i===void 0||i.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 a;(a=n.onStopped)===null||a===void 0||a.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 i;(i=n.onError)===null||i===void 0||i.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const bn=Symbol.for("trpc_untypedClient"),Bo={query:"query",mutate:"mutation",subscribe:"subscription"},Wo=e=>Bo[e];function Qo(e){const t=pn(({path:n,args:r})=>{const i=[...n],s=Wo(i.pop()),a=i.join(".");return e[s](a,...r)});return so(n=>n===bn?e:t[n])}function Ko(e){return Qo(new gn(e))}function Uo(e){return e[bn]}function Le(e){"@babel/helpers - typeof";return Le=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},Le(e)}function Ho(e,t){if(Le(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Le(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vo(e){var t=Ho(e,"string");return Le(t)=="symbol"?t:t+""}function zo(e,t,n){return(t=Vo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jt(Object(n),!0).forEach(function(r){zo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Go(e){var t,n,r,i=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Ue(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ue(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(i){return{value:i,done:r}})}return Ue=function(r){this.s=r,this.n=r.next},Ue.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var i=this.s.return;return i===void 0?Promise.resolve({value:r,done:!0}):t(i.apply(this.s,arguments))},throw:function(r){var i=this.s.return;return i===void 0?Promise.reject(r):t(i.apply(this.s,arguments))}},new Ue(e)}function Yo(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 Jo(e,t){if(e==null)return{};var n,r,i=Yo(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)&&(i[n]=e[n])}return i}const Zo=["cursor","direction"];function Je(e){return{path:e.path.join(".")}}function Xo(e){return e.length>=3}function ei(e){return Xo(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function bt(e,t,n){var r;const i=ei(e);let s=(r=i.args)===null||r===void 0?void 0:r.input;if(n){var a,c;s=x(x(x({},(a=(c=i.args)===null||c===void 0?void 0:c.input)!==null&&a!==void 0?a:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[i.path.join("."),s,t?.trpc]}async function ti(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const i=[];var s=!1,a=!1,c;try{for(var l=Go(e),u;s=!(u=await l.next()).done;s=!1){const d=u.value;i.push(d),r.setState({data:[...i]})}}catch(d){a=!0,c=d}finally{try{s&&l.return!=null&&await l.return()}finally{if(a)throw c}}return i}function se(e){const t=io(()=>{const{input:n,type:r}=e,i=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return i.length?[i]:[];if(r==="infinite"&&pe(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:a}=n;return[i,{input:Jo(n,Zo),type:"infinite"}]}return[i,x(x({},typeof n<"u"&&n!==ge&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function _n(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function _t(e){return to(e)?e():e}function ni(e){var t;const{input:n,query:r,path:i,queryKey:s,opts:a}=e,c=n===ge,l=async u=>{var d;const m=x(x({},a),{},{trpc:x(x({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...bt(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(er(x(x({},a??{}),{},{queryKey:s,queryFn:c?ge:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:Je({path:i})})}function ri(e){var t,n;const{mutate:r,path:i,prefix:s,opts:a,overrides:c}=e,l=_t(e.queryClient),u=_n({path:i,prefix:(t=a?.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(...bt([...u,{input:p}],a));return x(x({},a),{},{mutationKey:u,mutationFn:h,onSuccess(...p){var f,T;return m({originalFn:()=>{var L,A,k;return(L=a==null||(A=a.onSuccess)===null||A===void 0?void 0:A.call(a,...p))!==null&&L!==void 0?L:d==null||(k=d.onSuccess)===null||k===void 0?void 0:k.call(d,...p)},queryClient:l,meta:(f=(T=a?.meta)!==null&&T!==void 0?T:d?.meta)!==null&&f!==void 0?f:{}})},trpc:Je({path:i})})}function oi(e){const{input:t,query:n,path:r,queryKey:i,opts:s}=e,a=_t(e.queryClient),c=t===ge,l=async u=>{var d;const m=x(x({},s),{},{trpc:x(x({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),h=u.queryKey,p=await n(...bt(h,m));return oo(p)?ti(p,a,h):p};return Object.assign(tr(x(x({},s),{},{queryKey:i,queryFn:c?ge:l})),{trpc:Je({path:r})})}const ii=e=>{const{subscribe:t,path:n,queryKey:r,input:i,opts:s={}}=e,a="enabled"in s?!!s.enabled:i!==ge,c=l=>t(n.join("."),i===ge?void 0:i,l);return x(x({},s),{},{enabled:a,subscribe:c,queryKey:r,trpc:Je({path:n})})};function si(e){const t=e.keyPrefix,n=r=>(i,s,a)=>"router"in e?Promise.resolve(_t(e.ctx)).then(c=>vo({router:e.router,path:i,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof gn?e.client:Uo(e.client))[r](i,s,a);return pn(({args:r,path:i})=>{const s=[...i],a=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>se({path:s,type:"any",prefix:t}),pathFilter:()=>x(x({},c),{},{queryKey:se({path:s,type:"any",prefix:t})}),queryOptions:()=>oi({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:se({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>se({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>x(x({},l),{},{queryKey:se({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>ni({input:c,opts:l,path:s,queryKey:se({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>se({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>x(x({},l),{},{queryKey:se({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return ri({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:()=>_n({path:s,prefix:t}),subscriptionOptions:()=>ii({opts:l,path:s,input:c,queryKey:se({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function ai(){const e=ce(null),t=ce(null),n=s=>{const a=xe(()=>si({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return Q(e.Provider,{value:s.trpcClient},Q(t.Provider,{value:a},s.children))};n.displayName="TRPCProvider";function r(){const s=le(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function i(){const s=le(e);if(!s)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return s}return{TRPCProvider:n,useTRPC:r,useTRPCClient:i}}const lt={lan:new Set,animepahe:new Set,jasmr:new Set};function Ee(e){for(const t of[...lt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function wn(e,t){return lt[e].add(t),()=>{lt[e].delete(t)}}const ci=e=>new Promise(t=>setTimeout(t,e)),wt=async(e,t)=>{const n={};(!t?.body||!(t.body instanceof FormData))&&(n["Content-Type"]="application/json");const r=typeof e=="string"?e:e.toString();if(r.startsWith("/")||typeof window<"u"&&r.startsWith(window.location.origin)){const a=localStorage.getItem("animepahe_ua"),c=localStorage.getItem("animepahe_cookie"),l=localStorage.getItem("jasmr_ua"),u=localStorage.getItem("jasmr_cookie");a&&(n["x-animepahe-ua"]=a),c&&(n["x-animepahe-cookie"]=c),l&&(n["x-jasmr-ua"]=l),u&&(n["x-jasmr-cookie"]=u)}let s=await fetch(e,{...t,headers:{...n,...t?.headers}});for(let a=0;s.status===503&&a<8;a++)await ci(Math.min(500*2**a,4e3)),s=await fetch(e,{...t,headers:{...n,...t?.headers}});return s},li=async(e,t)=>{const n=await wt(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let i={};try{i=JSON.parse(r)}catch{}const s=typeof i.error=="string"?i.error:"";throw n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="animepahe"&&Ee("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="jasmr"&&Ee("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&Ee("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function ui(e,t){const n=await wt(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Ee("lan")}catch{}return await di(n),n}async function di(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 i=r?.error;if(!i||typeof i!="object")continue;const s=i.data?.cause;(i.message==="AUTH_REQUIRED"||s?.code==="AUTH_REQUIRED")&&(s?.provider==="animepahe"||s?.provider==="jasmr")&&Ee(s.provider),(i.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&Ee("lan")}}catch{}}const{TRPCProvider:mi,useTRPC:C}=ai(),X=Ko({links:[Lo({url:"/api/trpc",fetch:ui})]}),Ie=new Map,hi=500,pi=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let a=e;if(t&&!a.includes("w=")){const c=a.includes("?")?"&":"?";a+=`${c}w=${t}`}if(n&&!a.includes("h=")){const c=a.includes("?")?"&":"?";a+=`${c}h=${n}`}return a}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 i=`${r}-${t}-${n}`;if(Ie.has(i))return Ie.get(i);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 a=localStorage.getItem("animepahe_cookie"),c=localStorage.getItem("animepahe_ua");a&&(s+=`&cookie=${encodeURIComponent(a)}`),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 Ie.size>hi&&Ie.clear(),Ie.set(i,s),s},sl=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 al(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim():""}function cl(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const fi=(...e)=>e.filter(Boolean).join(" ");function yi(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const kn=ce(void 0),vi=()=>{const e=le(kn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},O={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",notifications:"notifications",settings:"settings",insights:"insights",insightsRecommendations:"insights-recommendations",providers:"providers",syncProfile:"sync-profile"},ll=()=>{const e=C(),t=G({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},ul=(e="TRENDING_DESC",t=10)=>vt({queryKey:[O.trendingList,e,t],queryFn:({pageParam:n=1})=>X.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),dl=(e="TV",t=12)=>vt({queryKey:[O.latestReleases,e,t],queryFn:({pageParam:n=1})=>X.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),ml=(e,t="TV",n=!0)=>{const r=C();return G({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},gi=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],hl=(e,t,n=14)=>{const r=C(),i=new URLSearchParams(e),s={page:t,limit:n};for(const a of gi){const c=i.get(a);c!==null&&(s[a]=c)}return G({...r.data.search.queryOptions(s),enabled:e!=null})},pl=()=>{const e=C();return G(e.queue.list.queryOptions())},bi=()=>{const e=C(),t=U();return ee(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?g.success("Added to queue"):g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},fl=()=>{const e=C(),t=U();return ee(e.queue.remove.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},yl=(e,t=!0)=>G({queryKey:[O.queueRemaining,e],queryFn:()=>X.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),vl=()=>{const e=C(),t=U();return ee(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const i=n.added??r.episodeNumbers.length;g.success(`${i} ${i===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},gl=()=>{const e=C(),t=U();return ee(e.queue.removeMany.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},bl=()=>{const e=C(),t=U();return ee(e.queue.clear.mutationOptions({onSuccess:()=>{g.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[O.queueRemaining]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to clear queue: ${n.message}`)}}))},_l=()=>{const e=C(),t=U(),n=e.queue.list.queryOptions().queryKey;return ee(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const i=t.getQueryData(n);return t.setQueryData(n,s=>{if(!s)return s;const a=new Map(s.map(c=>[c.id,c]));return r.map((c,l)=>{const u=a.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:i}},onError:(r,i,s)=>{s?.previousQueue&&t.setQueryData(n,s.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},_i=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function kt(e,t,n){const r=new URLSearchParams(e),i={page:t,limit:n};for(const s of _i){const a=r.get(s);a!==null&&(i[s]=a)}return i}const wl=(e,t="",n,r=14)=>G({queryKey:[O.watchlist,e,t,n,r],queryFn:async()=>{const i=new URLSearchParams(t);return i.set("status",e),await X.watchlist.list.query(kt(i.toString(),n,r))}}),kl=(e="")=>vt({queryKey:[O.continueWatching,e],queryFn:async({pageParam:t=1})=>await X.watchlist.continueWatchingAll.query(kt(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)})}),El=(e="",t,n=14)=>G({queryKey:[O.continueWatching,e,t,n],queryFn:async()=>await X.watchlist.continueWatchingAll.query(kt(e,t,n))}),Sl=()=>{const e=C(),t=U();return ee(e.watchlist.remove.mutationOptions({onSuccess:()=>{g.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[O.watchlist]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Pl=()=>{const e=C(),t=U();return ee(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{g.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[O.watchlist]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to update statuses: ${n.message}`)}}))},xl=()=>{const e=C(),t=U();return ee(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[O.watchlist]}),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Tl=()=>{const e=C(),t=U();return ee(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[O.continueWatching]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},En=(e=!0)=>{const t=C();return G({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},Sn=(e=!0)=>{const t=C();return G({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},Pn=(e=!0)=>{const t=C();return G({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},wi=()=>{const e=C(),t=U(),n=e.discovery.status.queryOptions().queryKey;return ee(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:[O.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},ki=()=>{const e=C(),t=U();return ee(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Ei=()=>{const e=C(),t=U();return ee(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Il=()=>{const e=C();return G({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},Nl=()=>{const e=C();return G({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},Ol=()=>G({queryKey:[O.genreCards],queryFn:()=>X.insights.genreCards.query()}),Si="_container_vk8jv_1",Pi="_bellBtn_vk8jv_7",xi="_badge_vk8jv_56",Ti="_dropdown_vk8jv_96",Ii="_dropdownHeader_vk8jv_127",Ni="_clearAllBtn_vk8jv_141",Oi="_discoveryStatusRow_vk8jv_159",Ci="_statusDot_vk8jv_170",Ai="_statusDotRunning_vk8jv_177",qi="_statusDotOk_vk8jv_182",Li="_statusDotInfo_vk8jv_186",Ri="_statusDotError_vk8jv_190",ji="_statusDotIdle_vk8jv_194",Di="_list_vk8jv_208",$i="_item_vk8jv_222",Mi="_thumbnail_vk8jv_237",Fi="_itemInfo_vk8jv_246",Bi="_itemTitle_vk8jv_251",Wi="_itemMeta_vk8jv_262",Qi="_systemItemMeta_vk8jv_272",Ki="_removeItem_vk8jv_289",Ui="_queueItem_vk8jv_319",Hi="_emptyState_vk8jv_323",Vi="_notificationDivider_vk8jv_371",v={container:Si,bellBtn:Pi,badge:xi,dropdown:Ti,dropdownHeader:Ii,clearAllBtn:Ni,discoveryStatusRow:Oi,statusDot:Ci,statusDotRunning:Ai,statusDotOk:qi,statusDotInfo:Li,statusDotError:Ri,statusDotIdle:ji,list:Di,item:$i,thumbnail:Mi,itemInfo:Fi,itemTitle:Bi,itemMeta:Wi,systemItemMeta:Qi,removeItem:Ki,queueItem:Ui,emptyState:Hi,notificationDivider:Vi},zi=({notification:e})=>{const t=ki(),n=bi(),[r,i]=ft.useState(!1),s=d=>{d.preventDefault(),d.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},a=()=>{t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},c=d=>{d.preventDefault(),d.stopPropagation(),i(!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(()=>i(!1),1e3)},{titlePreference:l}=vi(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(Z,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:v.item,onClick:a,children:[o("img",{src:pi(e.thumbnail,48,64),alt:e.name,className:v.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:u}),o("span",{className:v.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${v.removeItem} ${v.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(_,{name:"check"}):o(_,{name:"plus"})}),o("button",{className:v.removeItem,onClick:s,"aria-label":"Remove notification",children:o(_,{name:"times"})})]})};function et({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:i}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...i}})}const Gi=({count:e=3})=>o(z,{children:Array.from({length:e}).map((t,n)=>o("div",{className:v.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:v.thumbnail,style:{overflow:"hidden"},children:o(et,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:v.itemInfo,children:[o(et,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(et,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),Yi=()=>{const{data:e=[],isLoading:t}=En(),{data:n=[]}=Sn(),{data:r}=Pn(),i=Ei(),s=U(),[a,c]=E(null);w(()=>{s.invalidateQueries({queryKey:[O.notifications]})},[s]);const l=()=>{i.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:v.dropdown,children:[o("div",{className:v.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:v.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:v.discoveryStatusRow,children:r?.running?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotRunning}`,"aria-hidden":"true"}),o("span",{children:r.total>0?`Checking ${Math.min(r.done,r.total)}/${r.total} shows...`:"Checking for new episodes..."})]}):r?.state==="complete"?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete - checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching - nothing to check"})]}):r?.state==="error"?o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed - will retry automatically"})]}):o(z,{children:[o("span",{className:`${v.statusDot} ${v.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:r?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-r.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes"})]})}),o("div",{className:v.list,children:t&&n.length===0?o(Gi,{count:4}):o(z,{children:[n.map(d=>o("div",{className:v.item,children:[o("div",{className:v.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(_,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:d.title}),o("button",{type:"button",className:v.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:yi(d.message,40,"…")})]}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(_,{name:"plus"})}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(_,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:v.notificationDivider}),e.length>0?e.map(d=>o(zi,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:v.emptyState,children:"No new notifications"})]})}),u&&rn(o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem",backdropFilter:"blur(3px)"},onClick:()=>c(null),children:o("div",{style:{backgroundColor:"var(--bg-secondary)",padding:"1.5rem",borderRadius:"var(--radius-lg)",maxWidth:"420px",width:"100%",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border-primary)"},onClick:d=>d.stopPropagation(),children:[o("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem"},children:[o(_,{name:"info-circle",color:"#6c9fff"}),o("span",{style:{color:"#fff",fontWeight:600,fontSize:"1rem"},children:u.title})]}),o("p",{style:{color:"var(--text-secondary)",marginBottom:"1.5rem",lineHeight:1.5},children:u.message}),o("div",{style:{display:"flex",justifyContent:"flex-end"},children:o("button",{type:"button",onClick:()=>c(null),style:{background:"var(--accent)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},Ji=()=>{const[e,t]=E(!1),n=W(null),r=U(),i=C(),s=wi(),{data:a=[]}=En(),{data:c=[]}=Sn(),{data:l}=Pn(),u=a.length+c.length,d=u>5?"5+":u,m=W(!1);w(()=>{const p=f=>{n.current&&!n.current.contains(f.target)&&t(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),w(()=>{const p=!!l?.running;m.current&&!p&&(r.invalidateQueries(i.notifications.pathFilter()),r.invalidateQueries(i.discovery.pathFilter())),m.current=p},[l?.running,r,i]);const h=()=>{const p=!e;t(p),p&&s.mutate()};return o("div",{className:v.container,ref:n,children:[o("button",{className:v.bellBtn,onClick:h,"aria-label":"Notifications",children:[o(_,{name:"bell"}),u>0&&o("span",{className:v.badge,children:d})]}),e&&o(Yi,{})]})},Ze=e=>{const t=C();return G({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},xn=()=>{const e=C(),t=U();return ee(e.settings.set.mutationOptions({onSuccess:()=>{g.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[O.settings]})},onError:n=>{g.error(`Failed to update setting: ${n.message}`)}}))},Tn=ce(void 0),Zi=()=>{const e=le(Tn);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},ie={x:-2.8,y:-2,w:48.6,h:14},ut=15,Pe={w:13.6,h:10.2},ae=[{x:0,y:.5},{x:ut,y:-.9},{x:ut*2,y:.3}],Dt={x:Pe.w/2,y:Pe.h/2-.5},tt={y:Pe.h/2,x1:-2,x2:ut*2+Pe.w+1.4},$t=(e,t,n,r=0)=>{if(n.width<=0)return-1;const i=n.width/ie.w,s=(e-n.left)/i+ie.x,a=(t-n.top)/i+ie.y;for(let c=0;c<ae.length;c++){const l=s-ae[c].x,u=a-ae[c].y;if(l>=-r&&l<=Pe.w+r&&u>=-r&&u<=Pe.h+r)return c}return-1},Mt=7.5,Ft=e=>Math.max(-1,Math.min(1,e)),Xi=(e,t,n,r)=>{const i=n.width/ie.w,s=(e-n.left)/i+ie.x-r.x-Dt.x,a=(t-n.top)/i+ie.y-r.y-Dt.y;return{x:Ft(s/Mt),y:Ft(a/Mt)}},es=["normal","squint"],ts={normal:.72,squint:.28},Bt=(e=Math.random(),t)=>{let n=0;for(const r of es)if(n+=ts[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},ns="pet",rs="sleep",os=6e3,is=420,ss=.5,Wt=3e3,as=3e3,cs=ae.map((e,t)=>t*260),nt={from:ae.length-2,to:ae.length-1,after:400},Qt="data-dango-face",rt="data-dango-hover",ot="data-dango-cheer",Kt="data-dango-nudge",ls=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),Fe=()=>document.querySelectorAll("[data-dango-face-slot]"),us=e=>e.querySelectorAll("[data-dango-eye]"),ds=()=>document.querySelectorAll("[data-dango-eye]"),In=()=>{const{data:e}=Ze("dangoGaze"),{lowEndMode:t}=Zi();return e!=="false"&&!t},ms=()=>{const e=In();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=ae.map(()=>"normal");let n=-1,r=-1,i=!1,s=-1,a=0,c=0,l=0,u=0,d=0;const m=[],h=(y,I)=>{const b=window.setTimeout(()=>{m.splice(m.indexOf(b),1),y()},I);m.push(b)},p=(y,I,b)=>{Fe().forEach(D=>{Number(D.getAttribute("data-dango-face-slot"))===y&&(b?D.setAttribute(I,""):D.removeAttribute(I))})},f=y=>Fe().forEach(I=>I.removeAttribute(y)),T=(y,I,b)=>{f(I),requestAnimationFrame(()=>{p(y,I,!0),h(()=>f(I),b)})},P=()=>{Fe().forEach(y=>{const I=Number(y.getAttribute("data-dango-face-slot"));y.setAttribute(Qt,r===I?ns:t[I]),n===I?y.setAttribute(rt,""):y.removeAttribute(rt)})},L=y=>{y!==r&&(r>=0&&p(r,ot,!1),r=y,y>=0&&p(y,ot,!0))},A=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{L(-1),P()},is)},k=()=>{window.clearTimeout(d),L(-1)},$=()=>{i=!1,cs.forEach((y,I)=>{h(()=>{t[I]=Bt(),I===nt.from&&h(()=>T(nt.to,Kt,520),nt.after),P()},y)})},de=()=>{i=!0,t.fill(rs),k(),P()},Y=()=>{window.clearTimeout(u),u=window.setTimeout(de,os)},be=()=>{i||(s=(s+1)%t.length,t[s]=Bt(Math.random(),t[s]),P()),h(be,Wt+Math.random()*as)},te=()=>{const y=Array.from(ls(),J=>[J,J.getBoundingClientRect()]);y.forEach(([J,De])=>{us(J).forEach(ke=>{const{x:ne,y:ve}=Xi(c,l,De,ae[Number(ke.getAttribute("data-dango-eye"))]);ke.style.setProperty("--dango-gaze-x",ne.toFixed(3)),ke.style.setProperty("--dango-gaze-y",ve.toFixed(3))})});const I=y.find(([,J])=>c>=J.left&&c<=J.right&&l>=J.top&&l<=J.bottom)?.[1]??null,b=n,D=r,we=I?$t(c,l,I):-1,Te=we>=0?we:I?$t(c,l,I,ss):-1;n=we,Te>=0?(L(Te),A()):k(),(b!==n||D!==r)&&P(),i&&$(),Y()},_e=y=>{c=y.clientX,l=y.clientY,!a&&(a=requestAnimationFrame(()=>{a=0,te()}))},ye=y=>{y.relatedTarget||(n=-1,k(),P(),Y())};return P(),Y(),h(be,Wt),window.addEventListener("pointermove",_e,{passive:!0}),window.addEventListener("pointerout",ye),()=>{cancelAnimationFrame(a),window.clearTimeout(u),window.clearTimeout(d),m.forEach(window.clearTimeout),window.removeEventListener("pointermove",_e),window.removeEventListener("pointerout",ye),ds().forEach(y=>{y.style.removeProperty("--dango-gaze-x"),y.style.removeProperty("--dango-gaze-y")}),Fe().forEach(y=>{y.setAttribute(Qt,"normal"),y.removeAttribute(rt),y.removeAttribute(ot),y.removeAttribute(Kt)})}},[e])},Nn=ce(void 0),Cl=()=>{const e=le(Nn);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},Al=[{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"}],hs={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},ps="_logo_t3il2_1",fs="_skewer_t3il2_8",ys="_gaze_t3il2_15",vs="_face_t3il2_20",gs="_faceNormal_t3il2_25",bs="_facePet_t3il2_26",_s="_faceSquint_t3il2_27",ws="_faceSleep_t3il2_28",ks="_line_t3il2_36",Es="_sway_t3il2_44",Ss="_weight_t3il2_58",Ps="_shift_t3il2_73",xs="_rock_t3il2_87",Ts="_glance_t3il2_105",Is="_blinkDouble_t3il2_129 _blink_t3il2_124",Ns="_blinkSlow_t3il2_153 _blink_t3il2_124",Os="_bump_t3il2_172",Cs="_heart_t3il2_189",M={logo:ps,skewer:fs,gaze:ys,face:vs,faceNormal:gs,facePet:bs,faceSquint:_s,faceSleep:ws,line:ks,sway:Es,weight:Ss,shift:Ps,rock:xs,glance:Ts,blinkDouble:Is,blinkSlow:Ns,bump:Os,heart:Cs},Ut="var(--logo-ink)",As="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z",qs="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z",Ls="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z",Rs={pet:"M 4.85,5.15 Q 5.285,4.0 5.72,5.15 M 8.25,5.15 Q 8.618,4.0 8.99,5.15",squint:"M 4.82,3.9 L 5.6,4.62 L 4.82,5.34 M 9.08,3.9 L 8.3,4.62 L 9.08,5.34",sleep:"M 4.9,4.72 Q 5.285,5.28 5.67,4.72 M 8.25,4.72 Q 8.618,5.28 9.0,4.72"},On=[{lag:.8,hue:"iris",blink:"double",motion:"weight",glances:!1},{lag:1.4,hue:"sakura",blink:"slow",motion:"shift",glances:!1},{lag:1,hue:"mochi",blink:"slow",motion:"rock",glances:!0}],Ne=(e,t)=>e+Math.random()*(t-e),js=On.map(()=>({blinkDelay:-Ne(0,9),blinkDuration:Ne(3.4,8.6),motionDelay:-Ne(0,9),motionDuration:Ne(5.5,11),glanceDelay:-Ne(0,11)})),Ds={double:M.blinkDouble,slow:M.blinkSlow},$s={weight:M.weight,shift:M.shift,rock:M.rock},Ms={normal:M.faceNormal,pet:M.facePet,squint:M.faceSquint,sleep:M.faceSleep},Fs=["normal","pet","squint","sleep"],Bs=[{x:7,y:4.2,delay:0,drift:"0px"},{x:9.6,y:6.4,delay:-.3,drift:"-0.9px"},{x:4.6,y:6.1,delay:-.6,drift:"0.8px"},{x:8.2,y:3.4,delay:-.9,drift:"-0.4px"}],Et=({className:e})=>{const t=In();return o("svg",{viewBox:`${ie.x} ${ie.y} ${ie.w} ${ie.h}`,className:e?`${M.logo} ${e}`:M.logo,role:"img","aria-label":"dango","data-dango-gaze-origin":"",children:o("g",{className:t?M.sway:void 0,children:[o("path",{className:M.skewer,d:`M ${tt.x1},${tt.y} H ${tt.x2}`}),On.map((n,r)=>{const{x:i,y:s}=ae[r],a=js[r],{fill:c,stroke:l}=hs[n.hue],u=o("g",{"data-dango-eye":r,className:M.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:Fs.map(d=>o("g",{className:`${M.face} ${Ms[d]}`,children:o("g",{className:t&&d==="normal"?Ds[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${a.blinkDelay}s`,animationDuration:`${a.blinkDuration}s`}:void 0,children:d==="normal"?o(z,{children:[o("path",{fill:Ut,d:qs}),o("path",{fill:Ut,d:Ls})]}):o("path",{className:M.line,d:Rs[d]})})},d))});return o("g",{transform:`translate(${i} ${s})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?$s[n.motion]:void 0,style:t?{animationDelay:`${a.motionDelay}s`,animationDuration:`${a.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:As}),o("g",{className:M.bump,children:[t&&n.glances?o("g",{className:M.glance,style:{animationDelay:`${a.glanceDelay}s`},children:u}):u,t&&o("g",{children:Bs.map(d=>o("text",{className:M.heart,x:d.x,y:d.y,fill:"var(--color-danger)",style:{"--drift":d.drift,animationDelay:`${d.delay}s`},children:"♥"},d.x))})]})]})},n.hue)})]})})},Cn=ce(void 0),St=()=>{const e=le(Cn);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},An=ce(void 0),qn=()=>{const e=le(An);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},dt="virtual-keyboard:hide",Ht="virtual-keyboard:enabled-change",Ln="virtual_keyboard_enabled",Ws=!1;function Vt(){const e=localStorage.getItem(Ln);return e===null?Ws:e==="true"}const zt=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function Qs(){window.dispatchEvent(new CustomEvent(dt))}function Ks(){const[e,t]=E(!1),[n,r]=E(Vt),i=W(null);return w(()=>{const s=d=>{n&&zt(d.target)&&(i.current=d.target,t(!0))},a=d=>{d.target===i.current&&window.setTimeout(()=>{if(zt(document.activeElement)){i.current=document.activeElement,t(!0);return}i.current=null,t(!1)},0)},c=()=>{i.current=null,t(!1)},l=d=>{if(d.key!==Ln)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=Vt();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),window.addEventListener(dt,c),window.addEventListener("storage",l),window.addEventListener(Ht,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a),window.removeEventListener(dt,c),window.removeEventListener("storage",l),window.removeEventListener(Ht,u)}},[n]),{activeInputRef:i,isVisible:n&&e,hide:()=>t(!1)}}const Us="_header_q6huj_1",Hs="_hidden_q6huj_21",Vs="_scrolled_q6huj_25",zs="_logo_q6huj_31",Gs="_headerInner_q6huj_44",Ys="_leftSection_q6huj_54",Js="_desktopNav_q6huj_60",Zs="_navLink_q6huj_67",Xs="_navLinkActive_q6huj_83",ea="_rightSection_q6huj_102",ta="_searchWrapper_q6huj_108",na="_searchInput_q6huj_114",ra="_searchButton_q6huj_144",oa="_searchIcon_q6huj_168",ia="_profileBtn_q6huj_178",sa="_profileImg_q6huj_211",aa="_hamburgerBtn_q6huj_217",ca="_mobileSearchBar_q6huj_244",la="_mobileSearchBarHidden_q6huj_271",ua="_mobileSearchInner_q6huj_288",da="_mobileSearchIcon_q6huj_304",ma="_mobileSearchInput_q6huj_311",S={header:Us,hidden:Hs,scrolled:Vs,logo:zs,headerInner:Gs,leftSection:Ys,desktopNav:Js,navLink:Zs,navLinkActive:Xs,rightSection:ea,searchWrapper:ta,searchInput:na,searchButton:ra,searchIcon:oa,profileBtn:ia,profileImg:sa,hamburgerBtn:aa,mobileSearchBar:ca,mobileSearchBarHidden:la,mobileSearchInner:ua,mobileSearchIcon:da,mobileSearchInput:ma},ha=async()=>{let e;try{e=await X.auth.syncSettings.query()}catch{return null}const t=e.actualActiveProvider;if(t==="github")try{const n=await X.auth.githubStatus.query();if(n.authenticated&&n.user)return{name:n.user.name||n.user.login,picture:n.user.avatarUrl??void 0,provider:"github"}}catch{}if(t==="google")try{const n=await X.auth.user.query();if(n)return{name:n.name,picture:n.picture,email:n.email,provider:"google"}}catch{}return null},pa=()=>{const{toggleSidebar:e}=St(),{contentType:t}=qn(),[n,r]=E(""),[i,s]=E(!0),[a,c]=E(!1),[l,u]=E(!0),[d,m]=E(!1),h=Hn(),p=yt(),f=W(null),T=W(!1),P=W(null),L=W(null),A=W(null),k=W(null),$=W(!1),{data:de}=G({queryKey:[O.syncProfile],queryFn:ha,staleTime:3e4});w(()=>{const b=window.visualViewport;if(!b)return;const D=()=>{k.current?.style.setProperty("--vv-top",`${b.offsetTop}px`)};return D(),b.addEventListener("scroll",D),b.addEventListener("resize",D),()=>{b.removeEventListener("scroll",D),b.removeEventListener("resize",D)}},[]),w(()=>{const b=()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},D=()=>{b(),!(window.scrollY<=10)&&(f.current=window.setTimeout(()=>{$.current||s(!1)},2500))},we=()=>{T.current||(T.current=!0,P.current=requestAnimationFrame(()=>{T.current=!1,P.current=null;const ne=window.scrollY<=10;u(ve=>ve===ne?ve:ne),s(ve=>ve||!0),D()}))},Te=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"?(ne.preventDefault(),Y.current?.focus({preventScroll:!0})):ne.key==="Escape"&&document.activeElement===Y.current&&Y.current?.blur()},J=k.current,De=()=>{$.current=!0},ke=()=>{$.current=!1,D()};return window.addEventListener("scroll",we,{passive:!0}),window.addEventListener("keydown",Te),J?.addEventListener("pointerenter",De),J?.addEventListener("pointerleave",ke),()=>{window.removeEventListener("scroll",we),window.removeEventListener("keydown",Te),J?.removeEventListener("pointerenter",De),J?.removeEventListener("pointerleave",ke),b(),P.current!==null&&(cancelAnimationFrame(P.current),P.current=null),T.current=!1}},[a]);const Y=ft.useRef(null),be=()=>window.innerWidth<=1024,te=()=>{be()?(m(!0),setTimeout(()=>A.current?.focus({preventScroll:!0}),50)):document.activeElement===Y.current&&n.trim()?I():Y.current?.focus({preventScroll:!0})},_e=b=>{L.current?.contains(b.relatedTarget)||m(!1)},ye=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",y=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"},I=b=>{Qs();const D=n.trim();D&&h(t==="manga"?`/manga?q=${encodeURIComponent(D)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(D)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(D)}`:`/search?query=${encodeURIComponent(D)}`)};return o(z,{children:o("header",{ref:k,className:`${S.header} ${i?"":S.hidden} ${l?"":S.scrolled}`,children:[o("div",{className:S.headerInner,children:[o("div",{className:S.leftSection,children:[o("button",{className:S.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(_,{name:"bars"})}),o(Z,{to:"/",className:S.logo,"aria-label":"Ani-Web Home",children:o(Et,{})}),o("nav",{className:S.desktopNav,children:[o(Z,{to:"/",className:`${S.navLink} ${p.pathname==="/"?S.navLinkActive:""}`,children:"Home"}),o(Z,{to:y.to,className:`${S.navLink} ${p.pathname.startsWith(y.to)?S.navLinkActive:""}`,children:y.label}),t==="anime"&&o(Z,{to:"/insights",className:`${S.navLink} ${p.pathname==="/insights"?S.navLinkActive:""}`,children:"Insights"}),o(Z,{to:"/settings",className:`${S.navLink} ${p.pathname.startsWith("/settings")?S.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:S.rightSection,children:[o("div",{className:S.searchWrapper,children:[o("input",{ref:Y,type:"text","data-virtual-keyboard":"true",className:S.searchInput,placeholder:ye,value:n,onChange:b=>r(b.currentTarget.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:b=>{b.key==="Enter"&&I()}}),o("button",{type:"button",className:S.searchButton,"aria-label":"Search",onMouseDown:b=>b.preventDefault(),onClick:te,children:o(_,{name:"search",className:S.searchIcon})})]}),o(Ji,{}),o(Z,{to:"/settings?tab=sync",className:S.profileBtn,"aria-label":"Sync settings",children:de?.picture?o("img",{src:de.picture,alt:de.name,className:S.profileImg,referrerPolicy:"no-referrer",decoding:"async"}):de?.provider==="github"?o(_,{name:"github"}):o(_,{name:"cloud"})})]})]}),d&&o("div",{className:`${S.mobileSearchBar} ${i?"":S.mobileSearchBarHidden}`,ref:L,onBlur:_e,children:o("div",{className:S.mobileSearchInner,children:[o(_,{name:"search",className:S.mobileSearchIcon}),o("input",{ref:A,type:"text","data-virtual-keyboard":"true",className:S.mobileSearchInput,placeholder:ye,value:n,onChange:b=>r(b.currentTarget.value),onKeyDown:b=>{b.key==="Enter"?(I(),m(!1)):b.key==="Escape"&&m(!1)}})]})})]})})},mt="agreedToViewMature";function ht(){try{return localStorage.getItem(mt)==="true"}catch{return!1}}const Ce=new Set;function Rn(e){for(const t of Ce)t(e)}function Be(){Rn(ht())}function Gt(e){try{e?localStorage.setItem(mt,"true"):localStorage.removeItem(mt)}catch{}Rn(e)}function fa(){const[e,t]=E(ht);w(()=>(Ce.add(t),Ce.size===1&&(window.addEventListener("storage",Be),window.addEventListener("focus",Be)),t(ht()),()=>{Ce.delete(t),Ce.size===0&&(window.removeEventListener("storage",Be),window.removeEventListener("focus",Be))}),[]);const n=K(()=>Gt(!0),[]),r=K(()=>Gt(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const ya="_sidebar_153jc_1",va="_open_153jc_20",ga="_sidebarHeader_153jc_25",ba="_closeBtn_153jc_33",_a="_logo_153jc_57",wa="_navSection_153jc_69",ka="_navLink_153jc_75",Ea="_active_153jc_108",Sa="_overlay_153jc_118",Pa="_versionInfo_153jc_138",re={sidebar:ya,open:va,sidebarHeader:ga,closeBtn:ba,logo:_a,navSection:wa,navLink:ka,active:Ea,overlay:Sa,versionInfo:Pa},xa="3.7.3",jn={version:xa},Ta=()=>{const{isOpen:e,setIsOpen:t}=St(),{contentType:n}=qn(),{hasConsent:r}=fa(),i=()=>{t(!1)},s=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(_,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(_,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(_,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(_,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(_,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(_,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(_,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(_,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(_,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(_,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(_,{name:"sync-alt"}),label:"Trackers"},...r?[{to:"/mature",icon:o(_,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(_,{name:"cog"}),label:"Settings"}];return o(z,{children:[o("aside",{className:`${re.sidebar} ${e?re.open:""} sidebar`,children:[o("div",{className:re.sidebarHeader,children:[o("button",{className:re.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(Z,{to:"/",className:re.logo,onClick:i,children:o(Et,{})})]}),o("nav",{className:re.navSection,children:l.map(u=>o(Vn,{to:u.to,className:({isActive:d})=>`${re.navLink} ${d?re.active:""}`,onClick:i,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:re.versionInfo,children:["v",jn.version]})]}),e&&o("div",{className:re.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},Ia="_footer_1c905_1",Na="_footerInner_1c905_15",Oa="_brandSection_1c905_27",Ca="_logoRow_1c905_39",Aa="_logoText_1c905_45",qa="_brandMeta_1c905_51",La="_brandTagline_1c905_60",Ra="_statusPill_1c905_67",ja="_statusDot_1c905_80",Da="_linksGrid_1c905_88",$a="_linkColumn_1c905_96",Ma="_columnTitle_1c905_102",Fa="_bottomBar_1c905_126",Ba="_copyright_1c905_136",Wa="_brand_1c905_27",Qa="_heartIcon_1c905_152",Ka="_backToTop_1c905_157",q={footer:Ia,footerInner:Na,brandSection:Oa,logoRow:Ca,logoText:Aa,brandMeta:qa,brandTagline:La,statusPill:Ra,statusDot:ja,linksGrid:Da,linkColumn:$a,columnTitle:Ma,bottomBar:Fa,copyright:Ba,brand:Wa,heartIcon:Qa,backToTop:Ka},Ua=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:q.footer,children:[o("div",{className:q.footerInner,children:[o("div",{className:q.brandSection,children:[o("div",{className:q.logoRow,children:o(Et,{className:q.logoText})}),o("div",{className:q.brandMeta,children:[o("div",{className:q.statusPill,children:[o("span",{className:q.statusDot}),o("span",{children:["v",jn.version]})]}),o("p",{className:q.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:q.linksGrid,children:[o("div",{className:q.linkColumn,children:[o("h4",{className:q.columnTitle,children:"Navigation"}),o(Z,{to:"/",children:"Home"}),o(Z,{to:"/watchlist",children:"Watchlist"}),o(Z,{to:"/settings",children:"Settings"})]}),o("div",{className:q.linkColumn,children:[o("h4",{className:q.columnTitle,children:"Features"}),o(Z,{to:"/search",children:"Search Anime"}),o(Z,{to:"/trackers",children:"Trackers"}),o(Z,{to:"/insights",children:"Insights"})]}),o("div",{className:q.linkColumn,children:[o("h4",{className:q.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(_,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(_,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:q.linkColumn,children:[o("h4",{className:q.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:q.bottomBar,children:[o("p",{className:q.copyright,children:["© ",e," ",o("span",{className:q.brand,children:"dango"})," • Crafted with"," ",o(_,{name:"heart",className:q.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:q.backToTop,onClick:t,"aria-label":"Back to top",children:[o(_,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Dn(e){return JSON.stringify({0:e??{}})}function $n(e){return`/api/trpc/${e}?batch=1`}function pt(e,t){const n=Dn(t),r=$n(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 ql(e,t){await fetch($n(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Dn(t),keepalive:!0})}function Ll(e){e&&(pt("discord.clear",{sessionId:e}),pt("discord.heartbeat",{sessionId:e,bye:!0}))}function Ha(){const e=yt(),{data:t}=Ze("discordRPCEnabled"),n=W("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),w(()=>{if(t===!1||t==="false")return;const r=n.current,i=()=>X.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});i();const s=setInterval(i,15e3),a=()=>{pt("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(s),window.removeEventListener("pagehide",a)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let i="home";r.startsWith("/search")||r.startsWith("/mature")?i="search":r.startsWith("/watchlist")?i="watchlist":r.startsWith("/anime/")?i="anime":r.startsWith("/insights")?i="insights":r.startsWith("/settings")?i="settings":r.startsWith("/trackers")?i="trackers":r.startsWith("/asmr")?i="asmr":r.startsWith("/manga")?i="manga":r.startsWith("/tv")&&(i="tv"),X.discord.pageStatus.mutate({page:i}).catch(()=>{})},[e.pathname,t])}function Mn(e,t){const[n,r]=E(()=>{try{const s=localStorage.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=a=>{if(a.key===e)try{if(a.newValue===null){r(t);return}if(typeof t=="string"){r(a.newValue);return}try{r(JSON.parse(a.newValue))}catch{r(a.newValue)}}catch{}};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[e,t]);const i=K(s=>{r(a=>{const c=typeof s=="function"?s(a):s;try{typeof c=="string"?localStorage.setItem(e,c):localStorage.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,i]}const Fn=ce(void 0),Va=()=>{const e=le(Fn);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},za="_overlay_1juub_1",Ga="_fadeIn_1juub_1",Ya="_content_1juub_11",Ja="_modalIn_1juub_1",Za="_sm_1juub_29",Xa="_md_1juub_33",ec="_lg_1juub_37",tc="_title_1juub_41",nc="_body_1juub_48",rc="_footer_1juub_52",Se={overlay:za,fadeIn:Ga,content:Ya,modalIn:Ja,sm:Za,md:Xa,lg:ec,title:tc,body:nc,footer:rc};function Bn({children:e}){return o("h2",{className:Se.title,children:e})}function Wn({children:e}){return o("div",{className:Se.body,children:e})}function Qn({children:e}){return o("div",{className:Se.footer,children:e})}function je({isOpen:e,onClose:t,title:n,children:r,footer:i,width:s="md"}){const a=W(null),[c,l]=E(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",a.current?.focus(),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=d}},[e,t]),e?rn(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:Se.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${Se.content} ${Se[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(Bn,{children:n}),o(Wn,{children:r}),i&&o(Qn,{children:i})]})]}),c):null}je.Header=Bn;je.Body=Wn;je.Actions=Qn;const oc="_container_e96gf_1",ic="_field_e96gf_9",sc="_textarea_e96gf_20",ac="_input_e96gf_40",cc="_button_e96gf_58",lc="_secondaryButton_e96gf_78",uc="_actions_e96gf_95",dc="_hint_e96gf_104",mc="_link_e96gf_117",H={container:oc,field:ic,textarea:sc,input:ac,button:cc,secondaryButton:lc,actions:uc,hint:dc,link:mc},hc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",pc=e=>{try{return JSON.parse(e.detail)}catch{return null}},fc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=E(1),[s,a]=E(navigator.userAgent),[c,l]=E(""),[u,d]=E(!1),m=W(null),h=navigator.userAgent,p=/android/i.test(h),f=/firefox|fxios/i.test(h)&&!p,T=!f&&!p&&/chrome|chromium|edg|brave/i.test(h),P=f||T;w(()=>{e&&(i(1),a(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const L=()=>{localStorage.setItem("animepahe_ua",s),window.open("https://animepahe.pw","_blank","noopener,noreferrer"),i(2)},A=()=>{if(u)return;d(!0);const $=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,de=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),g.error("Helper not detected - install it via about:debugging first.")},3e3),Y=be=>{const te=pc(be);if(!(!te||te.requestId!==$))if(window.clearTimeout(de),window.removeEventListener("dango:pahe-cookie",Y),m.current=null,d(!1),te?.ok&&te.cookie)l(te.cookie),g.success("Cookie extracted from helper!");else if(te?.error==="NO_COOKIE"){const _e=te.debug?.stores?.length??0,ye=te.debug?.names??[];g.error(`Helper found no cf_clearance (checked ${_e} stores, saw: ${ye.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else g.error("Helper request failed - try again.")};m.current=Y,window.addEventListener("dango:pahe-cookie",Y),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:$}}))},k=()=>{const $=c.trim();if(!$){g.error("Please enter the cf_clearance cookie");return}try{localStorage.setItem("animepahe_cookie",$),g.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{g.error("Failed to save cookie")}};return o(je,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:H.container,children:r===1?o(z,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:H.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:s,readOnly:!0,rows:3,className:H.textarea})]}),o("div",{className:H.actions,children:[o("button",{className:H.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:H.button,onClick:L,children:"Start Verification (Opens AnimePahe)"})]})]}):o(z,{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."]}),P&&o("div",{className:H.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",f?o(z,{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(z,{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:hc,target:"_blank",rel:"noreferrer",className:H.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:H.actions,children:o("button",{className:H.button,onClick:A,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:H.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:$=>l($.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:H.input})]}),o("div",{className:H.actions,children:[o("button",{className:H.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:H.secondaryButton,onClick:()=>i(1),children:"Back"}),o("button",{className:H.button,onClick:k,children:"Submit"})]})]})})})};function yc(){const[e,t]=E(!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 vc="_screen_1pca0_1",gc="_icon_1pca0_14",bc="_title_1pca0_20",_c="_text_1pca0_24",wc="_button_1pca0_29",Oe={screen:vc,icon:gc,title:bc,text:_c,button:wc};class kc extends zn{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?o("div",{className:Oe.screen,children:[o(_,{name:"exclamation-triangle",className:Oe.icon}),o("h1",{className:Oe.title,children:"Something went wrong"}),o("p",{className:Oe.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Oe.button,children:[o(_,{name:"home"}),"Go back Home"]})]}):this.props.children}}const Kn=ce(void 0),Ec=()=>{const e=le(Kn);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Sc=({children:e})=>{const[t,n]=E(!1),r=K(()=>n(!0),[]),i=K(()=>n(!1),[]);return w(()=>wn("lan",r),[r]),o(Kn.Provider,{value:{isOpen:t,openModal:r,closeModal:i},children:e})},Pc="_container_88bss_1",xc="_field_88bss_8",Tc="_input_88bss_19",Ic="_actions_88bss_37",We={container:Pc,field:xc,input:Tc,actions:Ic},Yt=Gn(({variant:e="primary",size:t="md",loading:n,children:r,className:i="",disabled:s,...a},c)=>{const l=fi("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",i);return o("button",{className:l,disabled:s||n,ref:c,...a,children:n?o("span",{className:"btn-spinner"}):r})}),Nc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=E(""),[s,a]=E(!1);ft.useEffect(()=>{e&&i("")},[e]);const c=async()=>{if(!r){g.error("Please enter your password");return}a(!0);try{const l=await wt("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){g.error(u.error||"Login failed");return}g.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{g.error("Network error")}finally{a(!1)}};return o(je,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:We.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:We.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>i(l.currentTarget.value),placeholder:"Enter password...",className:We.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:We.actions,children:[o(Yt,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(Yt,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},Oc=R(()=>j(()=>import("./Home-BYuAVKgx.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]))),Cc=R(()=>j(()=>import("./Watchlist-DBmU8PNR.js"),__vite__mapDeps([34,1,2,4,10,11,12,5,13,3,6,7,8,9,14,15,16,17,18,35,36,37,38,39]))),Ac=R(()=>j(()=>import("./Settings-C-QEEujv.js"),__vite__mapDeps([40,1,2,41,42,4,43]))),Jt=R(()=>j(()=>import("./Player-2YKevlG4.js"),__vite__mapDeps([44,1,2,45,4,14,46,7,8,6,20,21,12,5,13,27,47,48,49,50,51,52]))),qc=R(()=>j(()=>import("./Search-CEErwr88.js"),__vite__mapDeps([53,1,4,3,5,6,7,8,9,10,11,2,12,13,14,15,16,17,18,37,38,54,55]))),Lc=R(()=>j(()=>import("./Mature-CMvs_-gf.js"),__vite__mapDeps([56,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,27,54,55,57]))),Zt=R(()=>j(()=>import("./Asmr-CP7vVwsh.js"),__vite__mapDeps([58,1,4,2,41,42,7,8,3,5,6,9,32,24,59,25,47,60,61,62]))),Rc=R(()=>j(()=>import("./Manga-COhyMd3K.js"),__vite__mapDeps([63,1,4,41,42,7,8,17,18,3,5,6,9,22,23,2,24,25,27,64,65,60,61]))),jc=R(()=>j(()=>import("./MangaInfoPage-LTEvl_nL.js"),__vite__mapDeps([66,1,4,17,18,23,2,24,64,65,60,61]))),Dc=R(()=>j(()=>import("./MangaReadPage-sEwzyBQ7.js"),__vite__mapDeps([67,1,17,4,18,2,23,24,64,65,60,61]))),$c=R(()=>j(()=>import("./ReadingList-C--ZvTe2.js"),__vite__mapDeps([68,1,3,4,5,6,7,8,9,69,15,16,17,18,35,36,22,23,2,24,25,26,19]))),Xt=R(()=>j(()=>import("./TvSearch-DcWcxRb1.js"),__vite__mapDeps([70,1,4,3,5,6,7,8,9,28,29,30,2,24,15,16,17,18,54,55]))),Mc=R(()=>j(()=>import("./TvInfo-BajXP7JJ.js"),__vite__mapDeps([71,1,4,30,2,24,72]))),Fc=R(()=>j(()=>import("./Tv-C6F9655r.js"),__vite__mapDeps([73,1,2,4,45,14,46,74,7,8,27,30,24,47,6,50,51,75]))),Bc=R(()=>j(()=>import("./TvWatchlist-Cf_25dKi.js"),__vite__mapDeps([76,1,3,4,5,6,7,8,9,69,15,16,17,18,35,36,19,29,30,2,24]))),Wc=R(()=>j(()=>import("./ListeningList-kRSLAo3B.js"),__vite__mapDeps([77,1,3,4,5,6,7,8,9,69,15,16,17,18,35,36,59,32,2,24,25,31,19]))),Qc=R(()=>j(()=>import("./Trackers-1i4Hd5D3.js"),__vite__mapDeps([78,1,2,4,79]))),Kc=R(()=>j(()=>import("./Insights-Bx01GySp.js"),__vite__mapDeps([80,1,2,4,81]))),Uc=R(()=>j(()=>import("./AnimeInfoPage-K0ErjilQ.js"),__vite__mapDeps([82,1,2,4]))),Hc=R(()=>j(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([83,1]))),Vc=R(()=>j(()=>import("./VirtualKeyboard-DeP7fb3P.js"),__vite__mapDeps([84,1,85])));function zc(){ms();const{isOpen:e,closeModal:t,onSuccess:n}=Va(),{isOpen:r,setIsOpen:i}=St(),{isOpen:s,openModal:a,closeModal:c}=Ec(),l=yt(),u=Yn(),d=W(new Map),m=W(l.pathname),h=Ks();Ha();const[p,f]=E(!1);w(()=>{li("/api/auth/app-status").then(A=>{A.hasPassword&&!A.isAuthenticated&&(f(!0),a())}).catch(()=>{})},[a]);const[T,P]=Mn("lan_auth_notice_shown","false"),L=W(!1);return w(()=>{if(T==="true"||L.current)return;L.current=!0,P("true");const A=setTimeout(()=>{g("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(A)},[T,P]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const A=l.key,k=d.current;if(u==="POP"){const $=k.get(A)??0;window.scrollTo({top:$,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{k.set(A,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const A=k=>{r&&k.key==="Escape"&&i(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A),document.body.classList.remove("sidebar-open")}},[r,i]),o("div",{className:"app-container",children:[o(fc,{isOpen:e,onClose:t,onSuccess:n}),o(Nc,{isOpen:s,onClose:p?()=>{}:c,onSuccess:()=>{f(!1),c()}}),o(Vr,{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"}}}}),o(pa,{}),o(Ta,{}),o("main",{className:"main-content",children:o(kc,{children:o(Pt,{fallback:o(yc,{}),children:o(Jn,{children:[o(N,{path:"/",element:o(Oc,{})}),o(N,{path:"/watchlist/:filter?",element:o(Cc,{})}),o(N,{path:"/reading-list/:filter?",element:o($c,{})}),o(N,{path:"/search",element:o(qc,{})}),o(N,{path:"/mature",element:o(Lc,{})}),o(N,{path:"/asmr",element:o(Zt,{})}),o(N,{path:"/asmr/:rj",element:o(Zt,{})}),o(N,{path:"/manga",element:o(Rc,{})}),o(N,{path:"/manga/:provider/:id",element:o(jc,{})}),o(N,{path:"/manga/:provider/:id/read",element:o(Dc,{})}),o(N,{path:"/tv",element:o(Xt,{})}),o(N,{path:"/tv/:id",element:o(Mc,{})}),o(N,{path:"/tv/:id/watch",element:o(Fc,{})}),o(N,{path:"/tv-search",element:o(Xt,{})}),o(N,{path:"/tv-watchlist/:filter?",element:o(Bc,{})}),o(N,{path:"/listening-list/:filter?",element:o(Wc,{})}),o(N,{path:"/settings",element:o(Ac,{})}),o(N,{path:"/trackers",element:o(Qc,{})}),o(N,{path:"/mal",element:o(xt,{to:"/trackers",replace:!0})}),o(N,{path:"/insights",element:o(Kc,{})}),o(N,{path:"/anime/:id",element:o(Uc,{})}),o(N,{path:"/watch/:id",element:o(Jt,{})}),o(N,{path:"/watch/:id/:episodeNumber",element:o(Jt,{})}),o(N,{path:"/player/:id/:episodeNumber?",element:o(Hc,{})}),o(N,{path:"*",element:o(xt,{to:"/",replace:!0})})]})})})}),o(Ua,{}),h.isVisible&&o(Pt,{fallback:null,children:o(Vc,{activeInputRef:h.activeInputRef,isVisible:h.isVisible,onClose:h.hide})})]})}function Gc(){return o(Sc,{children:o(zc,{})})}const Yc=({children:e})=>{const[t,n]=E(!1),r=K(()=>{n(s=>!s)},[]),i=xe(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(Cn.Provider,{value:i,children:e})},Jc=({children:e})=>{const[t,n]=Mn("dango_content_type","anime"),r=xe(()=>({contentType:t,setContentType:n}),[t,n]);return o(An.Provider,{value:r,children:e})},Zc=({children:e})=>{const[t,n]=E("englishName"),[r,i]=E(!0);w(()=>{(async()=>{try{const c=await X.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{i(!1)}})()},[]);const s=xe(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(kn.Provider,{value:s,children:e})},Xc=({children:e})=>{const{data:t,isLoading:n}=Ze("lowEndMode"),r=xn(),i=U(),[s,a]=E(!1);w(()=>{const u=i.getDefaultOptions();i.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,i]),w(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),w(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=K(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=xe(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(Tn.Provider,{value:l,children:e})},el=["iris","mochi","sakura"];function en(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const tl=({children:e})=>{const{data:t,isLoading:n}=Ze("theme"),r=xn(),[i,s]=E("iris");w(()=>{typeof t=="string"&&el.includes(t)&&s(t)},[t]),w(()=>{en(i)},[i]);const a=K(l=>{l!==i&&(s(l),en(l),r.mutate({key:"theme",value:l}))},[r,i]),c=xe(()=>({theme:i,setTheme:a,loading:n}),[i,a,n]);return o(Nn.Provider,{value:c,children:e})},nl=({children:e})=>{const[t,n]=E(!1),[r,i]=E(void 0),s=K(c=>{i(()=>c),n(!0)},[]),a=K(()=>{n(!1),i(void 0)},[]);return w(()=>wn("animepahe",()=>s()),[s]),o(Fn.Provider,{value:{isOpen:t,openModal:s,closeModal:a,onSuccess:r},children:e})};try{window.history.scrollRestoration="manual"}catch{}const tn=new nr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),nn=document.getElementById("root");nn&&Zn(o(Xn,{children:o(mi,{trpcClient:X,queryClient:tn,children:o(rr,{client:tn,children:o(nl,{children:o(Yc,{children:o(Jc,{children:o(Zc,{children:o(Xc,{children:o(tl,{children:o(Gc,{})})})})})})})})})}),nn);export{Ol as $,g as A,Yt as B,Ze as C,xn as D,xl as E,Tl as F,Pl as G,wt as H,F as I,li as J,Cl as K,Vt as L,je as M,Ht as N,cl as O,H as P,fc as Q,hl as R,et as S,Al as T,Qs as U,Ln as V,Ll as W,wn as X,ql as Y,St as Z,j as _,Mn as a,yc as a0,vl as a1,gl as a2,yl as a3,ul as b,dl as c,vi as d,fa as e,pi as f,sl as g,yi as h,C as i,ml as j,qn as k,Sl as l,pl as m,fl as n,bl as o,_l as p,O as q,Il as r,al as s,X as t,Zi as u,kl as v,ll as w,Nl as x,El as y,wl as z};
|
package/client/dist/assets/{libraryInvalidation-AzFLnbjH.js → libraryInvalidation-DI-v-DQ1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as r}from"./index-
|
|
1
|
+
import{q as r}from"./index-DB81Su4I.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=.8;const e="autoplayEnabled",E=(s,t)=>t>0&&s>=t*.8;const o=(s,t)=>t>0&&Number.isFinite(t)&&s>=t-.25,c=s=>s>5,l=()=>{try{return localStorage.getItem(e)==="true"}catch{return!1}},n=s=>{try{localStorage.setItem(e,String(s))}catch{}};export{a as C,o as a,c as h,E as i,l,n 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{i as v,A as h,q as A,t as y}from"./index-
|
|
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{i as v,A as h,q as A,t as y}from"./index-DB81Su4I.js";import{u as Q}from"./QueueOptionsButton-B4Re8F3V.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:[A.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 C}from"./vendor-core-DfaOB3Rn.js";import{b as p,u as d,a as l,e as Q}from"./vendor-query-BBT5_sHx.js";import{i as n,A as a,q as v,t as b}from"./index-
|
|
1
|
+
import{T as C}from"./vendor-core-DfaOB3Rn.js";import{b as p,u as d,a as l,e as Q}from"./vendor-query-BBT5_sHx.js";import{i as n,A as a,q as v,t as b}from"./index-DB81Su4I.js";import{i as g}from"./libraryInvalidation-DI-v-DQ1.js";function k(s){return String(s||"").trim().toUpperCase()}function H(s){return k(s.id||s._id||"")}function K(s){return!!s.isAdult}const U=["Listening","Completed","On-Hold","Dropped","Planned"],T=s=>k(s),x=(s="All",r=1,e=24)=>{const t=n();return p(t.asmrLibrary.list.queryOptions({status:s,page:r,limit:e}))},_=()=>{const s=n();return p({...s.asmrLibrary.ids.queryOptions(),staleTime:1e3*60})},W=s=>{const r=n();return p({...r.asmrLibrary.check.queryOptions({id:s||""}),enabled:!!s,staleTime:1e3*60})},j=(s=24)=>{const r=n();return p(r.asmrProgress.continueListening.queryOptions({limit:s}))},z=s=>{const r=n();return p({...r.asmrProgress.getByWork.queryOptions({workId:s||""}),enabled:!!s})},B=()=>{const s=n(),r=d();return l({mutationFn:async e=>{const{silent:t,...m}=e;return b.asmrLibrary.add.mutate(m)},onSuccess:(e,t)=>{t.silent||a.success("Added to listening list"),r.invalidateQueries({queryKey:[v.asmrLibrary]}),r.invalidateQueries(s.asmrLibrary.pathFilter())},onError:e=>{a.error(`Failed to add: ${e.message}`)}})},R=()=>{const s=n(),r=d();return l(s.asmrLibrary.remove.mutationOptions({onSuccess:()=>{a.success("Removed from listening list"),g(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{a.error(`Failed to remove: ${e.message}`)}}))},Y=()=>{const s=n(),r=d();return l(s.asmrLibrary.setStatus.mutationOptions({onSuccess:()=>{a.success("Status updated"),g(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{a.error(`Failed to update status: ${e.message}`)}}))},J=()=>{const s=n(),r=d();return l(s.asmrProgress.save.mutationOptions({onSuccess:()=>{g(r,"asmr",!0),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())}}))},V=()=>{const s=n(),r=d();return l(s.asmrProgress.remove.mutationOptions({onSuccess:()=>{a.success("Progress reset"),g(r,"asmr",!0),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{a.error(`Failed to reset progress: ${e.message}`)}}))},X=()=>{const s=n(),r=d();return l(s.asmrLibrary.batchStatus.mutationOptions({onSuccess:e=>{a.success(`Status updated for ${e.updated??0} items`),g(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{a.error(`Failed to update statuses: ${e.message}`)}}))},Z=()=>{const s=n(),r=d();return l(s.asmrLibrary.removeMany.mutationOptions({onSuccess:e=>{const t=e.removed??0;a.success(`Removed ${t} ${t===1?"item":"items"} from listening list`),g(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{a.error(`Failed to remove: ${e.message}`)}}))},ss=()=>{const s=n(),r=d();return l(s.asmrProgress.removeMany.mutationOptions({onSuccess:e=>{const t=e.removed??0;a.success(`Reset progress for ${t} ${t===1?"item":"items"}`),g(r,"asmr",!0),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{a.error(`Failed to reset progress: ${e.message}`)}}))},rs=()=>{const s=B(),r=R(),{data:e}=_(),t=C(()=>new Set(e?.ids||[]),[e]);return{toggle:o=>{const i=T(o.rjCode);t.has(i)?r.mutate({id:i}):s.mutate({...o,thumbnail:o.thumbnail||""})},bookmarkedIds:t,pending:s.isPending||r.isPending}},f=300*1e3,F=15,es=(s,r,e,t)=>{const m=r+1,o=Q({queries:Array.from({length:m},(u,E)=>{const P=E+1;return{queryKey:[v.asmrBrowse,s,P,e,t],queryFn:()=>{const O=s.trim();return b.asmr.browse.query({q:O||void 0,page:P,sort:e&&e!=="latest"?e:void 0,rating:t||void 0})},staleTime:f}})}),i=o.flatMap(u=>u.data?.shows??[]),A=i.slice((r-1)*F,r*F),y=o[o.length-1]?.data,L=!!(y&&(y.hasNext||i.length>r*F)),S=o.some(u=>u.isLoading),c=o.some(u=>u.isFetching),q=o.some(u=>u.isError);return{data:{shows:A,hasNext:L},isLoading:S,isError:q,isFetching:c}},ts=s=>{const r=n(),e=p({...r.asmr.work.queryOptions({rj:s}),enabled:!!s,staleTime:f,refetchOnMount:"always"});return{...e,data:e.data}},$=15,h=6;function I(s){if(s.isAdult||!s.thumbnail)return!1;const r=(s.rating||"").toLowerCase();return r===""||r==="sfw"}function w(s,r){const e=new Set,t=[];for(const m of s)for(const o of m){if(t.length>=r)return t;const i=o.id||o._id;!i||e.has(i)||(e.add(i),I(o)&&t.push(o))}return t}const os=(s=!0)=>{const r=Q({queries:Array.from({length:$},(c,q)=>{const u=q+1;return{queryKey:[v.asmrBrowse,"",u,"popular_month",""],queryFn:()=>b.asmr.browse.query({page:u,sort:"popular_month"}),staleTime:f,enabled:s,retry:1}})}),e=r.map(c=>c.data?.shows??[]),t=w(e,h),m=r.every(c=>c.isFetched),o=s&&m&&t.length<h,i=p({queryKey:[v.asmrBrowse,"",1,"popular","sfw"],queryFn:()=>b.asmr.browse.query({page:1,sort:"popular",rating:"sfw"}),staleTime:f,enabled:o,retry:1}),A=i.data?.shows??[],y=t.length>=h?t.slice(0,h):w([t,A],h),L=s&&(r.some(c=>c.isLoading)||o&&i.isLoading),S=s&&m&&y.length===0&&r.some(c=>c.isError);return{data:y,isLoading:L,isError:S}};export{U as A,H as a,os as b,ts as c,W as d,rs as e,z as f,k as g,J as h,B as i,es as j,T as k,K as l,x as m,R as n,Y as o,X as p,Z as q,ss as r,V as s,j as u};
|