"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[339],{22339:(e,a,s)=>{s.r(a),s.d(a,{default:()=>r});var t=s(89379),c=s(65043),n=s(74117),l=s(56644),i=s(25189),o=s(70579);const r=e=>{let{title:a,comps:s,activeIndex:r,onActiveChange:m,onMatchClick:d,elementProps:h,variant:v}=e;const{t:u}=(0,n.Bd)(),x=(0,c.useRef)(null),j=s[Math.max(0,Math.min(r,s.length-1))];if((0,c.useEffect)(()=>{try{var e;const a=x.current;if(!a)return;const s=Array.isArray(null===j||void 0===j?void 0:j.matches)?j.matches:[],t=Date.now();let c=0,n=Number.POSITIVE_INFINITY;s.forEach((e,a)=>{const s="".concat(e.date||"","T").concat(e.time||"00:00",":00"),l=new Date(s).getTime();if(!isNaN(l)){const e=Math.abs(l-t);e{const e=l.offsetLeft-(a.clientWidth-l.clientWidth)/2;a.scrollTo({left:Math.max(0,e),behavior:"smooth"})};"undefined"!==typeof requestAnimationFrame?requestAnimationFrame(i):setTimeout(i,0)}catch(a){}},[r,JSON.stringify(null===j||void 0===j?void 0:j.matches)]),"ticker"===v){const e=(null===j||void 0===j?void 0:j.matches)||[],s=[...e,...e,...e];return(0,o.jsxs)("section",(0,t.A)((0,t.A)({className:"matches-slider matches-ticker","aria-label":"".concat(u("nav.matches")," \u2013 ").concat((null===j||void 0===j?void 0:j.name)||"")},h||{}),{},{children:[(0,o.jsxs)("div",{className:"section-head",style:{marginTop:16,marginBottom:8},children:[(0,o.jsx)("h3",{children:a||u("nav.matches")}),(0,o.jsx)("a",{href:"/kalendar",className:"see-all",children:u("homepage.all_matches")})]}),(0,o.jsx)("div",{className:"ticker-belt",role:"list",children:s.map((e,a)=>(0,o.jsx)("div",{className:"match-card card",role:"button",tabIndex:0,"aria-label":"".concat((0,i.Lt)(e.home||"")," proti ").concat((0,i.Lt)(e.away||"")).concat(e.time?", ".concat(e.time):"").concat(e.score?", sk\xf3re ".concat(String(e.score)):""),onKeyDown:a=>{"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),null===d||void 0===d||d(e,null===j||void 0===j?void 0:j.name))},onClick:a=>{a.preventDefault(),null===d||void 0===d||d(e,null===j||void 0===j?void 0:j.name)},style:{cursor:d?"pointer":"default"},children:(0,o.jsxs)("div",{className:"teams",children:[(0,o.jsxs)("div",{className:"team",children:[(0,o.jsx)(l.L,{teamId:e.home_id,teamName:e.home,facrLogo:e.home_logo_url,size:"custom",alt:e.home,borderRadius:"full"}),(0,o.jsx)("div",{className:"name",children:(0,i.Lt)(e.home||"")})]}),(0,o.jsx)("div",{className:"score",children:e.score?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"home",children:String(e.score).split(":")[0]}),(0,o.jsx)("span",{className:"sep",children:":"}),(0,o.jsx)("span",{className:"away",children:String(e.score).split(":")[1]})]}):(0,o.jsx)("span",{className:"time",children:e.time})}),(0,o.jsxs)("div",{className:"team",children:[(0,o.jsx)(l.L,{teamId:e.away_id,teamName:e.away,facrLogo:e.away_logo_url,size:"custom",alt:e.away,borderRadius:"full"}),(0,o.jsx)("div",{className:"name",children:(0,i.Lt)(e.away||"")})]})]})},"".concat(e.id||a,"-ticker")))})]}))}return(0,o.jsxs)("section",(0,t.A)((0,t.A)({className:"matches-slider","aria-label":"".concat(u("nav.matches")," \u2013 ").concat((null===j||void 0===j?void 0:j.name)||"")},h||{}),{},{children:[(0,o.jsxs)("div",{className:"section-head",style:{marginTop:16,marginBottom:16},children:[(0,o.jsx)("h3",{children:a||u("nav.matches")}),(0,o.jsx)("a",{href:"/kalendar",className:"see-all",children:u("homepage.all_matches")})]}),(0,o.jsxs)("div",{className:"matches-grid",children:[(0,o.jsx)("div",{className:"matches-track",ref:x,role:"list",children:((null===j||void 0===j?void 0:j.matches)||[]).map((e,a)=>(0,o.jsxs)("div",{className:"match-card card",role:"button",tabIndex:0,"aria-label":"".concat((0,i.Lt)(e.home||"")," proti ").concat((0,i.Lt)(e.away||"")).concat(e.date?", ".concat(new Date("".concat(e.date,"T").concat(e.time||"00:00",":00")).toLocaleDateString()):"").concat(e.time?", ".concat(e.time):"").concat(e.score?", sk\xf3re ".concat(String(e.score)):""),onKeyDown:a=>{"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),null===d||void 0===d||d(e,null===j||void 0===j?void 0:j.name))},onClick:a=>{a.preventDefault(),null===d||void 0===d||d(e,null===j||void 0===j?void 0:j.name)},style:{cursor:d?"pointer":"default"},children:[(0,o.jsxs)("div",{className:"match-meta",children:[(0,o.jsx)("span",{children:(e.venue||"").split(",")[0]||""}),(0,o.jsx)("span",{children:"\u2022"}),(0,o.jsx)("span",{children:e.date?new Date("".concat(e.date,"T").concat(e.time||"00:00",":00")).toLocaleDateString():e.time||""})]}),(0,o.jsxs)("div",{className:"teams",children:[(0,o.jsxs)("div",{className:"team",children:[(0,o.jsx)(l.L,{teamId:e.home_id,teamName:e.home,facrLogo:e.home_logo_url,size:"custom",alt:e.home,borderRadius:"full"}),(0,o.jsx)("div",{className:"name",children:(0,i.Lt)(e.home||"")})]}),(0,o.jsx)("div",{className:"score",children:e.score?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"home",children:String(e.score).split(":")[0]}),(0,o.jsx)("span",{className:"sep",children:":"}),(0,o.jsx)("span",{className:"away",children:String(e.score).split(":")[1]})]}):(0,o.jsx)("span",{className:"time",children:e.time})}),(0,o.jsxs)("div",{className:"team",children:[(0,o.jsx)(l.L,{teamId:e.away_id,teamName:e.away,facrLogo:e.away_logo_url,size:"custom",alt:e.away,borderRadius:"full"}),(0,o.jsx)("div",{className:"name",children:(0,i.Lt)(e.away||"")})]})]})]},e.id||a))}),(0,o.jsx)("div",{className:"matches-tabs",children:s.map((e,a)=>(0,o.jsx)("button",{className:a===r?"active":"","aria-pressed":a===r,onClick:()=>m(a),children:e.name},"".concat(e.name,"-").concat(a)))})]})]}))}}}]); //# sourceMappingURL=339.c1ec8d08.chunk.js.map