1import{j as e,L as F,c as ue,C as Ae,r as C,u as ge,s as te,a as nt,b as _t,d as kt,A as Ct,e as Lt,f as Et,W as Dt,g as we,T as Oe,B as q,M as Tt,R as At,D as Pt,h as It,i as Mt}from"./index-DnLpPdJu.js";import{f as Ot,T as Ft}from"./registrationCounts-B6wNY_Gy.js";import{f as Pe,C as st,A as zt}from"./tournaments-BXkCUYTe.js";import{T as $t}from"./trending-up-BICJ--wK.js";import{T as Rt}from"./trending-down-Ctqs23fe.js";import{M as qt}from"./minus-ChWXzIjY.js";import{g as rt}from"./podium-B1GFD2BB.js";import{C as ot}from"./camera-CnKtd2yN.js";import{A as ne}from"./arrow-right--C-6tBwN.js";import{c as Bt}from"./rankingEvolution-DPeILJkB.js";import{C as Vt}from"./calendar-r-k-P1fG.js";import{H as Ht}from"./handshake-Db5RQ9Ei.js";import{A as Gt}from"./arrow-left-Br53sykA.js";import{C as Ut}from"./chevron-left-Bty14ADU.js";import{C as Kt}from"./calendar-days-DAiQ26Ba.js";import"./pricing-CJwlOrWS.js";import"./clock-I4IgI4BL.js";import"./shield-check-CSPL_bHn.js";const Yt=({to:t,rank:s,points:n,deltaPlaces:i,history:l})=>{const a=(i??0)>0,r=(i??0)<0,u=i!=null&&i!==0,c=(()=>{const o=l.filter(_=>typeof _=="number"&&!Number.isNaN(_));if(o.length<2)return null;const b=Math.min(...o),p=Math.max(...o)-b||1,j=100,d=40,x=j/(o.length-1),g=o.map((_,k)=>{const w=k*x,S=(_-b)/p*(d-6)+3;return[w,S]}),m=g.map(([_,k],w)=>`${w===0?"M":"L"}${_.toFixed(1)},${k.toFixed(1)}`).join(" "),h=`${m} L${j},${d} L0,${d} Z`,[N,v]=g[g.length-1];return{line:m,area:h,lastX:N,lastY:v}})();return e.jsxs(F,{to:t,className:"block rounded-2xl bg-card border border-border/70 shadow-sm hover:shadow-md transition-shadow overflow-hidden",children:[e.jsxs("div",{className:"p-4 pb-2 flex justify-between items-start gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-bold tracking-[0.15em] uppercase text-muted-foreground mb-1",children:"Classement FFT"}),e.jsx("div",{className:"font-display text-4xl md:text-5xl leading-none text-primary",children:s!=null?`#${s}`:"â"})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[e.jsxs("div",{className:ue("px-2.5 py-1 rounded-full flex items-center gap-1 border text-xs font-bold",a&&"bg-emerald-50 text-emerald-600 border-emerald-100",r&&"bg-red-50 text-red-600 border-red-100",!u&&"bg-muted text-muted-foreground border-transparent"),children:[a&&e.jsx($t,{className:"h-3.5 w-3.5"}),r&&e.jsx(Rt,{className:"h-3.5 w-3.5"}),!u&&e.jsx(qt,{className:"h-3.5 w-3.5"}),u?`${a?"+":""}${i}`:"â"]}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u?"places ce mois":"stable"})]})]}),e.jsxs("div",{className:"px-4 pb-4 flex items-end justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-2xl font-bold text-foreground leading-tight",children:n??"â"}),e.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:"Points"})]}),c&&e.jsx("div",{className:"flex-1 h-12 max-w-[160px]",children:e.jsxs("svg",{className:"w-full h-full",viewBox:"0 0 100 40",preserveAspectRatio:"none",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"rankSparkGrad",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--primary))",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--primary))",stopOpacity:"0"})]})}),e.jsx("path",{d:c.area,fill:"url(#rankSparkGrad)"}),e.jsx("path",{d:c.line,fill:"none",stroke:"hsl(var(--primary))",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:c.lastX,cy:c.lastY,r:"3",fill:"hsl(var(--primary))"})]})})]}),e.jsxs("div",{className:"bg-muted/50 px-4 py-3 border-t border-border/60 flex justify-between items-center",children:[e.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground",children:"Mon évolution"}),e.jsxs("span",{className:"text-[11px] font-bold uppercase tracking-wider text-primary inline-flex items-center gap-1",children:["Détails ",e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]})]})},Xt=()=>{const[t,s]=C.useState({}),{data:n}=ge({queryKey:["podiums-teaser"],queryFn:async()=>{const{data:r}=await te.from("tournaments").select("id,title,category,tournament_date,podium_photo_path").not("podium_photo_path","is",null).neq("status","draft").order("tournament_date",{ascending:!1}).limit(4);return r??[]}});if(C.useEffect(()=>{n!=null&&n.length&&rt(n.map(r=>r.podium_photo_path)).then(s)},[n]),!n||n.length===0)return null;const[i,...l]=n,a=t[i.podium_photo_path];return e.jsxs(F,{to:"/podiums",className:"group block overflow-hidden rounded-2xl border bg-card shadow-sm transition-shadow hover:shadow-lg",children:[e.jsxs("div",{className:"relative",children:[a?e.jsx("img",{src:a,alt:`Podium du tournoi ${i.title}`,loading:"lazy",className:"h-40 w-full object-cover transition-transform duration-500 group-hover:scale-105 md:h-44"}):e.jsx("div",{className:"h-40 w-full animate-pulse bg-muted md:h-44"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/25 to-transparent"}),e.jsx("div",{className:"absolute inset-x-0 top-0 flex items-center gap-2 p-3",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-accent px-2.5 py-1 text-[10px] font-extrabold uppercase tracking-[0.18em] text-accent-foreground",children:[e.jsx(ot,{className:"h-3 w-3"})," Derniers podiums"]})}),e.jsxs("div",{className:"absolute inset-x-0 bottom-0 p-3 text-primary-foreground",children:[e.jsx("div",{className:"font-display text-lg leading-tight line-clamp-1",children:i.title}),e.jsx("div",{className:"text-xs capitalize opacity-80",children:Pe(i.tournament_date)})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3",children:[e.jsx("div",{className:"flex flex-1 gap-2",children:l.slice(0,3).map(r=>{const u=t[r.podium_photo_path];return u?e.jsx("img",{src:u,alt:`Podium du tournoi ${r.title}
1`,loading:"lazy",className:"h-10 w-14 rounded-md object-cover"},r.id):e.jsx("div",{className:"h-10 w-14 animate-pulse rounded-md bg-muted"},r.id)})}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-sm font-bold text-court",children:["Voir tout ",e.jsx(ne,{className:"h-4 w-4"})]})]})]})},Qt=()=>new Date().toISOString().slice(0,10),Jt=()=>{var p,j;const{user:t}=nt(),{unread:s}=_t(),{data:n}=kt(),{data:i,isLoading:l}=ge({queryKey:["dashboard",t==null?void 0:t.id],enabled:!!t,staleTime:5*60*1e3,queryFn:async()=>{const[{data:d},x]=await Promise.all([te.from("registrations").select("id, status, payment_status, player_id, registration_source, registered_by_staff_id, tournaments(id,title,category,gender,tournament_date,start_time,status)").or(`player_id.eq.${t.id},partner_user_id.eq.${t.id}`).not("status","in","(withdrawn,rejected)").order("registered_at",{ascending:!1}),te.rpc("find_open_partners",{_limit:200})]),g=(x.data??[]).filter(v=>v.they_liked&&!v.i_liked).length,m=(d??[]).filter(v=>!["pending","canceled"].includes(v.payment_status)).filter(v=>!(v.registration_source==="phone"&&v.player_id===t.id&&v.registered_by_staff_id===t.id)).filter(v=>v.tournaments&&v.tournaments.tournament_date>=Qt()&&v.tournaments.status!=="cancelled").sort((v,_)=>v.tournaments.tournament_date.localeCompare(_.tournaments.tournament_date))[0]??null;let h=[];const{data:N}=await te.from("profile_ranking_history").select("snapshot_date, classement, points").eq("profile_id",t.id).order("snapshot_date",{ascending:!1}).limit(12);return N&&N.length&&(h=N),{nextReg:m,pendingLikes:g,rankHistory:h}}}),{data:a}=ge({queryKey:["dashboard-fft",n==null?void 0:n.first_name,n==null?void 0:n.last_name,n==null?void 0:n.ranking],enabled:!!(n!=null&&n.first_name)&&!!(n!=null&&n.last_name)&&!!(n!=null&&n.ranking),queryFn:async()=>{const d=h=>h.toLowerCase().normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").replace(/\s+/g," ").trim(),x=d(`${n.last_name} ${n.first_name}`),g=d(`${n.first_name} ${n.last_name}`),{data:m}=await te.from("fft_rankings").select("rank, points").in("player_name_normalized",[x,g]).order("snapshot_month",{ascending:!1}).limit(1).maybeSingle();return m&&Number(n==null?void 0:n.ranking)===m.rank?m:null}}),r=(i==null?void 0:i.nextReg)??null,u=(i==null?void 0:i.pendingLikes)??0,c=(i==null?void 0:i.rankHistory)??[],o=C.useMemo(()=>{const d=Bt(c.map(x=>({snapshot_date:x.snapshot_date,classement:x.classement,points:x.points})),{rank:(n==null?void 0:n.ranking)!=null?Number(n.ranking):null});return{rank:d.rank??(a==null?void 0:a.rank)??null,points:d.points??(a==null?void 0:a.points)??null,deltaPlaces:d.deltaPlaces,series:d.series}},[n==null?void 0:n.ranking,a,c]),b=C.useMemo(()=>{if(!(r!=null&&r.tournaments))return null;const d=new Date(r.tournaments.tournament_date+"T00:00:00"),x=Math.ceil((d.getTime()-Date.now())/(1e3*60*60*24));return x<=0?"Aujourd'hui":x===1?"Demain":`Dans ${x} jours`},[r]);if(!t||!n)return null;const f=`${((p=n.first_name)==null?void 0:p[0])??""}${((j=n.last_name)==null?void 0:j[0])??""}`.toUpperCase();return e.jsx("section",{className:"bg-gradient-to-b from-primary/[0.04] to-transparent",children:e.jsxs("div",{className:"container py-6 md:py-10 max-w-5xl space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Ct,{className:"h-12 w-12 border",children:[e.jsx(Lt,{src:n.avatar_url??void 0}),e.jsx(Et,{className:"bg-court text-primary-foreground",children:f||"?"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs uppercase tracking-widest text-muted-foreground",children:"Bienvenue"}),e.jsx("h1",{className:"font-display text-2xl md:text-3xl truncate normal-case",children:(()=>{const d=n.first_name||n.last_name||"";return d?d.charAt(0).toUpperCase()+d.slice(1).toLowerCase():""})()})]})]}),e.jsx(Dt,{}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2 md:items-start",children:[l&&!i?e.jsxs(we,{className:"p-5 flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-muted animate-pulse shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 w-2/3 rounded bg-muted animate-pulse"}
1),e.jsx("div",{className:"h-3 w-1/2 rounded bg-muted animate-pulse"})]})]}):r!=null&&r.tournaments?e.jsxs("div",{className:"space-y-2",children:[e.jsxs(F,{to:`/tournois/${r.tournaments.id}`,className:"block rounded-2xl bg-court text-primary-foreground p-4 shadow-lg hover:shadow-xl transition-shadow",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-widest opacity-80 mb-2",children:[e.jsx(Oe,{className:"h-3 w-3"})," Mon prochain tournoi"]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center min-w-12 rounded-lg bg-white/15 px-2 py-1.5 text-center backdrop-blur",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-wide opacity-80",children:new Date(r.tournaments.tournament_date).toLocaleDateString("fr-FR",{month:"short"})}),e.jsx("div",{className:"font-display text-lg leading-none",children:new Date(r.tournaments.tournament_date).getDate()})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border ${st[r.tournaments.category]}`,children:r.tournaments.category}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-80",children:r.tournaments.gender})]}),e.jsx("div",{className:"font-display text-base md:text-lg truncate",children:r.tournaments.title}),e.jsxs("div",{className:"text-xs opacity-90 mt-0.5",children:[b,r.tournaments.start_time&&` · ${r.tournaments.start_time.slice(0,5)}`]})]}),e.jsx(ne,{className:"h-4 w-4 shrink-0 opacity-80"})]})]}),e.jsx(q,{asChild:!0,variant:"ghost",size:"sm",className:"w-full text-court hover:text-court",children:e.jsxs(F,{to:"/mes-tournois",children:["Voir mes tournois ",e.jsx(ne,{className:"ml-1 h-4 w-4"})]})})]}):e.jsxs(we,{className:"p-5 flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-muted shrink-0",children:e.jsx(Vt,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:"Vous n'avez aucune inscription"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Inscrivez-vous à un tournoi pour relever votre prochain défi."})]}),e.jsx(q,{asChild:!0,size:"sm",className:"bg-court w-full sm:w-auto",children:e.jsx(F,{to:"/tournois",children:"S'inscrire à un tournoi"})})]}),e.jsx(Xt,{})]}),e.jsx(Yt,{to:"/moi/espace",rank:o.rank,points:o.points,deltaPlaces:o.deltaPlaces,history:o.series}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 md:gap-3",children:[e.jsx(Je,{to:"/partenaires",icon:e.jsx(Ht,{className:"h-4 w-4"}),label:"Demandes reçues",value:String(u),sub:u>0?"à accepter":"à jour",highlight:u>0}),e.jsx(Je,{to:"/messages",icon:e.jsx(Tt,{className:"h-4 w-4"}),label:"Messages",value:String(s),sub:s>0?"non lus":"à jour",highlight:s>0})]}),e.jsx(q,{asChild:!0,variant:"outline",className:"w-full sm:hidden",children:e.jsxs(F,{to:"/moi",children:["Tout mon espace ",e.jsx(ne,{className:"ml-1 h-4 w-4"})]})})]})})},Je=({to:t,icon:s,label:n,value:i,sub:l,highlight:a})=>e.jsxs(F,{to:t,className:`rounded-xl border p-3 transition-colors hover:bg-muted/50 ${a?"border-accent/40 bg-accent/5":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:[s,e.jsx("span",{className:"truncate",children:n})]}),e.jsx("div",{className:"font-display text-xl md:text-2xl mt-0.5",children:i}),e.jsx("div",{className:"text-[11px] text-muted-foreground truncate",children:l})]});function Zt(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ze(t){return Zt(t)||Array.isArray(t)}function Wt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Fe(t,s){const n=Object.keys(t),i=Object.keys(s);if(n.length!==i.length)return!1;const l=JSON.stringify(Object.keys(t.breakpoints||{})),a=JSON.stringify(Object.keys(s.breakpoints||{}));return l!==a?!1:n.every(r=>{const u=t[r],c=s[r];return typeof u=="function"?`${u}`==`${c}`:!Ze(u)||!Ze(c)?u===c:Fe(u,c)})}function We(t){return t.concat().sort((s,n)=>s.name>n.name?1:-1).map(s=>s.options)}function en(t,s){if(t.length!==s.length)return!1;const n=We(t),i=We(s);return n.every((l,a)=>{const r=i[a];return Fe(l,r)})}function ze(t){return typeof t=="number"}function Ie(t){return typeof t=="string"}function _e(t){return typeof t=="boolean"}function et(t){return Object.prototype.toString.call(t)==="[object Object]"}function A(t){return Math.abs(t)}function $e(t){return Math.sign(t)}function he(t,s){return A(t-s)}function tn(t,s){if(t===0||s===0||A(t)<=A(s))return 0;const n=he(A(t),A(s));return A(n/t)}function nn(t){return Math.round(t*100)/100}function be(t){return je(t).map(Number)}function B(t){return t[ye(t)]}function ye(t){return Math.max(0,t.length-1)}function Re(t,s){return s===ye(t)}function tt(t,s=0){return Array.from(Array(t),(n,i)=>s+i)}function je(t){return Object.keys(t)}function it(t,s){return[t,s].reduce((n,i)=>
vendor: 14,371 bytes, line 1
1(je(i).forEach(l=>{const a=n[l],r=i[l],u=et(a)&&et(r);n[l]=u?it(a,r):r}),n),{})}function Me(t,s){return typeof s.MouseEvent<"u"&&t instanceof s.MouseEvent}function sn(t,s){const n={start:i,center:l,end:a};function i(){return 0}function l(c){return a(c)/2}function a(c){return s-c}function r(c,o){return Ie(t)?n[t](c):t(s,c,o)}return{measure:r}}function Ne(){let t=[];function s(l,a,r,u={passive:!0}){let c;if("addEventListener"in l)l.addEventListener(a,r,u),c=()=>l.removeEventListener(a,r,u);else{const o=l;o.addListener(r),c=()=>o.removeListener(r)}return t.push(c),i}function n(){t=t.filter(l=>l())}const i={add:s,clear:n};return i}function rn(t,s,n,i){const l=Ne(),a=1e3/60;let r=null,u=0,c=0;function o(){l.add(t,"visibilitychange",()=>{t.hidden&&d()})}function b(){j(),l.clear()}function f(g){if(!c)return;r||(r=g,n(),n());const m=g-r;for(r=g,u+=m;u>=a;)n(),u-=a;const h=u/a;i(h),c&&(c=s.requestAnimationFrame(f))}function p(){c||(c=s.requestAnimationFrame(f))}function j(){s.cancelAnimationFrame(c),r=null,u=0,c=0}function d(){r=null,u=0}return{init:o,destroy:b,start:p,stop:j,update:n,render:i}}function on(t,s){const n=s==="rtl",i=t==="y",l=i?"y":"x",a=i?"x":"y",r=!i&&n?-1:1,u=b(),c=f();function o(d){const{height:x,width:g}=d;return i?x:g}function b(){return i?"top":n?"right":"left"}function f(){return i?"bottom":n?"left":"right"}function p(d){return d*r}return{scroll:l,cross:a,startEdge:u,endEdge:c,measureSize:o,direction:p}}function ie(t=0,s=0){const n=A(t-s);function i(o){return o<t}function l(o){return o>s}function a(o){return i(o)||l(o)}function r(o){return a(o)?i(o)?t:s:o}function u(o){return n?o-n*Math.ceil((o-s)/n):o}return{length:n,max:s,min:t,constrain:r,reachedAny:a,reachedMax:l,reachedMin:i,removeOffset:u}}function at(t,s,n){const{constrain:i}=ie(0,t),l=t+1;let a=r(s);function r(p){return n?A((l+p)%l):i(p)}function u(){return a}function c(p){return a=r(p),f}function o(p){return b().set(u()+p)}function b(){return at(t,u(),n)}const f={get:u,set:c,add:o,clone:b};return f}function an(t,s,n,i,l,a,r,u,c,o,b,f,p,j,d,x,g,m,h){const{cross:N,direction:v}=t,_=["INPUT","SELECT","TEXTAREA"],k={passive:!1},w=Ne(),S=Ne(),L=ie(50,225).constrain(j.measure(20)),P={mouse:300,touch:400},E={mouse:500,touch:600},z=d?43:25;let V=!1,H=0,G=0,se=!1,W=!1,Y=!1,X=!1;function de(y){if(!h)return;function D(O){(_e(h)||h(y,O))&&me(O)}const I=s;w.add(I,"dragstart",O=>O.preventDefault(),k).add(I,"touchmove",()=>{},k).add(I,"touchend",()=>{}).add(I,"touchstart",D).add(I,"mousedown",D).add(I,"touchcancel",M).add(I,"contextmenu",M).add(I,"click",J,!0)}function U(){w.clear(),S.clear()}function ae(){const y=X?n:s;S.add(y,"touchmove",$,k).add(y,"touchend",M).add(y,"mousemove",$,k).add(y,"mouseup",M)}function ce(y){const D=y.nodeName||"";return _.includes(D)}function Q(){return(d?E:P)[X?"mouse":"touch"]}function fe(y,D){const I=f.add($e(y)*-1),O=b.byDistance(y,!d).distance;return d||A(y)<L?O:g&&D?O*.5:b.byIndex(I.get(),0).distance}function me(y){const D=Me(y,i);X=D,Y=d&&D&&!y.buttons&&V,V=he(l.get(),r.get())>=2,!(D&&y.button!==0)&&(ce(y.target)||(se=!0,a.pointerDown(y),o.useFriction(0).useDuration(0),l.set(r),ae(),H=a.readPoint(y),G=a.readPoint(y,N),p.emit("pointerDown")))}function $(y){if(!Me(y,i)&&y.touches.length>=2)return M(y);const I=a.readPoint(y),O=a.readPoint(y,N),K=he(I,H),Z=he(O,G);if(!W&&!X&&(!y.cancelable||(W=K>Z,!W)))return M(y);const re=a.pointerMove(y);K>x&&(Y=!0),o.useFriction(.3).useDuration(.75),u.start(),l.add(v(re)),y.preventDefault()}function M(y){const I=b.byDistance(0,!1).index!==f.get(),O=a.pointerUp(y)*Q(),K=fe(v(O),I),Z=tn(O,K),re=z-10*Z,ee=m+Z/50;W=!1,se=!1,S.clear(),o.useDuration(re).useFriction(ee),c.distance(K,!d),X=!1,p.emit("pointerUp")}function J(y){Y&&(y.stopPropagation(),y.preventDefault(),Y=!1)}function R(){return se}return{init:de,destroy:U,pointerDown:R}}function cn(t,s){let i,l;function a(f){return f.timeStamp}function r(f,p){const d=`client${(p||t.scroll)==="x"?"X":"Y"}`;return(Me(f,s)?f:f.touches[0])[d]}function u(f){return i=f,l=f,r(f)}function c(f){const p=r(f)-r(l),j=a(f)-a(i)>170;return l=f,j&&(i=f),p}function o(f){if(!i||!l)return 0;const p=r(l)-r(i),j=a(f)-a(i),d=a(f)-a(l)>170,x=p/j;return j&&!d&&A(x)>.1?x:0}return{pointerDown:u,pointerMove:c,pointerUp:o,readPoint:r}}function ln(){function t(n){const{offsetTop:i,offsetLeft:l,offsetWidth:a,offsetHeight:r}=n;return{top:i,right:l+a,bottom:i+r,left:l,width:a,height:r}}return{measure:t}}function un(t){function s(i){return t*(i/100)}return{measure:s}}function dn(t,s,n,i,l,a,r){const u=[t].concat(i);let c,o,b=[],f=!1;function p(g){return l.measureSize(r.measure(g))}function j(g){if(!a)return;o=p(t),b=i.map(p);function m(h){for(const N of h){if(f)return;const v=N.target===t,_=i.indexOf(N.target),k=v?o:b[_],w=p(v?t:i[_]);if(A(w-k)>=.5){g.reInit(),s.emit("resize");break}}}c=new ResizeObserver(h=>{(_e(a)||a(g,h))&&m(h)}),n.requestAnimationFrame(()=>{u.forEach(h=>c.observe(h))})}function d(){f=!0,c&&c.disconnect()}return{init:j,destroy:d}}function fn(t,s,n,i,l,a){let r=0,u=0,c=l,o=a,b=t.get(),f=0;function p(){const k=i.get()-t.get(),w=!c;let S=0;return w?(r=0,n.set(i),t.set(i),S=k):(n.set(t),r+=k/c,r*=o,b+=r,t.add(r),S=b-f),u=$e(S),f=b,_}function j(){const k=i.get()-s.get();return A(k)<.001}function d(){return c}function x(){return u}function g(){return r}function m(){return N(l)}function h(){return v(a)}function N(k){return c=k,_}function v(k){return o=k,_}const _={direction:x,duration:d,velocity:g,seek:p,settled:j,useBaseFriction:h,useBaseDuration:m,useFriction:v,useDuration:N};return _}function mn(t,s,n,i,l){const a=l.measure(10),r=l.measure(50),u=ie(.1,.99);let c=!1;function o(){return!(c||!t.reachedAny(n.get())||!t.reachedAny(s.get()))}function b(j){if(!o())return;const d=t.reachedMin(s.get())?"min":"max",x=A(t[d]-s.get()),g=n.get()-s.get(),m=u.constrain(x/r);n.subtract(g*m),!j&&A(g)<a&&(n.set(t.constrain(n.get())),i.useDuration(25).useBaseFriction())}function f(j){c=!j}return{shouldConstrain:o,constrain:b,toggleActive:f}}function pn(t,s,n,i,l){const a=ie(-s+t,0),r=f(),u=b(),c=p();function o(d,x){return he(d,x)<=1}function b(){const d=r[0],x=B(r),g=r.lastIndexOf(d),m=r.indexOf(x)+1;return ie(g,m)}function f(){return n.map((d,x)=>{const{min:g,max:m}=a,h=a.constrain(d),N=!x,v=Re(n,x);return N?m:v||o(g,h)?g:o(m,h)?m:h}).map(d=>parseFloat(d.toFixed(3)))}function p(){if(s<=t+l)return[a.max];if(i==="keepSnaps")return r;const{min:d,max:x}=u;return r.slice(d,x)}return{snapsContained:c,scrollContainLimit:u}}function xn(t,s,n){const i=s[0],l=n?i-t:B(s);return{limit:ie(l,i)}}function hn(t,s,n,i){const a=s.min+.1,r=s.max+.1,{reachedMin:u,reachedMax:c}=ie(a,r);function o(p){return p===1?c(n.get()):p===-1?u(n.get()):!1}function b(p){if(!o(p))return;const j=t*(p*-1);i.forEach(d=>d.add(j))}return{loop:b}}function gn(t){const{max:s,length:n}=t;function i(a){const r=a-s;return n?r/-n:0}return{get:i}}function bn(t,s,n,i,l){const{startEdge:a,endEdge:r}=t,{groupSlides:u}=l,c=f().map(s.measure),o=p(),b=j();function f(){return u(i).map(x=>B(x)[r]-x[0][a]).map(A)}function p(){return i.map(x=>n[a]-x[a]).map(x=>-A(x))}function j(){return u(o).map(x=>x[0]).map((x,g)=>x+c[g])}return{snaps:o,snapsAligned:b}}function jn(t,s,n,i,l,a){const{groupSlides:r}=l,{min:u,max:c}=i,o=b();function b(){const p=r(a),j=!t||s==="keepSnaps";return n.length===1?[a]:j?p:p.slice(u,c).map((d,x,g)=>{const m=!x,h=Re(g,x);if(m){const N=B(g[0])+1;return tt(N)}if(h){const N=ye(a)-B(g)[0]+1;return tt(N,B(g)[0])}return d})}return{slideRegistry:o}}function Nn(t,s,n,i,l){const{reachedAny:a,removeOffset:r,constrain:u}=i;function c(d){return d.concat().sort((x,g)=>A(x)-A(g))[0]}function o(d){const x=t?r(d):u(d),g=s.map((h,N)=>({diff:b(h-x,0),index:N})).sort((h,N)=>A(h.diff)-A(N.diff)),{index:m}=g[0];return{index:m,distance:x}}function b(d,x){const g=[d,d+n,d-n];if(!t)return d;if(!x)return c(g);const m=g.filter(h=>$e(h)===x);return m.length?c(m):B(g)-n}function f(d,x){const g=s[d]-l.get(),m=b(g,x);return{index:d,distance:m}}function p(d,x){const g=l.get()+d,{index:m,distance:h}=o(g),N=!t&&a(g);if(!x||N)return{index:m,distance:d};const v=s[m]-h,_=d+b(v,0);return{index:m,distance:_}}return{byDistance:p,byIndex:f,shortcut:b}}function yn(t,s,n,i,l,a,r){function u(f){const p=f.distance,j=f.index!==s.get();a.add(p),p&&(i.duration()?t.start():(t.update(),t.render(1),t.update())),j&&(n.set(s.get()),s.set(f.index),r.emit("select"))}function c(f,p){const j=l.byDistance(f,p);u(j)}function o(f,p){const j=s.clone().set(f),d=l.byIndex(j.get(),p);u(d)}return{distance:c,index:o}}function vn(t,s,n,i,l,a,r,u){const c={passive:!0,capture:!0};let o=0;function b(j){if(!u)return;function d(x){if(new Date().getTime()-o>10)return;r.emit("slideFocusStart"),t.scrollLeft=0;const h=n.findIndex(N=>N.includes(x));ze(h)&&(l.useDuration(0),i.index(h,0),r.emit("slideFocus"))}a.add(document,"keydown",f,!1),s.forEach((x,g)=>{a.add(x,"focus",m=>{(_e(u)||u(j,m))&&d(g)},c)})}function f(j){j.code==="Tab"&&(o=new Date().getTime())}return{init:b}}function xe(t){let s=t;function n(){return s}function i(c){s=r(c)}function l(c){s+=r(c)}function a(c){s-=r(c)}function r(c){return ze(c)?c:c.get()}return{get:n,set:i,add:l,subtract:a}}function ct(t,s){const n=t.scroll==="x"?r:u,i=s.style;let l=null,a=!1;function r(p){return`translate3d(${p}px,0px,0px)`}function u(p){return`translate3d(0px,${p}px,0px)`}function c(p){if(a)return;const j=nn(t.direction(p));j!==l&&(i.transform=n(j),l=j)}function o(p){a=!p}function b(){a||(i.transform="",s.getAttribute("style")||s.removeAttribute("style"))}return{clear:b,to:c,toggleActive:o}}function wn(t,s,n,i,l,a,r,u,c){const b=be(l),f=be(l).reverse(),p=m().concat(h());function j(w,S){return w.reduce((L,P)=>L-l[P],S)}function d(w,S){return w.reduce((L,P)=>j(L,S)>0?L.concat([P]):L,[])}function x(w){return a.map((S,L)=>({start:S-i[L]+.5+w,end:S+s-.5+w}))}function g(w,S,L){const P=x(S);return w.map(E=>{const z=L?0:-n,V=L?n:0,H=L?"end":"start",G=P[E][H];return{index:E,loopPoint:G,slideLocation:xe(-1),translate:ct(t,c[E]),target:()=>u.get()>G?z:V}})}function m(){const w=r[0],S=d(f,w);return g(S,n,!1)}function h(){const w=s-r[0]-1,S=d(b,w);return g(S,-n,!0)}function N(){return p.every(({index:w})=>{const S=b.filter(L=>L!==w);return j(S,s)<=.1})}function v(){p.forEach(w=>{const{target:S,translate:L,slideLocation:P}=w,E=S();E!==P.get()&&(L.to(E),P.set(E))})}function _(){p.forEach(w=>w.translate.clear())}return{canLoop:N,clear:_,loop:v,loopPoints:p}}function Sn(t,s,n){let i,l=!1;function a(c){if(!n)return;function o(b){for(const f of b)if(f.type==="childList"){c.reInit(),s.emit("slidesChanged");break}}i=new MutationObserver(b=>{l||(_e(n)||n(c,b))&&o(b)}),i.observe(t,{childList:!0})}function r(){i&&i.disconnect(),l=!0}return{init:a,destroy:r}}function _n(t,s,n,i){const l={};let a=null,r=null,u,c=!1;function o(){u=new IntersectionObserver(d=>{c||(d.forEach(x=>{const g=s.indexOf(x.target);l[g]=x}),a=null,r=null,n.emit("slidesInView"))},{root:t.parentElement,threshold:i}),s.forEach(d=>u.observe(d))}function b(){u&&u.disconnect(),c=!0}function f(d){return je(l).reduce((x,g)=>{const m=parseInt(g),{isIntersecting:h}=l[m];return(d&&h||!d&&!h)&&x.push(m),x},[])}function p(d=!0){if(d&&a)return a;if(!d&&r)return r;const x=f(d);return d&&(a=x),d||(r=x),x}return{init:o,destroy:b,get:p}}function kn(t,s,n,i,l,a){const{measureSize:r,startEdge:u,endEdge:c}=t,o=n[0]&&l,b=d(),f=x(),p=n.map(r),j=g();function d(){if(!o)return 0;const h=n[0];return A(s[u]-h[u])}function x(){if(!o)return 0;const h=a.getComputedStyle(B(i));return parseFloat(h.getPropertyValue(`margin-${c}`))}function g(){return n.map((h,N,v)=>{const _=!N,k=Re(v,N);return _?p[N]+b:k?p[N]+f:v[N+1][u]-h[u]}).map(A)}return{slideSizes:p,slideSizesWithGaps:j,startGap:b,endGap:f}}function Cn(t,s,n,i,l,a,r,u,c){const{startEdge:o,endEdge:b,direction:f}=t,p=ze(n);function j(m,h){return be(m).filter(N=>N%h===0).map(N=>m.slice(N,N+h))}function d(m){return m.length?be(m).reduce((h,N,v)=>{const _=B(h)||0,k=_===0,w=N===ye(m),S=l[o]-a[_][o],L=l[o]-a[N][b],P=!i&&k?f(r):0,E=!i&&w?f(u):0,z=A(L-E-(S+P));return v&&z>s+c&&h.push(N),w&&h.push(m.length),h},[]).map((h,N,v)=>{const _=Math.max(v[N-1]||0);return m.slice(_,h)}):[]}function x(m){return p?j(m,n):d(m)}return{groupSlides:x}}function Ln(t,s,n,i,l,a,r){const{align:u,axis:c,direction:o,startIndex:b,loop:f,duration:p,dragFree:j,dragThreshold:d,inViewThreshold:x,slidesToScroll:g,skipSnaps:m,containScroll:h,watchResize:N,watchSlides:v,watchDrag:_,watchFocus:k}=a,w=2,S=ln(),L=S.measure(s),P=n.map(S.measure),E=on(c,o),z=E.measureSize(L),V=un(z),H=sn(u,z),G=!f&&!!h,se=f||!!h,{slideSizes:W,slideSizesWithGaps:Y,startGap:X,endGap:de}=kn(E,L,P,n,se,l),U=Cn(E,z,g,f,L,P,X,de,w),{snaps:ae,snapsAligned:ce}=bn(E,H,L,P,U),Q=-B(ae)+B(Y),{snapsContained:fe,scrollContainLimit:me}=pn(z,Q,ce,h,w),$=G?fe:ce,{limit:M}=xn(Q,$,f),J=at(ye($),b,f),R=J.clone(),T=be(n),y=({dragHandler:le,scrollBody:De,scrollBounds:Te,options:{loop:ve}})=>{ve||Te.constrain(le.pointerDown()),De.seek()},D=({scrollBody:le,translate:De,location:Te,offsetLocation:ve,previousLocation:gt,scrollLooper:bt,slideLooper:jt,dragHandler:Nt,animation:yt,eventHandler:Ge,scrollBounds:vt,options:{loop:Ue}},Ke)=>{const Ye=le.settled(),wt=!vt.shouldConstrain(),Xe=Ue?Ye:Ye&&wt,Qe=Xe&&!Nt.pointerDown();Qe&&yt.stop();const St=Te.get()*Ke+gt.get()*(1-Ke);ve.set(St),Ue&&(bt.loop(le.direction()),jt.loop()),De.to(ve.get()),Qe&&Ge.emit("settle"),Xe||Ge.emit("scroll")},I=rn(i,l,()=>y(Ee),le=>D(Ee,le)),O=.68,K=$[J.get()],Z=xe(K),re=xe(K),ee=xe(K),oe=xe(K),pe=fn(Z,ee,re,oe,p,O),Ce=Nn(f,$,Q,M,oe),Le=yn(I,J,R,pe,Ce,oe,r),Be=gn(M),Ve=Ne(),xt=_n(s,n,r,x),{slideRegistry:He}=jn(G,h,$,me,U,T),ht=vn(t,n,He,Le,pe,Ve,r,k),Ee={ownerDocument:i,ownerWindow:l,eventHandler:r,containerRect:L,slideRects:P,animation:I,axis:E,dragHandler:an(E,t,i,l,oe,cn(E,l),Z,I,Le,pe,Ce,J,r,V,j,d,m,O,_),eventStore:Ve,percentOfView:V,index:J,indexPrevious:R,limit:M,location:Z,offsetLocation:ee,previousLocation:re,options:a,resizeHandler:dn(s,r,l,n,E,N,S),scrollBody:pe,scrollBounds:mn(M,ee,oe,pe,V),scrollLooper:hn(Q,M,ee,[Z,ee,re,oe]),scrollProgress:Be,scrollSnapList:$.map(Be.get),scrollSnaps:$,scrollTarget:Ce,scrollTo:Le,slideLooper:wn(E,z,Q,W,Y,ae,$,ee,n),slideFocus:ht,slidesHandler:Sn(s,r,v),slidesInView:xt,slideIndexes:T,slideRegistry:He,slidesToScroll:U,target:oe,translate:ct(E,s)};return Ee}function En(){let t={},s;function n(o){s=o}function i(o){return t[o]||[]}
1function l(o){return i(o).forEach(b=>b(s,o)),c}function a(o,b){return t[o]=i(o).concat([b]),c}function r(o,b){return t[o]=i(o).filter(f=>f!==b),c}function u(){t={}}const c={init:n,emit:l,off:r,on:a,clear:u};return c}const Dn={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function Tn(t){function s(a,r){return it(a,r||{})}function n(a){const r=a.breakpoints||{},u=je(r).filter(c=>t.matchMedia(c).matches).map(c=>r[c]).reduce((c,o)=>s(c,o),{});return s(a,u)}function i(a){return a.map(r=>je(r.breakpoints||{})).reduce((r,u)=>r.concat(u),[]).map(t.matchMedia)}return{mergeOptions:s,optionsAtMedia:n,optionsMediaQueries:i}}function An(t){let s=[];function n(a,r){return s=r.filter(({options:u})=>t.optionsAtMedia(u).active!==!1),s.forEach(u=>u.init(a,t)),r.reduce((u,c)=>Object.assign(u,{[c.name]:c}),{})}function i(){s=s.filter(a=>a.destroy())}return{init:n,destroy:i}}function Se(t,s,n){const i=t.ownerDocument,l=i.defaultView,a=Tn(l),r=An(a),u=Ne(),c=En(),{mergeOptions:o,optionsAtMedia:b,optionsMediaQueries:f}=a,{on:p,off:j,emit:d}=c,x=E;let g=!1,m,h=o(Dn,Se.globalOptions),N=o(h),v=[],_,k,w;function S(){const{container:T,slides:y}=N;k=(Ie(T)?t.querySelector(T):T)||t.children[0];const I=Ie(y)?k.querySelectorAll(y):y;w=[].slice.call(I||k.children)}function L(T){const y=Ln(t,k,w,i,l,T,c);if(T.loop&&!y.slideLooper.canLoop()){const D=Object.assign({},T,{loop:!1});return L(D)}return y}function P(T,y){g||(h=o(h,T),N=b(h),v=y||v,S(),m=L(N),f([h,...v.map(({options:D})=>D)]).forEach(D=>u.add(D,"change",E)),N.active&&(m.translate.to(m.location.get()),m.animation.init(),m.slidesInView.init(),m.slideFocus.init(R),m.eventHandler.init(R),m.resizeHandler.init(R),m.slidesHandler.init(R),m.options.loop&&m.slideLooper.loop(),k.offsetParent&&w.length&&m.dragHandler.init(R),_=r.init(R,v)))}function E(T,y){const D=U();z(),P(o({startIndex:D},T),y),c.emit("reInit")}function z(){m.dragHandler.destroy(),m.eventStore.clear(),m.translate.clear(),m.slideLooper.clear(),m.resizeHandler.destroy(),m.slidesHandler.destroy(),m.slidesInView.destroy(),m.animation.destroy(),r.destroy(),u.clear()}function V(){g||(g=!0,u.clear(),z(),c.emit("destroy"),c.clear())}function H(T,y,D){!N.active||g||(m.scrollBody.useBaseFriction().useDuration(y===!0?0:N.duration),m.scrollTo.index(T,D||0))}function G(T){const y=m.index.add(1).get();H(y,T,-1)}function se(T){const y=m.index.add(-1).get();H(y,T,1)}function W(){return m.index.add(1).get()!==U()}function Y(){return m.index.add(-1).get()!==U()}function X(){return m.scrollSnapList}function de(){return m.scrollProgress.get(m.offsetLocation.get())}function U(){return m.index.get()}function ae(){return m.indexPrevious.get()}function ce(){return m.slidesInView.get()}function Q(){return m.slidesInView.get(!1)}function fe(){return _}function me(){return m}function $(){return t}function M(){return k}function J(){return w}const R={canScrollNext:W,canScrollPrev:Y,containerNode:M,internalEngine:me,destroy:V,off:j,on:p,emit:d,plugins:fe,previousScrollSnap:ae,reInit:x,rootNode:$,scrollNext:G,scrollPrev:se,scrollProgress:de,scrollSnapList:X,scrollTo:H,selectedScrollSnap:U,slideNodes:J,slidesInView:ce,slidesNotInView:Q};return P(s,n),setTimeout(()=>c.emit("init"),0),R}Se.globalOptions=void 0;function qe(t={},s=[]){const n=C.useRef(t),i=C.useRef(s),[l,a]=C.useState(),[r,u]=C.useState(),c=C.useCallback(()=>{l&&l.reInit(n.current,i.current)},[l]);return C.useEffect(()=>{Fe(n.current,t)||(n.current=t,c())},[t,c]),C.useEffect(()=>{en(i.current,s)||(i.current=s,c())},[s,c]),C.useEffect(()=>{if(Wt()&&r){Se.globalOptions=qe.globalOptions;const o=Se(r,n.current,i.current);return a(o),()=>o.destroy()}else a(void 0)},[r,a]),[u,l]}qe.globalOptions=void 0;const lt=C.createContext(null);function ke(){const t=C.useContext(lt);if(!t)throw new Error("useCarousel must be used within a <Carousel />");return t}const ut=C.forwardRef(({orientation:t="horizontal",opts:s,setApi:n,plugins:i,className:l,children:a,...r},u)=>{const[c,o]=qe({...s,axis:t==="horizontal"?"x":"y"},i),[b,f]=C.useState(!1),[p,j]=C.useState(!1),d=C.useCallback(h=>{h&&(f(h.canScrollPrev()),j(h.canScrollNext()))},[]),x=C.useCallback(()=>{o==null||o.scrollPrev()},[o]),g=C.useCallback(()=>{o==null||o.scrollNext()},[o]),m=C.useCallback(h=>{h.key==="ArrowLeft"?(h.preventDefault(),x()):h.key==="ArrowRight"&&(h.preventDefault(),g())},[x,g]);return C.useEffect(()=>{!o||!n||n(o)},[o,n]),C.useEffect(()=>{if(o)return d(o),o.on("reInit",d),o.on("select",d),()=>{o==null||o.off("select",d)}},[o,d]),e.jsx(lt.Provider,{value:{carouselRef:c,api:o,opts:s,orientation:t||((s==null?void 0:s.axis)==="y"?"vertical":"horizontal"),scrollPrev:x,scrollNext:g,canScrollPrev:b,canScrollNext:p},children:e.jsx("div",{ref:u,onKeyDownCapture:m,className:ue("relative",l),role:"region","aria-roledescription":"carousel",...r,children:a})})});
1ut.displayName="Carousel";const dt=C.forwardRef(({className:t,...s},n)=>{const{carouselRef:i,orientation:l}=ke();return e.jsx("div",{ref:i,className:"overflow-hidden",children:e.jsx("div",{ref:n,className:ue("flex",l==="horizontal"?"-ml-4":"-mt-4 flex-col",t),...s})})});dt.displayName="CarouselContent";const ft=C.forwardRef(({className:t,...s},n)=>{const{orientation:i}=ke();return e.jsx("div",{ref:n,role:"group","aria-roledescription":"slide",className:ue("min-w-0 shrink-0 grow-0 basis-full",i==="horizontal"?"pl-4":"pt-4",t),...s})});ft.displayName="CarouselItem";const mt=C.forwardRef(({className:t,variant:s="outline",size:n="icon",...i},l)=>{const{orientation:a,scrollPrev:r,canScrollPrev:u}=ke();return e.jsxs(q,{ref:l,variant:s,size:n,className:ue("absolute h-8 w-8 rounded-full",a==="horizontal"?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",t),disabled:!u,onClick:r,...i,children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Previous slide"})]})});mt.displayName="CarouselPrevious";const pt=C.forwardRef(({className:t,variant:s="outline",size:n="icon",...i},l)=>{const{orientation:a,scrollNext:r,canScrollNext:u}=ke();return e.jsxs(q,{ref:l,variant:s,size:n,className:ue("absolute h-8 w-8 rounded-full",a==="horizontal"?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",t),disabled:!u,onClick:r,...i,children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Next slide"})]})});pt.displayName="CarouselNext";function Pn(){const[t,s]=C.useState({}),[n,i]=C.useState(null),[l,a]=C.useState(null),[r,u]=C.useState(0),{data:c}=ge({queryKey:["latest-podiums"],queryFn:async()=>{const{data:o}=await te.from("tournaments").select("id,title,category,gender,tournament_date,podium_photo_path").not("podium_photo_path","is",null).neq("status","draft").order("tournament_date",{ascending:!1}).limit(6);return o??[]}});return C.useEffect(()=>{c!=null&&c.length&&rt(c.map(o=>o.podium_photo_path)).then(s)},[c]),C.useEffect(()=>{if(!l)return;u(l.selectedScrollSnap());const o=()=>u(l.selectedScrollSnap());return l.on("select",o),()=>{l.off("select",o)}},[l]),!c||c.length===0?null:e.jsxs("section",{className:"py-12 md:py-20",children:[e.jsxs("div",{className:"container",children:[e.jsxs("div",{className:"flex items-end justify-between mb-8 flex-wrap gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(ot,{className:"h-5 w-5 text-accent"}),e.jsx("span",{className:"text-xs uppercase tracking-[0.25em] font-extrabold text-accent",children:"Souvenirs"})]}),e.jsx("h2",{className:"font-display text-4xl md:text-6xl leading-none",children:"Derniers podiums"})]}),e.jsx(q,{asChild:!0,variant:"outline",className:"rounded-xl",children:e.jsxs(F,{to:"/podiums",children:["Tous les podiums ",e.jsx(ne,{className:"ml-2 h-4 w-4"})]})})]}),e.jsx("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:c.map((o,b)=>{const f=t[o.podium_photo_path];return e.jsxs(we,{className:"overflow-hidden group",children:[e.jsxs("button",{type:"button",onClick:()=>f&&i(b),className:"block w-full relative bg-muted","aria-label":`Agrandir le podium de ${o.title}`,children:[f?e.jsx("img",{src:f,alt:`Podium du tournoi ${o.title}`,loading:"lazy",className:"w-full aspect-video object-cover transition-transform duration-500 group-hover:scale-105"}):e.jsx("div",{className:"w-full aspect-video animate-pulse bg-muted"}),e.jsx("span",{className:"absolute top-2 right-2 inline-flex items-center gap-1 rounded-full bg-background/80 backdrop-blur px-2 py-1 text-[11px] font-bold",children:e.jsx(Oe,{className:"h-3 w-3 text-accent"})})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("span",{className:`text-xs font-bold px-2 py-0.5 rounded border ${st[o.category]}`,children:o.category}),e.jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:o.gender})]}),e.jsx("p",{className:"font-display text-lg block leading-tight",children:o.title}),e.jsx("p",{className:"text-sm text-muted-foreground capitalize mt-0.5",children:Pe(o.tournament_date)}),e.jsx(q,{asChild:!0,className:"mt-3 w-full rounded-xl font-bold",children:e.jsxs(F,{to:`/live/${o.id}`,children:[e.jsx(At,{className:"mr-1 h-4 w-4"}),"Voir le tournoi complet",e.jsx(Ae,{className:"ml-1 h-4 w-4"})]})})]})]},o.id)})})]}),e.jsx(Pt,{open:n!==null,onOpenChange:o=>!o&&i(null),children:e.jsx(It,{className:"max-w-3xl p-0 bg-background overflow-hidden border-0",children:n!==null&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{className:"sr-only",children:"Galerie des podiums"}),e.jsxs(ut,{setApi:a,opts:{startIndex:n,loop:c.length>1},className:"w-full",children:[e.jsx(dt,{children:c.map(o=>e.jsx(ft,{children:e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:t[o.podium_photo_path],alt:`Podium du tournoi ${o.title}`,className:"w-full h-auto max-h-[70vh] object-contain bg-black"}),e.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/50 to-transparent p-4 pt-10 text-white",children:[e.jsx("p",{className:"font-display text-xl leading-tight",children:o.title}),e.jsx("p",{className:"text-sm text-white/80 capitalize",children:Pe(o.tournament_date)})]})]})},o.id))}),c.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{className:"left-3 h-10 w-10 bg-background/90"}),e.jsx(pt,{className:"right-3 h-10 w-10 bg-background/90"})]})]}),c.length>1&&e.jsxs("div",{className:"flex items-center justify-center gap-2 pb-3 -mt-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ut,{className:"h-3.5 w-3.5"})," Glissez pour changer de photo ",e.jsx(Ae,{className:"h-3.5 w-3.5"})]}),e.jsxs("span",{className:"text-xs font-bold text-foreground ml-1",children:[r+1," / ",c.length]})]})]})})})]})}const In=()=>{const t=new Date;return`${t.getFullYear()}
1-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},Wn=()=>{const{user:t}=nt(),{data:s}=ge({queryKey:["home-upcoming",(t==null?void 0:t.id)??"anon"],queryFn:async()=>{const{data:r}=await te.from("tournaments").select("id,title,category,gender,tournament_date,start_time,end_time,referee_name,status,max_pairs,highlight_label,live_started_at,closed_at").gte("tournament_date",[In(),zt].sort().pop()).not("status","in","(draft,cancelled)").order("tournament_date",{ascending:!0}).limit(12),u=await Ot("tournament_id,status"),c={};u==null||u.forEach(f=>{var p;c[p=f.tournament_id]??(c[p]={confirmed:0,pending:0,waitlist:0}),f.status==="confirmed"?c[f.tournament_id].confirmed++:f.status==="pending"?c[f.tournament_id].pending++:f.status==="waitlist"&&c[f.tournament_id].waitlist++});const o=new Set;if(t){const{data:f}=await te.from("registrations").select("tournament_id,status,payment_status,player_id,partner_user_id,registered_by_staff_id").or(`player_id.eq.${t.id},partner_user_id.eq.${t.id}`);f==null||f.forEach(p=>{["withdrawn","rejected"].includes(p.status)||["pending","canceled"].includes(p.payment_status)||p.registered_by_staff_id&&p.registered_by_staff_id===p.player_id&&p.partner_user_id!==t.id||o.add(p.tournament_id)})}return{upcoming:(r??[]).filter(f=>!f.live_started_at&&!f.closed_at&&f.status!=="closed"&&f.status!=="completed").slice(0,6),counts:c,registered:o}}}),n=(s==null?void 0:s.upcoming)??[],i=(s==null?void 0:s.counts)??{},l=(s==null?void 0:s.registered)??new Set;if(t)return e.jsxs("div",{children:[e.jsx(Jt,{}),e.jsx("section",{className:"bg-sidebar/[0.02] py-12 md:py-20",children:e.jsxs("div",{className:"container",children:[e.jsxs("div",{className:"flex items-end justify-between mb-8 flex-wrap gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(Oe,{className:"h-5 w-5 text-accent"}),e.jsx("span",{className:"text-xs uppercase tracking-[0.25em] font-extrabold text-accent",children:"à l'affiche"})]}),e.jsx("h2",{className:"font-display text-4xl md:text-6xl leading-none",children:"Prochains tournois"})]}),e.jsx(q,{asChild:!0,variant:"outline",className:"rounded-xl",children:e.jsxs(F,{to:"/tournois",children:["Tous les tournois ",e.jsx(ne,{className:"ml-2 h-4 w-4"})]})})]}),n.length===0?e.jsx(we,{className:"p-10 text-center text-muted-foreground",children:"Aucun tournoi planifié pour le moment."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-5 md:grid-cols-2 lg:grid-cols-3",children:n.map(r=>{const u=i[r.id]??{confirmed:0,pending:0,waitlist:0};return e.jsx(Ft,{...r,filled:u.confirmed+u.pending,waitlist:u.waitlist,isRegistered:l.has(r.id)},r.id)})}),e.jsx("div",{className:"mt-8 flex justify-center",children:e.jsx(q,{asChild:!0,size:"lg",className:"rounded-xl",children:e.jsxs(F,{to:"/tournois",children:["Tous les tournois ",e.jsx(ne,{className:"ml-2 h-4 w-4"})]})})})]})]})}),e.jsx(Pn,{})]});const a=n[0];return e.jsxs("div",{className:"min-h-[100svh] bg-hero text-primary-foreground relative overflow-hidden flex flex-col",children:[e.jsx("div",{className:"absolute top-0 right-0 w-[500px] h-[500px] bg-accent/20 blur-[160px] rounded-full -mr-40 -mt-40 pointer-events-none"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-[400px] h-[400px] bg-primary-glow/30 blur-[140px] rounded-full -ml-20 -mb-20 pointer-events-none"}),e.jsx("div",{className:"absolute inset-0 opacity-[0.05] pointer-events-none",style:{backgroundImage:"linear-gradient(white 1px, transparent 1px), linear-gradient(90deg, white 1px, transparent 1px)",backgroundSize:"80px 80px"}}),e.jsxs("div",{className:"relative z-10 pt-safe px-6 flex flex-col items-center",children:[e.jsx("div",{className:"h-10 sm:h-14"}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent animate-pulse"}),e.jsx("span",{className:"text-accent text-[11px] font-extrabold uppercase tracking-[0.3em]",children:"Compétition"})]}),e.jsxs("h1",{className:"font-display text-5xl sm:text-7xl text-white text-center leading-none",children:["PADEL ",e.jsx("span",{className:"text-accent",children:"AC"})]}),e.jsx("p",{className:"mt-2 text-white/60 text-xs uppercase tracking-[0.25em] font-bold",children:"Roissy · Paris Nord"})]}),e.jsx("div",{className:"flex-1 min-h-6 sm:min-h-10"}),e.jsxs("div",{className:"relative z-10 px-6 pb-10 sm:pb-14 max-w-md mx-auto w-full",children:[e.jsxs("h2",{className:"font-display text-3xl sm:text-4xl text-accent leading-tight uppercase",children:["Bienvenue sur",e.jsx("br",{}),"l'app compétition."]}),e.jsx("p",{className:"mt-4 text-white/80 text-base leading-relaxed",children:"Inscrivez-vous aux tournois, trouvez un partenaire, suivez les matchs en direct et votre progression."}),e.jsxs("div",{className:"mt-8 space-y-3",children:[e.jsx(q,{asChild:!0,size:"lg",className:"w-full h-14 bg-accent text-accent-foreground hover:bg-accent/90 font-black uppercase tracking-wider rounded-xl",children:e.jsx(F,{to:"/auth",children:"Connexion"})}),e.jsx(q,{asChild:!0,size:"lg",variant:"outline",className:"w-full h-14 bg-transparent text-accent border-2 border-accent hover:bg-accent/10 hover:text-accent font-black uppercase tracking-wider rounded-xl",children:e.jsx(F,{to:"/auth?mode=signup",children:"Je m'inscris"})})]}),e.jsxs("div",{className:"mt-8 flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-white/15"}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.25em] text-white/40 font-bold",children:"Un aperçu"}),e.jsx("div",{className:"h-px flex-1 bg-white/15"})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-3",children:[e.jsxs(F,{to:"/tournois",className:"group rounded-xl border border-white/15 bg-white/5 backdrop-blur p-4 hover:bg-white/10 transition-colors",children:[e.jsx(Kt,{className:"h-5 w-5 text-accent mb-2"}),e.jsx("div",{className:"font-black uppercase text-sm tracking-wide",children:"Tournois"}),e.jsx("div",{className:"text-xs text-white/60 mt-0.5",children:a?`Prochain ${new Date(a.tournament_date).toLocaleDateString("fr-FR",{day:"numeric",month:"short"})}`:"Calendrier"})]}),e.jsxs(F,{to:"/live",className:"group rounded-xl border border-white/15 bg-white/5 backdrop-blur p-4 hover:bg-white/10 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-500 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-red-500"})]}),e.jsx("span",{className:"text-[10px] uppercase tracking-widest text-red-400 font-extrabold",children:"Live"})]}),e.jsx("div",{className:"font-black uppercase text-sm tracking-wide",children:"En direct"}),e.jsx("div",{className:"text-xs text-white/60 mt-0.5",children:"Scores & poules"})]})]}),e.jsxs("div",{className:"mt-10 rounded-2xl border border-white/10 bg-white/[0.04] backdrop-blur p-5",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.25em] text-accent font-extrabold mb-2",children:"Padel AC · Roissy"}),e.jsx("p",{className:"text-sm text-white/70 leading-relaxed",children:"10 terrains intérieurs panoramiques au Nord de Paris. Le club derrière l'app."}),e.jsx("a",{href:"https://padelac.fr",target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-flex items-center gap-1.5 text-sm font-bold text-accent hover:underline",children:"Voir le site du club â"})]}),e.jsxs("div",{className:"mt-6 text-center text-[11px] text-white/40",children:["© ",new Date().getFullYear()," Padel AC"]}
1)]})]})};export{Wn 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.