Files
katelyatv/patches/filter-page-url-chunk.js
T

1 line
17 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[923],{3747:function(e,t,a){Promise.resolve().then(a.bind(a,805))},805:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return v}});var l=a(4393),r=a(5538);let s=(0,a(4123).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var o=a(4908),n=a(6402),i=a(6501);let c=[{label:"全部",value:""},{label:"香港",value:"香港"},{label:"大陆",value:"大陆"},{label:"台湾",value:"台湾"},{label:"美国",value:"美国"},{label:"日本",value:"日本"},{label:"韩国",value:"韩国"},{label:"泰国",value:"泰国"},{label:"英国",value:"英国"},{label:"法国",value:"法国"}],u=[{label:"全部",value:""},{label:"电影",value:"电影"},{label:"电视剧",value:"电视剧"},{label:"连续剧",value:"连续剧"},{label:"综艺",value:"综艺"},{label:"动漫",value:"动漫"},{label:"动作片",value:"动作片"},{label:"喜剧片",value:"喜剧片"},{label:"爱情片",value:"爱情片"},{label:"科幻片",value:"科幻片"},{label:"恐怖片",value:"恐怖片"},{label:"剧情片",value:"剧情片"},{label:"战争片",value:"战争片"},{label:"国产剧",value:"国产剧"},{label:"香港剧",value:"香港剧"},{label:"台湾剧",value:"台湾剧"},{label:"欧美剧",value:"欧美剧"},{label:"韩国剧",value:"韩国剧"},{label:"日本剧",value:"日本剧"},{label:"泰国剧",value:"泰国剧"},{label:"海外剧",value:"海外剧"},{label:"大陆综艺",value:"大陆综艺"},{label:"港台综艺",value:"港台综艺"},{label:"日韩综艺",value:"日韩综艺"},{label:"欧美综艺",value:"欧美综艺"},{label:"国产动漫",value:"国产动漫"},{label:"日韩动漫",value:"日韩动漫"},{label:"欧美动漫",value:"欧美动漫"},{label:"港台动漫",value:"港台动漫"},{label:"记录片",value:"记录片"},{label:"短剧",value:"短剧"}],d=function(){let e=[{label:"全部",value:""}],t=new Date().getFullYear();for(let a=t;a>=t-15;a--)e.push({label:"".concat(a),value:"".concat(a)});return e}();function h(e){let{label:t,options:a,value:r,onChange:s}=e;return(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-400 min-w-[48px]",children:t}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>{let t=r===e.value;return(0,l.jsx)("button",{onClick:()=>s(e.value),className:"px-3 py-1.5 text-xs sm:text-sm font-medium rounded-full transition-all duration-200 whitespace-nowrap ".concat(t?"bg-purple-500 text-white shadow-sm":"bg-gray-200/60 text-gray-700 hover:bg-gray-300/60 dark:bg-gray-700/60 dark:text-gray-300 dark:hover:bg-gray-600/60"),children:e.label},e.value||"all")})})]})}function p(){let[e,t]=(0,o.useState)([]),[a,p]=(0,o.useState)("all"),[v,x]=(0,o.useState)([]),[g,m]=(0,o.useState)(function(){try{return new URLSearchParams(location.search).get("t")||""}catch(e){return""}}()),[b,f]=(0,o.useState)(function(){try{return new URLSearchParams(location.search).get("area")||""}catch(e){return""}}()),[y,w]=(0,o.useState)(function(){try{return new URLSearchParams(location.search).get("year")||""}catch(e){return""}}()),[k,j]=(0,o.useState)([]),[N,C]=(0,o.useState)(!1),[S,_]=(0,o.useState)(!1),[P,R]=(0,o.useState)(1),[E,D]=(0,o.useState)(!0),[Z,I]=(0,o.useState)(""),L=(0,o.useRef)(null),q=(0,o.useRef)(null),z=(0,o.useRef)(0),H="all"===a;(0,o.useEffect)(()=>{try{var q=new URLSearchParams(location.search),t=q.get("t"),ar=q.get("area"),yr=q.get("year");if(t||ar||yr){var tries=0,id=setInterval(function(){tries++;try{var g0=t,gm=0;if(t){m(function(pv){return pv||t})}if(ar)f(function(pv){return pv||ar});if(yr){w(function(pv){return pv||yr})}}catch(e){}if(tries>=1){clearInterval(id)}},60)}}catch(e){}},[]);(0,o.useEffect)(()=>{(async()=>{try{var e;let a=await fetch("/api/filter?action=sources"),l=await a.json();(null===(e=l.sources)||void 0===e?void 0:e.length)&&(t(l.sources),p("all"))}catch(e){I("加载资源站列表失败")}})()},[]),(0,o.useEffect)(()=>{if(H){x([]),m("");return}a&&(async()=>{try{x([]),m("");let e=await fetch("/api/filter?action=classes&source=".concat(encodeURIComponent(a))),t=await e.json();Array.isArray(t.classes)&&x(t.classes)}catch(e){}})()},[a,H]);let M=(0,o.useCallback)(async(e,t)=>{if(!a)return;let l=++z.current;t?(C(!0),I("")):_(!0);try{let r=new URLSearchParams({action:"browse",source:a,pg:String(e)});H?g&&r.set("cat",g):g&&r.set("t",g),b&&r.set("area",b),y&&r.set("year",y);let s=await fetch("/api/filter?".concat(r.toString())),o=await s.json();if(l!==z.current)return;if(o.error){I(o.error);return}let n=Array.isArray(o.list)?o.list:[];j(e=>{let a=t?n:[...e,...n],s=new Set;return a.filter(x=>{let k=x.title+"|"+x.year;return!s.has(k)&&(s.add(k),!0)})}),R(o.next_pg||e+1),D(!!o.has_more&&n.length>0)}catch(e){l===z.current&&I("加载失败,请稍后重试")}finally{l===z.current&&(C(!1),_(!1))}},[a,g,b,y,H]);(0,o.useEffect)(()=>{if(!a)return;j([]),R(1),D(!0);let e=setTimeout(()=>M(1,!0),100);return()=>clearTimeout(e)},[a,g,b,y,M]),(0,o.useEffect)(()=>{if(!E||N||S||!L.current)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&E&&!N&&!S&&M(P,!1)},{threshold:.1});return e.observe(L.current),q.current=e,()=>{q.current&&q.current.disconnect()}},[E,N,S,P,M]);let U=H?u:[{label:"全部",value:""},...v.map(e=>({label:e.type_name,value:e.type_id}))],A=[{label:"全部资源站",value:"all"},...e.map(e=>({label:e.name,value:e.key}))],B=!N&&!S&&0===k.length&&!Z&&!!a;return(0,l.jsx)(n.Z,{activePath:"/filter",children:(0,l.jsxs)("div",{className:"px-2 sm:px-4 py-4 sm:py-8 overflow-visible",children:[(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 mb-1 sm:mb-2 dark:text-gray-200 flex items-center gap-2",children:[(0,l.jsx)(r.Z,{className:"w-7 h-7 text-purple-500"}),"筛选"]}),(0,l.jsx)("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400",children:"按分类、地区(如香港)、年份精准筛选影片"})]}),(0,l.jsxs)("div",{className:"bg-white/60 dark:bg-gray-800/40 rounded-2xl p-4 sm:p-6 border border-gray-200/30 dark:border-gray-700/30 backdrop-blur-sm space-y-4",children:[(0,l.jsx)(h,{label:"资源站",options:A.slice(0,13),value:a,onChange:p}),U.length>1&&(0,l.jsx)(h,{label:"分类",options:U.slice(0,40),value:g,onChange:m}),(0,l.jsx)(h,{label:"地区",options:c,value:b,onChange:f}),(0,l.jsx)(h,{label:"年份",options:d,value:y,onChange:w}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsxs)("button",{onClick:()=>{m(""),f(""),w("")},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs sm:text-sm text-gray-600 hover:text-purple-600 dark:text-gray-400 dark:hover:text-purple-400 transition-colors",children:[(0,l.jsx)(s,{className:"w-4 h-4"}),"重置筛选"]})})]}),(0,l.jsxs)("div",{className:"mt-8",children:[Z&&(0,l.jsx)("div",{className:"text-center text-red-500 py-8",children:Z}),N&&0===k.length&&(0,l.jsx)("div",{className:"grid grid-cols-3 gap-x-2 gap-y-12 sm:grid-cols-[repeat(auto-fill,minmax(140px,1fr))] sm:gap-x-6 sm:gap-y-16",children:Array.from({length:12}).map((e,t)=>(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("div",{className:"relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-purple-200 animate-pulse dark:bg-purple-800",children:(0,l.jsx)("div",{className:"absolute inset-0 bg-purple-300 dark:bg-purple-700"})}),(0,l.jsx)("div",{className:"mt-2 h-4 bg-purple-200 rounded animate-pulse dark:bg-purple-800"})]},t))}),k.length>0&&(0,l.jsx)("div",{className:"grid grid-cols-3 gap-x-2 gap-y-12 px-0 sm:px-1 sm:grid-cols-[repeat(auto-fill,minmax(140px,1fr))] sm:gap-x-6 sm:gap-y-16",children:k.map((e,t)=>(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)(i.Z,{from:"search",id:e.id,source:e.source,source_name:e.source_name,title:e.title,poster:e.poster,year:e.year,episodes:e.episodes,type:e.episodes>1?"tv":"movie"})},"".concat(e.source,"-").concat(e.id,"-").concat(t)))}),B&&(0,l.jsx)("div",{className:"text-center text-gray-500 py-12 dark:text-gray-400",children:"暂无符合条件的内容,试试更换筛选条件或资源站"}),E&&k.length>0&&(0,l.jsx)("div",{ref:e=>{e&&null!==e.offsetParent&&(L.current=e)},className:"flex justify-center mt-12 py-8",children:S&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-purple-500"}),(0,l.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"加载中..."})]})}),!E&&k.length>0&&(0,l.jsx)("div",{className:"text-center text-gray-500 py-8 dark:text-gray-400",children:H?"已聚合展示各资源站结果":"已加载全部内容"})]})]})})}function v(){return(0,l.jsx)(p,{})}},1187:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var l=a(4393);let r=e=>{let{aspectRatio:t}=e;return(0,l.jsx)("div",{className:"w-full ".concat(t," rounded-lg"),style:{background:"linear-gradient(90deg, var(--skeleton-color) 25%, var(--skeleton-highlight) 50%, var(--skeleton-color) 75%)",backgroundSize:"200% 100%",animation:"shine 1.5s infinite"},children:(0,l.jsx)("style",{children:"\n @keyframes shine {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n }\n \n /* 亮色模式变量 */\n :root {\n --skeleton-color: #f0f0f0;\n --skeleton-highlight: #e0e0e0;\n }\n \n /* 暗色模式变量 */\n @media (prefers-color-scheme: dark) {\n :root {\n --skeleton-color: #2d2d2d;\n --skeleton-highlight: #3d3d3d;\n }\n }\n \n .dark {\n --skeleton-color: #2d2d2d;\n --skeleton-highlight: #3d3d3d;\n }\n "})})}},6501:function(e,t,a){"use strict";a.d(t,{Z:function(){return v}});var l=a(4393),r=a(4727),s=a(41),o=a(4187),n=a(9564),i=a(7944),c=a(1698),u=a(4908),d=a(7467),h=a(1802),p=a(1187);function v(e){var t,a,v,x,g,m,b,f;let{id:y,title:w="",query:k="",poster:j="",episodes:N,source:C,source_name:S,progress:_=0,year:P,from:R,currentEpisode:E,douban_id:D,onDelete:Z,rate:I,items:L,type:q=""}=e,z=(0,c.useRouter)(),[H,M]=(0,u.useState)(!1),[U,A]=(0,u.useState)(!1),B="search"===R&&!!(null==L?void 0:L.length),F=(0,u.useMemo)(()=>{if(!B||!L)return null;let e=new Map,t=new Map;L.forEach(a=>{var l;a.douban_id&&0!==a.douban_id&&e.set(a.douban_id,(e.get(a.douban_id)||0)+1);let r=(null===(l=a.episodes)||void 0===l?void 0:l.length)||0;r>0&&t.set(r,(t.get(r)||0)+1)});let a=e=>{let t,a=0;return e.forEach((e,l)=>{e>a&&(a=e,t=l)}),t};return{first:L[0],mostFrequentDoubanId:a(e),mostFrequentEpisodes:a(t)||0}},[B,L]),O=null!==(a=null==F?void 0:F.first.title)&&void 0!==a?a:w,T=null!==(v=null==F?void 0:F.first.poster)&&void 0!==v?v:j,J=null!==(x=null==F?void 0:F.first.source)&&void 0!==x?x:C,W=null!==(g=null==F?void 0:F.first.id)&&void 0!==g?g:y,Y=String(null!==(m=null==F?void 0:F.mostFrequentDoubanId)&&void 0!==m?m:D),G=null!==(b=null==F?void 0:F.mostFrequentEpisodes)&&void 0!==b?b:N,K=null!==(f=null==F?void 0:F.first.year)&&void 0!==f?f:P,Q=k||"",V=B?(null==F?void 0:null===(t=F.first.episodes)||void 0===t?void 0:t.length)===1?"movie":"tv":q;(0,u.useEffect)(()=>{if("douban"===R||!J||!W)return;(async()=>{try{let e=await (0,d.at)(J,W);M(e)}catch(e){throw Error("检查收藏状态失败")}})();let e=(0,d.sO)(J,W);return(0,d.rq)("favoritesUpdated",t=>{M(!!t[e])})},[R,J,W]);let X=(0,u.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),"douban"!==R&&J&&W)try{H?(await (0,d.r7)(J,W),M(!1)):(await (0,d.qn)(J,W,{title:O,source_name:S||"",year:K||"",cover:T,total_episodes:null!=G?G:1,save_time:Date.now()}),M(!0))}catch(e){throw Error("切换收藏状态失败")}},[R,J,W,O,S,K,T,G,H]),$=(0,u.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),"playrecord"===R&&J&&W)try{await (0,d.Ji)(J,W),null==Z||Z()}catch(e){throw Error("删除播放记录失败")}},[R,J,W,Z]),ee=(0,u.useCallback)(()=>{"douban"===R?z.push("/play?title=".concat(encodeURIComponent(O.trim())).concat(K?"&year=".concat(K):"").concat(V?"&stype=".concat(V):"")):J&&W&&z.push("/play?source=".concat(J,"&id=").concat(W,"&title=").concat(encodeURIComponent(O)).concat(K?"&year=".concat(K):"").concat(B?"&prefer=true":"").concat(Q?"&stitle=".concat(encodeURIComponent(Q.trim())):"").concat(V?"&stype=".concat(V):""))},[R,J,W,z,O,K,B,Q,V]),et=(0,u.useMemo)(()=>{let e={playrecord:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!0,showCheckCircle:!0,showDoubanLink:!1,showRating:!1},favorite:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!0,showCheckCircle:!1,showDoubanLink:!1,showRating:!1},search:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!B,showCheckCircle:!1,showDoubanLink:!!Y,showRating:!1},douban:{showSourceName:!1,showProgress:!1,showPlayButton:!0,showHeart:!1,showCheckCircle:!1,showDoubanLink:!0,showRating:!!I}};return e[R]||e.search},[R,B,Y,I]);return(0,l.jsxs)("div",{className:"group relative w-full rounded-lg bg-transparent cursor-pointer transition-all duration-300 ease-in-out hover:scale-[1.05] hover:z-[500]",onClick:ee,children:[(0,l.jsxs)("div",{className:"relative aspect-[2/3] overflow-hidden rounded-lg",children:[!U&&(0,l.jsx)(p.Z,{aspectRatio:"aspect-[2/3]"}),(0,l.jsx)(i.default,{src:(0,h.a8)(T),alt:O,fill:!0,className:"object-cover",referrerPolicy:"no-referrer",onLoadingComplete:()=>A(!0)}),(0,l.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent opacity-0 transition-opacity duration-300 ease-in-out group-hover:opacity-100"}),et.showPlayButton&&(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 transition-all duration-300 ease-in-out delay-75 group-hover:opacity-100 group-hover:scale-100",children:(0,l.jsx)(r.Z,{size:50,strokeWidth:.8,className:"text-white fill-transparent transition-all duration-300 ease-out hover:fill-green-500 hover:scale-[1.1]"})}),(et.showHeart||et.showCheckCircle)&&(0,l.jsxs)("div",{className:"absolute bottom-3 right-3 flex gap-3 opacity-0 translate-y-2 transition-all duration-300 ease-in-out group-hover:opacity-100 group-hover:translate-y-0",children:[et.showCheckCircle&&(0,l.jsx)(s.Z,{onClick:$,size:20,className:"text-white transition-all duration-300 ease-out hover:stroke-green-500 hover:scale-[1.1]"}),et.showHeart&&(0,l.jsx)(o.Z,{onClick:X,size:20,className:"transition-all duration-300 ease-out ".concat(H?"fill-red-600 stroke-red-600":"fill-transparent stroke-white hover:stroke-red-400"," hover:scale-[1.1]")})]}),et.showRating&&I&&(0,l.jsx)("div",{className:"absolute top-2 right-2 bg-pink-500 text-white text-xs font-bold w-7 h-7 rounded-full flex items-center justify-center shadow-md transition-all duration-300 ease-out group-hover:scale-110",children:I}),G&&G>1&&(0,l.jsx)("div",{className:"absolute top-2 right-2 bg-green-500 text-white text-xs font-semibold px-2 py-1 rounded-md shadow-md transition-all duration-300 ease-out group-hover:scale-110",children:E?"".concat(E,"/").concat(G):G}),et.showDoubanLink&&Y&&(0,l.jsx)("a",{href:"https://movie.douban.com/subject/".concat(Y),target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"absolute top-2 left-2 opacity-0 -translate-x-2 transition-all duration-300 ease-in-out delay-100 group-hover:opacity-100 group-hover:translate-x-0",children:(0,l.jsx)("div",{className:"bg-green-500 text-white text-xs font-bold w-7 h-7 rounded-full flex items-center justify-center shadow-md hover:bg-green-600 hover:scale-[1.1] transition-all duration-300 ease-out",children:(0,l.jsx)(n.Z,{size:16})})})]}),et.showProgress&&void 0!==_&&(0,l.jsx)("div",{className:"mt-1 h-1 w-full bg-gray-200 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-green-500 transition-all duration-500 ease-out",style:{width:"".concat(_,"%")}})}),(0,l.jsxs)("div",{className:"mt-2 text-center",children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("span",{className:"block text-sm font-semibold truncate text-gray-900 dark:text-gray-100 transition-colors duration-300 ease-in-out group-hover:text-green-600 dark:group-hover:text-green-400 peer",children:O}),(0,l.jsxs)("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-1 bg-gray-800 text-white text-xs rounded-md shadow-lg opacity-0 invisible peer-hover:opacity-100 peer-hover:visible transition-all duration-200 ease-out delay-100 whitespace-nowrap pointer-events-none",children:[O,(0,l.jsx)("div",{className:"absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-800"})]})]}),et.showSourceName&&S&&(0,l.jsx)("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:(0,l.jsx)("span",{className:"inline-block border rounded px-2 py-0.5 border-gray-500/60 dark:border-gray-400/60 transition-all duration-300 ease-in-out group-hover:border-green-500/60 group-hover:text-green-600 dark:group-hover:text-green-400",children:S})})]})]})}}},function(e){e.O(0,[447,256,609,402,78,541,242,744],function(){return e(e.s=3747)}),_N_E=e.O()}]);