@serifpersia/dango 3.8.4 → 3.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-arsIYutf.js → AnimeCard-DWKuN1cB.js} +1 -1
- package/client/dist/assets/AnimeInfo-BvNA7-QZ.js +1 -0
- package/client/dist/assets/AnimeInfoPage-BGg76ExO.js +2 -0
- package/client/dist/assets/Asmr-C8pvBHUO.js +2 -0
- package/client/dist/assets/AsmrPopup-BV5rbWXg.js +1 -0
- package/client/dist/assets/{AsmrResetProgressModal-CJlLLxvJ.js → AsmrResetProgressModal-Cs5wzgRU.js} +1 -1
- package/client/dist/assets/{Home-DtWNcknh.js → Home-C3k84yqn.js} +1 -1
- package/client/dist/assets/Home-grKghNM9.css +1 -0
- package/client/dist/assets/{Insights-BFEOElox.js → Insights-RSd-4osN.js} +1 -1
- package/client/dist/assets/{LibraryListPage-Cvu0K3yT.js → LibraryListPage-CHHjw4Jz.js} +1 -1
- package/client/dist/assets/ListeningList-DkgZaFkg.js +1 -0
- package/client/dist/assets/Manga-BAI78oiq.js +1 -0
- package/client/dist/assets/MangaInfoPage-CPYfuLAg.js +1 -0
- package/client/dist/assets/MangaReadPage-DvznQu_2.js +1 -0
- package/client/dist/assets/MangaResetProgressModal-BPci6zSM.js +1 -0
- package/client/dist/assets/{Mature-DCY32pCd.js → Mature-Cob1Zmtu.js} +1 -1
- package/client/dist/assets/{MatureConsentModal-zk8Ir04J.js → MatureConsentModal-BrKd4CBZ.js} +1 -1
- package/client/dist/assets/MediaCard-CJ-18Ma8.css +1 -0
- package/client/dist/assets/MediaCard-CXZJ8wr7.js +1 -0
- package/client/dist/assets/{OptionListMenu-BMdGIbak.js → OptionListMenu-ClUReC8J.js} +1 -1
- package/client/dist/assets/Player-1LfYnRyR.css +1 -0
- package/client/dist/assets/Player-7iroOb7T.js +56 -0
- package/client/dist/assets/PlayerProvider-DzaMVhFX.js +1 -0
- package/client/dist/assets/PlayerSettings-CbGkvNJq.css +1 -0
- package/client/dist/assets/{PlayerSettings-I5qwh2dG.js → PlayerSettings-DnFjoot8.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-CgPjlxhd.js → QueueOptionsButton-BdAz_Gn-.js} +1 -1
- package/client/dist/assets/QueueRail-BMLyoeAe.js +1 -0
- package/client/dist/assets/QueueRail-CcHdXRmS.css +1 -0
- package/client/dist/assets/{ReadingList-C3S-oiZU.js → ReadingList-B62vvh4_.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CZN-19N0.js → ResetProgressModal-CXDZfCap.js} +1 -1
- package/client/dist/assets/{Search-BK-3izwR.js → Search-CfNUqNi0.js} +1 -1
- package/client/dist/assets/Settings-B57LhIVH.css +1 -0
- package/client/dist/assets/Settings-CxC4k-nB.js +21 -0
- package/client/dist/assets/{SkeletonGrid-DWlQpD8M.js → SkeletonGrid-CmHR4_Fc.js} +1 -1
- package/client/dist/assets/Trackers-BC636V59.css +1 -0
- package/client/dist/assets/Trackers-BnvqfI9T.js +2 -0
- package/client/dist/assets/Tv-Dht8h84V.js +4 -0
- package/client/dist/assets/TvInfo-6fZeQsh1.js +1 -0
- package/client/dist/assets/{TvPopup-Bo-3peif.js → TvPopup-CIMgMYf0.js} +1 -1
- package/client/dist/assets/{TvSearch-Bzw_N9vB.js → TvSearch-DGG4xRiv.js} +1 -1
- package/client/dist/assets/TvWatchlist-B6DLkxqi.js +1 -0
- package/client/dist/assets/{VirtualKeyboard-B3STwvzu.js → VirtualKeyboard-D8TvygKk.js} +1 -1
- package/client/dist/assets/{WatchAlong-I0zNTgQi.js → WatchAlong-ivfsMGhR.js} +1 -1
- package/client/dist/assets/{WatchAlongPanel-DuGnVVja.js → WatchAlongPanel-CvUFCFll.js} +1 -1
- package/client/dist/assets/{Watchlist-raSYd6jM.js → Watchlist-dsmIAzsH.js} +1 -1
- package/client/dist/assets/index-Ej7BS74s.css +1 -0
- package/client/dist/assets/index-npJ4Ahxa.js +178 -0
- package/client/dist/assets/{libraryInvalidation-FFJuBJjR.js → libraryInvalidation-CHlEJU7b.js} +1 -1
- package/client/dist/assets/{playbackCompletion-UNMxJNR7.js → playbackCompletion-DB_c1lex.js} +1 -1
- package/client/dist/assets/{useAnimeInfoData-C0IMDPmT.js → useAnimeInfoData-DrWgr6PK.js} +1 -1
- package/client/dist/assets/useMangaLibrary-sGh96sdT.js +1 -0
- package/client/dist/assets/useMangaPopup-CWDMFbSD.js +1 -0
- package/client/dist/assets/{useProviders-UrTAFdZ7.js → useProviders-DphwZjpZ.js} +1 -1
- package/client/dist/assets/{useTv-218EB7PR.js → useTv-DatZ0tof.js} +1 -1
- package/client/dist/assets/{useTvLibrary-Dw8dk1-X.js → useTvLibrary-efdd6TIy.js} +1 -1
- package/client/dist/assets/useWatchAlongPlayer-CRf0zHFj.js +10 -0
- package/client/dist/assets/useWatchAlongPlayer-CzQyysyL.css +1 -0
- package/client/dist/index.html +2 -2
- package/package.json +2 -2
- package/server/dist/server.js +154 -154
- package/server/package.json +1 -1
- package/client/dist/assets/AnimeInfo-BN0BBGoL.js +0 -1
- package/client/dist/assets/AnimeInfoPage-BKWRJ_zM.js +0 -2
- package/client/dist/assets/Asmr-D841iN7S.js +0 -2
- package/client/dist/assets/AsmrPopup-bQNRqp8U.js +0 -1
- package/client/dist/assets/Home-DtY1sufI.css +0 -1
- package/client/dist/assets/ListeningList-BBCPOGtc.js +0 -1
- package/client/dist/assets/Manga-BzwrwVRY.js +0 -1
- package/client/dist/assets/MangaInfoPage-C9_jlomp.js +0 -1
- package/client/dist/assets/MangaReadPage-dlV9ruge.js +0 -1
- package/client/dist/assets/MangaResetProgressModal-C2audSPT.js +0 -1
- package/client/dist/assets/MediaCard-ByXxG9l_.js +0 -1
- package/client/dist/assets/MediaCard-CoyScn-7.css +0 -1
- package/client/dist/assets/Player-B8NgcAaG.js +0 -56
- package/client/dist/assets/Player-D-sQfjcx.css +0 -1
- package/client/dist/assets/PlayerProvider-BplcfsxC.js +0 -1
- package/client/dist/assets/PlayerSettings-BXGe3F5k.css +0 -1
- package/client/dist/assets/QueueRail-56BRY_9J.js +0 -1
- package/client/dist/assets/QueueRail-Bkh4VZls.css +0 -1
- package/client/dist/assets/Settings-C3A9xzAC.js +0 -21
- package/client/dist/assets/Settings-CXUYiXJY.css +0 -1
- package/client/dist/assets/Trackers-BTgn2ubb.js +0 -2
- package/client/dist/assets/Trackers-CvO6aWVx.css +0 -1
- package/client/dist/assets/Tv-CtiQrS7_.js +0 -4
- package/client/dist/assets/TvInfo-Bx4weneQ.js +0 -1
- package/client/dist/assets/TvWatchlist-DoMAHoqZ.js +0 -1
- package/client/dist/assets/index-BYIvl7ZE.css +0 -1
- package/client/dist/assets/index-CNEFXey-.js +0 -178
- package/client/dist/assets/useMangaLibrary-CzC0997w.js +0 -1
- package/client/dist/assets/useMangaPopup-D3j5_GPW.js +0 -1
- package/client/dist/assets/useWatchAlongPlayer-1fbftVwT.css +0 -1
- package/client/dist/assets/useWatchAlongPlayer-CTG8hA81.js +0 -10
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as Y,d as i,A as ye,u as e,S as g,g as ea,q as De}from"./vendor-core-DfaOB3Rn.js";import{u as V,b as R,a as S}from"./vendor-query-BBT5_sHx.js";import{J as r,q as s,t as c,ao as aa,v as na,X as qe,B as ge}from"./index-npJ4Ahxa.js";import{I as m}from"./vendor-icons-DrybRNxP.js";function ta(){const N=V();Y(()=>{const C=new URLSearchParams(window.location.search),h=C.get("mal");if(!h)return;const t=C.get("user"),y=C.get("reason");window.history.replaceState(null,"",window.location.pathname),h==="success"?(r.success(t?`Connected to MyAnimeList as ${decodeURIComponent(t)}`:"Connected to MyAnimeList"),N.invalidateQueries({queryKey:[s.trackerStatus]})):r.error(y?decodeURIComponent(y):"MyAnimeList authentication failed")},[N])}function sa(){const N=V(),[C,h]=i(!1);return Y(()=>{const t=new URLSearchParams(window.location.search),y=t.get("anilist");if(y){const k=t.get("user"),u=t.get("reason");window.history.replaceState(null,"",window.location.pathname),y==="success"?(r.success(k?`Connected to AniList as ${decodeURIComponent(k)}`:"Connected to AniList"),N.invalidateQueries({queryKey:[s.trackerStatus]})):r.error(u?decodeURIComponent(u):"AniList authentication failed");return}const b=new URLSearchParams(window.location.hash.substring(1)),l=b.get("access_token"),L=t.get("code");if(!l&&!L){const k=b.get("error");k&&(r.error(`AniList error: ${k}`),window.history.replaceState(null,"",window.location.pathname));return}const d=window.location.origin+window.location.pathname;window.history.replaceState(null,"",window.location.pathname),h(!0),r("Connecting to AniList..."),c.tracker.anilistAuth.mutate(l?{token:l}:{code:L,redirectUri:d}).then(async k=>{const u=k.user;r.success(`Connected to AniList as ${u?.name??"AniList user"}`),N.invalidateQueries({queryKey:[s.trackerStatus]})}).catch(k=>{r.error(k instanceof Error?k.message:"Failed to authenticate with AniList")}).finally(()=>{h(!1)})},[N]),C}const ia="_header_azjok_1",ra="_fadeIn_azjok_1",ca="_pageTitle_azjok_6",oa="_pageSubtitle_azjok_14",la="_importCard_azjok_20",da="_cardHeader_azjok_31",ma="_uploadArea_azjok_49",ua="_fileInputWrapper_azjok_53",pa="_fileInput_azjok_53",ha="_fileDisplay_azjok_71",ga="_fileIcon_azjok_79",ya="_fileName_azjok_84",ka="_browseButton_azjok_93",fa="_optionsArea_azjok_104",_a="_checkboxLabel_azjok_112",ba="_checkbox_azjok_112",va="_checkboxCustom_azjok_125",Na="_optionText_azjok_153",wa="_optionTitle_azjok_159",Ca="_optionDesc_azjok_165",Ia="_actions_azjok_171",Sa="_importBtn_azjok_179",La="_cancelBtn_azjok_185",Ma="_statusMessage_azjok_199",xa="_success_azjok_209",Ta="_error_azjok_215",Aa="_progressSection_azjok_221",za="_progressBar_azjok_226",Pa="_progressFill_azjok_234",ja="_progressInfo_azjok_241",Ba="_progressCount_azjok_248",Ea="_progressTitle_azjok_255",Fa="_sourceBadge_azjok_273",Da="_anilist_azjok_285",qa="_kitsu_azjok_291",$a="_offline_azjok_297",Ka="_skipped_azjok_303",Ra="_cardTitleRow_azjok_308",Ua="_anilistIcon_azjok_318",Qa="_malIcon_azjok_324",Oa="_badgeOnline_azjok_330",Ha="_badgeOffline_azjok_342",Ga="_connectedProfile_azjok_354",Wa="_avatar_azjok_361",Xa="_connectedInfo_azjok_368",Ja="_connectedName_azjok_376",Ya="_connectedHint_azjok_382",Va="_loginPrompt_azjok_387",Za="_loginSection_azjok_395",en="_primaryBtn_azjok_401",an="_fieldLabel_azjok_405",nn="_helpText_azjok_424",tn="_resetBtn_azjok_431",sn="_loginText_azjok_461",rn="_secondaryBtn_azjok_471",cn="_syncBtn_azjok_472",on="_divider_azjok_525",ln="_actionSection_azjok_531",dn="_inputGroup_azjok_545",mn="_credentialFields_azjok_551",un="_credentialField_azjok_551",pn="_input_azjok_545",hn="_syncSummary_azjok_587",gn="_syncErrors_azjok_593",yn="_spin_azjok_597",kn="_radioGroup_azjok_616",fn="_radioLabel_azjok_623",_n="_syncHint_azjok_661",bn="_importLoading_azjok_668",a={header:ia,fadeIn:ra,pageTitle:ca,pageSubtitle:oa,importCard:la,cardHeader:da,uploadArea:ma,fileInputWrapper:ua,fileInput:pa,fileDisplay:ha,fileIcon:ga,fileName:ya,browseButton:ka,optionsArea:fa,checkboxLabel:_a,checkbox:ba,checkboxCustom:va,optionText:Na,optionTitle:wa,optionDesc:Ca,actions:Ia,importBtn:Sa,cancelBtn:La,statusMessage:Ma,success:xa,error:Ta,progressSection:Aa,progressBar:za,progressFill:Pa,progressInfo:ja,progressCount:Ba,progressTitle:Ea,sourceBadge:Fa,anilist:Da,kitsu:qa,offline:$a,skipped:Ka,cardTitleRow:Ra,anilistIcon:Ua,malIcon:Qa,badgeOnline:Oa,badgeOffline:Ha,connectedProfile:Ga,avatar:Wa,connectedInfo:Xa,connectedName:Ja,connectedHint:Ya,loginPrompt:Va,loginSection:Za,primaryBtn:en,fieldLabel:an,helpText:nn,resetBtn:tn,loginText:sn,secondaryBtn:rn,syncBtn:cn,divider:on,actionSection:ln,inputGroup:dn,credentialFields:mn,credentialField:un,input:pn,syncSummary:hn,syncErrors:gn,spin:yn,radioGroup:kn,radioLabel:fn,syncHint:_n,importLoading:bn},ie="tracker_anilist_client_id",Re="49887".trim(),re=!!Re;function $e(){const N=V(),[C,h]=i(""),t=ye(!1),y=sa(),{data:b}=R({queryKey:[s.trackerStatus],queryFn:()=>c.tracker.status.query()}),{data:l}=R({queryKey:[s.anilistClientId],queryFn:async()=>(await c.settings.getByKey.query({key:ie})).value||""});Y(()=>{t.current||l===void 0||(l&&h(l),t.current=!0)},[l]);const L=S({mutationFn:()=>c.tracker.anilistDisconnect.mutate(),onSuccess:()=>{N.invalidateQueries({queryKey:[s.trackerStatus]}),r.success("Disconnected from AniList")},onError:_=>r.error(_.message)}),d=S({mutationFn:()=>c.settings.set.mutate({key:ie,value:""}),onSuccess:()=>{h(""),N.invalidateQueries({queryKey:[s.anilistClientId]}),r.success("Switched to dango's AniList app")},onError:_=>r.error(_.message)}),k=async()=>{const _=C.trim(),o=_||Re;if(!o){r.error("Enter your AniList client ID first");return}const P=(l||"").trim();try{_?_!==l&&await c.settings.set.mutate({key:ie,value:_}):re&&P&&await c.settings.set.mutate({key:ie,value:""}),N.invalidateQueries({queryKey:[s.anilistClientId]})}catch(M){r.error(M.message);return}const p=encodeURIComponent(window.location.origin+window.location.pathname);window.location.href=`https://anilist.co/api/v2/oauth/authorize?client_id=${encodeURIComponent(o)}&response_type=token&state=${p}`},u=b?.anilist?.user??null;return b?.anilist?.connected&&u?e("div",{className:a.connectedProfile,children:[u.avatar&&e("img",{src:u.avatar,alt:"Avatar",className:a.avatar,loading:"lazy",decoding:"async"}),e("div",{className:a.connectedInfo,children:[e("span",{className:a.connectedName,children:u.name}),e("span",{className:a.connectedHint,children:"2-way sync is ready"})]}),e("button",{className:a.secondaryBtn,onClick:()=>L.mutate(),disabled:L.isPending,children:[e(m,{name:"sign-out-alt"})," Disconnect"]})]}):e("div",{className:a.loginSection,children:[e("p",{className:a.loginText,children:["Log in with AniList to enable bidirectional progress & status synchronization.",y&&e("span",{style:{marginLeft:8,color:"var(--accent)"},children:"Finishing login…"})]}),e("div",{className:a.fieldLabel,children:["AniList client ID - defaults to dango's app"," ",e("a",{href:"https://anilist.co/settings/developer",target:"_blank",rel:"noopener noreferrer",children:["create your own app ",e(m,{name:"external-link-alt",size:9})]})]}),e("div",{className:a.inputGroup,children:[e("input",{type:"text",placeholder:"Client ID",value:C,onChange:_=>h(_.currentTarget.value),className:a.input}),e("button",{className:a.primaryBtn,onClick:k,disabled:!(C.trim()||re),children:[e(m,{name:"external-link-alt"})," Connect"]})]}),re&&l&&e("button",{className:a.resetBtn,onClick:()=>d.mutate(),disabled:d.isPending,children:"Use dango's app instead"}),e("p",{className:a.helpText,children:re?e(g,{children:["By default uses dango's client. To use your own AniList app: create it at"," ",e("a",{href:"https://anilist.co/settings/developer",target:"_blank",rel:"noopener noreferrer",children:"anilist.co/settings/developer"}),", set its ",e("strong",{children:"Redirect URL"})," to"," ",e("code",{children:`${window.location.origin}/api/tracker/anilist/callback`}),", then paste only the ",e("strong",{children:"Client ID"})," above (leave empty to use dango's)."]}):e(g,{children:["No shipped client in this build - create your own app at"," ",e("a",{href:"https://anilist.co/settings/developer",target:"_blank",rel:"noopener noreferrer",children:"anilist.co/settings/developer"}),", set ",e("strong",{children:"Redirect URL"})," to"," ",e("code",{children:`${window.location.origin}/api/tracker/anilist/callback`}),", then paste the"," ",e("strong",{children:"Client ID"})," above."]})})]})}function Ke({kind:N="anime",active:C=!0}){const h=V(),[t,y]=i(""),[b,l]=i(""),[L,d]=i(""),[k,u]=i(""),_=ye(!1),{data:o}=R({queryKey:[s.malClientConfig],queryFn:()=>c.tracker.malConfig.query()}),{data:P}=R({queryKey:[s.trackerStatus],queryFn:()=>c.tracker.status.query(),refetchInterval:15e3});Y(()=>{o&&!_.current&&(y(o.clientId),_.current=!0)},[o]);const p=S({mutationFn:async()=>{d(""),(b.trim()||t.trim()&&t.trim()!==o?.clientId)&&await c.tracker.malSaveConfig.mutate({clientId:t.trim(),clientSecret:b.trim()||void 0}),l("");const f=await c.tracker.malLogin.mutate({redirectUri:`${window.location.origin}/api/tracker/mal/callback`});window.location.assign(f.url)},onError:f=>d(f.message)}),M=S({mutationFn:()=>c.tracker.malDisconnect.mutate(),onSuccess:()=>{h.invalidateQueries({queryKey:[s.trackerStatus]}),u(""),d(""),r.success("Disconnected from MyAnimeList")},onError:f=>d(f.message)}),B=S({mutationFn:()=>c.tracker.malClearConfig.mutate(),onSuccess:()=>{y(""),l(""),u(""),d(""),h.invalidateQueries({queryKey:[s.trackerStatus]}),h.invalidateQueries({queryKey:[s.malClientConfig]}),r.success("Switched to dango's MyAnimeList app - reconnect to finish")},onError:f=>d(f.message)}),D=S({mutationFn:()=>N==="manga"?c.tracker.mangaMalSync.mutate():c.tracker.sync.mutate({provider:"mal"}),onSuccess:f=>{const T=f.summary;u(`Pushed: ${T.pushed} · Pulled: ${T.pulled} · Merged: ${T.merged} · Unchanged: ${T.unchanged}`+(T.errors.length>0?` · ${T.errors.length} error${T.errors.length>1?"s":""}`:""));for(const E of N==="manga"?[[s.trackerStatus],[s.mangaLibrary],[s.mangaContinueReading]]:[[s.trackerStatus],[s.watchlist],[s.continueWatching]])h.invalidateQueries({queryKey:E})},onError:f=>d(f.message)}),x=P?.mal;return e("div",{children:[x?.connected?e(g,{children:[e("div",{className:a.connectedProfile,children:[x.user?.avatar&&e("img",{src:x.user.avatar,alt:"Avatar",className:a.avatar,loading:"lazy",decoding:"async"}),e("div",{className:a.connectedInfo,children:[e("span",{className:a.connectedName,children:x.user?.name||"MyAnimeList user"}),e("span",{className:a.connectedHint,children:"2-way sync is ready"})]}),e("button",{className:a.secondaryBtn,onClick:()=>M.mutate(),disabled:M.isPending,children:[e(m,{name:"sign-out-alt"})," Disconnect"]})]}),C?e(g,{children:[e("button",{className:a.syncBtn,onClick:()=>D.mutate(),disabled:D.isPending,children:[e(m,{name:"sync-alt",className:D.isPending?a.spin:""}),D.isPending?"Syncing...":"Start Sync"]}),k&&e("div",{className:a.syncSummary,children:k})]}):e("p",{className:a.connectedHint,style:{color:"var(--color-warning)"},children:"Not the active tracker - sync disabled."})]}):e("div",{className:a.loginSection,children:[e("p",{className:a.loginText,children:"Log in with MyAnimeList to enable bidirectional progress & status synchronization."}),e("div",{className:a.credentialFields,children:[e("label",{className:`${a.fieldLabel} ${a.credentialField}`,children:[e("span",{children:["Client ID"," ",e("a",{href:"https://myanimelist.net/apiconfig",target:"_blank",rel:"noopener noreferrer",children:["create your own app ",e(m,{name:"external-link-alt",size:9})]}),o?.mode==="worker"&&e("span",{className:a.helpText,children:" — defaults to dango's app"})]}),e("input",{className:a.input,placeholder:o?.mode==="worker"?"dango's app (leave empty)":"Client ID",value:t,onChange:f=>y(f.currentTarget.value),autoComplete:"off"})]}),e("label",{className:`${a.fieldLabel} ${a.credentialField}`,children:[e("span",{children:["Client secret"," ",o?.hasSecret&&!b&&e("span",{className:a.helpText,children:"— saved"})]}),e("input",{className:a.input,type:"password",value:b,onChange:f=>l(f.currentTarget.value),placeholder:o?.mode==="worker"?"dango's app (leave empty)":o?.hasSecret?"Saved — leave blank to keep":"Client secret",autoComplete:"new-password"})]})]}),o?.hasCustomId&&o?.hasWorker&&e("button",{className:a.resetBtn,onClick:()=>B.mutate(),disabled:B.isPending,children:"Use dango's app instead"}),e("p",{className:a.helpText,children:o?.mode==="worker"?e(g,{children:["By default uses dango's client. To use your own MyAnimeList app: create it at"," ",e("a",{href:"https://myanimelist.net/apiconfig",target:"_blank",rel:"noopener noreferrer",children:"myanimelist.net/apiconfig"}),", set its ",e("strong",{children:"Redirect URL"})," to"," ",e("code",{children:[window.location.origin,"/api/tracker/mal/callback"]}),", then paste its"," ",e("strong",{children:"Client ID"})," and ",e("strong",{children:"Client secret"})," above (leave both empty to use dango's)."]}):e(g,{children:["No shipped client in this build - create your own app at"," ",e("a",{href:"https://myanimelist.net/apiconfig",target:"_blank",rel:"noopener noreferrer",children:"myanimelist.net/apiconfig"}),", set its ",e("strong",{children:"Redirect URL"})," to"," ",e("code",{children:[window.location.origin,"/api/tracker/mal/callback"]}),", then paste the"," ",e("strong",{children:"Client ID"})," and ",e("strong",{children:"Client secret"})," above. MAL requires the secret even for PKCE apps; it stays on your dango server and is never returned to the browser."]})}),e("button",{className:a.primaryBtn,onClick:()=>p.mutate(),disabled:!(t.trim()&&b.trim()||o?.clientId&&t.trim()===o.clientId&&o.hasSecret||!t.trim()&&!b.trim()&&o?.mode==="worker")||p.isPending,children:p.isPending?"Connecting...":"Connect to MyAnimeList"})]}),L&&e("p",{className:`${a.helpText} ${a.syncErrors}`,role:"alert",children:L}),e("hr",{className:a.divider}),e("p",{className:a.syncHint,children:"You can also import a public list or XML file without connecting an account:"})]})}const In=()=>{const{setIsOpen:N}=aa(),{contentType:C}=na(),h=C==="manga",t=V();ea.useEffect(()=>{document.title="Trackers - dango"},[]);const[y,b]=i(""),[l,L]=i("username"),[d,k]=i(null),[u,_]=i(!1);ta();const{data:o,isLoading:P}=R({queryKey:[s.trackerStatus],queryFn:async()=>await c.tracker.status.query()}),p=o?.anilist?.connected??!1,M=o?.mal?.connected??!1,{data:B}=R({queryKey:["activeTrackerProvider"],queryFn:async()=>(await c.settings.getByKey.query({key:"active_tracker_provider"}))?.value||""}),D=S({mutationFn:async n=>(await c.settings.set.mutate({key:"active_tracker_provider",value:n}),n),onSuccess:n=>{t.invalidateQueries({queryKey:["activeTrackerProvider"]}),r.success(`Active tracker set to ${n==="mal"?"MyAnimeList":"AniList"}`)},onError:()=>r.error("Failed to update active tracker")}),x=B&&(B==="anilist"&&p||B==="mal"&&M)?B:p&&!M?"anilist":M&&!p?"mal":p?"anilist":"",f=p||M;Y(()=>{p&&L("sync")},[p]);const T=S({mutationFn:async()=>(await c.tracker.sync.mutate({provider:"anilist"})).summary,onSuccess:n=>{t.invalidateQueries({queryKey:[s.watchlist]}),t.invalidateQueries({queryKey:[s.continueWatching]}),k(n),r.success(`Sync complete - pushed ${n.pushed}, pulled ${n.pulled}, merged ${n.merged}, unchanged ${n.unchanged}`,{duration:6e3})},onError:n=>r.error(n.message)}),[E,ke]=i(""),[Z,fe]=i("sync"),[ce,_e]=i("two-way"),[w,Ue]=i(null),ee=S({mutationFn:async()=>(await c.tracker.mangaSync.mutate({direction:ce})).summary,onSuccess:n=>{t.invalidateQueries({queryKey:[s.mangaLibrary]}),t.invalidateQueries({queryKey:[s.mangaContinueReading]}),Ue(n);const v=(n.warnings?.length??0)>0?`, ${n.warnings.length} warning(s)`:"";r.success(`Manga sync complete - pushed ${n.pushed}, pulled ${n.pulled}, merged ${n.merged}, unchanged ${n.unchanged}${v}`,{duration:6e3})},onError:n=>r.error(n.message)}),q=S({mutationFn:async()=>{if(!E.trim())throw new Error("Please enter a username");return(await c.tracker.mangaImport.mutate({username:E.trim(),erase:u})).count},onSuccess:n=>{t.invalidateQueries({queryKey:[s.mangaLibrary]}),t.invalidateQueries({queryKey:[s.mangaContinueReading]}),r.success(`Imported ${n} manga entries from AniList`),ke("")},onError:n=>r.error(n.message)}),[U,be]=i(""),[ae,ve]=i("username"),[oe,Ne]=i(null),[ne,we]=i(!1),[Ce,le]=i(""),[Ie,Qe]=i(""),j=S({mutationFn:async()=>{if(!U.trim())throw new Error("Please enter a MAL username");const n=await c.tracker.mangaMalImport.mutate({username:U.trim(),erase:u});return{imported:n.imported??0,skipped:n.skipped??0}},onSuccess:({imported:n,skipped:v})=>{t.invalidateQueries({queryKey:[s.mangaLibrary]}),t.invalidateQueries({queryKey:[s.mangaContinueReading]}),r.success(`Imported ${n} manga entries from MAL${v>0?`, skipped ${v}`:""}`),be("")},onError:n=>r.error(n.message)}),Oe=De(async()=>{const n=document.getElementById("malMangaFile");if(!n.files||n.files.length===0){le("Please select a file first.");return}we(!0),le(""),Ne(null);try{const v=new FormData;v.append("xmlfile",n.files[0]),v.append("erase",String(u));const W=await qe("/api/import/mal-xml-manga",{method:"POST",body:v}),I=await W.json().catch(()=>({}));if(!W.ok)throw new Error(I.error||"Import failed");Ne({imported:I.imported??0,skipped:I.skipped??0}),t.invalidateQueries({queryKey:[s.mangaLibrary]}),t.invalidateQueries({queryKey:[s.mangaContinueReading]})}catch(v){le(v.message)}finally{we(!1)}},[u,t]),$=S({mutationFn:async()=>{if(!y.trim())throw new Error("Please enter a username");return(await c.tracker.anilistImport.mutate({username:y.trim(),erase:F})).count},onSuccess:n=>{t.invalidateQueries({queryKey:[s.watchlist]}),t.invalidateQueries({queryKey:[s.continueWatching]}),r.success(`Imported ${n} anime entries from AniList`),b("")},onError:n=>r.error(n.message)}),[Q,Se]=i(""),z=S({mutationFn:async n=>{if(!Q.trim())throw new Error("Please enter a MAL username");return(await c.tracker.malImport.mutate({username:Q.trim(),erase:n.erase,useOfflineDb:n.useOfflineDb,skipFallback:n.skipFallback})).count},onSuccess:n=>{t.invalidateQueries({queryKey:[s.watchlist]}),t.invalidateQueries({queryKey:[s.continueWatching]}),r.success(`Imported ${n} anime entries from MAL`),Se("")},onError:n=>r.error(n.message)}),[F,Le]=i(!1),[O,He]=i(!0),[H,Ge]=i(!1),[Me,xe]=i(""),[K,Te]=i(!1),[A,Ae]=i(null),[de,ze]=i(null),[Pe,te]=i(""),me=ye(null),We=n=>{n.currentTarget.files&&n.currentTarget.files.length>0?xe(n.currentTarget.files[0].name):xe("")},Xe=De(async()=>{const n=document.getElementById("malFile");if(!n.files||n.files.length===0){te("Please select a file first.");return}const v=n.files[0];Te(!0),Ae(null),ze(null),te("");const W=new AbortController;me.current=W;try{const I=new FormData;I.append("xmlfile",v),I.append("erase",String(F)),I.append("useOfflineDb",String(O)),I.append("skipFallback",String(H));const ue=await qe("/api/import/mal-xml",{method:"POST",body:I,signal:W.signal});if(!ue.ok){const he=await ue.text();let X="Failed to import";try{X=JSON.parse(he).error||X}catch{}throw new Error(X)}const Be=ue.body?.getReader();if(!Be)throw new Error("No response stream");const Ve=new TextDecoder;let pe="",se="";for(;;){const{done:he,value:X}=await Be.read();if(he)break;pe+=Ve.decode(X,{stream:!0});const Ee=pe.split(`
|
|
2
|
+
`);pe=Ee.pop()||"";for(const J of Ee)if(J.startsWith("event: "))se=J.slice(7).trim();else if(J.startsWith("data: ")){const Ze=J.slice(6);try{const Fe=JSON.parse(Ze);se==="progress"?Ae(Fe):se==="complete"&&ze(Fe)}catch{}}else J===""&&(se="")}t.invalidateQueries({queryKey:[s.watchlist]})}catch(I){I instanceof DOMException&&I.name==="AbortError"?te("Import cancelled."):te(I.message)}finally{Te(!1),me.current=null}},[F,O,H,t]),Je=()=>{me.current?.abort(),c.settings.malImportCancel.mutate().catch(()=>{})},Ye=A?Math.round(A.current/A.total*100):0,[G,je]=i("username");return e("div",{className:"page-container",children:[e("div",{className:a.header,children:[e("h1",{className:a.pageTitle,children:"Trackers"}),e("p",{className:a.pageSubtitle,children:"Import & sync your anime watchlists and manga reading lists with tracking services"})]}),e("div",{style:{marginBottom:"16px",fontSize:"0.8rem",color:"var(--color-warning)",borderBottom:"1px solid var(--border-primary)",paddingBottom:"12px"},children:"⚠ Syncing writes directly to your AniList and MyAnimeList entries, and dango may not always handle anime/manga lists correctly - always keep a backup of your lists before syncing."}),f&&e("div",{style:{marginBottom:"16px",display:"flex",alignItems:"center",gap:"10px",fontSize:"0.85rem"},children:[e("label",{htmlFor:"active-tracker-select",style:{fontWeight:600,color:"var(--text-secondary)"},children:"Active tracker:"}),e("select",{id:"active-tracker-select",value:x,onChange:n=>D.mutate(n.currentTarget.value),style:{padding:"0.3rem 0.5rem",borderRadius:"var(--radius-md)",background:"var(--bg-tertiary)",color:"var(--text-primary)",border:"1px solid var(--border-primary)",fontSize:"var(--font-size-sm)",cursor:"pointer"},children:[p&&e("option",{value:"anilist",children:"AniList"}),M&&e("option",{value:"mal",children:"MyAnimeList"})]})]}),!h&&e(g,{children:e("div",{className:a.importCard,children:[e("div",{className:a.cardHeader,children:e("div",{className:a.cardTitleRow,children:[e(m,{name:"anilist",className:a.anilistIcon}),e("h3",{children:"AniList"}),P?null:p?e("span",{className:a.badgeOnline,children:"Connected"}):e("span",{className:a.badgeOffline,children:"Not connected"})]})}),e($e,{}),p&&x!=="anilist"&&e("p",{style:{color:"var(--color-warning)",marginTop:"8px",fontSize:"0.85rem"},children:"Not the active tracker - sync disabled."}),p&&x==="anilist"&&e(g,{children:[e("hr",{className:a.divider}),e("div",{className:a.radioGroup,children:[e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"anilistMode",value:"username",checked:l==="username",onChange:()=>L("username")}),e("span",{children:"Quick Import"})]}),e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"anilistMode",value:"sync",checked:l==="sync",onChange:()=>L("sync")}),e("span",{children:"Two-way Sync"})]})]}),l==="username"?e("div",{className:a.inputGroup,children:e("input",{type:"text",placeholder:"Enter AniList username",value:y,onChange:n=>b(n.currentTarget.value),className:a.input,disabled:$.isPending,onKeyDown:n=>{n.key==="Enter"&&y.trim()&&$.mutate()}})}):e("p",{className:a.syncHint,children:"Merges progress non-destructively: pushes shows and episodes you watched on dango to AniList, and pulls anything you updated on AniList into dango."}),l==="username"&&e("div",{className:a.optionsArea,children:e("label",{className:a.checkboxLabel,children:[e("input",{type:"checkbox",checked:F,onChange:n=>Le(n.currentTarget.checked),className:a.checkbox,disabled:$.isPending}),e("span",{className:a.checkboxCustom}),e("div",{className:a.optionText,children:[e("span",{className:a.optionTitle,children:"Erase current watchlist"}),e("span",{className:a.optionDesc,children:"Delete existing watchlist before importing."})]})]})}),l==="username"?e("button",{className:a.syncBtn,onClick:()=>$.mutate(),disabled:!y.trim()||$.isPending,children:[e(m,{name:"download"}),$.isPending?"Importing...":"Start Import"]}):e(g,{children:[e("button",{className:a.syncBtn,onClick:()=>T.mutate(),disabled:T.isPending,children:[e(m,{name:"sync-alt",className:T.isPending?a.spin:""}),T.isPending?"Syncing...":"Start Sync"]}),d&&e("div",{className:a.syncSummary,children:["Pushed: ",d.pushed," · Pulled: ",d.pulled," · Merged:"," ",d.merged," · Unchanged: ",d.unchanged,d.errors.length>0&&e("span",{className:a.syncErrors,children:[" ","· ",d.errors.length," error",d.errors.length>1?"s":""]})]})]})]})]})}),h&&e(g,{children:e("div",{className:a.importCard,children:[e("div",{className:a.cardHeader,children:e("div",{className:a.cardTitleRow,children:[e(m,{name:"anilist",className:a.anilistIcon}),e("h3",{children:"AniList Manga"}),P?null:p?e("span",{className:a.badgeOnline,children:"Connected"}):e("span",{className:a.badgeOffline,children:"Not connected"})]})}),e($e,{}),p&&x!=="anilist"&&e("p",{style:{color:"var(--color-warning)",marginTop:"8px",fontSize:"0.85rem"},children:"Not the active tracker - sync disabled."}),p&&x==="anilist"&&e(g,{children:[e("hr",{className:a.divider}),e("div",{className:a.radioGroup,children:[e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"mangaMode",value:"username",checked:Z==="username",onChange:()=>fe("username")}),e("span",{children:"Quick Import"})]}),e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"mangaMode",value:"sync",checked:Z==="sync",onChange:()=>fe("sync")}),e("span",{children:"Two-way Sync"})]})]}),Z==="username"?e(g,{children:[e("div",{className:a.inputGroup,children:e("input",{type:"text",placeholder:"Enter AniList username",value:E,onChange:n=>ke(n.currentTarget.value),className:a.input,disabled:q.isPending,onKeyDown:n=>{n.key==="Enter"&&E.trim()&&q.mutate()}})}),e("div",{className:a.optionsArea,children:e("label",{className:a.checkboxLabel,children:[e("input",{type:"checkbox",checked:u,onChange:n=>_(n.currentTarget.checked),className:a.checkbox,disabled:q.isPending}),e("span",{className:a.checkboxCustom}),e("div",{className:a.optionText,children:[e("span",{className:a.optionTitle,children:"Replace AniList-linked manga"}),e("span",{className:a.optionDesc,children:"Clears previously imported (anilist:) entries before importing. Your provider bookmarks are never touched."})]})]})})]}):e(g,{children:[e("p",{className:a.syncHint,children:"Merges chapter progress non-destructively: pushes manga and chapters you read on dango to AniList, and pulls anything you updated on AniList into dango. Local titles are linked only on exact title matches, and bookmarks with no chapters read are never pushed."}),e("div",{className:a.radioGroup,children:[e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"mangaDirection",value:"two-way",checked:ce==="two-way",onChange:()=>_e("two-way")}),e("span",{children:"Two-way"})]}),e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"mangaDirection",value:"pull-only",checked:ce==="pull-only",onChange:()=>_e("pull-only")}),e("span",{children:"Pull only (never writes to AniList)"})]})]})]}),Z==="username"?e("button",{className:a.syncBtn,onClick:()=>q.mutate(),disabled:!E.trim()||q.isPending,children:[e(m,{name:"download"}),q.isPending?"Importing...":"Start Import"]}):e(g,{children:[e("button",{className:a.syncBtn,onClick:()=>ee.mutate(),disabled:ee.isPending,children:[e(m,{name:"sync-alt",className:ee.isPending?a.spin:""}),ee.isPending?"Syncing...":"Start Manga Sync"]}),w&&e(g,{children:[e("div",{className:a.syncSummary,children:["Pushed: ",w.pushed," · Pulled: ",w.pulled," · Merged: ",w.merged," · Unchanged:"," ",w.unchanged,(w.skipped??0)>0&&e("span",{children:[" · Skipped: ",w.skipped]}),w.errors.length>0&&e("span",{className:a.syncErrors,children:[" ","· ",w.errors.length," error",w.errors.length>1?"s":""]})]}),(w.warnings?.length??0)>0&&e("div",{className:a.syncErrors,style:{marginTop:"8px"},children:[(w.warnings??[]).slice(0,5).map((n,v)=>e("div",{children:["⚠ ",n]},v)),(w.warnings?.length??0)>5&&e("div",{children:["+",(w.warnings?.length??0)-5," more warning(s)"]})]})]})]})]})]})}),!h&&e(g,{children:e("div",{className:a.importCard,children:[e("div",{className:a.cardHeader,children:e("div",{className:a.cardTitleRow,children:[e(m,{name:"myanimelist",className:a.malIcon}),e("h3",{children:"MyAnimeList"}),P?null:M?e("span",{className:a.badgeOnline,children:"Connected"}):e("span",{className:a.badgeOffline,children:"Not connected"})]})}),e(Ke,{active:x==="mal"}),e("div",{className:a.radioGroup,children:[e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"malMode",value:"username",checked:G==="username",onChange:()=>je("username")}),e("span",{children:"Username"})]}),e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"malMode",value:"xml",checked:G==="xml",onChange:()=>je("xml")}),e("span",{children:"XML File"})]})]}),G==="username"?e(g,{children:[e("div",{className:a.inputGroup,children:e("input",{type:"text",placeholder:"Enter MAL username",value:Q,onChange:n=>Se(n.currentTarget.value),className:a.input,disabled:z.isPending,onKeyDown:n=>{n.key==="Enter"&&Q.trim()&&z.mutate({erase:F,useOfflineDb:O,skipFallback:H})}})}),z.isPending&&e("div",{className:a.importLoading,children:[e(m,{name:"sync-alt",className:a.spin}),e("span",{children:"Importing from MAL..."})]})]}):e("div",{className:a.uploadArea,children:e("div",{className:a.fileInputWrapper,children:[e("input",{type:"file",id:"malFile",accept:".xml,application/xml",className:a.fileInput,onChange:We,disabled:K}),e("div",{className:a.fileDisplay,children:[e(m,{name:"file-alt",className:a.fileIcon}),e("span",{className:a.fileName,children:Me||"Choose XML file..."})]}),e("label",{htmlFor:"malFile",className:a.browseButton,children:"Browse"})]})}),e("div",{className:a.optionsArea,children:[e("label",{className:a.checkboxLabel,children:[e("input",{type:"checkbox",checked:F,onChange:n=>Le(n.currentTarget.checked),className:a.checkbox,disabled:K||z.isPending}),e("span",{className:a.checkboxCustom}),e("div",{className:a.optionText,children:[e("span",{className:a.optionTitle,children:"Erase current watchlist"}),e("span",{className:a.optionDesc,children:"Delete existing watchlist before importing."})]})]}),e("label",{className:a.checkboxLabel,children:[e("input",{type:"checkbox",checked:O,onChange:n=>He(n.currentTarget.checked),className:a.checkbox,disabled:K||z.isPending}),e("span",{className:a.checkboxCustom}),e("div",{className:a.optionText,children:[e("span",{className:a.optionTitle,children:"Use offline database (fast)"}),e("span",{className:a.optionDesc,children:"Match by MAL ID locally first - instant and avoids AniList rate limits."})]})]}),e("label",{className:a.checkboxLabel,children:[e("input",{type:"checkbox",checked:H,onChange:n=>Ge(n.currentTarget.checked),className:a.checkbox,disabled:K||z.isPending}),e("span",{className:a.checkboxCustom}),e("div",{className:a.optionText,children:[e("span",{className:a.optionTitle,children:"Skip online fallback"}),e("span",{className:a.optionDesc,children:"Only import offline matches. Unmatched titles are skipped without API calls."})]})]})]}),G==="username"?e("button",{className:a.syncBtn,onClick:()=>z.mutate({erase:F,useOfflineDb:O,skipFallback:H}),disabled:!Q.trim()||z.isPending,children:[e(m,{name:"download"}),z.isPending?"Importing...":"Start Import"]}):e("div",{className:a.actions,children:K?e(ge,{onClick:Je,className:a.cancelBtn,children:"Cancel Import"}):e(ge,{onClick:Xe,className:a.importBtn,disabled:!Me,children:[e(m,{name:"upload"})," Start Import"]})}),G==="username"&&z.isError&&e("div",{className:`${a.statusMessage} ${a.error}`,children:z.error.message}),K&&A&&e("div",{className:a.progressSection,children:[e("div",{className:a.progressBar,children:e("div",{className:a.progressFill,style:{width:`${Ye}%`}})}),e("div",{className:a.progressInfo,children:[e("span",{className:a.progressCount,children:[A.current," / ",A.total]}),e("span",{className:a.progressTitle,children:A.found?e(g,{children:[A.matchedTitle,e("span",{className:`${a.sourceBadge} ${a[A.source||"anilist"]}`,children:A.source==="kitsu"?"Kitsu":A.source==="offline"?"Offline DB":"AniList"})]}):e("span",{className:a.skipped,children:["Skipped: ",A.title]})})]})]}),de&&e("div",{className:`${a.statusMessage} ${a.success}`,children:["Import complete! Imported: ",de.imported,", Skipped: ",de.skipped,"."]}),Pe&&e("div",{className:`${a.statusMessage} ${a.error}`,children:Pe})]})}),h&&e("div",{className:a.importCard,children:[e("div",{className:a.cardHeader,children:e("div",{className:a.cardTitleRow,children:[e(m,{name:"myanimelist",className:a.malIcon}),e("h3",{children:"MyAnimeList Manga"}),P?null:M?e("span",{className:a.badgeOnline,children:"Connected"}):e("span",{className:a.badgeOffline,children:"Not connected"})]})}),e(Ke,{kind:"manga",active:x==="mal"}),e("div",{className:a.radioGroup,children:[e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"malMangaMode",value:"username",checked:ae==="username",onChange:()=>ve("username")}),e("span",{children:"Username"})]}),e("label",{className:a.radioLabel,children:[e("input",{type:"radio",name:"malMangaMode",value:"xml",checked:ae==="xml",onChange:()=>ve("xml")}),e("span",{children:"XML File"})]})]}),ae==="username"?e("div",{className:a.inputGroup,children:e("input",{type:"text",placeholder:"Enter MAL username",value:U,onChange:n=>be(n.currentTarget.value),className:a.input,disabled:j.isPending,onKeyDown:n=>{n.key==="Enter"&&U.trim()&&j.mutate()}})}):e("div",{className:a.uploadArea,children:e("div",{className:a.fileInputWrapper,children:[e("input",{type:"file",id:"malMangaFile",accept:".xml,application/xml",className:a.fileInput,onChange:n=>Qe(n.currentTarget.files?.[0]?.name??""),disabled:ne}),e("div",{className:a.fileDisplay,children:[e(m,{name:"file-alt",className:a.fileIcon}),e("span",{className:a.fileName,children:Ie||"Choose XML file..."})]}),e("label",{htmlFor:"malMangaFile",className:a.browseButton,children:"Browse"})]})}),e("div",{className:a.optionsArea,children:e("label",{className:a.checkboxLabel,children:[e("input",{type:"checkbox",checked:u,onChange:n=>_(n.currentTarget.checked),className:a.checkbox,disabled:j.isPending||ne}),e("span",{className:a.checkboxCustom}),e("div",{className:a.optionText,children:[e("span",{className:a.optionTitle,children:"Replace AniList-linked manga"}),e("span",{className:a.optionDesc,children:"Clears previously imported (anilist:) entries before importing. Your provider bookmarks are never touched."})]})]})}),ae==="username"?e("button",{className:a.syncBtn,onClick:()=>j.mutate(),disabled:!U.trim()||j.isPending,children:[e(m,{name:"download"}),j.isPending?"Importing...":"Start Import"]}):e("div",{className:a.actions,children:e(ge,{onClick:Oe,className:a.importBtn,disabled:ne||!Ie,children:[e(m,{name:"upload"})," ",ne?"Importing...":"Start Import"]})}),j.isError&&e("div",{className:`${a.statusMessage} ${a.error}`,children:j.error.message}),Ce&&e("div",{className:`${a.statusMessage} ${a.error}`,children:Ce}),oe&&e("div",{className:`${a.statusMessage} ${a.success}`,children:["Import complete! Imported: ",oe.imported,", Skipped:"," ",oe.skipped,"."]}),e("p",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"8px"},children:"MAL manga is matched to AniList by MAL ID with a title fallback. Unmatched titles are skipped. Imports land as AniList-linked entries alongside your provider bookmarks."})]})]})};export{In as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{u as t,d as y,A as V,h as g,S as Xe,g as ns,q as C,o as rs,p as ss,a as os,T as Se}from"./vendor-core-DfaOB3Rn.js";import{h as Un,p as z,t as pt,ac as as,a6 as is,S as On,e as ls,ak as cs,J as br,a8 as us,B as cn}from"./index-npJ4Ahxa.js";import{P as ds,a as ms,b as bs,F as hs,f as fs,c as vs}from"./PlayerProvider-DzaMVhFX.js";import{u as ps}from"./vendor-query-BBT5_sHx.js";import{I as he}from"./vendor-icons-DrybRNxP.js";import{p as Hn,M as gs,z as pr,f as Wn,c as ys,C as Ss,a as _s,P as Ts,b as un,u as Cs,i as ks,j as Es,n as Ns,h as Is,k as xs,m as As,l as Ls,s as qn,d as ws,e as Bs,g as Ps,r as Ms,o as Ae,A as Rs,t as zs,E as $s,w as Ds,x as Os,v as ie,y as qs,R as Vs,q as Fs}from"./useWatchAlongPlayer-CRf0zHFj.js";import{S as Us,O as Vn,a as Hs,A as Ws,b as Ks}from"./OptionListMenu-ClUReC8J.js";import{M as Qs}from"./MatureConsentModal-BrKd4CBZ.js";import{u as Ys}from"./useProviders-DphwZjpZ.js";import{e as js,f as Gs,g as Xs,d as Js,c as Zs,h as eo,i as to}from"./useTvLibrary-efdd6TIy.js";import{l as no,s as ro,i as dn,h as hr}from"./playbackCompletion-DB_c1lex.js";import{u as so}from"./useIsMobile-Dvx1uJ82.js";import{S as oo}from"./SynopsisText-B3Sa5pRv.js";import{W as ao}from"./WatchAlongPanel-CvUFCFll.js";import"./libraryInvalidation-CHlEJU7b.js";const io="_fullscreenFlat_10bzs_1",lo="_timeDisplay_10bzs_12",co="_bottomControls_10bzs_16",uo="_leftControls_10bzs_20",mo="_rightControls_10bzs_21",bo="_controlBtn_10bzs_25",ho="_controlsOverlay_10bzs_32",fo="_hidden_10bzs_52",vo="_topControls_10bzs_58",po="_backBtn_10bzs_78",go="_videoTitleInfo_10bzs_98",yo="_animeTitle_10bzs_104",So="_episodeLabel_10bzs_112",_o="_speedBoostBadge_10bzs_119",To="_progressBarContainer_10bzs_165",Co="_progressBar_10bzs_165",ko="_thumb_10bzs_184",Eo="_bufferedBar_10bzs_202",No="_watchedBar_10bzs_212",Io="_scrubbing_10bzs_237",xo="_timeBubble_10bzs_241",Ao="_bottomControlsRow_10bzs_255",Lo="_nextEpisodeBtn_10bzs_278",wo="_active_10bzs_340",Bo="_settingsPanel_10bzs_352",Po="_settingsHeader_10bzs_371",Mo="_settingsBackBtn_10bzs_379",Ro="_settingsTitle_10bzs_397",zo="_settingsContent_10bzs_408",$o="_currentValue_10bzs_417",Do="_menuItem_10bzs_423",Oo="_menuNote_10bzs_456",qo="_loadingOverlay_10bzs_465",Vo="_loadingDots_10bzs_476",Fo="_dot_10bzs_481",Uo="_bufferingOverlay_10bzs_510",Ho="_bufferingSpinner_10bzs_519",o={fullscreenFlat:io,timeDisplay:lo,bottomControls:co,leftControls:uo,rightControls:mo,controlBtn:bo,controlsOverlay:ho,hidden:fo,topControls:vo,backBtn:po,videoTitleInfo:go,animeTitle:yo,episodeLabel:So,speedBoostBadge:_o,progressBarContainer:To,progressBar:Co,thumb:ko,bufferedBar:Eo,watchedBar:No,scrubbing:Io,timeBubble:xo,bottomControlsRow:Ao,nextEpisodeBtn:Lo,active:wo,settingsPanel:Bo,settingsHeader:Po,settingsBackBtn:Mo,settingsTitle:Ro,settingsContent:zo,currentValue:$o,menuItem:Do,menuNote:Oo,loadingOverlay:qo,loadingDots:Vo,dot:Fo,bufferingOverlay:Uo,bufferingSpinner:Ho},Wo=({player:s,visible:h,settingsOpen:O,onOpenSettings:w,onCloseSettings:R,hasSubtitles:k,isSubtitleActive:I,subtitles:d,onSubtitleChange:i,showNextEpisodeButton:S,onNextEpisode:r,isTheaterMode:B,onTheaterModeToggle:fe,timeLabelRef:J})=>{const{state:m,actions:ke}=s,Le=()=>{if(I){i(-1);return}let ve=null;try{ve=z.getItem("tvLastSubtitle")}catch{}i(Hn(d,{lastKey:ve,enabled:!0}))};return t("div",{className:`${o.controlsOverlay} ${h?"":o.hidden}`,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:t("div",{className:o.bottomControls,onClick:ve=>ve.stopPropagation(),children:[t(ds,{classes:{container:o.progressBarContainer,scrubbing:o.scrubbing,timeBubble:o.timeBubble,bar:o.progressBar,buffered:o.bufferedBar,watched:o.watchedBar,thumb:o.thumb},timeLabelRef:J}),t("div",{className:o.bottomControlsRow,children:[t("div",{className:o.leftControls,children:[t(ms,{className:o.controlBtn}),t(bs,{buttonClassName:o.controlBtn,onExpandedChange:ke.setShowVolumeSlider}),t("span",{className:o.timeDisplay,ref:J,children:[Un(0)," / ",Un(m.duration)]})]}),t("div",{className:o.rightControls,children:[S&&t("button",{className:o.nextEpisodeBtn,onClick:r,title:"Play next episode",children:"Next EP"}),k&&t("button",{className:`${o.controlBtn} ${I?o.active:""}`,onClick:Le,"aria-label":I?"Turn subtitles off":"Turn subtitles on",children:t(he,{name:"closed-captioning"})}),t("button",{className:`${o.controlBtn} ${O?o.active:""}`,onClick:()=>O?R():w(),"aria-label":"Settings",children:t(he,{name:"cog"})}),t("button",{className:`${o.controlBtn} ${B?o.active:""}`,onClick:ve=>{ve.stopPropagation(),fe()},title:B?"Exit Theater Mode":"Theater Mode","aria-label":B?"Exit Theater Mode":"Theater Mode",children:t(he,{name:"tv"})}),t(hs,{className:o.controlBtn})]})]})]})})},mn=-6e4,Fn=6e4,fr=500,Ko=({classes:s,delayMs:h,onDelayChange:O})=>{const[w,R]=y(null),k=w??h,I=V(O);I.current=O;const d=V(h);d.current=h;const i=V(null);i.current=w,g(()=>{R(null)},[h]),g(()=>()=>{const B=i.current;B!==null&&B!==d.current&&I.current(B)},[]);const S=B=>{d.current=B,i.current=null,I.current(B),R(null)},r=B=>{const fe=i.current??d.current,J=Math.max(mn,Math.min(Fn,fe+B));S(J)};return t(Xe,{children:[t("div",{style:{display:"flex",gap:6,padding:"0.5rem 0.75rem 0.25rem"},children:[t("button",{type:"button",className:s.item,onClick:()=>r(-fr),"aria-label":"Show subtitles 0.5 seconds earlier",style:{flex:1,justifyContent:"center"},children:t("span",{children:"-0.5s"})}),t("button",{type:"button",className:s.item,onClick:()=>r(fr),"aria-label":"Show subtitles 0.5 seconds later",style:{flex:1,justifyContent:"center"},children:t("span",{children:"+0.5s"})}),t("button",{type:"button",className:s.item,onClick:()=>S(0),disabled:k===0,"aria-label":"Reset subtitle timing",style:{flex:1,justifyContent:"center"},children:t("span",{children:"Reset"})})]}),t(gs,{label:"Subtitle timing",display:pr(k),min:mn,max:Fn,step:100,value:k,percent:(k-mn)/(Fn-mn)*100,onChange:B=>{const fe=Math.round(B);i.current=fe,R(fe)},onCommit:()=>{const B=i.current;B!==null&&S(B)}}),t("div",{className:s.note,children:"Positive delays subtitles (show later). Negative shows them earlier. 0.0s is default."})]})},Qo=({view:s,onSelectView:h,onClose:O,player:w,onSubtitleStyleChange:R,streams:k,resolutionIdx:I,onResolutionChange:d,hasSubtitles:i,subtitles:S,selectedSubtitle:r,isSubtitleActive:B,onSubtitleChange:fe,audioTracks:J,selectedAudioTrack:m,onAudioTrackChange:ke,videoDelayEnabled:Le,onVideoDelayToggle:ve,videoDelayMs:pe,onVideoDelayChange:T,onCalibrate:gt,subtitleDelayMs:Je,onSubtitleDelayChange:E,ambientSettings:U,onAmbientChange:Q})=>{const{state:le}=w,yt=()=>t(Xe,{children:[k.length>1&&t("button",{className:o.menuItem,onClick:()=>h("resolution"),children:[t("span",{children:"Resolution"}),t("span",{className:o.currentValue,children:k[I]?.quality||"Auto"})]}),i&&t("button",{className:o.menuItem,onClick:()=>h("subtitles"),children:[t("span",{children:"Subtitles"}),t("span",{className:o.currentValue,children:B?S[r]?.label||S[r]?.language:"Off"})]}),i&&t("button",{className:o.menuItem,onClick:()=>h("subtitle-style"),children:[t("span",{children:"Subtitle Style"}),t("span",{className:o.currentValue,children:[le.subtitleFontSize.toFixed(1),"x · ",le.subtitlePosition]})]}),i&&t("button",{className:o.menuItem,onClick:()=>h("subtitle-timing"),children:[t("span",{children:"Subtitle Timing"}),t("span",{className:o.currentValue,children:pr(Je)})]}),J.length>0&&t("button",{className:o.menuItem,onClick:()=>h("audio"),children:[t("span",{children:"Audio Track"}),t("span",{className:o.currentValue,children:J[m]?.label||J[m]?.language})]}),t("button",{className:o.menuItem,onClick:()=>h("av-sync"),children:[t("span",{children:"A/V Sync"}),t("span",{className:o.currentValue,children:Le?`${pe}ms`:"Off"})]}),U&&Q&&t("button",{className:o.menuItem,onClick:()=>h("ambient"),children:[t("span",{children:"Ambient Light"}),t("span",{className:o.currentValue,children:U.enabled?"On":"Off"})]})]}),we=()=>t(Vn,{classes:{item:o.menuItem,active:o.active},options:k.map((x,se)=>({key:String(se),label:x.quality,selected:se===I})),onSelect:x=>d(Number(x))}),Ze=()=>t(Vn,{classes:{item:o.menuItem,active:o.active},options:[{key:"off",label:"Off",selected:!B},...S.map((x,se)=>({key:String(se),label:x.label||x.language,selected:se===r}))],onSelect:x=>fe(x==="off"?-1:Number(x))}),te=()=>t(Hs,{classes:{item:o.menuItem,active:o.active},values:{fontSize:le.subtitleFontSize,position:le.subtitlePosition,bgOpacity:le.subtitleBgOpacity,bgColor:le.subtitleBgColor,textColor:le.subtitleTextColor,edge:le.subtitleEdge,bold:le.subtitleBold},onChange:R}),St=()=>t(Ko,{classes:{item:o.menuItem,active:o.active,note:o.menuNote},delayMs:Je,onDelayChange:x=>E?.(x)}),st=()=>t(Vn,{classes:{item:o.menuItem,active:o.active},options:J.map((x,se)=>({key:String(se),label:x.label||x.language,selected:se===m})),onSelect:x=>ke(Number(x))}),Be=()=>t(Ws,{classes:{item:o.menuItem,active:o.active,note:o.menuNote},enabled:Le,delayMs:pe,onToggle:x=>ve?.(x),onDelayChange:x=>T?.(x),onCalibrate:gt}),j=()=>U&&Q?t(Ks,{classes:{item:o.menuItem,active:o.active,note:o.menuNote},values:U,onChange:Q}):null;return t("div",{"data-speed-boost-ignore":"true",onClick:x=>x.stopPropagation(),children:t(Us,{classes:{panel:o.settingsPanel,header:o.settingsHeader,backBtn:o.settingsBackBtn,title:o.settingsTitle,content:o.settingsContent},title:s==="main"?"Settings":s==="subtitle-style"?"Subtitle Style":s==="subtitle-timing"?"Subtitle Timing":s==="audio"?"Audio Track":s==="resolution"?"Resolution":s==="av-sync"?"A/V Sync":s==="ambient"?"Ambient Light":s.charAt(0).toUpperCase()+s.slice(1),onBack:()=>s==="main"?O():h("main"),children:[s==="main"&&yt(),s==="resolution"&&we(),s==="subtitles"&&Ze(),s==="subtitle-style"&&te(),s==="subtitle-timing"&&St(),s==="audio"&&st(),s==="av-sync"&&Be(),s==="ambient"&&j()]})})},Yo=({player:s,title:h,episodeLabel:O,server:w,audioTracks:R,selectedAudioTrack:k,onAudioTrackChange:I,subtitles:d,selectedSubtitle:i,onSubtitleChange:S,streams:r,resolutionIdx:B,onResolutionChange:fe,onBack:J,children:m,videoDelayEnabled:ke=!1,onVideoDelayToggle:Le,videoDelayMs:ve=0,onVideoDelayChange:pe,onCalibrateAvSync:T,subtitleDelayMs:gt=0,onSubtitleDelayChange:Je,showNextEpisodeButton:E=!1,onNextEpisode:U,isLoading:Q=!1,isTheaterMode:le,onTheaterModeToggle:yt,ambientSettings:we,onAmbientChange:Ze})=>{const{state:te,refs:St,actions:st}=s,Be=St.videoRef,{subtitleFontSize:j,subtitlePosition:x,subtitleBgOpacity:se,subtitleBgColor:ce,subtitleTextColor:Pe,subtitleEdge:Me,subtitleBold:ne}=te,[Ve,et]=y(null),Fe=V(null),[ot,Ee]=y(0);g(()=>{const ae=Be.current;if(!ae)return;const _e=()=>Ee(ae.clientHeight||0);_e();const ge=new ResizeObserver(_e);return ge.observe(ae),()=>ge.disconnect()},[Be]);const _t=st.setSubtitleStyle;g(()=>{const ae="tv-player-subtitle-style";let _e=document.getElementById(ae);_e||(_e=document.createElement("style"),_e.id=ae,document.head.appendChild(_e));const ge={fontSize:j,position:x,bgOpacity:se,bgColor:ce,textColor:Pe,edge:Me,bold:ne},Z=Be.current,Ot=Wn(j,ot||Z?.clientHeight||720);if(_e.textContent=ys({...ge,fontSize:Ot}),Z){const lt=()=>{const L=Number(x);return isNaN(L)?0:Math.max(0,Math.min(100,L))},ct=(L,u)=>{try{const l=L;l.snapToLines=!1,l.line=u}catch{}},kt=()=>{const L=Ot*16,u=Z.videoHeight||Z.clientHeight||720,l=Z.videoWidth||Z.clientWidth||1280;return{step:L*1.3/u*100,chars:Math.max(20,Math.floor(l/(L*.55)))}},ue=L=>{const u=Math.max(0,Math.min(100,100-lt())),l=Array.from(L.activeCues??[]);if(l.length<=1){l.forEach($e=>ct($e,u));return}const{step:de,chars:me}=kt();let At=u;for(let $e=l.length-1;$e>=0;$e--){const Lt=String(l[$e].text??"").replace(/<[^>]*>/g,"").split(`
|
|
2
|
+
`).reduce((Vt,fn)=>Vt+Math.max(1,Math.ceil(fn.length/me)),0),qt=At-Lt*de;ct(l[$e],Math.max(0,qt)),At=qt-de*.4}},Et=()=>{const L=Math.max(0,Math.min(100,100-lt()));Array.from(Z.textTracks).forEach(u=>{u.cues&&(Array.from(u.cues).forEach(l=>ct(l,L)),u.mode==="showing"&&ue(u))})};Et();const Te=L=>{const u=L.target;u.mode==="showing"&&ue(u)},Nt=()=>{Array.from(Z.textTracks).forEach(L=>{L.removeEventListener("cuechange",Te),L.addEventListener("cuechange",Te)}),Et()};Array.from(Z.textTracks).forEach(L=>{L.addEventListener("cuechange",Te)}),Z.textTracks.addEventListener("addtrack",Nt);const It=Array.from(Z.querySelectorAll("track")),xt=()=>Et();return It.forEach(L=>L.addEventListener("load",xt)),()=>{Array.from(Z.textTracks).forEach(L=>{L.removeEventListener("cuechange",Te)}),Z.textTracks.removeEventListener("addtrack",Nt),It.forEach(L=>L.removeEventListener("load",xt))}}},[j,x,se,ce,Pe,Me,ne,i,d,Be,ot]);const oe=d.length>0,Re=i>=0,ze=()=>{et("main"),st.setShowControls(!0)},Ue=()=>{et(null)},tt=te.showControls||!!Ve,Tt=fs(s.engine),at=Tt.audioTracks.find(ae=>ae.id===Tt.activeAudioTrack)??R[k],He=i>=0?d[i]??Tt.subtitleTracks.find(ae=>ae.id===i):void 0,bn=t(Ss,{visible:tt,title:h,episode:O,server:Q?void 0:w,audio:Q?void 0:at?.label||at?.language,subtitles:Q?void 0:He?.label||He?.language,onBack:J,classes:{overlay:o.controlsOverlay,hidden:o.hidden,top:o.topControls,backBtn:o.backBtn,titleInfo:o.videoTitleInfo,title:o.animeTitle,episode:o.episodeLabel}}),Ct=!Q&&!te.isBuffering&&te.duration>0?t(_s,{}):null,K=t(Wo,{player:s,visible:tt,settingsOpen:!!Ve,onOpenSettings:ze,onCloseSettings:Ue,hasSubtitles:oe,isSubtitleActive:Re,subtitles:d,onSubtitleChange:S,showNextEpisodeButton:E,onNextEpisode:U,isTheaterMode:le,onTheaterModeToggle:yt,timeLabelRef:Fe}),it=Ve?t(Qo,{view:Ve,onSelectView:et,onClose:Ue,player:s,onSubtitleStyleChange:_t,streams:r,resolutionIdx:B,onResolutionChange:fe,hasSubtitles:oe,subtitles:d,selectedSubtitle:i,isSubtitleActive:Re,onSubtitleChange:S,audioTracks:R,selectedAudioTrack:k,onAudioTrackChange:I,videoDelayEnabled:ke,onVideoDelayToggle:Le,videoDelayMs:ve,onVideoDelayChange:pe,onCalibrate:()=>{et(null),T?.()},subtitleDelayMs:gt,onSubtitleDelayChange:Je,ambientSettings:we,onAmbientChange:Ze}):null,A=t(Xe,{children:[Q&&t("div",{className:o.loadingOverlay,"aria-hidden":"true",children:t("div",{className:o.loadingDots,children:[t("div",{className:o.dot}),t("div",{className:o.dot}),t("div",{className:o.dot})]})}),te.isBuffering&&!Q&&t("div",{className:o.bufferingOverlay,"aria-hidden":"true",children:t("div",{className:o.bufferingSpinner})}),te.isSpeedBoostActive&&t("div",{className:o.speedBoostBadge,"aria-hidden":"true",children:[t("span",{children:"2x"}),t(he,{name:"forward",size:12})]})]});return t(Ts,{engine:s.engine,topBar:bn,centerControls:Ct,bottomBar:!Q&&te.duration>0?K:null,settingsPanel:it,overlays:A,isInteracting:!!Ve||te.showVolumeSlider,nativeControls:te.useNativeControls,onStageClick:Ue,className:te.isFullscreen?o.fullscreenFlat:"",children:m})},jo=({servers:s,selectedServer:h,onServerSelect:O})=>s.length===0?null:t("div",{className:un.sourceSelectionContainer,children:[t("h4",{children:"Source"}),t("div",{className:un.sourceButtons,children:s.map(w=>t("button",{className:`${un.sourceButton} ${h===w?un.active:""}`,onClick:()=>O(w),children:w},w))})]}),Go=ns.memo(jo);function Xo({details:s,isMovie:h,season:O,episode:w,videoRef:R,active:k}){const I=V("");I.current||(I.current=`tv-${Date.now()}-${Math.random().toString(36).slice(2)}`);const d=C(()=>{if(!s)return;const i=R.current,S=h?"":`S${String(O).padStart(2,"0")}E${String(w).padStart(2,"0")}`;pt.discord.tvPresence.mutate({title:s.title,episodeLabel:S,isPlaying:i?!i.paused&&!i.ended:!0,thumbnail:s.poster,currentTime:i?i.currentTime:0,duration:i&&i.duration||0,isAdult:s.adult===!0,sessionId:I.current}).catch(()=>{}),pt.discord.heartbeat.mutate({sessionId:I.current}).catch(()=>{})},[s,h,O,w,R]);return g(()=>{if(!s)return;d();const i=window.setInterval(()=>{const S=R.current;(!S||!S.paused)&&d()},15e3);return()=>window.clearInterval(i)},[d,s,R]),g(()=>{if(!s||!k)return;const i=R.current;if(!i)return;const S=()=>d();return i.addEventListener("play",S),i.addEventListener("pause",S),i.addEventListener("seeked",S),()=>{i.removeEventListener("play",S),i.removeEventListener("pause",S),i.removeEventListener("seeked",S)}},[s,k,d,R]),g(()=>{const i=I.current,S=()=>as(i),r=()=>S();return window.addEventListener("pagehide",r),window.addEventListener("beforeunload",r),()=>{window.removeEventListener("pagehide",r),window.removeEventListener("beforeunload",r),S()}},[]),{sendPresence:d}}function Jo(s,h,O){const w=()=>{const k=Array.isArray(s.audioTracks)?s.audioTracks.length:0,I=O.getWant(),d=k>0?Math.min(Math.max(0,I),k-1):I;s.audioTrack=d,d!==I&&O.onResolve(d)},R=(k,I)=>{const d=O.getWant(),i=Array.isArray(s.audioTracks)?s.audioTracks.length:0;if(I.id!==d&&d>=0&&d<i){s.audioTrack!==d&&(s.audioTrack=d);return}O.onResolve(I.id)};return s.on(h.MANIFEST_PARSED,w),s.on(h.AUDIO_TRACK_SWITCHED,R),()=>{s.off(h.MANIFEST_PARSED,w),s.off(h.AUDIO_TRACK_SWITCHED,R)}}const Zo=/\b(SmartTV|SMART-TV|Tizen|Web0S|webOS|NetCast|HbbTV|AppleTV|CrKey|BRAVIA|AFT[A-Za-z]|Fire\s?TV|GoogleTV|Roku|VIDAA|DTV|PlayStation|Xbox|Opera TV|POV_TV)\b/i;function ea(){try{if(Zo.test(navigator.userAgent||""))return!0;const s=navigator.deviceMemory;if(typeof s=="number"&&s>0&&s<2)return!0}catch{}return!1}const ta="_statusMsg_zqb8u_1",na="_error_zqb8u_7",ra="_spinner_zqb8u_11",sa="_spin_zqb8u_11",oa="_sourceLoader_zqb8u_16",aa="_ringSpinner_zqb8u_22",ia="_meta_zqb8u_40",la="_year_zqb8u_48",ca="_rating_zqb8u_53",ua="_typeBadge_zqb8u_62",da="_tv_zqb8u_70",ma="_movie_zqb8u_75",ba="_controlLabel_zqb8u_80",ha="_select_zqb8u_90",fa="_playerSection_zqb8u_102",va="_video_zqb8u_106",pa="_videoHidden_zqb8u_128",ga="_delayCanvas_zqb8u_133",ya="_delayCanvasActive_zqb8u_146",Sa="_subtitleOverlay_zqb8u_150",_a="_videoIframe_zqb8u_169",Ta="_retryButton_zqb8u_177",Ca="_sidebarSeason_zqb8u_192",ka="_mobileSeasonRow_zqb8u_208",Ea="_providerSelectWrap_zqb8u_222",Na="_genreRow_zqb8u_230",Ia="_genreChip_zqb8u_237",xa="_metaRow_zqb8u_247",Aa="_detailGrid_zqb8u_256",La="_detailItem_zqb8u_264",wa="_imdbLink_zqb8u_286",p={statusMsg:ta,error:na,spinner:ra,spin:sa,sourceLoader:oa,ringSpinner:aa,meta:ia,year:la,rating:ca,typeBadge:ua,tv:da,movie:ma,controlLabel:ba,select:ha,playerSection:fa,video:va,videoHidden:pa,delayCanvas:ga,delayCanvasActive:ya,subtitleOverlay:Sa,videoIframe:_a,retryButton:Ta,sidebarSeason:Ca,mobileSeasonRow:ka,providerSelectWrap:Ea,genreRow:Na,genreChip:Ia,metaRow:xa,detailGrid:Aa,detailItem:La,imdbLink:wa},Ba=[],Pa=[];function vr({error:s,onRetry:h}){return t("div",{className:`${p.statusMsg} ${p.error}`,style:{flexDirection:"column",alignItems:"stretch",gap:8},children:t("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t("span",{style:{flex:1},children:s}),t("button",{className:p.retryButton,onClick:h,children:"Retry"})]})})}const ja=()=>{const{id:s}=rs(),[h]=ss(),O=V(h);O.current=h;const w=os(),R=ps(),k=h.get("type"),I=is(),d=!!I.session,i=d&&!I.session?.host,S=i&&["tv","movie"].includes(I.room?.selection.kind||"")?I.room?.selection:null,[r,B]=y(null),[fe,J]=y(()=>parseInt(h.get("s")||"1",10)||1),m=S?.season??fe,[ke,Le]=y([]),[ve,pe]=y(()=>parseInt(h.get("e")||"1",10)||1),T=S?Number(S.episode):ve,[gt,Je]=y(()=>{try{return z.getItem("tvProvider")||""}catch{return""}}),E=S?.provider??gt,[U,Q]=y([]),[le,yt]=y(""),[we,Ze]=y(""),{options:te,isFallback:St,isLoading:st}=Ys(),Be=Se(()=>te.filter(e=>(e.kind??"tv")==="tv").map(e=>({id:e.id,label:e.label,tier:e.tier==="embed"?"embed":"direct",servers:e.servers})),[te]),j=St||Be.length===0?Ba:Be,x=j.filter(e=>e.tier==="direct"),se=j.filter(e=>e.tier==="embed"),[ce,Pe]=y(!1),[Me,ne]=y(""),[Ve,et]=y([]),[Fe,ot]=y(0),[Ee,_t]=y([]),[oe,Re]=y(-1),[ze,Ue]=y(0),[tt,Tt]=y(""),[at,He]=y(""),[bn,Ct]=y(()=>{try{return z.getItem("tvServer")||""}catch{return""}}),K=S?.source??bn,it=Se(()=>j.find(e=>e.id===E),[j,E]),A=it?.tier==="embed",[ae,_e]=y([]),[ge,Z]=y(""),[Ot,lt]=y(""),[ct,kt]=y(!1),ue=Se(()=>ae.length>0?ae:it?.servers??[],[ae,it]),Et=Se(()=>ge&&!d?["Embed",...ue]:ue,[ue,ge,d]),Te=ct&&!!ge,Nt=Te?Ot||ge:"";g(()=>{if(!ge){lt("");return}let e=!1;return On(`/api/resolve?url=${encodeURIComponent(ge)}`).then(n=>{!e&&n.finalUrl&<(n.finalUrl)}).catch(()=>{}),()=>{e=!0}},[ge]);const It=V([]);g(()=>{It.current=U},[U]);const xt=V(Fe);g(()=>{xt.current=Fe},[Fe]);const L=V(oe);g(()=>{L.current=oe},[oe]);const u=Cs({skipIntervals:Pa}),l=u.refs.videoRef,de=V(null),me=V([]),At=V(null),$e=V(null),{videoDelayMs:hn,videoDelayEnabled:Lt,setDelayEnabled:qt,handleVideoDelayChange:Vt,isCalibrating:fn,testClipActive:Ne,stopCalibration:vn,openAvSyncCalibrator:gr,cancelAvSyncCalibrator:yr,applyAvSyncCalibrator:Sr,toggleTestClip:_r,calibReturnRef:Ft,effectiveVideoDelayMs:pn}=ks(l),[ut,Tr]=y(()=>{try{const e=Number(z.getItem("tvSubtitleDelayMs"));if(Number.isFinite(e)&&e>=-6e4&&e<=6e4)return Math.round(e)}catch{}return 0}),gn=V(ut);gn.current=ut;const Cr=C(e=>{const n=Math.max(-6e4,Math.min(6e4,Math.round(e)));if(gn.current!==n){gn.current=n,Tr(n);try{z.setItem("tvSubtitleDelayMs",String(n))}catch{}}},[]);Es({videoRef:l,canvasRef:At,delayMs:pn,enabled:Lt});const yn=Lt,ye=yn||ut!==0,{settings:Sn,update:kr}=Ns(),_n=V(ye);_n.current=ye;const Tn=C(()=>{if(!_n.current)return;const e=l.current;e&&Array.from(e.textTracks).forEach(n=>{n.mode!=="hidden"&&(n.mode="hidden")})},[l]),{hasConsent:wt,grant:Er}=ls(),f=k==="movie";Xo({details:r,isMovie:f,season:m,episode:T,videoRef:l,active:!A&&!ce&&!Me&&U.length>0});const Ut=s?cs(k||"tv",s):"",ee=Ut,De=`${ee}:${m}:${T}:${E}:${K}`,Ht=Se(()=>!s||!r||A||Te||ce||we!==De||U[ze]?.type!=="hls"?null:{kind:f?"movie":"tv",...f?{}:{season:m},showId:s,episode:String(f?1:T),provider:E,source:K,mode:"sub",title:r.title},[s,r,A,Te,ce,we,De,U,ze,f,m,T,E,K]),Kn=Is(u.engine,Ht,ce||!r),Qn=js(),Wt=Gs(),Kt=Xs(),{toggle:Yn,bookmarkedIds:Nr,pending:Ir}=Js(),{data:jn}=Zs(r?Ut:void 0),Bt=jn?!!jn.inLibrary:Ut?Nr.has(Ut):!1,xr=C(()=>{!r||!s||Yn({tmdbId:Number(s),mediaType:k||"tv",title:r.title,poster:r.poster,year:r.year,adult:r.adult})},[r,s,k,Yn]),{data:dt,isFetched:Gn,isFetching:Cn}=eo(ee||void 0,m,T),Qt=Se(()=>ke.map(e=>e.episode_number).sort((e,n)=>e-n),[ke]),Pt=Qt.indexOf(T),kn=Pt>0?Qt[Pt-1]:null,F=Pt>=0&&Pt<Qt.length-1?Qt[Pt+1]:null,Yt=Se(()=>(r?.seasons??[]).map(e=>e.season_number).filter(e=>Number.isFinite(e)).sort((e,n)=>e-n),[r]),We=Se(()=>{if(f||F!=null)return null;const e=Yt.indexOf(m);return e>=0&&e<Yt.length-1?Yt[e+1]:(r?.number_of_seasons??0)>m?m+1:null},[f,F,Yt,m,r?.number_of_seasons]),Xn=dt?.currentTime??0,jt=V(null),[Ke,Gt]=y(!1),[mt,Jn]=y(0),[Mt,Zn]=y(!1),[bt,ht]=y(!1),[Ar,En]=y(!1),[Lr,wr]=y(""),[Xt,Br]=y(!1),[Pr,Nn]=y(!1),{isTheaterMode:Oe,toggleTheaterMode:In,handleLayoutClick:Mr}=xs();g(()=>{const e=n=>{n.defaultPrevented||n.ctrlKey||n.metaKey||n.altKey||n.repeat||n.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||n.key.toLowerCase()==="t"&&In()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[In]),As(u,(U.length>0||at!=="")&&!Oe&&!Ke&&!bt);const Rr=so(),[ft,zr]=y(no),$r=C(e=>{zr(e),ro(e)},[]),Qe=V(!1),qe=V(null),xn=V(0),G=V(null),Jt=V(""),Dr=hr(Xn),Rt=!d&&!Qe.current&&(Ke||bt||Dr),Zt=V(Rt);Zt.current=Rt;const en=V(!1);g(()=>{en.current=Mt},[Mt]);const Ye=C((e,n)=>{if(!ee||!n||n<30)return;const a=dn(e,n);Math.abs(e-xn.current)<10&&!a||(xn.current=e,Qn.mutate({mediaId:ee,season:m,episode:T,currentTime:Math.floor(e),duration:Math.floor(n),completed:a,title:r?.title??null,poster:r?.poster??null,backdrop:r?.backdrop??null,year:r?.year??null,overview:r?.overview??null,tmdbId:r?.id??null,mediaType:k||"tv",adult:r?.adult?1:0}))},[ee,m,T,Qn,r,k]),Ie=C((e,n)=>{vn();const a=new URLSearchParams(h);a.set("type",h.get("type")||"tv"),a.set("s",String(e)),a.set("e",String(n)),w(`${window.location.pathname}?${a.toString()}`)},[h,w,vn]),zt=C(()=>{const e=l.current;if(!e||f||F==null){En(!1);return}const n=e.duration||0,a=e.currentTime||0;En(n>0&&a/n>=.8)},[f,F,l]),tn=C((e,n)=>["tv-sources",E,f?"movie":"tv",s,e,n,K],[E,f,s,K]),nn=C(async(e,n)=>{if(!r||!s||!E)return{valid:!1,sources:[]};const a=f?"movie":"tv",c=await pt.tv.sources.query({provider:E,type:a,tmdbId:String(s),season:e,episode:n,title:r.title||"",year:r.year||"",totalSeasons:String(r.number_of_seasons||1),imdbId:r.imdb_id||"",...K?{server:K}:{}});return{valid:"valid"in c?c.valid:!1,error:"error"in c?c.error:void 0,sources:c.sources,referer:"referer"in c?c.referer:void 0,audioTracks:c.audioTracks,subtitles:"subtitles"in c?c.subtitles:void 0,servers:"servers"in c?c.servers:void 0,server:"server"in c?c.server:void 0,embedUrl:"embedUrl"in c?c.embedUrl:void 0}},[r,s,E,f,K]),er=C(()=>{if(f||!r||!s||!E||A||F==null)return;const e=tn(m,F);R.getQueryState(e)?.status!=="success"&&R.prefetchQuery({queryKey:e,queryFn:()=>nn(m,F),staleTime:300*1e3,gcTime:1800*1e3})},[f,r,s,E,A,F,m,R,tn,nn]),Or=C(()=>{if(Ne)return;zt();const e=l.current;!e||e.paused||e.ended||(e.duration>0&&e.duration-e.currentTime<=60&&er(),!qe.current&&(qe.current=setTimeout(()=>{qe.current=null,Ye(e.currentTime,e.duration||0)},5e3)))},[Ye,l,Ne,zt,er]),qr=C(()=>{const e=l.current;if(!(!e||!r)&&(qe.current&&clearTimeout(qe.current),qe.current=null,Ye(e.currentTime,e.duration||0),!i)){if(F!=null){ft&&(pe(F),Ie(m,F));return}wr(f?r.title:`${r.title} - Season ${m}`),ht(!0),Qe.current=!0}},[f,r,m,F,ft,Ye,Ie,l,i]),{checkEnd:rn,logDuration:tr}=Ls({videoRef:l,sourceType:A?"iframe":void 0,resetKey:`${ee}:${m}:${T}`,onEnd:qr}),Vr=C(()=>{u.actions.onPlay()},[u.actions]),Fr=C(()=>{u.actions.onPause();const e=l.current;e&&!e.ended&&Ye(e.currentTime,e.duration||0)},[u.actions,Ye,l]),Ur=C(()=>{const e=l.current;if(e){try{const n=parseFloat(z.getItem("playerVolume")||"");isNaN(n)||(e.volume=Math.max(0,Math.min(1,n))),e.muted=z.getItem("playerMuted")==="true"}catch{}if(G.current!=null&&G.current>0){try{e.currentTime=G.current}catch{}G.current=null}zt()}},[l,zt]),An=C(()=>{const e=l.current;if(e&&G.current!=null&&G.current>0){try{e.currentTime=G.current}catch{}G.current=null}},[l]),Hr=C(()=>{mt>0&&(G.current=mt);const e=l.current;if(e&&mt>0){try{e.currentTime=mt,G.current=null}catch{}e.play().catch(()=>{})}Gt(!1),Qe.current=!0},[mt,l]),nr=C(()=>{G.current=null;const e=l.current;e&&(e.currentTime=0,e.play().catch(()=>{})),Gt(!1),Qe.current=!0},[l]),Wr=C(()=>{F!=null&&(Qe.current=!0,pe(F),Ie(m,F))},[F,m,Ie]),Kr=C(()=>{We!=null&&(ht(!1),Qe.current=!0,J(We),pe(1),Ie(We,1))},[We,Ie]),Qr=C(async()=>{if(ee)try{Bt?await Wt.mutateAsync({id:ee,status:"Completed"}):r&&s&&(await Kt.mutateAsync({tmdbId:Number(s),mediaType:k||"tv",title:r.title,poster:r.poster,backdrop:r.backdrop,year:r.year,overview:r.overview,adult:r.adult,status:"Completed",silent:!0}),br.success("Moved to Completed")),ht(!1),w("/")}catch{}},[ee,Bt,Wt,Kt,r,s,k,w]);g(()=>{Qe.current=!1,jt.current=null,Gt(!1),En(!1),Jn(0),Zn(!1),en.current=!1,G.current=null,xn.current=0},[ee,m,T]),g(()=>{Jt.current=De},[De]),g(()=>{Gn&&(Zn(!0),en.current=!0)},[Gn,ee,m,T]),g(()=>{if(d||Cn||!dt||Qe.current)return;const e=`${ee}:${m}:${T}`;if(jt.current===e)return;jt.current=e;const n=dt,a=n.currentTime??0;hr(a)&&n.completed!==1&&!dn(a,n.duration??0)&&(Jn(a),Gt(!0))},[dt,Cn,ee,m,T,d]),g(()=>{!d&&Ke&&l.current&&l.current.pause()},[Ke,l,d]),g(()=>{const e=l.current;return()=>{qe.current&&clearTimeout(qe.current),qe.current=null,!e?.ended&&u.engine.getState().duration>0&&Ye(u.engine.getTimeline().currentTime,u.engine.getState().duration)}},[u.engine,Ye,l]);const Ln=C(e=>{let n=null,a=!0;try{n=z.getItem("tvLastSubtitle"),a=z.getItem("tvSubtitlesEnabled")!=="false"}catch{}return Hn(e,{lastKey:n,enabled:a})},[]),wn=C(e=>{if(!(e<0))try{z.setItem("tvSubtitlesEnabled","true"),z.setItem("tvSelectedSubtitle",String(e))}catch{}},[]),rr=C(e=>{if(e.length===0)return 0;let n=null;try{n=z.getItem("tvLastAudio")}catch{}if(n){const a=e.findIndex(P=>qn(P)===n);if(a>=0)return a;const c=n.indexOf("|||"),b=c>=0?n.slice(0,c):n,_=c>=0?n.slice(c+3):n,$=e.findIndex(P=>P.language===b||P.label===_);if($>=0)return $}return Hn(e,{lastKey:null,enabled:!0})},[]),sr=C(e=>{let n=null;try{n=z.getItem("tvLastQuality")}catch{}if(!n||e.length===0)return 0;const a=e.findIndex(P=>(P.quality||"")===n);if(a>=0)return a;const c=P=>{const X=/(\d{3,4})/.exec(P||"");return X?parseInt(X[1],10):0},b=c(n);if(!b)return 0;let _=0,$=1/0;return e.forEach((P,X)=>{const v=c(P.quality),H=Math.abs(v-b);v>0&&H<$&&($=H,_=X)}),_},[]),{data:or}=to(ee||void 0),ar=Se(()=>(or?.progress??[]).filter(n=>n.season===m&&(n.completed===1||dn(n.currentTime,n.duration))).map(n=>String(n.episode)),[or,m]),ir=Se(()=>ke.map(e=>({id:String(e.episode_number),label:`Episode ${e.episode_number}`,sublabel:e.name||void 0,thumbnail:e.still_path?`https://image.tmdb.org/t/p/w185${e.still_path}`:void 0})),[ke]),lr=Se(()=>(r?.genres??[]).map(e=>e.name).slice(0,5),[r]),Bn=Se(()=>[r?.year,r?.status,r?.number_of_seasons?`${r.number_of_seasons} Season${r.number_of_seasons>1?"s":""}`:null,r?.number_of_episodes?`${r.number_of_episodes} Episodes`:null].filter(Boolean),[r]);g(()=>{if(!i&&j.length!==0&&!j.some(e=>e.id===E)){const e=j.find(n=>n.tier==="direct")?.id??j[0].id;Je(e);try{z.setItem("tvProvider",e)}catch{}}},[j,E,i]),g(()=>{_e([]),Z(""),lt(""),kt(!1)},[E]),g(()=>{if(!i&&ue.length!==0&&!ue.includes(K)){Ct(ue[0]);try{z.setItem("tvServer",ue[0])}catch{}}},[ue,K,i]),g(()=>{if(!s){B(null),Q([]),Ze(""),ne(""),He("");return}const e=Number(s),n=k||"tv";B(null),Q([]),Ze(""),ne(""),He("");const a=parseInt(O.current.get("s")||"",10),c=parseInt(O.current.get("e")||"",10);J(isNaN(a)?1:a),pe(isNaN(c)?1:c),Ue(0),pt.tv.details.query({type:n,id:String(e)}).then(b=>{const _={id:b.id,title:b.title||"",overview:b.overview||"",vote_average:b.vote_average,year:b.year,poster:b.poster,backdrop:b.backdrop,imdb_id:b.imdb_id||void 0,adult:b.adult,seasons:b.seasons,number_of_seasons:b.number_of_seasons};B(_),_.seasons&&_.seasons.length>0&&isNaN(a)&&J(_.seasons[0].season_number)}).catch(()=>{})},[s,k]),g(()=>{if(!r||!s)return;if(!(r.seasons!==void 0||r.number_of_seasons!==void 0)){Le([]);return}const n=parseInt(h.get("e")||"",10);pt.tv.episodes.query({id:String(s),season:String(m)}).then(a=>{const c=(a.episodes||[]).map(b=>({episode_number:b.episode_number,name:b.name||"",vote_average:b.vote_average,overview:b.overview||"",still_path:b.still_path||""}));Le(c),c.length!==0&&pe(b=>!isNaN(n)&&c.some(_=>_.episode_number===n)?n:c.some(_=>_.episode_number===b)?b:c[0].episode_number)}).catch(()=>{})},[r,s,m,h]),g(()=>{if(!A||!r||!s)return;On(`/api/tv/embed/${E}/${f?"movie":"tv"}/${s}?season=${m}&episode=${T}`).then(n=>{if(n.url)return He(n.url),On(`/api/resolve?url=${encodeURIComponent(n.url)}`).then(a=>{a.finalUrl&&He(a.finalUrl)})}).catch(()=>{})},[E,r,s,m,T,f,A]);const sn=C(async()=>{if(!r||!s||!E||A||r.adult&&!wt)return;const e=De;Pe(!0),ne(""),It.current.length===0&&(Q([]),Ue(0),et([]),_t([]));try{const n=await R.fetchQuery({queryKey:tn(m,T),queryFn:()=>nn(m,T),staleTime:3e5,gcTime:18e5});if(Jt.current!==e)return;if(Pe(!1),!n.valid||!n.sources?.length){ne(n.error?`${n.error}`:ue.length>0?`No streams from ${K}. Try another server.`:"No streams available.");return}if(d&&K&&n.server&&n.server!==K){Q([]),ne("The host's selected server is unavailable. Automatic source switching is disabled in watch-along rooms.");return}!i&&!K&&n.server&&Ct(n.server);const a=d?n.sources.filter(P=>P.type==="hls"):n.sources;if(d&&a.length===0){Q([]),ne("The room requires a direct HLS source. No compatible stream is available here.");return}Q(a),yt(n.server||K),Ze(e),n.servers?.length&&_e(n.servers),n.embedUrl&&Z(n.embedUrl),Ue(sr(a)),n.referer&&Tt(n.referer);const c=n.audioTracks||[];et(c),ot(c.length>0?rr(c):0);const b=n.subtitles||[];if(_t(b),b.length>0){const P=Ln(b);Re(P),wn(P)}else Re(-1);const _=f?"movie":"tv",$=s;pt.tv.subtitles.query({type:_,tmdbId:String($),season:String(m),episode:String(T)}).then(P=>{if(Jt.current!==e)return;const X=Array.isArray(P.subtitles)?P.subtitles:[];X.length!==0&&_t(v=>{const H=[...v,...X.filter(Y=>!v.some(q=>q.url===Y.url))];if(v.length===0){const Y=Ln(H);Re(Y),wn(Y)}return H})}).catch(()=>{}),ne("")}catch(n){if(Jt.current!==e)return;Pe(!1),ne(n instanceof Error?n.message:"Failed to load streams.")}},[r,s,E,m,T,f,A,wt,ue,K,Ln,wn,rr,sr,R,tn,nn,De,d,i]),Pn=C(()=>{const e=l.current;e&&!isNaN(e.currentTime)&&(G.current=e.currentTime)},[l]),Yr=C(e=>{if(!(i||d&&e==="Embed")){if(e==="Embed"){kt(!0);return}Pn(),kt(!1),Ct(e);try{z.setItem("tvServer",e)}catch{}ne("")}},[Pn,i,d]),jr=C(e=>{Je(e);try{z.setItem("tvProvider",e)}catch{}},[]);g(()=>{E&&r&&!A&&sn()},[E,r,sn,A]),g(()=>{if(!l.current)return;if(de.current=null,A||Te||d&&U[ze]?.type!=="hls"){u.engine.unload();return}if(Ne&&!d)return u.engine.loadSource({url:"/av-sync-test.mp4"},{autoPlay:!Zt.current});if(Ft.current!=null&&(G.current=Ft.current,Ft.current=null),we===De&&G.current==null&&!Zt.current)try{const v=l.current;v&&!v.ended&&v.currentTime>1&&(G.current=v.currentTime)}catch{}const n=G.current??0,a=!ce&&we===De?Te?"":U[ze]?.url||"":"";if(!a){try{l.current?.pause(),l.current?.removeAttribute("src"),l.current?.load()}catch{}return}const c=l.current;c.pause(),c.removeAttribute("src"),c.load(),u.actions.resetMediaState();const b=`/api/tv/stream-proxy?url=${encodeURIComponent(a)}&referer=${encodeURIComponent(tt)}&provider=${encodeURIComponent(E)}`,_=ea()||document.body.classList.contains("low-end"),$=_?60:180,P=u.engine.loadSource({url:b,hls:U[ze]?.type==="hls"},{hlsConfig:{enableWorker:!0,lowLatencyMode:!1,startPosition:n>0?n:-1,maxBufferLength:$,maxMaxBufferLength:$+(_?30:60),backBufferLength:_?30:60,maxBufferSize:(_?120:360)*1e3*1e3,fragLoadPolicy:{default:{maxTimeToFirstByteMs:15e3,maxLoadTimeMs:45e3,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:3,retryDelayMs:800,maxRetryDelayMs:6e3}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:25e3,timeoutRetry:{maxNumRetry:1,retryDelayMs:500,maxRetryDelayMs:2e3},errorRetry:{maxNumRetry:2,retryDelayMs:800,maxRetryDelayMs:4e3}}}},onHls:(v,H)=>{de.current=v;const Y=()=>{let D=!1,M=0;try{D=z.getItem("tvSubtitlesEnabled")==="true";const N=parseInt(z.getItem("tvSelectedSubtitle")||"0",10);!isNaN(N)&&N>=0&&(M=N)}catch{}return{enabled:D,index:M}},q=()=>{if(typeof v.subtitleTrack!="number")return;if(me.current.length>0){v.subtitleTrack=-1;return}const D=Array.isArray(v.subtitleTracks)?v.subtitleTracks:[];if(D.length===0){v.subtitleTrack=-1;return}const M=Y();if(M.enabled){const N=M.index<D.length?M.index:0;v.subtitleTrack=N,Re(N),Tn()}else v.subtitleTrack=-1};Jo(v,H.Events,{getWant:()=>xt.current,onResolve:D=>ot(D)}),v.on(H.Events.MANIFEST_PARSED,q),v.on(H.Events.SUBTITLE_TRACKS_UPDATED,()=>{q()}),v.on(H.Events.SUBTITLE_TRACK_SWITCH,(D,M)=>{if(me.current.length>0){if(M.id!==-1)try{v.subtitleTrack=-1}catch{}return}const N=Array.isArray(v.subtitleTracks)?v.subtitleTracks:[];if(N.length!==0){if(M.id===-1){const Ce=Y();if(Ce.enabled){const re=Ce.index<N.length?Ce.index:0;v.subtitleTrack=re;return}}Re(M.id),Tn()}})},onReady:()=>{(n>0||!Zt.current&&en.current)&&u.engine.play()},onError:v=>{ne(v.message),Pe(!1),de.current=null}}),X=()=>{const Y=c.error?.code===4?"Video source not supported or not found":"Failed to load video stream";ne(`${Y}. The source may be invalid or expired. Try switching source or reloading.`),Pe(!1)};return c.addEventListener("error",X),()=>{P(),de.current=null,c.removeEventListener("error",X)}},[U,we,ce,ze,E,tt,A,Te,l,Ft,Ne,ee,m,T,An,Tn,u.actions,u.engine,De,d]),g(()=>{if(i||!Mt||Ke||bt||Rt||A||Ne)return;const e=l.current;!e||!e.paused||e.ended||e.readyState<1||(An(),u.engine.play())},[Mt,Ke,bt,Rt,A,Ne,An,l,i,u.engine]),g(()=>{const e=de.current;!e||typeof e.audioTrack!="number"||(e.audioTrack=Fe)},[Fe]),g(()=>{const e=de.current;!e||typeof e.subtitleTrack!="number"||!Array.isArray(e.subtitleTracks)||e.subtitleTracks.length===0||me.current.length>0||(oe>=0?e.subtitleTrack=oe:e.subtitleTrack=-1)},[oe]),g(()=>{const e=l.current;if(!(!e||A)&&(e.querySelectorAll("track").forEach(n=>n.remove()),me.current=[],Ee.length!==0&&(Ee.forEach(n=>{const a=document.createElement("track");a.kind="subtitles",a.label=n.label||n.language||"Unknown",a.srclang=n.language||n.label||"en";const c=`/api/subtitle-proxy?url=${encodeURIComponent(n.url)}&referer=${encodeURIComponent(tt)}`;a.src=c,a.addEventListener("load",()=>{const b=me.current.indexOf(a),_=a.track;if(_&&b>=0){const $=b===L.current;_.mode=$&&!_n.current?"showing":"hidden"}}),e.appendChild(a),me.current.push(a)}),Ee.length>0)))try{const n=de.current;n&&typeof n.subtitleTrack=="number"&&n.subtitleTrack!==-1&&(n.subtitleTrack=-1)}catch{}},[Ee,tt,A,E,K,l]),g(()=>{const e=l.current;if(!e||A)return;const n=de.current;me.current.length>0&&n&&typeof n.subtitleTrack=="number"&&Array.isArray(n.subtitleTracks)&&n.subtitleTracks.length>0&&(n.subtitleTrack=-1);const a=()=>{const _=Wn(u.state.subtitleFontSize,e.clientHeight||720),$=Math.max(0,Math.min(100,100-u.state.subtitlePosition)),P=()=>{const q=_*16,D=e.videoHeight||e.clientHeight||720,M=e.videoWidth||e.clientWidth||1280;return{step:q*1.3/D*100,chars:Math.max(20,Math.floor(M/(q*.55)))}},X=(q,D)=>{const M=q;M.snapToLines=!1,M.line=D},v=q=>{if(!q.cues)return;Array.from(q.cues).forEach(re=>X(re,$));const D=Array.from(q.activeCues??[]);if(D.length<=1){D.forEach(re=>X(re,$));return}const{step:M,chars:N}=P();let Ce=$;for(let re=D.length-1;re>=0;re--){const je=String(D[re].text??"").replace(/<[^>]*>/g,"").split(`
|
|
3
|
+
`).reduce((an,$t)=>an+Math.max(1,Math.ceil($t.length/N)),0);Ce=Math.max(0,Ce-je*M),X(D[re],Ce),Ce-=M*.4}},H=me.current;if(H.length>0){H.forEach((q,D)=>{const M=q.track;if(!M)return;const N=D===oe;M.mode=N&&!ye?"showing":"hidden",N&&!ye&&v(M)});return}const Y=Array.from(e.textTracks);Y.length!==0&&Y.forEach((q,D)=>{const M=D===oe;q.mode=M&&!ye?"showing":"hidden",M&&!ye&&v(q)})};a();const c=()=>a();e.textTracks.addEventListener("addtrack",c),e.addEventListener("loadedmetadata",a,{once:!0});const b=window.setTimeout(a,600);return()=>{e.textTracks.removeEventListener("addtrack",c),e.removeEventListener("loadedmetadata",a),window.clearTimeout(b)}},[oe,Ee,A,E,l,ye,u.state.subtitleFontSize,u.state.subtitlePosition]),g(()=>{if(!ye)return;const e=l.current,n=$e.current;if(!e||!n)return;const a=ut/1e3,c=pn/1e3,b=new Set;let _=[],$=-1,P=-1,X=-1,v=-1,H=0,Y=0,q=!1;const D=()=>{const W=L.current;if(W<0)return null;const Ge=me.current;return Ge.length>0?Ge[W]?.track??null:Array.from(e.textTracks)[W]??null},M=(W,Ge)=>{const be=W.cues;if(!be||be.length===0)return Array.from(W.activeCues??[]);let nt=0,rt=be.length;for(;nt<rt;){const xe=nt+rt>>>1;be[xe].endTime+a<Ge?nt=xe+1:rt=xe}const Dt=[];for(let xe=nt;xe<be.length;xe++){const ln=be[xe];if(ln.startTime+a>Ge)break;ln.endTime+a>=Ge&&Dt.push(ln)}return Dt},N=()=>{const W=D(),Ge=e.currentTime-c,be=W?M(W,Ge):[],nt=e.clientWidth,rt=e.clientHeight,Dt=e.videoWidth,xe=e.videoHeight;if(be.length===_.length&&be.every((zn,$n)=>zn===_[$n])&&nt===$&&rt===P&&Dt===X&&xe===v||(_=be,$=nt,P=rt,X=Dt,v=xe,n.textContent="",be.length===0))return;const dr={fontSize:Wn(u.state.subtitleFontSize,rt),position:u.state.subtitlePosition,bgOpacity:u.state.subtitleBgOpacity,bgColor:u.state.subtitleBgColor,textColor:u.state.subtitleTextColor,edge:u.state.subtitleEdge,bold:u.state.subtitleBold},Zr=ws(dr),es=Bs(e,dr.position);be.forEach((zn,$n)=>{const mr=String(zn.text??"");if(!Ps(mr).trim())return;const Dn=document.createElement("div"),ts=(be.length-1-$n)*1.7;Dn.style.cssText=`${Zr}
|
|
4
|
+
bottom: calc(${es}px + ${ts}em);`,Dn.innerHTML=Ms(mr),n.appendChild(Dn)})},Ce=()=>{Array.from(e.textTracks).forEach(W=>{b.has(W)||(b.add(W),W.addEventListener("cuechange",N))})},re=()=>{Ce(),N()},Rn=()=>{if(q||Y)return;const W=()=>{Y=0,!(q||e.paused||e.ended)&&(N(),Rn())};Y=window.requestAnimationFrame(W)},je=e,an=()=>{H=0,N(),!q&&je.requestVideoFrameCallback&&(H=je.requestVideoFrameCallback(an))},$t=()=>{N(),je.requestVideoFrameCallback?H||(H=je.requestVideoFrameCallback(an)):Rn()};Ce(),e.textTracks.addEventListener("addtrack",re),e.textTracks.addEventListener("removetrack",re),e.addEventListener("timeupdate",N),e.addEventListener("seeked",N),e.addEventListener("loadedmetadata",N),e.addEventListener("play",$t);const cr=Array.from(e.querySelectorAll("track"));cr.forEach(W=>W.addEventListener("load",N));const ur=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>N());return ur?.observe(e),N(),$t(),()=>{q=!0,b.forEach(W=>W.removeEventListener("cuechange",N)),e.textTracks.removeEventListener("addtrack",re),e.textTracks.removeEventListener("removetrack",re),e.removeEventListener("timeupdate",N),e.removeEventListener("seeked",N),e.removeEventListener("loadedmetadata",N),e.removeEventListener("play",$t),cr.forEach(W=>W.removeEventListener("load",N)),ur?.disconnect(),Y&&window.cancelAnimationFrame(Y),H&&je.cancelVideoFrameCallback&&je.cancelVideoFrameCallback(H),n.textContent=""}},[ye,ut,oe,Ee,pn,l,u.state.subtitleFontSize,u.state.subtitlePosition,u.state.subtitleBgOpacity,u.state.subtitleBgColor,u.state.subtitleTextColor,u.state.subtitleEdge,u.state.subtitleBold]);const Mn=()=>{B(null),Q([]),He(""),w(-1)},Gr=C(e=>{i||(J(e),pe(1),Ie(e,1))},[Ie,i]),on=!f&&r?.seasons&&r.seasons.length>1?t("label",{className:p.sidebarSeason,children:[t("span",{children:"Season"}),t("select",{disabled:i,value:m,onChange:e=>Gr(parseInt(e.currentTarget.value,10)||1),className:p.select,children:r.seasons.map(e=>t("option",{value:e.season_number,children:["Season ",e.season_number," (",e.episode_count," ep)"]},e.season_number))})]}):null,vt=C(e=>{if(i)return;const n=parseInt(e,10);if(!isNaN(n)){try{l.current?.pause()}catch{}pe(n),Ie(m,n)}Nn(!1)},[m,Ie,l,i]);g(()=>{if(f)return;const e=n=>{n.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||n.key.toLowerCase()==="n"&&(F!=null?vt(String(F)):br.error("No next episode available"))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[f,F,vt]);const Xr=e=>{ot(e);try{const a=Ve[e];a&&z.setItem("tvLastAudio",qn(a))}catch{}const n=de.current;n&&n.audioTrack!==void 0&&(n.audioTrack=e)},Jr=e=>{Re(e);try{if(e===-1)z.setItem("tvSubtitlesEnabled","false");else{z.setItem("tvSubtitlesEnabled","true"),z.setItem("tvSelectedSubtitle",String(e));const b=Ee[e];b&&z.setItem("tvLastSubtitle",qn(b))}}catch{}const n=l.current,a=de.current;if(a&&typeof a.subtitleTrack=="number"&&Array.isArray(a.subtitleTracks)&&a.subtitleTracks.length>0&&(a.subtitleTrack=me.current.length>0||e<0?-1:e),!n)return;const c=me.current;if(c.length>0){c.forEach((b,_)=>{const $=b.track;if(!$)return;const P=_===e;$.mode=P&&!ye?"showing":"hidden"});return}Array.from(n.textTracks).forEach((b,_)=>{const $=_===e;b.mode=$&&!ye?"showing":"hidden"})};return g(()=>{if(!r){document.title="TV & Movies - dango";return}document.title=f?`${r.title} - dango`:`${r.title} - Season ${m} Episode ${T} - dango`},[r,f,m,T]),g(()=>{if(!r||f)return;const e=new URLSearchParams(h),n=e.get("s"),a=e.get("e"),c=String(m),b=String(T);n===c&&a===b||(e.set("type",h.get("type")||"tv"),e.set("s",c),e.set("e",b),w(`${window.location.pathname}?${e.toString()}`,{replace:!0}))},[r,f,m,T,h,w]),t("div",{className:`${Ae.playerPageLayout} ${Oe?Ae.theaterMode:""} ${f?Ae.noSidebar:""}`,onClick:Mr,children:[Oe&&t(Rs,{videoRef:l,active:Sn.enabled&&!A&&U.length>0&&!Me&&!(r?.adult&&!wt),settings:Sn}),!Oe&&!f&&t("aside",{className:Ae.episodeSidebar,children:r?t(zs,{episodes:ir,currentEpisode:String(T),watchedEpisodes:ar,onEpisodeClick:vt,header:on}):t($s,{variant:"sidebar"})}),t("div",{className:Ae.playerMain,children:[r&&t("div",{className:p.playerSection,onContextMenu:e=>e.preventDefault(),style:r.adult&&!wt?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:A&&at&&!d?t("iframe",{src:at,className:p.videoIframe,allow:"autoplay; fullscreen",allowFullScreen:!0}):!A&&Nt&&!d?t("iframe",{src:Nt,className:p.videoIframe,allow:"autoplay; fullscreen",allowFullScreen:!0}):!A&&(U.length>0||ce)?t(Xe,{children:[Me&&t(vr,{error:Me,onRetry:sn}),t(Yo,{player:u,title:r.title,episodeLabel:f?void 0:`S${m} E${T}`,server:le||it?.label||E,audioTracks:Ve,selectedAudioTrack:Fe,onAudioTrackChange:Xr,subtitles:Ee,selectedSubtitle:oe,onSubtitleChange:Jr,streams:U,resolutionIdx:ze,onResolutionChange:e=>{Pn(),Ue(e);try{const n=U[e]?.quality;n&&z.setItem("tvLastQuality",n)}catch{}},onBack:Mn,videoDelayEnabled:Lt,onVideoDelayToggle:qt,videoDelayMs:hn,onVideoDelayChange:Vt,onCalibrateAvSync:d?void 0:gr,subtitleDelayMs:ut,onSubtitleDelayChange:Cr,showNextEpisodeButton:!i&&Ar&&!Ke&&!bt,onNextEpisode:Wr,isLoading:ce,isTheaterMode:Oe,onTheaterModeToggle:In,ambientSettings:Sn,onAmbientChange:kr,children:[t(vs,{autoPlay:!d&&Mt&&!Rt,playsInline:!0,disablePictureInPicture:!0,className:`${p.video} ${yn?p.videoHidden:""}`,onTimeUpdate:()=>{Ne||(Or(),rn())},onEnded:()=>{Ne||rn(!0)},onPlay:Vr,onPause:Fr,onSeeked:()=>{Ne||(zt(),rn())},onLoadedMetadata:()=>{Ur(),tr(),rn()},onDurationChange:()=>{tr()},onContextMenu:e=>e.preventDefault(),onError:()=>{ne("Video failed to load. Try another server or reload."),Pe(!1)}}),t("canvas",{ref:At,className:`${p.delayCanvas} ${yn?p.delayCanvasActive:""}`}),ye&&t("div",{ref:$e,className:p.subtitleOverlay}),t(Ds,{isOpen:fn,ms:hn,onChange:Vt,onApply:Sr,onClose:yr,testClipActive:Ne,onTestClip:_r})]})]}):Me&&!A?t(vr,{error:Me,onRetry:sn}):null}),t(ao,{playback:Ht?{selection:Ht,position:l.current?.currentTime||0,playing:!1,rate:u.engine.getState().playbackRate}:null,onCreate:()=>{vn(),u.engine.pause()},needsPlayback:Kn.needsPlayback,onEnablePlayback:Kn.enablePlayback}),d&&!ce&&r&&!Ht&&t("p",{role:"alert",children:"The host's direct HLS source is unavailable here. Retry or leave the room to use another source."}),!Oe&&r&&t(Os,{}),!Oe&&on&&t("div",{className:p.mobileSeasonRow,children:on}),!Oe&&r&&t("div",{className:ie.streamPanel,children:[t("div",{className:p.providerSelectWrap,children:t("label",{className:p.controlLabel,children:["Provider",t("select",{value:E,onChange:e=>jr(e.currentTarget.value),className:p.select,disabled:i||j.length===0,children:st?t("option",{value:"",children:"Loading..."}):j.length===0?t("option",{value:"",children:"No providers available"}):t(Xe,{children:[x.length>0&&t("optgroup",{label:"Direct HLS",children:x.map(e=>t("option",{value:e.id,children:e.label},e.id))}),se.length>0&&t("optgroup",{label:"Embeds",children:se.map(e=>t("option",{value:e.id,children:e.label},e.id))})]})})]})}),!i&&!A&&(ce?t("div",{className:p.sourceLoader,children:t("div",{className:p.ringSpinner})}):t(Go,{servers:Et,selectedServer:ct?"Embed":K,onServerSelect:Yr}))]}),!Oe&&r&&t("div",{className:Ae.playerInfoContainer,children:[t("div",{className:Ae.playerInfoHeader,children:[t("div",{className:Ae.playerAnimeCard,children:r.poster&&t(us,{src:`https://image.tmdb.org/t/p/w342${r.poster}`,alt:r.title,loading:"lazy",decoding:"async"})}),t("div",{className:Ae.videoTitleSection,children:[t("div",{className:ie.titleContainer,children:[t("h1",{children:r.title}),t("div",{className:p.meta,children:[t("span",{className:p.year,children:r.year}),r.vote_average!=null&&r.vote_average>0&&t("span",{className:p.rating,children:[t(he,{name:"star",size:12}),Number(r.vote_average).toFixed(1)]}),t("span",{className:`${p.typeBadge} ${p[f?"movie":"tv"]}`,children:f?"Movie":"TV Show"})]}),lr.length>0&&t("div",{className:p.genreRow,children:lr.map(e=>t("span",{className:p.genreChip,children:e},e))}),Bn.length>0&&t("div",{className:p.metaRow,children:Bn.map((e,n)=>t("span",{children:[e,n<Bn.length-1?" · ":""]},`${e}-${n}`))})]}),t("div",{className:ie.controls,children:[t("button",{className:`${ie.watchlistBtn} ${Bt?ie.inList:""}`,onClick:xr,disabled:Ir,type:"button",children:[Bt?t(he,{name:"check",size:14}):t(he,{name:"plus",size:14}),Bt?"In Watchlist":"Add to Watchlist"]}),!f&&t(Xe,{children:[t("button",{className:`${ie.watchlistBtn}`,onClick:()=>kn!=null&&vt(String(kn)),disabled:i||kn==null,type:"button",children:[t(he,{name:"chevron-left",size:14}),"Prev EP"]}),t("button",{className:`${ie.watchlistBtn}`,onClick:()=>F!=null&&vt(String(F)),disabled:i||F==null,type:"button",children:["Next EP",t(he,{name:"chevron-right",size:14})]}),!f&&t("button",{className:`${ie.watchlistBtn} ${ie.modeToggleBtn} ${ft?ie.modeToggleActive:""}`,onClick:()=>$r(!ft),type:"button","aria-pressed":ft,children:ft?"AUTOPLAY: ON":"AUTOPLAY: OFF"}),Rr&&t("button",{className:`${ie.watchlistBtn}`,onClick:()=>Nn(!0),type:"button",children:[t(he,{name:"list-ul",size:14}),"Episodes"]})]})]})]})]}),t("div",{className:Ae.infoColumns,children:[t("div",{className:`${ie.descriptionSection} ${ie.synopsisFlat}`,children:[t("h3",{children:"Synopsis"}),t(oo,{text:r.overview,emptyText:"No description available."}),t("button",{className:ie.detailsToggleBtn,onClick:()=>Br(!Xt),type:"button",children:[Xt?t(he,{name:"chevron-up"}):t(he,{name:"chevron-down"}),Xt?"Hide Details":"Show Details"]})]}),Xt&&t("div",{className:p.detailGrid,children:[r.first_air_date&&t("div",{className:p.detailItem,children:[t("strong",{children:f?"Release Date":"First Air Date"}),t("span",{children:r.first_air_date})]}),r.last_air_date&&t("div",{className:p.detailItem,children:[t("strong",{children:"Last Air Date"}),t("span",{children:r.last_air_date})]}),r.networks&&r.networks.length>0&&t("div",{className:p.detailItem,children:[t("strong",{children:"Networks"}),t("span",{children:r.networks.map(e=>e.name).join(", ")})]}),r.created_by&&r.created_by.length>0&&t("div",{className:p.detailItem,children:[t("strong",{children:"Created By"}),t("span",{children:r.created_by.map(e=>e.name).join(", ")})]}),r.episode_run_time&&r.episode_run_time.length>0&&t("div",{className:p.detailItem,children:[t("strong",{children:"Episode Runtime"}),t("span",{children:[r.episode_run_time[0]," min"]})]}),r.imdb_id&&t("div",{className:p.detailItem,children:[t("strong",{children:"IMDb"}),t("a",{href:`https://www.imdb.com/title/${r.imdb_id}`,target:"_blank",rel:"noopener noreferrer",className:p.imdbLink,children:"View on IMDb"})]})]})]})]}),!f&&t(qs,{isOpen:Pr,onClose:()=>Nn(!1),episodes:ir,currentEpisode:String(T),watchedEpisodes:ar,onEpisodeClick:vt,header:on}),r?.adult&&!wt&&t(Qs,{isOpen:!0,onClose:Mn,onGrant:Er}),t(Vs,{isOpen:!d&&Ke&&!Cn&&jt.current===`${ee}:${m}:${T}`&&dt?.completed!==1&&!dn(Xn,dt?.duration??0),onClose:nr,title:"Resume Watching",message:t(Xe,{children:["You were at ",t("strong",{children:Un(mt)})]}),restartLabel:"Start from Beginning",onResume:Hr,onRestart:nr}),t(Fs,{isOpen:bt,onClose:()=>ht(!1),title:f?"Movie Completed!":We!=null?"Season Complete!":"Show Completed!",heading:Lr,message:f?"You finished this movie!":We!=null?`You finished Season ${m}.`:"Congratulations! You finished all available episodes.",children:[t(cn,{variant:"secondary",onClick:()=>ht(!1),children:"Close"}),We!=null?t(cn,{onClick:Kr,children:["Start Season ",We]}):t(Xe,{children:[t(cn,{onClick:()=>{ht(!1),Mn()},children:"Back to Details"}),t(cn,{onClick:Qr,disabled:Wt.isPending||Kt.isPending,children:Wt.isPending||Kt.isPending?"Saving...":"Move to Completed"})]})]}),!r&&t("div",{className:p.statusMsg,children:[t(he,{name:"spinner",className:p.spinner})," Loading..."]})]})]})};export{ja as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as R,a as q,p as E,d as l,h as C,T,u as e,g as F}from"./vendor-core-DfaOB3Rn.js";import{I as a}from"./vendor-icons-DrybRNxP.js";import{aj as j,e as U,ak as H,t as J,B as w,a8 as K,i as I}from"./index-npJ4Ahxa.js";import{c as Q,d as X}from"./useTvLibrary-efdd6TIy.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-CHlEJU7b.js";const Y="_container_198yg_1",Z="_heroSection_198yg_11",ee="_bannerContainer_198yg_17",ne="_banner_198yg_17",te="_bannerOverlay_198yg_37",se="_heroContent_198yg_49",ae="_posterContainer_198yg_62",oe="_poster_198yg_62",ie="_infoGlass_198yg_86",re="_title_198yg_100",le="_quickMeta_198yg_110",ce="_metaItem_198yg_118",de="_iconStar_198yg_126",me="_iconTv_198yg_130",_e="_iconType_198yg_134",he="_genres_198yg_139",ge="_genre_198yg_139",ve="_metaRow_198yg_156",pe="_metaValue_198yg_164",ue="_metaDivider_198yg_168",ye="_synopsisSection_198yg_173",ke="_sectionTitleSmall_198yg_179",be="_synopsis_198yg_173",Ne="_actions_198yg_196",Se="_watchBtn_198yg_202",fe="_watchlistBtn_198yg_226",Ce="_active_198yg_250",Te="_seasonPickerLabel_198yg_256",we="_seasonSelect_198yg_267",Ie="_detailsToggleBtn_198yg_286",Be="_expandedContent_198yg_304",De="_detailGrid_198yg_309",Me="_detailItem_198yg_315",Le="_imdbLink_198yg_333",Pe="_heroSkeleton_198yg_343",$e="_skeletonBanner_198yg_347",Ge="_skeletonContent_198yg_354",xe="_skeletonPoster_198yg_365",Oe="_skeletonInfo_198yg_373",Ae="_skeletonTitle_198yg_380",Ve="_skeletonMeta_198yg_388",We="_skeletonDesc_198yg_396",ze="_skeletonActions_198yg_404",Re="_errorState_198yg_413",qe="_matureOverlay_198yg_434",Ee="_matureContent_198yg_444",n={container:Y,heroSection:Z,bannerContainer:ee,banner:ne,bannerOverlay:te,heroContent:se,posterContainer:ae,poster:oe,infoGlass:ie,title:re,quickMeta:le,metaItem:ce,iconStar:de,iconTv:me,iconType:_e,genres:he,genre:ge,metaRow:ve,metaValue:pe,metaDivider:ue,synopsisSection:ye,sectionTitleSmall:ke,synopsis:be,actions:Ne,watchBtn:Se,watchlistBtn:fe,active:Ce,seasonPickerLabel:Te,seasonSelect:we,detailsToggleBtn:Ie,expandedContent:Be,detailGrid:De,detailItem:Me,imdbLink:Le,heroSkeleton:Pe,skeletonBanner:$e,skeletonContent:Ge,skeletonPoster:xe,skeletonInfo:Oe,skeletonTitle:Ae,skeletonMeta:Ve,skeletonDesc:We,skeletonActions:ze,errorState:Re,matureOverlay:qe,matureContent:Ee};function Qe(){const{id:o}=R(),c=q(),[B]=E(),i=j(B.get("type")),{hasConsent:D}=U(),[t,M]=l(null),[L,_]=l(!0),[u,y]=l(""),[d,P]=l(!1),[h,$]=l(1),G=H(i,o??""),x=Number(o),{data:O}=Q(t?G:void 0),g=!!O?.inLibrary,{toggle:A}=X();C(()=>{o&&(_(!0),y(""),J.tv.details.query({type:i,id:String(o)}).then(s=>{const m={id:s.id,title:s.title||"",overview:s.overview||"",vote_average:s.vote_average,year:s.year,poster:s.poster,backdrop:s.backdrop,imdb_id:s.imdb_id||void 0,adult:s.adult,seasons:s.seasons?.map(z=>({...z,name:""})),number_of_seasons:s.number_of_seasons};M(m),_(!1)}).catch(s=>{y(s.message),_(!1)}))},[o,i]),C(()=>{document.title=t?.title?`${t.title} - dango`:"TV & Movies - dango"},[t?.title]);const V=()=>{!o||!t||c(r?I(i,o):I(i,o,h,1))},W=()=>{t&&A({tmdbId:x,mediaType:i,title:t.title,poster:t.poster,year:t.year,adult:t.adult})},r=i==="movie",v=!r,k=t?.backdrop?`https://image.tmdb.org/t/p/w1280${t.backdrop}`:"",b=t?.poster?`https://image.tmdb.org/t/p/w500${t.poster}`:"",N=T(()=>t?.genres?t.genres.map(s=>s.name).slice(0,5):[],[t?.genres]),S=T(()=>t?.seasons?t.seasons.filter(s=>s.season_number>0):[],[t?.seasons]),p=[t?.year,t?.status,v&&t?.number_of_seasons?`${t.number_of_seasons} Season${t.number_of_seasons>1?"s":""}`:null,v&&t?.number_of_episodes?`${t.number_of_episodes} Episodes`:null].filter(Boolean);if(L)return e("div",{className:n.container,children:e("div",{className:n.heroSkeleton,children:[e("div",{className:n.skeletonBanner}),e("div",{className:n.skeletonContent,children:[e("div",{className:n.skeletonPoster}),e("div",{className:n.skeletonInfo,children:[e("div",{className:n.skeletonTitle}),e("div",{className:n.skeletonMeta}),e("div",{className:n.skeletonDesc}),e("div",{className:n.skeletonActions})]})]})]})});if(u||!t)return e("div",{className:n.container,children:e("div",{className:n.errorState,children:[e(a,{name:"exclamation-triangle",size:48}),e("h2",{children:"Failed to load details"}),e("p",{children:u||"Something went wrong"}),e(w,{onClick:()=>c(-1),children:"Go Back"})]})});const f=t.adult&&!D;return e("div",{className:n.container,style:f?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:[e("div",{className:n.heroSection,children:[e("div",{className:n.bannerContainer,children:[k&&e("div",{className:n.banner,style:{backgroundImage:`url(${k})`}}),e("div",{className:n.bannerOverlay})]}),e("div",{className:n.heroContent,children:[e("div",{className:n.posterContainer,children:b&&e(K,{src:b,alt:t.title,className:n.poster,decoding:"async"})}),e("div",{className:n.infoGlass,children:[e("div",{children:[e("h1",{className:n.title,children:t.title}),e("div",{className:n.quickMeta,children:[t.vote_average!=null&&t.vote_average>0&&e("div",{className:n.metaItem,children:[e(a,{name:"star",className:n.iconStar}),e("span",{children:Number(t.vote_average).toFixed(1)})]}),e("div",{className:n.metaItem,children:[e(a,{name:"tv",className:n.iconTv}),e("span",{children:r?"Movie":"TV Show"})]}),t.vote_count!=null&&e("div",{className:n.metaItem,children:[e(a,{name:"users",className:n.iconType}),e("span",{children:[t.vote_count.toLocaleString()," votes"]})]})]}),N.length>0&&e("div",{className:n.genres,children:N.map(s=>e("span",{className:n.genre,children:s},s))})]}),p.length>0&&e("div",{className:n.metaRow,children:p.map((s,m)=>e(F.Fragment,{children:[e("span",{className:n.metaValue,children:s}),m<p.length-1&&e("span",{className:n.metaDivider,children:"·"})]},m))}),t.overview&&e("div",{className:n.synopsisSection,children:[e("h2",{className:n.sectionTitleSmall,children:"Synopsis"}),e("p",{className:n.synopsis,children:t.overview})]}),e("div",{className:n.actions,children:[e("button",{className:n.watchBtn,onClick:V,children:[e(a,{name:"play",size:14}),r?"Watch Now":`Start S${h}`]}),e("button",{className:`${n.watchlistBtn} ${g?n.active:""}`,onClick:W,children:[g?e(a,{name:"check",size:14}):e(a,{name:"plus",size:14}),g?"In Watchlist":"Add to Watchlist"]})]}),v&&S.length>1&&e("label",{className:n.seasonPickerLabel,children:[e("span",{children:"Season"}),e("select",{value:h,onChange:s=>$(parseInt(s.currentTarget.value,10)||1),className:n.seasonSelect,children:S.map(s=>e("option",{value:s.season_number,children:["Season ",s.season_number," (",s.episode_count," Episodes)"]},s.season_number))})]}),e("button",{className:n.detailsToggleBtn,onClick:()=>P(!d),children:[d?e(a,{name:"chevron-up"}):e(a,{name:"chevron-down"}),d?"Hide Details":"Show Details"]}),d&&e("div",{className:n.expandedContent,children:e("div",{className:n.detailGrid,children:[t.first_air_date&&e("div",{className:n.detailItem,children:[e("strong",{children:r?"Release Date":"First Air Date"}),e("span",{children:t.first_air_date})]}),t.last_air_date&&e("div",{className:n.detailItem,children:[e("strong",{children:"Last Air Date"}),e("span",{children:t.last_air_date})]}),t.networks&&t.networks.length>0&&e("div",{className:n.detailItem,children:[e("strong",{children:"Networks"}),e("span",{children:t.networks.map(s=>s.name).join(", ")})]}),t.created_by&&t.created_by.length>0&&e("div",{className:n.detailItem,children:[e("strong",{children:"Created By"}),e("span",{children:t.created_by.map(s=>s.name).join(", ")})]}),t.episode_run_time&&t.episode_run_time.length>0&&e("div",{className:n.detailItem,children:[e("strong",{children:"Episode Runtime"}),e("span",{children:[t.episode_run_time[0]," min"]})]}),t.imdb_id&&e("div",{className:n.detailItem,children:[e("strong",{children:"IMDb"}),e("a",{href:`https://www.imdb.com/title/${t.imdb_id}`,target:"_blank",rel:"noopener noreferrer",className:n.imdbLink,children:"View on IMDb"})]})]})})]})]})]}),f&&e("div",{className:n.matureOverlay,children:e("div",{className:n.matureContent,children:[e(a,{name:"exclamation-triangle",size:48}),e("h2",{children:"Content Warning"}),e("p",{children:"This content may contain mature themes."}),e(w,{onClick:()=>c("/"),children:"Go Back"})]})})]})}export{Qe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as n,h as b,T as k,u as T}from"./vendor-core-DfaOB3Rn.js";import{
|
|
1
|
+
import{d as n,h as b,T as k,u as T}from"./vendor-core-DfaOB3Rn.js";import{ak as _,t as m,k as w,i as I,l as P}from"./index-npJ4Ahxa.js";import{d as D}from"./useTvLibrary-efdd6TIy.js";import{a as W}from"./MediaCard-CXZJ8wr7.js";const S=({item:e,anchorRect:l,onMouseEnter:i,onMouseLeave:c,onRequestClose:p})=>{const[a,u]=n(null),[d,r]=n(!0),{toggle:v,bookmarkedIds:g}=D(),y=_(e.type,e.id),f=g.has(y);b(()=>{let o=!1;return r(!0),m.tv.details.query({type:e.type,id:String(e.id)}).then(s=>{o||(u({overview:s.overview,vote_average:s.vote_average,number_of_seasons:s.number_of_seasons}),r(!1))}).catch(()=>{o||r(!1)}),()=>{o=!0}},[e.id,e.type]);const h=k(()=>a?.genres?a.genres.slice(0,4).map(o=>o.name):[],[a?.genres]),t=[];return a?.vote_average!=null&&a.vote_average>0&&t.push({icon:"star",label:Number(a.vote_average).toFixed(1),accent:!0}),t.push({icon:"tv",label:e.type==="tv"?"TV Show":"Movie"}),e.year&&t.push({label:e.year}),a?.status&&t.push({label:a.status}),T(W,{anchorRect:l,title:e.title,loading:d,meta:t,genres:h,synopsis:P(a?.overview,200),primaryAction:{to:I(e.type,e.id),label:"Watch now",icon:"play"},secondaryAction:{to:w(e.type,e.id),label:"Details",icon:"info-circle"},bookmarked:f,onToggleBookmark:()=>v({tmdbId:e.id,mediaType:e.type,title:e.title,poster:e.image,year:e.year}),onMouseEnter:i,onMouseLeave:c,onRequestClose:p})};export{S as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as I,p as ae,A as re,d as o,T as Y,q as M,u as t}from"./vendor-core-DfaOB3Rn.js";import{I as h}from"./vendor-icons-DrybRNxP.js";import{P as D}from"./MediaCard-
|
|
1
|
+
import{h as I,p as ae,A as re,d as o,T as Y,q as M,u as t}from"./vendor-core-DfaOB3Rn.js";import{I as h}from"./vendor-icons-DrybRNxP.js";import{P as D}from"./MediaCard-CXZJ8wr7.js";import{a as ne,T as se}from"./useTv-DatZ0tof.js";import{S as le}from"./SkeletonGrid-CmHR4_Fc.js";import{u as ie,T as W,M as Q,aa as oe,B as x}from"./index-npJ4Ahxa.js";import{E as ce}from"./ErrorMessage-DAxegITP.js";import{s as r}from"./Search.module-C_qwCdHS.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BrKd4CBZ.js";import"./TvPopup-CIMgMYf0.js";import"./useTvLibrary-efdd6TIy.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-CHlEJU7b.js";const de=[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}],ue=[{value:"popularity.desc",label:"Popularity"},{value:"vote_average.desc",label:"Top Rated"},{value:"primary_release_date.desc",label:"Newest"},{value:"primary_release_date.asc",label:"Oldest"},{value:"vote_count.desc",label:"Most Voted"}],O=new Date().getFullYear(),me=[{value:"ALL",label:"All Years"},...Array.from({length:O-1980+1},(l,m)=>({value:String(O-m),label:String(O-m)}))];function _e(){I(()=>{document.title="Search TV & Movies - dango"},[]);const[l,m]=ae(),{lowEndMode:K}=ie(),C=re(null),[g,H]=o(l.get("q")||""),[p,U]=o(l.get("q")||""),[u,v]=o(parseInt(l.get("page")||"1",10)||1),[i,J]=o(l.get("type")||"multi"),[$,k]=o(l.get("genre")||""),[y,B]=o(l.get("year")||"ALL"),[f,E]=o(l.get("sort_by")||"popularity.desc"),[b,X]=o(!1),[c,N]=o(()=>{const e={},a=l.get("genre")||"";return a&&(e[a]="include"),e}),P=Y(()=>{if(i==="tv")return Object.entries(W).map(([a,n])=>({id:a,name:n}));if(i==="movie")return Object.entries(Q).map(([a,n])=>({id:a,name:n}));const e=new Map;for(const[a,n]of Object.entries(W))e.set(a,n);for(const[a,n]of Object.entries(Q))e.set(a,n);return Array.from(e.entries()).map(([a,n])=>({id:a,name:n}))},[i]),S=Y(()=>Object.entries(c).filter(([,a])=>a==="include").map(([a])=>a).join(","),[c]),{data:L,isLoading:w,isError:Z,error:ee}=ne({query:p,type:i,genre:S,year:y,sort_by:f,page:u}),T=L?.results||[],_=L?.total_pages||0,j=L?.total_results||0,R=u<Math.min(_,500),d=M((e={})=>{const a=new URLSearchParams,n=e.q!==void 0?e.q:p,s=e.type!==void 0?e.type:i,G=e.year!==void 0?e.year:y,V=e.sort!==void 0?e.sort:f,F=e.page!==void 0?e.page:String(u),z=e.genre!==void 0?e.genre:S;n.trim()&&a.set("q",n.trim()),s!=="multi"&&a.set("type",s),z&&a.set("genre",z),G!=="ALL"&&a.set("year",G),V!=="popularity.desc"&&a.set("sort_by",V),F!=="1"&&a.set("page",F),m(a,{replace:!0})},[p,i,y,f,u,S,m]),A=M(()=>{oe(),v(1),U(g),d({q:g,page:"1"}),window.scrollTo({top:0,behavior:"smooth"})},[g,d]),q=M(e=>{if(v(e),d({page:String(e)}),C.current){const a=C.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:a,behavior:"smooth"})}},[d]),te=M(e=>{N(a=>{const n=a[e],s={...a};return n==="include"?s[e]="exclude":n==="exclude"?delete s[e]:s[e]="include",s}),v(1)},[]);return I(()=>{const a=Object.entries(c).filter(([,n])=>n==="include").map(([n])=>n).join(",");a!==$&&(k(a),d({genre:a,page:"1"}))},[c,$,k,d]),t("div",{className:"page-container",children:[t("div",{className:r.header,children:[t("h1",{className:r.pageTitle,children:"Search TV & Movies"}),t("p",{className:r.pageSubtitle,children:"Discover trending shows, movies, and more powered by TMDB"})]}),t("div",{className:r.filterContainer,children:[t("div",{className:r.searchBarWrapper,children:[t("div",{className:r.inputIconWrapper,children:[t(h,{name:"search",className:r.searchIcon}),t("input",{type:"text","data-virtual-keyboard":"true",className:r.searchInput,placeholder:"Search titles...",value:g,onInput:e=>H(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&A()})]}),t("div",{className:r.searchActions,children:[t("select",{value:i,onChange:e=>{J(e.currentTarget.value),N({})},className:r.providerSelect,"aria-label":"Media type",children:de.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(x,{onClick:A,className:r.searchBtn,children:"Search"}),t("button",{className:`${r.filterToggleBtn} ${b?r.active:""}`,onClick:()=>X(!b),children:[t(h,{name:"filter",size:14}),t("span",{children:"Filters"}),b?t(h,{name:"chevron-up",size:12}):t(h,{name:"chevron-down",size:12})]})]})]}),t("div",{className:`${r.advancedFilters} ${b?r.show:""}`,children:[t("div",{className:r.filterDivider}),t("div",{className:r.filterGrid,children:[t("div",{className:r.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:f,onChange:e=>E(e.currentTarget.value),children:ue.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:r.filterItem,children:[t("label",{children:"Year"}),t("select",{value:y,onChange:e=>B(e.currentTarget.value),children:me.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),P.length>0&&t("div",{className:r.genreSection,children:[t("label",{className:r.genreLabel,children:"Genres"}),t("div",{className:r.genreContainer,children:P.map(e=>t("button",{className:`${r.genreButton} ${r[c[e.id]||""]}`,onClick:()=>te(e.id),children:e.name},e.id))})]}),t("div",{className:r.filterActions,children:[t(x,{variant:"secondary",onClick:()=>{N({}),B("ALL"),E("popularity.desc"),v(1),d({genre:"",year:"ALL",sort:"popularity.desc",page:"1"})},children:"Reset All"}),t(x,{onClick:A,className:r.searchBtn,children:"Apply Filters"})]})]})]}),Z&&t(ce,{message:ee?.message||"Search failed"}),Object.keys(c).length>0&&t("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",marginBottom:"1.5rem"},children:[t("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),Object.entries(c).map(([e,a])=>{const n=P.find(s=>s.id===e)?.name||e;return t("span",{className:`badge ${a==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[a==="include"?`+ ${n}`:`- ${n}`,t("button",{onClick:()=>{const s={...c};delete s[e],N(s)},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e)})]}),t("div",{className:r.resultsHeader,ref:C,children:[t("h2",{className:r.resultsTitle,children:[p?`Results for "${p}"`:S?"Browsing genres":i==="tv"?"Popular TV Shows":i==="movie"?"Popular Movies":"Trending",j>0&&t("span",{style:{fontWeight:400,color:"var(--text-tertiary)",fontSize:"0.85em",marginLeft:"0.5em"},children:["(",j.toLocaleString(),")"]})]}),T.length>0&&t(D,{page:u,totalPages:Math.max(1,Math.min(_,500)),canGoNext:R,onChange:q,isLoading:w})]}),t("div",{className:`${r.resultsGrid} ${K?r.lowEnd:""}`,children:w?t(le,{}):T.map(e=>t(se,{item:{id:e.id,title:e.title,year:e.year,type:e.type,image:e.image,vote_average:e.vote_average,adult:e.adult}},`${e.type}-${e.id}`))}),!w&&T.length===0&&t("div",{className:r.noResults,children:[t(h,{name:"search",size:48,className:r.noResultsIcon}),t("h3",{children:"No results found"}),t("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&t("div",{className:r.bottomPagination,children:t(D,{page:u,totalPages:Math.max(1,Math.min(_,500)),canGoNext:R,onChange:q,isLoading:w,variant:"labeled"})})]})}export{_e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as $,d as f,h as L,T as U,u as d}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-CXZJ8wr7.js";import{L as F}from"./LibraryListPage-CHHjw4Jz.js";import{R as N}from"./ResetProgressModal-CXDZfCap.js";import{T as _}from"./TvPopup-CIMgMYf0.js";import{i as y,h as u,j as R}from"./index-npJ4Ahxa.js";import{j,u as K,a as O,b as Q,f as Y,k as q,l as z,m as G,T as I}from"./useTvLibrary-efdd6TIy.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BrKd4CBZ.js";import"./SkeletonGrid-CmHR4_Fc.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-CHlEJU7b.js";const Z=["All","Continue Watching",...I],S=24;function ct(){const{filter:l="All"}=$(),[c,m]=f(1),[s,v]=f(null);L(()=>{document.title="TV Watchlist - dango"},[]),L(()=>{m(1)},[l]);const o=l==="Continue Watching",r=j(o?"All":l,c,S),i=K(100),T=O(),P=Q(),k=Y(),w=q(),C=z(),B=G(),M=U(()=>o?(i.data?.data??[]).map(t=>{const a=t.currentTime??0,e=t.duration??0,g=t.season??1,h=t.episode??1,n=t.mediaType==="movie",p=n?"Movie":`S${g} E${h}`,b=t.completed===1||e>0&&a>=e*.8;return{key:t.id,libId:t.id,tmdbId:t.tmdbId??0,mediaType:t.mediaType,title:t.title||"",poster:t.poster||"",year:t.year,adult:R({adult:t.adult===1}),status:t.watchlistStatus??"",badge:p,progressPercent:b?100:e>0?a/e*100:0,progressLabel:e>0?b?"Watched":n?`${u(a)} / ${u(e)}`:`${p} · ${u(a)} / ${u(e)}`:p,watchTarget:y(t.mediaType,t.tmdbId??0,n?void 0:g,n?void 0:h)}}):(r.data?.data??[]).map(t=>({key:t.id,libId:t.id,tmdbId:t.tmdbId,mediaType:t.mediaType,title:t.title,poster:t.poster||"",year:t.year,adult:R({adult:t.adult===1}),status:t.status,badge:t.lastSeason&&t.lastEpisode?`S${t.lastSeason} E${t.lastEpisode}`:void 0,progressPercent:void 0,progressLabel:void 0,watchTarget:y(t.mediaType,t.tmdbId,t.lastSeason??void 0,t.lastEpisode??void 0)})),[o,i.data,r.data]),W=o?i.data?.total??0:r.data?.total??0,E=o?i.isLoading:r.isLoading,A=o?i.error:r.error,V=t=>{s&&(P.mutate({mediaId:s.libId}),t&&T.mutate(s.libId))};return d(F,{headerTitle:"My TV Watchlist",headerSubtitle:"Track and manage your movies and shows",filters:Z,filterBy:l,filterBasePath:"/tv-watchlist",continueFilter:"Continue Watching",statusOptions:[...I],entries:M,total:W,isLoading:E,error:A,page:c,pageSize:S,onPageChange:m,emptyTitle:"Your TV watchlist is looking a bit empty",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to watch!",browseLabel:"Browse TV & Movies",browseTarget:"/tv",removeListLabel:"Remove from TV Watchlist",listNoun:"TV watchlist",skipConfirmKey:"tvSkipRemoveConfirmation",onBulkStatus:(t,a)=>w.mutate({ids:t,status:a}),onBulkRemove:t=>{o?B.mutate(t):C.mutate(t)},onStatusChange:(t,a)=>k.mutate({id:t,status:a}),onRemoveItem:t=>T.mutate(t),renderCard:t=>d(x,{item:{id:t.libId,title:t.title,thumbnail:t.poster,typeBadge:t.mediaType==="movie"?"Movie":"TV",chapterBadge:t.badge??null,isAdult:t.adult},linkTo:t.watchTarget,hoverIcon:"play",progress:t.progressPercent!==void 0&&t.progressLabel?{percent:t.progressPercent,label:t.progressLabel}:void 0,showProgress:o,metaRow:t.year?d("span",{style:{opacity:.75},children:t.year}):void 0,onRemove:o?()=>v(t):void 0,renderPopup:(a,e)=>d(_,{item:{id:t.tmdbId??0,title:t.title||"",year:t.year||"",type:t.mediaType||"tv",image:t.poster||""},anchorRect:a,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onRequestClose:e.close})}),modals:d(N,{isOpen:!!s,itemName:s?.title,progressKind:"watch",listLabel:"my TV watchlist",onClose:()=>{v(null)},onConfirm:V})})}export{ct as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as w,A as E,h as v,q as N,$ as D,u as o}from"./vendor-core-DfaOB3Rn.js";import{p as x}from"./index-
|
|
1
|
+
import{d as w,A as E,h as v,q as N,$ as D,u as o}from"./vendor-core-DfaOB3Rn.js";import{p as x}from"./index-npJ4Ahxa.js";import"./vendor-query-BBT5_sHx.js";import"./vendor-icons-DrybRNxP.js";const O="_keyboard_1l8yf_1",R="_small_1l8yf_18",T="_medium_1l8yf_25",q="_large_1l8yf_32",U="_topBar_1l8yf_39",V="_dragHandle_1l8yf_48",W="_grip_1l8yf_59",X="_topButton_1l8yf_67",Y="_key_1l8yf_1",j="_closeButton_1l8yf_98",A="_keys_1l8yf_104",F="_row_1l8yf_111",J="_wideKey_1l8yf_132",P="_spaceKey_1l8yf_136",G="_spaceIcon_1l8yf_144",Q="_activeKey_1l8yf_153",t={keyboard:O,small:R,medium:T,large:q,topBar:U,dragHandle:V,grip:W,topButton:X,key:Y,closeButton:j,keys:A,row:F,wideKey:J,spaceKey:P,spaceIcon:G,activeKey:Q},$="virtual-keyboard-state",b=["small","medium","large"],Z=["1","2","3","4","5","6","7","8","9","0"],ee=["!","@","#","$","%","^","&","*","(",")"],te=[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],ne=()=>{const i={position:{x:Math.max(12,window.innerWidth-690),y:Math.max(90,window.innerHeight-330)},size:"medium"};try{const c=x.getItem($);if(!c)return i;const s=JSON.parse(c);return{position:s.position&&Number.isFinite(s.position.x)&&Number.isFinite(s.position.y)?s.position:i.position,size:s.size&&b.includes(s.size)?s.size:i.size}}catch{return i}},K=(i,c)=>{const s=c?.offsetWidth??650,r=c?.offsetHeight??270;return{x:Math.min(Math.max(8,i.x),Math.max(8,window.innerWidth-s-8)),y:Math.min(Math.max(8,i.y),Math.max(8,window.innerHeight-r-8))}};function re({activeInputRef:i,isVisible:c,onClose:s}){const[{position:r,size:l},h]=w(ne),[k,z]=w(!1),[g,S]=w(!1),f=E(null),u=E(null);v(()=>{x.setItem($,JSON.stringify({position:r,size:l}))},[r,l]),v(()=>{const e=()=>{h(n=>({...n,position:K(n.position,f.current)}))};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const _=()=>i.current&&document.contains(i.current)?i.current:document.activeElement instanceof HTMLInputElement?document.activeElement:null,d=e=>{const n=_();if(!n)return;const a=n.selectionStart??n.value.length,p=n.selectionEnd??n.value.length;n.setRangeText(e,a,p,"end"),n.dispatchEvent(new Event("input",{bubbles:!0})),n.focus()},M=()=>{const e=_();if(!e)return;const n=e.selectionStart??e.value.length,a=e.selectionEnd??e.value.length;n===a&&n===0||(e.setRangeText("",n===a?n-1:n,a,"end"),e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus())},B=()=>{const e=_();if(!e){s();return}const n=e.form;n?n.requestSubmit():e.dispatchEvent(new KeyboardEvent("keydown",{key:"Enter",bubbles:!0})),s()},C=e=>{e.preventDefault()},y=N(e=>{if(!u.current)return;const n={x:e.clientX-u.current.x,y:e.clientY-u.current.y};h(a=>({...a,position:K(n,f.current)}))},[]),m=N(()=>{u.current=null,window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",m)},[y]),L=e=>{e.preventDefault(),u.current={x:e.clientX-r.x,y:e.clientY-r.y},window.addEventListener("mousemove",y),window.addEventListener("mouseup",m)};if(v(()=>()=>{window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",m)},[y,m]),!c)return null;const H=g?ee:Z,I=()=>{h(e=>{const n=b[(b.indexOf(e.size)+1)%b.length];return{...e,size:n}})};return D(o("div",{ref:f,className:`${t.keyboard} ${t[l]}`,style:{left:r.x,top:r.y},onMouseDown:C,"data-virtual-keyboard-root":!0,children:[o("div",{className:t.topBar,children:[o("div",{className:t.dragHandle,onMouseDown:L,"aria-label":"Move virtual keyboard",children:[o("span",{className:t.grip,"aria-hidden":"true"}),o("span",{children:"Virtual Keyboard"})]}),o("button",{type:"button",className:t.topButton,onClick:I,children:["Size: ",l[0].toUpperCase()+l.slice(1)]}),o("button",{type:"button",className:`${t.topButton} ${t.closeButton}`,onClick:s,children:"X"})]}),o("div",{className:t.keys,children:[o("div",{className:t.row,children:[H.map(e=>o("button",{type:"button",className:t.key,onClick:()=>d(e),children:e},e)),o("button",{type:"button",className:`${t.key} ${t.wideKey}`,onClick:M,"aria-label":"Backspace",children:"⟵"})]}),te.map((e,n)=>o("div",{className:t.row,children:[e.map(a=>{const p=k?a.toUpperCase():a;return o("button",{type:"button",className:t.key,onClick:()=>d(p),children:p},a)}),n===1&&o("button",{type:"button",className:`${t.key} ${t.wideKey}`,onClick:B,children:"Enter"})]},e.join(""))),o("div",{className:t.row,children:[o("button",{type:"button",className:`${t.key} ${t.wideKey} ${g?t.activeKey:""}`,onClick:()=>S(e=>!e),children:"Ctrl"}),o("button",{type:"button",className:`${t.key} ${t.wideKey} ${k?t.activeKey:""}`,onClick:()=>z(e=>!e),children:"Shift"}),o("button",{type:"button",className:`${t.key} ${t.spaceKey}`,onClick:()=>d(" "),"aria-label":"Space",children:o("span",{className:t.spaceIcon})}),o("button",{type:"button",className:t.key,onClick:()=>d("."),children:"."}),o("button",{type:"button",className:t.key,onClick:()=>d("-"),children:"-"})]})]})]}),document.body)}export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as h,d as s,u as e}from"./vendor-core-DfaOB3Rn.js";import{
|
|
1
|
+
import{c as h,d as s,u as e}from"./vendor-core-DfaOB3Rn.js";import{a6 as d,B as m}from"./index-npJ4Ahxa.js";import{W as u,s as p,a as g}from"./WatchAlongPanel-CvUFCFll.js";import"./vendor-query-BBT5_sHx.js";import"./vendor-icons-DrybRNxP.js";function b(){const o=d(),c=h(),[t,l]=s(c.hash.slice(1)),[n,a]=s("");return e("div",{style:{maxWidth:640,margin:"2rem auto",padding:"0 1rem"},children:[e("h1",{children:"Watch along"}),e("p",{children:"Watch with friends across the internet. The host chooses the episode, provider, and source, and controls playback. Your dango streams your own video."}),o.session&&e(u,{}),!o.session&&e("form",{className:p.panel,onSubmit:r=>{r.preventDefault();try{o.join(t),a("")}catch(i){a(i instanceof Error?i.message:"Could not join room")}},children:[e(g,{}),e("label",{htmlFor:"watch-invite",children:"Invite link or room code"}),e("input",{id:"watch-invite",value:t,onChange:r=>l(r.currentTarget.value),required:!0,autoComplete:"off"}),e("p",{children:"Joining shares your connection and playback readiness with the room service. Start a room from an episode using a direct HLS source."}),e(m,{type:"submit",disabled:!o.workerUrl,style:{marginTop:"1rem"},children:"Join room"}),!o.workerUrl&&e("p",{children:"Watch along is unavailable. The server needs a watch-along service URL."}),n&&e("p",{role:"alert",children:n})]})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as h,A as _,h as z,u as s,L as C}from"./vendor-core-DfaOB3Rn.js";import{
|
|
1
|
+
import{d as h,A as _,h as z,u as s,L as C}from"./vendor-core-DfaOB3Rn.js";import{a6 as g,B as r}from"./index-npJ4Ahxa.js";const N="_panel_ntzz0_1",b="_summary_ntzz0_10",k="_heading_ntzz0_20",x="_actions_ntzz0_21",T="_members_ntzz0_22",A="_name_ntzz0_29",o={panel:N,summary:b,heading:k,actions:x,members:T,name:A};function L(){const t=g();return s("label",{className:o.name,children:["Display name",s("input",{value:t.displayName,onChange:a=>t.setDisplayName(a.currentTarget.value),maxLength:32,placeholder:"Your name (optional)",autoComplete:"nickname"}),s("small",{children:"Remembered for this profile on this browser."})]})}function D({playback:t,onCreate:a,needsPlayback:l,onEnablePlayback:p}){const e=g(),[y,m]=h(!1),[d,i]=h(""),[v,f]=h(!1),c=_(null);z(()=>{c.current&&(e.session||l)&&(c.current.open=!0)},[e.session,l]);const u=e.session?`${e.workerUrl}/join#${e.session.id}.${e.session.guestToken}`:"";return s("details",{ref:c,className:o.panel,"aria-label":"Watch along",children:[s("summary",{className:o.summary,children:["Watch along",e.session?e.session.host?" · You are hosting":" · Following host":""]}),s("div",{className:o.heading,children:e.session?s("div",{className:o.actions,children:[s(r,{size:"sm",variant:"secondary",onClick:async()=>{f(!0);try{await navigator.clipboard.writeText(u),i("Invite copied")}catch{i("Copy the invite below")}},children:"Copy invite"}),s(r,{size:"sm",variant:"ghost",onClick:e.leave,children:e.session.host?"End room":"Leave room"})]}):s("div",{className:o.actions,children:[a&&s(r,{size:"sm",loading:y,disabled:!t||!e.workerUrl,onClick:async()=>{if(t){m(!0),i("");try{a(),await e.create({...t,playing:!1})}catch(n){i(n instanceof Error?n.message:"Could not create room")}finally{m(!1)}}},children:"Create room"}),s(C,{to:"/watch-along",children:"Join a room"})]})}),s(L,{}),!e.session&&s("p",{children:"Direct HLS only. Each viewer needs their own dango. Room controls use the shared watch-along service."}),e.session&&s("p",{children:[e.connected?e.room?.hostOnline?"Connected":"Host disconnected. Room closes after 60 seconds unless they reconnect":"Connecting…"," ","· Provider and source follow the host. Volume and subtitles stay yours."]}),e.room&&s("p",{children:[e.session?.host&&"End the room when you are finished watching. ","Rooms automatically close six hours after creation. This room expires at"," ",s("time",{dateTime:new Date(e.room.expiresAt).toISOString(),children:new Date(e.room.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),", even if playback is still active."]}),e.room&&s("ul",{className:o.members,children:e.room.members.map((n,w)=>s("li",{children:[n.name||(n.host?"Host":`Guest ${w+1}`),n.name&&n.host?" (host)":"",n.id===e.selfId?" (you)":"",": ",n.status]},n.id))}),l&&s(r,{size:"sm",onClick:p,children:"Enable playback"}),v&&e.session&&s("input",{"aria-label":"Room invite",readOnly:!0,value:u,onFocus:n=>n.currentTarget.select()}),(e.error||d)&&s("p",{role:"status",children:e.error||d})]})}export{D as W,L as a,o as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as fe,o as He,a as Ze,p as Je,d as h,A as ye,T,u as t,S as Xe}from"./vendor-core-DfaOB3Rn.js";import{u as et,a as Se}from"./vendor-query-BBT5_sHx.js";import{l as tt,u as at,d as nt,C as st,D as _e,E as we,q as Ae,F as lt,t as rt,o as ct,G as it,H as ot,I as dt,J as ht,K as ut,B as W,L as se}from"./index-CNEFXey-.js";import{I as g}from"./vendor-icons-DrybRNxP.js";import{A as mt}from"./AnimeCard-arsIYutf.js";import{S as pt}from"./SkeletonGrid-DWlQpD8M.js";import{E as gt}from"./ErrorMessage-DAxegITP.js";import{P as Le}from"./MediaCard-ByXxG9l_.js";import{s as n}from"./LibraryListPage.module-r6k9nyT9.js";import{A as vt}from"./ActiveFilterChips-olGfwxle.js";import"./useAnimeInfoData-C0IMDPmT.js";import"./QueueOptionsButton-CgPjlxhd.js";import"./vendor-ui-3qrARCPr.js";import"./playbackCompletion-UNMxJNR7.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-zk8Ir04J.js";const ft=(d,v)=>{const l=new URLSearchParams(v);return l.delete("page"),l.sort(),`${d}|${l.toString()}`},yt=(d,v)=>{const l=new Set(d);return v.forEach(w=>l.add(w)),l},St=(d,v)=>{const l=new Set(d);return v.forEach(w=>l.delete(w)),l},_t="_sortSelect_cahhw_1",wt="_filterContainer_cahhw_30",At="_slideUpIn_cahhw_1",Lt="_searchBarWrapper_cahhw_44",Ct="_inputIconWrapper_cahhw_50",Nt="_searchIcon_cahhw_55",bt="_searchInput_cahhw_64",Bt="_searchActions_cahhw_84",kt="_searchBtn_cahhw_89",Rt="_filterToggleBtn_cahhw_94",Tt="_advancedFilters_cahhw_115",Wt="_show_cahhw_122",It="_filterDivider_cahhw_128",xt="_filterGrid_cahhw_134",$t="_filterItem_cahhw_141",Pt="_genreSection_cahhw_183",Ft="_genreLabel_cahhw_189",Gt="_genreContainer_cahhw_199",Mt="_genreButton_cahhw_205",Ot="_include_cahhw_222",Et="_exclude_cahhw_228",Dt="_filterActions_cahhw_235",zt="_applyBtn_cahhw_246",c={sortSelect:_t,filterContainer:wt,slideUpIn:At,searchBarWrapper:Lt,inputIconWrapper:Ct,searchIcon:Nt,searchInput:bt,searchActions:Bt,searchBtn:kt,filterToggleBtn:Rt,advancedFilters:Tt,show:Wt,filterDivider:It,filterGrid:xt,filterItem:$t,genreSection:Pt,genreLabel:Ft,genreContainer:Gt,genreButton:Mt,include:Ot,exclude:Et,filterActions:Dt,applyBtn:zt},Ne=["All","Continue Watching","Watching","Completed","On-Hold","Dropped","Planned"],Ce=Ne.slice(2),Ut=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Adult (18+)"}],qt=[{value:"ALL",label:"All Seasons"},{value:"WINTER",label:"Winter"},{value:"SPRING",label:"Spring"},{value:"SUMMER",label:"Summer"},{value:"FALL",label:"Fall"}],ca=()=>{fe(()=>{document.title="Watchlist - dango"},[]);const{filter:d="All"}=He(),v=Ze(),[l,w]=Je(),Q=et(),le=tt(),[f,I]=h(parseInt(l.get("page")||"1")),[A,x]=h(l.get("query")||""),[L,V]=h(l.get("sortBy")||"last_added"),[C,$]=h(l.get("type")||"ALL"),[N,P]=h(l.get("season")||"ALL"),[b,F]=h(l.get("year")||"ALL"),[k,G]=h(()=>{const e={},a=l.get("genres")?.split(",").map(r=>r.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(r=>r.trim()).filter(Boolean)||[];return a.forEach(r=>r&&(e[r]="include")),s.forEach(r=>r&&(e[r]="exclude")),e}),[M,be]=h(()=>["type","season","year","genres","excludeGenres"].some(e=>l.has(e))),{lowEndMode:Be}=at(),{titlePreference:O}=nt(),{data:ke}=st(),re=ke?.genres||[],H=ye(null),[o,B]=h(null),[Z,E]=h(!1),[ce,D]=h(!1),[z,Re]=h(!1),[p,y]=h(new Set),J=ye(null),i=d==="Continue Watching",U=T(()=>{const e=new URLSearchParams(l);return e.delete("page"),e.set("titlePreference",O),e.toString()},[l,O]),{data:q,isLoading:Te,error:We}=_e(U,f,14),{data:Y,isLoading:Ie,error:xe}=we(d,U,f,14),{data:$e}=_e(U,f+1,14),{data:Pe}=we(d,U,f+1,14),X=T(()=>(i?q?.data:Y?.data)||[],[i,q,Y]),R=T(()=>(i?q?.total:Y?.total)||0,[i,q,Y]),j=i?Te:Ie,ie=i?We:xe,oe=i?$e:Pe;fe(()=>{x(l.get("query")||""),V(l.get("sortBy")||"last_added"),$(l.get("type")||"ALL"),P(l.get("season")||"ALL"),F(l.get("year")||"ALL");const e={},a=l.get("genres")?.split(",").map(u=>u.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(u=>u.trim()).filter(Boolean)||[];a.forEach(u=>u&&(e[u]="include")),s.forEach(u=>u&&(e[u]="exclude")),G(e),I(parseInt(l.get("page")||"1"));const r=ft(d,l);J.current!==null&&J.current!==r&&y(new Set),J.current=r},[l,d]);const Fe=Se({mutationFn:async({id:e,status:a})=>{await rt.watchlist.setStatus.mutate({id:e,status:a})},onSuccess:()=>{Q.invalidateQueries({queryKey:[Ae.watchlist]}),lt.success("Status updated")}}),Ge=Se(le.continueWatching.remove.mutationOptions({onSuccess:()=>{Q.invalidateQueries(le.continueWatching.pathFilter()),Q.invalidateQueries({queryKey:[Ae.continueWatching]})}})),ee=ct(),{data:de}=it("skipRemoveConfirmation"),Me=ot(),te=T(()=>{const e=a=>a[O]||a.name||"";return[...X].sort((a,s)=>L==="name_asc"?e(a).localeCompare(e(s)):L==="name_desc"?e(s).localeCompare(e(a)):0)},[X,L,O]),ae=new Date().getFullYear(),Oe=[{value:"ALL",label:"All Years"},...Array.from({length:ae-1980+1},(e,a)=>({value:String(ae-a),label:String(ae-a)}))],m=(e=L,a=1)=>{const s=new URLSearchParams;A.trim()&&s.set("query",A.trim()),e!=="last_added"&&s.set("sortBy",e),C!=="ALL"&&s.set("type",C),N!=="ALL"&&s.set("season",N),b!=="ALL"&&s.set("year",b);const r=Object.entries(k).filter(([,_])=>_==="include").map(([_])=>_),u=Object.entries(k).filter(([,_])=>_==="exclude").map(([_])=>_);r.length>0&&s.set("genres",r.join(",")),u.length>0&&s.set("excludeGenres",u.join(",")),a>1&&s.set("page",a.toString()),w(s),a!==f&&I(a)},he=e=>{if(m(L,e),H.current){const a=H.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:a,behavior:"smooth"})}},Ee=()=>{x(""),V("last_added"),$("ALL"),P("ALL"),F("ALL"),G({}),w(new URLSearchParams),I(1)},De=e=>{G(a=>{const s=a[e],r={...a};return s==="include"?r[e]="exclude":s==="exclude"?delete r[e]:r[e]="include",r})},ue=(e,a)=>{if(i){B({id:e,name:a});return}String(de)==="true"||String(de)==="1"?ee.mutate({id:e}):B({id:e,name:a})},ze=()=>{if(o){if(o.ids){i?(Ue.mutate({ids:o.ids}),Z&&pe.mutate({ids:o.ids})):pe.mutate({ids:o.ids}),y(new Set),B(null),E(!1),D(!1);return}i?(Ge.mutate({showId:o.id}),Z&&ee.mutate({id:o.id})):ee.mutate({id:o.id}),ce&&Me.mutate({key:"skipRemoveConfirmation",value:!0}),B(null),E(!1),D(!1)}},me=()=>{B(null),E(!1),D(!1)},pe=dt(),Ue=ht(),qe=ut(),Ye=()=>{Re(e=>{const a=!e;return a||y(new Set),a})},je=e=>{y(a=>{const s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})},K=te.map(e=>e.id),ne=K.length>0&&K.every(e=>p.has(e)),Ke=()=>{y(ne?e=>St(e,K):e=>yt(e,K))},Qe=e=>{p.size!==0&&(qe.mutate({ids:[...p],status:e}),y(new Set))},Ve=()=>{p.size!==0&&B({ids:[...p]})},ge=X.length>=14&&oe&&oe.data.length>0,ve=T(()=>Math.max(1,Math.ceil(R/14)),[R]),S=[];A.trim()&&S.push({key:"query",label:`Search: ${A}`,onRemove:()=>{x(""),m()}}),C!=="ALL"&&S.push({key:"type",label:`Type: ${C}`,onRemove:()=>{$("ALL"),m()}}),N!=="ALL"&&S.push({key:"season",label:`Season: ${N}`,onRemove:()=>{P("ALL"),m()}}),b!=="ALL"&&S.push({key:"year",label:`Year: ${b}`,onRemove:()=>{F("ALL"),m()}});for(const[e,a]of Object.entries(k))S.push({key:e,label:a==="include"?`+ ${e}`:`-${e}`,tone:a==="include"?"primary":"danger",onRemove:()=>{G(s=>{const r={...s};return delete r[e],r}),m()}});return t("div",{className:"page-container",children:[t("header",{className:n.header,children:[t("h2",{className:n.title,children:"My Watchlist"}),t("p",{className:n.subtitle,children:"Track and manage your anime collection"})]}),t("div",{className:n.controls,children:[t("div",{className:n.filters,children:Ne.map(e=>t("button",{className:`${n.filterBtn} ${d===e?n.active:""}`,onClick:()=>{const a=new URLSearchParams(l);a.delete("page"),v({pathname:`/watchlist/${e}`,search:a.toString()}),I(1)},children:e},e))}),t("div",{children:t("select",{className:c.sortSelect,value:L,onChange:e=>{const a=e.currentTarget.value;V(a),m(a,f)},children:[t("option",{value:"last_added",children:"Recently Added"}),t("option",{value:"name_asc",children:"Name (A-Z)"}),t("option",{value:"name_desc",children:"Name (Z-A)"})]})})]}),t("div",{className:c.filterContainer,children:[t("div",{className:c.searchBarWrapper,children:[t("div",{className:c.inputIconWrapper,children:[t(g,{name:"search",className:c.searchIcon}),t("input",{className:c.searchInput,placeholder:"Search your watchlist by title...",value:A,onInput:e=>x(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&m()})]}),t("div",{className:c.searchActions,children:[t(W,{onClick:()=>m(),className:c.searchBtn,children:"Search"}),t("button",{className:`${c.filterToggleBtn} ${M?n.active:""}`,onClick:()=>be(!M),children:[t(g,{name:"filter",size:14}),t("span",{children:"Filters"}),M?t(g,{name:"chevron-up",size:12}):t(g,{name:"chevron-down",size:12})]})]})]}),t("div",{className:`${c.advancedFilters} ${M?c.show:""}`,children:[t("div",{className:c.filterDivider}),t("div",{className:c.filterGrid,children:[t("div",{className:c.filterItem,children:[t("label",{children:"Type"}),t("select",{value:C,onChange:e=>$(e.currentTarget.value),children:Ut.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Season"}),t("select",{value:N,onChange:e=>P(e.currentTarget.value),children:qt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Year"}),t("select",{value:b,onChange:e=>F(e.currentTarget.value),children:Oe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),re.length>0&&t("div",{className:c.genreSection,children:[t("label",{className:c.genreLabel,children:"Genres"}),t("div",{className:c.genreContainer,children:re.map(e=>t("button",{className:`${c.genreButton} ${c[k[e]||""]}`,onClick:()=>De(e),children:e},e))})]}),t("div",{className:c.filterActions,children:[t(W,{variant:"secondary",onClick:Ee,children:"Reset All"}),t(W,{onClick:()=>m(),className:c.applyBtn,children:"Apply Filters"})]})]})]}),t("div",{className:n.resultsHeader,ref:H,children:[t("h3",{className:n.resultsTitle,children:[i?"Continue Watching":d,t("span",{className:n.itemCount,children:["(",R," items)"]})]}),t("div",{className:n.headerActions,children:[t("button",{className:`${n.manageBtn} ${z?n.active:""}`,onClick:Ye,children:[t(g,{name:"pencil-alt",size:13}),t("span",{children:"Bulk Manage"})]}),R>0&&t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j})]})]}),z&&t("div",{className:n.manageBar,children:[t("button",{className:n.selectAllBtn,onClick:Ke,children:[t("span",{className:`${n.selectAllBox} ${ne?n.selectAllBoxChecked:""}`,"aria-hidden":"true"}),t("span",{children:ne?"Clear Page":"Select All"})]}),t("span",{className:n.manageCount,children:[p.size," selected"]}),t("div",{className:n.manageSpacer}),!i&&t("select",{className:n.manageStatusSelect,value:"",onChange:e=>{e.currentTarget.value&&Qe(e.currentTarget.value)},disabled:p.size===0,title:"Set status for selected items",children:[t("option",{value:"",children:"Set status…"}),Ce.map(e=>t("option",{value:e,children:e},e))]}),t("button",{className:n.manageRemoveBtn,onClick:Ve,disabled:p.size===0,children:[t(g,{name:"trash",size:13}),t("span",{children:"Remove Selected"})]})]}),j?t(pt,{}):ie?t(gt,{message:ie.message}):t(Xe,{children:[S.length>0&&t(vt,{chips:S}),t("div",{className:`${n.grid} ${Be?n.lowEnd:""}`,children:te.map(e=>{const a=p.has(e.id);return t("div",{className:`${n.itemWrapper} ${a?n.selected:""}`,children:[z&&t("div",{className:n.selectOverlay,onClick:()=>je(e.id),title:a?"Deselect":"Select",children:t("span",{className:n.selectBadge,children:a?t(g,{name:"check",size:12}):null})}),t(mt,{anime:e,continueWatching:i,onRemove:()=>ue(e.id,e.name),layout:"vertical"}),!i&&!z&&t("div",{className:n.cardActions,children:[t("select",{className:n.statusSelect,value:e.status,onChange:s=>Fe.mutate({id:e.id,status:s.currentTarget.value}),children:Ce.map(s=>t("option",{value:s,children:s},s))}),t("button",{className:n.removeBtn,onClick:()=>ue(e.id,e.name),title:"Remove from Watchlist","aria-label":"Remove from Watchlist",children:t(g,{name:"trash",size:12})})]})]},e._id)})})]}),!j&&te.length===0&&t("div",{className:n.emptyState,children:[t("h3",{className:n.emptyTitle,children:"Your watchlist is looking a bit lonely"}),t("p",{className:n.emptyText,children:d!=="All"||A||C!=="ALL"||N!=="ALL"||b!=="ALL"||Object.keys(k).length>0?"No anime match these filters. Try adjusting them to see more titles.":"Let's find something to watch!"}),t("button",{className:n.emptyBtn,onClick:()=>v("/search"),children:[t(g,{name:"search",size:14}),t("span",{children:"Browse Anime"})]})]}),R>0&&t("div",{className:n.bottomPagination,children:t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j,variant:"labeled"})}),t(se,{isOpen:!!o,onClose:me,title:i?"Reset Progress":"Remove from Watchlist",children:[t(se.Body,{children:[t("p",{children:o?.ids&&o.ids.length>1?i?`Are you sure you want to remove watch progress for ${o.ids.length} items?`:`Are you sure you want to remove ${o.ids.length} items from your watchlist?`:i?`Are you sure you want to remove your watch progress for "${o?.name}"?`:`Are you sure you want to remove "${o?.name}" from your watchlist?`}),i&&t("label",{children:[t("input",{type:"checkbox",checked:Z,onChange:e=>E(e.currentTarget.checked)}),"Also remove from my watchlist"]}),!i&&!(o?.ids&&o.ids.length>1)&&t("label",{children:[t("input",{type:"checkbox",checked:ce,onChange:e=>D(e.currentTarget.checked)}),"Remember my choice"]})]}),t(se.Actions,{children:[t(W,{variant:"secondary",onClick:me,children:"No"}),t(W,{variant:"danger",onClick:ze,children:"Yes"})]})]})]})};export{ca as default};
|
|
1
|
+
import{h as fe,o as He,a as Ze,p as Je,d as h,A as ye,T,u as t,S as Xe}from"./vendor-core-DfaOB3Rn.js";import{u as et,a as Se}from"./vendor-query-BBT5_sHx.js";import{o as tt,u as at,d as nt,G as st,H as _e,I as we,q as Ae,J as lt,t as rt,w as ct,K as it,L as ot,N as dt,O as ht,P as ut,B as W,Q as se}from"./index-npJ4Ahxa.js";import{I as g}from"./vendor-icons-DrybRNxP.js";import{A as mt}from"./AnimeCard-DWKuN1cB.js";import{S as pt}from"./SkeletonGrid-CmHR4_Fc.js";import{E as gt}from"./ErrorMessage-DAxegITP.js";import{P as Le}from"./MediaCard-CXZJ8wr7.js";import{s as n}from"./LibraryListPage.module-r6k9nyT9.js";import{A as vt}from"./ActiveFilterChips-olGfwxle.js";import"./useAnimeInfoData-DrWgr6PK.js";import"./QueueOptionsButton-BdAz_Gn-.js";import"./vendor-ui-3qrARCPr.js";import"./playbackCompletion-DB_c1lex.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BrKd4CBZ.js";const ft=(d,v)=>{const l=new URLSearchParams(v);return l.delete("page"),l.sort(),`${d}|${l.toString()}`},yt=(d,v)=>{const l=new Set(d);return v.forEach(w=>l.add(w)),l},St=(d,v)=>{const l=new Set(d);return v.forEach(w=>l.delete(w)),l},_t="_sortSelect_cahhw_1",wt="_filterContainer_cahhw_30",At="_slideUpIn_cahhw_1",Lt="_searchBarWrapper_cahhw_44",Ct="_inputIconWrapper_cahhw_50",Nt="_searchIcon_cahhw_55",bt="_searchInput_cahhw_64",Bt="_searchActions_cahhw_84",kt="_searchBtn_cahhw_89",Rt="_filterToggleBtn_cahhw_94",Tt="_advancedFilters_cahhw_115",Wt="_show_cahhw_122",It="_filterDivider_cahhw_128",xt="_filterGrid_cahhw_134",Pt="_filterItem_cahhw_141",$t="_genreSection_cahhw_183",Ft="_genreLabel_cahhw_189",Gt="_genreContainer_cahhw_199",Ot="_genreButton_cahhw_205",Mt="_include_cahhw_222",Et="_exclude_cahhw_228",Dt="_filterActions_cahhw_235",zt="_applyBtn_cahhw_246",c={sortSelect:_t,filterContainer:wt,slideUpIn:At,searchBarWrapper:Lt,inputIconWrapper:Ct,searchIcon:Nt,searchInput:bt,searchActions:Bt,searchBtn:kt,filterToggleBtn:Rt,advancedFilters:Tt,show:Wt,filterDivider:It,filterGrid:xt,filterItem:Pt,genreSection:$t,genreLabel:Ft,genreContainer:Gt,genreButton:Ot,include:Mt,exclude:Et,filterActions:Dt,applyBtn:zt},Ne=["All","Continue Watching","Watching","Completed","On-Hold","Dropped","Planned"],Ce=Ne.slice(2),Ut=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Adult (18+)"}],qt=[{value:"ALL",label:"All Seasons"},{value:"WINTER",label:"Winter"},{value:"SPRING",label:"Spring"},{value:"SUMMER",label:"Summer"},{value:"FALL",label:"Fall"}],ca=()=>{fe(()=>{document.title="Watchlist - dango"},[]);const{filter:d="All"}=He(),v=Ze(),[l,w]=Je(),Q=et(),le=tt(),[f,I]=h(parseInt(l.get("page")||"1")),[A,x]=h(l.get("query")||""),[L,V]=h(l.get("sortBy")||"last_added"),[C,P]=h(l.get("type")||"ALL"),[N,$]=h(l.get("season")||"ALL"),[b,F]=h(l.get("year")||"ALL"),[k,G]=h(()=>{const e={},a=l.get("genres")?.split(",").map(r=>r.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(r=>r.trim()).filter(Boolean)||[];return a.forEach(r=>r&&(e[r]="include")),s.forEach(r=>r&&(e[r]="exclude")),e}),[O,be]=h(()=>["type","season","year","genres","excludeGenres"].some(e=>l.has(e))),{lowEndMode:Be}=at(),{titlePreference:M}=nt(),{data:ke}=st(),re=ke?.genres||[],H=ye(null),[o,B]=h(null),[Z,E]=h(!1),[ce,D]=h(!1),[z,Re]=h(!1),[p,y]=h(new Set),J=ye(null),i=d==="Continue Watching",U=T(()=>{const e=new URLSearchParams(l);return e.delete("page"),e.set("titlePreference",M),e.toString()},[l,M]),{data:q,isLoading:Te,error:We}=_e(U,f,14),{data:Y,isLoading:Ie,error:xe}=we(d,U,f,14),{data:Pe}=_e(U,f+1,14),{data:$e}=we(d,U,f+1,14),X=T(()=>(i?q?.data:Y?.data)||[],[i,q,Y]),R=T(()=>(i?q?.total:Y?.total)||0,[i,q,Y]),j=i?Te:Ie,ie=i?We:xe,oe=i?Pe:$e;fe(()=>{x(l.get("query")||""),V(l.get("sortBy")||"last_added"),P(l.get("type")||"ALL"),$(l.get("season")||"ALL"),F(l.get("year")||"ALL");const e={},a=l.get("genres")?.split(",").map(u=>u.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(u=>u.trim()).filter(Boolean)||[];a.forEach(u=>u&&(e[u]="include")),s.forEach(u=>u&&(e[u]="exclude")),G(e),I(parseInt(l.get("page")||"1"));const r=ft(d,l);J.current!==null&&J.current!==r&&y(new Set),J.current=r},[l,d]);const Fe=Se({mutationFn:async({id:e,status:a})=>{await rt.watchlist.setStatus.mutate({id:e,status:a})},onSuccess:()=>{Q.invalidateQueries({queryKey:[Ae.watchlist]}),lt.success("Status updated")}}),Ge=Se(le.continueWatching.remove.mutationOptions({onSuccess:()=>{Q.invalidateQueries(le.continueWatching.pathFilter()),Q.invalidateQueries({queryKey:[Ae.continueWatching]})}})),ee=ct(),{data:de}=it("skipRemoveConfirmation"),Oe=ot(),te=T(()=>{const e=a=>a[M]||a.name||"";return[...X].sort((a,s)=>L==="name_asc"?e(a).localeCompare(e(s)):L==="name_desc"?e(s).localeCompare(e(a)):0)},[X,L,M]),ae=new Date().getFullYear(),Me=[{value:"ALL",label:"All Years"},...Array.from({length:ae-1980+1},(e,a)=>({value:String(ae-a),label:String(ae-a)}))],m=(e=L,a=1)=>{const s=new URLSearchParams;A.trim()&&s.set("query",A.trim()),e!=="last_added"&&s.set("sortBy",e),C!=="ALL"&&s.set("type",C),N!=="ALL"&&s.set("season",N),b!=="ALL"&&s.set("year",b);const r=Object.entries(k).filter(([,_])=>_==="include").map(([_])=>_),u=Object.entries(k).filter(([,_])=>_==="exclude").map(([_])=>_);r.length>0&&s.set("genres",r.join(",")),u.length>0&&s.set("excludeGenres",u.join(",")),a>1&&s.set("page",a.toString()),w(s),a!==f&&I(a)},he=e=>{if(m(L,e),H.current){const a=H.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:a,behavior:"smooth"})}},Ee=()=>{x(""),V("last_added"),P("ALL"),$("ALL"),F("ALL"),G({}),w(new URLSearchParams),I(1)},De=e=>{G(a=>{const s=a[e],r={...a};return s==="include"?r[e]="exclude":s==="exclude"?delete r[e]:r[e]="include",r})},ue=(e,a)=>{if(i){B({id:e,name:a});return}String(de)==="true"||String(de)==="1"?ee.mutate({id:e}):B({id:e,name:a})},ze=()=>{if(o){if(o.ids){i?(Ue.mutate({ids:o.ids}),Z&&pe.mutate({ids:o.ids})):pe.mutate({ids:o.ids}),y(new Set),B(null),E(!1),D(!1);return}i?(Ge.mutate({showId:o.id}),Z&&ee.mutate({id:o.id})):ee.mutate({id:o.id}),ce&&Oe.mutate({key:"skipRemoveConfirmation",value:!0}),B(null),E(!1),D(!1)}},me=()=>{B(null),E(!1),D(!1)},pe=dt(),Ue=ht(),qe=ut(),Ye=()=>{Re(e=>{const a=!e;return a||y(new Set),a})},je=e=>{y(a=>{const s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})},K=te.map(e=>e.id),ne=K.length>0&&K.every(e=>p.has(e)),Ke=()=>{y(ne?e=>St(e,K):e=>yt(e,K))},Qe=e=>{p.size!==0&&(qe.mutate({ids:[...p],status:e}),y(new Set))},Ve=()=>{p.size!==0&&B({ids:[...p]})},ge=X.length>=14&&oe&&oe.data.length>0,ve=T(()=>Math.max(1,Math.ceil(R/14)),[R]),S=[];A.trim()&&S.push({key:"query",label:`Search: ${A}`,onRemove:()=>{x(""),m()}}),C!=="ALL"&&S.push({key:"type",label:`Type: ${C}`,onRemove:()=>{P("ALL"),m()}}),N!=="ALL"&&S.push({key:"season",label:`Season: ${N}`,onRemove:()=>{$("ALL"),m()}}),b!=="ALL"&&S.push({key:"year",label:`Year: ${b}`,onRemove:()=>{F("ALL"),m()}});for(const[e,a]of Object.entries(k))S.push({key:e,label:a==="include"?`+ ${e}`:`-${e}`,tone:a==="include"?"primary":"danger",onRemove:()=>{G(s=>{const r={...s};return delete r[e],r}),m()}});return t("div",{className:"page-container",children:[t("header",{className:n.header,children:[t("h2",{className:n.title,children:"My Watchlist"}),t("p",{className:n.subtitle,children:"Track and manage your anime collection"})]}),t("div",{className:n.controls,children:[t("div",{className:n.filters,children:Ne.map(e=>t("button",{className:`${n.filterBtn} ${d===e?n.active:""}`,onClick:()=>{const a=new URLSearchParams(l);a.delete("page"),v({pathname:`/watchlist/${e}`,search:a.toString()}),I(1)},children:e},e))}),t("div",{children:t("select",{className:c.sortSelect,value:L,onChange:e=>{const a=e.currentTarget.value;V(a),m(a,f)},children:[t("option",{value:"last_added",children:"Recently Added"}),t("option",{value:"name_asc",children:"Name (A-Z)"}),t("option",{value:"name_desc",children:"Name (Z-A)"})]})})]}),t("div",{className:c.filterContainer,children:[t("div",{className:c.searchBarWrapper,children:[t("div",{className:c.inputIconWrapper,children:[t(g,{name:"search",className:c.searchIcon}),t("input",{className:c.searchInput,placeholder:"Search your watchlist by title...",value:A,onInput:e=>x(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&m()})]}),t("div",{className:c.searchActions,children:[t(W,{onClick:()=>m(),className:c.searchBtn,children:"Search"}),t("button",{className:`${c.filterToggleBtn} ${O?n.active:""}`,onClick:()=>be(!O),children:[t(g,{name:"filter",size:14}),t("span",{children:"Filters"}),O?t(g,{name:"chevron-up",size:12}):t(g,{name:"chevron-down",size:12})]})]})]}),t("div",{className:`${c.advancedFilters} ${O?c.show:""}`,children:[t("div",{className:c.filterDivider}),t("div",{className:c.filterGrid,children:[t("div",{className:c.filterItem,children:[t("label",{children:"Type"}),t("select",{value:C,onChange:e=>P(e.currentTarget.value),children:Ut.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Season"}),t("select",{value:N,onChange:e=>$(e.currentTarget.value),children:qt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Year"}),t("select",{value:b,onChange:e=>F(e.currentTarget.value),children:Me.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),re.length>0&&t("div",{className:c.genreSection,children:[t("label",{className:c.genreLabel,children:"Genres"}),t("div",{className:c.genreContainer,children:re.map(e=>t("button",{className:`${c.genreButton} ${c[k[e]||""]}`,onClick:()=>De(e),children:e},e))})]}),t("div",{className:c.filterActions,children:[t(W,{variant:"secondary",onClick:Ee,children:"Reset All"}),t(W,{onClick:()=>m(),className:c.applyBtn,children:"Apply Filters"})]})]})]}),t("div",{className:n.resultsHeader,ref:H,children:[t("h3",{className:n.resultsTitle,children:[i?"Continue Watching":d,t("span",{className:n.itemCount,children:["(",R," items)"]})]}),t("div",{className:n.headerActions,children:[t("button",{className:`${n.manageBtn} ${z?n.active:""}`,onClick:Ye,children:[t(g,{name:"pencil-alt",size:13}),t("span",{children:"Bulk Manage"})]}),R>0&&t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j})]})]}),z&&t("div",{className:n.manageBar,children:[t("button",{className:n.selectAllBtn,onClick:Ke,children:[t("span",{className:`${n.selectAllBox} ${ne?n.selectAllBoxChecked:""}`,"aria-hidden":"true"}),t("span",{children:ne?"Clear Page":"Select All"})]}),t("span",{className:n.manageCount,children:[p.size," selected"]}),t("div",{className:n.manageSpacer}),!i&&t("select",{className:n.manageStatusSelect,value:"",onChange:e=>{e.currentTarget.value&&Qe(e.currentTarget.value)},disabled:p.size===0,title:"Set status for selected items",children:[t("option",{value:"",children:"Set status…"}),Ce.map(e=>t("option",{value:e,children:e},e))]}),t("button",{className:n.manageRemoveBtn,onClick:Ve,disabled:p.size===0,children:[t(g,{name:"trash",size:13}),t("span",{children:"Remove Selected"})]})]}),j?t(pt,{}):ie?t(gt,{message:ie.message}):t(Xe,{children:[S.length>0&&t(vt,{chips:S}),t("div",{className:`${n.grid} ${Be?n.lowEnd:""}`,children:te.map(e=>{const a=p.has(e.id);return t("div",{className:`${n.itemWrapper} ${a?n.selected:""}`,children:[z&&t("div",{className:n.selectOverlay,onClick:()=>je(e.id),title:a?"Deselect":"Select",children:t("span",{className:n.selectBadge,children:a?t(g,{name:"check",size:12}):null})}),t(mt,{anime:e,continueWatching:i,onRemove:()=>ue(e.id,e.name),layout:"vertical"}),!i&&!z&&t("div",{className:n.cardActions,children:[t("select",{className:n.statusSelect,value:e.status,onChange:s=>Fe.mutate({id:e.id,status:s.currentTarget.value}),children:Ce.map(s=>t("option",{value:s,children:s},s))}),t("button",{className:n.removeBtn,onClick:()=>ue(e.id,e.name),title:"Remove from Watchlist","aria-label":"Remove from Watchlist",children:t(g,{name:"trash",size:12})})]})]},e._id)})})]}),!j&&te.length===0&&t("div",{className:n.emptyState,children:[t("h3",{className:n.emptyTitle,children:"Your watchlist is looking a bit lonely"}),t("p",{className:n.emptyText,children:d!=="All"||A||C!=="ALL"||N!=="ALL"||b!=="ALL"||Object.keys(k).length>0?"No anime match these filters. Try adjusting them to see more titles.":"Let's find something to watch!"}),t("button",{className:n.emptyBtn,onClick:()=>v("/search"),children:[t(g,{name:"search",size:14}),t("span",{children:"Browse Anime"})]})]}),R>0&&t("div",{className:n.bottomPagination,children:t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j,variant:"labeled"})}),t(se,{isOpen:!!o,onClose:me,title:i?"Reset Progress":"Remove from Watchlist",children:[t(se.Body,{children:[t("p",{children:o?.ids&&o.ids.length>1?i?`Are you sure you want to remove watch progress for ${o.ids.length} items?`:`Are you sure you want to remove ${o.ids.length} items from your watchlist?`:i?`Are you sure you want to remove your watch progress for "${o?.name}"?`:`Are you sure you want to remove "${o?.name}" from your watchlist?`}),i&&t("label",{children:[t("input",{type:"checkbox",checked:Z,onChange:e=>E(e.currentTarget.checked)}),"Also remove from my watchlist"]}),!i&&!(o?.ids&&o.ids.length>1)&&t("label",{children:[t("input",{type:"checkbox",checked:ce,onChange:e=>D(e.currentTarget.checked)}),"Remember my choice"]})]}),t(se.Actions,{children:[t(W,{variant:"secondary",onClick:me,children:"No"}),t(W,{variant:"danger",onClick:ze,children:"Yes"})]})]})]})};export{ca as default};
|