1import{u as x,A as N,j as e,H as w,a2 as v,E as T,v as A,j4 as k,L as S,j5 as M}from"./index-Cz_StzOF.js";import{u as V}from"./useSuspenseQuery-C53WRaHC.js";import{B as u}from"./button-DLLlTj8W.js";import{r as E,w as C}from"./watch-button-FCFZFKG1.js";import{B as p}from"./badge-DNloBTC5.js";import{a as L}from"./format-kickoff-BtEnAC7R.js";import{s as H,f as _,c as B}from"./format-result-CBMhgY1c.js";import{s as g}from"./stfc-perspective-DR0tLe7W.js";const h="mx-auto w-full max-w-4xl px-4";function $({fixture:s}){const n=[],{data:a}=x(w()),{data:l}=x(v());for(const t of E({audioEntryId:a?.watchAudioEntryId??"",kickoffAt:new Date(N(s.kickoffAt)),now:new Date,status:s.status,streamAudioEnabled:s.streamAudioEnabled,streamVideoEnabled:s.streamVideoEnabled,videoEntryId:a?.watchVideoEntryId??"",viewerCountry:l?.country??"",watchEnabled:!!a?.watchEnabled}))n.push(t.disabled?{label:t.label,href:null,note:t.availableFromMs===void 0?void 0:C(t.availableFromMs)}:{label:t.label,href:t.href});return n.length===0?null:e.jsx("nav",{"aria-label":"Match actions",className:"border-b bg-white",children:e.jsx("div",{className:`${h} flex flex-wrap gap-2 py-3`,children:n.map(t=>t.href?e.jsx(u,{asChild:!0,size:"sm",variant:"outline",children:e.jsx("a",{href:t.href,rel:"noopener",target:t.href.startsWith("http")?"_blank":void 0,children:t.label})},t.label):e.jsxs(u,{"aria-disabled":"true","aria-label":`${t.label} â ${t.note??"not available for this fixture"}`,className:"h-auto cursor-not-allowed flex-col items-start gap-0.5 py-1.5 opacity-60",onClick:r=>r.preventDefault(),size:"sm",title:t.note??"Not available for this fixture",variant:"outline",children:[e.jsx("span",{children:t.label}),t.note?e.jsx("span",{className:"font-normal text-[0.7rem] leading-tight",children:t.note}):null]},t.label))})})}const f="/stfc-badge.svg";function O({fixture:s}){const{publicBaseUrl:n}=T(),a=new Date(s.kickoffAt),l=s.status==="live",t=s.status==="final",r=s.status==="upcoming",o=g(s.homeTeamName),i=A(s.opponentBadgeUrl,n),d=o?f:i,c=o?i:f,m=H(s);return e.jsx("header",{className:"bg-deep-navy text-white",children:e.jsxs("div",{className:"page-wrap px-4 py-10",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s.matchdayNumber!==null&&e.jsxs("span",{className:"rounded-full bg-amber px-3 py-1 font-semibold text-deep-nav
1y text-xs",children:["Matchday ",s.matchdayNumber]}),e.jsxs("span",{className:"text-sm text-white/70",children:[a.toLocaleDateString("en-GB",{timeZone:"UTC",weekday:"short",day:"numeric",month:"short"}),", ",L(s.kickoffAt,s.kickoffTimeTbc)]}),l&&e.jsx(p,{className:"bg-red-600 text-white",children:"LIVE"}),t&&e.jsx(p,{variant:"secondary",children:"Full time"})]}),e.jsxs("div",{className:"mt-6 grid grid-cols-1 items-center gap-6 sm:grid-cols-[1fr_auto_1fr] sm:gap-8",children:[e.jsxs("div",{className:"flex items-center justify-center gap-4 sm:justify-end",children:[d&&e.jsx("img",{alt:`${s.homeTeamName} badge`,className:"h-16 w-16 shrink-0 object-contain sm:h-20 sm:w-20",src:d}),e.jsxs("div",{className:"text-center sm:text-left",children:[e.jsx("h1",{className:"font-bold text-3xl sm:text-4xl",children:s.homeTeamName}),e.jsx("p",{className:"mt-1 text-sm text-white/70",children:"Home"})]})]}),(l||t)&&s.homeScore!==null&&s.awayScore!==null?e.jsxs("div",{className:"text-center font-bold text-6xl tabular-nums",children:[s.homeScore," â ",s.awayScore]}):e.jsx("div",{className:"text-center text-3xl text-white/40",children:"vs"}),e.jsxs("div",{className:"flex items-center justify-center gap-4 sm:justify-start",children:[e.jsxs("div",{className:"order-2 text-center sm:order-none sm:text-right",children:[e.jsx("h1",{className:"font-bold text-3xl sm:text-4xl",children:s.awayTeamName}),e.jsx("p",{className:"mt-1 text-sm text-white/70",children:"Away"})]}),c&&e.jsx("img",{alt:`${s.awayTeamName} badge`,className:"order-1 h-16 w-16 shrink-0 object-contain sm:order-none sm:h-20 sm:w-20",src:c})]})]}),m&&e.jsxs("p",{className:"mt-3 text-center text-sm text-white/70 tabular-nums",children:["Penalties ",m]}),s.venue&&e.jsx("p",{className:"mt-6 text-center text-white/80",children:s.venue}),r&&e.jsx("div",{className:"text-center",children:e.jsx(I,{kickoffMs:s.kickoffAt})})]})})}function I({kickoffMs:s}){const n=N(s)-Date.now();if(n<=0)return null;const a=Math.floor(n/(1e3*60*60*24)),l=Math.floor(n/(1e3*60*60)%24),t=Math.floor(n/(1e3*60)%60);return e.jsxs("div",{className:"mt-4 inline-flex items-center gap-3 rounded-md bg-white/10 px-4 py-2",children:[e.jsx("span",{className:"text-white/70 text-xs uppercase",children:"Kicks off in"}),e.jsxs("span",{className:"font-bold tabular-nums",children:[a,"d ",String(l).padStart(2,"0"),"h ",String(t).padStart(2,"0"),"m"]})]})}function P({lineup:s,homeTeamName:n,awayTeamName:a}){if(!s)return e.jsxs("section",{className:"rounded-lg border border-dashed bg-white p-8 text-center text-muted-foreground",children:[e.jsx("p",{className:"font-semibold",children:"Lineups not yet announced"}),e.jsx("p",{className:"mt-1 text-sm",children:"Teamsheets are typically released around an hour before kick-off."})]});const l=g(n),t={managerName:s.managerName,name:l?n:a,startingXi:s.startingXi,subs:s.subs},r={managerName:null,name:l?a:n,startingXi:s.opponentStartingXi,subs:s.opponentSubs},[o,i]=l?[t,r]:[r,t];return e.jsx("section",{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsx(b,{side:o}),e.jsx(b,{side:i})]})})}function b({side:s}){return s.startingXi.length===0?e.jsxs("article",{className:"rounded-lg border border-dashed bg-white p-6 text-muted-foreground",children:[e.jsx("header",{className:"mb-4",children:e.jsx("h3",{className:"font-bold text-deep-nav
1y text-xl",children:s.name})}),e.jsx("p",{children:"Teamsheet not available for this match."})]}):e.jsxs("article",{className:"rounded-lg bg-white p-6 shadow-sm",children:[e.jsx("header",{className:"mb-4",children:e.jsx("h3",{className:"font-bold text-deep-navy text-xl",children:s.name})}),e.jsx(j,{label:"Starting XI",players:s.startingXi}),s.subs.length>0&&e.jsx("div",{className:"mt-6",children:e.jsx(j,{label:"Substitutes",players:s.subs})}),s.managerName&&e.jsxs("p",{className:"mt-6 text-muted-foreground text-sm",children:[e.jsx("span",{className:"font-semibold",children:"Manager:"})," ",s.managerName]})]})}function j({label:s,players:n}){return e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 font-semibold text-deep-navy text-sm",children:s}),e.jsx("ul",{className:"space-y-1",children:n.map(a=>e.jsxs("li",{className:"flex items-center gap-3",children:[a.squadNumber!==null&&e.jsx("span",{className:"inline-flex h-6 w-6 items-center justify-center rounded-full bg-deep-navy text-white text-xs tabular-nums",children:a.squadNumber}
1),e.jsx("span",{className:"flex-1 font-medium text-deep-navy",children:a.name})]},a.squadNumber===null?`${s}-${a.name}-${a.position}`:`${s}-sq-${a.squadNumber}`))})]})}function K(){const{section:s,slug:n}=k.useParams(),{data:a}=V(M(n));if(!a)return null;const l=a.status==="live",t=a.status==="final";return e.jsxs("article",{children:[e.jsx("div",{className:"bg-deep-navy",children:e.jsx("div",{className:`${h} pt-5`,children:e.jsxs(S,{className:"inline-flex items-center gap-1.5 text-sm text-white/70 transition-colors hover:text-white",params:{section:s},to:"/matches/$section/fixtures",children:[e.jsx("span",{"aria-hidden":"true",children:"â"})," Back to fixtures"]})})}),e.jsx(O,{fixture:a}),e.jsx($,{fixture:a}),e.jsxs("div",{className:`${h} space-y-10 py-10`,children:[!t&&e.jsxs("section",{id:"match-info",children:[e.jsx("h2",{className:"font-bold text-deep-navy text-h4",children:"Match information"}),a.previewText?e.jsx("p",{className:"mt-3 whitespace-pre-line text-muted-foreground leading-7",children:a.previewText}):e.jsx("p",{className:"mt-3 text-muted-foreground italic",children:"Match preview to follow."})]}),l&&e.jsxs("section",{className:"rounded-lg border border-red-300 bg-red-50 px-6 py-4 text-red-900",children:[e.jsx("p",{className:"font-semibold",children:"This match is in progress."}),e.jsx("p",{className:"mt-1 text-body",children:"Refresh the page for the latest score. Live updates will be enabled when the data feed is connected."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-4 font-bold text-deep-nav
1y text-h4",children:"Lineups"}),e.jsx(P,{awayTeamName:a.awayTeamName,homeTeamName:a.homeTeamName,lineup:a.lineup})]}),a.events.length>0&&e.jsxs("section",{id:"match-events",children:[e.jsx("h2",{className:"mb-4 font-bold text-deep-navy text-h4",children:"Match events"}),e.jsx(F,{awayTeamName:a.awayTeamName,events:a.events,homeTeamName:a.homeTeamName})]}),a.stats&&e.jsxs("section",{id:"match-stats",children:[e.jsx("h2",{className:"mb-4 font-bold text-deep-navy text-h4",children:"Match stats"}),e.jsx(R,{awayTeamName:a.awayTeamName,homeTeamName:a.homeTeamName,stats:a.stats})]})]})]})}function D(s){switch(s){case"GOAL":return"â½";case"PENALTY":return"â½";case"YELLOW_CARD":return"ð¨";case"RED_CARD":return"ð¥";case"SUBSTITUTION":return"â»";default:return"â¢"}}function F({awayTeamName:s,events:n,homeTeamName:a}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] gap-x-4 px-4 pb-2 font-semibold text-deep-navy",children:[e.jsx("span",{className:"text-right",children:a}),e.jsx("span",{"aria-hidden":"true",className:"w-16"}),e.jsx("span",{className:"text-left",children:s})]}),e.jsx("ol",{className:"divide-y rounded-lg border bg-white",children:n.map(l=>{const t=l.homeAway==="h",r=l.type==="GOAL"||l.type==="PENALTY",o=_(l.minute,l.addedTime),i=e.jsx("span",{className:r?"font-semibold text-deep-nav
1y":"text-deep-navy",children:B(l)});return e.jsxs("li",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-x-4 px-4 py-3",children:[e.jsx("span",{className:"text-right",children:t?i:null}),e.jsxs("span",{className:"flex w-16 shrink-0 items-center justify-center gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:"text-lg",children:D(l.type)}),e.jsx("span",{className:"font-mono text-body text-muted-foreground",children:o})]}),e.jsx("span",{className:"text-left",children:t?null:i})]},l.id)})})]})}function R({awayTeamName:s,homeTeamName:n,stats:a}){const t=[{label:"Possession %",homeValue:a.possessionHome,awayValue:a.possessionAway},{label:"Shots on target",homeValue:a.shotsOnTargetHome,awayValue:a.shotsOnTargetAway},{label:"Shots off target",homeValue:a.shotsOffTargetHome,awayValue:a.shotsOffTargetAway},{label:"Attempts on goal",homeValue:a.attemptsOnGoalHome,awayValue:a.attemptsOnGoalAway},{label:"Corners",homeValue:a.cornersHome,awayValue:a.cornersAway},{label:"Fouls",homeValue:a.foulsHome,awayValue:a.foulsAway},{label:"Yellow cards",homeValue:a.yellowCardsHome,awayValue:a.yellowCardsAway},{label:"Red cards",homeValue:a.redCardsHome,awayValue:a.redCardsAway}].filter(r=>r.homeValue!==null||r.awayValue!==null);return t.length===0?null:e.jsxs("div",{className:"rounded-lg border bg-white",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-x-4 border-b px-4 py-3 font-semibold text-deep-nav
1y",children:[e.jsx("span",{className:"text-left",children:n}),e.jsx("span",{className:"text-body text-muted-foreground",children:"vs"}),e.jsx("span",{className:"text-right",children:s})]}),e.jsx("ul",{className:"divide-y",children:t.map(r=>{const o=r.homeValue??0,i=r.awayValue??0,d=r.label==="Possession %",c=o+i,m=d&&c>0?Math.round(o/c*100):0,y=d&&c>0?100-m:0;return e.jsxs("li",{className:"px-4 py-3",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-x-4 text-deep-navy",children:[e.jsx("span",{className:"text-left font-semibold",children:r.homeValue??"-"}),e.jsx("span",{className:"text-body text-muted-foreground",children:r.label}),e.jsx("span",{className:"text-right font-semibold",children:r.awayValue??"-"})]}),d&&c>0&&e.jsxs("div",{className:"mt-2 flex h-2 overflow-hidden rounded-full bg-muted",children:[e.jsx("div",{className:"bg-deep-navy",style:{width:`${m}%`}}),e.jsx("div",{className:"bg-amber",style:{width:`${y}%`}})]})]},r.label)})})]})}export{K as component};
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.