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