1import{j as e,u as b}from"./vendor-query-BS2dq783.js";import{u as w,o as f}from"./index-XSMUCKQL.js";import{P as _}from"./Pagination-8yCKIFoX.js";import{R as C}from"./RecipeCard-BztZUUDF.js";import{a as P,D as I}from"./constants-DYhdS0d2.js";import{u as S}from"./vendor-i18n-D2HZKkC3.js";import{c as A,N as E,L}from"./vendor-router-B8t7gLgI.js";import{H as v,p as d,e as F}from"./vendor-icons-CK634XgA.js";import"./vendor-sentry-D2THoUNl.js";import"./vendor-utils-BVzZ8OFP.js";import"./MatchPercentageBar-C73YMeZv.js";import"./LazyImage-BZDx7M4D.js";const R=[{value:"",label:"All Categories"},...P],T=[{value:"",label:"All Difficulties"},...I];function V(){const{t:s}=S(),{isAuthenticated:j}=w(),[l,p]=A();if(!j)return e.jsx(E,{to:"/login",replace:!0});const n=l.get("category")||"",c=l.get("difficulty")||"",o=l.get("min_match")||"0",m=parseInt(l.get("page")||"1",10),{data:x}=b({queryKey:["recipe-categories"],queryFn:f.categories,staleTime:300*1e3}),y=x?[{value:"",label:"All Categories"},...x.map(a=>({value:a.value,label:a.label}))]:R,{data:t,isLoading:h}=b({queryKey:["buildable",{category:n,difficulty:c,min_match:o,page:m}],queryFn:()=>f.buildable({category:n,difficulty:c,min_match:o,page:m})}),g=t?Math.ceil(t.count/20):0,u=(a,i)=>{const r=new URLSearchParams(l);i?r.set(a,i):r.delete(a),a!=="page"&&r.delete("page"),p(r)},N=a=>{const i=new URLSearchParams(l);a>1?i.set("page",String(a)):i.delete("page"),p(i),window.scrollTo({top:0,behavior:"smooth"})};return e.jsx("div",{className:"py-8",children:e.jsxs("div",{className:"mx-auto max-w-screen-2xl px-4",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("h1",{className:"font-display text-3xl font-bold text-white mb-2 flex items-center gap-3",children:[e.jsx(v,{className:"h-8 w-8 text-cyber-green"}),s("buildable.title")]}),e.jsx("p",{className:"text-gray-400",children:s("buildable.subtitle")})]}),e.jsx("div",{className:"card-cyber p-4 mb-6",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("select",{value:n,onChange:a=>u("category",a.target.value),className:"input-cyber appearance-none pr-10 w-full",children:y.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))}),e.jsx(d,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"relative flex-1",children:[e.jsx("select",{value:c,onChange:a=>u("difficulty",a.target.value),className:"input-cyber appearance-none pr-10 w-full",children:T.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))}),e.jsx(d,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"relative flex-1",children:[e.jsxs("select",{value:o,onChange:a=>u("min_match",a.target.value),className:"input-cyber appearance-none pr-10 w-full",children:[e.jsx("option",{value:"0",children:s("buildable.filter_any")}),e.jsx("option",{value:"25",children:s("buildable.filter_25")}),e.jsx("option",{value:"50",children:s("buildable.filter_50")}),e.jsx("option",{value:"75",children:s("buildable.filter_75")}),e.jsx("option",{value:"100",children:s("buildable.filter_100")})]}),e.jsx(d,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-500 pointer-events-none"})]})]})}),t&&e.jsx("div",{className:"mb-4 text-sm text-gray-500 font-mono",children:s("buildable.count_found",{count:t.count})}),h&&e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx("div",{className:"text-cyber-green font-mono animate-pulse",children:s("buildable.loading")})}),t&&!h&&e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:t.results.map(a=>e.jsx(C,{recipe:a,showMatch:!0},a.id))}),t&&t.results.length===0&&e.jsxs("div",{className:"text-center py-20",children:[e.jsx(v,{className:"h-16 w-16 text-gray-600 mx-auto mb-4"}),e.jsx("h3",{className:"font-display text-xl text-white mb-2",children:s("buildable.no_recipes_title")}),e.jsx("p",{className:"text-gray-500 mb-6",children:s("buildable.no_recipes_desc")}),e.jsxs(L,{to:"/my-junkbin",className:"btn-cyber inline-flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4"}),s("my_junkbin.title")]})]}),t&&g>1&&e.jsx(_,{currentPage:m,totalPages:g,onPageChange:N,color:"green",className:"mt-8"})]})})}export{V as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.