PageSourceSearch

https://faf.co.ao/assets/CompetitionDetail-De4NS_-T.js

js faf.co.ao collected 2026-10-02 19:10:12 UTC 19,198 bytes, 1 lines download raw bytes

1import{j as e,r as T,b as v,L as G,R as W}from"./vendor-react-core-_0sZDOLQ.js";import{c as K,b as N,B as V}from"./index-j07E1qHv.js";import{T as P,a as R,b as j,c as _}from"./tabs-BUF6w8PE.js";import{S as C}from"./skeleton-ClHfYp06.js";import{L as E}from"./LeagueTable-BYodKyuv.js";import{C as p,a as u,b as F,c as k}from"./card-DHmBnTdH.js";import{m as w}from"./vendor-framer-motion-C1oRD-X5.js";import{h as M,t as U,u as q,b as z,Z as D,l as O,aN as $,U as H,_ as J,w as Q,aF as A}from"./vendor-lucide-Ddz0eB7N.js";import{B}from"./badge-BXqwvh8U.js";import{D as L,E as I}from"./vendor-utils-BRu4i-LD.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-supabase-Ca6cp8v2.js";function Z({history:n}){return e.jsx(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:e.jsx(p,{className:"border-0 shadow-sm hover:shadow-md transition-shadow",children:e.jsxs(u,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:n.season}),e.jsxs("div",{className:"flex items-center gap-2 text-yellow-600",children:[e.jsx(M,{className:"w-5 h-5"}),e.jsx("span",{className:"font-semibold",children:n.champion})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-100 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(U,{className:"w-5 h-5 text-gray-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase",children:"Vice-Campeão"}),e.jsx("p",{className:"font-semibold text-gray-900",children:n.runner_up||"N/A"})]})]}),n.top_scorer&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-red-100 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(q,{className:"w-5 h-5 text-red-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase",children:"Melhor Marcador"}),e.jsxs("p",{className:"font-semibold text-gray-900",children:[n.top_scorer," (",n.top_scorer_goals," golos)"]})]})]}),n.best_defense&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(z,{className:"w-5 h-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase",children:"Melhor Defesa"}),e.jsx("p",{className:"font-semibold text-gray-900",children:n.best_defense})]})]}),n.total_goals&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(M,{className:"w-5 h-5 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase",children:"Total de Golos"}),e.jsxs("p",{className:"font-semibold text-gray-900",children:[n.total_goals," (",n.total_matches," jogos)"]})]})]})]}),n.relegated_teams&&n.relegated_teams.length>0&&e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase mb-2",children:"Despromovidos"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.relegated_teams.map((c,g)=>e.jsx("span",{className:"px-3 py-1 bg-red-50 text-red-700 text-sm rounded-full",children:c},g))})]})]})})})}function X({competitionName:n}){const[c,g]=T.useState("all"),{data:l=[],isLoading:m}=v({queryKey:["matches",n],queryFn:async()=>await N.entities.Match.filter({competition:n},"match_date")}),r=l.filter(a=>c==="all"?!0:a.status===c),t={scheduled:{label:"Agendado",color:"bg-blue-100 text-blue-700"},live:{label:"AO VIVO",color:"bg-red-600 text-white animate-pulse"},finished:{label:"Terminado",color:"bg-gray-100 text-gray-700"}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(p,{className:"border-0 shadow-sm",children:e.jsx(u,{className:"p-4",children:e.jsx(P,{value:c,onValueChange:g,children:e.jsxs(R,{className:"bg-gray-100 p-1 rounded-xl w-full",children:[e.jsx(j,{value:"all",className:"flex-1",children:"Todos"}),e.jsx(j,{value:"scheduled",className:"flex-1",children:"Agendados"}),e.jsx(j,{value:"live",className:"flex-1",children:"Ao Vivo"}),e.jsx(j,{value:"finished",className:"flex-1",children:"Terminados"})]})})})}),m?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(a=>e.jsx(C,{className:"h-32 rounded-xl"},a))}):r.length>0?e.jsx("div",{className:"space-y-4",children:r.map((a,h)=>{const y=new Date(a.match_date),x=t[a.status]||t.scheduled;return e.jsx(w.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:h*.05},children:e.jsx(G,{to:K(`MatchCenter?id=${a.id}`),children:e.jsx(p,{className:"border-0 shadow-sm hover:shadow-lg transition-shadow cursor-pointer",children:e.jsxs(u,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx(B,{className:x.color,children:x.label}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"w-4 h-4"}),L(y,"d 'de' MMMM",{locale:I})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O,{className:"w-4 h-4"}),L(y,"HH:mm")]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 items-center gap-4",children:[e.jsx("div",{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 mb-2",children:[a.home_logo&&e.jsx("img",{src:a.home_logo,alt:a.home_team,loading:"lazy",decoding:"async",className:"w-8 h-8 object-contain"}),e.jsx("span",{className:"font-bold text-gray-900",children:a.home_team})]})}),e.jsx("div",{className:"text-center",children:a.status==="finished"||a.status==="live"?e.jsxs("div",{className:"text-3xl font-bold text-gray-900",children:[a.home_score??0," - ",a.away_score??0]}):e.jsx("div",{className:"text-lg font-semibold text-gray-400",children:"VS"})}),e.jsx("div",{className:"text-left",children:e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"font-bold text-gray-900",children:a.away_team}),a.away_logo&&e.jsx("img",{src:a.away_logo,alt:a.away_team,loading:"lazy",decoding:"async",className:"w-8 h-8 object-contain"})]})})]}),a.venue&&e.jsxs("div",{className:"flex items-center justify-center gap-1 text-sm text-gray-500 mt-4",children:[e.jsx($,{className:"w-4 h-4"}),a.venue]})]})})})},a.id)})}):e.jsx(p,{className:"border-0 shadow-sm",children:e.jsxs(u,{className:"p-12 text-center",children:[e.jsx(D,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"Nenhum jogo encontrado"})]})})]})}function Y({competitionName:n}){const[c,g]=T.useState(""),[l,m]=T.useState(""),{data:r=[]}=v({queryKey:["standings",n,"2025/26"],queryFn:async()=>await N.entities.Standing.filter({competition_name:n,season:"2025/26"},"position")}),{data:t=[],isLoading:a}=v({queryKey:["h2h",c,l],queryFn:async()=>{if(!c||!l)return[];const s=await N.entities.Match.filter({home_team:c,away_team:l},"-match_date"),f=await N.entities.Match.filter({home_team:l,away_team:c},"-match_date");return[...s,...f].sort((d,b)=>new Date(b.match_date)-new Date(d.match_date))},enabled:!!(c&&l&&c!==l)}),h=r.map(s=>s.team_name),x=(()=>{if(!t.length)return null;const s=t.filter(i=>i.home_team===c&&i.home_score>i.away_score||i.away_team===c&&i.away_score>i.home_score).length,f=t.filter(i=>i.home_team===l&&i.home_score>i.away_score||i.away_team===l&&i.away_score>i.home_score).length,d=t.filter(i=>i.home_score===i.away_score).length,b=t.reduce((i,o)=>o.home_team===c?i+(o.home_score||0):o.away_team===c?i+(o.away_score||0):i,0),S=t.reduce((i,o)=>o.home_team===l?i+(o.home_score||0):o.away_team===l?i+(o.away_score||0):i,0);return{team1Wins:s,team2Wins:f,draws:d,team1Goals:b,team2Goals:S}})();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(p,{className:"border-0 shadow-lg",children:[e.jsx(F,{className:"bg-gradient-to-r from-red-600 to-red-700",children:e.jsxs(k,{className:"text-white flex items-center gap-2",children:[e.jsx(H,{className:"w-5 h-5"}),"Confronto Direto"]})}),e.jsx(u,{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Equipa 1"}),e.jsxs("select",{value:c,onChange:s=>g(s.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-red-600 focus:border-transparent",children:[e.jsx("option",{value:"",children:"Selecionar equipa"}),h.map(s=>e.jsx("option",{value:s,children:s},s))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Equipa 2"}
1),e.jsxs("select",{value:l,onChange:s=>m(s.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-red-600 focus:border-transparent",children:[e.jsx("option",{value:"",children:"Selecionar equipa"}),h.filter(s=>s!==c).map(s=>e.jsx("option",{value:s,children:s},s))]})]})]})})]}),c&&l&&c!==l&&e.jsx(e.Fragment,{children:a?e.jsx(C,{className:"h-64 rounded-xl"}):x&&t.length>0?e.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:[e.jsx(p,{className:"border-0 shadow-lg",children:e.jsxs(u,{className:"p-8",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl font-bold text-red-600 mb-2",children:x.team1Wins}),e.jsx("div",{className:"text-sm text-gray-600",children:c}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"Vitórias"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl font-bold text-gray-600 mb-2",children:x.draws}),e.jsx("div",{className:"text-sm text-gray-600",children:"Empates"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl font-bold text-blue-600 mb-2",children:x.team2Wins}),e.jsx("div",{className:"text-sm text-gray-600",children:l}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"Vitórias"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-6 py-6 border-t",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-gray-900 mb-1",children:x.team1Goals}),e.jsx("div",{className:"text-xs text-gray-500",children:"Golos Marcados"})]}),e.jsx("div",{className:"text-center",children:e.jsx(M,{className:"w-8 h-8 text-yellow-500 mx-auto"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-gray-900 mb-1",children:x.team2Goals}),e.jsx("div",{className:"text-xs text-gray-500",children:"Golos Marcados"})]})]}),e.jsx("div",{className:"text-center pt-6 border-t",children:e.jsxs("p",{className:"text-sm text-gray-500",children:["Total de jogos disputados: ",e.jsx("span",{className:"font-bold text-gray-900",children:t.length})]})})]})}),e.jsxs(p,{className:"border-0 shadow-lg",children:[e.jsx(F,{children:e.jsxs(k,{className:"flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5"}),"Jogos Recentes"]})}),e.jsx(u,{className:"p-6",children:e.jsx("div",{className:"space-y-3",children:t.slice(0,5).map((s,f)=>{const d=new Date(s.match_date),b=s.home_team===c,S=b?s.home_score:s.away_score,i=b?s.away_score:s.home_score;let o="bg-gray-100 text-gray-700";return S>i&&(o="bg-green-100 text-green-700"),S<i&&(o="bg-red-100 text-red-700"),e.jsxs(w.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:f*.1},className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e.jsx(B,{className:o,children:L(d,"d MMM yyyy",{locale:I})}),e.jsx("span",{className:"text-sm text-gray-600",children:s.competition})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"font-semibold text-gray-900",children:s.home_team}),e.jsxs("span",{className:"text-2xl font-bold text-gray-900",children:[s.home_score??"-"," : ",s.away_score??"-"]}),e.jsx("span",{className:"font-semibold text-gray-900",children:s.away_team})]})]},s.id)})})})]})]}):e.jsx(p,{className:"border-0 shadow-sm",children:e.jsxs(u,{className:"p-12 text-center",children:[e.jsx(H,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"Nenhum confronto encontrado entre estas equipas"})]})})})]})}function ee({competitionName:n,season:c}){const{data:g=[],isLoading:l}=v({queryKey:["scorers",n,c],queryFn:async()=>{const r=await N.entities.Match.filter({competition:n,status:"finished"});if(r.length===0)return[];const t=r.map(h=>h.id),a=[];for(const h of t){const y=await N.entities.MatchEvent.filter({match_id:h,event_type:"goal"});a.push(...y)}return a}}),m=W.useMemo(()=>{const r={};return g.forEach(t=>{t.player_name&&(r[t.player_name]||(r[t.player_name]={name:t.player_name,goals:0,team:t.team}),r[t.player_name].goals++)}),Object.values(r).sort((t,a)=>a.goals-t.goals).slice(0,10)},[g]);return e.jsxs(p,{className:"border-0 shadow-lg",children:[e.jsx(F,{className:"bg-gradient-to-r from-yellow-500 to-yellow-600",children:e.jsxs(k,{className:"text-white flex items-center gap-2",children:[e.jsx(q,{className:"w-5 h-5"}),"Melhores Marcadores"]})}),e.jsx(u,{className:"p-6",children:l?e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(r=>e.jsx(C,{className:"h-16 rounded-lg"},r))}):m.length>0?e.jsx("div",{className:"space-y-3",children:m.map((r,t)=>e.jsxs(w.div,{initial:{opacity:0,x:-20}
1,animate:{opacity:1,x:0},transition:{delay:t*.05},className:"flex items-center gap-4 p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors",children:[e.jsxs("div",{className:`w-10 h-10 rounded-full flex items-center justify-center font-bold ${t===0?"bg-yellow-500 text-white":t===1?"bg-gray-400 text-white":t===2?"bg-amber-700 text-white":"bg-gray-200 text-gray-700"}`,children:[t===0&&e.jsx(U,{className:"w-5 h-5"}),t!==0&&t+1]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-bold text-gray-900",children:r.name}),e.jsx("p",{className:"text-sm text-gray-500",children:r.team==="home"?"Casa":"Fora"})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-2xl font-bold text-red-600",children:r.goals}),e.jsx("div",{className:"text-xs text-gray-500",children:r.goals===1?"golo":"golos"})]})]},r.name))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(q,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"Ainda sem dados de marcadores"})]})})]})}function he({defaultCompetitionName:n="Girabola",displayName:c}){const l=new URLSearchParams(window.location.search).get("name")||n,m=c||l,[r,t]=T.useState("2025/26"),{data:a=[],isLoading:h}=v({queryKey:["standings",l,r],queryFn:async()=>await N.entities.Standing.filter({competition_name:l,season:r},"position"),initialData:[]}),{data:y=[],isLoading:x}=v({queryKey:["history",l],queryFn:async()=>await N.entities.SeasonHistory.filter({competition_name:l},"-season"),initialData:[]}),{data:s}=v({queryKey:["competition",l],queryFn:async()=>(await N.entities.Competition.filter({name:l}))[0],initialData:null}),f=["2025/26","2024/25","2023/24","2022/23","2021/22"];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(G,{to:K("Competitions"),children:e.jsxs(V,{variant:"ghost",className:"text-white hover:bg-white/10 mb-6",children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),"Voltar às Competições"]})}),e.jsxs(w.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex items-center gap-6",children:[e.jsx("div",{className:"w-20 h-20 bg-white/10 backdrop-blur-lg rounded-2xl flex items-center justify-center",children:e.jsx(M,{className:"w-10 h-10 text-yellow-500"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-white mb-2",children:m}),e.jsx("p",{className:"text-gray-400 text-lg",children:(s==null?void 0:s.description)||"Competição Nacional de Futebol"})]})]})]})}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs(P,{defaultValue:"standings",className:"space-y-6",children:[e.jsxs(R,{className:"bg-white shadow-sm p-1 rounded-xl overflow-x-auto flex-wrap",children:[e.jsxs(j,{value:"standings",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:[e.jsx(Q,{className:"w-4 h-4 mr-2"}),"Classificação"]}),e.jsxs(j,{value:"fixtures",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:[e.jsx(D,{className:"w-4 h-4 mr-2"}),"Calendário"]}),e.jsxs(j,{value:"scorers",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:[e.jsx(q,{className:"w-4 h-4 mr-2"}),"Marcadores"]}),e.jsxs(j,{value:"h2h",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Confrontos"]}),e.jsxs(j,{value:"history",className:"data-[state=active]:bg-red-600 data-[state=active]:text-white",children:[e.jsx(A,{className:"w-4 h-4 mr-2"}),"Histórico"]})]}),e.jsxs(_,{value:"standings",className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4 bg-white p-4 rounded-xl shadow-sm",children:[e.jsx("span",{className:"font-semibold text-gray-900",children:"Temporada:"}),e.jsx("div",{className:"flex gap-2",children:f.map(d=>e.jsx(V,{variant:r===d?"default":"outline",size:"sm",onClick:()=>t(d),className:r===d?"bg-red-600 hover:bg-red-700":"",children:d},d))})]}),h?e.jsx(C,{className:"h-[600px] rounded-xl"}):a.length>0?e.jsx(E,{standings:a,competition:m}):e.jsxs("div",{className:"bg-white rounded-xl p-12 text-center shadow-sm",children:[e.jsx(M,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsxs("p",{className:"text-gray-500",children:["Classificação não disponível para a temporada ",r]})]})]}),e.jsx(_,{value:"fixtures",children:e.jsx(X,{competitionName:l})}),e.jsx(_,{value:"scorers",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsx(ee,{competitionName:l,season:r})}),e.jsx("div",{children:a.length>0&&e.jsx(E,{standings:a.slice(0,5),competition:m})})]})}),e.jsx(_,{value:"h2h",children:e.jsx(Y,{competitionName:l})}),e.jsx(_,{value:"history",className:"space-y-6",children:x?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[1,2,3,4].map(d=>
1e.jsx(C,{className:"h-64 rounded-xl"},d))}):y.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:y.map((d,b)=>e.jsx(Z,{history:d},d.id))}):e.jsxs("div",{className:"bg-white rounded-xl p-12 text-center shadow-sm",children:[e.jsx(A,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"Histórico não disponível para esta competição"})]})})]})})})]})}export{he 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.