PageSourceSearch

https://nicholasalifa.lovable.app/assets/Store-nU2DzV1w.js

js nicholasalifa.lovable.app collected 2026-10-03 03:34:12 UTC 22,542 bytes, 16 lines download raw bytes

1import{c as R,at as he,au as xe,f as ue,r as h,j as e,L as T,_ as W,av as pe,A as Z,V as fe,Z as F,I as J,B as u,aw as D,d as ee,ai as se,a3 as G,e as X,ax as ge,l as je,m as be,ay as te,az as we,X as ae,aA as ye,F as Ne,M as ve}from"./index-DVnvwKss.js";import{A as ke,T as _e,a as Ce,b as Se}from"./alert-Da7Z02jc.js";import{P as Ae}from"./PageHero-Cfb0jg5b.js";import{R as ze}from"./RatingSummary-Cnuj92Lo.js";import{E as H}from"./eye-BZHLZsJp.js";import{G as re}from"./graduation-cap-B6HRXtd7.js";import{P as O}from"./package-CWCtnPMe.js";import{S as M}from"./skeleton-0-5UMlgj.js";import{u as Me}from"./useProductReviews-BzoTRBx9.js";import{S as Ee}from"./star-DgJGUcrD.js";import{R as Le}from"./refresh-cw-BskMRNIY.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Pe=R("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Te=R("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const ne=R("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]),$e={book:ee,course:re,event:F,digital:se,physical:O},Q={book:"Book",course:"Course",event:"Event",digital:"Digital",physical:"Physical"};function U({product:s,ratingSummary:n}){const{addItem:r}=he(),{openCart:i}=xe(),{formatPrice:d,currencySymbol:l,toDisplayValue:m,toKobo:x}=ue(),g=$e[s.product_type],[S,p]=h.useState(s.allow_pay_what_you_want?m(s.price).toString():""),v=a=>{if(a.preventDefault(),a.stopPropagation(),!s.has_multiple_formats){if(s.allow_pay_what_you_want){const f=x(parseFloat(S)),E=s.min_price||0;if(isNaN(f)||f<E){G.error(`Minimum price is ${d(E)}`);return}r(s,1,f)}else r(s);G.success(`${s.title} added to cart`,{action:{label:"View Cart",onClick:i}})}},y=s.stock_quantity!==null&&s.stock_quantity<=0,j=s.has_multiple_formats&&s.hardcopy_price,N=!j&&s.compare_at_price&&s.compare_at_price>s.price,c=N?Math.round((s.compare_at_price-s.price)/s.compare_at_price*100):0;return e.jsxs(T,{to:`/store/${s.slug}`,className:"group relative block bg-card overflow-hidden rounded-xl border border-border/60 hover:border-primary/40 shadow-sm hover:shadow-xl transition-all duration-500 ease-out hover:-translate-y-1",children:[e.jsxs("div",{className:"aspect-[4/5] bg-secondary relative overflow-hidden",children:[s.cover_image_url?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:s.cover_image_url,alt:`${s.title} - ${Q[s.product_type]}`,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-[1.04] transition-transform duration-700 ease-out"}),e.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-foreground
16/20 to-transparent pointer-events-none"})]}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-muted to-secondary",children:e.jsx(g,{className:"w-20 h-20 text-muted-foreground/20",strokeWidth:1.25})}),e.jsxs("div",{className:"absolute top-3 left-3 flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-background/90 backdrop-blur-sm border border-border/40 text-[11px] font-medium tracking-wide uppercase",children:[e.jsx(g,{className:"w-3 h-3"}),e.jsx("span",{children:Q[s.product_type]})]}),e.jsxs("div",{className:"absolute top-3 right-3 flex flex-col gap-1.5 items-end",children:[N&&e.jsxs("div",{className:"px-2.5 py-1 rounded-full bg-destructive text-destructive-foreground text-[11px] font-bold tracking-wide",children:["−",c,"%"]}),s.is_preorder&&e.jsxs("div",{className:"flex items-center gap-1 px-2.5 py-1 rounded-full bg-amber-500 text-white text-[11px] font-medium tracking-wide",children:[e.jsx(W,{className:"w-3 h-3"}),"Pre-Order"]}),s.read_online_enabled&&!s.is_preorder&&e.jsxs("div",{className:"flex items-center gap-1 px-2.5 py-1 rounded-full bg-primary text-primary-foreground text-[11px] font-medium tracking-wide",children:[e.jsx(H,{className:"w-3 h-3"}),"Free to Read"]}),s.is_featured&&!s.is_preorder&&!s.read_online_enabled&&!N&&e.jsx("div",{className:"px-2.5 py-1 rounded-full bg-foreground text-background text-[11px] font-medium tracking-wide",children:"Featured"})]}),y&&e.jsx("div",{className:"absolute inset-0 bg-background/85 backdrop-blur-[2px] flex items-center justify-center",children:e.jsx(pe,{variant:"destructive",className:"text-sm tracking-wide",children:"Out of Stock"})}),e.jsx("div",{className:"absolute bottom-3 right-3 w-9 h-9 rounded-full bg-background/95 backdrop-blur-sm border border-border/40 flex items-center justify-center opacity-0 group-hover:opacity-100 translate-y-2 group-hover:translate-y-0 transition-all duration-300",children:e.jsx(Z,{className:"w-4 h-4 text-foreground"})})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[e.jsx("h3",{className:"font-heading text-lg leading-snug line-clamp-2 group-hover:text-primary transition-colors min-h-[3.25rem]",children:s.title}),n&&n.review_count>0&&e.jsx(ze,{averageRating:n.average_rating,reviewCount:n.review_count,compact:!0}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 leading-relaxed",children:s.description}),s.is_preorder&&s.preorder_release_date&&e.jsxs("p",{className:"text-xs text-amber-600 flex items-center gap-1.5 font-medium",children:[e.jsx(W,{className:"w-3 h-3"}),"Available ",fe(new Date(s.preorder_release_date),"MMM d, yyyy")]}),s.product_type==="event"&&s.event_date&&!s.is_preorder&&e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1.5 font-medium",children:[e.jsx(F,{className:"w-3 h-3"}),new Date(s.event_date).toLocaleDateString("en-US",{dateStyle:"medium"})]}),e.jsx("div",{className:"h-px bg-border/60"}),s.allow_pay_what_you_want?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-xs uppercase tracking-wider text-muted-foreground font-medium",children:"Pay what you want"}),s.min_price&&s.min_price>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["min ",d(s.min_price)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1 flex-1 border border-input rounded-md px-3 h-9 focus-within:border-primary transition-colors",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:l}),e.jsx(J,{type:"number",min:m(s.min_price||0),step:"0.01",value:S,onChange:a=>{a.stopPropagation(),p(a.target.value)},onClick:a=>a.preventDefault(),className:"h-7 border-0 px-0 focus-visible:ring-0 shadow-none",placeholder:"Amount"})]}),e.jsxs(u,{size:"sm",onClick:v,disabled:y,className:"shrink-0 h-9",children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),s.is_preorder?"Pre-Order":"Add"]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Suggested: ",d(s.price)]})]}):e.jsxs("div",{className:"flex items-end justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:j?"Starting at":"Price"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"font-heading text-xl text-foreground font-semibold",children:d(j?Math.min(s.price,s.hardcopy_price||s.price):s.price)}),N&&e.jsx("span",{className:"text-xs text-muted-foreground line-through",children:d(s.compare_at_price)})]})]}),j?e.jsx(u,{size:"sm",variant:"default",className:"shrink-0",children:"View Options"}):s.read_online_enabled?e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(u,{size:"sm",variant:"outline",className:"shrink-0 px-2.5",children:e.jsx(H,{className:"w-4 h-4"})}),e.jsx(u,{size:"sm",onClick:v,disabled:y,className:"shrink-0",children:e.jsx(D,{className:"w-4 h-4"})})]}):e.jsxs(u,{size:"sm",onClick:v,disabled:y,className:"shrink-0",children:[e.jsx(D,{className:"w-4 h-4 mr-1.5"}),s.is_preorder?"Pre-Order":"Add"]})]})]})]})}const Y=[{id:"all",label:"All",icon:ne},{id:"book",label:"Books",icon:ee},{id:"course",label:"Courses",icon:re},{id:"event",label:"Events",icon:F},{id:"digital",label:"Digital",icon:se},{id:"physical",label:"Physical",icon:O}];function De(){return e.jsxs("div",{className:"bg-card border-2 border-border",children:[e.jsx(M,{className:"aspect-[4/3] w-full rounded-none"}),e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx(M,{className:"h-5 w-3/4"}),e.jsx(M,{className:"h-4 w-full"}),e.jsx(M,{className:"h-4 w-1/2"}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(M,{className:"h-6 w-20"}),e.jsx(M,{className:"h-8 w-16 rounded-md"})]})]})]})}const Re=new Set(["the","a","an","and","or","but","of","to","in","on","for","with","by","from","at","as","is","are","
16was","were","be","been","being","this","that","these","those","it","its","your","you","my","our","we","i","how","what","when","why","where","who","which","into","about","over","under","up","down","out","off","not","no","yes","do","does","did","has","have","had","will","would","can","could","should","may","might","just"]);function Fe(s,n=8){if(!(s!=null&&s.length))return[];const r=new Map;for(const i of s){const l=`${i.title} ${i.description??""}`.toLowerCase().match(/[a-z][a-z'-]{2,}/g)??[];for(const m of l)Re.has(m)||m.length<4||r.set(m,(r.get(m)??0)+1)}return Array.from(r.entries()).sort((i,d)=>d[1]-i[1]).slice(0,n).map(([i])=>i)}function Oe(s,n,r=5){const i=s.toLowerCase().trim();return i?n.filter(l=>l!==i).map(l=>{let m=0;l.startsWith(i[0])&&(m+=2),l.includes(i.slice(0,3))&&(m+=3);const x=new Set([...i]).size&&[...new Set(i)].filter(g=>l.includes(g)).length;return m+=x,{k:l,score:m}}).filter(l=>l.score>2).sort((l,m)=>m.score-l.score).slice(0,r).map(l=>l.k):[]}function Ie({message:s,onRetry:n,isRetrying:r}){return e.jsx("div",{className:"max-w-2xl mx-auto py-12 animate-fade-in",children:e.jsxs(ke,{variant:"destructive",className:"border-2",children:[e.jsx(_e,{className:"h-5 w-5"}),e.jsx(Ce,{className:"font-heading text-lg",children:"We couldn't load the store"}),e.jsxs(Se,{className:"mt-2 space-y-4",children:[e.jsx("p",{className:"text-sm",children:"Something went wrong while fetching products. This is usually a temporary network or server hiccup."}),s&&e.jsx("p",{className:"text-xs font-mono bg-destructive/10 px-3 py-2 rounded border border-destructive/20 break-words",children:s}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-1",children:[e.jsxs(u,{onClick:n,disabled:r,variant:"default",size:"sm",className:"gap-2",children:[e.jsx(Le,{className:`w-4 h-4 ${r?"animate-spin":""}`}),r?"Retrying...":"Try again"]}),e.jsx(u,{variant:"outline",size:"sm",onClick:()=>window.location.reload(),children:"Reload page"}),e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(T,{to:"/contact",className:"gap-2",children:[e.jsx(ve,{className:"w-4 h-4"}),"Report issue"]})})]})]})]})})}function qe({searchQuery:s,activeCategory:n,categoryCounts:r,categories:i,onClearSearch:d,onSelectCategory:l,onApplyKeyword:m,keywordSuggestions:x,popularKeywords:g,hasAnyProducts:S}){var N;const p=!!s.trim(),v=((N=i.find(c=>c.id===n))==null?void 0:N.label)??"this category",y=i.filter(c=>c.id!=="all"&&c.id!==n&&(r[c.id]??0)>0).slice(0,4);if(!S)return e.jsxs("div",{className:"text-center py-20 animate-fade-in max-w-md mx-auto",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-muted mb-6",children:e.jsx(Pe,{className:"w-10 h-10 text-muted-foreground/50"})}),e.jsx("h3",{className:"font-heading text-2xl mb-2",children:"The store is being stocked"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"New books, courses and resources are coming soon. Subscribe to be the first to know when they launch."}),e.jsx(u,{asChild:!0,variant:"default",children:e.jsx(T,{to:"/subscribe",children:"Get notified"})})]});const j=(p&&x.length>0?x:g).slice(0,8);return e.jsxs("div",{className:"text-center py-20 animate-fade-in max-w-xl mx-auto",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-muted mb-6",children:p?e.jsx(Te,{className:"w-10 h-10 text-muted-foreground/60"}):e.jsx(ne,{className:"w-10 h-10 text-muted-foreground/50"})}),e.jsx("h3",{className:"font-heading text-2xl mb-2",children:p?"No matches found":`No products in ${v} yet`}),e.jsx("p",{className:"text-muted-foreground mb-6",children:p?e.jsxs(e.Fragment,{children:["We couldn't find anything for ",e.jsxs("span",{className:"font-medium text-foreground",children:['"',s,'"']}),n!=="all"?e.jsxs(e.Fragment,{children:[" in ",e.jsx("span",{className:"font-medium text-foreground",children:v})]}):null,". Try a different keyword, check spelling, or broaden your filters."]}):"This category is still being built out. Browse another collection or check back soon."}),j.length>0&&e.jsxs("div",{className:"mb-8",children:[e.jsxs("p",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-3 inline-flex items-center gap-1.5",children:[e.jsx(ae,{className:"w-3 h-3"}),p&&x.length>0?"Did you mean":"Popular searches"]}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:j.map(c=>e.jsxs("button",{onClick:()=>m(c),className:"inline-flex items-center gap-1 px-3 py-1.5 rounded-full border border-border bg-card hover:bg-secondary hover:border-primary/40 text-sm capitalize transition-colors",children:[e.jsx(te,{className:"w-3 h-3 text-muted-foreground"}),c]},c))})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 justify-center mb-8",children:[p&&e.jsx(u,{variant:"outline",size:"sm",onClick:d,children:"Clear search"}),n!=="all"&&e.jsx(u,{variant:"outline",size:"sm",onClick:()=>l("all"),children:"View all products"}),e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(T,{to:"/subscribe",children:"Get lau
16nch updates"})})]}),y.length>0&&e.jsxs("div",{className:"border-t border-border pt-6",children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-3",children:"Try browsing"}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:y.map(c=>{const a=c.icon;return e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>{d(),l(c.id)},className:"gap-2",children:[e.jsx(a,{className:"w-4 h-4"}),c.label,e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r[c.id],")"]})]},c.id)})})]})]})}const Be=50,C=new Map;function Ke(s){const n=C.get(s);return n&&(C.delete(s),C.set(s,n)),n}function Ve(s,n){if(C.set(s,n),C.size>Be){const r=C.keys().next().value;r!==void 0&&C.delete(r)}}function ts(){const[s,n]=h.useState("all"),[r,i]=h.useState(""),[d,l]=h.useState(""),[m,x]=h.useState(!1),g=h.useRef(null),S=h.useRef(""),{data:p,isLoading:v,isError:y,error:j,refetch:N,isFetching:c}=X(s),{data:a}=X("all"),{data:f}=ge();h.useEffect(()=>{const t=window.setTimeout(()=>l(r),120);return()=>window.clearTimeout(t)},[r]);const E=h.useMemo(()=>{var o,k;const t=`${(a==null?void 0:a.length)??0}:${((o=a==null?void 0:a[0])==null?void 0:o.id)??""}:${((k=a==null?void 0:a[a.length-1])==null?void 0:k.id)??""}`;return S.current!==t&&(S.current=t,C.clear()),t},[a]),I=h.useMemo(()=>{const t={all:(a==null?void 0:a.length)||0};return a==null||a.forEach(o=>{t[o.product_type]=(t[o.product_type]||0)+1}),t},[a]),L=h.useMemo(()=>Fe(a,8),[a]),A=h.useMemo(()=>{if(!p||!r.trim())return p;const t=r.toLowerCase();return p.filter(o=>o.title.toLowerCase().includes(t)||o.description&&o.description.toLowerCase().includes(t))},[p,r]),q=h.useMemo(()=>{const t=d.toLowerCase().trim();if(!t||t.length<2||!a)return[];const o=`${E}::${t}`,k=Ke(o);if(k)return k;const $=new RegExp(`\\b${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`),ce=[...new Set(t)],de=Math.ceil(t.length*.6),B=a.map(b=>{const _=b.title.toLowerCase(),K=(b.description??"").toLowerCase();let w=0;if(_===t?w=100:_.startsWith(t)?w=80:$.test(_)?w=60:_.includes(t)&&(w=40),w===0&&(K.startsWith(t)?w=25:K.includes(t)&&(w=15)),w===0){const V=ce.filter(me=>_.includes(me)).length;V>=de&&(w=5+V)}return{p:b,score:w}}).filter(b=>b.score>0).sort((b,_)=>_.score-b.score||b.p.title.length-_.p.title.length).slice(0,6).map(b=>b.p);return Ve(o,B),B},[a,d,E]),P=h.useMemo(()=>Oe(d,L,5),[d,L]);h.useEffect(()=>{const t=o=>{g.current&&!g.current.contains(o.target)&&x(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const ie=h.useMemo(()=>{const t=new Set;return A==null||A.forEach(o=>t.add(o.id)),f==null||f.forEach(o=>t.add(o.id)),Array.from(t)},[A,f]),{data:z}=Me(ie),oe=f&&f.length>0&&s==="all"&&!r.trim(),le=m&&r.trim().length>=2;return e.jsxs(e.Fragment,{children:[e.jsx(je,{title:"Store",description:"Shop books, courses, and digital resources by Nicholas Alifa.",url:"/store"}),e.jsx(be,{}),e.jsxs("main",{className:"min-h-screen",children:[e.jsx(Ae,{title:"Store",description:"Books, courses, and resources to help you grow."}),e.jsxs("div",{className:"container-wide py-12",children:[e.jsxs("div",{ref:g,className:"relative max-w-md mb-6",children:[e.jsx(te,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(J,{placeholder:"Search products...",value:r,onChange:t=>{i(t.target.value),x(!0)},onFocus:()=>x(!0),onKeyDown:t=>{t.key==="Escape"&&x(!1)},className:"pl-10 pr-10"}),r&&e.jsx("button",{onClick:()=>{i(""),x(!1)},className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Clear search",children:e.jsx(we,{className:"w-4 h-4"})}),le&&e.jsx("div",{className:"absolute top-full left-0 right-0 mt-2 bg-card border border-border rounded-lg shadow-lg overflow-hidden z-30 animate-fade-in",children:q.length>0?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"px-3 pt-2.5 pb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Products"}),e.jsx("ul",{className:"pb-1.5",children:q.map(t=>e.jsx("li",{children:e.jsxs(T,{to:`/store/${t.slug}`,onClick:()=>x(!1),className:"flex items-center gap-3 px-3 py-2 hover:bg-secondary/60 transition-colors group",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded bg-secondary overflow-hidden",children:t.cover_image_url?e.jsx("img",{src:t.cover_image_url,alt:"",className:"w-full h-full object-cover",loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(O,{className:"w-4 h-4 text-muted-foreground
16/50"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate text-foreground",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:t.product_type})]}),e.jsx(Z,{className:"w-3.5 h-3.5 text-muted-foreground/60 group-hover:text-primary transition-colors"})]})},t.id))})]}):e.jsxs("div",{className:"p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:['No products match "',e.jsx("span",{className:"text-foreground font-medium",children:r}),'".']}),(P.length>0||L.length>0)&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-1.5 inline-flex items-center gap-1",children:[e.jsx(ae,{className:"w-3 h-3"}),P.length>0?"Did you mean":"Try"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:(P.length>0?P:L.slice(0,6)).map(t=>e.jsx("button",{onClick:()=>{i(t)},className:"px-2.5 py-1 rounded-full border border-border bg-background hover:bg-secondary text-xs capitalize transition-colors",children:t},t))})]})]})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-10",children:Y.map(t=>{const o=t.icon,k=I[t.id]??0,$=s===t.id;return e.jsxs(u,{variant:$?"default":"outline",size:"sm",onClick:()=>n(t.id),className:"gap-2",children:[e.jsx(o,{className:"w-4 h-4"}),t.label,k>0&&e.jsx("span",{className:`text-xs rounded-full px-1.5 py-0.5 min-w-[1.25rem] text-center leading-none ${$?"bg-primary-foreground/20 text-primary-foreground":"bg-muted text-muted-foreground"}`,children:k})]},t.id)})}),oe&&e.jsxs("section",{className:"mb-12",children:[e.jsxs("div",{className:"bg-accent/30 border border-accent rounded-lg p-6 -mx-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx(Ee,{className:"w-5 h-5 text-primary fill-primary"}),e.jsx("h2",{className:"font-heading text-2xl",children:"Featured"})]}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-8",children:f.map(t=>e.jsx(U,{product:t,ratingSummary:z==null?void 0:z[t.id]},t.id))})]}),e.jsx(ye,{className:"mt-12"})]}),v?e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-8",children:Array.from({length:8}).map((t,o)=>e.jsx(De,{},o))}):y?e.jsx(Ie,{message:j instanceof Error?j.message:void 0,onRetry:()=>N(),isRetrying:c}):A&&A.length>0?e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-8 animate-fade-in",children:A.map(t=>e.jsx(U,{product:t,ratingSummary:z==null?void 0:z[t.id]},t.id))},s+r):e.jsx(qe,{searchQuery:r,activeCategory:s,categoryCounts:I,categories:Y,onClearSearch:()=>i(""),onSelectCategory:n,onApplyKeyword:t=>i(t),keywordSuggestions:P,popularKeywords:L,hasAnyProducts:((a==null?void 0:a.length)??0)>0})]})]}),e.jsx(Ne,{})]})}export{ts 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.