import{i as $,s as F,j as e,S as o,aQ as R,bt as P,n as g,f as w,a5 as q,bM as E,u as T,r as f,P as A,N as D,B as Y,H as z,b as L,L as K,E as U,a6 as H,h as V,F as Q,e as W}from"./index-Bt7ohjT1.js";import{u as G}from"./useReviewsThisMonth-BfaqUfeD.js";import{U as B}from"./users-AHUkR0xv.js";import{T as J}from"./trending-up-DPin_hmr.js";function X(s=5){return $({queryKey:["reviews","best-month-records",s],queryFn:async()=>{const{data:c,error:l}=await F.rpc("get_best_month_records");if(l)throw l;return(c||[]).map(i=>({coachId:i.coach_id,fiveStarCount:Number(i.five_star_count),displayMonth:i.display_month})).sort((i,n)=>n.fiveStarCount-i.fiveStarCount).slice(0,s)}})}function Z(){return $({queryKey:["monthly-performance"],queryFn:async()=>{const{data:s,error:c}=await F.from("coach_monthly_performance").select("*").order("month_year",{ascending:!1});if(c)throw c;const l=new Map;return(s||[]).forEach(i=>{const n=i.month_year;l.has(n)||l.set(n,{monthYear:i.month_year,displayMonth:i.display_month,coaches:[]}),l.get(n).coaches.push({id:i.id,coachId:i.coach_id,monthYear:i.month_year,displayMonth:i.display_month,fiveStarCount:i.five_star_count})}),l.forEach(i=>{i.coaches.sort((n,x)=>x.fiveStarCount-n.fiveStarCount)}),Array.from(l.values())}})}const O=({coachOfTheMonth:s,coaches:c,currentCount:l})=>{var h,b;const{data:i=[]}=Z(),n=(h=s.coachOfMonthTitle)==null?void 0:h.replace(/coach of the month/i,"").trim(),x=new Date().toISOString().slice(0,7),j=i.filter(r=>r.monthYear!==x).map(r=>{const d=r.coaches[0];if(!d)return null;const p=c.find(m=>m.id===d.coachId);return p?{month:r.displayMonth,coach:p,fiveStars:d.fiveStarCount}:null}).filter(r=>r!==null).filter(r=>r.month.toLowerCase()!==(n||"").toLowerCase()).slice(0,6);return e.jsx("section",{className:"py-20 px-4 border-b border-white/10",children:e.jsxs("div",{className:"container mx-auto max-w-6xl",children:[e.jsx(o,{children:e.jsxs("div",{className:"text-center mb-10",children:[e.jsxs("h2",{className:"font-display text-4xl md:text-6xl font-bold italic text-white uppercase tracking-tight leading-[0.95] mb-4",children:[n," ",e.jsx("span",{className:"text-primary",children:"Coach of the Month"})]}),e.jsx("p",{className:"text-white/50 text-sm md:text-base max-w-xl mx-auto",children:"Recognising the coach delivering outstanding experiences right now — based on real 5★ reviews."})]})}),e.jsx(o,{delay:.1,children:e.jsx("div",{className:"relative overflow-hidden rounded-sm border-2 border-primary bg-white/[0.03] shadow-[0_0_40px_-8px_hsl(var(--primary)/0.5)]",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 p-6 text-center md:flex-row md:p-10 md:text-left",children:[e.jsx("div",{className:"h-28 w-28 shrink-0 overflow-hidden rounded-full border-4 border-primary md:h-40 md:w-40",children:e.jsx("img",{src:s.photo,alt:`${s.name}, ${n} Coach of the Month`,className:"h-full w-full object-cover",style:R(s.photoPositionDesktop||s.photoPositionMobile||"center top")})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"flex items-center justify-center gap-2 font-heading text-xs font-black uppercase tracking-[0.25em] text-primary md:justify-start",children:[e.jsx(P,{className:"h-4 w-4"})," Reigning champion · ",n]}),e.jsx("h3",{className:"mt-2 font-display text-4xl font-black uppercase leading-none tracking-tight text-white md:text-6xl",children:s.name}),((b=s.cities)==null?void 0:b[0])&&e.jsx("p",{className:"mt-2 text-xs uppercase tracking-[0.2em] text-white/50",children:s.cities.join(" · ")}),e.jsx(g,{to:`/coaches/${s.slug}`,className:"mt-5 inline-flex items-center bg-primary px-6 py-3 font-heading text-sm font-black uppercase tracking-widest text-primary-foreground transition-transform hover:scale-[1.02]",children:"View profile"})]}),e.jsxs("div",{className:"shrink-0 border-primary/40 md:border-l md:pl-10",children:[e.jsx("div",{className:"font-display text-6xl font-black leading-none text-primary md:text-7xl",children:l??s.reviewCount}),e.jsx("div",{className:"mt-1 text-[11px] uppercase tracking-widest text-white/50",children:"Five-star reviews"})]})]})})}),j.length>0&&e.jsx(o,{delay:.15,children:e.jsx("div",{className:"mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:j.map(r=>{var d;return e.jsxs(g,{to:`/coaches/${r.coach.slug}`,className:"group rounded-sm border border-white/10 bg-white/[0.02] p-5 transition-colors hover:border-primary/60",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-16 w-16 shrink-0 overflow-hidden rounded-full border-2 border-white/15 group-hover:border-primary",children:e.jsx("img",{src:r.coach.photo,alt:r.coach.name,loading:"lazy",className:"h-full w-full object-cover",style:R(r.coach.photoPositionDesktop||r.coach.photoPositionMobile||"center top")})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-primary",children:r.month}),e.jsx("p",{className:"font-display text-xl font-black uppercase leading-tight tracking-tight text-white",children:r.coach.name}),((d=r.coach.cities)==null?void 0:d[0])&&e.jsx("p",{className:"truncate text-xs text-white/45",children:r.coach.cities[0]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center justify-between border-t border-white/10 pt-3",children:[e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:5}).map((p,m)=>e.jsx(w,{className:"h-3.5 w-3.5 fill-primary text-primary"},m))}),e.jsxs("span",{className:"font-display text-lg font-black text-white",children:[r.fiveStars,e.jsx("span",{className:"ml-1 text-[10px] uppercase tracking-widest text-white/40",children:"5★"})]})]})]},r.month)})})})]})})},ee="/assets/coaches-hero-D8ixxzYv.webp";function ie(){var _;const{data:s=[],isLoading:c}=q(),{data:l=[],isLoading:i}=E(),{data:n=[],isLoading:x,displayMonth:j}=G(),{data:h=[],isLoading:b}=X(),{openEnquiryModal:r,openCitySelection:d,openCheckDate:p}=T(),m=f.useMemo(()=>s.find(t=>t.coachOfMonthTitle),[s]),v=f.useMemo(()=>!l.length||!s.length?[]:l.map(t=>{const a=s.find(u=>u.id===t.coachId);return a?{...a,fiveStarCount:t.fiveStarCount}:null}).filter(t=>t!==null&&t.fiveStarCount>0).slice(0,5),[l,s]),y=f.useMemo(()=>!n.length||!s.length?[]:n.map(t=>{const a=s.find(u=>u.id===t.coachId);return a?{...a,monthlyReviewCount:t.reviewCount}:null}).filter(t=>t!==null&&t.monthlyReviewCount>0).slice(0,5),[n,s]),N=f.useMemo(()=>[...s].sort((t,a)=>t.isNew&&!a.isNew?1:!t.isNew&&a.isNew?-1:a.reviewCount-t.reviewCount),[s]),k=f.useMemo(()=>!h.length||!s.length?[]:h.map(t=>{const a=s.find(u=>u.id===t.coachId);return a?{...a,recordCount:t.fiveStarCount,recordMonth:t.displayMonth}:null}).filter(t=>t!==null&&t.recordCount>0),[h,s]),C=!i&&v.length>0,M=!x&&y.length>0,S=!b&&k.length>0,I=C||M||S;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(A,{title:"Meet Our Coaches | Spartacus Bubble Soccer",description:"Meet the Spartacus-certified coaches delivering the UK's #1 rated bubble football experience. Trained, audited and reviewed. No subcontracting."}),e.jsx(D,{}),e.jsx(Y,{}),e.jsxs("main",{children:[e.jsxs("section",{className:"relative min-h-[65vh] flex items-center justify-center text-center overflow-hidden",children:[e.jsx(z,{image:ee,overlayVariant:"foreground",overlayOpacity:50}),e.jsx("div",{className:"relative z-10 container-wide py-32 md:py-40",children:e.jsxs(o,{children:[e.jsxs("div",{className:"inline-flex items-center gap-2 bg-primary/20 border border-primary/30 rounded-sm px-4 py-2 mb-6",children:[e.jsx(B,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Certified · Audited · Visible"})]}),e.jsxs("h1",{className:"font-display text-5xl md:text-7xl lg:text-8xl font-bold italic text-white uppercase tracking-tight leading-[0.9]",children:["Meet Your",e.jsx("br",{}),e.jsx("span",{className:"text-primary",children:"Coaches"})]}),e.jsxs("p",{className:"mt-6 text-lg md:text-xl text-white/70 max-w-2xl mx-auto leading-relaxed",children:["Your experience is only as good as the coach who runs it.",e.jsx("br",{className:"hidden md:block"})," ","With Spartacus, you know exactly who that is — before you book."]}),e.jsxs("div",{className:"mt-10 flex flex-col sm:flex-row gap-3 justify-center items-center",children:[e.jsx(L,{size:"lg",className:"w-full sm:w-auto sm:min-w-[220px]",onClick:()=>d({source:"coaches-hero"}),children:"Book Now"}),e.jsx(L,{variant:"outline",size:"lg",className:"w-full sm:w-auto sm:min-w-[220px] border-white/30 text-white hover:bg-white/10",onClick:()=>p(),children:"Check Date"})]})]})})]}),e.jsx("div",{className:"band band-black",children:e.jsx(K,{dark:!0})}),e.jsx("div",{className:"band band-char",children:e.jsx("section",{className:"py-20 px-4 relative overflow-hidden",children:e.jsxs("div",{className:"container mx-auto max-w-6xl",children:[e.jsx(o,{children:e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 bg-primary/20 border border-primary/30 rounded-sm px-4 py-2 mb-4",children:[e.jsx(B,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Full Roster"})]}),e.jsxs("h2",{className:"font-display text-4xl md:text-6xl font-bold italic text-white uppercase tracking-tight leading-[0.95] mb-3",children:["The Coaches Behind"," ",e.jsx("span",{className:"text-primary",children:"the Standard"})]}),e.jsx("p",{className:"text-white/60 text-sm md:text-lg leading-relaxed max-w-2xl mx-auto",children:"Meet the people who make it happen — and why it's the same quality every city, every time."})]})}),c?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(U,{className:"h-8 w-8 animate-spin text-primary"})}):N.length>0?e.jsx(H,{coaches:N,desktopCols:4,showCity:!0,staggerReveal:!0}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-white/60",children:"No coaches available at this time. Check back soon!"})})]})})}),m&&e.jsx("div",{className:"band band-black",children:e.jsx(O,{coachOfTheMonth:m,coaches:s,currentCount:(_=y.find(t=>t.id===m.id))==null?void 0:_.monthlyReviewCount})}),I&&e.jsx("div",{className:"band band-near",children:e.jsx("section",{className:"py-20",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx(o,{children:e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("h2",{className:"font-display text-4xl md:text-6xl font-bold italic text-white uppercase tracking-tight leading-[0.95] mb-3",children:["Measured. Ranked. ",e.jsx("span",{className:"text-primary",children:"Proven."})]}),e.jsxs("p",{className:"text-white/50",children:["Real scores. Real reviews.",e.jsx("br",{className:"md:hidden"})," ","See which coaches are leading right now."]})]})}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto",children:[C&&e.jsx(o,{delay:.1,children:e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-sm p-6 h-full",children:[e.jsxs("h3",{className:"font-display font-bold text-white mb-5 flex items-center gap-2 uppercase text-sm tracking-wide",children:[e.jsx(V,{className:"h-5 w-5 text-primary"}),"Most 5-Star Reviews"]}),e.jsx("div",{className:"space-y-2",children:v.map((t,a)=>e.jsxs(g,{to:`/coaches/${t.slug}`,className:"flex items-center gap-3 hover:bg-white/5 p-2.5 rounded-sm -mx-2 transition-colors group",children:[e.jsx("span",{className:`text-sm font-black w-5 text-center ${a===0?"text-primary":a===1?"text-white/70":a===2?"text-white/50":"text-white/30"}`,children:a+1}),e.jsx("img",{src:t.photo,alt:t.name,className:"w-9 h-9 rounded-full object-cover border-2 border-white/20"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"font-medium text-white text-sm truncate group-hover:text-primary transition-colors",children:t.name})}),e.jsxs("div",{className:"flex items-center gap-1 bg-primary/20 px-2.5 py-1 rounded-sm",children:[e.jsx(w,{className:"h-3 w-3 fill-primary text-primary"}),e.jsx("span",{className:"font-bold text-primary text-xs",children:t.fiveStarCount})]})]},t.id))})]})}),M&&e.jsx(o,{delay:.2,children:e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-sm p-6 h-full",children:[e.jsxs("h3",{className:"font-display font-bold text-white mb-5 flex items-center gap-2 uppercase text-sm tracking-wide",children:[e.jsx(J,{className:"h-5 w-5 text-primary"}),"Most This Month · ",j]}),e.jsx("div",{className:"space-y-2",children:y.map((t,a)=>e.jsxs(g,{to:`/coaches/${t.slug}`,className:"flex items-center gap-3 hover:bg-white/5 p-2.5 rounded-sm -mx-2 transition-colors group",children:[e.jsx("span",{className:`text-sm font-black w-5 text-center ${a===0?"text-primary":a===1?"text-white/70":a===2?"text-white/50":"text-white/30"}`,children:a+1}),e.jsx("img",{src:t.photo,alt:t.name,className:"w-9 h-9 rounded-full object-cover border-2 border-white/20"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"font-medium text-white text-sm truncate group-hover:text-primary transition-colors",children:t.name})}),e.jsxs("div",{className:"flex items-center gap-1 bg-primary/20 px-2.5 py-1 rounded-sm",children:[e.jsx(w,{className:"h-3 w-3 fill-primary text-primary"}),e.jsx("span",{className:"font-bold text-primary text-xs",children:t.monthlyReviewCount})]})]},t.id))})]})}),S&&e.jsx(o,{delay:.3,children:e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-sm p-6 h-full",children:[e.jsxs("h3",{className:"font-display font-bold text-white mb-1 flex items-center gap-2 uppercase text-sm tracking-wide",children:[e.jsx(P,{className:"h-5 w-5 text-primary"}),"Record Month · All Time"]}),e.jsx("p",{className:"text-white/40 text-[11px] uppercase tracking-widest mb-4",children:"Most 5-star reviews in a single month"}),e.jsx("div",{className:"space-y-2",children:k.map((t,a)=>e.jsxs(g,{to:`/coaches/${t.slug}`,className:"flex items-center gap-3 hover:bg-white/5 p-2.5 rounded-sm -mx-2 transition-colors group",children:[e.jsx("span",{className:`text-sm font-black w-5 text-center ${a===0?"text-primary":a===1?"text-white/70":a===2?"text-white/50":"text-white/30"}`,children:a+1}),e.jsx("img",{src:t.photo,alt:t.name,className:"w-9 h-9 rounded-full object-cover border-2 border-white/20"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-white text-sm truncate group-hover:text-primary transition-colors",children:t.name}),e.jsx("p",{className:"text-white/40 text-[11px] uppercase tracking-wide",children:t.recordMonth})]}),e.jsxs("div",{className:"flex items-center gap-1 bg-primary/20 px-2.5 py-1 rounded-sm",children:[e.jsx(w,{className:"h-3 w-3 fill-primary text-primary"}),e.jsx("span",{className:"font-bold text-primary text-xs",children:t.recordCount})]})]},t.id))})]})})]})]})})}),e.jsx("div",{className:"band band-black",children:e.jsx(Q,{})})]}),e.jsx(W,{})]})}export{ie as default};