1import{j as e,b as N,L as C}from"./vendor-react-core-_0sZDOLQ.js";import{c as A,B as k,b as f}from"./index-j07E1qHv.js";import{C as x,b as p,c as w,a as h}from"./card-DHmBnTdH.js";import{B as M}from"./badge-BXqwvh8U.js";import{S as y}from"./skeleton-ClHfYp06.js";import{T as F,a as I,b as j,c as u}from"./tabs-BUF6w8PE.js";import{h as B}from"./vendor-utils-BRu4i-LD.js";import{aB as V,l as P,b9 as D,as as T,u as G,U as E,h as J,_ as z,Z as H,aN as K,p as S,a$ as U,aC as Y,aE as O,q as Z,ba as Q}from"./vendor-lucide-Ddz0eB7N.js";import{m as v}from"./vendor-framer-motion-C1oRD-X5.js";import{M as W}from"./MatchReportCard-DgBl4nvX.js";import{A as q}from"./AIStatusPanel-BQTPQoH5.js";import{i as L}from"./aiRecords-DV0ew06X.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-supabase-Ca6cp8v2.js";function X({report:s,match:t}){const a=[{label:"Posse de Bola",home:(s==null?void 0:s.home_possession)||0,away:(s==null?void 0:s.away_possession)||0,unit:"%",color:"bg-blue-600"},{label:"Remates",home:(s==null?void 0:s.home_shots)||0,away:(s==null?void 0:s.away_shots)||0,color:"bg-red-600"},{label:"Remates à Baliza",home:(s==null?void 0:s.home_shots_on_target)||0,away:(s==null?void 0:s.away_shots_on_target)||0,color:"bg-green-600"},{label:"Cantos",home:(s==null?void 0:s.home_corners)||0,away:(s==null?void 0:s.away_corners)||0,color:"bg-yellow-600"},{label:"Faltas",home:(s==null?void 0:s.home_fouls)||0,away:(s==null?void 0:s.away_fouls)||0,color:"bg-orange-600"}],r=({home:l,away:c,label:i,unit:o="",color:n})=>{const d=l+c,m=d>0?l/d*100:50,g=d>0?c/d*100:50;return e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-2xl font-bold text-gray-900",children:[l,o]}),e.jsx("span",{className:"text-sm text-gray-500 uppercase font-medium",children:i}),e.jsxs("span",{className:"text-2xl font-bold text-gray-900",children:[c,o]})]}),e.jsxs("div",{className:"flex h-3 rounded-full overflow-hidden bg-gray-100",children:[e.jsx("div",{className:`${n} transition-all duration-500`,style:{width:`${m}%`}}),e.jsx("div",{className:"bg-gray-300 transition-all duration-500",style:{width:`${g}%`}})]})]})};return e.jsxs(x,{className:"border-0 shadow-lg",children:[e.jsx(p,{className:"bg-gradient-to-r from-gray-900 to-gray-800",children:e.jsxs(w,{className:"text-white flex items-center gap-2",children:[e.jsx(V,{className:"w-5 h-5"}),"EstatÃsticas do Jogo"]})}),e.jsxs(h,{className:"p-6",children:[e.jsx("div",{className:"space-y-2",children:a.map((l,c)=>e.jsx(v.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:c*.1},children:e.jsx(r,{...l})},l.label))}),s&&(s.home_yellow_cards>0||s.away_yellow_cards>0||s.home_red_cards>0||s.away_red_cards>0)&&e.jsx("div",{className:"mt-6 pt-6 border-t",children:e.jsxs("div",{className:"flex justify-around items-center",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-gray-500 mb-2",children:t==null?void 0:t.home_team}),e.jsxs("div",{className:"flex gap-3 justify-center",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-4 bg-yellow-400 rounded-sm"}),e.jsx("span",{className:"text-xl font-bold text-gray-900",children:s.home_yellow_cards||0})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-4 bg-red-600 rounded-sm"}),e.jsx("span",{className:"text-xl font-bold text-gray-900",children:s.home_red_cards||0})]})]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-gray-500 mb-2",children:t==null?void 0:t.away_team}),e.jsxs("div",{className:"flex gap-3 justify-center",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-4 bg-yellow-400 rounded-sm"}),e.jsx("span",{className:"text-xl font-bold text-gray-900",children:s.away_yellow_cards||0})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-4 bg-red-600 rounded-sm"}),e.jsx("span",{className:"text-xl font-bold text-gray-900",children:s.away_red_cards||0})]})]})]})]})})]})]})}const R={goal:{icon:G,color:"text-green-600",bg:"bg-green-50"},yellow_card:{icon:T,color:"text-yellow-600",bg:"bg-yellow-50"},red_card:{icon:T,color:"text-red-600",bg:"bg-red-50"},substitution:{icon:D,color:"text-blue-600",bg:"bg-blue-50"}};function ee({events:s,match:t}){const a=[{minute:12,type:"goal",team:"home",player:"Mabululu",description:"Golo de Mabululu"}
1,{minute:28,type:"yellow_card",team:"away",player:"Show",description:"Cartão amarelo para Show"},{minute:45,type:"goal",team:"away",player:"Gelson Dala",description:"Golo de Gelson Dala"},{minute:62,type:"substitution",team:"home",player:"Zini â Dala",description:"Substituição"},{minute:73,type:"goal",team:"home",player:"Mabululu",description:"Golo de Mabululu"}],r=(s==null?void 0:s.length)>0?s:a;return e.jsxs(x,{className:"border-0 shadow-lg",children:[e.jsx(p,{className:"bg-gradient-to-r from-red-600 to-red-700",children:e.jsxs(w,{className:"text-white flex items-center gap-2",children:[e.jsx(P,{className:"w-5 h-5"}),"Cronologia do Jogo"]})}),e.jsxs(h,{className:"p-6",children:[e.jsx("div",{className:"space-y-4",children:r.map((l,c)=>{const i=R[l.type]||R.goal,o=i.icon,n=l.team==="home";return e.jsxs(v.div,{initial:{opacity:0,x:n?-20:20},animate:{opacity:1,x:0},transition:{delay:c*.1},className:`flex items-start gap-4 ${n?"":"flex-row-reverse"}`,children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-10 h-10 ${i.bg} rounded-full flex items-center justify-center`,children:e.jsx(o,{className:`w-5 h-5 ${i.color}`})}),c<r.length-1&&e.jsx("div",{className:"w-0.5 h-8 bg-gray-200 mt-2"})]}),e.jsxs("div",{className:`flex-1 ${n?"text-left":"text-right"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",style:{justifyContent:n?"flex-start":"flex-end"},children:[e.jsxs("span",{className:"font-bold text-gray-900",children:[l.minute,"'"]}),e.jsx("span",{className:"text-sm text-gray-500",children:"|"}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:n?t==null?void 0:t.home_team:t==null?void 0:t.away_team})]}),e.jsx("p",{className:"text-gray-900 font-semibold",children:l.player}),e.jsx("p",{className:"text-sm text-gray-600",children:l.description})]})]},c)})}),r.length===0&&e.jsxs("div",{className:"text-center py-12 text-gray-500",children:[e.jsx(P,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),e.jsx("p",{children:"Nenhum evento registado"})]})]})]})}function $({formation:s="4-3-3",players:t=[],teamName:a}){const r=s.split("-").map(Number),l=["Guarda-Redes",...Array(r[0]||4).fill("Defesa"),...Array(r[1]||3).fill("Médio"),...Array(r[2]||3).fill("Avançado")],c=t.length>0?t:l,i=c[0];let o=1;const n=r.map(d=>{const m=c.slice(o,o+d);return o+=d,m});return e.jsxs(x,{className:"border-0 shadow-lg",children:[e.jsx(p,{className:"bg-gradient-to-r from-green-600 to-green-700",children:e.jsxs(w,{className:"text-white flex items-center gap-2",children:[e.jsx(E,{className:"w-5 h-5"}),a," - Formação ",s]})}),e.jsx(h,{className:"p-0",children:e.jsxs("div",{className:"relative h-[500px] bg-gradient-to-b from-green-600 to-green-500",style:{backgroundImage:` 2 linear-gradient(to bottom, rgba(0,0,0,0.1) 1px, transparent 1px), 3 linear-gradient(to right, rgba(0,0,0,0.1) 1px, transparent 1px) 4 `,backgroundSize:"40px 40px"},children:[e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-32 h-32 border-2 border-white/40 rounded-full"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-2 h-2 bg-white/60 rounded-full"}),e.jsx("div",{className:"absolute top-1/2 left-0 right-0 h-0.5 bg-white/40"})]}),e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex flex-col items-center",children:[e.jsx("div",{className:"w-12 h-12 bg-yellow-500 border-2 border-white rounded-full flex items-center justify-center shadow-lg",children:e.jsx("span",{className:"text-white text-xs font-bold",children:"GR"})}),e.jsx("span",{className:"text-white text-xs mt-1 bg-black/50 px-2 py-1 rounded max-w-[80px] truncate",children:i})]}),n.map((d,m)=>{const g=15+(m+1)*(70/(n.length+1));return e.jsx("div",{className:"absolute left-0 right-0 flex justify-around px-8",style:{top:`${g}%`},children:d.map((b,_)=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-600 border-2 border-white rounded-full flex items-center justify-center shadow-lg",children:e.jsx("span",{className:"text-white text-xs font-bold",children:_+1})}),e.jsx("span",{className:"text-white text-xs mt-1 bg-black/50 px-2 py-1 rounded max-w-[80px] truncate",children:b})]},_))},m)})]})})]})}function be(){var n,d,m,g;const t=new URLSearchParams(window.location.search).get("id"),{data:a,isLoading:r}=N({queryKey:["match",t],queryFn:async()=>(await f.entities.Match.filter({id:t}))[0],enabled:!!t}),{data:l}=N({queryKey:["match-report",t],queryFn:async()=>(await f.entities.MatchReport.filter({match_id:t}))[0],enabled:!!t}),{data:c}=N({queryKey:["match-ai-prediction",t],queryFn:async()=>a&&(await f.entities.AIPrediction.filter({team_name:a.home_team})).find(L)||null,enabled:!!a}),{data:i}=N({queryKey:["match-video-detection",t],queryFn:async()=>(await f.entities.AIVideoDetection.filter({match_id:t})).find(L)||null,enabled:!!t});if(r)return e.jsx("div",{className:"min-h-screen bg-gray-50 py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx(y,{className:"h-64 roun
4ded-2xl mb-8"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(y,{className:"h-96"}),e.jsx(y,{className:"h-96"})]})]})});if(!a)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(J,{className:"w-20 h-20 text-gray-300 mx-auto mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Jogo não encontrado"}),e.jsx(C,{to:A("Matches"),children:e.jsx(k,{children:"Voltar aos Jogos"})})]})});const o={scheduled:{label:"Agendado",class:"bg-blue-500"},live:{label:"AO VIVO",class:"bg-red-500 animate-pulse"},finished:{label:"Terminado",class:"bg-gray-500"}};return e.jsxs("main",{className:"min-h-screen bg-gray-50",children:[e.jsx("section",{className:"bg-gradient-to-br from-faf-blue via-faf-blue-light to-faf-blue-dark py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx(C,{to:A("Matches"),children:e.jsxs(k,{variant:"ghost",className:"text-white hover:bg-white/10 mb-6",children:[e.jsx(z,{className:"w-4 h-4 mr-2"}),"Voltar aos Jogos"]})}),e.jsxs(v.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:[e.jsx(M,{className:"bg-white/10 text-white mb-4 backdrop-blur-lg",children:a.competition}),e.jsxs("div",{className:"flex items-center justify-center gap-8 mb-6",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[a.home_logo?e.jsx("img",{src:a.home_logo,alt:a.home_team,loading:"lazy",decoding:"async",className:"w-20 h-20 object-contain mb-3"}):e.jsx("div",{className:"w-20 h-20 bg-white/10 backdrop-blur-lg rounded-full flex items-center justify-center mb-3",children:e.jsx("span",{className:"text-white text-2xl font-bold",children:(n=a.home_team)==null?void 0:n.charAt(0)})}),e.jsx("h2",{className:"text-2xl font-bold text-white text-center",children:a.home_team})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[e.jsx("span",{className:"text-6xl font-bold text-white",children:a.home_score??"-"}),e.jsx("span",{className:"text-4xl text-white/60",children:":"}),e.jsx("span",{className:"text-6xl font-bold text-white",children:a.away_score??"-"})]}),e.jsx(M,{className:`${(d=o[a.status])==null?void 0:d.class} text-white text-sm px-4 py-1`,children:(m=o[a.status])==null?void 0:m.label})]}),e.jsxs("div",{className:"flex flex-col items-center",children:[a.away_logo?e.jsx("img",{src:a.away_logo,alt:a.away_team,loading:"lazy",decoding:"async",className:"w-20 h-20 object-contain mb-3"}):e.jsx("div",{className:"w-20 h-20 bg-white/10 backdrop-blur-lg rounded-full flex items-center justify-center mb-3",children:e.jsx("span",{className:"text-white text-2xl font-bold",children:(g=a.away_team)==null?void 0:g.charAt(0)})}),e.jsx("h2",{className:"text-2xl font-bold text-white text-center",children:a.away_team})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-6 text-gray-300",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4"}),e.jsx("span",{children:B(a.match_date).format("DD/MM/YYYY HH:mm")})]}),a.venue&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:a.venue})]})]}),a.source_url&&e.jsx("div",{className:"mt-5 flex justify-center",children:e.jsxs("a",{href:a.source_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-full bg-white/10 px-4 py-2 text-sm font-semibold text-white hover:bg-white/20",children:[e.jsx(S,{className:"h-4 w-4"}),"Fonte: ",a.source_name||"Verificada",e.jsx(U,{className:"h-3 w-3"})]})})]})]})}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs(F,{defaultValue:"stats",className:"space-y-6",children:[e.jsxs(I,{className:"bg-white shadow-sm p-1 rounded-xl",children:[e.jsx(j,{value:"stats",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:"EstatÃsticas"}),e.jsx(j,{value:"timeline",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:"Cronologia"}),e.jsx(j,{value:"formations",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:"Formações"}),e.jsx(j,{value:"ai",className:"data-[state=active]:bg-blue-600 data-[state=active]:text-white",children:"Análise IA â¨"}),a.status==="finished"&&e.jsx(j,{value:"highlights",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:"Destaques"})]}),e.jsx(u,{value:"stats",children:l?e.jsx(X,{report:l,match:a}):e.jsx(x,{className:"border-0 shadow-lg",children:e.jsxs(h,{className:"p-12 text-center",children:[e.jsx(E,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"EstatÃsticas não disponÃveis"})]})})}),e.jsx(u,{value:"timeline",children:e.jsx(ee,{events:l==null?void 0:l.key_events,match:a})}),e.jsx(u,{value:"formations",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx($,{formation:"4-3-3",teamName:a.home_team}),e.jsx($,{formation:"4-4-2",teamName:a.away_team})]})}),e.jsxs(u,{value:"ai",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(x,{className:"border-blue-200 bg-blue-50/20",children:e.jsxs(h,{className:"p-8 text-center",children:[e.jsx(Y,{className:"w-12 h-12 text-blue-600 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-bold text-blue-900 mb-6",children:"Probabilidade experimental"}),c?e.jsxs("div",{className:"flex items-center justify-between gap-4 max-w-sm mx-auto",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2 truncate",children:a.home_team}),e.jsxs("p",{className:"text-4xl font-black text-blue-600",children:[c.win_probability,"%"]})]}),e.jsx("div",{className:"w-px h-16 bg-blue-200"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2 truncate",children:a.away_team}),e.jsxs("p",{className:"text-4xl font-black text-gray-400",children:[(100-c.win_probability).toFixed(1),"%"]})]})]}):e.jsx("p",{className:"text-sm text-blue-800",children:"Nenhuma previsão validada dis
4ponÃvel para este jogo."}),e.jsx("p",{className:"text-xs text-blue-600/70 mt-8",children:"Conteúdo analÃtico não oficial. Exige modelo, dados e revisão documentados."}),c&&e.jsx(q,{record:c,className:"mt-5 text-left"})]})}),e.jsx(x,{className:"border-emerald-200 bg-emerald-50/20",children:e.jsxs(h,{className:"p-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"p-2 bg-emerald-100 rounded-lg",children:e.jsx(O,{className:"w-5 h-5 text-emerald-600"})}),e.jsx("h3",{className:"text-xl font-bold text-emerald-900",children:"Detecções Computer Vision"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white/50 rounded-xl border border-emerald-100",children:[e.jsx("span",{className:"text-sm text-emerald-800",children:"Passes Detectados (Total)"}),e.jsx("span",{className:"text-xl font-bold text-emerald-600",children:(i==null?void 0:i.total_passes_detected)||"---"})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white/50 rounded-xl border border-emerald-100",children:[e.jsx("span",{className:"text-sm text-emerald-800",children:"Remates Detectados"}),e.jsx("span",{className:"text-xl font-bold text-emerald-600",children:(i==null?void 0:i.total_shots_detected)||"---"})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white/50 rounded-xl border border-emerald-100",children:[e.jsx("span",{className:"text-sm text-emerald-800",children:"Latência de Processamento"}),e.jsx("span",{className:"text-sm font-medium text-emerald-500",children:i!=null&&i.latency_ms?`${i.latency_ms} ms`:"---"})]})]}),i?e.jsx(q,{record:i,className:"mt-6"}):e.jsxs("div",{className:"mt-6 flex items-center gap-2 rounded bg-emerald-100/50 p-2 text-xs text-emerald-700",children:[e.jsx(S,{className:"h-4 w-4"}),"Nenhuma deteção de vÃdeo validada para este jogo."]})]})})]}),e.jsxs("div",{className:"mt-8 p-6 bg-amber-50 rounded-2xl border border-amber-200 flex gap-4",children:[e.jsx(Z,{className:"w-6 h-6 text-amber-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-amber-900",children:"Nota da Inteligência Artificial"}),e.jsx("p",{className:"text-sm text-amber-800 mt-1",children:"Estes módulos são experimentais. Só são apresentados resultados com estado validado, versão do modelo, referência dos dados e revisão humana documentados."})]})]})]}),a.status==="finished"&&e.jsx(u,{value:"highlights",children:e.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[e.jsx(x,{className:"border-0 shadow-lg",children:e.jsx(h,{className:"p-0",children:e.jsx("div",{className:"aspect-video bg-gradient-to-br from-gray-900 to-gray-700 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx(Q,{className:"w-20 h-20 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg",children:"Destaques em vÃdeo disponÃveis em breve"}),e.jsx("p",{className:"text-sm text-gray-400 mt-2",children:"Os highlights serão publicados após processamento"})]})})})}),l&&e.jsx(W,{report:l,match:a})]})})]})})})]})}export{be 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.