1import{getContext as e,getElement as t,store as a}from"@wordpress/interactivity";function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,l=Array(t);a<t;a++)l[a]=e[a];return l}const n="legacy";function s(){var e;return(null===(e=window)||void 0===e||null===(e=e.KEEPUP)||void 0===e||null===(e=e.global)||void 0===e?void 0:e.config)||{}}function o(){return(s().middleware_url||"").replace(/\/+$/,"")}function c(){const e={"Accept-Encoding":"gzip",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}};if(("new"===s().middleware_version?"new":n)===n){const t=s().middleware_key||"";t&&(e["x-api-key"]=t)}return e}function i(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e){return e.toString().replace(/\+/g,"%20")}class u{constructor(e,t){i(this,"url",void 0),i(this,"headers",void 0),this.url=(e||o()||"").replace(/\/+$/,""),this.headers=new Headers(c(t?{"x-api-key":t}:{}))}async callMiddleware(e){try{const t=await fetch(e,{method:"GET",headers:this.headers});if(t.ok){const e=await t.json();if(e)return e}else console.log("Error in response from middleware: ",t)}catch(e){console.log(e)}return!1}async getFixturesResults(e,t,a,l,n){const s=new URLSearchParams({competitionId:e,tournamentId:t,includeTicketAndStreamInfo:"true"});void 0!==a&&"all"!==a&&s.set("teamId",a),l&&(isNaN(l)?(s.set("stageName",l),s.set("week","null")):s.set("week",l)),n&&"all"!==n&&s.set("venueName",n);const o="".concat(this.url,"/middleware/v2/fixturesAndResultsV2?").concat(r(s));return await this.callMiddleware(o)}async getRounds(e,t){const a=new URLSearchParams({tournamentId:e});t&&a.set("shouldGetCurrentRoundMatches","true");const l="".concat(this.url,"/middleware/v2/rounds?").concat(r(a));return await this.callMiddleware(l)}async getVenues(e){let t=this.url+"/middleware/v2/venues/".concat(e);return await this.callMiddleware(t)}async getMatches(e){try{const t=await fetch(this.url+"/middleware/v2/matches/"+e,{method:"GET",headers:this.headers});if(t.ok){const e=await t.json();if(e)return e}else console.log("Error in response from middleware: ",t)}catch(e){console.log(e)}return!1}async getMatchCentre(e){try{const t=await fetch(this.url+"/middleware/v2/matchCentre/"+e,{method:"GET",headers:this.headers});if(t.ok){const e=await t.json();if(e){const t={code:"TBD",id:"0",name:"TBD",officialName:"TBD",shortName:"TBD"};let a=e;return a.homeTeam||(a.homeTeam=t),a.awayTeam||(a.awayTeam=t),a}}else console.log("Error in response from middleware: ",t)}catch(e){console.log(e)}return!1}async getMatchesByDateRange(e,t,a){try{const e=await this.getMatches(a);console.log(e)}catch(e){console.log(e)}return!1}}function d(e,t){switch(e){case"Playing":return"Live";case"Played":return"FT";case"Cancelled":return"Cancelled";case"Postponed":return"TBC";case"Suspended":return"Suspended";default:return function(e){const t=new Date(e);return new Intl.DateTimeFormat("en-AU",{hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)}(t)}}function g(e,t){var a;const l=null==e||null===(a=e.liveData)||void 0===a||null===(a=a.matchDetails)||void 0===a?void 0:a.scores;if(null!=l&&l.pen&&null!=l&&l.et)return"".concat(l.et[t]," (").concat(l.pen[t],")");if(null!=l&&l.total&&void 0!==l.total[t])return l.total[t];const n="home"===t?e.homeScore:e.awayScore;return null!=n?n:""}const m=new URLSearchParams(window.location.search).has("spoof_aggregate");window.moment;const h=(e,t,a)=>{const l=(new Date).getTime();return l>e-6e4*t&&l<e+6e4*a},v=new URLSearchParams(window.location.search).has("spoof_aggregate");async function b(e){try{const n=await fetch(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=o();if(!a)return"";const n="".concat(a,"/").concat(String(e).replace(/^\/+/,"")),s=new URLSearchParams;Object.entries(t||{}
1).forEach(e=>{let t=(c=2,function(e){if(Array.isArray(e))return e}(o=e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l,n,s,o,c=[],i=!0,r=!1;try{if(s=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;i=!1}else for(;!(i=(l=s.call(a)).done)&&(c.push(l.value),c.length!==t);i=!0);}catch(e){r=!0,n=e}finally{try{if(!i&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(r)throw n}}return c}}(o,c)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?l(e,t):void 0}}(o,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=t[0],n=t[1];var o,c;null!=n&&s.append(a,n)});const c=s.toString();return c?"".concat(n,"?").concat(c):n}("/middleware/v2/matchCentre/".concat(e)),{headers:c()});if(200!==n.status)return{notFound:!0};const s=await n.json();if(!s)return{notFound:!0};if(v){var t,a;const e=null==s||null===(t=s.liveData)||void 0===t?void 0:t.matchDetails,l=null==e||null===(a=e.scores)||void 0===a?void 0:a.total;e&&(e.matchStatus="Played"),l&&(l.home=l.home||"2",l.away=l.away||"1"),null!=e&&e.scores&&(e.scores.aggregate=e.scores.aggregate||"4-3")}const i={code:"TBD",id:"0",name:"TBD",officialName:"TBD",shortName:"TBD"};let r=s;return r.homeTeam||(r.homeTeam=i),r.awayTeam||(r.awayTeam=i),s}catch(e){return console.log(e),{notFound:!0}}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,l=Array(t);a<t;a++)l[a]=e[a];return l}const f=window.sessionStorage,y=["Elimination Finals","Semi-finals","Grand Final"];function L(e,t){const a=e.matchWeekLabel[t];_.finalsStage=y.includes(a)?a:"",_.isFinals=""!==_.finalsStage,_.currentWeek=!1,_.fromDate=null,_.toDate=null}function k(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=null==t||null===(e=t.scores)||void 0===e?void 0:e.aggregate;return a&&void 0!==a.home&&void 0!==a.away?"".concat(a.home,"-").concat(a.away):""}function p(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const l=String(null!=a?a:"").trim();if(""===l)return"";const n=null==t||null===(e=t.scores)||void 0===e?void 0:e.pen;if(!n||void 0===n.home||null===n.home||void 0===n.away||null===n.away)return l;const s=(i=l.split("-").map(e=>e.trim()),r=2,function(e){if(Array.isArray(e))return e}(i)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l,n,s,o,c=[],i=!0,r=!1;try{if(s=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;i=!1}else for(;!(i=(l=s.call(a)).done)&&(c.push(l.value),c.length!==t);i=!0);}catch(e){r=!0,n=e}finally{try{if(!i&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(r)throw n}}return c}}(i,r)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?w(e,t):void 0}}(i,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=s[0],c=s[1];var i,r;return o&&c?"".concat(o,"(").concat(n.home,") - ").concat(c,"(").concat(n.away,")"):l}function M(e){var t,a,l,n,s;return[null!==(t=null===(a=e.team1home)||void 0===a?void 0:a.uuid)&&void 0!==t?t:"",null!==(l=null===(n=e.team2away)||void 0===n?void 0:n.uuid)&&void 0!==l?l:""].sort().join("|")+":"+(null!==(s=e.stage)&&void 0!==s?s:"")}function S(e){const t=new Set;for(const a of e)for(const e of a.matches)2!==e.leg||"Playing"!==e.status&&"Played"!==e.status||t.add(M(e));for(const a of e)for(const e of a.matches)1===e.leg?t.has(M(e))&&(delete e.aggregate_score,delete e.aggregate_display_score):2===e.leg&&"Playing"!==e.status&&"Played"!==e.status&&(delete e.aggregate_score,delete e.aggregate_display_score)}const W=a("matches-takeover",{state:{show:!1,showClub:!1,isLoading:!0,isALeagueMen:!0,isALeagueWomen:!1,isMatchesTab:!0,isLaddersTab:!1,isVideosTab:!1,hasMatches:!0,hasLiveMatches:!1,matches:[],currentWeek:!1,isFinals:!1,finalsStage:"",isWeekSelectionList:!1,selectedMatchWeek:1,selectedMatchWeekLabel:"Matchweek",clubSelectorLabel:"Club",selectedClub:"all",isActiveClub:!1,selectedCompetitionIds:"xwnjb1az11zffwty3m6vn8y6",selectedLeague:"a-league-men",noMatchesFound:!1,liveMatchesInterval:null,lastUpdatedMatches:null,adSlots:{},adSlotCount:1,adConfig:{},ecalId:"",allMatches:!1,matchesUrl:"",breakUrl:"",fromDate:null,toDate:null,get isALeaguesSite(){return e().isALeaguesSite},get currentMatchWeek(){return e().matchWeek[_.selectedLeague]},get currentMatchWeekLabel(){return e().matchWeekLabel[_.selectedLeague]},get hasSelectedClub(){return"all"!==_.selectedClub},get shouldCallMatches(){return _.isALeaguesSite&&(!0!==_.allMatches||"all"!==_.selectedClub||"All Matches"===_.selectedMatchWeekLabel)}}
1,actions:{toggle(){_.show=!_.show,_.show?(A.sendPageViewEvent(),A.initialiseGPT(),_.isALeaguesSite||1===_.selectedMatchWeek||setTimeout(()=>{D(_.selectedLeague)},100),document.body.classList.add("matches-takeover--opened")):(document.body.classList.remove("matches-takeover--opened"),A.unloadAds()),_.showClub&&(_.showClub=!1)},async showALeagueMenTab(){if(_.isALeagueMen)return;const t=e();A.unloadAds(),_.isALeagueMen=!0,_.isALeagueWomen=!1,_.selectedCompetitionIds="xwnjb1az11zffwty3m6vn8y6",_.selectedLeague="a-league-men",_.isMatchesTab=!0,_.isLaddersTab=!1,_.isVideosTab=!1,_.ecalId=t.ecalId.mens,_.selectedMatchWeek=t.matchWeek[_.selectedLeague],_.selectedMatchWeekLabel=t.matchWeekLabel[_.selectedLeague],L(t,_.selectedLeague),_.isALeaguesSite?C.resetState():C.resetStateClubs(),f.setItem("selectedLeague","a-league-men"),A.setVisibleWeeks(),A.setVisibleClubs(),A.setMatchesUrl(),await T(),A.reinitEcal(),A.sendPageViewEvent(),A.initialiseGPT(),t.isALeaguesSite||1===_.selectedMatchWeek||I(_.selectedMatchWeek,_.selectedLeague)},async showALeagueWomenTab(){if(_.isALeagueWomen)return;const t=e();A.unloadAds(),_.isALeagueMen=!1,_.isALeagueWomen=!0,_.selectedCompetitionIds="9p3nnxhdjahfn8qswpzy8oyc3",_.selectedLeague="a-league-women",_.isMatchesTab=!0,_.isLaddersTab=!1,_.isVideosTab=!1,_.ecalId=t.ecalId.womens,_.selectedMatchWeek=t.matchWeek[_.selectedLeague],_.selectedMatchWeekLabel=t.matchWeekLabel[_.selectedLeague],L(t,_.selectedLeague),_.isALeaguesSite?C.resetState():C.resetStateClubs(),f.setItem("selectedLeague","a-league-women"),A.setVisibleWeeks(),A.setVisibleClubs(),A.setMatchesUrl(),await T(),A.reinitEcal(),A.sendPageViewEvent(),A.initialiseGPT(),t.isALeaguesSite||1===_.selectedMatchWeek||I(_.selectedMatchWeek,_.selectedLeague)},resetState(){const t=e();_.selectedClub="all",_.clubSelectorLabel="Team",_.isActiveClub=!1,L(t,_.selectedLeague),_.allMatches=!1},resetStateClubs(){const t=e();_.selectedClub="all",_.clubSelectorLabel="Team",_.isActiveClub=!1,L(t,_.selectedLeague),_.allMatches=!0},showMatchesTab(){_.isMatchesTab=!0,_.isLaddersTab=!1,_.isVideosTab=!1},showLaddersTab(){_.isMatchesTab=!1,_.isLaddersTab=!0,_.isVideosTab=!1},showVideosTab(){_.isMatchesTab=!1,_.isLaddersTab=!1,_.isVideosTab=!0},toggleClubMenu(){_.showClub=!_.showClub,A.sendCustomEvent("matches_slider_filter_click",{filter:"club_selector",value:_.showClub?"open":"close"})},clearClubSelection(e){e.stopPropagation(),_.selectedClub="all",_.clubSelectorLabel="Club",_.isActiveClub=!1,_.showClub=!1,T()},toggleThisWeekFilter(){_.currentWeek=!_.currentWeek,_.isWeekSelectionList=!1,(!_.isALeaguesSite||_.isALeaguesSite&&"all"!==_.selectedClub)&&(_.allMatches=!_.currentWeek),_.currentWeek&&_.allMatches&&(_.allMatches=!1),_.currentWeek||_.allMatches||"All Matches"!==_.selectedMatchWeekLabel||(_.allMatches=!0),_.fromDate=_.currentWeek?U(!1,!0):null,_.toDate=_.currentWeek?U(!0):null,_.shouldCallMatches?T():I(_.currentMatchWeek,_.selectedLeague),A.sendCustomEvent("matches_slider_filter_click",{filter:"next_7_days",value:_.currentWeek?"next_7_days":"all"})},toggleWeekSelectionList(){_.isWeekSelectionList=!_.isWeekSelectionList,A.sendCustomEvent("matches_slider_filter_click",{filter:"week_selector",value:_.isWeekSelectionList?"open":"close"})},setActiveMatchWeek(){const t=e();_.selectedMatchWeek=t.item.value,_.selectedMatchWeekLabel=t.item.label,_.currentWeek=!1,_.fromDate=null,_.toDate=null,_.allMatches=!1,C.toggleWeekSelectionList(),_.isALeaguesSite&&"all"!==_.selectedMatchWeek&&"all"===_.selectedClub?T():I(_.selectedMatchWeek,_.selectedLeague)},setActiveClub(){const t=e();"all"===t.item.key?(_.clubSelectorLabel="Club",_.selectedClub="all",_.isActiveClub=!1,_.allMatches=!1,L(t,_.selectedLeague)):(_.clubSelectorLabel=t.item.value,_.selectedClub=t.item.key,_.isActiveClub=!0,_.allMatches=!0,_.currentWeek=!1,_.fromDate=null,_.toDate=null),_.showClub=!1,T()},showAllMatches(){_.isALeaguesSite&&(_.selectedMatchWeek="all",_.selectedMatchWeekLabel="All Matches",_.allMatches=!0,_.currentWeek=!1,C.toggleWeekSelectionList(),T())},get currentWeek(){return!0===_.currentWeek},get isLoading(){return!0===_.isLoading},get adSlotCount(){return _.adSlotCount},get ads(){return _.ads},incrementAdSlotCount:()=>
1(_.adSlotCount++,_.adSlotCount),getSelectedClubLogo(){if("all"===_.selectedClub)return null;const t=e();return"".concat(t.homeUrl,"/wp-content/themes/keepup-club/source/images/logos/teamcode/").concat(_.selectedClub,".svg")}},callbacks:{async init(){A.removeCloak();const t=e();_.adConfig=t.adConfig,_.allMatches=!_.isALeaguesSite,_.selectedMatchWeek=t.matchWeek[_.selectedLeague],_.selectedMatchWeekLabel=t.matchWeekLabel[_.selectedLeague],L(t,_.selectedLeague),A.setLeagueDefaults(),_.matchesUrl=t.matchesUrl[_.selectedLeague],await A.fetchMatches(),A.stopLiveMatches(),await A.fetchLiveMatches()},removeCloak(){t().ref.removeAttribute("data-wp-cloak")},showNoMatchesFoundText(){if(e(),_.hasMatches&&!_.noMatchesFound)return;const t=A.getActiveBreak();return t?(_.breakUrl=t.url||"",t.name):(_.breakUrl="","No matches found.")},getActiveBreak(){const t=e(),a=_.selectedMatchWeek,l=_.isALeagueMen?t.breaks["a-league-men"]:t.breaks["a-league-women"];if(!l||!l.length)return null;let n=l.find(e=>e.weeks.includes(a));if(!n&&_.currentWeek){const e=Date.now()/1e3;n=l.find(t=>t.startTimestamp&&t.endTimestamp&&e>=t.startTimestamp&&e<=t.endTimestamp)}return n||null},imageLoaded(){const e=t().ref;e.children[1].addEventListener("load",()=>{e.children[0].classList.add("team-logo__image-placeholder--hidden"),e.children[1].classList.remove("team-logo__image--hidden")})},reinitEcal(){const e=window.EcalWidget;e&&"function"==typeof e.init&&window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const t=e.buttonElements?Array.from(e.buttonElements):[];Array.from(document.querySelectorAll(".ecal-sync-widget-button")).some(e=>!e.clickReady&&!t.includes(e))&&(window.ECAL_SYNC_WIDGET=e.init({apiKey:"qbocOqZzzXDpJusuYvcXvCeXV0ydn5vJ9lkR8WhfovM650b482"}))})})},*fetchMatches(){var t,a;_.isLoading=!0,_.noMatchesFound=!1;const l=e(),n=_.isALeaguesSite?_.selectedClub:(null===(t=l.currentClubCode)||void 0===t?void 0:t[_.selectedLeague])||"all",s=yield async function(e){let t=e.competition,a=e.tournament,l=e.leagueSlug,n=e.club,s=void 0===n?"all":n,o=e.matchWeek,c=void 0===o?null:o,i=e.allMatches,r=void 0!==i&&i,h=e.currentWeek,v=void 0!==h&&h;if(!t||!a)return{notFound:!0};const b=r||v||"all"===c||null===c?null:c;try{const e=await(new u).getFixturesResults(t,a,void 0,b,void 0);if(!Array.isArray(e))return{notFound:!0};let n=e;if(s&&"all"!==s&&(n=n.filter(e=>{var t,a;return(null===(t=e.homeTeam)||void 0===t?void 0:t.code)===s||(null===(a=e.awayTeam)||void 0===a?void 0:a.code)===s})),v&&!r){const e=new Date;e.setHours(0,0,0,0);const t=e.getTime(),a=Date.now()+6048e5;n=n.filter(e=>{const l=Number(e.startDate)||0;return l>=t&&l<=a})}if(0===n.length)return{notFound:!0};const o=n.map(e=>function(e){var t,a,l,n,s,o,c,i,r,u,m,h,v,b,w,f,y,L,k,p,M,S;let W=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const _=Number(e.startDate)||0,C=e.matchStatus||"Fixture",A=null!==(t=e.competition)&&void 0!==t&&t.name?(T=e.competition.name,String(null!=T?T:"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")):W;var T;const I={uuid:e.id,team1home:{code:null!==(a=null===(l=e.homeTeam)||void 0===l?void 0:l.code)&&void 0!==a?a:"",uuid:null!==(n=null===(s=e.homeTeam)||void 0===s?void 0:s.id)&&void 0!==n?n:"",title:null!==(o=null!==(c=null===(i=e.homeTeam)||void 0===i?void 0:i.officialName)&&void 0!==c?c:null===(r=e.homeTeam)||void 0===r?void 0:r.name)&&void 0!==o?o:""},team2away:{code:null!==(u=null===(m=e.awayTeam)||void 0===m?void 0:m.code)&&void 0!==u?u:"",uuid:null!==(h=null===(v=e.awayTeam)||void 0===v?void 0:v.id)&&void 0!==h?h:"",title:null!==(b=null!==(w=null===(f=e.awayTeam)||void 0===f?void 0:f.officialName)&&void 0!==w?w:null===(y=e.awayTeam)||void 0===y?void 0:y.name)&&void 0!==b?b:""},stage:null!==(L=e.stage)&&void 0!==L?L:"",status:C,status_label:d(C,_),start_timestamp:_,start_datetime_raw:new Date(_).toISOString(),venue_long_name:null!==(k=null===(p=e.venue)||void 0===p?void 0:p.longName)&&void 0!==k?k:"",buy_tickets:null!==(M=e.ticketUrl)&&void 0!==M?M:"",leg:null===(S=e.liveData)||void 0===S||null===(S=S.matchDetails)||void 0===S?void 0:S.leg,home_team_score:g(e,"home"),away_team_score:g(e,"away"),url:"/matches/".concat(A,"/?uuid=").concat(e.id),channel_10:!!e.isCh10,channel_10_play:!!e.is10Play,channel_10_bold:!!e.is10Bold,channel_sky_open:!!e.isSkyOpen},D=function(e){var t;const a=null==e||null===(t=e.liveData)||void 0===t||null===(t=t.matchDetails)||void 0===t||null===(t=t.scores)||void 0===t?void 0:t.aggregate;return a&&void 0!==a.home&&void 0!==a.away?"".concat(a.home,"-").concat(a.away):""}(e);return""!==D&&(I.aggregate_score=D,I.aggregate_display_score=D),I}(e,l));
1return m&&o.forEach(e=>function(e){e.status="Played",e.status_label="FT",e.home_team_score=e.home_team_score||"2",e.away_team_score=e.away_team_score||"1",e.aggregate_score=e.aggregate_score||"4-3"}(e)),{data:o,notFound:!1}}catch(e){return console.error(e),{notFound:!0}}}({competition:_.selectedCompetitionIds,tournament:null===(a=l.tournament)||void 0===a?void 0:a[_.selectedLeague],leagueSlug:_.selectedLeague,club:n,matchWeek:_.selectedMatchWeek,allMatches:_.allMatches,currentWeek:_.currentWeek}),o=s.notFound,c=s.data;if(o)return _.noMatchesFound=!0,_.hasLiveMatches=!1,_.hasMatches=!1,void(_.isLoading=!1);_.noMatchesFound=!1,_.hasMatches=!0,_.hasLiveMatches=c.some(e=>"Playing"===e.status),c.forEach(e=>{"Fixture"!==e.status&&"Scheduled"!==e.status||(e.status_label=F(e.start_timestamp))});const i=A.groupMatchesByDay(c);_.matches=i,S(_.matches),_.isLoading=!1,A.reinitEcal()},fetchLiveMatches(){const e=async()=>{const e=_.matches;for(const o of e)for(const e of o.matches){const o=h(e.start_timestamp,30,240);if(e.uuid&&o){var t,a,l,n;const o=(await b(e.uuid)).liveData.matchDetails,c=o.matchStatus;e.home_team_score=null!=o&&null!==(t=o.scores)&&void 0!==t&&t.pen?"".concat(o.scores.et.home," (").concat(o.scores.pen.home,")"):null==o||null===(a=o.scores)||void 0===a?void 0:a.total.home,e.away_team_score=null!=o&&null!==(l=o.scores)&&void 0!==l&&l.pen?"".concat(o.scores.et.away," (").concat(o.scores.pen.away,")"):null==o||null===(n=o.scores)||void 0===n?void 0:n.total.away,void 0!==o.leg&&(e.leg=o.leg);let i="";if(1===o.leg&&"Played"===c){var s;const e=null==o||null===(s=o.scores)||void 0===s?void 0:s.total;void 0!==(null==e?void 0:e.home)&&void 0!==(null==e?void 0:e.away)&&(i="".concat(e.home,"-").concat(e.away))}else 1!==o.leg&&(i=k(o));if(""!==i?(e.aggregate_score=i,e.aggregate_display_score=1===o.leg?i:p(o,i)):(delete e.aggregate_score,delete e.aggregate_display_score),c)switch(e.status=c,e.status){case"Playing":e.status_label="Live";break;case"Played":e.status_label="FT";break;case"Cancelled":e.status_label="Cancelled";break;case"Postponed":e.status_label="TBC";break;case"Suspended":e.status_label="Suspended";break;default:e.status_label=F(e.start_timestamp)}}}_.hasLiveMatches=e.some(e=>e.matches.some(e=>"Playing"===e.status)),S(_.matches)};clearInterval(_.liveMatchesInterval),e(),_.liveMatchesInterval=setInterval(e,3e4)},stopLiveMatches(){_.liveMatchesInterval&&(clearInterval(_.liveMatchesInterval),_.liveMatchesInterval=null)},groupMatchesByDay(e){const t=[],a={};return e.forEach(e=>{const t=e.start_datetime_raw.replace(" ","T"),l=new Date(t).toISOString().split("T")[0];a[l]||(a[l]=[]),a[l].push(e)}),Object.keys(a).forEach((e,l)=>{t.push({date:P(e),dateRaw:e,index:l+1,matches:a[e]})}),t},isActiveMatchWeek:()=>e().item.value===_.selectedMatchWeek,isCurrentMatchWeek:()=>e().item.value===_.currentMatchWeek,isSelectedWeekCurrentWeek:()=>_.selectedMatchWeek===_.currentMatchWeek,isSelectedClub(){const t=e();return"all"!==t.item.key&&t.item.key===_.selectedClub},toggleButtonLabel:()=>_.show?"Hide matches":"Show matches",getHomeClubImageSrc(){const t=e();return"".concat(t.homeUrl,"/wp-content/themes/keepup-club/source/images/logos/teamcode/").concat(t.child.team1home.code,".svg")},getAwayClubImageSrc(){const t=e();return"".concat(t.homeUrl,"/wp-content/themes/keepup-club/source/images/logos/teamcode/").concat(t.child.team2away.code,".svg")},setVisibleWeeks(){const t=e();_.visibleWeeks=_.isALeagueMen?t.weeksByLeague["a-league-men"]:t.weeksByLeague["a-league-women"]},setVisibleClubs(){const t=e();_.visibleClubs=_.isALeagueMen?t.clubs["a-league-men"]:t.clubs["a-league-women"]},setMatchesUrl(){const t=e();_.matchesUrl=_.isALeagueMen?t.matchesUrl["a-league-men"]:t.matchesUrl["a-league-women"]},setLeagueDefaults(){const t=e(),a=f.getItem("selectedLeague"),l=document.getElementById("matches-takeover-a-league-men-tab"),n=document.getElementById("matches-takeover-a-league-women-tab");l&&n?"a-league-men"!==a&&a?"a-league-women"===a&&(_.isALeagueMen=!1,_.isALeagueWomen=!0,_.selectedCompetitionIds="9p3nnxhdjahfn8qswpzy8oyc3",_.selectedLeague="a-league-women",_.visibleWeeks=t.weeksByLeague["a-league-women"],_.visibleClubs=t.clubs["a-league-women"],_.ecalId=t.ecalId.womens,L(t,_.selectedLeague),_.selectedMatchWeek=t.matchWeek[_.selectedLeague],_.selectedMatchWeekLabel=t.matchWeekLabel[_.selectedLeague]):(_.isALeagueMen=!0,_.isALeagueWomen=!1,_.selectedCompetitionIds="xwnjb1az11zffwty3m6vn8y6",_.selectedLeague="a-league-men",_.visibleWeeks=t.weeksByLeague["a-league-men"],_.visibleClubs=t.clubs["a-league-men"],_.ecalId=t.ecalId.mens,L(t,_.selectedLeague),_.selectedMatchWeek=t.matchWeek[_.selectedLeague],_.selectedMatchWeekLabel=t.matchWeekLabel[_.selectedLeague]):!0===window.location.hostname.includes("canberraunited")?(_.isALeagueMen=!1,_.isALeagueWomen=!0,_.selectedCompetitionIds="9p3nnxhdjahfn8qswpzy8oyc3",_.visibleWeeks=t.weeksByLeague["a-league-women"],_.visibleClubs=t.clubs["a-league-women"],_.selectedLeague="a-league-women",_.ecalId=t.ecalId.womens,L(t,_.selectedLeague),_.selectedMatchWeek=t.matchWeek[_.selectedLeague],_.selectedMatchWeekLabel=t.matchWeekLabel[_.selectedLeague]):(_.isALeagueMen=!0,_.isALeagueWomen=!1,_.selectedCompetitionIds="xwnjb1az11zffwty3m6vn8y6",_.selectedLeague="a-league-men",_.ecalId=t.ecalId.mens,_.visibleWeeks=t.weeksByLeague["a-league-men"],_.visibleClubs=t.clubs["a-league-men"],L(t,_.selectedLeague))},*sendPageViewEvent(){const e=_.isALeagueMen?"a-league-men":"a-league-women",t=_.isALeagueMen?"A-League Men":"A-League Women";yield window.dataLayer.push({event:"matches_slider_view",page_path:"/matches-slider/".concat(e),page_title:"Matches Slider - ".concat(t)})},*sendCustomEvent(e,t){yield window.dataLayer.push({event:e,...t})},isGrandFinal(){var t,a;const l=e();return"grand final"===String(null!==(t=null===(a=l.child)||void 0===a?void 0:a.stage)&&void 0!==t?t:"").trim().toLowerCase()},isPlaying(){if("Playing"===e().child.status)return!0},isPlayed(){if("Played"===e().child.status)return!0},isUpcoming(){if("Fixture"===e().child.status||A.isPostponed())return!0},isPostponed(){const t=e();if("Postponed"===t.child.status||"TBC"===t.child.status)return!0},hasAggregateScore(){var t,a;const l=e();return""!==String(null!==(t=null===(a=l.child)||void 0===a?void 0:a.aggregate_score)&&void 0!==t?t:"").trim()},getAggregateScore(){var t,a,l,n;const s=e(),o=String(null!==(t=null!==(a=null===(l=s.child)||void 0===l?void 0:l.aggregate_display_score)&&void 0!==a?a:null===(n=s.child)||void 0===n?void 0:n.aggregate_score)&&void 0!==t?t:"").trim();return""===o?"":"Agg: ".concat(o)},matchesCompleted:()=>e().group.matches.every(e=>"Played"===e.status),async initialiseGPT(){var e;_.adSlotCount=1,_.adSlots={};const t=null===(e=window.KEEPUP)||void 0===e||null===(e=e.ads)||void 0===e?void 0:e.ad_config;let a;a=_.isALeagueMen?document.querySelectorAll(".tab-a-league-men .matches-content__group-ad-slot"):document.querySelectorAll(".tab-a-league-women .matches-content__group-ad-slot"),a.forEach((e,a)=>{if(a%2!=0){var l;const n=(null==t?void 0:t.network_code)||"",s=(null===(l=_.adConfig)||void 0===l?void 0:l.code)||"";if(!n||!s||"undefined"===n||"undefined"===s)return;A.defineAdSlot(a,s,n,(null==t?void 0:t.common_targeting)||{},e)}})},defineAdSlot(e,t,a,l,n){if(window.KEEPUP.global.config.disable_ads||void 0===window.googletag)return;const s=_.adSlotCount,o="/".concat(a,"/").concat(t),c="div-gpt-ad-matches-slider-".concat(s),i=[320,50];n.innerHTML='<div class="ad-container" style="width: 320px; height: 50px;" id="'.concat(c,'"></div>'),window.googletag.cmd.push(()=>{const e=window.googletag.defineSlot(o,i,c);e&&(e.addService(window.googletag.pubads()),E(e,s,l),window.googletag.display(e),_.adSlots[c]=e,C.incrementAdSlotCount())})},unloadAds(){Object.keys(_.adSlots).length>0&&window.googletag.destroySlots(Object.values(_.adSlots))},maybeCloseFilters(e){_.isWeekSelectionList&&("Escape"!==e.key&&e.target===document.querySelector(".matches-navigation__week-selector")||(_.isWeekSelectionList=!1))},isSemiFinal(){var t,a;const l=e();return"semi-finals"===String(null!==(t=null===(a=l.child)||void 0===a?void 0:a.stage)&&void 0!==t?t:"").trim().toLowerCase()},hasTicketLink(){const t=e();return""!==t.child.buy_tickets&&null!==t.child.buy_tickets},getSelectedMatchWeekLabel:()=>_.currentWeek&&_.isALeaguesSite?"Matchweek":_.selectedMatchWeekLabel,getTimezoneNotice:()=>"â¹ï¸ Timezone: "+Intl.DateTimeFormat().resolvedOptions().timeZone,getLastPlayedGame(){_.isALeaguesSite||_.isLoading||!_.matches.length||D(_.selectedLeague)}}}),_=W.state,C=W.actions,A=W.callbacks,T=async()=>{await A.fetchMatches(),await A.fetchLiveMatches()},I=(e,t)=>{const a=document.querySelector(".matches-takeover.matches-takeover--mobile-overlay");if(isNaN(e))return void(a.scrollTop=a.scrollHeight);const l=document.querySelector(".matches-takeover--mobile-overlay .tab-".concat(t,' [data-group-index="').concat(e,'"]')),n=!!document.querySelector(".matches-takeover--mobile-overlay .matches-takeover__league-tabs"),s=document.querySelector(".matches-takeover--mobile-overlay .matches-navigation__timezone-notice"),o=s?s.offsetHeight:0;let c;if(c=n?96+o:6,a&&l){let e=0,t=l;for(;t&&t!==a&&(e+=t.offsetTop,t=t.offsetParent,t!==document.body););a.scrollTop=e-c}},D=e=>{const t=document.querySelectorAll(".matches-takeover--mobile-overlay .tab-".concat(e," .scores--played")),a=t[t.length-1];if(!a)return;const l=a.closest("[data-group-index]").dataset.groupIndex;I(parseInt(l,10),e)},P=e=>{const t=new Date(e),a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getDay()],l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate();return"".concat(a,", ").concat(l," ").concat(n)},E=(e,t,a)=>{e.setTargeting("position","slider"+t),e.setTargeting("url",window.location.pathname),e.setTargeting("contentGroup","matches")},F=e=>{const t=new Date(e);return new Intl.DateTimeFormat("en-AU",{hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)},U=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const a=new Date;return t&&a.setHours(0,0,0,0),e&&a.setDate(a.getDate()+7),a.setSeconds(0,0),a.toISOString()};
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.