PageSourceSearch

https://fedeesp.org.br/assets/SchoolProfile-BnEahT91.js

js fedeesp.org.br collected 2026-10-04 07:47:58 UTC 27,850 bytes, 1 lines download raw bytes

1import{j as e,b as L}from"./index-BbKxumrM.js";import{h as ge,r as h,L as ee}from"./react-vendor-DT1_wbt4.js";import{i as fe}from"./importerService-CJBLwWQJ.js";import{c as ue,a as ye}from"./rankingPaulistaService-pKKq8az2.js";import{ai as be,r as se,y as Q,a3 as Ne,an as oe,aJ as je,a5 as we,aA as Se,q as ae,c as ve,al as ke,aK as Ie,j as Ce,ay as Me,z as ze,x as $e,ah as Ae,aL as Ee}from"./ui-vendor-BfDHuItz.js";import"./firebase-vendor-CSkRnVBi.js";import"./_shared-DmxjeCpw.js";import"./xlsx-DraEgqC5.js";const Ge=()=>{const{id:a}=ge(),[t,f]=h.useState(null),[S,j]=h.useState([]),[z,p]=h.useState([]),[c,$]=h.useState([]),[w,B]=h.useState([]),[b,O]=h.useState([]),[_,X]=h.useState([]),[n,g]=h.useState([]),[v,F]=h.useState([]),[R,T]=h.useState([]),[d,u]=h.useState([]),[y,N]=h.useState([]),[I,k]=h.useState(!0),[M,q]=h.useState(new Date().getFullYear());h.useEffect(()=>{(async()=>{if(a){k(!0);try{const[i,m,x,o]=await Promise.all([L.getSchoolById(a),L.getCompetitions(),L.getSchools(),L.getSports()]);if(!i){k(!1);return}f(i),B(m||[]),j(x||[]),T(o||[]);const[s,l]=await Promise.all([L.getRegistrations(a),L.getAthletes(a).catch(()=>[])]);$(s||[]),F(l||[]);const E=Array.from(new Set([...(m||[]).map(C=>String(C.id))])).filter(Boolean),[D,J,V,Y,te,me]=await Promise.all([Promise.all(E.map(C=>L.getMatchesByCompetition(C).catch(()=>[]))),Promise.all(E.map(C=>L.getRankings(C).catch(()=>[]))),Promise.all(E.map(C=>L.getRegistrations(void 0,C).catch(()=>[]))),Promise.all(E.map(C=>L.getEtapasByCompetition(C).catch(()=>[]))),L.getLocais().catch(()=>[]),L.getDisputes().catch(()=>[])]);u(Y.flat()),N(te||[]),g(me||[]);const xe=D.flat(),ie=new Set((s||[]).map(C=>String(C.id))),pe=xe.filter(C=>ie.has(String(C.homeTeamRegistrationId||""))||ie.has(String(C.awayTeamRegistrationId||""))||C.homeTeamName&&i.name&&C.homeTeamName.includes(i.name)||C.awayTeamName&&i.name&&C.awayTeamName.includes(i.name));p(pe.sort((C,he)=>(he.date||"").localeCompare(C.date||""))),O(J.flat()),X(V.flat())}catch(i){console.error(i)}finally{k(!1)}}})()},[a]);const A=r=>{if(!r)return null;if(typeof r=="string"){const i=/(\d{4})/.exec(r);return i?parseInt(i[1],10):null}return r!=null&&r.seconds?new Date(r.seconds*1e3).getFullYear():r!=null&&r.toDate?r.toDate().getFullYear():null},H=(r,i)=>{const m=[r.eventDate,r.date,r.startDate,r.createdAt,r.period];for(const o of m)if(A(o)===i)return!0;return!!(r.competitionName||"").includes(String(i))},Z=h.useMemo(()=>c.filter(r=>H(r,M)),[c,M]),K=h.useMemo(()=>z.filter(r=>H(r,M)),[z,M]),U=h.useMemo(()=>new Set(c.map(r=>String(r.id))),[c]),P=h.useMemo(()=>b.filter(r=>{if(r.registrationId&&!U.has(String(r.registrationId)))return!1;if(!r.registrationId&&t){const m=x=>fe.normalizeString(x);if(m(r.teamName)!==m(t.name))return!1}const i=w.find(m=>String(m.id)===String(r.competitionId));if(i){const m=A(i.startDate||i.period||"");if(m&&m!==M)return!1}return!0}),[b,U,t,w,M]),re=h.useMemo(()=>{const r=new Set(Z.map(s=>String(s.competitionId))),i=new Set;Z.forEach(s=>{(s.athleteIds||[]).forEach(l=>i.add(String(l)))});const m=P.filter(s=>Number(s.pos)===1).length,x=P.filter(s=>Number(s.pos)===2).length,o=P.filter(s=>Number(s.pos)===3).length;return{competicoes:r.size,atletas:i.size,golds:m,silvers:x,bronzes:o,totalMedalhas:m+x+o}},[Z,P]),W=h.useMemo(()=>{if(!t||S.length===0)return null;const r={registrations:_,rankings:b,competitions:w,sports:R,disputes:n}
1,i=ue(S.map(o=>({id:o.id,name:o.name,city:o.city,state:o.state})),r,{year:M}),m=i.findIndex(o=>String(o.schoolId)===String(t.id)),x=m>=0?i[m]:null;return{position:m>=0?m+1:null,total:i.length,percentile:i.length>0&&m>=0?Math.round((i.length-m)/i.length*100):null,pontos:(x==null?void 0:x.pontos)||0,pontosColocacao:(x==null?void 0:x.pontosColocacao)||0,pontosParticipacao:(x==null?void 0:x.pontosParticipacao)||0}},[b,_,n,S,w,R,t,M]),le=h.useMemo(()=>{var x;const r=new Map,i=new Set,m=o=>String(o??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase();for(const o of P){const s=c.find(te=>String(te.id)===String(o.registrationId)),l=(x=s==null?void 0:s.athleteIds)==null?void 0:x[0],E=(s==null?void 0:s.athleteName)||o.teamName;if(!E)continue;const D=Number(o.pos);if(!(D>=1&&D<=3))continue;const J=[m((s==null?void 0:s.sportName)||o.sportName),m((s==null?void 0:s.category)||(s==null?void 0:s.categoryName)||o.categoryName),String((s==null?void 0:s.gender)||o.gender||""),m((s==null?void 0:s.divisao)||(s==null?void 0:s.prova)),String(l||E),String(D)].join("|");if(i.has(J))continue;i.add(J);const V=String(l||E),Y=r.get(V)||{name:E,athleteId:l,gold:0,silver:0,bronze:0,pts:0};D===1?(Y.gold++,Y.pts+=3):D===2?(Y.silver++,Y.pts+=2):D===3&&(Y.bronze++,Y.pts+=1),r.set(V,Y)}return Array.from(r.values()).filter(o=>o.pts>0).sort((o,s)=>s.pts-o.pts).slice(0,5)},[P,c]),ce=h.useMemo(()=>{var o;const r=new Map,i=new Set,m=s=>String(s??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase();for(const s of P){const l=c.find(Y=>String(Y.id)===String(s.registrationId)),E=(l==null?void 0:l.sportName)||s.sportName||"Outras",D=Number(s.pos),J=D===1?3:D===2?2:D===3?1:0;if(J===0)continue;const V=[m(E),m((l==null?void 0:l.category)||(l==null?void 0:l.categoryName)||s.categoryName),String((l==null?void 0:l.gender)||s.gender||""),m((l==null?void 0:l.divisao)||(l==null?void 0:l.prova)),String(((o=l==null?void 0:l.athleteIds)==null?void 0:o[0])||s.teamName||(l==null?void 0:l.schoolId)||""),String(D)].join("|");i.has(V)||(i.add(V),r.set(E,(r.get(E)||0)+J))}const x=Array.from(r.values()).reduce((s,l)=>s+l,0);return x===0?[]:Array.from(r.entries()).map(([s,l])=>({sport:s,pts:l,percent:l/x})).sort((s,l)=>l.pts-s.pts)},[P,c]),ne=h.useMemo(()=>{const r=Date.now();return K.filter(i=>(i.date?new Date(i.date).getTime():0)>r&&i.status!=="finished").sort((i,m)=>(i.date||"").localeCompare(m.date||"")).slice(0,5)},[K]),G=h.useMemo(()=>{var i,m;const r=new Map;for(const x of c){const o=A(x.eventDate||x.createdAt)||A((i=w.find(l=>String(l.id)===String(x.competitionId)))==null?void 0:i.startDate);if(!o)continue;const s=r.get(o)||{competicoes:new Set,gold:0,silver:0,bronze:0};s.competicoes.add(String(x.competitionId)),r.set(o,s)}for(const x of b){const o=c.find(D=>String(D.id)===String(x.registrationId));if(!o||String(o.schoolId)!==String((t==null?void 0:t.id)||""))continue;const s=A((m=w.find(D=>String(D.id)===String(x.competitionId)))==null?void 0:m.startDate);if(!s)continue;const l=r.get(s)||{competicoes:new Set,gold:0,silver:0,bronze:0},E=Number(x.pos);E===1?l.gold++:E===2?l.silver++:E===3&&l.bronze++,r.set(s,l)}return Array.from(r.entries()).map(([x,o])=>({year:x,competicoes:o.competicoes.size,gold:o.gold,silver:o.silver,bronze:o.bronze,total:o.gold+o.silver+o.bronze})).sort((x,o)=>o.year-x.year)},[c,b,w,t]),de=h.useMemo(()=>{const r=new Set([new Date().getFullYear()]);return G.forEach(i=>r.add(i.year)),Array.from(r).sort((i,m)=>m-i)},[G]);return I?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsx(be,{className:"animate-spin text-fedeesp-red",size:32})}):t?e.jsxs("div",{className:"bg-gray-50 min-h-screen pb-20",children:[e.jsx(De,{school:t,year:M,availableYears:de,onYearChange:q}),e.jsxs("div",{className:"max-w-6xl mx-auto px-6 -mt-8 space-y-8",children:[e.jsx(Te,{kpis:re,stateRanking:W,year:M}),W&&W.percentile!==null&&e.jsx(Pe,{percentile:W.percentile,position:W.position,total:W.total}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(Be,{atletas:le}),e.jsx(Fe,{data:ce})]}),ne.length>0&&e.jsx(Re,{matches:ne,competitions:w,registrations:_,schools:S}),e.jsx(Le,{registrations:Z,competitions:w,rankings:P,athletes:v,etapas:d,locais:y}),G.length>1&&e.jsx(Ye,{data:G}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(Oe,{school:t}),e.jsx(Ue,{school:t,kpis:re,year:M})]})]})]}):e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-gray-50 p-6 text-center",children:[e.jsx(se,{size:48,className:"text-gray-300 mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Escola não encontrada"}),e.jsx(ee,{to:"/",className:"text-fedeesp-red hover:underline",children:"Voltar à FEDEESP"})]})},De=({school:a,year:t,availableYears:f,onYearChange:S})=>e.jsx("div",{className:"bg-gradient-to-br from-gray-900 via-gray-800 to-fedeesp-red text-white",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 pt-12 pb-16",children:[e.jsx(ee,{to:"/",className:"inline-flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest text-white/70 hover:text-white mb-6",children:"← FEDEESP"}),e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-end gap-6",children:[e.jsx("div",{className:"h-28 w-28 md:h-32 md:w-32 rounded-3xl bg-white p-3 shadow-2xl shrink-0 flex items-center justify-center",children:a.logoUrl?e.jsx("img",{src:a.logoUrl,alt:a.name,className:"w-full h-full object-contain"}):e.jsx("span",{className:"text-fedeesp-red font-black text-4xl",children:a.name.charAt(0)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-white/60 mb-1",children:"PERFIL DA ESCOLA"}),e.jsx("h1",{className:"text-3xl md:text-4xl font-black tracking-tighter break-words",children:a.name}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-white/80",children:[a.city&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Q,{size:14}),a.city,a.state?`/${a.state}`:""]}),a.inep&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["INEP ",a.inep]})]})]}),e.jsxs("div",{className:"shrink-0",children:[e.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-white/60 mb-1",children:"Temporada"}),e.jsx("select",{value:t,onChange:j=>
1S(parseInt(j.target.value,10)),className:"bg-white/10 border border-white/20 text-white rounded-xl px-3 py-2 text-sm font-bold focus:ring-2 focus:ring-white/40 outline-none backdrop-blur-sm",children:f.map(j=>e.jsx("option",{value:j,className:"text-gray-900",children:j},j))})]})]})]})}),Te=({kpis:a,stateRanking:t,year:f})=>{const S=[{icon:e.jsx(se,{size:20}),label:"Competições",value:a.competicoes,sub:"participando"},{icon:e.jsx(Ne,{size:20}),label:"Atletas",value:a.atletas,sub:"inscritos"},{icon:e.jsx(oe,{size:20}),label:"Medalhas",value:a.totalMedalhas,sub:a.totalMedalhas>0?`${a.golds}🥇 ${a.silvers}🥈 ${a.bronzes}🥉`:"—"},{icon:e.jsx(je,{size:20}),label:`Ranking SP/${f}`,value:t!=null&&t.position?`#${t.position}`:"—",sub:t!=null&&t.total?`${t.pontos} pts · de ${t.total} escolas`:"Portaria FEDEESP 02/2025"}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:S.map((j,z)=>e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-fedeesp-red",children:j.icon}),e.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400",children:j.label})]}),e.jsx("div",{className:"text-3xl md:text-4xl font-black tracking-tighter text-gray-900",children:j.value}),e.jsx("div",{className:"text-[11px] text-gray-500 mt-1",children:j.sub})]},z))})},Pe=({percentile:a,position:t,total:f})=>{const S=a>=90?"TOP 10% das escolas paulistas":a>=75?"Acima da média estadual":a>=50?"Entre as 50% melhores":a>=25?"Em ascensão":"Em construção",j=a>=75?"from-emerald-500 to-emerald-700":a>=50?"from-amber-500 to-amber-700":"from-gray-500 to-gray-700";return e.jsxs("div",{className:`rounded-2xl bg-gradient-to-r ${j} text-white p-6 shadow-sm flex items-center gap-4`,children:[e.jsx(we,{size:36,className:"shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-80 mb-1",children:"Comparativo Estadual"}),e.jsx("p",{className:"text-lg md:text-xl font-black tracking-tight",children:S}),e.jsxs("p",{className:"text-xs opacity-90 mt-0.5",children:[t?`Posição #${t} de ${f} escolas`:"Sem posição calculada"," · percentil ",a,"%"]})]})]})},Be=({atletas:a})=>e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(oe,{size:16,className:"text-fedeesp-red"})," Top 5 Medalhistas"]}),a.length===0?e.jsx("p",{className:"text-sm text-gray-500 italic",children:"Nenhuma medalha registrada nesta temporada."}):e.jsx("ol",{className:"space-y-2.5",children:a.map((t,f)=>e.jsxs("li",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`shrink-0 flex items-center justify-center h-8 w-8 rounded-full text-xs font-black ${f===0?"bg-amber-100 text-amber-800":f===1?"bg-gray-200 text-gray-700":f===2?"bg-orange-100 text-orange-800":"bg-gray-100 text-gray-500"}`,children:f+1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[t.athleteId?e.jsx(ee,{to:`/atleta?id=${encodeURIComponent(String(t.athleteId))}`,className:"text-sm font-bold text-gray-900 hover:text-fedeesp-red transition-colors truncate block",children:t.name}):e.jsx("span",{className:"text-sm font-bold text-gray-900 truncate block",children:t.name}),e.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:[t.gold>0&&e.jsxs("span",{children:[t.gold,"🥇 "]}),t.silver>0&&e.jsxs("span",{children:[t.silver,"🥈 "]}),t.bronze>0&&e.jsxs("span",{children:[t.bronze,"🥉"]})]})]}),e.jsxs("span",{className:"text-[10px] font-black text-fedeesp-red",children:[t.pts,"pts"]})]},f))})]}),Fe=({data:a})=>{const t=["#ED1A3B","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316"];let z=0;const p=a.map((c,$)=>{const w=z*2*Math.PI;z+=c.percent;const B=z*2*Math.PI,b=80+70*Math.sin(w),O=80-70*Math.cos(w),_=80+70*Math.sin(B),X=80-70*Math.cos(B),n=B-w>Math.PI?1:0;return{path:`M 80 80 L ${b} ${O} A 70 70 0 ${n} 1 ${_} ${X} Z`,color:t[$%t.length],...c}});return e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(Se,{size:16,className:"text-fedeesp-red"})," Mapa de Força (por modalidade)"]}),a.length===0?e.jsx("p",{className:"text-sm text-gray-500 italic",children:"Sem medalhas nesta temporada pra calcular."}):e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-6",children:[e.jsx("svg",{viewBox:"0 0 160 160",className:"w-40 h-40 shrink-0",children:p.length===1?e.jsx("circle",{cx:80,cy:80,r:70,fill:p[0].color}):p.map((c,$)=>e.jsx("path",{d:c.path,fill:c.color},$))}),e.jsx("ul",{className:"flex-1 space-y-2 w-full",children:p.map((c,$)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-3 h-3 rounded-sm shrink-0",style:{background:c.color}}),e.jsx("span",{className:"font-bold text-gray-900 truncate flex-1",children:c.sport}),e.jsxs("span",{className:"text-gray-500 shrink-0",children:[Math.round(c.percent*100),"%"]})]},$))})]})]})},Re=({matches:a,competitions:t,registrations:f,schools:S})=>{const j=p=>{if(!p||p==="_no_school"||p==="undefined")return;const c=S.find($=>String($.id)===String(p));return c==null?void 0:c.name},z=(p,c)=>{const $=c==="home"?p.homeTeamRegistrationId:p.awayTeamRegistrationId,w=c==="home"?p.homeTeamName:p.awayTeamName,B=p[c==="home"?"homeTeam":"awayTeam"];if($){const b=f.find(O=>String(O.id)===String($));if(b){const O=j(b.schoolId);return b.type==="individual"?b.athleteName||b.teamName||b.schoolName||O||w||B||"Atleta":b.teamName||b.customTeamName||b.schoolName||O||b.athleteName||w||B||"A definir"}}return w||B||"A definir"};return e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(ae,{size:16,className:"text-fedeesp-red"})," Próximos Compromissos"]}),e.jsx("ul",{className:"divide-y divide-gray-100",children:a.map(p=>{const c=t.find(B=>String(B.id)===String(p.competitionId)),$=z(p,"home"),w=z(p,"away");return e.jsxs("li",{className:"py-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-sm font-bold text-gray-900 truncate",children:[$," ",e.jsx("span",{className:"text-gray-400 font-normal",children:"vs"})," ",w]}),e.jsxs("p",{className:"text-[11px] text-gray-500 mt-0.5",children:[(c==null?void 0:c.name)||"—",p.category?` · ${p.category}`:""]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("p",{className:"text-xs font-bold text-gray-700",children:Ke(p.date)}),p.time&&e.jsx("p",{className:"text-[11px] text-gray-500",children:p.time})]})]}
1,p.id)})})]})},Le=({registrations:a,competitions:t,rankings:f,athletes:S,etapas:j,locais:z})=>{const p=h.useMemo(()=>{const n=new Map;return j.forEach(g=>n.set(String(g.id),g)),n},[j]),c=h.useMemo(()=>{const n=new Map;return z.forEach(g=>n.set(String(g.id),g)),n},[z]),$=n=>{var d,u;if(!(n!=null&&n.length))return{};const g=n[0],v=g.etapaId?p.get(String(g.etapaId)):void 0;let F=(v==null?void 0:v.date)||g.eventDate,R=(v==null?void 0:v.localId)||g.localId;if(!F||!R){const y=t.find(I=>String(I.id)===String(g.competitionId)),N=(v==null?void 0:v.name)||g.etapaName;if(y&&N)for(const I of y.sportsConfig||[]){const k=(d=I.dateEvents)==null?void 0:d.find(M=>M.name===N);if(k){!F&&k.date&&(F=k.date),!R&&k.localId&&(R=k.localId);break}}}const T=R?(u=c.get(String(R)))==null?void 0:u.name:void 0;return{date:F,localName:T}},w=n=>{if(!n)return;const g=/^(\d{4})-(\d{2})-(\d{2})/.exec(n);return g?`${g[3]}/${g[2]}/${g[1]}`:n},B=h.useMemo(()=>{const n=new Map;return S.forEach(g=>n.set(String(g.id),g)),n},[S]),b=h.useMemo(()=>{const n=new Map,g=d=>String(d??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase().replace(/\s+/g," "),v=d=>g(ye(String(d||"").trim()))||"outras",F=d=>(String(d).match(/[A-ZÀ-Ü]/g)||[]).length,R=(d,u)=>{const y=d.trim(),N=u.trim();return F(N)!==F(y)?F(N)>F(y)?N:y:N.length>y.length?N:y};for(const d of a){const u=d.sportName||d.sport||d.modality||"Outras",y=v(u),N=`${d.category||d.categoryName||"Sem Categoria"}|${d.gender||""}`;let I=n.get(y);I?I.sport=R(I.sport,String(u)):(I={sport:String(u).trim(),categories:new Map,gold:0,silver:0,bronze:0},n.set(y,I));let k=I.categories.get(N);k||(k={name:d.category||d.categoryName||"Sem Categoria",gender:d.gender||"",regs:[]},I.categories.set(N,k)),k.regs.push(d)}const T=new Set;for(const d of f){const u=a.find(k=>String(k.id)===String(d.registrationId)),y=n.get(v((u==null?void 0:u.sportName)||d.sportName||"Outras"));if(!y)continue;const N=Number(d.pos),I=`${String(d.disputeId||"")}|${String((u==null?void 0:u.schoolId)||"")}|${N}`;T.has(I)||(T.add(I),N===1?y.gold++:N===2?y.silver++:N===3&&y.bronze++)}return Array.from(n.values()).sort((d,u)=>d.sport.localeCompare(u.sport,"pt-BR"))},[a,f]),[O,_]=h.useState(new Set),X=n=>{_(g=>{const v=new Set(g);return v.has(n)?v.delete(n):v.add(n),v})};return b.length===0?e.jsx("div",{className:"bg-white rounded-2xl border border-gray-100 p-8 shadow-sm text-center text-sm text-gray-500",children:"Nenhuma inscrição nesta temporada."}):e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-900 px-6 pt-6 pb-3 flex items-center gap-2",children:[e.jsx(se,{size:16,className:"text-fedeesp-red"})," Modalidades & Categorias"]}),e.jsx("div",{className:"divide-y divide-gray-100",children:b.map(n=>{const g=O.has(n.sport),v=new Set,F=new Set;Array.from(n.categories.values()).forEach(T=>{T.regs.forEach(d=>{var u;if(d.type==="team"&&Array.isArray(d.athleteIds))d.athleteIds.forEach(y=>v.add(String(y)));else{const y=(u=d.athleteIds)==null?void 0:u[0],N=d.athleteName||d.teamName||"";F.add(y?`id:${y}`:`name:${N}`)}})});const R=v.size+F.size;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>X(n.sport),className:"w-full flex items-center justify-between gap-4 px-6 py-4 hover:bg-gray-50 transition-colors text-left",children:[e.jsxs("span",{className:"flex items-center gap-3 min-w-0",children:[g?e.jsx(ve,{size:18,className:"text-fedeesp-red shrink-0"}):e.jsx(ke,{size:18,className:"text-gray-400 shrink-0"}),e.jsx("span",{className:"text-sm font-black tracking-tight text-gray-900 truncate",children:n.sport})]}),e.jsxs("span",{className:"flex items-center gap-3 shrink-0 text-[11px] text-gray-500",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-gray-900",children:R})," atletas"]}),n.gold+n.silver+n.bronze>0&&e.jsxs("span",{className:"hidden sm:inline",children:[n.gold>0&&`${n.gold}🥇 `,n.silver>0&&`${n.silver}🥈 `,n.bronze>0&&`${n.bronze}🥉`]}),e.jsxs("span",{className:"text-[10px] uppercase font-bold text-gray-400",children:[n.categories.size," cat"]})]})]}),g&&e.jsx("div",{className:"bg-gray-50 px-6 py-4 space-y-3",children:Array.from(n.categories.values()).map((T,d)=>{const u=Array.from(new Set(T.regs.map(k=>{var M;return k.competitionName||((M=t.find(q=>String(q.id)===String(k.competitionId)))==null?void 0:M.name)||""}
1))).filter(Boolean),{date:y,localName:N}=$(T.regs),I=w(y);return e.jsx("div",{className:"bg-white rounded-xl border border-gray-100 p-4",children:(()=>{const k=new Set,M=new Set,q=[];return T.regs.forEach((A,H)=>{var Z;if(A.type==="team"&&Array.isArray(A.athleteIds)&&A.athleteIds.length>0)A.athleteIds.forEach(K=>{const U=String(K);if(k.has(U))return;k.add(U);const P=B.get(U);q.push({aid:U,label:(P==null?void 0:P.name)||"Atleta"})});else{const K=(Z=A.athleteIds)==null?void 0:Z[0],U=A.athleteName||A.teamName||`Atleta ${H+1}`,P=K?`id:${K}`:`name:${U}`;if(M.has(P))return;M.add(P),q.push({aid:K?String(K):void 0,label:U})}}),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("h4",{className:"text-xs font-black tracking-tight text-gray-900",children:[T.name,T.gender?` · ${T.gender==="M"?"Masculino":T.gender==="F"?"Feminino":"Misto"}`:""]}),e.jsxs("span",{className:"text-[10px] uppercase tracking-widest font-bold text-gray-400",children:[q.length," atleta(s)"]})]}),u.length>0&&e.jsx("p",{className:"text-[11px] text-gray-500 mb-1",children:u.join(" · ")}),(I||N)&&e.jsxs("p",{className:"text-[11px] text-gray-600 mb-2 flex items-center gap-3 flex-wrap",children:[I&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ae,{size:11,className:"text-gray-400"})," ",I]}),N&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Q,{size:11,className:"text-gray-400"})," ",N]})]}),e.jsx("ul",{className:"flex flex-wrap gap-1.5",children:q.map((A,H)=>A.aid?e.jsx(ee,{to:`/atleta?id=${encodeURIComponent(A.aid)}`,className:"inline-flex items-center rounded-full bg-fedeesp-red/10 hover:bg-fedeesp-red/20 text-fedeesp-red px-3 py-1 text-[11px] font-bold transition-colors",children:A.label},H):e.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 text-gray-700 px-3 py-1 text-[11px] font-bold",children:A.label},H))})]})})()},d)})})]},n.sport)})})]})},Ye=({data:a})=>e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(ae,{size:16,className:"text-fedeesp-red"})," Histórico Anual"]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100 text-[10px] font-black uppercase tracking-widest text-gray-400",children:[e.jsx("th",{className:"text-left py-2",children:"Ano"}),e.jsx("th",{className:"text-right py-2",children:"Competições"}),e.jsx("th",{className:"text-right py-2",children:"🥇"}),e.jsx("th",{className:"text-right py-2",children:"🥈"}),e.jsx("th",{className:"text-right py-2",children:"🥉"}),e.jsx("th",{className:"text-right py-2",children:"Total"})]})}),e.jsx("tbody",{children:a.map(t=>e.jsxs("tr",{className:"border-b border-gray-50 last:border-0",children:[e.jsx("td",{className:"py-2.5 font-black text-gray-900",children:t.year}),e.jsx("td",{className:"py-2.5 text-right text-gray-700",children:t.competicoes}),e.jsx("td",{className:"py-2.5 text-right text-gray-700",children:t.gold||"—"}),e.jsx("td",{className:"py-2.5 text-right text-gray-700",children:t.silver||"—"}),e.jsx("td",{className:"py-2.5 text-right text-gray-700",children:t.bronze||"—"}),e.jsx("td",{className:"py-2.5 text-right font-black text-fedeesp-red",children:t.total})]},t.year))})]})})]}),Oe=({school:a})=>{const t=[{icon:e.jsx(Q,{size:14}),label:"Endereço",value:[a.address,a.city,a.state].filter(Boolean).join(", ")},{icon:e.jsx(Ie,{size:14}),label:"Telefone",value:a.phone},{icon:e.jsx(Ce,{size:14}),label:"E-mail",value:a.email}].filter(f=>!!f.value);return e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(Q,{size:16,className:"text-fedeesp-red"})," Contato"]}),t.length===0?e.jsx("p",{className:"text-sm text-gray-500 italic",children:"Sem informações de contato cadastradas."}):e.jsx("ul",{className:"space-y-3",children:t.map((f,S)=>e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-gray-400 mt-0.5",children:f.icon}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 mb-0.5",children:f.label}),e.jsx("p",{className:"text-sm text-gray-800 break-words",children:f.value})]})]},S))})]})},Ue=({school:a,kpis:t,year:f})=>{const[S,j]=h.useState(!1),z=h.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/#/escola/${encodeURIComponent(String(a.id))}`,[a.id]),p=`${a.name} na FEDEESP ${f} — ${t.totalMedalhas} medalha${t.totalMedalhas===1?"":"s"} em ${t.competicoes} competição(ões).`,c=b=>encodeURIComponent(b),$=`https://wa.me/?text=${c(p+" "+z)}`,w=`https://twitter.com/intent/tweet?text=${c(p)}&url=${c(z)}`,B=async()=>{try{await navigator.clipboard.writeText(z),j(!0),setTimeout(()=>j(!1),2200)}catch{}};return e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-widest text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(Me,{size:16,className:"text-fedeesp-red"})," Compartilhar perfil"]}),e.jsx("p",{className:"text-xs text-gray-600 mb-4",children:p}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("a",{href:$,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-500 hover:bg-emerald-600 px-4 py-2 text-[11px] font-black uppercase tracking-widest text-white transition",children:[e.jsx(ze,{size:14})," WhatsApp"]}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-full bg-gray-900 hover:bg-black px-4 py-2 text-[11px] font-black uppercase tracking-widest text-white transition",children:[e.jsx($e,{size:14})," X / Twitter"]}),e.jsxs("button",{onClick:B,className:`inline-flex items-center gap-1.5 rounded-full px-4 py-2 text-[11px] font-black uppercase tracking-widest text-white transition ${S?"bg-emerald-500":"bg-gray-700 hover:bg-gray-800"}`,children:[S?e.jsx(Ae,{size:14}):e.jsx(Ee,{size:14}
1)," ",S?"Copiado!":"Copiar link"]})]})]})};function Ke(a){if(!a)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(a);return t?`${t[3]}/${t[2]}/${t[1]}`:a}export{Ge 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.