import{_ as Le}from"./x-IbYg2U.js";import{_ as Be}from"./F5sIXqK7.js";import{L as Ke,u as je,n as Ee,r as Me,w as Ne,l as Re,h as p,v as $e,a1 as qe,B as We,C as o,E as u,Q as g,I as k,P as b,K as S,f as e,D as A,O as Qe,_ as Ge,R as Ve,U as Ie,a7 as Xe}from"./0gA1_Wwl.js";import{_ as Ye}from"./DRy348X1.js";import{_ as Ze}from"./B-qOFK9V.js";import{_ as ze}from"./Cvd3zQWS.js";import{_ as Je}from"./7vn5wsHx.js";import{_ as et}from"./BVQcB7vW.js";import{_ as tt}from"./BxYEAYUb.js";import{i as at,_ as st}from"./DUFBXaf7.js";import ot from"./DrUpZTkP.js";import{_ as rt}from"./D5zEKB03.js";import{g as _}from"./BjdxBe_l.js";import{g as mt}from"./CPfO20CH.js";import{C as it}from"./DMMjVHYg.js";const lt=["FirstHalf","HalfTime","SecondHalf","ExtraFirstHalf","ExtraSecondHalf","ExtraHalfTime","ShootOut","FullTime90","Live"],ut={key:1,class:"flex flex-1 w-full fixture-card__content"},ct={key:2,class:"flex flex-1 w-full fixture-card__content"},nt={key:0,class:"flex items-center justify-center w-full py-1 pl-16 text-xs text-gray-100 bg-zinc-800 fixture-card__postponed"},It=Ke({name:"FixtureCard",__name:"index",props:{data:{},widget:{},style:{},theme:{},backgroundKey:{default:void 0},showTimer:{type:Boolean,default:!0},showTeamSlug:{type:Boolean,default:!0},showMatchOrder:{type:Boolean,default:!0},showSponsor:{type:Boolean,default:!1}},async setup(Oe){var N,R,$,q,W,Q,G,V,X,Y;let O,U;const F=Re(),r=Oe,{$gc:P}=je(),L=Ee(),a=Me({...r.data});Ne(()=>r.data,()=>{a.value=r.data});const T=((N=L.params.slug)==null?void 0:N[0])===F.public.club.slugs.fixtures&&L.params.slug.length>2,B=p(()=>{var t;return at((t=a.value)==null?void 0:t.kickOffUTC)}),K=p(()=>{var t;return lt.includes((t=a.value)==null?void 0:t.period)}),x=p(()=>{var t;return!["PreMatch","Postponed"].includes((t=a.value)==null?void 0:t.period)}),m=p(()=>{var t;return r.theme||((t=r.style)==null?void 0:t.theme)||"light"}),j=p(()=>(a==null?void 0:a.homeOrAway)==="Home"?i==null?void 0:i.teamID:c==null?void 0:c.teamID),Ae=p(()=>{var t,s,l,w,y,v,n,d;return(t=r.data)!=null&&t.isCustom?"":E!==void 0&&((s=a.value)==null?void 0:s.matchID)!==void 0?`/${(y=(w=(l=F.public)==null?void 0:l.club)==null?void 0:w.slugs)==null?void 0:y.fixtures}/${(v=a.value)==null?void 0:v.slugTeamName}/${(n=a.value)==null?void 0:n.seasonID}/${(d=a.value)==null?void 0:d.matchID}`:""});let E;j!==void 0&&(E=(R=([O,U]=$e(()=>P().football.web().getTeamById(j)),O=await O,U(),O))==null?void 0:R.slug);const{borderRadius:He,textColor:Se}=qe(m.value);let C;if((q=($=a.value)==null?void 0:$.mediaAssets)!=null&&q.customIcon){const t=(Q=(W=a.value)==null?void 0:W.mediaAssets)==null?void 0:Q.customIcon;C={icon:t[0].toLowerCase()+t.slice(1),label:(V=(G=a.value)==null?void 0:G.mediaAssets)==null?void 0:V.customLabel,url:(Y=(X=a.value)==null?void 0:X.mediaAssets)==null?void 0:Y.customUrl,iconPack:""},C.iconPack=it[C.icon]}const i=p(()=>{var t,s,l;return(t=r==null?void 0:r.data)!=null&&t.isCustom?M("Home"):(l=(s=a.value)==null?void 0:s.teamData)==null?void 0:l[0]}),c=p(()=>{var t,s,l;return(t=a.value)!=null&&t.isCustom?M("Away"):(l=(s=a.value)==null?void 0:s.teamData)==null?void 0:l[1]});function M(t){var s,l,w,y,v,n,d;return x.value&&t==="Home"?(l=(s=a.value)==null?void 0:s.teamData)==null?void 0:l[0]:x.value&&t==="Away"||((w=r==null?void 0:r.data)==null?void 0:w.homeOrAway)==="Home"?(v=(y=a.value)==null?void 0:y.teamData)==null?void 0:v[1]:(d=(n=a.value)==null?void 0:n.teamData)==null?void 0:d[0]}return We(()=>{T&&window.addEventListener("MatchCentre:Update",async()=>{var t,s;a.value=await P().football.web().getMatch((t=r.data)==null?void 0:t.matchID,i==null?void 0:i.value.teamID,(s=r.data)==null?void 0:s.seasonID)})}),(t,s)=>{var J,ee;const l=Le,w=Be,y=Ge,v=Ye,n=Ze,d=ze,Z=Je,H=et,z=tt,Ue=st,Fe=ot,Pe=Xe;return o(),u(Pe,{class:S(["relative block transition duration-300 translate-y-0 fixture-card__container group/fixture",[("useStyleObject"in t?t.useStyleObject:e(rt))(((J=t.widget)==null?void 0:J.style)||t.style),(ee=t.widget)==null?void 0:ee.theme,e(He),{"bg-white":e(m)==="light","hover:-translate-y-1 hover:shadow-xl":!e(T)}]]),to:e(Ae)},{default:g(()=>{var te;return[t.backgroundKey?(o(),u(l,{key:0,"image-key":t.backgroundKey,"base-width":1600,"base-height":1600,sizes:[1600,1200,800,400],fit:"cover",class:"absolute object-cover object-center w-full h-full card__crest -z-10 after:content-[''] after:absolute after:w-full after:h-full after:bg-red-500"},null,8,["image-key"])):k("",!0),b(Fe,{class:S(["flex fixture-card",{"flex-wrap":((te=e(a))==null?void 0:te.period)==="Postponed"}])},{header:g(()=>{var h,f,D;return[b(w,{"date-string":e(Ie).fromISO((h=e(a))==null?void 0:h.kickOffUTC).toFormat("ccc d LLL"),"time-string":e(Ie).fromISO((f=e(a))==null?void 0:f.kickOffUTC).toFormat("h:mm a"),"competition-crest":e(mt)(e(a),e(m)),"is-home":((D=e(a))==null?void 0:D.homeOrAway)==="Home","is-result":e(x),"show-match-order":t.showMatchOrder&&!e(T),"is-live":e(K),theme:e(m)},null,8,["date-string","time-string","competition-crest","is-home","is-result","show-match-order","is-live","theme"])]}),content:g(()=>{var h,f,D,ae,se,oe,re,me,ie,le,ue,ce,ne,de,he,fe,pe,ge,we,ye,ve,ke,be,xe;return[e(a)?e(K)||e(x)?(o(),A("div",ut,[b(v,{home:e(i),opposition:e(c),"home-crest":("getTeamCrest"in t?t.getTeamCrest:e(_))(e(i)),"opposition-crest":("getTeamCrest"in t?t.getTeamCrest:e(_))(e(c)),"show-team-slug":t.showTeamSlug,theme:e(m),venue:(h=e(a))==null?void 0:h.venue,"postponed-reason":(f=e(a))==null?void 0:f.postponedReason,"squad-name":(D=e(a))==null?void 0:D.formattedTeamName,period:(ae=e(a))==null?void 0:ae.period},null,8,["home","opposition","home-crest","opposition-crest","show-team-slug","theme","venue","postponed-reason","squad-name","period"]),e(T)?(o(),u(H,{key:1},{default:g(()=>[b(d,{match:e(a),theme:e(m)},null,8,["match","theme"]),e(B)?(o(),u(Z,{key:0})):k("",!0)]),_:1})):(o(),u(n,{key:0,"match-id":(se=e(a))==null?void 0:se.matchID,"ticket-url":(re=(oe=e(a))==null?void 0:oe.mediaAssets)==null?void 0:re.ticketUrl,"match-report-url":(ie=(me=e(a))==null?void 0:me.mediaAssets)==null?void 0:ie.matchReportUrl,"season-id":(le=e(a))==null?void 0:le.seasonID,"is-result":e(x),"team-id":((ue=e(a))==null?void 0:ue.homeOrAway)==="Home"?(ce=e(i))==null?void 0:ce.teamID:(ne=e(c))==null?void 0:ne.teamID,theme:e(m),"custom-button":e(C),"is-fixture-card":e(m)==="club"},null,8,["match-id","ticket-url","match-report-url","season-id","is-result","team-id","theme","custom-button","is-fixture-card"])),(de=t.widget)!=null&&de.showSponsor?(o(),u(z,{key:2,class:"fixture-sponsor","section-id":"matchCentre_FirstTeam_Web"})):k("",!0)])):(o(),A("div",ct,[b(H,null,{default:g(()=>{var I,_e,Te,Ce,De;return[b(Ue,{"team-name":((I=e(a))==null?void 0:I.homeOrAway)==="Home"?e(c).teamName:e(i).teamName,"team-crest":((_e=e(a))==null?void 0:_e.homeOrAway)==="Home"?("getTeamCrest"in t?t.getTeamCrest:e(_))(e(c),e(m)):("getTeamCrest"in t?t.getTeamCrest:e(_))(e(i),e(m)),"kick-off-u-t-c":(Te=e(a))==null?void 0:Te.kickOffUTC,"background-key":t.backgroundKey,"home-crest":("getTeamCrest"in t?t.getTeamCrest:e(_))(e(i)),"opposition-crest":("getTeamCrest"in t?t.getTeamCrest:e(_))(e(c)),"show-timer":t.showTimer,"show-team-slug":t.showTeamSlug,venue:(Ce=e(a))==null?void 0:Ce.venue,"squad-name":(De=e(a))==null?void 0:De.formattedTeamName,theme:e(m)},null,8,["team-name","team-crest","kick-off-u-t-c","background-key","home-crest","opposition-crest","show-timer","show-team-slug","venue","squad-name","theme"])]}),_:1}),e(T)?(o(),u(H,{key:1},{default:g(()=>{var I;return[((I=e(a))==null?void 0:I.period)!=="PreMatch"?(o(),u(d,{key:0,match:e(a),theme:e(m)},null,8,["match","theme"])):k("",!0),e(B)?(o(),u(Z,{key:1})):k("",!0)]}),_:1})):(o(),u(n,{key:0,"match-id":(he=e(a))==null?void 0:he.matchID,"ticket-url":(pe=(fe=e(a))==null?void 0:fe.mediaAssets)==null?void 0:pe.ticketUrl,"match-report-url":(we=(ge=e(a))==null?void 0:ge.mediaAssets)==null?void 0:we.matchReportUrl,"season-id":(ye=e(a))==null?void 0:ye.seasonID,"is-result":e(x),"team-id":((ve=e(a))==null?void 0:ve.homeOrAway)==="Home"?(ke=e(i))==null?void 0:ke.teamID:(be=e(c))==null?void 0:be.teamID,theme:e(m),"custom-button":e(C),"is-fixture-card":e(m)==="club"},null,8,["match-id","ticket-url","match-report-url","season-id","is-result","team-id","theme","custom-button","is-fixture-card"])),(xe=t.widget)!=null&&xe.showSponsor?(o(),u(z,{key:2,class:"fixture-sponsor","section-id":"matchCentre_FirstTeam_Web"})):k("",!0)])):(o(),A("div",{key:0,class:S(["flex flex-col items-center justify-center w-full h-full overflow-hidden rounded card upcoming wrapper min-w-[256px] md:mx-0",[e(Se)]])},[b(y,{tag:"h5",class:""},{default:g(()=>s[0]||(s[0]=[Ve(" No Upcoming Fixtures ")])),_:1})],2))]}),footer:g(()=>{var h,f;return[((h=e(a))==null?void 0:h.period)==="Postponed"?(o(),A("div",nt,Qe(((f=e(a))==null?void 0:f.postponedReason)||"Postponed"),1)):k("",!0)]}),_:1},8,["class"])]}),_:1},8,["class","to"])}}});export{It as _};