1import{s as b,j as e}from"./index-BKYl9XI7.js";import{r}from"./vendor-react-BjSty5Uo.js";import{f as Ae}from"./format-BMulUEhk.js";import{M as $e}from"./Modal-XSVONxj1.js";import{h as ge,L as z,a7 as Ye,K as pe,b as be,X as Qe,a5 as Ve}from"./vendor-ui-Ci1VS1Mm.js";import"./vendor-supabase-BPVmyxZX.js";const Be="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sdq-blue/30 focus-visible:border-sdq-blue transition-colors",fe="flex-1 min-w-0 px-2 py-1.5 border border-gray-200 rounded-lg text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sdq-blue/30 focus-visible:border-sdq-blue transition-colors bg-white";function Je(d){if(!d)return{short:"â",color:"bg-gray-100 text-gray-400"};const o=d.toLowerCase();return o.includes("portero")?{short:"POR",color:"bg-amber-100 text-amber-700"}:o.includes("defensa")||o.includes("lateral")?{short:"DEF",color:"bg-blue-100 text-blue-700"}:o.includes("medio")||o.includes("centro")?{short:"MED",color:"bg-emerald-100 text-emerald-700"}:o.includes("delantero")||o.includes("extremo")?{short:"DEL",color:"bg-red-100 text-red-700"}:{short:d.slice(0,3).toUpperCase(),color:"bg-gray-100 text-gray-500"}}const A=()=>({appearances:0,minutes:0,goals:0,yellow_cards:0,red_cards:0});function ye(d){const o={};for(const c of d.starters){const m=d.subs.find(O=>O.out===c),$=m!=null&&m.minute?Math.min(90,Math.max(0,parseInt(m.minute))):90;o[c]={...A(),appearances:1,minutes:$}}for(const c of d.subs)if(c.in&&!o[c.in]){const m=c.minute?Math.max(0,90-parseInt(c.minute)):30;o[c.in]={...A(),appearances:1,minutes:m}}for(const[c,m]of Object.entries(d.goals??{}))o[c]&&(o[c].goals=m);for(const[c,m]of Object.entries(d.yellow_cards??{}))o[c]&&(o[c].yellow_cards=m);for(const[c,m]of Object.entries(d.red_cards??{}))o[c]&&(o[c].red_cards=m);return o}function X({value:d,onChange:o,max:c=99}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>o(Math.max(0,d-1)),className:"w-6 h-6 rounded-full border border-gray-200 text-gray-400 hover:border-sdq-blue hover:text-sdq-blue transition-colors text-sm flex items-center justify-center leading-none",children:"â"}),e.jsx("span",{className:"w-4 text-center text-sm font-bold text-gray-900",children:d}),e.jsx("button",{type:"button",onClick:()=>o(Math.min(c,d+1)),className:"w-6 h-6 rounded-full border border-gray-200 text-gray-400 hover:border-sdq-blue hover:text-sdq-blue transition-colors text-sm flex items-center justify-center leading-none",children:"+"})]})}function es(){var ie,de,me,xe,ue,he;const[d,o]=r.useState([]),[c,m]=r.useState([]),[$,O]=r.useState([]),[je,F]=r.useState([]),[H,q]=r.useState([]),[N,_e]=r.useState(""),[w,W]=r.useState(""),[k,Y]=r.useState(""),[j,D]=r.useState(""),[Ne,Z]=r.useState(!1),[we,C]=r.useState(!1),[n,ve]=r.useState(null),[h,Q]=r.useState({home_score:"",away_score:""}),[P,M]=r.useState(!1),[R,v]=r.useState(""),[G,V]=r.useState(1),[S,Se]=r.useState([]),[ee,se]=r.useState(!1),[f,te]=r.useState([]),[_,L]=r.useState([]),[B,ae]=r.useState({}),[re,ne]=r.useState({}),[le,oe]=r.useState({});r.useEffect(()=>{qe()},[]),r.useEffect(()=>{W(""),O([]),Y(""),F([]),D(""),q([]),N&&ke(N)},[N]),r.useEffect(()=>{Y(""),F([]),D(""),q([]),w&&Ce(w)},[w]),r.useEffect(()=>{F([]),D(""),q([]),k&&Me(k)},[k]),r.useEffect(()=>{q([]),j&&J(j)},[j]);async function qe(){const{data:s}=await b.from("years").select("id, year").order("year",{ascending:!1});o(s??[])}async function ke(s){const{data:t}=await b.from("tournaments").select("id, name, year_id").eq("year_id",s).order("name");m(t??[])}async function Ce(s){const{data:t}=await b.from("stages").select("id, name, tournament_id").eq("tournament_id",s).order("name");O(t??[])}async function Me(s){const{data:t}=await b.from("fechas").select("id, name, stage_id").eq("stage_id",s).order("name");F(t??[])}async function J(s){Z(!0);const{data:t}=await b.from("matches").select(` 2 *, 3 home_team:teams!matches_home_team_id_fkey(id, name, short_name, logo_url, is_our_team), 4 away_team:teams!matches_away_team_id_fkey(id, name, short_name, logo_url, is_our_team) 5 `).eq("fecha_id",s).order("match_date");q(t??[]),Z(!1)}async function Ee(s){se(!0);const t=s.home_team.is_our_team?s.home_team.id:s.away_team.id,{data:a}=await b.from("players").select("id, name, number, position, appearances, goals, minutes, yellow_cards, red_cards").eq("team_id",t).order("number");Se(a??[]),se(!1)}const T=s=>{var t,a;return((t=s.home_team)==null?void 0:t.is_our_team)||((a=s.away_team)==null?void 0:a.is_our_team)};function Ie(s){ve(s),V(1),Q({home_score:s.home_score!==null?String(s.home_score):"",away_score:s.away_score!==null?String(s.away_score):""});const t=s.match_stats;te((t==null?void 0:t.starters)??[]),L((t==null?void 0:t.subs)??[]),ae((t==null?void 0:t.goals)??{}),ne((t==null?void 0:t.yellow_cards)??{}),oe((t==null?void 0:t.red_cards)??{}),v(""),C(!0),T(s)&&Ee(s)}async function Oe(s){if(s.preventDefault(),!n)return;const t=parseInt(h.home_score,10),a=parseInt(h.away_score,10);if(isNaN(t)||isNaN(a)||t<0||a<0){v("Ingresa marcadores válidos (números ⥠0).");return}v(""),M(!0),await b.from("matches").update({home_score:t,away_score:a,status:"played"}).eq("id",n.id),M(!1),C(!1),J(j)}async function Fe(){if(!n)return;if(v(""),_.filter(i=>i.out&&i.in).some(i=>
5!i.minute.trim())){v("Indica el minuto de cada cambio.");return}M(!0);const t=parseInt(h.home_score,10),a=parseInt(h.away_score,10),l={starters:f,subs:_.filter(i=>i.out&&i.in),goals:Object.fromEntries(Object.entries(B).filter(([,i])=>i>0)),yellow_cards:Object.fromEntries(Object.entries(re).filter(([,i])=>i>0)),red_cards:Object.fromEntries(Object.entries(le).filter(([,i])=>i>0))},{error:x}=await b.from("matches").update({home_score:t,away_score:a,status:"played",match_stats:l}).eq("id",n.id);if(x){v(x.message),M(!1);return}const g=n.match_stats?ye(n.match_stats):{},u=ye(l),p=[...new Set([...Object.keys(g),...Object.keys(u)])];if(p.length>0){const{data:i}=await b.from("players").select("id, appearances, goals, minutes, yellow_cards, red_cards").in("id",p);for(const y of i??[]){const E=g[y.id]??A(),I=u[y.id]??A();await b.from("players").update({appearances:Math.max(0,(y.appearances||0)+I.appearances-E.appearances),minutes:Math.max(0,(y.minutes||0)+I.minutes-E.minutes),goals:Math.max(0,(y.goals||0)+I.goals-E.goals),yellow_cards:Math.max(0,(y.yellow_cards||0)+I.yellow_cards-E.yellow_cards),red_cards:Math.max(0,(y.red_cards||0)+I.red_cards-E.red_cards)}).eq("id",y.id)}}M(!1),C(!1),J(j)}function De(s){te(t=>t.includes(s)?t.filter(a=>a!==s):t.length<11?[...t,s]:t)}function Pe(){L(s=>[...s,{out:"",in:"",minute:""}])}function Re(s){L(t=>t.filter((a,l)=>l!==s))}function K(s,t,a){L(l=>l.map((x,g)=>g===s?{...x,[t]:a}:x))}const Ge=s=>S.find(t=>t.id===s),ce=r.useMemo(()=>{const s=new Set(f);return _.forEach(t=>{t.in&&s.add(t.in)}),S.filter(t=>s.has(t.id))},[f,_,S]),Le=s=>Ae(s,"es-EC",{weekday:"short",day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"}),Te=c.filter(s=>s.year_id===N),ze=$.filter(s=>s.tournament_id===w),U=()=>{const s=parseInt(h.home_score,10),t=parseInt(h.away_score,10);return!isNaN(s)&&!isNaN(t)&&s>=0&&t>=0};return e.jsxs("div",{className:"p-4 sm:p-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Resultados"}),e.jsx("p",{className:"text-sm text-gray-400 mt-0.5",children:"Carga el marcador y estadÃsticas de los partidos por fecha"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[{label:"Año",value:N,onChange:_e,disabled:!1,items:d.map(s=>({id:s.id,label:String(s.year)})),placeholder:"Seleccionar añoâ¦"},{label:"Torneo",value:w,onChange:W,disabled:!N,items:Te.map(s=>({id:s.id,label:s.name})),placeholder:"Seleccionar torneoâ¦"},{label:"Etapa",value:k,onChange:Y,disabled:!w,items:ze.map(s=>({id:s.id,label:s.name})),placeholder:"Seleccionar etapaâ¦"},{label:"Fecha",value:j,onChange:D,disabled:!k,items:je.map(s=>({id:s.id,label:s.name})),placeholder:"Seleccionar fechaâ¦"}].map(({label:s,value:t,onChange:a,disabled:l,items:x,placeholder:g})=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:s}),e.jsxs("select",{className:Be,value:t,onChange:u=>a(u.target.value),disabled:l,children:[e.jsx("option",{value:"",children:g}),x.map(u=>e.jsx("option",{value:u.id,children:u.label},u.id))]})]},s))}),e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:j?Ne?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(z,{className:"w-6 h-6 animate-spin text-gray-300"})}):H.length===0?e.jsxs("div",{className:"flex flex-col items-center py-16 gap-3 text-gray-400",children:[e.jsx(ge,{className:"w-8 h-8"}),e.jsx("p",{className:"text-sm",children:"No hay partidos en esta fecha."})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[640px] text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-50 border-b border-gray-100",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium text-gray-500",children:"Fecha"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-gray-500",children:"Encuentro"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-gray-500",children:"Resultado"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium text-gray-500",children:"Estadio"}),e.jsx("th",{className:"px-4 py-3"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:H.map(s=>{var t,a,l,x,g,u;return e.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[e.jsx("td",{className:"px-4 py-4 text-xs text-gray-500 whitespace-nowrap",children:Le(s.match_date)}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 justify-end min-w-[120px]",children:[e.jsx("span",{className:"font-semibold text-gray-800 text-right",children:((t=s.home_team)==null?void 0:t.short_name)||((a=s.home_team)==null?void 0:a.name)}),((l=s.home_team)==null?void 0:l.logo_url)&&e.jsx("img",{src:s.home_team.logo_url,className:"w-6 h-6 object-contain shrink-0",alt:""})]}),e.jsx("span",{className:"text-xs text-gray-400 font-medium",children:"vs"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-[120px]",children:[((x=s.away_team)==null?void 0:x.logo_url)&&e.jsx("img",{src:s.away_team.logo_url,className:"w-6 h-6 object-contain shrink-0",alt:""}),e.jsx("span",{className:"font-semibold text-gray-800",children:((g=s.away_team)==null?void 0:g.short_name)||((u=s.away_team)==null?void 0:u.name)})]})]})}),e.jsx("td",{className:"px-4 py-4 text-center",children:s.status==="played"&&s.home_score!==null?e.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xl font-black text-sdq-blue",children:s.home_score}),e.jsx("span",{className:"text-gray-300 font-bold",children:"â"}),e.jsx("span",{className:"text-xl font-black text-sdq-blue",children:s.away_score}),e.jsx(Ye,{className:"w-4 h-4 text-green-500 ml-1"}),s.match_stats&&e.jsx("span",{className:"ml-1 text-[10px] text-gray-400 font-medium",children:"ð"})]}):e.jsx("span",{className:"text-gray-300 text-lg font-bold",children:"â â"})}),e.jsx("td",{className:"px-4 py-4 text-xs text-gray-500",children:s.venue||"â"}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("button",{onClick:()=>Ie(s),className:"px-3 py-1.5 text-xs font-medium rounded-lg border border-sdq-blue/30 text-sdq-blue hover:bg-sdq-blue hover:text-white transition-colors whitespace-nowrap",children:s.status==="played"?"Editar resultado":"Cargar resultado"})})]},s.id)})})]})}):e.jsxs("div",{className:"flex flex-col items-center py-16 gap-3 text-gray-300",children:[e.jsx(ge,{className:"w-10 h-10"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Selecciona año, torneo, etapa y fecha para ver los partidos."})]})}),e.jsx($e,{open:we,onClose:()=>C(!1),title:G===1?"Registrar resultado":"Alineación del equipo",size:G===2?"xl":"md",children:n&&e.jsxs(e.Fragment,{children:[G===1&&e.jsxs("form",{onSubmit:Oe,className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-center gap-6 py-4 bg-gray-50 rounded-xl",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[(ie=n.home_team)!=null&&ie.logo_url?e.jsx("img",{src:n.home_team.logo_url,className:"w-12 h-12 object-contain",alt:""}):e.jsx("div",{className:"w-12 h-12 rounded-full bg-sdq-blue/10 flex items-center justify-center text-sdq-blue font-bold text-sm",children:(((de=n.home_team)==null?void 0:de.short_name)||"").slice(0,3)}),e.jsx("span",{className:"text-xs font-semibold text-gray-700 text-center max-w-[90px] leading-tight",children:(me=n.home_team)==null?void 0:me.name}),e.jsx("input",{type:"number",min:"0",className:"w-20 h-16 text-3xl font-black text-center border-2 border-gray-200 rounded-xl focus-visible:border-sdq-blue focus:outline-none text-sdq-blue",value:h.home_score,onChange:s=>Q(t=>({...t,home_score:s.target.value})),placeholder:"0"})]}),e.jsx("span",{className:"text-3xl font-black text-gray-200 mb-2",children:"â"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[(xe=n.away_team)!=null&&xe.logo_url?e.jsx("img",{src:n.away_team.logo_url,className:"w-12 h-12 object-contain",alt:""}):e.jsx("div",{className:"w-12 h-12 rounded-full bg-sdq-red/10 flex items-center justify-center text-sdq-red font-bold text-sm",children:(((ue=n.away_team)==null?void 0:ue.short_name)||"").slice(0,3)}),e.jsx("span",{className:"text-xs font-semibold text-gray-700 text-center max-w-[90px] leading-tight",children:(he=n.away_team)==null?void 0:he.name}),e.jsx("input",{type:"number",min:"0",className:"w-20 h-16 text-3xl font-black text-center border-2 border-gray-200 rounded-xl focus-visible:border-sdq-blue focus:outline-none text-sdq-blue",value:h.away_score,onChange:s=>Q(t=>({...t,away_score:s.target.value})),placeholder:"0"})]})]}),T(n)&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 border border-blue-100 rounded-lg text-xs text-blue-700",children:[e.jsx("span",{className:"shrink-0",children:"ð"}),"Después del marcador podrás registrar la alineación de SDQ."]}),R&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-100 rounded-lg text-xs text-red-600",children:[e.jsx(pe,{className:"w-4 h-4 shrink-0"})," ",R]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>C(!1),className:"px-4 py-2 text-sm text-gray-600 hover:text-gray-800 transition-colors",children:"Cancelar"}),e.jsx("button",{type:"submit",disabled:P||!U(),className:"px-4 py-2 text-sm border border-gray-200 rounded-lg text-gray-600 hover:bg-gray-50 transition-colors disabled:opacity-40",children:P?e.jsx(z,{className:"w-3.5 h-3.5 animate-spin"}):(T(n),"Guardar")}),T(n)&&e.jsx("button",{type:"button",disabled:!U()||ee,onClick:()=>{U()&&V(2)},className:"flex items-center gap-2 px-5 py-2 bg-sdq-dark-blue hover:bg-sdq-blue text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-40",children:ee?e.jsx(z,{className:"w-3.5 h-3.5 animate-spin"}):e.jsxs(e.Fragment,{children:["Guardar y registrar alineación ",e.jsx(be,{size:15})]})})]})]}),G===2&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-center justify-between bg-gray-50 rounded-xl px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[n.home_team.logo_url&&e.jsx("img",{src:n.home_team.logo_url,className:"w-7 h-7 object-contain",alt:""}),e.jsx("span",{className:"text-sm font-semibold text-gray-700",children:n.home_team.short_name})]}),e.jsxs("span",{className:"font-display text-2xl text-sdq-dark-blue",children:[h.home_score," â ",h.away_score]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-700",children:n.away_team.short_name}),n.away_team.logo_url&&e.jsx("img",{src:n.away_team.logo_url,className:"w-7 h-7 object-contain",alt:""})]})]}),S.length===0?e.jsx("div",{className:"text-center py-8 text-sm text-gray-400",children:"No hay jugadores registrados para este equipo."}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-800",children:"Titulares"}),e.jsxs("span",{className:`text-xs font-bold px-2.5 py-0.5 rounded-full ${f.length===11?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:[f.length,"/11"]})]}),e.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 ga
5p-2",children:S.map(s=>{const t=f.includes(s.id),a=!t&&f.length>=11,{short:l,color:x}=Je(s.position);return e.jsxs("button",{type:"button",disabled:a,onClick:()=>De(s.id),className:`flex flex-col items-start p-2.5 rounded-xl border-2 text-left transition-all ${t?"border-sdq-blue bg-sdq-blue/5 shadow-sm":a?"border-gray-100 bg-gray-50 opacity-40 cursor-not-allowed":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"}`,children:[e.jsxs("span",{className:"text-[10px] font-bold text-gray-400",children:["#",s.number??"â"]}),e.jsx("span",{className:"text-xs font-semibold text-gray-900 leading-tight mt-0.5 w-full truncate",children:s.name}),e.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full mt-1.5 ${x}`,children:l})]},s.id)})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-bold text-gray-800 mb-3",children:"Cambios"}),_.length===0&&e.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Sin cambios registrados."}),e.jsx("div",{className:"space-y-2 mb-3",children:_.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 p-2.5 rounded-lg",children:[e.jsxs("select",{value:s.out,onChange:a=>K(t,"out",a.target.value),className:fe,children:[e.jsx("option",{value:"",children:"Saleâ¦"}),f.map(a=>{const l=Ge(a);return e.jsxs("option",{value:a,children:[l!=null&&l.number?`#${l.number} `:"",l==null?void 0:l.name]},a)})]}),e.jsx(be,{size:13,className:"text-gray-400 shrink-0"}),e.jsxs("select",{value:s.in,onChange:a=>K(t,"in",a.target.value),className:fe,children:[e.jsx("option",{value:"",children:"Entraâ¦"}),S.filter(a=>!f.includes(a.id)||a.id===s.in).map(a=>e.jsxs("option",{value:a.id,children:[a.number?`#${a.number} `:"",a.name]},a.id))]}),e.jsx("input",{type:"number",min:"1",max:"90",value:s.minute,onChange:a=>K(t,"minute",a.target.value),className:"w-16 px-2 py-1.5 border border-gray-200 rounded-lg text-xs text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sdq-blue/30 bg-white",placeholder:"min"}),e.jsx("button",{type:"button",onClick:()=>Re(t),className:"text-gray-300 hover:text-red-400 transition-colors shrink-0",children:e.jsx(Qe,{size:14})})]},t))}),e.jsxs("button",{type:"button",onClick:Pe,className:"flex items-center gap-1.5 text-xs text-sdq-blue hover:text-sdq-dark-blue font-semibold transition-colors",children:[e.jsx(Ve,{size:13})," Añadir cambio"]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-bold text-gray-800 mb-3",children:"EstadÃsticas"}),ce.length===0?e.jsx("p",{className:"text-xs text-gray-400",children:"Selecciona los titulares para registrar estadÃsticas."}):e.jsxs("div",{className:"rounded-xl border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_80px_80px_80px] bg-gray-50 border-b border-gray-100 px-4 py-2",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Jugador"}),e.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider text-center",children:"â½ Goles"}),e.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider text-center",children:"ð¨ Amarilla"}),e.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider text-center",children:"ð¥ Roja"})]}),(()=>{const s=n.home_team.is_our_team?parseInt(h.home_score,10):parseInt(h.away_score,10),t=Object.values(B).reduce((a,l)=>a+l,0);return ce.map((a,l)=>{const x=_.some(p=>p.in===a.id),g=B[a.id]??0,u=isNaN(s)?99:g+(s-t);return e.jsxs("div",{className:`grid grid-cols-[1fr_80px_80px_80px] items-center px-4 py-2.5 ${l%2===0?"bg-white":"bg-gray-50/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("span",{className:"text-[10px] text-gray-400 font-bold w-7 shrink-0",children:["#",a.number??"â"]}),e.jsx("span",{className:"text-xs font-semibold text-gray-900 truncate",children:a.name}),x&&e.jsx("span",{className:"shrink-0 text-[9px] bg-emerald-100 text-emerald-700 font-bold px-1.5 py-0.5 rounded-full",children:"cambio"})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(X,{value:g,onChange:p=>ae(i=>({...i,[a.id]:p})),max:u})}),e.jsx("div",{className:"flex justify-center",children:e.jsx(X,{value:re[a.id]??0,onChange:p=>ne(i=>({...i,[a.id]:p})),max:2})}),e.jsx("div",{className:"flex justify-center",children:e.jsx(X,{value:le[a.id]??0,onChange:p=>oe(i=>({...i,[a.id]:p})),max:1})})]},a.id)})})()]})]})]}),R&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-100 rounded-lg text-xs text-red-600",children:[e.jsx(pe,{className:"w-4 h-4 shrink-0"})," ",R]}),e.jsxs("div",{className:"flex justify-between pt-2 border-t border-gray-100",children:[e.jsx("button",{type:"button",onClick:()=>V(1),className:"flex items-center gap-1.5 px-4 py-2 text-sm text-gray-600 hover:text-gray-800 transition-colors",children:"â Volver al marcador"}),e.jsxs("button",{type:"button",onClick:Fe,disabled:P,className:"flex items-center gap-2 px-6 py-2 bg-sdq-dark-blue hover:bg-sdq-blue text-white text-sm font-semibold rounded-lg transition-colors disabled:opacity-60",children:[P&&e.jsx(z,{className:"w-3.5 h-3.5 animate-spin"}),"Guardar resultado completo"]})]})]})]})})]})}export{es 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.