@serifpersia/dango 3.6.1 → 3.6.2
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-DbrG4Bo-.js → AnimeCard-KCdQSFYo.js} +1 -1
- package/client/dist/assets/{AnimeInfo-CgSQGjef.js → AnimeInfo-CWppMyrH.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-DSybdvf_.js → AnimeInfoPage-CfYONEFT.js} +2 -2
- package/client/dist/assets/{Asmr-DFFV-7y4.js → Asmr-CbkxcXne.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-Brdfu_22.js → AsmrResetProgressModal-CjPrSioI.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-DBBUzoHn.js → AvSyncCalibrator-XNJmMFmH.js} +1 -1
- package/client/dist/assets/{Home-DjGl-3os.js → Home-BTkitKD6.js} +1 -1
- package/client/dist/assets/{Insights-4O52Z1t2.js → Insights-_LB6kp3M.js} +1 -1
- package/client/dist/assets/{LibraryListPage-Z0w_rmHP.js → LibraryListPage-4BBrV2Ne.js} +1 -1
- package/client/dist/assets/{ListeningList-DjbzDs1E.js → ListeningList-BlAwt-LT.js} +1 -1
- package/client/dist/assets/{Manga-BRIDluzF.js → Manga-BtLdEUi5.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-Q4CjEGJH.js → MangaInfoPage-CQr6_pSH.js} +1 -1
- package/client/dist/assets/{MangaReadPage-BbJK5FY6.js → MangaReadPage-DUHUub1H.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-BCFPXDF6.js → MangaResetProgressModal-CnP9RIzg.js} +1 -1
- package/client/dist/assets/{Mature-DjQzs66p.js → Mature-Dv8i7W02.js} +1 -1
- package/client/dist/assets/{MediaCard-DedwE5DX.js → MediaCard-tBWyjKaV.js} +1 -1
- package/client/dist/assets/{Music-z2RkiMDf.js → Music-kBqpbxdz.js} +1 -1
- package/client/dist/assets/{OptionListMenu-CetjZizt.js → OptionListMenu-BiiWXfEL.js} +1 -1
- package/client/dist/assets/{Player-DD-9SgWU.js → Player-CXReluOl.js} +2 -2
- package/client/dist/assets/{PlayerSettings-ne_DQSTl.js → PlayerSettings-uFwbD3Z7.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-CIKT4YcD.js → QueueOptionsButton-BN-6sbNV.js} +1 -1
- package/client/dist/assets/{QueueRail-DPclldS0.js → QueueRail-BYyC_xPZ.js} +1 -1
- package/client/dist/assets/{Radio-aeqPTMht.js → Radio-DN66fPmx.js} +1 -1
- package/client/dist/assets/{ReadingList-p6G7NHtC.js → ReadingList-6z-6l85T.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-B7UuuL3X.js → ResetProgressModal-CZieLUpX.js} +1 -1
- package/client/dist/assets/{Search-BzyHVByR.js → Search-aO0P-vef.js} +1 -1
- package/client/dist/assets/{Settings-DMmtLUsL.js → Settings-CYeDIeBU.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-B5JXhZO4.js → SkeletonGrid-DJKwfPjg.js} +1 -1
- package/client/dist/assets/{Trackers-tLL1afjB.js → Trackers-CLJvFNWX.js} +1 -1
- package/client/dist/assets/Tv-B-TnGO82.js +4 -0
- package/client/dist/assets/{TvInfo-DmrBLjgK.js → TvInfo-Y7k3LY78.js} +1 -1
- package/client/dist/assets/{TvPopup-D1mSlOZt.js → TvPopup-CM8RMOwX.js} +1 -1
- package/client/dist/assets/{TvSearch-BGQRUq9E.js → TvSearch-Bn-OsC1u.js} +1 -1
- package/client/dist/assets/{TvWatchlist-DdLkpeQT.js → TvWatchlist-PyOWvixK.js} +1 -1
- package/client/dist/assets/{Watchlist-BObmM6QB.js → Watchlist-CCmzjnDR.js} +1 -1
- package/client/dist/assets/{hls-qCuNYJym.js → hls-Dn7_lAv2.js} +1 -1
- package/client/dist/assets/{index-B4AdKbhW.js → index-VzVAYX5A.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-CSnwUBuU.js → useAnimeInfoData-BpD2dXLB.js} +1 -1
- package/client/dist/assets/{useAsmr-BKAaWEXn.js → useAsmr-Dm1-a4VV.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-DDLRBLzz.js → useAsmrPopup-2SWfvbnM.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-C6XEMuSr.js → useMangaLibrary-RpiA2f_k.js} +1 -1
- package/client/dist/assets/{useMangaPopup-wfCJubPD.js → useMangaPopup-Dcfgv2CZ.js} +1 -1
- package/client/dist/assets/{useProviders-C7jrBgxf.js → useProviders-vzvT6VhD.js} +1 -1
- package/client/dist/assets/{useTv-DM5KtzEc.js → useTv-DrhnOiw6.js} +1 -1
- package/client/dist/assets/{useTvLibrary-73NkS_5R.js → useTvLibrary-DDReryyQ.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/package.json +1 -1
- package/client/dist/assets/Tv-CluLN4KA.js +0 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as t,h as Re,g as Be,A as De,q as Fe,u as e,S as d}from"./vendor-core-DfaOB3Rn.js";import{u as qe,b as $e,a as I}from"./vendor-query-BBT5_sHx.js";import{z as i,t as h,W as nn,j as an,B as le}from"./index-
|
|
1
|
+
import{d as t,h as Re,g as Be,A as De,q as Fe,u as e,S as d}from"./vendor-core-DfaOB3Rn.js";import{u as qe,b as $e,a as I}from"./vendor-query-BBT5_sHx.js";import{z as i,t as h,W as nn,j as an,B as le}from"./index-VzVAYX5A.js";import{I as l}from"./vendor-icons-DrybRNxP.js";function tn(){const K=qe(),[Y,k]=t(!1);return Re(()=>{const s=new URLSearchParams(window.location.search),b=s.get("anilist");if(b){const m=s.get("user"),_=s.get("reason");window.history.replaceState(null,"",window.location.pathname),b==="success"?(i.success(m?`Connected to AniList as ${decodeURIComponent(m)}`:"Connected to AniList"),K.invalidateQueries({queryKey:["trackerStatus"]})):i.error(_?decodeURIComponent(_):"AniList authentication failed");return}const j=new URLSearchParams(window.location.hash.substring(1)),y=j.get("access_token"),x=s.get("code");if(!y&&!x){const m=j.get("error");m&&(i.error(`AniList error: ${m}`),window.history.replaceState(null,"",window.location.pathname));return}const g=window.location.origin+window.location.pathname;window.history.replaceState(null,"",window.location.pathname),k(!0),i("Connecting to AniList..."),h.tracker.anilistAuth.mutate(y?{token:y}:{code:x,redirectUri:g}).then(async m=>{const _=m.user;i.success(`Connected to AniList as ${_?.name??"AniList user"}`),K.invalidateQueries({queryKey:["trackerStatus"]})}).catch(m=>{i.error(m instanceof Error?m.message:"Failed to authenticate with AniList")}).finally(()=>{k(!1)})},[K]),Y}const sn="_header_j1lbh_1",rn="_fadeIn_j1lbh_1",ln="_pageTitle_j1lbh_6",cn="_pageSubtitle_j1lbh_14",on="_importCard_j1lbh_20",dn="_slideUpIn_j1lbh_1",mn="_cardHeader_j1lbh_37",pn="_uploadArea_j1lbh_55",hn="_fileInputWrapper_j1lbh_59",un="_fileInput_j1lbh_59",gn="_fileDisplay_j1lbh_87",yn="_fileIcon_j1lbh_95",bn="_fileName_j1lbh_100",_n="_browseButton_j1lbh_109",fn="_optionsArea_j1lbh_120",Nn="_checkboxLabel_j1lbh_128",kn="_checkbox_j1lbh_128",vn="_checkboxCustom_j1lbh_141",wn="_optionText_j1lbh_169",In="_optionTitle_j1lbh_175",xn="_optionDesc_j1lbh_181",Mn="_actions_j1lbh_187",Cn="_importBtn_j1lbh_195",Ln="_cancelBtn_j1lbh_201",Sn="_statusMessage_j1lbh_215",Tn="_success_j1lbh_225",An="_error_j1lbh_231",jn="_progressSection_j1lbh_237",Pn="_progressBar_j1lbh_242",En="_progressFill_j1lbh_250",Bn="_progressInfo_j1lbh_257",Dn="_progressCount_j1lbh_264",Fn="_progressTitle_j1lbh_271",$n="_sourceBadge_j1lbh_289",Un="_anilist_j1lbh_301",Rn="_kitsu_j1lbh_307",qn="_offline_j1lbh_313",Kn="_skipped_j1lbh_319",On="_cardTitleRow_j1lbh_324",Qn="_anilistIcon_j1lbh_334",Gn="_malIcon_j1lbh_340",Hn="_badgeOnline_j1lbh_346",Wn="_badgeOffline_j1lbh_358",zn="_connectedProfile_j1lbh_370",Xn="_avatar_j1lbh_379",Jn="_connectedInfo_j1lbh_386",Yn="_connectedName_j1lbh_394",Vn="_connectedHint_j1lbh_400",Zn="_loginPrompt_j1lbh_405",ea="_loginSection_j1lbh_413",na="_fieldLabel_j1lbh_419",aa="_helpText_j1lbh_438",ta="_loginText_j1lbh_455",sa="_primaryBtn_j1lbh_464",ia="_secondaryBtn_j1lbh_465",ra="_syncBtn_j1lbh_466",la="_divider_j1lbh_518",ca="_actionSection_j1lbh_524",oa="_inputGroup_j1lbh_538",da="_input_j1lbh_538",ma="_syncSummary_j1lbh_559",pa="_syncErrors_j1lbh_565",ha="_spin_j1lbh_569",ua="_radioGroup_j1lbh_598",ga="_radioLabel_j1lbh_604",ya="_syncHint_j1lbh_642",ba="_importLoading_j1lbh_649",n={header:sn,fadeIn:rn,pageTitle:ln,pageSubtitle:cn,importCard:on,slideUpIn:dn,cardHeader:mn,uploadArea:pn,fileInputWrapper:hn,fileInput:un,fileDisplay:gn,fileIcon:yn,fileName:bn,browseButton:_n,optionsArea:fn,checkboxLabel:Nn,checkbox:kn,checkboxCustom:vn,optionText:wn,optionTitle:In,optionDesc:xn,actions:Mn,importBtn:Cn,cancelBtn:Ln,statusMessage:Sn,success:Tn,error:An,progressSection:jn,progressBar:Pn,progressFill:En,progressInfo:Bn,progressCount:Dn,progressTitle:Fn,sourceBadge:$n,anilist:Un,kitsu:Rn,offline:qn,skipped:Kn,cardTitleRow:On,anilistIcon:Qn,malIcon:Gn,badgeOnline:Hn,badgeOffline:Wn,connectedProfile:zn,avatar:Xn,connectedInfo:Jn,connectedName:Yn,connectedHint:Vn,loginPrompt:Zn,loginSection:ea,fieldLabel:na,helpText:aa,loginText:ta,primaryBtn:sa,secondaryBtn:ia,syncBtn:ra,divider:la,actionSection:ca,inputGroup:oa,input:da,syncSummary:ma,syncErrors:pa,spin:ha,radioGroup:ua,radioLabel:ga,syncHint:ya,importLoading:ba},ce="tracker_anilist_client_id",Ue="49887".trim(),va=()=>{const{setIsOpen:K}=nn(),{contentType:Y}=an(),k=Y==="manga",s=qe();Be.useEffect(()=>{document.title="Trackers - dango"},[]);const[b,j]=t(""),[y,x]=t("username"),[g,m]=t(null),[_,oe]=t(""),[M,de]=t(!1),Ke=tn(),{data:me,isLoading:pe}=$e({queryKey:["trackerStatus"],queryFn:async()=>await h.tracker.status.query()}),{data:C}=$e({queryKey:["anilistClientId"],queryFn:async()=>(await h.settings.getByKey.query({key:ce})).value||""}),he=De(!1);Be.useEffect(()=>{he.current||C!==void 0&&(C&&oe(C),he.current=!0)},[C]);const v=me?.anilist?.connected??!1;Re(()=>{v&&x("sync")},[v]);const O=me?.anilist?.user??null,V=!!Ue,Oe=(C||"").trim(),Qe=async()=>{const a=_.trim(),r=a||Ue;if(!r){i.error("Enter your AniList client ID first");return}const N=async(A,se)=>{await h.settings.set.mutate({key:A,value:se})};try{a?a!==C&&await N(ce,a):V&&Oe&&await N(ce,""),s.invalidateQueries({queryKey:["anilistClientId"]})}catch(A){i.error(A.message);return}const c=window.location.origin+window.location.pathname,U=encodeURIComponent(c);window.location.href=`https://anilist.co/api/v2/oauth/authorize?client_id=${encodeURIComponent(r)}&response_type=token&state=${U}`},ue=I({mutationFn:async()=>h.tracker.anilistDisconnect.mutate(),onSuccess:()=>{s.invalidateQueries({queryKey:["trackerStatus"]}),i.success("Disconnected from AniList")},onError:a=>i.error(a.message)}),Q=I({mutationFn:async()=>(await h.tracker.sync.mutate({provider:"anilist"})).summary,onSuccess:a=>{s.invalidateQueries({queryKey:["watchlist"]}),s.invalidateQueries({queryKey:["allContinueWatching"]}),m(a),i.success(`Sync complete — pushed ${a.pushed}, pulled ${a.pulled}, merged ${a.merged}, unchanged ${a.unchanged}`,{duration:6e3})},onError:a=>i.error(a.message)}),[P,ge]=t(""),[G,ye]=t("sync"),[Z,be]=t("two-way"),[o,Ge]=t(null),H=I({mutationFn:async()=>(await h.tracker.mangaSync.mutate({direction:Z})).summary,onSuccess:a=>{s.invalidateQueries({queryKey:["manga-library"]}),s.invalidateQueries({queryKey:["manga-continue-reading"]}),Ge(a);const r=(a.warnings?.length??0)>0?`, ${a.warnings.length} warning(s)`:"";i.success(`Manga sync complete — pushed ${a.pushed}, pulled ${a.pulled}, merged ${a.merged}, unchanged ${a.unchanged}${r}`,{duration:6e3})},onError:a=>i.error(a.message)}),L=I({mutationFn:async()=>{if(!P.trim())throw new Error("Please enter a username");return(await h.tracker.mangaImport.mutate({username:P.trim(),erase:M})).count},onSuccess:a=>{s.invalidateQueries({queryKey:["manga-library"]}),s.invalidateQueries({queryKey:["manga-continue-reading"]}),i.success(`Imported ${a} manga entries from AniList`),ge("")},onError:a=>i.error(a.message)}),[E,_e]=t(""),[W,fe]=t("username"),[ee,Ne]=t(null),[z,ke]=t(!1),[ve,ne]=t(""),[we,He]=t(""),f=I({mutationFn:async()=>{if(!E.trim())throw new Error("Please enter a MAL username");const a=await h.tracker.mangaMalImport.mutate({username:E.trim(),erase:M});return{imported:a.imported??0,skipped:a.skipped??0}},onSuccess:({imported:a,skipped:r})=>{s.invalidateQueries({queryKey:["manga-library"]}),s.invalidateQueries({queryKey:["manga-continue-reading"]}),i.success(`Imported ${a} manga entries from MAL${r>0?`, skipped ${r}`:""}`),_e("")},onError:a=>i.error(a.message)}),We=Fe(async()=>{const a=document.getElementById("malMangaFile");if(!a.files||a.files.length===0){ne("Please select a file first.");return}ke(!0),ne(""),Ne(null);try{const r=new FormData;r.append("xmlfile",a.files[0]),r.append("erase",String(M));const N=await fetch("/api/import/mal-xml-manga",{method:"POST",body:r}),c=await N.json().catch(()=>({}));if(!N.ok)throw new Error(c.error||"Import failed");Ne({imported:c.imported??0,skipped:c.skipped??0}),s.invalidateQueries({queryKey:["manga-library"]}),s.invalidateQueries({queryKey:["manga-continue-reading"]})}catch(r){ne(r.message)}finally{ke(!1)}},[M,s]),S=I({mutationFn:async()=>{if(!b.trim())throw new Error("Please enter a username");return(await h.tracker.anilistImport.mutate({username:b.trim(),erase:w})).count},onSuccess:a=>{s.invalidateQueries({queryKey:["watchlist"]}),s.invalidateQueries({queryKey:["allContinueWatching"]}),i.success(`Imported ${a} anime entries from AniList`),j("")},onError:a=>i.error(a.message)}),[B,Ie]=t(""),u=I({mutationFn:async a=>{if(!B.trim())throw new Error("Please enter a MAL username");return(await h.tracker.malImport.mutate({username:B.trim(),erase:a.erase,useOfflineDb:a.useOfflineDb,skipFallback:a.skipFallback})).count},onSuccess:a=>{s.invalidateQueries({queryKey:["watchlist"]}),s.invalidateQueries({queryKey:["allContinueWatching"]}),i.success(`Imported ${a} anime entries from MAL`),Ie("")},onError:a=>i.error(a.message)}),[w,xe]=t(!1),[D,ze]=t(!0),[F,Xe]=t(!1),[Me,Ce]=t(""),[T,Le]=t(!1),[p,Se]=t(null),[ae,Te]=t(null),[Ae,X]=t(""),te=De(null),Je=a=>{a.target.files&&a.target.files.length>0?Ce(a.target.files[0].name):Ce("")},Ye=Fe(async()=>{const a=document.getElementById("malFile");if(!a.files||a.files.length===0){X("Please select a file first.");return}const r=a.files[0];Le(!0),Se(null),Te(null),X("");const N=new AbortController;te.current=N;try{const c=new FormData;c.append("xmlfile",r),c.append("erase",String(w)),c.append("useOfflineDb",String(D)),c.append("skipFallback",String(F));const U=await fetch("/api/import/mal-xml",{method:"POST",body:c,signal:N.signal});if(!U.ok){const re=await U.text();let R="Failed to import";try{R=JSON.parse(re).error||R}catch{}throw new Error(R)}const A=U.body?.getReader();if(!A)throw new Error("No response stream");const se=new TextDecoder;let ie="",J="";for(;;){const{done:re,value:R}=await A.read();if(re)break;ie+=se.decode(R,{stream:!0});const Pe=ie.split(`
|
|
2
2
|
`);ie=Pe.pop()||"";for(const q of Pe)if(q.startsWith("event: "))J=q.slice(7).trim();else if(q.startsWith("data: ")){const en=q.slice(6);try{const Ee=JSON.parse(en);J==="progress"?Se(Ee):J==="complete"&&Te(Ee)}catch{}}else q===""&&(J="")}s.invalidateQueries({queryKey:["watchlist"]})}catch(c){c instanceof DOMException&&c.name==="AbortError"?X("Import cancelled."):X(c.message)}finally{Le(!1),te.current=null}},[w,D,F,s]),Ve=()=>{te.current?.abort(),h.settings.malImportCancel.mutate().catch(()=>{})},Ze=p?Math.round(p.current/p.total*100):0,[$,je]=t("username");return e("div",{className:"page-container",children:[e("div",{className:n.header,children:[e("h1",{className:n.pageTitle,children:"Trackers"}),e("p",{className:n.pageSubtitle,children:"Import & sync your anime watchlists and manga reading lists with tracking services"})]}),e("div",{style:{marginBottom:"16px",padding:"10px 14px",borderRadius:"8px",fontSize:"0.85rem",background:"color-mix(in srgb, var(--color-warning) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--color-warning) 25%, transparent)",color:"var(--text-secondary)"},children:"⚠ Syncing writes directly to your AniList entries, and dango may not always handle anime/manga lists correctly — always keep a backup of your lists before syncing."}),!k&&e(d,{children:e("div",{className:n.importCard,children:[e("div",{className:n.cardHeader,children:e("div",{className:n.cardTitleRow,children:[e(l,{name:"anilist",className:n.anilistIcon}),e("h3",{children:"AniList"}),pe?null:v?e("span",{className:n.badgeOnline,children:"Connected"}):e("span",{className:n.badgeOffline,children:"Not connected"})]})}),v&&O?e("div",{className:n.connectedProfile,children:[O.avatar&&e("img",{src:O.avatar,alt:"Avatar",className:n.avatar,loading:"lazy",decoding:"async"}),e("div",{className:n.connectedInfo,children:[e("span",{className:n.connectedName,children:O.name}),e("span",{className:n.connectedHint,children:"2-way sync is ready"})]}),e("button",{className:n.secondaryBtn,onClick:()=>ue.mutate(),disabled:ue.isPending,children:[e(l,{name:"sign-out-alt"})," Disconnect"]})]}):e("div",{className:n.loginSection,children:[e("p",{className:n.loginText,children:["Log in with AniList to enable bidirectional progress & status synchronization.",Ke&&e("span",{style:{marginLeft:8,color:"var(--accent)"},children:"Finishing login…"})]}),e("div",{className:n.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(l,{name:"external-link-alt",size:9})]})]}),e("div",{className:n.inputGroup,children:[e("input",{type:"text",placeholder:"Client ID",value:_,onChange:a=>oe(a.target.value),className:n.input}),e("button",{className:n.primaryBtn,onClick:Qe,disabled:!(_.trim()||V),children:[e(l,{name:"external-link-alt"})," Connect"]})]}),e("p",{className:n.helpText,children:V?e(d,{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(d,{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."]})})]}),v&&e(d,{children:[e("hr",{className:n.divider}),e("div",{className:n.radioGroup,children:[e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"anilistMode",value:"username",checked:y==="username",onChange:()=>x("username")}),e("span",{children:"Quick Import"})]}),e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"anilistMode",value:"sync",checked:y==="sync",onChange:()=>x("sync")}),e("span",{children:"Two-way Sync"})]})]}),y==="username"?e("div",{className:n.inputGroup,children:e("input",{type:"text",placeholder:"Enter AniList username",value:b,onChange:a=>j(a.target.value),className:n.input,disabled:S.isPending,onKeyDown:a=>{a.key==="Enter"&&b.trim()&&S.mutate()}})}):e("p",{className:n.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."}),y==="username"&&e("div",{className:n.optionsArea,children:e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:w,onChange:a=>xe(a.target.checked),className:n.checkbox,disabled:S.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Erase current watchlist"}),e("span",{className:n.optionDesc,children:"Delete existing watchlist before importing."})]})]})}),y==="username"?e("button",{className:n.syncBtn,onClick:()=>S.mutate(),disabled:!b.trim()||S.isPending,children:[e(l,{name:"download"}),S.isPending?"Importing...":"Start Import"]}):e(d,{children:[e("button",{className:n.syncBtn,onClick:()=>Q.mutate(),disabled:Q.isPending,children:[e(l,{name:"sync-alt",className:Q.isPending?n.spin:""}),Q.isPending?"Syncing...":"Start Sync"]}),g&&e("div",{className:n.syncSummary,children:["Pushed: ",g.pushed," · Pulled: ",g.pulled," · Merged:"," ",g.merged," · Unchanged: ",g.unchanged,g.errors.length>0&&e("span",{className:n.syncErrors,children:[" ","· ",g.errors.length," error",g.errors.length>1?"s":""]})]})]}),e("p",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"8px"},children:["AniList ",e("code",{children:"Rewatching (REPEATING)"})," is not tracked — entries with this status are ignored."]})]})]})}),k&&e(d,{children:e("div",{className:n.importCard,children:[e("div",{className:n.cardHeader,children:e("div",{className:n.cardTitleRow,children:[e(l,{name:"anilist",className:n.anilistIcon}),e("h3",{children:"AniList Manga"}),pe?null:v?e("span",{className:n.badgeOnline,children:"Connected"}):e("span",{className:n.badgeOffline,children:"Not connected"})]})}),v?e(d,{children:[e("div",{className:n.radioGroup,children:[e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"mangaMode",value:"username",checked:G==="username",onChange:()=>ye("username")}),e("span",{children:"Quick Import"})]}),e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"mangaMode",value:"sync",checked:G==="sync",onChange:()=>ye("sync")}),e("span",{children:"Two-way Sync"})]})]}),G==="username"?e(d,{children:[e("div",{className:n.inputGroup,children:e("input",{type:"text",placeholder:"Enter AniList username",value:P,onChange:a=>ge(a.target.value),className:n.input,disabled:L.isPending,onKeyDown:a=>{a.key==="Enter"&&P.trim()&&L.mutate()}})}),e("div",{className:n.optionsArea,children:e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:M,onChange:a=>de(a.target.checked),className:n.checkbox,disabled:L.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Replace AniList-linked manga"}),e("span",{className:n.optionDesc,children:"Clears previously imported (anilist:) entries before importing. Your provider bookmarks are never touched."})]})]})})]}):e(d,{children:[e("p",{className:n.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:n.radioGroup,children:[e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"mangaDirection",value:"two-way",checked:Z==="two-way",onChange:()=>be("two-way")}),e("span",{children:"Two-way"})]}),e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"mangaDirection",value:"pull-only",checked:Z==="pull-only",onChange:()=>be("pull-only")}),e("span",{children:"Pull only (never writes to AniList)"})]})]})]}),G==="username"?e("button",{className:n.syncBtn,onClick:()=>L.mutate(),disabled:!P.trim()||L.isPending,children:[e(l,{name:"download"}),L.isPending?"Importing...":"Start Import"]}):e(d,{children:[e("button",{className:n.syncBtn,onClick:()=>H.mutate(),disabled:H.isPending,children:[e(l,{name:"sync-alt",className:H.isPending?n.spin:""}),H.isPending?"Syncing...":"Start Manga Sync"]}),o&&e(d,{children:[e("div",{className:n.syncSummary,children:["Pushed: ",o.pushed," · Pulled: ",o.pulled," · Merged: ",o.merged," · Unchanged:"," ",o.unchanged,(o.skipped??0)>0&&e("span",{children:[" · Skipped: ",o.skipped]}),o.errors.length>0&&e("span",{className:n.syncErrors,children:[" ","· ",o.errors.length," error",o.errors.length>1?"s":""]})]}),(o.warnings?.length??0)>0&&e("div",{className:n.syncErrors,style:{marginTop:"8px"},children:[(o.warnings??[]).slice(0,5).map((a,r)=>e("div",{children:["⚠ ",a]},r)),(o.warnings?.length??0)>5&&e("div",{children:["+",(o.warnings?.length??0)-5," more warning(s)"]})]})]})]}),e("p",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"8px"},children:["AniList ",e("code",{children:"Rereading (REPEATING)"})," is not tracked — entries with this status are ignored."]})]}):e("p",{className:n.loginText,children:"Connect your AniList account above to sync your manga reading list."})]})}),!k&&e(d,{children:e("div",{className:n.importCard,children:[e("div",{className:n.cardHeader,children:e("div",{className:n.cardTitleRow,children:[e(l,{name:"myanimelist",className:n.malIcon}),e("h3",{children:"MyAnimeList"})]})}),e("div",{className:n.radioGroup,children:[e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"malMode",value:"username",checked:$==="username",onChange:()=>je("username")}),e("span",{children:"Username"})]}),e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"malMode",value:"xml",checked:$==="xml",onChange:()=>je("xml")}),e("span",{children:"XML File"})]})]}),$==="username"?e(d,{children:[e("div",{className:n.inputGroup,children:e("input",{type:"text",placeholder:"Enter MAL username",value:B,onChange:a=>Ie(a.target.value),className:n.input,disabled:u.isPending,onKeyDown:a=>{a.key==="Enter"&&B.trim()&&u.mutate({erase:w,useOfflineDb:D,skipFallback:F})}})}),u.isPending&&e("div",{className:n.importLoading,children:[e(l,{name:"sync-alt",className:n.spin}),e("span",{children:"Importing from MAL..."})]})]}):e("div",{className:n.uploadArea,children:e("div",{className:n.fileInputWrapper,children:[e("input",{type:"file",id:"malFile",accept:".xml,application/xml",className:n.fileInput,onChange:Je,disabled:T}),e("div",{className:n.fileDisplay,children:[e(l,{name:"file-alt",className:n.fileIcon}),e("span",{className:n.fileName,children:Me||"Choose XML file..."})]}),e("label",{htmlFor:"malFile",className:n.browseButton,children:"Browse"})]})}),e("div",{className:n.optionsArea,children:[e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:w,onChange:a=>xe(a.target.checked),className:n.checkbox,disabled:T||u.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Erase current watchlist"}),e("span",{className:n.optionDesc,children:"Delete existing watchlist before importing."})]})]}),e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:D,onChange:a=>ze(a.target.checked),className:n.checkbox,disabled:T||u.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Use offline database (fast)"}),e("span",{className:n.optionDesc,children:"Match by MAL ID locally first — instant and avoids AniList rate limits."})]})]}),e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:F,onChange:a=>Xe(a.target.checked),className:n.checkbox,disabled:T||u.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Skip online fallback"}),e("span",{className:n.optionDesc,children:"Only import offline matches. Unmatched titles are skipped without API calls."})]})]})]}),$==="username"?e("button",{className:n.syncBtn,onClick:()=>u.mutate({erase:w,useOfflineDb:D,skipFallback:F}),disabled:!B.trim()||u.isPending,children:[e(l,{name:"download"}),u.isPending?"Importing...":"Start Import"]}):e("div",{className:n.actions,children:T?e(le,{onClick:Ve,className:n.cancelBtn,children:"Cancel Import"}):e(le,{onClick:Ye,className:n.importBtn,disabled:!Me,children:[e(l,{name:"upload"})," Start Import"]})}),$==="username"&&u.isError&&e("div",{className:`${n.statusMessage} ${n.error}`,children:u.error.message}),T&&p&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressBar,children:e("div",{className:n.progressFill,style:{width:`${Ze}%`}})}),e("div",{className:n.progressInfo,children:[e("span",{className:n.progressCount,children:[p.current," / ",p.total]}),e("span",{className:n.progressTitle,children:p.found?e(d,{children:[p.matchedTitle,e("span",{className:`${n.sourceBadge} ${n[p.source||"anilist"]}`,children:p.source==="kitsu"?"Kitsu":p.source==="offline"?"Offline DB":"AniList"})]}):e("span",{className:n.skipped,children:["Skipped: ",p.title]})})]})]}),ae&&e("div",{className:`${n.statusMessage} ${n.success}`,children:["Import complete! Imported: ",ae.imported,", Skipped: ",ae.skipped,"."]}),Ae&&e("div",{className:`${n.statusMessage} ${n.error}`,children:Ae})]})}),k&&e("div",{className:n.importCard,children:[e("div",{className:n.cardHeader,children:e("div",{className:n.cardTitleRow,children:[e(l,{name:"myanimelist",className:n.malIcon}),e("h3",{children:"MyAnimeList Manga"})]})}),e("div",{className:n.radioGroup,children:[e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"malMangaMode",value:"username",checked:W==="username",onChange:()=>fe("username")}),e("span",{children:"Username"})]}),e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"malMangaMode",value:"xml",checked:W==="xml",onChange:()=>fe("xml")}),e("span",{children:"XML File"})]})]}),W==="username"?e("div",{className:n.inputGroup,children:e("input",{type:"text",placeholder:"Enter MAL username",value:E,onChange:a=>_e(a.target.value),className:n.input,disabled:f.isPending,onKeyDown:a=>{a.key==="Enter"&&E.trim()&&f.mutate()}})}):e("div",{className:n.uploadArea,children:e("div",{className:n.fileInputWrapper,children:[e("input",{type:"file",id:"malMangaFile",accept:".xml,application/xml",className:n.fileInput,onChange:a=>He(a.target.files?.[0]?.name??""),disabled:z}),e("div",{className:n.fileDisplay,children:[e(l,{name:"file-alt",className:n.fileIcon}),e("span",{className:n.fileName,children:we||"Choose XML file..."})]}),e("label",{htmlFor:"malMangaFile",className:n.browseButton,children:"Browse"})]})}),e("div",{className:n.optionsArea,children:e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:M,onChange:a=>de(a.target.checked),className:n.checkbox,disabled:f.isPending||z}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Replace AniList-linked manga"}),e("span",{className:n.optionDesc,children:"Clears previously imported (anilist:) entries before importing. Your provider bookmarks are never touched."})]})]})}),W==="username"?e("button",{className:n.syncBtn,onClick:()=>f.mutate(),disabled:!E.trim()||f.isPending,children:[e(l,{name:"download"}),f.isPending?"Importing...":"Start Import"]}):e("div",{className:n.actions,children:e(le,{onClick:We,className:n.importBtn,disabled:z||!we,children:[e(l,{name:"upload"})," ",z?"Importing...":"Start Import"]})}),f.isError&&e("div",{className:`${n.statusMessage} ${n.error}`,children:f.error.message}),ve&&e("div",{className:`${n.statusMessage} ${n.error}`,children:ve}),ee&&e("div",{className:`${n.statusMessage} ${n.success}`,children:["Import complete! Imported: ",ee.imported,", Skipped:"," ",ee.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{va as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{u as t,d as S,A,h as y,S as Me,g as Gr,o as Qr,p as Xr,a as Zr,T as Ee,q as T}from"./vendor-core-DfaOB3Rn.js";import{u as Jr}from"./vendor-query-BBT5_sHx.js";import{g as on,e as es,t as yt,z as ts,O as ns,M as Mn,B as Ue}from"./index-VzVAYX5A.js";import{I as U}from"./vendor-icons-DrybRNxP.js";import{S as rs,U as ss,p as Dn,M as os,D as gr,m as On,k as as,C as is,a as ls,b as cs,c as rn,u as ds,d as us,e as ms,j as hs,f as fs,h as gs,l as ps,B as bs,i as Pn,F as vs,G as ys,H as mr,s as Rn,n as _s,o as Ss,q as Ts,r as Cs,t as Le,A as ks,v as Es,E as ws,y as Ns,P as xs,w as ue,z as Is,R as Bs}from"./AvSyncCalibrator-XNJmMFmH.js";import{S as As,O as $n,a as Ls,A as Ms,b as Ps}from"./OptionListMenu-BiiWXfEL.js";import{u as Rs}from"./useProviders-vzvT6VhD.js";import{d as $s,g as zs,h as Ds,f as Os,e as Fs,j as Vs,k as js}from"./useTvLibrary-DDReryyQ.js";import{l as Us,c as Ws}from"./hls-Dn7_lAv2.js";import{u as Hs}from"./useIsMobile-Dvx1uJ82.js";import{S as Ks}from"./SynopsisText-B3Sa5pRv.js";const qs="_fullscreenFlat_1d0oj_1",Ys="_timeDisplay_1d0oj_15",Gs="_bottomControls_1d0oj_19",Qs="_leftControls_1d0oj_23",Xs="_rightControls_1d0oj_24",Zs="_controlBtn_1d0oj_28",Js="_controlsOverlay_1d0oj_47",eo="_hidden_1d0oj_67",to="_topControls_1d0oj_73",no="_backBtn_1d0oj_93",ro="_videoTitleInfo_1d0oj_113",so="_animeTitle_1d0oj_119",oo="_episodeLabel_1d0oj_127",ao="_speedBoostBadge_1d0oj_134",io="_progressBarContainer_1d0oj_180",lo="_progressBar_1d0oj_180",co="_thumb_1d0oj_199",uo="_bufferedBar_1d0oj_217",mo="_watchedBar_1d0oj_227",ho="_scrubbing_1d0oj_252",fo="_timeBubble_1d0oj_256",go="_bottomControlsRow_1d0oj_270",po="_nextEpisodeBtn_1d0oj_293",bo="_active_1d0oj_355",vo="_settingsPanel_1d0oj_430",yo="_settingsHeader_1d0oj_449",_o="_settingsBackBtn_1d0oj_457",So="_settingsTitle_1d0oj_475",To="_settingsContent_1d0oj_486",Co="_currentValue_1d0oj_495",ko="_menuItem_1d0oj_510",Eo="_menuNote_1d0oj_543",wo="_loadingOverlay_1d0oj_556",No="_loadingDots_1d0oj_567",xo="_dot_1d0oj_572",Io="_bufferingOverlay_1d0oj_601",Bo="_bufferingSpinner_1d0oj_610",a={fullscreenFlat:qs,timeDisplay:Ys,bottomControls:Gs,leftControls:Qs,rightControls:Xs,controlBtn:Zs,controlsOverlay:Js,hidden:eo,topControls:to,backBtn:no,videoTitleInfo:ro,animeTitle:so,episodeLabel:oo,speedBoostBadge:ao,progressBarContainer:io,progressBar:lo,thumb:co,bufferedBar:uo,watchedBar:mo,scrubbing:ho,timeBubble:fo,bottomControlsRow:go,nextEpisodeBtn:po,active:bo,settingsPanel:vo,settingsHeader:yo,settingsBackBtn:_o,settingsTitle:So,settingsContent:To,currentValue:Co,menuItem:ko,menuNote:Eo,loadingOverlay:wo,loadingDots:No,dot:xo,bufferingOverlay:Io,bufferingSpinner:Bo},Ao=({player:o,visible:p,settingsOpen:W,onOpenSettings:O,onCloseSettings:G,hasSubtitles:P,isSubtitleActive:r,subtitles:I,onSubtitleChange:i,showNextEpisodeButton:te,onNextEpisode:Q,isTheaterMode:R,onTheaterModeToggle:h,timeLabelRef:K})=>{const{state:m,refs:We,actions:$}=o,X=We.videoRef,Pe=k=>{const ne=X.current;!ne||isNaN(m.duration)||m.duration===0||(ne.currentTime=k*m.duration)},Re=()=>{X.current&&($.setIsScrubbing(!0),$.wasPlayingBeforeScrub.current=!X.current.paused,X.current.pause())},He=k=>{const ne=X.current;ne&&m.duration&&(ne.currentTime=k*m.duration)},Ke=()=>{$.setIsScrubbing(!1),$.wasPlayingBeforeScrub.current&&X.current?.play().catch(()=>{})},Ze=k=>{const ne=X.current;ne&&(ne.volume=k,ne.muted=k===0)},ae=()=>{if(r){i(-1);return}let k=null;try{k=localStorage.getItem("tvLastSubtitle")}catch{}i(Dn(I,{lastKey:k,enabled:!0}))},q=m.isMuted?t(U,{name:"volume-mute"}):m.volume<.5?t(U,{name:"volume-down"}):t(U,{name:"volume-up"});return t("div",{className:`${a.controlsOverlay} ${p?"":a.hidden}`,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:t("div",{className:a.bottomControls,onClick:k=>k.stopPropagation(),children:[t(rs,{classes:{container:a.progressBarContainer,scrubbing:a.scrubbing,timeBubble:a.timeBubble,bar:a.progressBar,buffered:a.bufferedBar,watched:a.watchedBar,thumb:a.thumb},videoRef:X,duration:m.duration,formatTime:on,isScrubbing:m.isScrubbing,buffered:"full",onSeek:Pe,onScrubStart:Re,onScrubMove:He,onScrubEnd:Ke,timeLabelRef:K}),t("div",{className:a.bottomControlsRow,children:[t("div",{className:a.leftControls,children:[t("button",{className:a.controlBtn,onClick:$.togglePlay,"aria-label":m.isPlaying?"Pause":"Play",children:m.isPlaying?t(U,{name:"pause"}):t(U,{name:"play"})}),t(ss,{muted:m.isMuted,volume:m.volume,volumeIcon:q,buttonClassName:a.controlBtn,onToggleMute:$.toggleMute,onVolumeChange:Ze,onExpandedChange:k=>$.setShowVolumeSlider(k)}),t("span",{className:a.timeDisplay,ref:K,children:[on(0)," / ",on(m.duration)]})]}),t("div",{className:a.rightControls,children:[te&&t("button",{className:a.nextEpisodeBtn,onClick:Q,title:"Play next episode",children:"Next EP"}),P&&t("button",{className:`${a.controlBtn} ${r?a.active:""}`,onClick:ae,"aria-label":r?"Turn subtitles off":"Turn subtitles on",children:t(U,{name:"closed-captioning"})}),t("button",{className:`${a.controlBtn} ${W?a.active:""}`,onClick:()=>W?G():O(),"aria-label":"Settings",children:t(U,{name:"cog"})}),t("button",{className:`${a.controlBtn} ${R?a.active:""}`,onClick:k=>{k.stopPropagation(),h()},title:R?"Exit Theater Mode":"Theater Mode","aria-label":R?"Exit Theater Mode":"Theater Mode",children:t(U,{name:"tv"})}),t("button",{className:a.controlBtn,onClick:$.toggleFullscreen,"aria-label":m.isFullscreen?"Exit Fullscreen":"Fullscreen",children:m.isFullscreen?t(U,{name:"compress"}):t(U,{name:"expand"})})]})]})]})})},sn=-6e4,zn=6e4,hr=500,Lo=({classes:o,delayMs:p,onDelayChange:W})=>{const[O,G]=S(null),P=O??p,r=A(W);r.current=W;const I=A(p);I.current=p;const i=A(null);i.current=O,y(()=>{G(null)},[p]),y(()=>()=>{const R=i.current;R!==null&&R!==I.current&&r.current(R)},[]);const te=R=>{I.current=R,i.current=null,r.current(R),G(null)},Q=R=>{const h=i.current??I.current,K=Math.max(sn,Math.min(zn,h+R));te(K)};return t(Me,{children:[t("div",{style:{display:"flex",gap:6,padding:"0.5rem 0.75rem 0.25rem"},children:[t("button",{type:"button",className:o.item,onClick:()=>Q(-hr),"aria-label":"Show subtitles 0.5 seconds earlier",style:{flex:1,justifyContent:"center"},children:t("span",{children:"-0.5s"})}),t("button",{type:"button",className:o.item,onClick:()=>Q(hr),"aria-label":"Show subtitles 0.5 seconds later",style:{flex:1,justifyContent:"center"},children:t("span",{children:"+0.5s"})}),t("button",{type:"button",className:o.item,onClick:()=>te(0),disabled:P===0,"aria-label":"Reset subtitle timing",style:{flex:1,justifyContent:"center"},children:t("span",{children:"Reset"})})]}),t(os,{label:"Subtitle timing",display:gr(P),min:sn,max:zn,step:100,value:P,percent:(P-sn)/(zn-sn)*100,onChange:R=>{const h=Math.round(R);i.current=h,G(h)},onCommit:()=>{const R=i.current;R!==null&&te(R)}}),t("div",{className:o.note,children:"Positive delays subtitles (show later). Negative shows them earlier. 0.0s is default."})]})},Mo=({view:o,onSelectView:p,onClose:W,player:O,onSubtitleStyleChange:G,streams:P,resolutionIdx:r,onResolutionChange:I,hasSubtitles:i,subtitles:te,selectedSubtitle:Q,isSubtitleActive:R,onSubtitleChange:h,audioTracks:K,selectedAudioTrack:m,onAudioTrackChange:We,videoDelayEnabled:$,onVideoDelayToggle:X,videoDelayMs:Pe,onVideoDelayChange:Re,onCalibrate:He,subtitleDelayMs:Ke,onSubtitleDelayChange:Ze,ambientSettings:ae,onAmbientChange:q})=>{const{state:k}=O,ne=()=>t(Me,{children:[P.length>1&&t("button",{className:a.menuItem,onClick:()=>p("resolution"),children:[t("span",{children:"Resolution"}),t("span",{className:a.currentValue,children:P[r]?.quality||"Auto"})]}),i&&t("button",{className:a.menuItem,onClick:()=>p("subtitles"),children:[t("span",{children:"Subtitles"}),t("span",{className:a.currentValue,children:R?te[Q]?.label||te[Q]?.language:"Off"})]}),i&&t("button",{className:a.menuItem,onClick:()=>p("subtitle-style"),children:[t("span",{children:"Subtitle Style"}),t("span",{className:a.currentValue,children:[k.subtitleFontSize.toFixed(1),"x · ",k.subtitlePosition]})]}),i&&t("button",{className:a.menuItem,onClick:()=>p("subtitle-timing"),children:[t("span",{children:"Subtitle Timing"}),t("span",{className:a.currentValue,children:gr(Ke)})]}),K.length>0&&t("button",{className:a.menuItem,onClick:()=>p("audio"),children:[t("span",{children:"Audio Track"}),t("span",{className:a.currentValue,children:K[m]?.label||K[m]?.language})]}),t("button",{className:a.menuItem,onClick:()=>p("av-sync"),children:[t("span",{children:"A/V Sync"}),t("span",{className:a.currentValue,children:$?`${Pe}ms`:"Off"})]}),ae&&q&&t("button",{className:a.menuItem,onClick:()=>p("ambient"),children:[t("span",{children:"Ambient Light"}),t("span",{className:a.currentValue,children:ae.enabled?"On":"Off"})]})]}),Se=()=>t($n,{classes:{item:a.menuItem,active:a.active},options:P.map((w,H)=>({key:String(H),label:w.quality,selected:H===r})),onSelect:w=>I(Number(w))}),Y=()=>t($n,{classes:{item:a.menuItem,active:a.active},options:[{key:"off",label:"Off",selected:!R},...te.map((w,H)=>({key:String(H),label:w.label||w.language,selected:H===Q}))],onSelect:w=>h(w==="off"?-1:Number(w))}),Te=()=>t(Ls,{classes:{item:a.menuItem,active:a.active},values:{fontSize:k.subtitleFontSize,position:k.subtitlePosition,bgOpacity:k.subtitleBgOpacity,bgColor:k.subtitleBgColor,textColor:k.subtitleTextColor,edge:k.subtitleEdge,bold:k.subtitleBold},onChange:G}),L=()=>t(Lo,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},delayMs:Ke,onDelayChange:w=>Ze?.(w)}),$e=()=>t($n,{classes:{item:a.menuItem,active:a.active},options:K.map((w,H)=>({key:String(H),label:w.label||w.language,selected:H===m})),onSelect:w=>We(Number(w))}),qe=()=>t(Ms,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},enabled:$,delayMs:Pe,onToggle:w=>X?.(w),onDelayChange:w=>Re?.(w),onCalibrate:He}),be=()=>ae&&q?t(Ps,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},values:ae,onChange:q}):null;return t("div",{"data-speed-boost-ignore":"true",onClick:w=>w.stopPropagation(),children:t(As,{classes:{panel:a.settingsPanel,header:a.settingsHeader,backBtn:a.settingsBackBtn,title:a.settingsTitle,content:a.settingsContent},title:o==="main"?"Settings":o==="subtitle-style"?"Subtitle Style":o==="subtitle-timing"?"Subtitle Timing":o==="audio"?"Audio Track":o==="resolution"?"Resolution":o==="av-sync"?"A/V Sync":o==="ambient"?"Ambient Light":o.charAt(0).toUpperCase()+o.slice(1),onBack:()=>o==="main"?W():p("main"),children:[o==="main"&&ne(),o==="resolution"&&Se(),o==="subtitles"&&Y(),o==="subtitle-style"&&Te(),o==="subtitle-timing"&&L(),o==="audio"&&$e(),o==="av-sync"&&qe(),o==="ambient"&&be()]})})},Po=({player:o,title:p,episodeLabel:W,audioTracks:O,selectedAudioTrack:G,onAudioTrackChange:P,subtitles:r,selectedSubtitle:I,onSubtitleChange:i,streams:te,resolutionIdx:Q,onResolutionChange:R,onBack:h,children:K,videoDelayEnabled:m=!1,onVideoDelayToggle:We,videoDelayMs:$=0,onVideoDelayChange:X,onCalibrateAvSync:Pe,subtitleDelayMs:Re=0,onSubtitleDelayChange:He,showNextEpisodeButton:Ke=!1,onNextEpisode:Ze,isLoading:ae=!1,isTheaterMode:q,onTheaterModeToggle:k,ambientSettings:ne,onAmbientChange:Se})=>{const{state:Y,refs:Te,actions:L}=o,$e=Te.videoRef,{subtitleFontSize:qe,subtitlePosition:be,subtitleBgOpacity:w,subtitleBgColor:H,subtitleTextColor:at,subtitleEdge:ie,subtitleBold:ze}=Y,[we,De]=S(null),it=A(null),[Ot,_t]=S(0);y(()=>{const le=$e.current;if(!le)return;const u=()=>_t(le.clientHeight||0);u();const dt=new ResizeObserver(u);return dt.observe(le),()=>dt.disconnect()},[$e]);const me=(le,u)=>{try{localStorage.setItem(le,String(u))}catch{}},ve=(le,u)=>{switch(le){case"fontSize":typeof u=="number"&&(L.setSubtitleFontSize(u),me("subtitleFontSize",u));break;case"position":typeof u=="number"&&(L.setSubtitlePosition(u),me("subtitlePosition",u));break;case"bgOpacity":typeof u=="number"&&(L.setSubtitleBgOpacity(u),me("subtitleBgOpacity",u));break;case"bgColor":typeof u=="string"&&(L.setSubtitleBgColor(u),me("subtitleBgColor",u));break;case"textColor":typeof u=="string"&&(L.setSubtitleTextColor(u),me("subtitleTextColor",u));break;case"edge":(u==="shadow"||u==="outline"||u==="none")&&(L.setSubtitleEdge(u),me("subtitleEdge",u));break;case"bold":typeof u=="boolean"&&(L.setSubtitleBold(u),me("subtitleBold",u));break}};y(()=>{const le="tv-player-subtitle-style";let u=document.getElementById(le);u||(u=document.createElement("style"),u.id=le,document.head.appendChild(u));const dt={fontSize:qe,position:be,bgOpacity:w,bgColor:H,textColor:at,edge:ie,bold:ze},Z=$e.current,kt=On(qe,Ot||Z?.clientHeight||720);if(u.textContent=as({...dt,fontSize:kt}),Z){const Et=()=>{const B=Number(be);return isNaN(B)?0:Math.max(0,Math.min(100,B))},ut=(B,J)=>{try{const de=B;de.snapToLines=!1,de.line=J}catch{}},wt=()=>{const B=kt*16,J=Z.videoHeight||Z.clientHeight||720,de=Z.videoWidth||Z.clientWidth||1280;return{step:B*1.3/J*100,chars:Math.max(20,Math.floor(de/(B*.55)))}},b=B=>{const J=Math.max(0,Math.min(100,100-Et())),de=Array.from(B.activeCues??[]);if(de.length<=1){de.forEach(Fe=>ut(Fe,J));return}const{step:It,chars:ln}=wt();let Ce=J;for(let Fe=de.length-1;Fe>=0;Fe--){const cn=String(de[Fe].text??"").replace(/<[^>]*>/g,"").split(`
|
|
2
|
+
`).reduce((dn,mt)=>dn+Math.max(1,Math.ceil(mt.length/ln)),0),jt=Ce-cn*It;ut(de[Fe],Math.max(0,jt)),Ce=jt-It*.4}},l=()=>{const B=Math.max(0,Math.min(100,100-Et()));Array.from(Z.textTracks).forEach(J=>{J.cues&&(Array.from(J.cues).forEach(de=>ut(de,B)),J.mode==="showing"&&b(J))})};l();const re=B=>{const J=B.target;J.mode==="showing"&&b(J)},ce=()=>{Array.from(Z.textTracks).forEach(B=>{B.removeEventListener("cuechange",re),B.addEventListener("cuechange",re)}),l()};Array.from(Z.textTracks).forEach(B=>{B.addEventListener("cuechange",re)}),Z.textTracks.addEventListener("addtrack",ce);const Nt=Array.from(Z.querySelectorAll("track")),xt=()=>l();return Nt.forEach(B=>B.addEventListener("load",xt)),()=>{Array.from(Z.textTracks).forEach(B=>{B.removeEventListener("cuechange",re)}),Z.textTracks.removeEventListener("addtrack",ce),Nt.forEach(B=>B.removeEventListener("load",xt))}}},[qe,be,w,H,at,ie,ze,I,r,$e,Ot]);const St=r.length>0,lt=I>=0,M=()=>{De("main"),L.setShowControls(!0)},ct=()=>{De(null)},Tt=Y.showControls||!!we,Oe=t(cs,{visible:Tt,title:p,episode:W,onBack:h,classes:{overlay:a.controlsOverlay,hidden:a.hidden,top:a.topControls,backBtn:a.backBtn,titleInfo:a.videoTitleInfo,title:a.animeTitle,episode:a.episodeLabel}}),Ft=!ae&&!Y.isBuffering&&Y.duration>0?t(is,{isPlaying:Y.isPlaying,onTogglePlay:L.togglePlay,onSkipBack:()=>L.seek(-10),onSkipForward:()=>L.seek(10)}):null,an=t(Ao,{player:o,visible:Tt,settingsOpen:!!we,onOpenSettings:M,onCloseSettings:ct,hasSubtitles:St,isSubtitleActive:lt,subtitles:r,onSubtitleChange:i,showNextEpisodeButton:Ke,onNextEpisode:Ze,isTheaterMode:q,onTheaterModeToggle:k,timeLabelRef:it}),Ct=we?t(Mo,{view:we,onSelectView:De,onClose:ct,player:o,onSubtitleStyleChange:ve,streams:te,resolutionIdx:Q,onResolutionChange:R,hasSubtitles:St,subtitles:r,selectedSubtitle:I,isSubtitleActive:lt,onSubtitleChange:i,audioTracks:O,selectedAudioTrack:G,onAudioTrackChange:P,videoDelayEnabled:m,onVideoDelayToggle:We,videoDelayMs:$,onVideoDelayChange:X,onCalibrate:()=>{De(null),Pe?.()},subtitleDelayMs:Re,onSubtitleDelayChange:He,ambientSettings:ne,onAmbientChange:Se}):null,Vt=t(Me,{children:[ae&&t("div",{className:a.loadingOverlay,"aria-hidden":"true",children:t("div",{className:a.loadingDots,children:[t("div",{className:a.dot}),t("div",{className:a.dot}),t("div",{className:a.dot})]})}),Y.isBuffering&&!ae&&t("div",{className:a.bufferingOverlay,"aria-hidden":"true",children:t("div",{className:a.bufferingSpinner})}),Y.isSpeedBoostActive&&t("div",{className:a.speedBoostBadge,"aria-hidden":"true",children:[t("span",{children:"2x"}),t(U,{name:"forward",size:12})]})]});return t(ls,{player:o,topBar:Oe,centerControls:Ft,bottomBar:!ae&&Y.duration>0?an:null,settingsPanel:Ct,overlays:Vt,isInteracting:!!we,className:Y.isFullscreen?a.fullscreenFlat:"",children:K})},Ro=({servers:o,selectedServer:p,onServerSelect:W})=>o.length===0?null:t("div",{className:rn.sourceSelectionContainer,children:[t("h4",{children:"Source"}),t("div",{className:rn.sourceButtons,children:o.map(O=>t("button",{className:`${rn.sourceButton} ${p===O?rn.active:""}`,onClick:()=>W(O),children:O},O))})]}),$o=Gr.memo(Ro);function zo(o,p,W){const O=()=>{const P=Array.isArray(o.audioTracks)?o.audioTracks.length:0,r=W.getWant(),I=P>0?Math.min(Math.max(0,r),P-1):r;o.audioTrack=I,I!==r&&W.onResolve(I)},G=(P,r)=>{const I=W.getWant(),i=Array.isArray(o.audioTracks)?o.audioTracks.length:0;if(r.id!==I&&I>=0&&I<i){o.audioTrack!==I&&(o.audioTrack=I);return}W.onResolve(r.id)};return o.on(p.MANIFEST_PARSED,O),o.on(p.AUDIO_TRACK_SWITCHED,G),()=>{o.off(p.MANIFEST_PARSED,O),o.off(p.AUDIO_TRACK_SWITCHED,G)}}const Do=/\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 Oo(){try{if(Do.test(navigator.userAgent||""))return!0;const o=navigator.deviceMemory;if(typeof o=="number"&&o>0&&o<2)return!0}catch{}return!1}const Fo="_page_f7wlz_1",Vo="_header_f7wlz_7",jo="_pageTitle_f7wlz_11",Uo="_searchForm_f7wlz_21",Wo="_searchInput_f7wlz_27",Ho="_searchBtn_f7wlz_42",Ko="_suggestions_f7wlz_58",qo="_suggestionPill_f7wlz_65",Yo="_statusMsg_f7wlz_81",Go="_error_f7wlz_87",Qo="_textOnly_f7wlz_91",Xo="_spinner_f7wlz_96",Zo="_spin_f7wlz_96",Jo="_sourceLoader_f7wlz_101",ea="_ringSpinner_f7wlz_107",ta="_grid_f7wlz_125",na="_skeletonCard_f7wlz_131",ra="_skeletonThumb_f7wlz_136",sa="_skeletonLine_f7wlz_142",oa="_shimmer_f7wlz_149",aa="_backBtn_f7wlz_169",ia="_meta_f7wlz_187",la="_headerActions_f7wlz_195",ca="_watchlistBtn_f7wlz_202",da="_active_f7wlz_220",ua="_year_f7wlz_230",ma="_rating_f7wlz_235",ha="_typeBadge_f7wlz_244",fa="_tv_f7wlz_252",ga="_movie_f7wlz_257",pa="_tvSeries_f7wlz_262",ba="_tvMiniSeries_f7wlz_267",va="_overview_f7wlz_272",ya="_controls_f7wlz_279",_a="_controlLabel_f7wlz_287",Sa="_select_f7wlz_297",Ta="_playerSection_f7wlz_309",Ca="_video_f7wlz_313",ka="_videoHidden_f7wlz_335",Ea="_delayCanvas_f7wlz_340",wa="_delayCanvasActive_f7wlz_353",Na="_subtitleOverlay_f7wlz_357",xa="_videoIframe_f7wlz_376",Ia="_retryButton_f7wlz_384",Ba="_sidebarSeason_f7wlz_399",Aa="_mobileSeasonRow_f7wlz_415",La="_providerSelectWrap_f7wlz_429",Ma="_genreRow_f7wlz_441",Pa="_genreChip_f7wlz_448",Ra="_metaRow_f7wlz_458",$a="_detailGrid_f7wlz_467",za="_detailItem_f7wlz_475",Da="_imdbLink_f7wlz_497",v={page:Fo,header:Vo,pageTitle:jo,searchForm:Uo,searchInput:Wo,searchBtn:Ho,suggestions:Ko,suggestionPill:qo,statusMsg:Yo,error:Go,textOnly:Qo,spinner:Xo,spin:Zo,sourceLoader:Jo,ringSpinner:ea,grid:ta,skeletonCard:na,skeletonThumb:ra,skeletonLine:sa,shimmer:oa,backBtn:aa,meta:ia,headerActions:la,watchlistBtn:ca,active:da,year:ua,rating:ma,typeBadge:ha,tv:fa,movie:ga,tvSeries:pa,tvMiniSeries:ba,overview:va,controls:ya,controlLabel:_a,select:Sa,playerSection:Ta,video:Ca,videoHidden:ka,delayCanvas:Ea,delayCanvasActive:wa,subtitleOverlay:Na,videoIframe:xa,retryButton:Ia,sidebarSeason:Ba,mobileSeasonRow:Aa,providerSelectWrap:La,genreRow:Ma,genreChip:Pa,metaRow:Ra,detailGrid:$a,detailItem:za,imdbLink:Da},Oa=[],Fa=[];function fr({error:o,onRetry:p}){return t("div",{className:`${v.statusMsg} ${v.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:o}),t("button",{className:v.retryButton,onClick:p,children:"Retry"})]})})}const Ja=()=>{const{id:o}=Qr(),[p]=Xr(),W=A(p);W.current=p;const O=Zr(),G=Jr(),P=p.get("type"),[r,I]=S(null),[i,te]=S(()=>parseInt(p.get("s")||"1",10)||1),[Q,R]=S([]),[h,K]=S(()=>parseInt(p.get("e")||"1",10)||1),[m,We]=S(()=>{try{return localStorage.getItem("tvProvider")||""}catch{return""}}),[$,X]=S([]),[Pe,Re]=S(""),{options:He,isFallback:Ke,isLoading:Ze}=Rs(),ae=Ee(()=>He.filter(e=>(e.kind??"tv")==="tv").map(e=>({id:e.value,label:e.label,tier:e.tier==="embed"?"embed":"direct",servers:e.servers})),[He]),q=Ke||ae.length===0?Oa:ae,k=q.filter(e=>e.tier==="direct"),ne=q.filter(e=>e.tier==="embed"),[Se,Y]=S(!1),[Te,L]=S(""),[$e,qe]=S([]),[be,w]=S(0),[H,at]=S([]),[ie,ze]=S(-1),[we,De]=S(0),[it,Ot]=S(""),[_t,me]=S(""),[ve,St]=S(()=>{try{return localStorage.getItem("tvServer")||""}catch{return""}}),lt=Ee(()=>q.find(e=>e.id===m),[q,m]),M=lt?.tier==="embed",[ct,Tt]=S([]),[Oe,Ft]=S(""),[an,Ct]=S(""),[Vt,le]=S(!1),u=Ee(()=>ct.length>0?ct:lt?.servers??[],[ct,lt]),dt=Ee(()=>Oe?["Embed",...u]:u,[u,Oe]),Z=Vt&&!!Oe,kt=Z?an||Oe:"";y(()=>{if(!Oe){Ct("");return}let e=!1;return fetch(`/api/resolve?url=${encodeURIComponent(Oe)}`).then(n=>n.json()).then(n=>{!e&&n.finalUrl&&Ct(n.finalUrl)}).catch(()=>{}),()=>{e=!0}},[Oe]);const Et=A([]);y(()=>{Et.current=$},[$]);const ut=A(be);y(()=>{ut.current=be},[be]);const wt=A(ie);y(()=>{wt.current=ie},[ie]);const b=ds({skipIntervals:Fa}),l=b.refs.videoRef,re=A(null),ce=A([]),Nt=A(null),xt=A(null),{videoDelayMs:B,videoDelayEnabled:J,setDelayEnabled:de,handleVideoDelayChange:It,isCalibrating:ln,testClipActive:Ce,stopCalibration:Fe,openAvSyncCalibrator:Fn,cancelAvSyncCalibrator:cn,applyAvSyncCalibrator:jt,toggleTestClip:dn,calibReturnRef:mt,effectiveVideoDelayMs:un}=us(l),[ht,pr]=S(()=>{try{const e=Number(localStorage.getItem("tvSubtitleDelayMs"));if(Number.isFinite(e)&&e>=-6e4&&e<=6e4)return Math.round(e)}catch{}return 0}),mn=A(ht);mn.current=ht;const br=T(e=>{const n=Math.max(-6e4,Math.min(6e4,Math.round(e)));if(mn.current!==n){mn.current=n,pr(n);try{localStorage.setItem("tvSubtitleDelayMs",String(n))}catch{}}},[]);ms({videoRef:l,canvasRef:Nt,delayMs:un,enabled:J});const hn=J,ye=hn||ht!==0,{settings:fn,update:vr}=hs(),gn=A(ye);gn.current=ye;const pn=T(()=>{if(!gn.current)return;const e=l.current;e&&Array.from(e.textTracks).forEach(n=>{n.mode!=="hidden"&&(n.mode="hidden")})},[l]),{hasConsent:Bt,grant:yr}=es(),At=A("");At.current||(At.current=`tv-${Date.now()}-${Math.random().toString(36).slice(2)}`);const f=P==="movie",Ut=o?$s(P||"tv",o):"",F=Ut,Vn=zs(),Wt=Ds(),{toggle:jn,bookmarkedIds:_r,pending:Sr}=Os(),{data:Un}=Fs(r?Ut:void 0),Ht=Un?!!Un.inLibrary:Ut?_r.has(Ut):!1,Tr=T(()=>{!r||!o||jn({tmdbId:Number(o),mediaType:P||"tv",title:r.title,poster:r.poster,year:r.year,adult:r.adult})},[r,o,P,jn]),{data:Je,isFetched:Wn,isPending:Hn}=Vs(F||void 0,i,h),Kt=Ee(()=>Q.map(e=>e.episode_number).sort((e,n)=>e-n),[Q]),et=Kt.indexOf(h),bn=et>0?Kt[et-1]:null,x=et>=0&&et<Kt.length-1?Kt[et+1]:null,qt=Ee(()=>(r?.seasons??[]).map(e=>e.season_number).filter(e=>Number.isFinite(e)).sort((e,n)=>e-n),[r]),_e=Ee(()=>{if(f||x!=null)return null;const e=qt.indexOf(i);return e>=0&&e<qt.length-1?qt[e+1]:(r?.number_of_seasons??0)>i?i+1:null},[f,x,qt,i,r?.number_of_seasons]),Kn=Je?.currentTime??0,qn=Je?.duration??0,vn=Je?.completed===!0||Je?.completed===1||Pn(Kn,qn),[Ne,Ve]=S(!1),xe=A(!1),yn=A(null),Lt=A(null);y(()=>{xe.current=!1,Lt.current=null,Ve(!1)},[F,i,h]);const[Ie,Yt]=S(!1),[ft,Yn]=S(0),[tt,Gn]=S(!1),[Ye,nt]=S(!1),[Cr,_n]=S(!1),[kr,Qn]=S(""),[Gt,Er]=S(!1),[wr,Sn]=S(!1),{isTheaterMode:je,toggleTheaterMode:Tn,handleLayoutClick:Nr}=fs();y(()=>{const e=n=>{n.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||n.key.toLowerCase()==="t"&&Tn()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[Tn]),gs(b,($.length>0||_t!=="")&&!je&&!Ie&&!Ne&&!Ye);const xr=Hs(),[gt,Ir]=S(ps),Br=T(e=>{Ir(e),bs(e)},[]),he=A(!1),rt=A(null),Cn=A(0),Xn=A(!1),Zn=A(0),ee=A(null),Mt=A(""),Ar=mr(Kn,qn),Pt=!he.current&&!xe.current&&(Ie||Ne||Ye||vn||Ar),pt=A(Pt);pt.current=Pt;const bt=A(!1);y(()=>{bt.current=tt},[tt]);const Ge=T((e,n)=>{if(!F||!n||n<30)return;const s=Pn(e,n),d=s?n:e;Math.abs(d-Cn.current)<10&&!s||(Cn.current=d,Vn.mutate({mediaId:F,season:i,episode:h,currentTime:Math.floor(d),duration:Math.floor(n),completed:s,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:P||"tv",adult:r?.adult?1:0}))},[F,i,h,Vn,r,P]),Be=T((e,n)=>{Fe();const s=new URLSearchParams(p);s.set("type",p.get("type")||"tv"),s.set("s",String(e)),s.set("e",String(n)),O(`${window.location.pathname}?${s.toString()}`)},[p,O,Fe]),Rt=T(()=>{const e=l.current;if(!e||f||x==null){_n(!1);return}const n=e.duration||0,s=e.currentTime||0;_n(n>0&&s/n>=.8)},[f,x,l]),Qt=T((e,n)=>["tv-sources",m,f?"movie":"tv",o,e,n,ve],[m,f,o,ve]),Xt=T(async(e,n)=>{if(!r||!o||!m)return{valid:!1,sources:[]};const s=f?"movie":"tv",d=await yt.tv.sources.query({provider:m,type:s,tmdbId:String(o),season:e,episode:n,title:r.title||"",year:r.year||"",totalSeasons:String(r.number_of_seasons||1),imdbId:r.imdb_id||"",...u.length>0&&ve?{server:ve}:{}});return{valid:"valid"in d?d.valid:!1,error:"error"in d?d.error:void 0,sources:d.sources,referer:"referer"in d?d.referer:void 0,audioTracks:d.audioTracks,subtitles:"subtitles"in d?d.subtitles:void 0,servers:"servers"in d?d.servers:void 0,embedUrl:"embedUrl"in d?d.embedUrl:void 0}},[r,o,m,f,u,ve]),Jn=T(()=>{if(f||!r||!o||!m||M||x==null)return;const e=Qt(i,x);G.getQueryState(e)?.status!=="success"&&G.prefetchQuery({queryKey:e,queryFn:()=>Xt(i,x),staleTime:300*1e3,gcTime:1800*1e3})},[f,r,o,m,M,x,i,G,Qt,Xt]),Lr=T(()=>{if(Ce)return;Rt();const e=l.current;!e||e.paused||e.ended||(e.duration>0&&e.duration-e.currentTime<=60&&Jn(),rt.current&&clearTimeout(rt.current),rt.current=setTimeout(()=>{Ge(e.currentTime,e.duration||0)},5e3))},[Ge,l,Ce,Rt,Jn]),Mr=T(()=>{const e=l.current;if(!e||!r)return;rt.current&&clearTimeout(rt.current),Ge(e.currentTime,e.duration||0),Xn.current=!0;const n=vs({seekInduced:Date.now()-Zn.current<ys,autoplayEnabled:gt,hasNext:!f&&x!=null,isFinal:f||x==null});n==="advance"&&x!=null?(K(x),Be(i,x)):n==="prompt-next"?(xe.current=!1,he.current=!0,Ve(!0)):n==="prompt-complete"&&(Qn(f?r.title:`${r.title} — Season ${i}`),nt(!0),xe.current=!0,he.current=!0)},[f,r,i,x,gt,Ge,Be,l]),Pr=T(()=>{Xn.current=!1,b.actions.onPlay()},[b.actions]),Rr=T(()=>{b.actions.onPause();const e=l.current;e&&!e.ended&&Ge(e.currentTime,e.duration||0)},[b.actions,Ge,l]),$r=T(()=>{b.actions.onLoadedMetadata();const e=l.current;if(e){try{const n=parseFloat(localStorage.getItem("playerVolume")||"");isNaN(n)||(e.volume=Math.max(0,Math.min(1,n))),e.muted=localStorage.getItem("playerMuted")==="true"}catch{}if(ee.current!=null&&ee.current>0){try{e.currentTime=ee.current}catch{}ee.current=null}Rt()}},[b.actions,l,Rt]),kn=T(()=>{const e=l.current;if(e&&ee.current!=null&&ee.current>0){try{e.currentTime=ee.current}catch{}ee.current=null}},[l]),zr=T(()=>{ft>0&&(ee.current=ft);const e=l.current;if(e&&ft>0){try{e.currentTime=ft,ee.current=null}catch{}e.play().catch(()=>{})}Yt(!1),he.current=!0},[ft,l]),er=T(()=>{ee.current=null;const e=l.current;e&&(e.currentTime=0,e.play().catch(()=>{})),Yt(!1),he.current=!0},[l]),Dr=T(()=>{xe.current=!0,Ve(!1),he.current=!0},[]),Or=T(()=>{xe.current=!0,Ve(!1),he.current=!0,ee.current=null;const e=l.current;if(e){try{e.currentTime=0}catch{}e.play().catch(()=>{})}},[l]),tr=T(()=>{x!=null&&(xe.current=!0,Ve(!1),he.current=!0,K(x),Be(i,x))},[x,i,Be]),nr=T(()=>{_e!=null&&(xe.current=!0,Ve(!1),nt(!1),he.current=!0,te(_e),K(1),Be(_e,1))},[_e,Be]),Fr=T(async()=>{if(F)try{await Wt.mutateAsync({id:F,status:"Completed"}),nt(!1),Ve(!1),O("/")}catch{}},[F,Wt,O]);y(()=>{he.current=!1,yn.current=null,Yt(!1),_n(!1),Yn(0),Gn(!1),bt.current=!1,ee.current=null,Mt.current=`${F}:${i}:${h}`,Cn.current=0},[F,i,h]),y(()=>{Wn&&(Gn(!0),bt.current=!0)},[Wn,F,i,h]),y(()=>{if(!Je||he.current)return;const e=`${F}:${i}:${h}`;if(yn.current===e)return;yn.current=e;const n=Je,s=n.currentTime??0,d=n.duration??0;mr(s,d)&&(Yn(s),Yt(!0))},[Je,F,i,h]),y(()=>{if(!tt||he.current||xe.current||Ie||Ye||Ne)return;const e=`${F}:${i}:${h}`;if(Lt.current!==e){if(!vn){Hn||(Lt.current=e);return}if(f){Lt.current=e,Ve(!0);return}if(!(!r||et<0||Q.length===0)){if(Lt.current=e,x==null&&_e==null){r&&Q.length>0&&(Qn(`${r.title} — Season ${i}`),nt(!0),xe.current=!0,he.current=!0);return}Ve(!0)}}},[tt,vn,Hn,Ie,Ye,Ne,f,x,_e,r,et,Q.length,F,i,h]),y(()=>{(Ie||Ne)&&l.current&&l.current.pause()},[Ie,Ne,l]),y(()=>{const e=l.current;return()=>{rt.current&&clearTimeout(rt.current),e&&!e.ended&&Ge(e.currentTime,e.duration||0)}},[Ge,l]);const En=T(e=>{let n=null,s=!0;try{n=localStorage.getItem("tvLastSubtitle"),s=localStorage.getItem("tvSubtitlesEnabled")!=="false"}catch{}return Dn(e,{lastKey:n,enabled:s})},[]),wn=T(e=>{if(!(e<0))try{localStorage.setItem("tvSubtitlesEnabled","true"),localStorage.setItem("tvSelectedSubtitle",String(e))}catch{}},[]),rr=T(e=>{if(e.length===0)return 0;let n=null;try{n=localStorage.getItem("tvLastAudio")}catch{}if(n){const s=e.findIndex(g=>Rn(g)===n);if(s>=0)return s;const d=n.indexOf("|||"),c=d>=0?n.slice(0,d):n,N=d>=0?n.slice(d+3):n,z=e.findIndex(g=>g.language===c||g.label===N);if(z>=0)return z}return Dn(e,{lastKey:null,enabled:!0})},[]),{data:sr}=js(F||void 0),or=Ee(()=>(sr?.progress??[]).filter(n=>n.season===i&&(n.completed===!0||n.completed===1||Pn(n.currentTime,n.duration))).map(n=>String(n.episode)),[sr,i]),ar=Ee(()=>Q.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})),[Q]),ir=Ee(()=>(r?.genres??[]).map(e=>e.name).slice(0,5),[r]),Nn=Ee(()=>[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]);y(()=>{if(q.length!==0&&!q.some(e=>e.id===m)){const e=q.find(n=>n.tier==="direct")?.id??q[0].id;We(e);try{localStorage.setItem("tvProvider",e)}catch{}}},[q,m]),y(()=>{Tt([]),Ft(""),Ct(""),le(!1)},[m]),y(()=>{if(u.length!==0&&!u.includes(ve)){St(u[0]);try{localStorage.setItem("tvServer",u[0])}catch{}}},[u,ve]),y(()=>{if(!o){I(null),X([]),Re(""),L(""),me("");return}const e=Number(o),n=P||"tv";I(null),X([]),Re(""),L(""),me("");const s=parseInt(W.current.get("s")||"",10),d=parseInt(W.current.get("e")||"",10);te(isNaN(s)?1:s),K(isNaN(d)?1:d),De(0),yt.tv.details.query({type:n,id:String(e)}).then(c=>{const N={id:c.id,title:c.title||"",overview:c.overview||"",vote_average:c.vote_average,year:c.year,poster:c.poster,backdrop:c.backdrop,imdb_id:c.imdb_id||void 0,adult:c.adult,seasons:c.seasons,number_of_seasons:c.number_of_seasons};I(N),N.seasons&&N.seasons.length>0&&isNaN(s)&&te(N.seasons[0].season_number)}).catch(()=>{})},[o,P]),y(()=>{if(!r||!o)return;if(!(r.seasons!==void 0||r.number_of_seasons!==void 0)){R([]);return}const n=parseInt(p.get("e")||"",10);yt.tv.episodes.query({id:String(o),season:String(i)}).then(s=>{const d=(s.episodes||[]).map(c=>({episode_number:c.episode_number,name:c.name||"",vote_average:c.vote_average,overview:c.overview||"",still_path:c.still_path||""}));R(d),d.length!==0&&K(c=>!isNaN(n)&&d.some(N=>N.episode_number===n)?n:d.some(N=>N.episode_number===c)?c:d[0].episode_number)}).catch(()=>{})},[r,o,i,p]),y(()=>{if(!M||!r||!o)return;fetch(`/api/tv/embed/${m}/${f?"movie":"tv"}/${o}?season=${i}&episode=${h}`).then(n=>n.json()).then(n=>{if(n.url)return me(n.url),fetch(`/api/resolve?url=${encodeURIComponent(n.url)}`).then(s=>s.json()).then(s=>{s.finalUrl&&me(s.finalUrl)})}).catch(()=>{})},[m,r,o,i,h,f,M]);const Zt=T(async()=>{if(!r||!o||!m||M||r.adult&&!Bt)return;const e=`${F}:${i}:${h}`;Y(!0),L(""),Et.current.length===0&&(X([]),De(0),qe([]),at([]));try{const n=await G.fetchQuery({queryKey:Qt(i,h),queryFn:()=>Xt(i,h),staleTime:3e5,gcTime:18e5});if(Mt.current!==e){Y(!1);return}if(Y(!1),!n.valid||!n.sources?.length){L(n.error?`${n.error}`:u.length>0?`No streams from ${ve}. Try another server.`:"No streams available.");return}X(n.sources),Re(e),n.servers?.length&&Tt(n.servers),n.embedUrl&&Ft(n.embedUrl),De(0),n.referer&&Ot(n.referer);const s=n.audioTracks||[];qe(s),w(s.length>0?rr(s):0);const d=n.subtitles||[];if(at(d),d.length>0){const z=En(d);ze(z),wn(z)}else ze(-1);const c=f?"movie":"tv",N=o;yt.tv.subtitles.query({type:c,tmdbId:String(N),season:String(i),episode:String(h)}).then(z=>{if(Mt.current!==e)return;const g=Array.isArray(z.subtitles)?z.subtitles:[];g.length!==0&&at(se=>{const fe=[...se,...g.filter(_=>!se.some(ge=>ge.url===_.url))];if(se.length===0){const _=En(fe);ze(_),wn(_)}return fe})}).catch(()=>{}),L("")}catch{if(Mt.current!==e)return;Y(!1),L("Failed to load streams.")}},[r,o,m,i,h,f,M,Bt,u,ve,En,wn,rr,F,G,Qt,Xt]),xn=T(()=>{const e=l.current;e&&!isNaN(e.currentTime)&&(ee.current=e.currentTime)},[l]),Vr=T(e=>{if(e==="Embed"){le(!0);return}xn(),le(!1),St(e);try{localStorage.setItem("tvServer",e)}catch{}L("")},[xn]),jr=T(e=>{We(e);try{localStorage.setItem("tvProvider",e)}catch{}},[]);y(()=>{m&&r&&!M&&Zt()},[m,r,Zt,M]),y(()=>{if(!l.current)return;if(re.current&&(re.current.destroy(),re.current=null),M||Z){const g=l.current;g&&(g.pause(),g.removeAttribute("src"),g.load());return}let e=!1;if(Ce){const g=l.current;return g&&(g.pause(),g.removeAttribute("src"),g.load(),g.src="/av-sync-test.mp4",pt.current||g.play().catch(()=>{})),()=>{e=!0}}if(mt.current!=null&&(ee.current=mt.current,mt.current=null),Mt.current===`${F}:${i}:${h}`&&ee.current==null&&!pt.current)try{const g=l.current;g&&!g.ended&&g.currentTime>1&&(ee.current=g.currentTime)}catch{}const s=ee.current??0,d=!Se&&Pe===`${F}:${i}:${h}`?Z?"":$[we]?.url||"":"";if(!d){try{l.current?.pause(),l.current?.removeAttribute("src"),l.current?.load()}catch{}return}const c=l.current;c.pause(),c.removeAttribute("src"),c.load(),b.actions.resetMediaState();const N=`/api/tv/stream-proxy?url=${encodeURIComponent(d)}&referer=${encodeURIComponent(it)}`;$[we]?.type==="hls"?(async()=>{const g=await Us();if(!e)if(g&&g.isSupported()){const se=Oo()||document.body.classList.contains("low-end"),fe=se?60:180,_=new g({enableWorker:!0,lowLatencyMode:!1,startPosition:s>0?s:-1,maxBufferLength:fe,maxMaxBufferLength:fe+(se?30:60),backBufferLength:se?30:60,maxBufferSize:(se?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}}}});re.current=_,_.on(g.Events.ERROR,(D,E)=>{E.fatal&&(L(`Stream failed (${E.details}). Try another source or reload.`),Y(!1),_.destroy(),re.current=null)}),_.loadSource(N),_.attachMedia(c);const ge=()=>{let D=!1,E=0;try{D=localStorage.getItem("tvSubtitlesEnabled")==="true";const C=parseInt(localStorage.getItem("tvSelectedSubtitle")||"0",10);!isNaN(C)&&C>=0&&(E=C)}catch{}return{enabled:D,index:E}},V=()=>{if(typeof _.subtitleTrack!="number")return;if(ce.current.length>0){_.subtitleTrack=-1;return}const D=Array.isArray(_.subtitleTracks)?_.subtitleTracks:[];if(D.length===0){_.subtitleTrack=-1;return}const E=ge();if(E.enabled){const C=E.index<D.length?E.index:0;_.subtitleTrack=C,ze(C),pn()}else _.subtitleTrack=-1};zo(_,g.Events,{getWant:()=>ut.current,onResolve:D=>w(D)}),_.on(g.Events.MANIFEST_PARSED,()=>{V(),(s>0||!pt.current&&bt.current)&&c.play().catch(()=>b.actions.setShowControls(!0))}),_.on(g.Events.SUBTITLE_TRACKS_UPDATED,()=>{V()}),_.on(g.Events.SUBTITLE_TRACK_SWITCH,(D,E)=>{if(ce.current.length>0){if(E.id!==-1)try{_.subtitleTrack=-1}catch{}return}const C=Array.isArray(_.subtitleTracks)?_.subtitleTracks:[];if(C.length!==0){if(E.id===-1){const ke=ge();if(ke.enabled){const oe=ke.index<C.length?ke.index:0;_.subtitleTrack=oe;return}}ze(E.id),pn()}})}else Ws(c)&&(c.src=N,(s>0||!pt.current&&bt.current)&&c.play().catch(()=>{L("Failed to play stream. Try another source.")}))})():(c.src=N,(s>0||!pt.current&&bt.current)&&c.play().catch(()=>{L("Failed to play stream. Try another source.")}));const z=()=>{const fe=c.error?.code===4?"Video source not supported or not found":"Failed to load video stream";L(`${fe}. The source may be invalid or expired. Try switching source or reloading.`),Y(!1)};return c.addEventListener("error",z),()=>{e=!0,c.removeEventListener("error",z)}},[$,Pe,Se,we,m,it,M,Z,l,mt,Ce,F,i,h,kn,pn,b.actions]),y(()=>{if(!tt||Ie||Ne||Ye||Pt||M||Ce)return;const e=l.current;!e||!e.paused||e.ended||e.readyState<1||(kn(),e.play().catch(()=>{}))},[tt,Ie,Ne,Ye,Pt,M,Ce,kn,l]),y(()=>{const e=re.current;!e||typeof e.audioTrack!="number"||(e.audioTrack=be)},[be]),y(()=>{const e=re.current;!e||typeof e.subtitleTrack!="number"||!Array.isArray(e.subtitleTracks)||e.subtitleTracks.length===0||ce.current.length>0||(ie>=0?e.subtitleTrack=ie:e.subtitleTrack=-1)},[ie]),y(()=>{const e=l.current;if(!(!e||M)&&(e.querySelectorAll("track").forEach(n=>n.remove()),ce.current=[],H.length!==0&&(H.forEach(n=>{const s=document.createElement("track");s.kind="subtitles",s.label=n.label||n.language||"Unknown",s.srclang=n.language||n.label||"en";const d=`/api/subtitle-proxy?url=${encodeURIComponent(n.url)}&referer=${encodeURIComponent(it)}`;s.src=d,s.addEventListener("load",()=>{const c=ce.current.indexOf(s),N=s.track;if(N&&c>=0){const z=c===wt.current;N.mode=z&&!gn.current?"showing":"hidden"}}),e.appendChild(s),ce.current.push(s)}),H.length>0)))try{const n=re.current;n&&typeof n.subtitleTrack=="number"&&n.subtitleTrack!==-1&&(n.subtitleTrack=-1)}catch{}},[H,it,M,m,l]),y(()=>{const e=l.current;if(!e||M)return;const n=re.current;ce.current.length>0&&n&&typeof n.subtitleTrack=="number"&&Array.isArray(n.subtitleTracks)&&n.subtitleTracks.length>0&&(n.subtitleTrack=-1);const s=()=>{const N=On(b.state.subtitleFontSize,e.clientHeight||720),z=Math.max(0,Math.min(100,100-b.state.subtitlePosition)),g=()=>{const V=N*16,D=e.videoHeight||e.clientHeight||720,E=e.videoWidth||e.clientWidth||1280;return{step:V*1.3/D*100,chars:Math.max(20,Math.floor(E/(V*.55)))}},se=(V,D)=>{const E=V;E.snapToLines=!1,E.line=D},fe=V=>{if(!V.cues)return;Array.from(V.cues).forEach(oe=>se(oe,z));const D=Array.from(V.activeCues??[]);if(D.length<=1){D.forEach(oe=>se(oe,z));return}const{step:E,chars:C}=g();let ke=z;for(let oe=D.length-1;oe>=0;oe--){const Qe=String(D[oe].text??"").replace(/<[^>]*>/g,"").split(`
|
|
3
|
+
`).reduce((tn,zt)=>tn+Math.max(1,Math.ceil(zt.length/C)),0);ke=Math.max(0,ke-Qe*E),se(D[oe],ke),ke-=E*.4}},_=ce.current;if(_.length>0){_.forEach((V,D)=>{const E=V.track;if(!E)return;const C=D===ie;E.mode=C&&!ye?"showing":"hidden",C&&!ye&&fe(E)});return}const ge=Array.from(e.textTracks);ge.length!==0&&ge.forEach((V,D)=>{const E=D===ie;V.mode=E&&!ye?"showing":"hidden",E&&!ye&&fe(V)})};s();const d=()=>s();e.textTracks.addEventListener("addtrack",d),e.addEventListener("loadedmetadata",s,{once:!0});const c=window.setTimeout(s,600);return()=>{e.textTracks.removeEventListener("addtrack",d),e.removeEventListener("loadedmetadata",s),window.clearTimeout(c)}},[ie,H,M,m,l,ye,b.state.subtitleFontSize,b.state.subtitlePosition]),y(()=>{if(!ye)return;const e=l.current,n=xt.current;if(!e||!n)return;const s=ht/1e3,d=un/1e3,c=new Set;let N=[],z=-1,g=-1,se=-1,fe=-1,_=0,ge=0,V=!1;const D=()=>{const j=wt.current;if(j<0)return null;const Xe=ce.current;return Xe.length>0?Xe[j]?.track??null:Array.from(e.textTracks)[j]??null},E=(j,Xe)=>{const pe=j.cues;if(!pe||pe.length===0)return Array.from(j.activeCues??[]);let st=0,ot=pe.length;for(;st<ot;){const Ae=st+ot>>>1;pe[Ae].endTime+s<Xe?st=Ae+1:ot=Ae}const Dt=[];for(let Ae=st;Ae<pe.length;Ae++){const nn=pe[Ae];if(nn.startTime+s>Xe)break;nn.endTime+s>=Xe&&Dt.push(nn)}return Dt},C=()=>{const j=D(),Xe=e.currentTime-d,pe=j?E(j,Xe):[],st=e.clientWidth,ot=e.clientHeight,Dt=e.videoWidth,Ae=e.videoHeight;if(pe.length===N.length&&pe.every((Bn,An)=>Bn===N[An])&&st===z&&ot===g&&Dt===se&&Ae===fe||(N=pe,z=st,g=ot,se=Dt,fe=Ae,n.textContent="",pe.length===0))return;const dr={fontSize:On(b.state.subtitleFontSize,ot),position:b.state.subtitlePosition,bgOpacity:b.state.subtitleBgOpacity,bgColor:b.state.subtitleBgColor,textColor:b.state.subtitleTextColor,edge:b.state.subtitleEdge,bold:b.state.subtitleBold},Kr=_s(dr),qr=Ss(e,dr.position);pe.forEach((Bn,An)=>{const ur=String(Bn.text??"");if(!Ts(ur).trim())return;const Ln=document.createElement("div"),Yr=(pe.length-1-An)*1.7;Ln.style.cssText=`${Kr}
|
|
4
|
+
bottom: calc(${qr}px + ${Yr}em);`,Ln.innerHTML=Cs(ur),n.appendChild(Ln)})},ke=()=>{Array.from(e.textTracks).forEach(j=>{c.has(j)||(c.add(j),j.addEventListener("cuechange",C))})},oe=()=>{ke(),C()},In=()=>{if(V||ge)return;const j=()=>{ge=0,!(V||e.paused||e.ended)&&(C(),In())};ge=window.requestAnimationFrame(j)},Qe=e,tn=()=>{_=0,C(),!V&&Qe.requestVideoFrameCallback&&(_=Qe.requestVideoFrameCallback(tn))},zt=()=>{C(),Qe.requestVideoFrameCallback?_||(_=Qe.requestVideoFrameCallback(tn)):In()};ke(),e.textTracks.addEventListener("addtrack",oe),e.textTracks.addEventListener("removetrack",oe),e.addEventListener("timeupdate",C),e.addEventListener("seeked",C),e.addEventListener("loadedmetadata",C),e.addEventListener("play",zt);const lr=Array.from(e.querySelectorAll("track"));lr.forEach(j=>j.addEventListener("load",C));const cr=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>C());return cr?.observe(e),C(),zt(),()=>{V=!0,c.forEach(j=>j.removeEventListener("cuechange",C)),e.textTracks.removeEventListener("addtrack",oe),e.textTracks.removeEventListener("removetrack",oe),e.removeEventListener("timeupdate",C),e.removeEventListener("seeked",C),e.removeEventListener("loadedmetadata",C),e.removeEventListener("play",zt),lr.forEach(j=>j.removeEventListener("load",C)),cr?.disconnect(),ge&&window.cancelAnimationFrame(ge),_&&Qe.cancelVideoFrameCallback&&Qe.cancelVideoFrameCallback(_),n.textContent=""}},[ye,ht,ie,H,un,l,b.state.subtitleFontSize,b.state.subtitlePosition,b.state.subtitleBgOpacity,b.state.subtitleBgColor,b.state.subtitleTextColor,b.state.subtitleEdge,b.state.subtitleBold]);const Jt=()=>{I(null),X([]),me(""),O(-1)},Ur=T(e=>{te(e),K(1),Be(e,1)},[Be]),en=!f&&r?.seasons&&r.seasons.length>1?t("label",{className:v.sidebarSeason,children:[t("span",{children:"Season"}),t("select",{value:i,onChange:e=>Ur(parseInt(e.target.value,10)||1),className:v.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=T(e=>{const n=parseInt(e,10);if(!isNaN(n)){try{l.current?.pause()}catch{}K(n),Be(i,n)}Sn(!1)},[i,Be,l]);y(()=>{if(f)return;const e=n=>{n.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||n.key.toLowerCase()==="n"&&(x!=null?vt(String(x)):ts.error("No next episode available"))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[f,x,vt]);const Wr=e=>{w(e);try{const s=$e[e];s&&localStorage.setItem("tvLastAudio",Rn(s))}catch{}const n=re.current;n&&n.audioTrack!==void 0&&(n.audioTrack=e)},Hr=e=>{ze(e);try{if(e===-1)localStorage.setItem("tvSubtitlesEnabled","false");else{localStorage.setItem("tvSubtitlesEnabled","true"),localStorage.setItem("tvSelectedSubtitle",String(e));const c=H[e];c&&localStorage.setItem("tvLastSubtitle",Rn(c))}}catch{}const n=l.current,s=re.current;if(s&&typeof s.subtitleTrack=="number"&&Array.isArray(s.subtitleTracks)&&s.subtitleTracks.length>0&&(s.subtitleTrack=ce.current.length>0||e<0?-1:e),!n)return;const d=ce.current;if(d.length>0){d.forEach((c,N)=>{const z=c.track;if(!z)return;const g=N===e;z.mode=g&&!ye?"showing":"hidden"});return}Array.from(n.textTracks).forEach((c,N)=>{const z=N===e;c.mode=z&&!ye?"showing":"hidden"})},$t=T(()=>{if(!r)return;const e=l.current,n=f?"":`S${String(i).padStart(2,"0")}E${String(h).padStart(2,"0")}`;yt.discord.tvPresence.mutate({title:r.title,episodeLabel:n,isPlaying:e?!e.paused&&!e.ended:!0,thumbnail:r.poster,currentTime:e?e.currentTime:0,duration:e&&e.duration||0,isAdult:r.adult===!0,sessionId:At.current}).catch(()=>{}),yt.discord.heartbeat.mutate({sessionId:At.current}).catch(()=>{})},[r,f,i,h,l]);return y(()=>{if(!r)return;$t();const e=window.setInterval(()=>{const n=l.current;(!n||!n.paused)&&$t()},15e3);return()=>window.clearInterval(e)},[$t,r,l]),y(()=>{if(!r||M||Se||Te||$.length===0)return;const e=l.current;if(!e)return;const n=()=>$t();return e.addEventListener("play",n),e.addEventListener("pause",n),e.addEventListener("seeked",n),()=>{e.removeEventListener("play",n),e.removeEventListener("pause",n),e.removeEventListener("seeked",n)}},[r,M,Se,Te,$,$t,l]),y(()=>{const e=At.current,n=()=>ns(e),s=()=>n();return window.addEventListener("pagehide",s),window.addEventListener("beforeunload",s),()=>{window.removeEventListener("pagehide",s),window.removeEventListener("beforeunload",s),n()}},[]),y(()=>{if(!r){document.title="TV & Movies - dango";return}document.title=f?`${r.title} - dango`:`${r.title} - Season ${i} Episode ${h} - dango`},[r,f,i,h]),y(()=>{if(!r||f)return;const e=new URLSearchParams(p),n=e.get("s"),s=e.get("e"),d=String(i),c=String(h);n===d&&s===c||(e.set("type",p.get("type")||"tv"),e.set("s",d),e.set("e",c),O(`${window.location.pathname}?${e.toString()}`,{replace:!0}))},[r,f,i,h,p,O]),t("div",{className:`${Le.playerPageLayout} ${je?Le.theaterMode:""} ${f?Le.noSidebar:""}`,onClick:Nr,children:[je&&t(ks,{videoRef:l,active:fn.enabled&&!M&&$.length>0&&!Te&&!(r?.adult&&!Bt),settings:fn}),!je&&!f&&t("aside",{className:Le.episodeSidebar,children:r?t(Es,{episodes:ar,currentEpisode:String(h),watchedEpisodes:or,onEpisodeClick:vt,header:en}):t(ws,{variant:"sidebar"})}),t("div",{className:Le.playerMain,children:[r&&t("div",{className:v.playerSection,onContextMenu:e=>e.preventDefault(),style:r.adult&&!Bt?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:M&&_t?t("iframe",{src:_t,className:v.videoIframe,allow:"autoplay; fullscreen",allowFullScreen:!0}):!M&&kt?t("iframe",{src:kt,className:v.videoIframe,allow:"autoplay; fullscreen",allowFullScreen:!0}):!M&&($.length>0||Se)?t(Me,{children:[Te&&t(fr,{error:Te,onRetry:Zt}),t(Po,{player:b,title:r.title,episodeLabel:f?void 0:`S${i} E${h}`,audioTracks:$e,selectedAudioTrack:be,onAudioTrackChange:Wr,subtitles:H,selectedSubtitle:ie,onSubtitleChange:Hr,streams:$,resolutionIdx:we,onResolutionChange:e=>{xn(),De(e)},onBack:Jt,videoDelayEnabled:J,onVideoDelayToggle:de,videoDelayMs:B,onVideoDelayChange:It,onCalibrateAvSync:Fn,subtitleDelayMs:ht,onSubtitleDelayChange:br,showNextEpisodeButton:Cr&&!Ie&&!Ne&&!Ye,onNextEpisode:tr,isLoading:Se,isTheaterMode:je,onTheaterModeToggle:Tn,ambientSettings:fn,onAmbientChange:vr,children:[t("video",{ref:l,autoPlay:tt&&!Pt,playsInline:!0,disablePictureInPicture:!0,className:`${v.video} ${hn?v.videoHidden:""}`,onTimeUpdate:Lr,onEnded:()=>{Ce||Mr()},onPlay:Pr,onPause:Rr,onSeeked:()=>{Zn.current=Date.now(),Rt()},onLoadedMetadata:$r,onVolumeChange:b.actions.onVolumeChange,onWaiting:b.actions.onWaiting,onPlaying:b.actions.onPlaying,onCanPlay:b.actions.onCanPlay,onContextMenu:e=>e.preventDefault(),onError:()=>{L("Video failed to load. Try another server or reload."),Y(!1)}}),t("canvas",{ref:Nt,className:`${v.delayCanvas} ${hn?v.delayCanvasActive:""}`}),ye&&t("div",{ref:xt,className:v.subtitleOverlay}),t(Ns,{isOpen:ln,ms:B,onChange:It,onApply:jt,onClose:cn,testClipActive:Ce,onTestClip:dn})]})]}):Te&&!M?t(fr,{error:Te,onRetry:Zt}):null}),!je&&r&&t(xs,{}),!je&&en&&t("div",{className:v.mobileSeasonRow,children:en}),!je&&r&&t("div",{className:ue.streamPanel,children:[t("div",{className:v.providerSelectWrap,children:t("label",{className:v.controlLabel,children:["Provider",t("select",{value:m,onChange:e=>jr(e.target.value),className:v.select,disabled:q.length===0,children:Ze?t("option",{value:"",children:"Loading..."}):q.length===0?t("option",{value:"",children:"No providers available"}):t(Me,{children:[k.length>0&&t("optgroup",{label:"Direct HLS",children:k.map(e=>t("option",{value:e.id,children:e.label},e.id))}),ne.length>0&&t("optgroup",{label:"Embeds",children:ne.map(e=>t("option",{value:e.id,children:e.label},e.id))})]})})]})}),!M&&(Se?t("div",{className:v.sourceLoader,children:t("div",{className:v.ringSpinner})}):t($o,{servers:dt,selectedServer:Vt?"Embed":ve,onServerSelect:Vr}))]}),!je&&r&&t("div",{className:Le.playerInfoContainer,children:[t("div",{className:Le.playerInfoHeader,children:[t("div",{className:Le.playerAnimeCard,children:r.poster&&t("img",{src:`https://image.tmdb.org/t/p/w342${r.poster}`,alt:r.title,loading:"lazy",decoding:"async"})}),t("div",{className:Le.videoTitleSection,children:[t("div",{className:ue.titleContainer,children:[t("h1",{children:r.title}),t("div",{className:v.meta,children:[t("span",{className:v.year,children:r.year}),r.vote_average!=null&&r.vote_average>0&&t("span",{className:v.rating,children:[t(U,{name:"star",size:12}),Number(r.vote_average).toFixed(1)]}),t("span",{className:`${v.typeBadge} ${v[f?"movie":"tv"]}`,children:f?"Movie":"TV Show"})]}),ir.length>0&&t("div",{className:v.genreRow,children:ir.map(e=>t("span",{className:v.genreChip,children:e},e))}),Nn.length>0&&t("div",{className:v.metaRow,children:Nn.map((e,n)=>t("span",{children:[e,n<Nn.length-1?" · ":""]},`${e}-${n}`))})]}),t("div",{className:ue.controls,children:[t("button",{className:`${ue.watchlistBtn} ${Ht?ue.inList:""}`,onClick:Tr,disabled:Sr,type:"button",children:[Ht?t(U,{name:"check",size:14}):t(U,{name:"plus",size:14}),Ht?"In Watchlist":"Add to Watchlist"]}),!f&&t(Me,{children:[t("button",{className:`${ue.watchlistBtn}`,onClick:()=>bn!=null&&vt(String(bn)),disabled:bn==null,type:"button",children:[t(U,{name:"chevron-left",size:14}),"Prev EP"]}),t("button",{className:`${ue.watchlistBtn}`,onClick:()=>x!=null&&vt(String(x)),disabled:x==null,type:"button",children:["Next EP",t(U,{name:"chevron-right",size:14})]}),!f&&t("button",{className:`${ue.watchlistBtn} ${ue.modeToggleBtn} ${gt?ue.modeToggleActive:""}`,onClick:()=>Br(!gt),type:"button","aria-pressed":gt,children:gt?"AUTOPLAY: ON":"AUTOPLAY: OFF"}),xr&&t("button",{className:`${ue.watchlistBtn}`,onClick:()=>Sn(!0),type:"button",children:[t(U,{name:"list-ul",size:14}),"Episodes"]})]})]})]})]}),t("div",{className:Le.infoColumns,children:[t("div",{className:`${ue.descriptionSection} ${ue.synopsisFlat}`,children:[t("h3",{children:"Synopsis"}),t(Ks,{text:r.overview,emptyText:"No description available."}),t("button",{className:ue.detailsToggleBtn,onClick:()=>Er(!Gt),type:"button",children:[Gt?t(U,{name:"chevron-up"}):t(U,{name:"chevron-down"}),Gt?"Hide Details":"Show Details"]})]}),Gt&&t("div",{className:v.detailGrid,children:[r.first_air_date&&t("div",{className:v.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:v.detailItem,children:[t("strong",{children:"Last Air Date"}),t("span",{children:r.last_air_date})]}),r.networks&&r.networks.length>0&&t("div",{className:v.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:v.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:v.detailItem,children:[t("strong",{children:"Episode Runtime"}),t("span",{children:[r.episode_run_time[0]," min"]})]}),r.imdb_id&&t("div",{className:v.detailItem,children:[t("strong",{children:"IMDb"}),t("a",{href:`https://www.imdb.com/title/${r.imdb_id}`,target:"_blank",rel:"noopener noreferrer",className:v.imdbLink,children:"View on IMDb"})]})]})]})]}),!f&&t(Is,{isOpen:wr,onClose:()=>Sn(!1),episodes:ar,currentEpisode:String(h),watchedEpisodes:or,onEpisodeClick:vt,header:en}),r?.adult&&!Bt&&t(Mn,{isOpen:!0,title:"Content Warning",onClose:Jt,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," ","(or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(Ue,{variant:"secondary",onClick:Jt,children:"Go Back"}),t(Ue,{onClick:yr,children:"I'm 18+, Continue"})]})]})}),t(Bs,{isOpen:Ie,onClose:er,title:"Resume Watching",message:t(Me,{children:["You were at ",t("strong",{children:on(ft)})]}),restartLabel:"Start from Beginning",onResume:zr,onRestart:er}),t(Mn,{isOpen:Ne,onClose:Dr,title:f?"Movie Completed":"Episode Completed",children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:f?t(Me,{children:"You've already watched this movie."}):t(Me,{children:["You've already watched"," ",t("strong",{children:["Season ",i," Episode ",h]}),". Would you like to continue?"]})}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center",flexWrap:"wrap"},children:[t(Ue,{variant:"secondary",onClick:Or,children:"Replay"}),x!=null?t(Ue,{onClick:tr,children:["Watch EP ",x]}):_e!=null?t(Ue,{onClick:nr,children:["Start Season ",_e]}):null]})]})}),t(Mn,{isOpen:Ye,onClose:()=>nt(!1),title:f?"Movie Completed!":_e!=null?"Season Complete!":"Show Completed!",children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t(U,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),t("p",{style:{fontSize:"1.1rem",fontWeight:600},children:kr}),t("p",{style:{color:"var(--text-secondary)"},children:f?"You finished this movie!":_e!=null?`You finished Season ${i}.`:"Congratulations! You finished all available episodes."}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center",flexWrap:"wrap"},children:[t(Ue,{variant:"secondary",onClick:()=>nt(!1),children:"Close"}),_e!=null?t(Ue,{onClick:nr,children:["Start Season ",_e]}):t(Me,{children:[t(Ue,{onClick:()=>{nt(!1),Jt()},children:"Back to Details"}),Ht&&t(Ue,{onClick:Fr,disabled:Wt.isPending,children:Wt.isPending?"Saving...":"Move to Completed"})]})]})]})}),!r&&t("div",{className:v.statusMsg,children:[t(U,{name:"spinner",className:v.spinner})," Loading..."]})]})]})};export{Ja as default};
|
|
@@ -1 +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{e as j,t as U,B as w}from"./index-
|
|
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{e as j,t as U,B as w}from"./index-VzVAYX5A.js";import{n as H,d as J,e as K,f as Q,t as I}from"./useTvLibrary-DDReryyQ.js";import"./vendor-query-BBT5_sHx.js";const X="_container_198yg_1",Y="_heroSection_198yg_11",Z="_bannerContainer_198yg_17",ee="_banner_198yg_17",ne="_bannerOverlay_198yg_37",te="_heroContent_198yg_49",se="_posterContainer_198yg_62",ae="_poster_198yg_62",oe="_infoGlass_198yg_86",ie="_title_198yg_100",re="_quickMeta_198yg_110",le="_metaItem_198yg_118",ce="_iconStar_198yg_126",de="_iconTv_198yg_130",me="_iconType_198yg_134",_e="_genres_198yg_139",he="_genre_198yg_139",ge="_metaRow_198yg_156",ve="_metaValue_198yg_164",pe="_metaDivider_198yg_168",ye="_synopsisSection_198yg_173",ue="_sectionTitleSmall_198yg_179",ke="_synopsis_198yg_173",be="_actions_198yg_196",Ne="_watchBtn_198yg_202",Se="_watchlistBtn_198yg_226",fe="_active_198yg_250",Ce="_seasonPickerLabel_198yg_256",Te="_seasonSelect_198yg_267",we="_detailsToggleBtn_198yg_286",Ie="_expandedContent_198yg_304",Be="_detailGrid_198yg_309",De="_detailItem_198yg_315",Me="_imdbLink_198yg_333",Le="_heroSkeleton_198yg_343",Pe="_skeletonBanner_198yg_347",$e="_skeletonContent_198yg_354",Ge="_skeletonPoster_198yg_365",xe="_skeletonInfo_198yg_373",Oe="_skeletonTitle_198yg_380",Ae="_skeletonMeta_198yg_388",Ve="_skeletonDesc_198yg_396",We="_skeletonActions_198yg_404",ze="_errorState_198yg_413",Re="_matureOverlay_198yg_434",qe="_matureContent_198yg_444",n={container:X,heroSection:Y,bannerContainer:Z,banner:ee,bannerOverlay:ne,heroContent:te,posterContainer:se,poster:ae,infoGlass:oe,title:ie,quickMeta:re,metaItem:le,iconStar:ce,iconTv:de,iconType:me,genres:_e,genre:he,metaRow:ge,metaValue:ve,metaDivider:pe,synopsisSection:ye,sectionTitleSmall:ue,synopsis:ke,actions:be,watchBtn:Ne,watchlistBtn:Se,active:fe,seasonPickerLabel:Ce,seasonSelect:Te,detailsToggleBtn:we,expandedContent:Ie,detailGrid:Be,detailItem:De,imdbLink:Me,heroSkeleton:Le,skeletonBanner:Pe,skeletonContent:$e,skeletonPoster:Ge,skeletonInfo:xe,skeletonTitle:Oe,skeletonMeta:Ae,skeletonDesc:Ve,skeletonActions:We,errorState:ze,matureOverlay:Re,matureContent:qe};function Je(){const{id:o}=R(),c=q(),[B]=E(),i=H(B.get("type")),{hasConsent:D}=j(),[t,M]=l(null),[L,_]=l(!0),[y,u]=l(""),[d,P]=l(!1),[h,$]=l(1),G=J(i,o),x=Number(o),{data:O}=K(t?G:void 0),g=!!O?.inLibrary,{toggle:A}=Q();C(()=>{o&&(_(!0),u(""),U.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=>{u(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(y||!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:y||"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("img",{src:b,alt:t.title,className:n.poster,decoding:"async"})}),e("div",{className:n.infoGlass,children:[e("div",{className:n.topInfo,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.target.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{Je as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as b,d as v,h as P,T as z,u as e,S,L as p}from"./vendor-core-DfaOB3Rn.js";import{I as i}from"./vendor-icons-DrybRNxP.js";import{f as W,d as B,c as D,t as L}from"./useTvLibrary-
|
|
1
|
+
import{A as b,d as v,h as P,T as z,u as e,S,L as p}from"./vendor-core-DfaOB3Rn.js";import{I as i}from"./vendor-icons-DrybRNxP.js";import{f as W,d as B,c as D,t as L}from"./useTvLibrary-DDReryyQ.js";import{t as M}from"./index-VzVAYX5A.js";import{p as a,a as A}from"./MediaCard-tBWyjKaV.js";const R=({item:s,anchorRect:m,onMouseEnter:u,onMouseLeave:g,onRequestClose:r})=>{const d=b(!1),[n,N]=v(null),[f,l]=v(!0),{toggle:y,bookmarkedIds:w}=W(),I=B(s.type,s.id),c=w.has(I);P(()=>{let t=!1;return l(!0),M.tv.details.query({type:s.type,id:String(s.id)}).then(o=>{t||(N({overview:o.overview,vote_average:o.vote_average,number_of_seasons:o.number_of_seasons}),l(!1))}).catch(()=>{t||l(!1)}),()=>{t=!0}},[s.id,s.type]);const h=z(()=>n?.genres?n.genres.slice(0,4).map(t=>t.name):[],[n?.genres]),k=D(s.type,s.id),T=L(s.type,s.id),_=t=>{t.preventDefault(),t.stopPropagation(),y({tmdbId:s.id,mediaType:s.type,title:s.title,poster:s.image,year:s.year})};return e(A,{anchorRect:m,onMouseEnter:()=>{d.current=!0,u()},onMouseLeave:()=>{d.current=!1,g()},onRequestClose:r,children:[e("div",{className:a.header,children:e("div",{className:a.title,children:s.title})}),e("div",{className:a.body,children:f?e("div",{className:a.loading,children:[e("div",{className:a.spinner}),e("span",{children:"Fetching details..."})]}):e(S,{children:[e("div",{className:a.metaRow,children:[n?.vote_average!=null&&n.vote_average>0&&e("div",{className:a.metaItem,children:[e(i,{name:"star",className:a.scoreIcon,size:14}),e("span",{children:Number(n.vote_average).toFixed(1)})]}),e("div",{className:a.metaItem,children:[e(i,{name:"tv",size:14}),e("span",{children:s.type==="tv"?"TV Show":"Movie"})]}),s.year&&e("div",{className:a.metaItem,children:e("span",{children:s.year})}),n?.status&&e("div",{className:a.metaItem,children:e("span",{children:n.status})})]}),h.length>0&&e("div",{className:a.genres,children:h.map(t=>e("span",{className:a.genre,children:t},t))}),n?.overview&&e("div",{className:a.synopsis,children:n.overview.length>200?n.overview.slice(0,200)+"...":n.overview})]})}),e("div",{className:a.footer,children:[e("div",{className:a.primaryAction,children:e(p,{to:T,className:a.watchBtn,onClick:r,children:[e(i,{name:"play",size:14}),"Watch now"]})}),e("div",{className:a.secondaryActions,children:[e("button",{className:`${a.watchlistBtn} ${c?a.active:""}`,onClick:_,children:[c?e(i,{name:"check",size:12}):e(i,{name:"plus",size:12}),e("span",{children:c?"Remove":"Watchlist"})]}),e(p,{to:k,className:a.detailsBtn,onClick:r,children:[e(i,{name:"info-circle",size:12}),e("span",{children:"Details"})]})]})]})]})};export{R as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as W,p as ae,A as re,d as o,T as z,q as A,u as t}from"./vendor-core-DfaOB3Rn.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{P as I,S as ne}from"./SkeletonGrid-
|
|
1
|
+
import{h as W,p as ae,A as re,d as o,T as z,q as A,u as t}from"./vendor-core-DfaOB3Rn.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{P as I,S as ne}from"./SkeletonGrid-DJKwfPjg.js";import{a as se,T as le}from"./useTv-DrhnOiw6.js";import{u as ie,N as oe,B as x}from"./index-VzVAYX5A.js";import{E as ce}from"./ErrorMessage-DAxegITP.js";import{s as r}from"./Search.module-CMEai-B-.js";import"./MediaCard-tBWyjKaV.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./TvPopup-CM8RMOwX.js";import"./useTvLibrary-DDReryyQ.js";import"./vendor-query-BBT5_sHx.js";const de=[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}],me=[{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"}],Y={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",10762:"Kids",9648:"Mystery",10765:"Sci-Fi & Fantasy",37:"Western"},H={28:"Action",12:"Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",14:"Fantasy",36:"History",27:"Horror",9648:"Mystery",10749:"Romance",878:"Sci-Fi",53:"Thriller",10752:"War",37:"Western"},O=new Date().getFullYear(),ue=[{value:"ALL",label:"All Years"},...Array.from({length:O-1980+1},(l,u)=>({value:String(O-u),label:String(O-u)}))];function Me(){W(()=>{document.title="Search TV & Movies - dango"},[]);const[l,u]=ae(),{lowEndMode:K}=ie(),C=re(null),[g,Q]=o(l.get("q")||""),[h,U]=o(l.get("q")||""),[m,v]=o(parseInt(l.get("page")||"1",10)||1),[i,J]=o(l.get("type")||"multi"),[$,k]=o(l.get("genre")||""),[y,F]=o(l.get("year")||"ALL"),[f,B]=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}),M=z(()=>{if(i==="tv")return Object.entries(Y).map(([a,n])=>({id:a,name:n}));if(i==="movie")return Object.entries(H).map(([a,n])=>({id:a,name:n}));const e=new Map;for(const[a,n]of Object.entries(Y))e.set(a,n);for(const[a,n]of Object.entries(H))e.set(a,n);return Array.from(e.entries()).map(([a,n])=>({id:a,name:n}))},[i]),S=z(()=>Object.entries(c).filter(([,a])=>a==="include").map(([a])=>a).join(","),[c]),{data:P,isLoading:w,isError:Z,error:ee}=se({query:h,type:i,genre:S,year:y,sort_by:f,page:m}),T=P?.results||[],L=P?.total_pages||0,E=P?.total_results||0,R=m<Math.min(L,500),d=A((e={})=>{const a=new URLSearchParams,n=e.q!==void 0?e.q:h,s=e.type!==void 0?e.type:i,q=e.year!==void 0?e.year:y,G=e.sort!==void 0?e.sort:f,D=e.page!==void 0?e.page:String(m),V=e.genre!==void 0?e.genre:S;n.trim()&&a.set("q",n.trim()),s!=="multi"&&a.set("type",s),V&&a.set("genre",V),q!=="ALL"&&a.set("year",q),G!=="popularity.desc"&&a.set("sort_by",G),D!=="1"&&a.set("page",D),u(a,{replace:!0})},[h,i,y,f,m,S,u]),_=A(()=>{oe(),v(1),U(g),d({q:g,page:"1"}),window.scrollTo({top:0,behavior:"smooth"})},[g,d]),j=A(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=A(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 W(()=>{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(p,{name:"search",className:r.searchIcon}),t("input",{type:"text","data-virtual-keyboard":"true",className:r.searchInput,placeholder:"Search titles...",value:g,onInput:e=>Q(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&_()})]}),t("div",{className:r.searchActions,children:[t("select",{value:i,onChange:e=>{J(e.target.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:_,className:r.searchBtn,children:"Search"}),t("button",{className:`${r.filterToggleBtn} ${b?r.active:""}`,onClick:()=>X(!b),children:[t(p,{name:"filter",size:14}),t("span",{children:"Filters"}),b?t(p,{name:"chevron-up",size:12}):t(p,{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=>B(e.currentTarget.value),children:me.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=>F(e.currentTarget.value),children:ue.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&t("div",{className:r.genreSection,children:[t("label",{className:r.genreLabel,children:"Genres"}),t("div",{className:r.genreContainer,children:M.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({}),F("ALL"),B("popularity.desc"),v(1),d({genre:"",year:"ALL",sort:"popularity.desc",page:"1"})},children:"Reset All"}),t(x,{onClick:_,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=M.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:[h?`Results for "${h}"`:S?"Browsing genres":i==="tv"?"Popular TV Shows":i==="movie"?"Popular Movies":"Trending",E>0&&t("span",{style:{fontWeight:400,color:"var(--text-tertiary)",fontSize:"0.85em",marginLeft:"0.5em"},children:["(",E.toLocaleString(),")"]})]}),T.length>0&&t(I,{page:m,totalPages:Math.max(1,Math.min(L,500)),canGoNext:R,onChange:j,isLoading:w})]}),t("div",{className:`${r.resultsGrid} ${K?r.lowEnd:""}`,children:w?t(ne,{}):T.map(e=>t(le,{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(p,{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(I,{page:m,totalPages:Math.max(1,Math.min(L,500)),canGoNext:R,onChange:j,isLoading:w,variant:"labeled"})})]})}export{Me as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as U,d as v,h as y,T as x,u as l}from"./vendor-core-DfaOB3Rn.js";import{M as N}from"./MediaCard-
|
|
1
|
+
import{o as U,d as v,h as y,T as x,u as l}from"./vendor-core-DfaOB3Rn.js";import{M as N}from"./MediaCard-tBWyjKaV.js";import{L as _}from"./LibraryListPage-4BBrV2Ne.js";import{R as K}from"./ResetProgressModal-CZieLUpX.js";import{T as O}from"./TvPopup-CM8RMOwX.js";import{g as u}from"./index-VzVAYX5A.js";import{l as Q,u as Y,a as q,b as z,h as G,m as Z,o as j,p as D,t as S,i as I,T as k}from"./useTvLibrary-DDReryyQ.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-icons-DrybRNxP.js";import"./SkeletonGrid-DJKwfPjg.js";import"./ErrorMessage-DAxegITP.js";import"./Watchlist.module-XGtVQr1d.js";import"./vendor-query-BBT5_sHx.js";const H=["All","Continue Watching",...k],P=24;function ce(){const{filter:d="All"}=U(),[T,g]=v(1),[s,p]=v(null),[h,c]=v(!1);y(()=>{document.title="TV Watchlist - dango"},[]),y(()=>{g(1)},[d]);const o=d==="Continue Watching",r=Q(o?"All":d,T,P),i=Y(100),b=q(),w=z(),C=G(),W=Z(),B=j(),E=D(),M=x(()=>o?(i.data?.data??[]).map(e=>{const a=e.currentTime??0,t=e.duration??0,f=e.season??e.lastSeason??1,R=e.episode??e.lastEpisode??1,n=e.mediaType==="movie",m=n?"Movie":`S${f} E${R}`,L=e.completed===!0||e.completed===1||t>0&&a>=t*.8;return{key:e.id,libId:e.id,tmdbId:e.tmdbId,mediaType:e.mediaType,title:e.title,poster:e.poster||"",year:e.year,adult:I({adult:e.adult===1}),status:e.status,badge:m,progressPercent:L?100:t>0?a/t*100:0,progressLabel:t>0?L?"Watched":n?`${u(a)} / ${u(t)}`:`${m} · ${u(a)} / ${u(t)}`:m,watchTarget:S(e.mediaType,e.tmdbId,n?void 0:f,n?void 0:R)}}):(r.data?.data??[]).map(e=>({key:e.id,libId:e.id,tmdbId:e.tmdbId,mediaType:e.mediaType,title:e.title,poster:e.poster||"",year:e.year,adult:I({adult:e.adult===1}),status:e.status,badge:e.lastSeason&&e.lastEpisode?`S${e.lastSeason} E${e.lastEpisode}`:void 0,progressPercent:void 0,progressLabel:void 0,watchTarget:S(e.mediaType,e.tmdbId,e.lastSeason??void 0,e.lastEpisode??void 0)})),[o,i.data,r.data]),A=o?i.data?.total??0:r.data?.total??0,V=o?i.isLoading:r.isLoading,$=o?i.error:r.error,F=()=>{s&&(w.mutate({mediaId:s.libId}),h&&b.mutate(s.libId),p(null),c(!1))};return l(_,{headerTitle:"My TV Watchlist",headerSubtitle:"Track and manage your movies and shows",filters:H,filterBy:d,filterBasePath:"/tv-watchlist",continueFilter:"Continue Watching",statusOptions:[...k],entries:M,total:A,isLoading:V,error:$,page:T,pageSize:P,onPageChange:g,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:(e,a)=>W.mutate({ids:e,status:a}),onBulkRemove:e=>{o?E.mutate(e):B.mutate(e)},onStatusChange:(e,a)=>C.mutate({id:e,status:a}),onRemoveItem:e=>b.mutate(e),renderCard:e=>l(N,{item:{id:e.libId,title:e.title,thumbnail:e.poster,typeBadge:e.mediaType==="movie"?"Movie":"TV",chapterBadge:e.badge??null,isAdult:e.adult},linkTo:e.watchTarget,hoverIcon:"play",progress:e.progressPercent!==void 0&&e.progressLabel?{percent:e.progressPercent,label:e.progressLabel}:void 0,showProgress:o,metaRow:e.year?l("span",{style:{opacity:.75},children:e.year}):void 0,onRemove:o?()=>p(e):void 0,renderPopup:(a,t)=>l(O,{item:{id:e.tmdbId??0,title:e.title||"",year:e.year||"",type:e.mediaType||"tv",image:e.poster||""},anchorRect:a,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onRequestClose:t.close})}),modals:l(K,{isOpen:!!s,itemName:s?.title,progressKind:"watch",listLabel:"my TV watchlist",alsoRemove:h,onAlsoRemoveChange:c,onClose:()=>{p(null),c(!1)},onConfirm:F})})}export{ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as ge,o as Ke,a as Qe,p as Ve,d as u,A as ve,T as R,u as t,S as He}from"./vendor-core-DfaOB3Rn.js";import{u as Ze,a as fe}from"./vendor-query-BBT5_sHx.js";import{h as Je,u as Xe,d as et,v as tt,w as ye,x as Se,z as at,t as nt,k as st,y as lt,A as rt,C as it,D as ct,E as ot,B as T,M as ae}from"./index-B4AdKbhW.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{A as dt}from"./AnimeCard-DbrG4Bo-.js";import{P as be,S as ut}from"./SkeletonGrid-B5JXhZO4.js";import{E as mt}from"./ErrorMessage-DAxegITP.js";import{s as a}from"./Watchlist.module-XGtVQr1d.js";import"./useAnimeInfoData-CSnwUBuU.js";import"./QueueOptionsButton-CIKT4YcD.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-DedwE5DX.js";import"./useIsMobile-Dvx1uJ82.js";const ht=(d,g)=>{const l=new URLSearchParams(g);return l.delete("page"),l.sort(),`${d}|${l.toString()}`},pt=(d,g)=>{const l=new Set(d);return g.forEach(N=>l.add(N)),l},gt=(d,g)=>{const l=new Set(d);return g.forEach(N=>l.delete(N)),l},Ae=["All","Continue Watching","Watching","Completed","On-Hold","Dropped","Planned"],Le=Ae.slice(2),vt=[{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+)"}],ft=[{value:"ALL",label:"All Seasons"},{value:"WINTER",label:"Winter"},{value:"SPRING",label:"Spring"},{value:"SUMMER",label:"Summer"},{value:"FALL",label:"Fall"}],Wt=()=>{ge(()=>{document.title="Watchlist - dango"},[]);const{filter:d="All"}=Ke(),g=Qe(),[l,N]=Ve(),q=Ze(),ne=Je(),[v,B]=u(parseInt(l.get("page")||"1")),[f,W]=u(l.get("query")||""),[C,K]=u(l.get("sortBy")||"last_added"),[y,P]=u(l.get("type")||"ALL"),[S,I]=u(l.get("season")||"ALL"),[b,$]=u(l.get("year")||"ALL"),[k,F]=u(()=>{const e={},n=l.get("genres")?.split(",").map(r=>r.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(r=>r.trim()).filter(Boolean)||[];return n.forEach(r=>r&&(e[r]="include")),s.forEach(r=>r&&(e[r]="exclude")),e}),[M,Ne]=u(()=>["type","season","year","genres","excludeGenres"].some(e=>l.has(e))),{lowEndMode:Ce}=Xe(),{titlePreference:O}=et(),{data:ke}=tt(),se=ke?.genres||[],Q=ve(null),[c,w]=u(null),[V,D]=u(!1),[le,E]=u(!1),[z,we]=u(!1),[h,L]=u(new Set),H=ve(null),i=d==="Continue Watching",G=R(()=>{const e=new URLSearchParams(l);return e.delete("page"),e.set("titlePreference",O),e.toString()},[l,O]),{data:_,isLoading:xe,error:Re}=ye(G,v,14),{data:U,isLoading:Te,error:Be}=Se(d,G,v,14),{data:We}=ye(G,v+1,14),{data:Pe}=Se(d,G,v+1,14),Z=R(()=>(i?_?.data:U?.data)||[],[i,_,U]),x=R(()=>(i?_?.total:U?.total)||0,[i,_,U]),Y=i?xe:Te,re=i?Re:Be,ie=i?We:Pe;ge(()=>{W(l.get("query")||""),K(l.get("sortBy")||"last_added"),P(l.get("type")||"ALL"),I(l.get("season")||"ALL"),$(l.get("year")||"ALL");const e={},n=l.get("genres")?.split(",").map(o=>o.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(o=>o.trim()).filter(Boolean)||[];n.forEach(o=>o&&(e[o]="include")),s.forEach(o=>o&&(e[o]="exclude")),F(e),B(parseInt(l.get("page")||"1"));const r=ht(d,l);H.current!==null&&H.current!==r&&L(new Set),H.current=r},[l,d]);const Ie=fe({mutationFn:async({id:e,status:n})=>{await nt.watchlist.setStatus.mutate({id:e,status:n})},onSuccess:()=>{q.invalidateQueries({queryKey:["watchlist"]}),at.success("Status updated")}}),$e=fe(ne.continueWatching.remove.mutationOptions({onSuccess:()=>{q.invalidateQueries(ne.continueWatching.pathFilter()),q.invalidateQueries({queryKey:["allContinueWatching"]})}})),J=st(),{data:ce}=lt("skipRemoveConfirmation"),Fe=rt(),X=R(()=>{const e=n=>n[O]||n.name||"";return[...Z].sort((n,s)=>C==="name_asc"?e(n).localeCompare(e(s)):C==="name_desc"?e(s).localeCompare(e(n)):0)},[Z,C,O]),ee=new Date().getFullYear(),Me=[{value:"ALL",label:"All Years"},...Array.from({length:ee-1980+1},(e,n)=>({value:String(ee-n),label:String(ee-n)}))],m=(e=C,n=1)=>{const s=new URLSearchParams;f.trim()&&s.set("query",f.trim()),e!=="last_added"&&s.set("sortBy",e),y!=="ALL"&&s.set("type",y),S!=="ALL"&&s.set("season",S),b!=="ALL"&&s.set("year",b);const r=Object.entries(k).filter(([,A])=>A==="include").map(([A])=>A),o=Object.entries(k).filter(([,A])=>A==="exclude").map(([A])=>A);r.length>0&&s.set("genres",r.join(",")),o.length>0&&s.set("excludeGenres",o.join(",")),n>1&&s.set("page",n.toString()),N(s),n!==v&&B(n)},oe=e=>{if(m(C,e),Q.current){const n=Q.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},Oe=()=>{W(""),K("last_added"),P("ALL"),I("ALL"),$("ALL"),F({}),N(new URLSearchParams),B(1)},De=e=>{F(n=>{const s=n[e],r={...n};return s==="include"?r[e]="exclude":s==="exclude"?delete r[e]:r[e]="include",r})},de=(e,n)=>{if(i){w({id:e,name:n});return}String(ce)==="true"||String(ce)==="1"?J.mutate({id:e}):w({id:e,name:n})},Ee=()=>{if(c){if(c.ids){i?(ze.mutate({ids:c.ids}),V&&me.mutate({ids:c.ids})):me.mutate({ids:c.ids}),L(new Set),w(null),D(!1),E(!1);return}i?($e.mutate({showId:c.id}),V&&J.mutate({id:c.id})):J.mutate({id:c.id}),le&&Fe.mutate({key:"skipRemoveConfirmation",value:!0}),w(null),D(!1),E(!1)}},ue=()=>{w(null),D(!1),E(!1)},me=it(),ze=ct(),Ge=ot(),_e=()=>{we(e=>{const n=!e;return n||L(new Set),n})},Ue=e=>{L(n=>{const s=new Set(n);return s.has(e)?s.delete(e):s.add(e),s})},j=X.map(e=>e.id),te=j.length>0&&j.every(e=>h.has(e)),Ye=()=>{L(te?e=>gt(e,j):e=>pt(e,j))},je=e=>{h.size!==0&&(Ge.mutate({ids:[...h],status:e}),L(new Set))},qe=()=>{h.size!==0&&w({ids:[...h]})},he=Z.length>=14&&ie&&ie.data.length>0,pe=R(()=>Math.max(1,Math.ceil(x/14)),[x]);return t("div",{className:"page-container",children:[t("header",{className:a.header,children:[t("h2",{className:a.title,children:"My Watchlist"}),t("p",{className:a.subtitle,children:"Track and manage your anime collection"})]}),t("div",{className:a.controls,children:[t("div",{className:a.filters,children:Ae.map(e=>t("button",{className:`${a.filterBtn} ${d===e?a.active:""}`,onClick:()=>{const n=new URLSearchParams(l);n.delete("page"),g({pathname:`/watchlist/${e}`,search:n.toString()}),B(1)},children:e},e))}),t("div",{children:t("select",{className:a.sortSelect,value:C,onChange:e=>{const n=e.currentTarget.value;K(n),m(n,v)},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:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(p,{name:"search",className:a.searchIcon}),t("input",{className:a.searchInput,placeholder:"Search your watchlist by title...",value:f,onInput:e=>W(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&m()})]}),t("div",{className:a.searchActions,children:[t(T,{onClick:()=>m(),className:a.searchBtn,children:"Search"}),t("button",{className:`${a.filterToggleBtn} ${M?a.active:""}`,onClick:()=>Ne(!M),children:[t(p,{name:"filter",size:14}),t("span",{children:"Filters"}),M?t(p,{name:"chevron-up",size:12}):t(p,{name:"chevron-down",size:12})]})]})]}),t("div",{className:`${a.advancedFilters} ${M?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Type"}),t("select",{value:y,onChange:e=>P(e.currentTarget.value),children:vt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:S,onChange:e=>I(e.currentTarget.value),children:ft.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:b,onChange:e=>$(e.currentTarget.value),children:Me.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),se.length>0&&t("div",{className:a.genreSection,children:[t("label",{className:a.genreLabel,children:"Genres"}),t("div",{className:a.genreContainer,children:se.map(e=>t("button",{className:`${a.genreButton} ${a[k[e]||""]}`,onClick:()=>De(e),children:e},e))})]}),t("div",{className:a.filterActions,children:[t(T,{variant:"secondary",onClick:Oe,children:"Reset All"}),t(T,{onClick:()=>m(),className:a.applyBtn,children:"Apply Filters"})]})]})]}),t("div",{className:a.resultsHeader,ref:Q,children:[t("h3",{className:a.resultsTitle,children:[i?"Continue Watching":d,t("span",{className:a.itemCount,children:["(",x," items)"]})]}),t("div",{className:a.headerActions,children:[t("button",{className:`${a.manageBtn} ${z?a.active:""}`,onClick:_e,children:[t(p,{name:"pencil-alt",size:13}),t("span",{children:"Bulk Manage"})]}),x>0&&t(be,{page:v,totalPages:pe,canGoNext:he,onChange:oe,isLoading:Y})]})]}),z&&t("div",{className:a.manageBar,children:[t("button",{className:a.selectAllBtn,onClick:Ye,children:[t("span",{className:`${a.selectAllBox} ${te?a.selectAllBoxChecked:""}`,"aria-hidden":"true"}),t("span",{children:te?"Clear Page":"Select All"})]}),t("span",{className:a.manageCount,children:[h.size," selected"]}),t("div",{className:a.manageSpacer}),!i&&t("select",{className:a.manageStatusSelect,value:"",onChange:e=>{e.currentTarget.value&&je(e.currentTarget.value)},disabled:h.size===0,title:"Set status for selected items",children:[t("option",{value:"",children:"Set status…"}),Le.map(e=>t("option",{value:e,children:e},e))]}),t("button",{className:a.manageRemoveBtn,onClick:qe,disabled:h.size===0,children:[t(p,{name:"trash",size:13}),t("span",{children:"Remove Selected"})]})]}),Y?t(ut,{}):re?t(mt,{message:re.message}):t(He,{children:[(y!=="ALL"||S!=="ALL"||b!=="ALL"||Object.keys(k).length>0||f.trim())&&t("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[t("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),f.trim()&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Search: ",f,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),W(""),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),y!=="ALL"&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",y,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),P("ALL"),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),S!=="ALL"&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",S,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),I("ALL"),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),b!=="ALL"&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",b,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),$("ALL"),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(k).map(([e,n])=>t("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,t("button",{onClick:s=>{s.stopPropagation(),s.preventDefault(),F(r=>{const o={...r};return delete o[e],o}),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),t("div",{className:`${a.grid} ${Ce?a.lowEnd:""}`,children:X.map(e=>{const n=h.has(e.id);return t("div",{className:`${a.itemWrapper} ${n?a.selected:""}`,children:[z&&t("div",{className:a.selectOverlay,onClick:()=>Ue(e.id),title:n?"Deselect":"Select",children:t("span",{className:a.selectBadge,children:n?t(p,{name:"check",size:12}):null})}),t(dt,{anime:e,continueWatching:i,onRemove:()=>de(e.id,e.name),layout:"vertical"}),!i&&!z&&t("div",{className:a.cardActions,children:[t("select",{className:a.statusSelect,value:e.status,onChange:s=>Ie.mutate({id:e.id,status:s.currentTarget.value}),children:Le.map(s=>t("option",{value:s,children:s},s))}),t("button",{className:a.removeBtn,onClick:()=>de(e.id,e.name),title:"Remove from Watchlist","aria-label":"Remove from Watchlist",children:t(p,{name:"trash",size:12})})]})]},e._id)})})]}),!Y&&X.length===0&&t("div",{className:a.emptyState,children:[t("h3",{className:a.emptyTitle,children:"Your watchlist is looking a bit lonely"}),t("p",{className:a.emptyText,children:d!=="All"||f||y!=="ALL"||S!=="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:a.emptyBtn,onClick:()=>g("/search"),children:[t(p,{name:"search",size:14}),t("span",{children:"Browse Anime"})]})]}),x>0&&t("div",{className:a.bottomPagination,children:t(be,{page:v,totalPages:pe,canGoNext:he,onChange:oe,isLoading:Y,variant:"labeled"})}),t(ae,{isOpen:!!c,onClose:ue,title:i?"Reset Progress":"Remove from Watchlist",children:[t(ae.Body,{children:[t("p",{children:c?.ids&&c.ids.length>1?i?`Are you sure you want to remove watch progress for ${c.ids.length} items?`:`Are you sure you want to remove ${c.ids.length} items from your watchlist?`:i?`Are you sure you want to remove your watch progress for "${c?.name}"?`:`Are you sure you want to remove "${c?.name}" from your watchlist?`}),i&&t("label",{children:[t("input",{type:"checkbox",checked:V,onChange:e=>D(e.target.checked)}),"Also remove from my watchlist"]}),!i&&!(c?.ids&&c.ids.length>1)&&t("label",{children:[t("input",{type:"checkbox",checked:le,onChange:e=>E(e.target.checked)}),"Remember my choice"]})]}),t(ae.Actions,{children:[t(T,{variant:"secondary",onClick:ue,children:"No"}),t(T,{variant:"danger",onClick:Ee,children:"Yes"})]})]})]})};export{Wt as default};
|
|
1
|
+
import{h as ge,o as Ke,a as Qe,p as Ve,d as u,A as ve,T as R,u as t,S as He}from"./vendor-core-DfaOB3Rn.js";import{u as Ze,a as fe}from"./vendor-query-BBT5_sHx.js";import{h as Je,u as Xe,d as et,v as tt,w as ye,x as Se,z as at,t as nt,k as st,y as lt,A as rt,C as it,D as ct,E as ot,B as T,M as ae}from"./index-VzVAYX5A.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{A as dt}from"./AnimeCard-KCdQSFYo.js";import{P as be,S as ut}from"./SkeletonGrid-DJKwfPjg.js";import{E as mt}from"./ErrorMessage-DAxegITP.js";import{s as a}from"./Watchlist.module-XGtVQr1d.js";import"./useAnimeInfoData-BpD2dXLB.js";import"./QueueOptionsButton-BN-6sbNV.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-tBWyjKaV.js";import"./useIsMobile-Dvx1uJ82.js";const ht=(d,g)=>{const l=new URLSearchParams(g);return l.delete("page"),l.sort(),`${d}|${l.toString()}`},pt=(d,g)=>{const l=new Set(d);return g.forEach(N=>l.add(N)),l},gt=(d,g)=>{const l=new Set(d);return g.forEach(N=>l.delete(N)),l},Ae=["All","Continue Watching","Watching","Completed","On-Hold","Dropped","Planned"],Le=Ae.slice(2),vt=[{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+)"}],ft=[{value:"ALL",label:"All Seasons"},{value:"WINTER",label:"Winter"},{value:"SPRING",label:"Spring"},{value:"SUMMER",label:"Summer"},{value:"FALL",label:"Fall"}],Wt=()=>{ge(()=>{document.title="Watchlist - dango"},[]);const{filter:d="All"}=Ke(),g=Qe(),[l,N]=Ve(),q=Ze(),ne=Je(),[v,B]=u(parseInt(l.get("page")||"1")),[f,W]=u(l.get("query")||""),[C,K]=u(l.get("sortBy")||"last_added"),[y,P]=u(l.get("type")||"ALL"),[S,I]=u(l.get("season")||"ALL"),[b,$]=u(l.get("year")||"ALL"),[k,F]=u(()=>{const e={},n=l.get("genres")?.split(",").map(r=>r.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(r=>r.trim()).filter(Boolean)||[];return n.forEach(r=>r&&(e[r]="include")),s.forEach(r=>r&&(e[r]="exclude")),e}),[M,Ne]=u(()=>["type","season","year","genres","excludeGenres"].some(e=>l.has(e))),{lowEndMode:Ce}=Xe(),{titlePreference:O}=et(),{data:ke}=tt(),se=ke?.genres||[],Q=ve(null),[c,w]=u(null),[V,D]=u(!1),[le,E]=u(!1),[z,we]=u(!1),[h,L]=u(new Set),H=ve(null),i=d==="Continue Watching",G=R(()=>{const e=new URLSearchParams(l);return e.delete("page"),e.set("titlePreference",O),e.toString()},[l,O]),{data:_,isLoading:xe,error:Re}=ye(G,v,14),{data:U,isLoading:Te,error:Be}=Se(d,G,v,14),{data:We}=ye(G,v+1,14),{data:Pe}=Se(d,G,v+1,14),Z=R(()=>(i?_?.data:U?.data)||[],[i,_,U]),x=R(()=>(i?_?.total:U?.total)||0,[i,_,U]),Y=i?xe:Te,re=i?Re:Be,ie=i?We:Pe;ge(()=>{W(l.get("query")||""),K(l.get("sortBy")||"last_added"),P(l.get("type")||"ALL"),I(l.get("season")||"ALL"),$(l.get("year")||"ALL");const e={},n=l.get("genres")?.split(",").map(o=>o.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(o=>o.trim()).filter(Boolean)||[];n.forEach(o=>o&&(e[o]="include")),s.forEach(o=>o&&(e[o]="exclude")),F(e),B(parseInt(l.get("page")||"1"));const r=ht(d,l);H.current!==null&&H.current!==r&&L(new Set),H.current=r},[l,d]);const Ie=fe({mutationFn:async({id:e,status:n})=>{await nt.watchlist.setStatus.mutate({id:e,status:n})},onSuccess:()=>{q.invalidateQueries({queryKey:["watchlist"]}),at.success("Status updated")}}),$e=fe(ne.continueWatching.remove.mutationOptions({onSuccess:()=>{q.invalidateQueries(ne.continueWatching.pathFilter()),q.invalidateQueries({queryKey:["allContinueWatching"]})}})),J=st(),{data:ce}=lt("skipRemoveConfirmation"),Fe=rt(),X=R(()=>{const e=n=>n[O]||n.name||"";return[...Z].sort((n,s)=>C==="name_asc"?e(n).localeCompare(e(s)):C==="name_desc"?e(s).localeCompare(e(n)):0)},[Z,C,O]),ee=new Date().getFullYear(),Me=[{value:"ALL",label:"All Years"},...Array.from({length:ee-1980+1},(e,n)=>({value:String(ee-n),label:String(ee-n)}))],m=(e=C,n=1)=>{const s=new URLSearchParams;f.trim()&&s.set("query",f.trim()),e!=="last_added"&&s.set("sortBy",e),y!=="ALL"&&s.set("type",y),S!=="ALL"&&s.set("season",S),b!=="ALL"&&s.set("year",b);const r=Object.entries(k).filter(([,A])=>A==="include").map(([A])=>A),o=Object.entries(k).filter(([,A])=>A==="exclude").map(([A])=>A);r.length>0&&s.set("genres",r.join(",")),o.length>0&&s.set("excludeGenres",o.join(",")),n>1&&s.set("page",n.toString()),N(s),n!==v&&B(n)},oe=e=>{if(m(C,e),Q.current){const n=Q.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},Oe=()=>{W(""),K("last_added"),P("ALL"),I("ALL"),$("ALL"),F({}),N(new URLSearchParams),B(1)},De=e=>{F(n=>{const s=n[e],r={...n};return s==="include"?r[e]="exclude":s==="exclude"?delete r[e]:r[e]="include",r})},de=(e,n)=>{if(i){w({id:e,name:n});return}String(ce)==="true"||String(ce)==="1"?J.mutate({id:e}):w({id:e,name:n})},Ee=()=>{if(c){if(c.ids){i?(ze.mutate({ids:c.ids}),V&&me.mutate({ids:c.ids})):me.mutate({ids:c.ids}),L(new Set),w(null),D(!1),E(!1);return}i?($e.mutate({showId:c.id}),V&&J.mutate({id:c.id})):J.mutate({id:c.id}),le&&Fe.mutate({key:"skipRemoveConfirmation",value:!0}),w(null),D(!1),E(!1)}},ue=()=>{w(null),D(!1),E(!1)},me=it(),ze=ct(),Ge=ot(),_e=()=>{we(e=>{const n=!e;return n||L(new Set),n})},Ue=e=>{L(n=>{const s=new Set(n);return s.has(e)?s.delete(e):s.add(e),s})},j=X.map(e=>e.id),te=j.length>0&&j.every(e=>h.has(e)),Ye=()=>{L(te?e=>gt(e,j):e=>pt(e,j))},je=e=>{h.size!==0&&(Ge.mutate({ids:[...h],status:e}),L(new Set))},qe=()=>{h.size!==0&&w({ids:[...h]})},he=Z.length>=14&&ie&&ie.data.length>0,pe=R(()=>Math.max(1,Math.ceil(x/14)),[x]);return t("div",{className:"page-container",children:[t("header",{className:a.header,children:[t("h2",{className:a.title,children:"My Watchlist"}),t("p",{className:a.subtitle,children:"Track and manage your anime collection"})]}),t("div",{className:a.controls,children:[t("div",{className:a.filters,children:Ae.map(e=>t("button",{className:`${a.filterBtn} ${d===e?a.active:""}`,onClick:()=>{const n=new URLSearchParams(l);n.delete("page"),g({pathname:`/watchlist/${e}`,search:n.toString()}),B(1)},children:e},e))}),t("div",{children:t("select",{className:a.sortSelect,value:C,onChange:e=>{const n=e.currentTarget.value;K(n),m(n,v)},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:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(p,{name:"search",className:a.searchIcon}),t("input",{className:a.searchInput,placeholder:"Search your watchlist by title...",value:f,onInput:e=>W(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&m()})]}),t("div",{className:a.searchActions,children:[t(T,{onClick:()=>m(),className:a.searchBtn,children:"Search"}),t("button",{className:`${a.filterToggleBtn} ${M?a.active:""}`,onClick:()=>Ne(!M),children:[t(p,{name:"filter",size:14}),t("span",{children:"Filters"}),M?t(p,{name:"chevron-up",size:12}):t(p,{name:"chevron-down",size:12})]})]})]}),t("div",{className:`${a.advancedFilters} ${M?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Type"}),t("select",{value:y,onChange:e=>P(e.currentTarget.value),children:vt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:S,onChange:e=>I(e.currentTarget.value),children:ft.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:b,onChange:e=>$(e.currentTarget.value),children:Me.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),se.length>0&&t("div",{className:a.genreSection,children:[t("label",{className:a.genreLabel,children:"Genres"}),t("div",{className:a.genreContainer,children:se.map(e=>t("button",{className:`${a.genreButton} ${a[k[e]||""]}`,onClick:()=>De(e),children:e},e))})]}),t("div",{className:a.filterActions,children:[t(T,{variant:"secondary",onClick:Oe,children:"Reset All"}),t(T,{onClick:()=>m(),className:a.applyBtn,children:"Apply Filters"})]})]})]}),t("div",{className:a.resultsHeader,ref:Q,children:[t("h3",{className:a.resultsTitle,children:[i?"Continue Watching":d,t("span",{className:a.itemCount,children:["(",x," items)"]})]}),t("div",{className:a.headerActions,children:[t("button",{className:`${a.manageBtn} ${z?a.active:""}`,onClick:_e,children:[t(p,{name:"pencil-alt",size:13}),t("span",{children:"Bulk Manage"})]}),x>0&&t(be,{page:v,totalPages:pe,canGoNext:he,onChange:oe,isLoading:Y})]})]}),z&&t("div",{className:a.manageBar,children:[t("button",{className:a.selectAllBtn,onClick:Ye,children:[t("span",{className:`${a.selectAllBox} ${te?a.selectAllBoxChecked:""}`,"aria-hidden":"true"}),t("span",{children:te?"Clear Page":"Select All"})]}),t("span",{className:a.manageCount,children:[h.size," selected"]}),t("div",{className:a.manageSpacer}),!i&&t("select",{className:a.manageStatusSelect,value:"",onChange:e=>{e.currentTarget.value&&je(e.currentTarget.value)},disabled:h.size===0,title:"Set status for selected items",children:[t("option",{value:"",children:"Set status…"}),Le.map(e=>t("option",{value:e,children:e},e))]}),t("button",{className:a.manageRemoveBtn,onClick:qe,disabled:h.size===0,children:[t(p,{name:"trash",size:13}),t("span",{children:"Remove Selected"})]})]}),Y?t(ut,{}):re?t(mt,{message:re.message}):t(He,{children:[(y!=="ALL"||S!=="ALL"||b!=="ALL"||Object.keys(k).length>0||f.trim())&&t("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[t("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),f.trim()&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Search: ",f,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),W(""),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),y!=="ALL"&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",y,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),P("ALL"),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),S!=="ALL"&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",S,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),I("ALL"),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),b!=="ALL"&&t("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",b,t("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),$("ALL"),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(k).map(([e,n])=>t("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,t("button",{onClick:s=>{s.stopPropagation(),s.preventDefault(),F(r=>{const o={...r};return delete o[e],o}),m()},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),t("div",{className:`${a.grid} ${Ce?a.lowEnd:""}`,children:X.map(e=>{const n=h.has(e.id);return t("div",{className:`${a.itemWrapper} ${n?a.selected:""}`,children:[z&&t("div",{className:a.selectOverlay,onClick:()=>Ue(e.id),title:n?"Deselect":"Select",children:t("span",{className:a.selectBadge,children:n?t(p,{name:"check",size:12}):null})}),t(dt,{anime:e,continueWatching:i,onRemove:()=>de(e.id,e.name),layout:"vertical"}),!i&&!z&&t("div",{className:a.cardActions,children:[t("select",{className:a.statusSelect,value:e.status,onChange:s=>Ie.mutate({id:e.id,status:s.currentTarget.value}),children:Le.map(s=>t("option",{value:s,children:s},s))}),t("button",{className:a.removeBtn,onClick:()=>de(e.id,e.name),title:"Remove from Watchlist","aria-label":"Remove from Watchlist",children:t(p,{name:"trash",size:12})})]})]},e._id)})})]}),!Y&&X.length===0&&t("div",{className:a.emptyState,children:[t("h3",{className:a.emptyTitle,children:"Your watchlist is looking a bit lonely"}),t("p",{className:a.emptyText,children:d!=="All"||f||y!=="ALL"||S!=="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:a.emptyBtn,onClick:()=>g("/search"),children:[t(p,{name:"search",size:14}),t("span",{children:"Browse Anime"})]})]}),x>0&&t("div",{className:a.bottomPagination,children:t(be,{page:v,totalPages:pe,canGoNext:he,onChange:oe,isLoading:Y,variant:"labeled"})}),t(ae,{isOpen:!!c,onClose:ue,title:i?"Reset Progress":"Remove from Watchlist",children:[t(ae.Body,{children:[t("p",{children:c?.ids&&c.ids.length>1?i?`Are you sure you want to remove watch progress for ${c.ids.length} items?`:`Are you sure you want to remove ${c.ids.length} items from your watchlist?`:i?`Are you sure you want to remove your watch progress for "${c?.name}"?`:`Are you sure you want to remove "${c?.name}" from your watchlist?`}),i&&t("label",{children:[t("input",{type:"checkbox",checked:V,onChange:e=>D(e.target.checked)}),"Also remove from my watchlist"]}),!i&&!(c?.ids&&c.ids.length>1)&&t("label",{children:[t("input",{type:"checkbox",checked:le,onChange:e=>E(e.target.checked)}),"Remember my choice"]})]}),t(ae.Actions,{children:[t(T,{variant:"secondary",onClick:ue,children:"No"}),t(T,{variant:"danger",onClick:Ee,children:"Yes"})]})]})]})};export{Wt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as n}from"./index-
|
|
1
|
+
import{_ as n}from"./index-VzVAYX5A.js";let a=null,e=null;async function r(){return a||(e||(e=n(()=>import("./hls-BOLXTnjL.js"),[]).then(l=>(a=l.default,a)).catch(()=>null)),e)}function c(l){return l.canPlayType("application/vnd.apple.mpegurl")!==""||l.canPlayType("application/x-mpegURL")!==""}export{c,r as l};
|