1import{r as n,j as s}from"./vendor-react-nIFFWcjg.js";import{u as J}from"./vendor-react-router-65IGR4DC.js";import{u as K,g as W,a as $,M as Z,b as _,c as tt}from"./MatchesListPage-B9tOhGhn.js";import{u as et,a as st}from"./useIsMobile-C9JFGQjn.js";import{u as at,M as p,a as rt,b as ot,L as nt,N as it,H as ut,c as f,d as ct}from"./main-CUbWTmvN.js";import{u as dt}from"./useEditableClubsQuery-BzVu4OXN.js";import"./vendor-react-query-ChuYpeSs.js";import"./vendor-datepicker-WU22x5DJ.js";import"./vendor-react-aria-Cxu2IdXX.js";import"./MobileFiltersModal-85B2lMWC.js";import"./ExpandIcon-BTRX85Gp.js";import"./FiltersDialog-BXfeIZkD.js";const mt=g=>{if(g){const i=new Date(g),u=_(i.getFullYear(),i.getMonth(),i.getDate());return{...tt(u),date:u}}else return $()};function Et(){var A,R,I,N;const g=et(),{data:i}=at(),u=((A=i==null?void 0:i.env)==null?void 0:A.siteName)??"",[c,j]=J(),d=c.get("startDate"),D=c.get("endDate"),E=c.get("team"),F=c.get("competition"),O=c.get("groupBy"),t=c.get("matchType")||"results",L=c.get("sort"),m=O==="flat",[Q,U]=n.useState(null),r=n.useMemo(()=>mt(d),[d]),T=n.useMemo(()=>{switch(t){case"fixtures":return p.FIXTURE;case"all":return;case"results":default:return`${p.RESULT},${p.POSTPONED},${p.ABANDONED}`}},[t]),{data:b,isLoading:B}=dt(),{data:e,isLoading:H}=st(),{data:v,isLoading:X}=rt(),l=n.useMemo(()=>e==null?void 0:e.find(h=>h.competitions===F),[e,F]),o=n.useMemo(()=>new Date().toISOString().split("T")[0],[]),G=n.useMemo(()=>d||(m?t==="fixtures"?o:void 0:t==="results"?r.startDate:t==="fixtures"&&o>r.startDate?o:r.startDate),[m,d,o,r.startDate,t]),V=n.useMemo(()=>D||(m?t==="results"?o:void 0:t==="results"&&o<r.endDate?o:r.endD
1ate),[m,D,r.endDate,t,o]),w=t==="fixtures"?"ASC":"DESC",Y=L?L==="DESC"?f.DESC:f.ASC:w==="DESC"?f.DESC:f.ASC,{data:a,isLoading:M,isFetchedAfterMount:C,error:k}=ot({limit:1e3,period:ct.Custom,startDate:G,endDate:V,sort:Y,status:T,teamId:E,competition:(l==null?void 0:l.competitions)??((R=e==null?void 0:e[0])==null?void 0:R.competitions)},{enabled:!!e}),{data:q,isLoading:z}=K({startDate:t==="results"?void 0:o,endDate:t==="fixtures"?void 0:o,status:T,teamId:E,competition:(l==null?void 0:l.competitions)??((I=e==null?void 0:e[0])==null?void 0:I.competitions)},{enabled:!!e});if(n.useEffect(()=>{var h;if(t==="results"&&!m&&!M&&C&&!d&&(!a||((h=a==null?void 0:a.items)==null?void 0:h.length)===0)){const y=W($().date);j(P=>(P.set("startDate",y.startDate),P.set("endDate",y.endDate),P),{replace:!0}),U(y)}},[t,m,C,M,(N=a==null?void 0:a.items)==null?void 0:N.length,r,d,a,j]),H||M||z||B||X)return s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"calc(100vh - 100px)"},children:s.jsx(nt,{})});if(k||!e||!a||!b||!v)return s.jsx(it,{});const S=`${u} Football Scores, Results & Season Archives`,x=`View ${u} scores, results & season archives, along with other competitions involving ${u} clubs, on the official website of the ${u}.`;return s.jsxs(s.Fragment,{children:[s.jsxs(ut,{children:[s.jsx("title",{children:S}),s.jsx("meta",{name:"description",content:x}),s.jsx("meta",{property:"og:title",content:S}),s.jsx("meta",{property:"og:description",content:x}),s.jsx("meta",{name:"twitter:title",content:S}),s.jsx("meta",{name:"twitter:description",content:x})]}),s.jsx(Z,{title:"Results",isMobile:g,matchFilters:e,selectedCompetition:l??e[0],matches:(a==null?void 0:a.items)??[],matchDates:q,clubs:b.items,currentMonth:Q??r,featureFlags:v,sortByDate:w,showAdvancedFilters:!0,defaultMatchType:t,monthSwitcherMode:m?void 0:t==="results"?"RESULTS":"FIXTURES"})]})}export{Et as ResultsPage}; 2//# sourceMappingURL=index-CW5vUiMe.js.map
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.