import{j as e}from"./vendor-ui-CUslpDkL.js";import{r as u,L as c}from"./vendor-react-Dg0Tra3e.js";import{c as h,u as g,b as f,n as b,l as y,s as j}from"./index-CJqEbhJN.js";import{u as v}from"./vendor-query-CN1EccJz.js";import{F as m}from"./flame-DnD4Z7Bh.js";import{m as N}from"./vendor-motion-CiNtJfg1.js";import{P as w}from"./play-Cs8ErDIS.js";import{E as k}from"./eye-DZ0k9N0A.js";import"./vendor-supabase-yzuDJZPy.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const d=h("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),_=t=>{const s=Math.floor(t/3600),o=Math.floor(t%3600/60),a=Math.floor(t%60);return s>0?`${s}:${o.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${o}:${a.toString().padStart(2,"0")}`},S=t=>t>=.9?"text-green-400":t>=.8?"text-yellow-400":"text-orange-400",$=t=>t>=.9?"bg-green-500/20 border-green-500/30":t>=.8?"bg-yellow-500/20 border-yellow-500/30":"bg-orange-500/20 border-orange-500/30",C=t=>t.anilist_id?`https://img.anili.st/media/${t.anilist_id}`:t.image_url?`https://obhjzrksrismzslqjxaz.supabase.co/functions/v1/proxy-image?url=${encodeURIComponent(t.image_url)}`:"/placeholder.svg";function T(){const{t}=g(),[s,o]=u.useState("trending"),{data:a,isLoading:x}=v({queryKey:["public_searches",s],queryFn:async()=>{let r=j.from("public_searches").select("*").limit(50);switch(s){case"trending":r=r.order("view_count",{ascending:!1});break;case"latest":r=r.order("created_at",{ascending:!1});break;case"unsolved":r=r.eq("is_solved",!1).order("created_at",{ascending:!1});break}const{data:i,error:l}=await r;if(l)throw l;return i}}),p=[{id:"trending",label:t("explore.trending"),icon:e.jsx(m,{className:"w-4 h-4"})},{id:"latest",label:t("explore.latest"),icon:e.jsx(f,{className:"w-4 h-4"})},{id:"unsolved",label:t("explore.unsolved"),icon:e.jsx(d,{className:"w-4 h-4"})}];return e.jsxs(e.Fragment,{children:[e.jsxs(b,{children:[e.jsx("title",{children:"Explore Anime Scenes | What-Anime Community"}),e.jsx("meta",{name:"description",content:"Discover and explore anime scenes identified by our community. Find trending, latest, and unsolved anime screenshots."}),e.jsx("meta",{property:"og:title",content:"Explore Anime Scenes | What-Anime"}),e.jsx("meta",{property:"og:description",content:"Discover anime scenes shared by our community. Help identify the sauce!"}),e.jsx("meta",{property:"og:type",content:"website"})]}),e.jsx("div",{className:"min-h-screen px-4 py-8 md:py-12",children:e.jsxs("div",{className:"mx-auto max-w-7xl",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h1",{className:"text-3xl md:text-5xl font-bold mb-3 bg-gradient-to-r from-primary via-secondary to-accent bg-clip-text text-transparent",children:t("explore.title")}),e.jsx("p",{className:"text-muted-foreground text-lg max-w-2xl mx-auto",children:t("explore.description")})]}),e.jsx("div",{className:"flex justify-center gap-3 mb-10",children:p.map(r=>e.jsxs("button",{onClick:()=>o(r.id),className:`
                  flex items-center gap-2 px-5 py-2.5 rounded-full text-sm font-medium
                  transition-all duration-300 border
                  ${s===r.id?"bg-primary/20 text-primary border-primary/50 shadow-lg shadow-primary/20":"bg-card/50 text-muted-foreground border-border/50 hover:bg-card hover:text-foreground hover:border-border"}
                `,children:[r.icon,r.label]},r.id))}),x?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((r,i)=>e.jsx(y,{className:"aspect-video rounded-xl"},i))}):a&&a.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:a.map((r,i)=>e.jsx(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,delay:i*.03},children:e.jsx(c,{to:`/scene/${r.id}`,className:"block group",children:e.jsxs("div",{className:"relative bg-card/60 backdrop-blur-sm rounded-xl overflow-hidden border border-border/50 hover:border-primary/50 transition-all duration-300 hover:shadow-lg hover:shadow-primary/10",children:[e.jsxs("div",{className:"relative aspect-video overflow-hidden bg-muted/30",children:[e.jsx("img",{src:C(r),alt:r.anime_title||"Anime scene",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",loading:"lazy",onError:l=>{const n=l.currentTarget;n.onerror=null,n.src="/placeholder.svg",n.className="w-full h-full object-contain p-8 opacity-50"}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/90 flex items-center justify-center backdrop-blur-sm",children:e.jsx(w,{className:"w-5 h-5 text-primary-foreground fill-current ml-0.5"})})}),e.jsxs("div",{className:"absolute top-3 left-3 right-3 flex items-start justify-between",children:[e.jsx("div",{className:`px-2.5 py-1 rounded-full text-xs font-semibold border backdrop-blur-sm ${$(r.similarity)}`,children:e.jsxs("span",{className:S(r.similarity),children:[(r.similarity*100).toFixed(0),"% match"]})}),!r.is_solved&&e.jsxs("div",{className:"px-2.5 py-1 rounded-full text-xs font-semibold bg-orange-500/90 text-white flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3"}),t("explore.unsolvedBadge")]})]}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-3",children:[e.jsx("h3",{className:"font-semibold text-white text-sm line-clamp-1 mb-1 drop-shadow-lg",children:r.anime_title||t("explore.unknownAnime")}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/80",children:[r.episode&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-primary font-medium",children:t("explore.episode")}),e.jsx("span",{children:r.episode})]}),r.timestamp_from&&e.jsx("span",{className:"flex items-center gap-1 font-mono",children:_(r.timestamp_from)})]})]})]}),e.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between text-xs text-muted-foreground border-t border-border/30",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(k,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:[r.view_count.toLocaleString()," views"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(m,{className:"w-3.5 h-3.5 text-orange-400"}),e.jsx("span",{children:new Date(r.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]})]})]})})},r.id))}):e.jsxs("div",{className:"text-center py-20",children:[e.jsx("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-muted/30 flex items-center justify-center",children:e.jsx(d,{className:"w-10 h-10 text-muted-foreground"})}),e.jsx("h3",{className:"text-2xl font-semibold mb-3",children:t("explore.noScenesYet")}),e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:t("explore.beFirstToShare")}),e.jsx(c,{to:"/",className:"inline-flex items-center gap-2 px-6 py-3 rounded-full bg-primary text-primary-foreground font-medium hover:bg-primary/90 transition-colors",children:t("explore.searchAndShare")})]})]})})]})}export{T as default};