@golstats/gsc-landing 1.0.159 → 1.0.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gsc-landing.js +6 -6
- package/dist/gsc-landing.umd.cjs +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/gsc-landing.umd.cjs
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* Vue 3 Carousel 0.3.3
|
|
26
26
|
* (c) 2024
|
|
27
27
|
* @license MIT
|
|
28
|
-
*/const je={itemsToShow:1,itemsToScroll:1,modelValue:0,transition:300,autoplay:0,snapAlign:"center",wrapAround:!1,throttle:16,pauseAutoplayOnHover:!1,mouseDrag:!0,touchDrag:!0,dir:"ltr",breakpoints:void 0,i18n:{ariaNextSlide:"Navigate to next slide",ariaPreviousSlide:"Navigate to previous slide",ariaNavigateToSlide:"Navigate to slide {slideNumber}",ariaGallery:"Gallery",itemXofY:"Item {currentSlide} of {slidesCount}",iconArrowUp:"Arrow pointing upwards",iconArrowDown:"Arrow pointing downwards",iconArrowRight:"Arrow pointing to the right",iconArrowLeft:"Arrow pointing to the left"}},Rh={itemsToShow:{default:je.itemsToShow,type:Number},itemsToScroll:{default:je.itemsToScroll,type:Number},wrapAround:{default:je.wrapAround,type:Boolean},throttle:{default:je.throttle,type:Number},snapAlign:{default:je.snapAlign,validator(s){return["start","end","center","center-even","center-odd"].includes(s)}},transition:{default:je.transition,type:Number},breakpoints:{default:je.breakpoints,type:Object},autoplay:{default:je.autoplay,type:Number},pauseAutoplayOnHover:{default:je.pauseAutoplayOnHover,type:Boolean},modelValue:{default:void 0,type:Number},mouseDrag:{default:je.mouseDrag,type:Boolean},touchDrag:{default:je.touchDrag,type:Boolean},dir:{default:je.dir,validator(s){return["rtl","ltr"].includes(s)}},i18n:{default:je.i18n,type:Object},settings:{default(){return{}},type:Object}};function Bk({config:s,slidesCount:e}){const{snapAlign:t,wrapAround:a,itemsToShow:i=1}=s;if(a)return Math.max(e-1,0);let o;switch(t){case"start":o=e-i;break;case"end":o=e-1;break;case"center":case"center-odd":o=e-Math.ceil((i-.5)/2);break;case"center-even":o=e-Math.ceil(i/2);break;default:o=0;break}return Math.max(o,0)}function Dk({config:s,slidesCount:e}){const{wrapAround:t,snapAlign:a,itemsToShow:i=1}=s;let o=0;if(t||i>e)return o;switch(a){case"start":o=0;break;case"end":o=i-1;break;case"center":case"center-odd":o=Math.floor((i-1)/2);break;case"center-even":o=Math.floor((i-2)/2);break;default:o=0;break}return o}function Fo({val:s,max:e,min:t}){return e<t?s:Math.min(Math.max(s,t),e)}function Pk({config:s,currentSlide:e,slidesCount:t}){const{snapAlign:a,wrapAround:i,itemsToShow:o=1}=s;let r=e;switch(a){case"center":case"center-odd":r-=(o-1)/2;break;case"center-even":r-=(o-2)/2;break;case"end":r-=o-1;break}return i?r:Fo({val:r,max:t-o,min:0})}function Nh(s){return s?s.reduce((e,t)=>{var a;return t.type===n.Fragment?[...e,...Nh(t.children)]:((a=t.type)===null||a===void 0?void 0:a.name)==="CarouselSlide"?[...e,t]:e},[]):[]}function Mo({val:s,max:e,min:t=0}){return s>e?Mo({val:s-(e+1),max:e,min:t}):s<t?Mo({val:s+(e+1),max:e,min:t}):s}function Ok(s,e){let t;return e?function(...a){const i=this;t||(s.apply(i,a),t=!0,setTimeout(()=>t=!1,e))}:s}function Fk(s,e){let t;return function(...a){t&&clearTimeout(t),t=setTimeout(()=>{s(...a),t=null},e)}}function Mk(s="",e={}){return Object.entries(e).reduce((t,[a,i])=>t.replace(`{${a}}`,String(i)),s)}var $k=n.defineComponent({name:"ARIA",setup(){const s=n.inject("config",n.reactive(Object.assign({},je))),e=n.inject("currentSlide",n.ref(0)),t=n.inject("slidesCount",n.ref(0));return()=>n.h("div",{class:["carousel__liveregion","carousel__sr-only"],"aria-live":"polite","aria-atomic":"true"},Mk(s.i18n.itemXofY,{currentSlide:e.value+1,slidesCount:t.value}))}}),Vk=n.defineComponent({name:"Carousel",props:Rh,setup(s,{slots:e,emit:t,expose:a}){var i;const o=n.ref(null),r=n.ref([]),l=n.ref(0),d=n.ref(0),c=n.reactive(Object.assign({},je));let h=Object.assign({},je),u;const f=n.ref((i=s.modelValue)!==null&&i!==void 0?i:0),p=n.ref(0),m=n.ref(0),g=n.ref(0),y=n.ref(0);let b,S;n.provide("config",c),n.provide("slidesCount",d),n.provide("currentSlide",f),n.provide("maxSlide",g),n.provide("minSlide",y),n.provide("slideWidth",l);function _(){u=Object.assign({},s.breakpoints),h=Object.assign(Object.assign(Object.assign({},h),s),{i18n:Object.assign(Object.assign({},h.i18n),s.i18n),breakpoints:void 0}),T(h)}function C(){if(!u||!Object.keys(u).length)return;const x=Object.keys(u).map(U=>Number(U)).sort((U,M)=>+M-+U);let j=Object.assign({},h);x.some(U=>{const M=window.matchMedia(`(min-width: ${U}px)`).matches;return M&&(j=Object.assign(Object.assign({},j),u[U])),M}),T(j)}function T(x){Object.entries(x).forEach(([j,U])=>c[j]=U)}const v=Fk(()=>{C(),N(),E()},16);function E(){if(!o.value)return;const x=o.value.getBoundingClientRect();l.value=x.width/c.itemsToShow}function N(){d.value<=0||(m.value=Math.ceil((d.value-1)/2),g.value=Bk({config:c,slidesCount:d.value}),y.value=Dk({config:c,slidesCount:d.value}),c.wrapAround||(f.value=Fo({val:f.value,max:g.value,min:y.value})))}n.onMounted(()=>{n.nextTick(()=>E()),setTimeout(()=>E(),1e3),C(),q(),window.addEventListener("resize",v,{passive:!0}),t("init")}),n.onUnmounted(()=>{S&&clearTimeout(S),b&&clearInterval(b),window.removeEventListener("resize",v,{passive:!0})});let L=!1;const R={x:0,y:0},$={x:0,y:0},K=n.reactive({x:0,y:0}),z=n.ref(!1),ae=n.ref(!1),oe=()=>{z.value=!0},ie=()=>{z.value=!1};function ce(x){["INPUT","TEXTAREA","SELECT"].includes(x.target.tagName)||(L=x.type==="touchstart",L||x.preventDefault(),!(!L&&x.button!==0||J.value)&&(R.x=L?x.touches[0].clientX:x.clientX,R.y=L?x.touches[0].clientY:x.clientY,document.addEventListener(L?"touchmove":"mousemove",de,!0),document.addEventListener(L?"touchend":"mouseup",Q,!0)))}const de=Ok(x=>{ae.value=!0,$.x=L?x.touches[0].clientX:x.clientX,$.y=L?x.touches[0].clientY:x.clientY;const j=$.x-R.x,U=$.y-R.y;K.y=U,K.x=j},c.throttle);function Q(){const x=c.dir==="rtl"?-1:1,j=Math.sign(K.x)*.4,U=Math.round(K.x/l.value+j)*x;if(U&&!L){const M=W=>{window.removeEventListener("click",M,!0)};window.addEventListener("click",M,!0)}Z(f.value-U),K.x=0,K.y=0,ae.value=!1,document.removeEventListener(L?"touchmove":"mousemove",de,!0),document.removeEventListener(L?"touchend":"mouseup",Q,!0)}function q(){!c.autoplay||c.autoplay<=0||(b=setInterval(()=>{c.pauseAutoplayOnHover&&z.value||ue()},c.autoplay))}function he(){b&&(clearInterval(b),b=null),q()}const J=n.ref(!1);function Z(x){const j=c.wrapAround?x:Fo({val:x,max:g.value,min:y.value});f.value===j||J.value||(t("slide-start",{slidingToIndex:x,currentSlideIndex:f.value,prevSlideIndex:p.value,slidesCount:d.value}),J.value=!0,p.value=f.value,f.value=j,S=setTimeout(()=>{if(c.wrapAround){const U=Mo({val:j,max:g.value,min:0});U!==f.value&&(f.value=U,t("loop",{currentSlideIndex:f.value,slidingToIndex:x}))}t("update:modelValue",f.value),t("slide-end",{currentSlideIndex:f.value,prevSlideIndex:p.value,slidesCount:d.value}),J.value=!1,he()},c.transition))}function ue(){Z(f.value+c.itemsToScroll)}function ge(){Z(f.value-c.itemsToScroll)}const Ce={slideTo:Z,next:ue,prev:ge};n.provide("nav",Ce),n.provide("isSliding",J);const se=n.computed(()=>Pk({config:c,currentSlide:f.value,slidesCount:d.value}));n.provide("slidesToScroll",se);const Ee=n.computed(()=>{const x=c.dir==="rtl"?-1:1,j=se.value*l.value*x;return{transform:`translateX(${K.x-j}px)`,transition:`${J.value?c.transition:0}ms`,margin:c.wrapAround?`0 -${d.value*l.value}px`:"",width:"100%"}});function Te(){_(),C(),N(),E(),he()}Object.keys(Rh).forEach(x=>{["modelValue"].includes(x)||n.watch(()=>s[x],Te)}),n.watch(()=>s.modelValue,x=>{x!==f.value&&Z(Number(x))}),n.watch(d,N),t("before-init"),_();const Fe={config:c,slidesCount:d,slideWidth:l,next:ue,prev:ge,slideTo:Z,currentSlide:f,maxSlide:g,minSlide:y,middleSlide:m};a({updateBreakpointsConfigs:C,updateSlidesData:N,updateSlideWidth:E,initDefaultConfigs:_,restartCarousel:Te,slideTo:Z,next:ue,prev:ge,nav:Ce,data:Fe});const et=e.default||e.slides,it=e.addons,ot=n.reactive(Fe);return()=>{const x=Nh(et==null?void 0:et(ot)),j=(it==null?void 0:it(ot))||[];x.forEach((H,G)=>H.props.index=G);let U=x;if(c.wrapAround){const H=x.map((X,Y)=>n.cloneVNode(X,{index:-x.length+Y,isClone:!0,key:`clone-before-${Y}`})),G=x.map((X,Y)=>n.cloneVNode(X,{index:x.length+Y,isClone:!0,key:`clone-after-${Y}`}));U=[...H,...x,...G]}r.value=x,d.value=Math.max(x.length,1);const M=n.h("ol",{class:"carousel__track",style:Ee.value,onMousedownCapture:c.mouseDrag?ce:null,onTouchstartPassiveCapture:c.touchDrag?ce:null},U),W=n.h("div",{class:"carousel__viewport"},M);return n.h("section",{ref:o,class:{carousel:!0,"is-sliding":J.value,"is-dragging":ae.value,"is-hover":z.value,"carousel--rtl":c.dir==="rtl"},dir:c.dir,"aria-label":c.i18n.ariaGallery,tabindex:"0",onMouseenter:oe,onMouseleave:ie},[W,j,n.h($k)])}}}),$o;(function(s){s.arrowUp="arrowUp",s.arrowDown="arrowDown",s.arrowRight="arrowRight",s.arrowLeft="arrowLeft"})($o||($o={}));const Uk={arrowUp:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z",arrowRight:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z",arrowLeft:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"};function zk(s){return s in $o}const Vo=s=>{const e=n.inject("config",n.reactive(Object.assign({},je))),t=String(s.name),a=`icon${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!t||typeof t!="string"||!zk(t))return;const i=Uk[t],o=n.h("path",{d:i}),r=e.i18n[a]||s.title||t,l=n.h("title",r);return n.h("svg",{class:"carousel__icon",viewBox:"0 0 24 24",role:"img","aria-label":r},[l,o])};Vo.props={name:String,title:String};const Gk=(s,{slots:e,attrs:t})=>{const{next:a,prev:i}=e||{},o=n.inject("config",n.reactive(Object.assign({},je))),r=n.inject("maxSlide",n.ref(1)),l=n.inject("minSlide",n.ref(1)),d=n.inject("currentSlide",n.ref(1)),c=n.inject("nav",{}),{dir:h,wrapAround:u,i18n:f}=o,p=h==="rtl",m=n.h("button",{type:"button",class:["carousel__prev",!u&&d.value<=l.value&&"carousel__prev--disabled",t==null?void 0:t.class],"aria-label":f.ariaPreviousSlide,onClick:c.prev},(i==null?void 0:i())||n.h(Vo,{name:p?"arrowRight":"arrowLeft"})),g=n.h("button",{type:"button",class:["carousel__next",!u&&d.value>=r.value&&"carousel__next--disabled",t==null?void 0:t.class],"aria-label":f.ariaNextSlide,onClick:c.next},(a==null?void 0:a())||n.h(Vo,{name:p?"arrowLeft":"arrowRight"}));return[m,g]};var jk=n.defineComponent({name:"CarouselSlide",props:{index:{type:Number,default:1},isClone:{type:Boolean,default:!1}},setup(s,{slots:e}){const t=n.inject("config",n.reactive(Object.assign({},je))),a=n.inject("currentSlide",n.ref(0)),i=n.inject("slidesToScroll",n.ref(0)),o=n.inject("isSliding",n.ref(!1)),r=n.computed(()=>s.index===a.value),l=n.computed(()=>s.index===a.value-1),d=n.computed(()=>s.index===a.value+1),c=n.computed(()=>{const h=Math.floor(i.value),u=Math.ceil(i.value+t.itemsToShow-1);return s.index>=h&&s.index<=u});return()=>{var h;return n.h("li",{style:{width:`${100/t.itemsToShow}%`},class:{carousel__slide:!0,"carousel__slide--clone":s.isClone,"carousel__slide--visible":c.value,"carousel__slide--active":r.value,"carousel__slide--prev":l.value,"carousel__slide--next":d.value,"carousel__slide--sliding":o.value},"aria-hidden":!c.value},(h=e.default)===null||h===void 0?void 0:h.call(e,{isActive:r.value,isClone:s.isClone,isPrev:l.value,isNext:d.value,isSliding:o.value,isVisible:c.value}))}}});const Lt=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t},Hk={__name:"MatchDay",props:{isLandingMode:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#183143"},numberColor:{type:String,default:"white"},numberFontFamily:{type:String,default:"sans-serif"},numberFontSize:{type:String,default:"14px"},textColor:{type:String,default:"rgba(255, 255, 255, 0.5)"},textFontFamily:{type:String,default:"'Poppins-Regular', sans-serif"},textFontSize:{type:String,default:"8px"},bottomLineColor:{type:String,default:"#cbee6b"},selectedMatchDayBackgroundColor:{type:String,default:"#243b4c"},height:{type:String,default:"fit-content"},matchDay:{type:Object,default:()=>{}},matchDaySelected:{type:Object,default:()=>{}},componentWidth:{type:Number,default:0}},emits:["change-match-day"],setup(s,{emit:e}){const t=s,a=n.computed(()=>{const l={"background-color":t.backgroundColor,height:t.height};return t.matchDay.key===t.matchDaySelected.key&&(l["border-bottom"]=`solid 1px ${t.bottomLineColor}`,l["background-color"]=t.selectedMatchDayBackgroundColor),t.isLandingMode||(l["border-right"]="solid 1px rgba(255, 255, 255, 0.1)"),l}),i=n.computed(()=>({color:t.numberColor,"font-family":t.numberFontFamily,"font-size":t.numberFontSize})),o=n.computed(()=>({color:t.textColor,"font-family":t.textFontFamily,"font-size":t.textFontSize}));function r(l){e("click-match-day",l)}return(l,d)=>(n.openBlock(),n.createElementBlock("div",{class:"match-day",style:n.normalizeStyle({...a.value}),onClick:d[0]||(d[0]=c=>r(s.matchDay))},[n.createElementVNode("div",{class:"match-day__value",style:n.normalizeStyle(i.value)},n.toDisplayString(s.matchDay.valueText),5),Number.isNaN(s.matchDay.value)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:"match-day__text",style:n.normalizeStyle([s.isLandingMode?"margin-top:3px":"margin-top:4px",o.value])},n.toDisplayString(s.isLandingMode||s.componentWidth<=425?"JOR":"JORNADA"),5))],4))}},Wk=Lt(Hk,[["__scopeId","data-v-687d929a"]]),Kk={__name:"MatchDayPicker",props:{matchDays:{type:Array,default:()=>[]},isLandingMode:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#183143"},numberColor:{type:String,default:"white"},numberFontFamily:{type:String,default:"sans-serif"},numberFontSize:{type:String,default:"14px"},textColor:{type:String,default:"rgba(255, 255, 255, 0.5)"},textFontFamily:{type:String,default:"sans-serif"},textFontSize:{type:String,default:"8px"},bottomLineColor:{type:String,default:"#cbee6b"},selectedMatchDayBackgroundColor:{type:String,default:"#243b4c"},height:{type:String,default:"fit-content"},itemsToShow:{type:Number,default:9},itemsToScroll:{type:Number,default:9},defaultMatchDayKey:{type:[String,null],default:""},componentWidth:{type:Number,default:0},closestMatchDay:{type:[Number,String],default:0}},emits:["change-match-day"],setup(s,{emit:e}){const t=s;n.useCssVars(c=>({"26769adc":o.value,"2678c95c":r.value}));const a=n.ref(null),i=n.computed(()=>({itemsToShow:t.itemsToShow,itemsToScroll:t.itemsToScroll,snapAlign:"start"})),o=n.computed(()=>a.value.data.currentSlide.value==0?"none":"inline"),r=n.computed(()=>a.value.data.currentSlide.value==a.value.data.maxSlide.value?"none":"inline"),l=n.ref({});n.watch(()=>t.closestMatchDay,c=>{if(c){const h=t.matchDays.find(u=>u.key===c);d(h||t.matchDays[0],!0)}}),n.watch(()=>t.matchDays,c=>{if(!t.closestMatchDay&&c&&c.length){const h=c.find(u=>u.key===t.defaultMatchDayKey);l.value=h||c[0],e("change-match-day",l.value)}else t.closestMatchDay&&(l.value=c.find(h=>h.key===t.closestMatchDay)||{})},{immediate:!0});function d(c,h=!1){h&&a.value&&a.value.slideTo(c.index),l.value=c,e("change-match-day",l.value)}return(c,h)=>(n.openBlock(),n.createElementBlock("div",{class:"match-day-picker",style:n.normalizeStyle(s.isLandingMode?"border-top-left-radius: 9px; border-top-right-radius: 9px;":"margin-bottom:12px")},[n.createVNode(n.unref(Vk),n.mergeProps(i.value,{ref_key:"matchDayPickerCarousel",ref:a}),{addons:n.withCtx(()=>[n.createVNode(n.unref(Gk))]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.matchDays,u=>(n.openBlock(),n.createBlock(n.unref(jk),{key:u.key},{default:n.withCtx(()=>[n.createVNode(Wk,n.mergeProps(t,{"match-day":u,"match-day-selected":l.value,"is-landing-mode":s.isLandingMode,"component-width":s.componentWidth,onClickMatchDay:d}),null,16,["match-day","match-day-selected","is-landing-mode","component-width"])]),_:2},1024))),128))]),_:1},16)],4))}},qk=Lt(Kk,[["__scopeId","data-v-1621f164"]]);function Ns(s,e=80){return`${{}.TEAM_LOGOS_URL||"https://az755631.vo.msecnd.net/teams-"}${e}/${s}.png`}function Bh(s){if(typeof s=="string"){let e=s.replace("M","J ");return e=e.replace("PO1","CFI"),e=e.replace("PO2","CFV"),e=e.replace("PO3","SFI"),e=e.replace("PO4","SFV"),e=e.replace("PO5","FI"),e=e.replace("PO6","FV"),e}}function Yk(s){let e="";return s.game_status!=4&&(e+="Finalizado"),(s.penalties_score_home_team!=0||s.penalties_score_visiting_team!=0)&&(e+=" - Penales "+s.penalties_score_home_team+" - "+s.penalties_score_visiting_team),e}const Jk={class:"game-info__teams"},Xk={class:"game-info__teams__team__logo"},Zk=["src"],Qk={class:"game-info__teams__detail"},eE={key:0,class:"game-info__teams__detail__pre-game"},tE={class:"game-info__teams__team__logo away"},sE=["src"],aE={key:0},nE={key:0},iE={key:1},oE={__name:"GameInfo",props:{isLandingMode:{type:Boolean,default:!1},isAcronymVisible:{type:Boolean,default:!1},isTelevisionVisible:{type:Boolean,default:!0},game:{type:Object,required:!0},colorPrimary:{type:String,default:"white"},colorSecondary:{type:String,default:"grey"},namesFontSize:{type:String,default:"12px"},timeFontSize:{type:String,default:"12px"},timeZoneFontSize:{type:String,default:"8px"},scoreFontSize:{type:String,default:"13px"},namesFontFamily:{type:String,default:"sans-serif"},scoreFontFamily:{type:String,default:"sans-serif"},additionalInfoFontFamily:{type:String,default:"sans-serif"},additionalInfoFontSize:{type:String,default:"9px"}},setup(s){const e=s,t=n.computed(()=>{let c=e.game.schedule.split(":");return c.pop(),c=c.join(":"),c}),a=n.computed(()=>{let c="120px";return(e.isLandingMode||e.isAcronymVisible)&&(c="70px"),{"min-width":c}}),i=n.computed(()=>({"font-size":e.namesFontSize,"font-family":e.namesFontFamily,color:e.colorPrimary})),o=n.computed(()=>({"font-size":e.additionalInfoFontSize,"font-family":e.additionalInfoFontFamily,color:e.colorSecondary})),r=n.computed(()=>({"font-size":e.scoreFontSize,"font-family":e.scoreFontFamily,color:e.colorPrimary})),l=n.computed(()=>({"font-size":e.timeZoneFontSize,"font-family":e.namesFontFamily,color:e.colorPrimary})),d=n.computed(()=>({"font-size":e.timeFontSize,"font-family":e.namesFontFamily,color:e.colorPrimary}));return(c,h)=>(n.openBlock(),n.createElementBlock("div",{class:"game-info",style:n.normalizeStyle(s.isLandingMode?"gap:5px":"")},[n.createElementVNode("div",Jk,[n.createElementVNode("div",{class:"game-info__teams__team",style:n.normalizeStyle(a.value)},[n.createElementVNode("div",{class:"game-info__teams__team__name",style:n.normalizeStyle(i.value)},n.toDisplayString(s.isLandingMode||s.isAcronymVisible?s.game.home_team.acronym:s.game.home_team.colloquial_name),5),n.createElementVNode("div",Xk,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.home_team.team_id),alt:""},null,8,Zk)])],4),n.createElementVNode("div",Qk,[s.game.game_status===4&&!s.game.is_live?(n.openBlock(),n.createElementBlock("div",eE,[n.createElementVNode("div",null,[n.createElementVNode("span",{style:n.normalizeStyle(d.value)},n.toDisplayString(t.value),5),n.createTextVNode(),n.createElementVNode("span",{style:n.normalizeStyle(l.value)},"CST",4)])])):(n.openBlock(),n.createElementBlock("div",{key:1,class:"game-info__teams__detail__score",style:n.normalizeStyle(r.value)},[n.createElementVNode("span",null,n.toDisplayString(s.game.score[0])+" - "+n.toDisplayString(s.game.score[1]),1)],4))]),n.createElementVNode("div",{class:"game-info__teams__team away",style:n.normalizeStyle(a.value)},[n.createElementVNode("div",tE,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.visiting_team.team_id),alt:""},null,8,sE)]),n.createElementVNode("div",{class:"game-info__teams__team__name",style:n.normalizeStyle(i.value)},n.toDisplayString(s.isLandingMode||s.isAcronymVisible?s.game.visiting_team.acronym:s.game.visiting_team.colloquial_name),5)],4)]),n.createElementVNode("div",{class:"game-info__status",style:n.normalizeStyle([o.value,s.isLandingMode?"line-height: normal":""])},[s.game.game_status===4&&!s.game.is_live?(n.openBlock(),n.createElementBlock("span",aE,[s.isTelevisionVisible?(n.openBlock(),n.createElementBlock("span",nE,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)])):(n.openBlock(),n.createElementBlock("span",iE,n.toDisplayString(n.unref(Yk)(s.game)),1))],4)],4))}},Dh=Lt(oE,[["__scopeId","data-v-a6b3fc44"]]),Ph=s=>(n.pushScopeId("data-v-e2fc9ed0"),s=s(),n.popScopeId(),s),rE={class:"game-status"},lE={key:0,class:"game-status__day__live"},cE=Ph(()=>n.createElementVNode("span",null,"LIVE",-1)),dE=Ph(()=>n.createElementVNode("span",{class:"dot"},null,-1)),hE=[cE,dE],uE={key:0,class:"game-status__round"},mE={__name:"GameStatus",props:{isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},status:{type:Number,default:4},isLive:{type:Boolean,default:!1},dateTimeMillis:{type:Number,default:0},roundAbbreviation:{type:String,default:""},fontSize:{type:String,default:"10px"}},setup(s){const e=s,t=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],a=n.computed(()=>{let r="";if(e.dateTimeMillis){const l=new Date(e.dateTimeMillis);r=`${l.getDate()} ${t[l.getMonth()]}`}return r}),i=n.computed(()=>({"font-size":e.fontSize})),o=n.computed(()=>{let r=[];return e.isLive?r.push("live"):e.status!==1&&r.push("pre-match"),r});return(r,l)=>(n.openBlock(),n.createElementBlock("div",rE,[n.createElementVNode("div",{class:n.normalizeClass(["game-status__day",o.value]),style:n.normalizeStyle(i.value)},[s.isLive?(n.openBlock(),n.createElementBlock("div",lE,hE)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(a.value),1)],64))],6),s.isRoundMode?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",uE,n.toDisplayString(s.roundAbbreviation),1))]))}},Oh=Lt(mE,[["__scopeId","data-v-e2fc9ed0"]]),It={SHOW_GAME_EVENTS:"SHOW_GAME_EVENTS",PLAY_GOALS:"PLAY_GOALS",PLAY_RESUME:"PLAY_RESUME",NOTIFICATION:"NOTIFICATION",STATISTICS:"STATISTICS"},fE=s=>(n.pushScopeId("data-v-5711c5a6"),s=s(),n.popScopeId(),s),pE={class:"actions"},gE={class:"actions__row"},yE=fE(()=>n.createElementVNode("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.87471 3.35132C9.31653 3.35132 9.67471 3.70949 9.67471 4.15132V10.4531C9.67471 10.8949 9.31653 11.2531 8.87471 11.2531C8.43288 11.2531 8.07471 10.8949 8.07471 10.4531V4.15132C8.07471 3.70949 8.43288 3.35132 8.87471 3.35132Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.67549 0.199951C5.11732 0.199951 5.47549 0.558123 5.47549 0.999951V10.4526C5.47549 10.8944 5.11732 11.2526 4.67549 11.2526C4.23366 11.2526 3.87549 10.8944 3.87549 10.4526V0.999951C3.87549 0.558123 4.23366 0.199951 4.67549 0.199951Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.0002 5.45154C1.44202 5.45154 1.8002 5.80971 1.8002 6.25154V10.4527C1.8002 10.8945 1.44202 11.2527 1.0002 11.2527C0.558368 11.2527 0.200195 10.8945 0.200195 10.4527V6.25154C0.200195 5.80971 0.558368 5.45154 1.0002 5.45154Z",fill:"#EEEC6B"})],-1)),bE=[yE],SE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wE=["fill"],_E={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},kE=["fill"],EE={__name:"GameActionsLanding",props:{gameStatus:{type:Number,default:4},isLive:{type:Boolean,default:!1},hasVideo:{type:Boolean,default:!1},iconColor:{type:String,default:"#CBEE6B"},iconBackgroundColor:{type:String,default:"rgba(255, 255, 255, 0.2)"},iconBorderColor:{type:String,default:"rgba(255, 255, 255, 0.1)"},showPlayButton:{type:Boolean,default:!1}},emits:["action"],setup(s,{emit:e}){const t=s,a=n.computed(()=>({backgroundColor:t.iconBackgroundColor,borderColor:t.iconBorderColor}));function i(o){e("action",o)}return(o,r)=>(n.openBlock(),n.createElementBlock("div",pE,[n.createElementVNode("div",gE,[n.createElementVNode("div",{class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:r[0]||(r[0]=l=>i(n.unref(It).STATISTICS))},bE,4),s.showPlayButton&&s.hasVideo?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:r[1]||(r[1]=l=>i(n.unref(It).PLAY_RESUME))},[(n.openBlock(),n.createElementBlock("svg",SE,[n.createElementVNode("path",{d:"M0.442694 7.9474C0.385489 7.90953 0.337676 7.85295 0.304408 7.78375C0.27114 7.71456 0.25368 7.63538 0.253908 7.55475V0.444134C0.253987 0.363779 0.271562 0.284951 0.304765 0.216032C0.337968 0.147113 0.385557 0.090677 0.442475 0.0527243C0.499393 0.0147716 0.563511 -0.00327964 0.628014 0.000489552C0.692517 0.00425874 0.754994 0.0297075 0.808803 0.0741304L5.09491 3.62986C5.14387 3.67036 5.18401 3.7253 5.21178 3.78978C5.23955 3.85426 5.25409 3.92628 5.25409 3.99944C5.25409 4.0726 5.23955 4.14462 5.21178 4.2091C5.18401 4.27358 5.14387 4.32852 5.09491 4.36902L0.808803 7.92559C0.755077 7.97011 0.692648 7.99565 0.628173 7.99949C0.563698 8.00333 0.499593 7.98533 0.442694 7.9474Z",fill:t.iconColor},null,8,wE)]))],4)):n.createCommentVNode("",!0),s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:1,class:"actions__button",onClick:r[2]||(r[2]=l=>i(n.unref(It).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",_E,[n.createElementVNode("path",{d:"M5.056 14.476h2.888c0 .838-.65 1.524-1.444 1.524-.794 0-1.444-.686-1.444-1.524zM13 12.952v.762H0v-.762l1.444-1.523V6.857c0-2.362 1.445-4.419 3.612-5.105v-.228C5.056.686 5.706 0 6.5 0c.794 0 1.444.686 1.444 1.524v.228c2.167.686 3.612 2.743 3.612 5.105v4.572L13 12.952zm-2.889-6.095c0-2.133-1.589-3.81-3.611-3.81-2.022 0-3.611 1.677-3.611 3.81v5.333h7.222V6.857z",fill:t.iconColor},null,8,kE)]))])):n.createCommentVNode("",!0)])]))}},TE=Lt(EE,[["__scopeId","data-v-5711c5a6"]]),Uo=s=>(n.pushScopeId("data-v-d64f8667"),s=s(),n.popScopeId(),s),CE={class:"actions"},xE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},vE=["fill"],AE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},LE=["fill"],IE=Uo(()=>n.createElementVNode("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.87471 3.35132C9.31653 3.35132 9.67471 3.70949 9.67471 4.15132V10.4531C9.67471 10.8949 9.31653 11.2531 8.87471 11.2531C8.43288 11.2531 8.07471 10.8949 8.07471 10.4531V4.15132C8.07471 3.70949 8.43288 3.35132 8.87471 3.35132Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.67549 0.199951C5.11732 0.199951 5.47549 0.558123 5.47549 0.999951V10.4526C5.47549 10.8944 5.11732 11.2526 4.67549 11.2526C4.23366 11.2526 3.87549 10.8944 3.87549 10.4526V0.999951C3.87549 0.558123 4.23366 0.199951 4.67549 0.199951Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.0002 5.45154C1.44202 5.45154 1.8002 5.80971 1.8002 6.25154V10.4527C1.8002 10.8945 1.44202 11.2527 1.0002 11.2527C0.558368 11.2527 0.200195 10.8945 0.200195 10.4527V6.25154C0.200195 5.80971 0.558368 5.45154 1.0002 5.45154Z",fill:"#EEEC6B"})],-1)),RE=[IE],NE={key:0,class:"actions__videos"},BE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},DE=["fill"],PE={key:1,class:"actions__videos__thumbnails"},OE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__goals"},null,-1)),FE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__summary"},null,-1)),ME={height:24,width:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},$E=["stroke"],VE={__name:"GameActionsFull",props:{gameStatus:{type:Number,default:4},isLive:{type:Boolean,default:!1},hasVideo:{type:Boolean,default:!1},hasActions:{type:Boolean,default:!0},hasGoals:{type:Boolean,default:!0},areEventsVisible:{type:Boolean,default:!1},iconColor:{type:String,default:"#CBEE6B"},iconBackgroundColor:{type:String,default:"rgba(255, 255, 255, 0.2)"},iconBorderColor:{type:String,default:"rgba(255, 255, 255, 0.1)"},showPlayButton:{type:Boolean,default:!1},arrowColor:{type:String,default:"white"},thumbnailFontFamily:{type:String,default:"sans-serif"},thumbnailFontSize:{type:String,default:"8px"},thumbnailColor:{type:String,default:"rgba(255, 255, 255, 0.5)"},componentWidth:{type:Number,default:400,validator(s){return s>0}}},emits:["action"],setup(s,{emit:e}){const t=s,a=n.computed(()=>({backgroundColor:t.iconBackgroundColor,borderColor:t.iconBorderColor})),i=n.computed(()=>{const d=[];return t.componentWidth<540&&d.push("mobile"),d}),o=n.computed(()=>t.componentWidth>730),r=n.computed(()=>({color:t.thumbnailColor,fontFamily:t.thumbnailFontFamily,fontSize:t.thumbnailFontSize}));function l(d){e("action",d)}return(d,c)=>(n.openBlock(),n.createElementBlock("div",CE,[n.createElementVNode("div",{class:n.normalizeClass(["actions__buttons",i.value])},[s.gameStatus===4444&&!s.isLive&&!o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button",onClick:c[0]||(c[0]=h=>l(n.unref(It).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",xE,[n.createElementVNode("path",{d:"M5.056 14.476h2.888c0 .838-.65 1.524-1.444 1.524-.794 0-1.444-.686-1.444-1.524zM13 12.952v.762H0v-.762l1.444-1.523V6.857c0-2.362 1.445-4.419 3.612-5.105v-.228C5.056.686 5.706 0 6.5 0c.794 0 1.444.686 1.444 1.524v.228c2.167.686 3.612 2.743 3.612 5.105v4.572L13 12.952zm-2.889-6.095c0-2.133-1.589-3.81-3.611-3.81-2.022 0-3.611 1.677-3.611 3.81v5.333h7.222V6.857z",fill:t.iconColor},null,8,vE)]))])):n.createCommentVNode("",!0),s.showPlayButton&&s.hasVideo&&!o.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:c[1]||(c[1]=h=>l(n.unref(It).PLAY_RESUME))},[(n.openBlock(),n.createElementBlock("svg",AE,[n.createElementVNode("path",{d:"M0.442694 7.9474C0.385489 7.90953 0.337676 7.85295 0.304408 7.78375C0.27114 7.71456 0.25368 7.63538 0.253908 7.55475V0.444134C0.253987 0.363779 0.271562 0.284951 0.304765 0.216032C0.337968 0.147113 0.385557 0.090677 0.442475 0.0527243C0.499393 0.0147716 0.563511 -0.00327964 0.628014 0.000489552C0.692517 0.00425874 0.754994 0.0297075 0.808803 0.0741304L5.09491 3.62986C5.14387 3.67036 5.18401 3.7253 5.21178 3.78978C5.23955 3.85426 5.25409 3.92628 5.25409 3.99944C5.25409 4.0726 5.23955 4.14462 5.21178 4.2091C5.18401 4.27358 5.14387 4.32852 5.09491 4.36902L0.808803 7.92559C0.755077 7.97011 0.692648 7.99565 0.628173 7.99949C0.563698 8.00333 0.499593 7.98533 0.442694 7.9474Z",fill:t.iconColor},null,8,LE)]))],4)):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:c[2]||(c[2]=h=>l(n.unref(It).STATISTICS))},RE,4)],2),o.value?(n.openBlock(),n.createElementBlock("div",NE,[s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button",onClick:c[3]||(c[3]=h=>l(n.unref(It).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",BE,[n.createElementVNode("path",{d:"M5.056 14.476h2.888c0 .838-.65 1.524-1.444 1.524-.794 0-1.444-.686-1.444-1.524zM13 12.952v.762H0v-.762l1.444-1.523V6.857c0-2.362 1.445-4.419 3.612-5.105v-.228C5.056.686 5.706 0 6.5 0c.794 0 1.444.686 1.444 1.524v.228c2.167.686 3.612 2.743 3.612 5.105v4.572L13 12.952zm-2.889-6.095c0-2.133-1.589-3.81-3.611-3.81-2.022 0-3.611 1.677-3.611 3.81v5.333h7.222V6.857z",fill:t.iconColor},null,8,DE)]))])):n.createCommentVNode("",!0),s.showPlayButton&&s.hasVideo?(n.openBlock(),n.createElementBlock("div",PE,[s.hasGoals?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__videos__thumbnails__thumbnail",onClick:c[4]||(c[4]=h=>l(n.unref(It).PLAY_GOALS))},[OE,n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__text",style:n.normalizeStyle(r.value)}," Goles ",4)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail",onClick:c[5]||(c[5]=h=>l(n.unref(It).PLAY_RESUME))},[FE,n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__text",style:n.normalizeStyle(r.value)}," Resumen ",4)])])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),(s.gameStatus!==4||s.isLive)&&s.hasActions?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["actions__button expand",{"rotated-180":s.areEventsVisible,mobile:s.componentWidth<540}]),onClick:c[6]||(c[6]=h=>l(n.unref(It).SHOW_GAME_EVENTS))},[(n.openBlock(),n.createElementBlock("svg",ME,[n.createElementVNode("path",{d:"M18.394 9.13501L13.1302 14.3988C12.5086 15.0204 11.4914 15.0204 10.8697 14.3988L5.60596 9.13501",stroke:s.arrowColor},null,8,$E)]))],2)):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["actions__button expand",{"rotated-180":!1,mobile:s.componentWidth<540}])},null,2))]))}},UE=Lt(VE,[["__scopeId","data-v-d64f8667"]]),cn=s=>(n.pushScopeId("data-v-2968a2f6"),s=s(),n.popScopeId(),s),zE={class:"row-landing__game-status"},GE={class:"row-landing__game-actions"},jE={class:"row-full__game-status"},HE={class:"row-full__game-info"},WE={key:0},KE={class:"row-full__game-actions"},qE={class:"game-events-container"},YE=cn(()=>n.createElementVNode("div",{class:"separator"},null,-1)),JE=cn(()=>n.createElementVNode("div",null,null,-1)),XE={class:"game-events__data"},ZE={class:"game-events__data__team"},QE=["src"],eT={class:"game-events__data__team__event__text"},tT={class:"game-events__data__team away"},sT={class:"game-events__data__team__event__text"},aT=["src"],nT=cn(()=>n.createElementVNode("div",null,null,-1)),iT=cn(()=>n.createElementVNode("div",null,null,-1)),oT={__name:"CalendarRow",props:{teamId:{type:Number,default:0},showVideos:{type:Number,default:0},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},game:{type:Object,required:!0},height:{type:String,default:"fit-content"},backgroundColor:{type:String,default:"#172531"},showPlayButton:{type:Boolean,default:!1},componentWidth:{type:Number,default:400,validator(s){return s>0}},televisionFontSize:{type:String,default:"12px"},televisionFontFamily:{type:String,default:"sans-serif"},televisionColor:{type:String,default:"rgba(255, 255, 255, 0.5)"}},emits:["action"],setup(s,{emit:e}){const t=s,a={GOAL:{}.GAME_EVENTS_ICONS_GOAL||"/icn-gol.svg",RED_CARD:{}.GAME_EVENTS_ICONS_RED_CARD||"/icn-expulsion.svg",YELLOW_CARD:{}.GAME_EVENTS_ICONS_YELLOW_CARD||"/icn-amarilla.svg"},i=n.ref(!1),o=n.ref(!1),r=n.computed(()=>{const y={homeTeam:[],awayTeam:[]};return t.game&&t.game.game_status!==4&&!t.game.is_live&&t.game.minutes&&(y.homeTeam.push(...m(t.game.minutes.home_goals_minutes,a.GOAL)),y.homeTeam.push(...m(t.game.minutes.home_red_cards_minutes,a.RED_CARD)),y.homeTeam.push(...m(t.game.minutes.home_yellow_cards_minutes,a.YELLOW_CARD)),y.awayTeam.push(...m(t.game.minutes.visiting_goals_minutes,a.GOAL)),y.awayTeam.push(...m(t.game.minutes.away_red_cards_minutes,a.RED_CARD)),y.awayTeam.push(...m(t.game.minutes.away_yellow_cards_minutes,a.YELLOW_CARD))),y}),l=n.computed(()=>{const y=r.value.homeTeam.length,b=r.value.awayTeam.length;return y+b>0}),d=n.computed(()=>{const y=t.game.score[0],b=t.game.score[1];return y>0||b>0}),c=n.computed(()=>({"background-color":t.backgroundColor})),h=n.computed(()=>({height:t.height})),u=n.computed(()=>{const y={game:[],events:[]};return t.componentWidth<500?(y.events.push("break-point-3"),y.game.push("break-point-2")):t.componentWidth<730?(y.game.push("break-point-2"),y.events.push("break-point-2")):t.componentWidth<910&&(y.game.push("break-point-1"),y.events.push("break-point-1")),y}),f=n.computed(()=>({isLandingMode:t.isLandingMode,game:t.game,colorPrimary:"#fff",colorSecondary:"#fff",namesFontSize:"12px",timeFontSize:"12px",timeZoneFontSize:"8px",scoreFontSize:"13px",namesFontFamily:"sans-serif",scoreFontFamily:"sans-serif",additionalInfoFontFamily:"sans-serif",additionalInfoFontSize:"9px"})),p=n.computed(()=>({"font-size":t.televisionFontSize,"font-family":t.televisionFontFamily,color:t.televisionColor}));n.watch(()=>t.componentWidth,y=>{o.value=y<910});function m(y,b){return y.map(S=>({iconUrl:b,text:S}))}function g(y){y===It.SHOW_GAME_EVENTS?i.value=!i.value:e("action",{action:y,game:t.game})}return(y,b)=>s.isLandingMode?(n.openBlock(),n.createElementBlock("div",{key:0,class:"row-landing",style:n.normalizeStyle(c.value)},[n.createVNode(Dh,{game:s.game,"is-landing-mode":s.isLandingMode},null,8,["game","is-landing-mode"]),n.createElementVNode("div",zE,[n.createVNode(Oh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Bh)(s.game.matchday_abbreviation),"is-landing-mode":s.isLandingMode,"is-round-mode":s.isRoundMode,"font-size":"10px"},null,8,["status","is-live","date-time-millis","round-abbreviation","is-landing-mode","is-round-mode"])]),n.createElementVNode("div",GE,[s.game.home_team?(n.openBlock(),n.createBlock(TE,{key:0,"is-live":!!s.game.is_live,"has-video":s.showVideos==0||s.showVideos==1&&s.teamId==s.game.home_team.team_id?!!s.game.has_video:!1,"game-status":s.game.game_status,"show-play-button":!0,onAction:g},null,8,["is-live","has-video","game-status"])):n.createCommentVNode("",!0)])],4)):(n.openBlock(),n.createElementBlock("div",{key:1,class:"row-full-container",style:n.normalizeStyle(c.value)},[n.createElementVNode("div",{class:n.normalizeClass(["row-full",u.value.game]),style:n.normalizeStyle(h.value)},[n.createElementVNode("div",jE,[n.createVNode(Oh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Bh)(s.game.matchday_abbreviation),"is-landing-mode":s.isLandingMode,"is-round-mode":s.isRoundMode,"font-size":"10px"},null,8,["status","is-live","date-time-millis","round-abbreviation","is-landing-mode","is-round-mode"])]),n.createElementVNode("div",HE,[n.createVNode(Dh,n.mergeProps(f.value,{"is-television-visible":o.value,game:s.game,"is-landing-mode":s.isLandingMode,"is-acronym-visible":s.componentWidth<540}),null,16,["is-television-visible","game","is-landing-mode","is-acronym-visible"])]),s.componentWidth>=910?(n.openBlock(),n.createElementBlock("div",{key:0,class:"row-full__television",style:n.normalizeStyle(p.value)},[!o.value&&(s.game.game_status===4||s.game.is_live)?(n.openBlock(),n.createElementBlock("span",WE,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0),n.createElementVNode("div",KE,[s.game.home_team?(n.openBlock(),n.createBlock(UE,{key:0,"is-live":!!s.game.is_live,"has-video":s.showVideos==0||s.showVideos==1&&s.teamId==s.game.home_team.team_id?!!s.game.has_video:!1,"has-actions":l.value,"has-goals":s.showVideos==0||s.showVideos==1&&s.teamId==s.game.home_team.team_id?d.value:!1,"game-status":s.game.game_status,"show-play-button":!0,"are-events-visible":i.value,"component-width":s.componentWidth,onAction:g},null,8,["is-live","has-video","has-actions","has-goals","game-status","are-events-visible","component-width"])):n.createCommentVNode("",!0)])],6),n.createVNode(n.Transition,null,{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",qE,[YE,n.createElementVNode("div",{class:n.normalizeClass(["game-events",u.value.events])},[JE,n.createElementVNode("div",XE,[n.createElementVNode("div",ZE,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.homeTeam,(S,_)=>(n.openBlock(),n.createElementBlock("div",{key:`h${_}`,class:"game-events__data__team__event"},[n.createElementVNode("img",{src:S.iconUrl},null,8,QE),n.createElementVNode("div",eT,n.toDisplayString(S.text),1)]))),128))]),n.createElementVNode("div",tT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.awayTeam,(S,_)=>(n.openBlock(),n.createElementBlock("div",{key:`a${_}`,class:"game-events__data__team__event"},[n.createElementVNode("div",sT,n.toDisplayString(S.text),1),n.createElementVNode("img",{src:S.iconUrl},null,8,aT)]))),128))])]),nT,iT],2)],512),[[n.vShow,i.value]])]),_:1})],4))}},Fh=Lt(oT,[["__scopeId","data-v-2968a2f6"]]),rT={class:"calendar-table"},lT={__name:"CalendarTable",props:{teamId:{type:Number,default:0},showVideos:{type:Number,default:0},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},gamesPerPage:{type:Array,default:()=>[]},rowHeight:{type:String,default:"fit-content"},oddRowColor:{type:String,default:"#172531"},evenRowColor:{type:String,default:"#0D1D29"},componentWidth:{type:Number,default:400,validator(s){return s>0}}},emits:["action"],setup(s,{emit:e}){const t=s;function a(o){return o%2===0?t.evenRowColor:t.oddRowColor}function i(o){e("action",o)}return(o,r)=>(n.openBlock(),n.createElementBlock("div",rT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.gamesPerPage,(l,d)=>(n.openBlock(),n.createBlock(Fh,{key:l.game_id,game:l,"team-id":s.teamId,"show-videos":s.showVideos,"is-landing-mode":s.isLandingMode,height:s.rowHeight,"background-color":a(d),"component-width":s.componentWidth,"is-round-mode":s.isRoundMode,onAction:i},null,8,["game","team-id","show-videos","is-landing-mode","height","background-color","component-width","is-round-mode"]))),128))]))}},cT=Lt(lT,[["__scopeId","data-v-c7bf1232"]]),dT={class:"calendar-by-team"},hT={class:"playing-as-picker"},uT={class:"calendar-by-team__page"},mT={__name:"CalendarTableByTeam",props:{showVideos:{type:Number,default:0},teamId:{type:Number,default:0},isPaginationVisible:{type:Boolean,default:!0},gamesPages:{type:Map,default:()=>new Map},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},rowHeight:{type:String,default:"fit-content"},nameRowColor:{type:String,default:"#172531"},gameRowColor:{type:String,default:"#0D1D29"},componentWidth:{type:Number,default:400,validator(s){return s>0}}},emits:["action"],setup(s,{emit:e}){const t=s,a=n.ref(0),i=n.computed(()=>{let d=[];if(t.gamesPages.size>0){const c=Array.from(t.gamesPages.entries()).reduce((h,[u,f])=>{const p=Number(u),m=Number.isNaN(p)?u:`Jornada ${p<10?"0":""}${p}`,g=f.reduce((y,b)=>(y.push(...b),y),[]).filter(y=>a.value===0||a.value===1&&y.visiting_team.team_id===t.teamId?!0:a.value===2&&y.home_team.team_id===t.teamId);return g.length>0&&h.push({roundName:m,games:g}),h},[]);d.push(c)}return d});function o(d){e("action",d)}function r(d){document.querySelector("#opc0").classList.remove("selected"),document.querySelector("#opc1").classList.remove("selected"),document.querySelector("#opc2").classList.remove("selected"),a.value=d,document.querySelector("#opc"+d).classList.add("selected")}function l(d){let c=d;switch(d){case"PI1":c="Play In 1";break;case"PI2":c="Play In 2";break;case"R1":c="Repechaje";break;case"CFI":c="Cuartos de final - Ida";break;case"CFV":c="Cuartos de final - Vuelta";break;case"SFI":c="Semifinal - Ida";break;case"SFV":c="Semifinal - Vuelta";break;case"FI":c="Final - Ida";break;case"FV":c="Final - Vuelta";break}return c}return(d,c)=>(n.openBlock(),n.createElementBlock("div",dT,[n.createElementVNode("div",hT,[n.createElementVNode("div",{class:"playing-as-picker__type selected",id:"opc0",onClick:c[0]||(c[0]=h=>r(0))}," Todas "),n.createElementVNode("div",{class:"playing-as-picker__type",id:"opc1",onClick:c[1]||(c[1]=h=>r(1))},"Visitante"),n.createElementVNode("div",{class:"playing-as-picker__type",id:"opc2",onClick:c[2]||(c[2]=h=>r(2))},"Local")]),n.createVNode(n.unref(Ih),{"is-pagination-visible":s.isPaginationVisible,items:i.value},{default:n.withCtx(({item:h})=>[n.createElementVNode("div",uT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h,(u,f)=>(n.openBlock(),n.createElementBlock("div",{key:f,class:"calendar-by-team__page__round"},[n.createElementVNode("div",{class:"calendar-by-team__page__round__round-name",style:n.normalizeStyle([{color:"white"},s.componentWidth<=425?"padding: 5px 10px":""])},n.toDisplayString(l(u.roundName)),5),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.games,p=>(n.openBlock(),n.createBlock(Fh,{key:p.game_id,game:p,"team-id":s.teamId,"show-videos":s.showVideos,"is-landing-mode":s.isLandingMode,height:s.rowHeight,"background-color":s.gameRowColor,"component-width":s.componentWidth,"is-round-mode":s.isRoundMode,onAction:o},null,8,["game","team-id","show-videos","is-landing-mode","height","background-color","component-width","is-round-mode"]))),128))]))),128))])]),_:1},8,["is-pagination-visible","items"])]))}},fT=Lt(mT,[["__scopeId","data-v-6e0e406c"]]),pT="_liveMinutes_1utnm_2",gT="_viewButtomEvent_1utnm_6",yT="_containerEvents_1utnm_20",bT="_sepEvents_1utnm_26",ST="_goalsContainer_1utnm_36",wT="_yellowContainer_1utnm_44",_T="_redContainer_1utnm_52",kT="_containerEventsGameHometeam_1utnm_60",ET="_containerEventsGameAwayteam_1utnm_73",TT="_image62Icon_1utnm_86",CT="_imgChivasIcon_1utnm_95",xT="_nameDesktop_1utnm_102",vT="_nameMobile_1utnm_115",AT="_homeTeam_1utnm_127",LT="_sbado16De_1utnm_138",IT="_gameDate_1utnm_147",RT="_sab16092023_1utnm_151",NT="_div_1utnm_164",BT="_divscore_1utnm_173",DT="_cst_1utnm_183",PT="_hour_1utnm_192",OT="_score_1utnm_193",FT="_chivasTvCanal_1utnm_204",MT="_gameStatus_1utnm_216",$T="_matchInfo_1utnm_227",VT="_image62Icon1_1utnm_241",UT="_name_1utnm_102",zT="_imgAtlasIcon_1utnm_263",GT="_name1_1utnm_270",jT="_awayTeam_1utnm_282",HT="_matchCard_1utnm_293",WT={liveMinutes:pT,viewButtomEvent:gT,containerEvents:yT,sepEvents:bT,goalsContainer:ST,yellowContainer:wT,redContainer:_T,containerEventsGameHometeam:kT,containerEventsGameAwayteam:ET,image62Icon:TT,imgChivasIcon:CT,nameDesktop:xT,nameMobile:vT,homeTeam:AT,sbado16De:LT,gameDate:IT,sab16092023:RT,div:NT,divscore:BT,cst:DT,hour:PT,score:OT,chivasTvCanal:FT,gameStatus:MT,matchInfo:$T,image62Icon1:VT,name:UT,imgAtlasIcon:zT,name1:GT,awayTeam:jT,matchCard:HT},KT=["src"],qT=["src"],YT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),JT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),XT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),ZT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),QT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),eC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),tC=n.createElementVNode("img",{src:"http://golstatsimages.blob.core.windows.net/todoelfut/point-indicador-live.png"},null,-1),sC={key:0},aC=n.createElementVNode("div",null,"ver eventos",-1),nC=n.createElementVNode("img",{width:"13",style:{"margin-top":"1px"},src:"http://golstatsimages.blob.core.windows.net/todoelfut/arrow-live-down.png"},null,-1),iC=["src"],oC=["src"],rC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},lC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},cC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},dC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),hC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),uC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),mC={__name:"CardPreMatch",props:{game:{type:Object,default:()=>{}},playsLive:{type:Object,default:()=>{}},is_captured:{type:Number,default:1},infoLive:{type:Object,default:()=>{}}},emits:["open-modal-event"],setup(s,{emit:e}){const t=s,a=new Map([[1,45],[2,90],[3,105],[4,120]]),i=n.computed(()=>{const h=a.get(t.infoLive.recent_lapse);return h&&h<t.infoLive.minute?`${h}' + ${t.infoLive.minute-h}'`:`${t.infoLive.minute}'`}),o=n.computed(()=>{let h=0,u=0,f=!1;var p=!1;return Object.keys(t.infoLive).includes("score")&&(t.infoLive.score["own_"+t.game.home_team.team_id]!=null&&t.infoLive.score["own_"+t.game.home_team.team_id]!=0&&(p=!0),t.infoLive.score["own_"+t.game.visiting_team.team_id]!=null&&t.infoLive.score["own_"+t.game.visiting_team.team_id]!=0&&(f=!0),f?t.infoLive.score[t.game.home_team.team_id]!=null&&(h=parseInt(t.infoLive.score[t.game.home_team.team_id])+parseInt(t.infoLive.score["own_"+t.game.visiting_team.team_id])):t.infoLive.score[t.game.home_team.team_id]!=null&&(h=parseInt(t.infoLive.score[t.game.home_team.team_id])),p?t.infoLive.score[t.game.visiting_team.team_id]!=null&&(u=parseInt(t.infoLive.score[t.game.visiting_team.team_id])+parseInt(t.infoLive.score["own_"+t.game.home_team.team_id])):t.infoLive.score[t.game.visiting_team.team_id]!=null&&(u=parseInt(t.infoLive.score[t.game.visiting_team.team_id]))),h+" - "+u}),r=n.computed(()=>{const h={...t.game};return h.gameSchedule=t.game.schedule.split(":"),h.gameSchedule.pop(),h.gameSchedule=h.gameSchedule.join(":"),h});function l(h){let u=h.split(" "),f=u[u.length-2];return f.includes("+")?u[u.length-3]+"+"+u[u.length-1]:(f=u[u.length-1],f)}function d(h){e("open-modal-event",h)}function c(h,u){const f=new Date(h);if(u==1){const p=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],m=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];return`${p[f.getDay()]} ${f.getDate()} de ${m[f.getMonth()]}`}else return`${f.getDate()}-${f.getMonth()+1}-${f.getFullYear()}`}return(h,u)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(h.$style.matchCard)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.homeTeam),id:"container-home-team"},[n.createElementVNode("img",{class:n.normalizeClass(h.$style.image62Icon),alt:"",src:n.unref(Ns)(r.value.home_team.team_id,150)},null,10,KT),n.createElementVNode("img",{class:n.normalizeClass(h.$style.imgChivasIcon),alt:"",src:n.unref(Ns)(r.value.home_team.team_id)},null,10,qT),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.nameDesktop),id:"team-name"},n.toDisplayString(r.value.home_team.colloquial_name),3),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.nameMobile),id:"team-name"},n.toDisplayString(r.value.home_team.acronym),3),r.value.game_status==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[r.value.is_live==0&&r.value.game_status==1||Object.keys(r.value.minutes).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameHometeam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[r.value.minutes.home_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[YT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.home_goals_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f).replace("(AG)","")),1),p!=r.value.minutes.home_goals_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.home_red_cards_minutes.length>0&&r.value.minutes.home_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.home_red_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(h.$style.yellowContainer)},[JT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.home_red_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f)),1),p!=r.value.minutes.home_red_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.home_red_cards_minutes.length>0||r.value.minutes.home_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.home_yellow_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:4,class:n.normalizeClass(h.$style.redContainer)},[XT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.home_yellow_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f)),1),p!=r.value.minutes.home_yellow_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[r.value.is_live==1&&r.value.game_status!=1||r.value.game_status==0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameHometeam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[Object.keys(s.playsLive).length>0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[s.playsLive[s.game.home_team.team_id]&&"goals"in s.playsLive[s.game.home_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[Object.keys(s.playsLive[s.game.home_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[ZT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.home_team.team_id].goals),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.home_team.team_id].goals[f].event.map(m=>`${m}'`).join(", ").replace("(AG)","")),1),p!=Object.keys(s.playsLive[s.game.home_team.team_id].goals).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.home_team.team_id]&&"red"in s.playsLive[s.game.home_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[Object.keys(s.playsLive[s.game.home_team.team_id].red).length>0&&Object.keys(s.playsLive[s.game.home_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.home_team.team_id].red).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.yellowContainer)},[QT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.home_team.team_id].red),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.home_team.team_id].red[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.home_team.team_id].red).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.home_team.team_id]&&"yellow"in s.playsLive[s.game.home_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[Object.keys(s.playsLive[s.game.home_team.team_id].red).length>0||Object.keys(s.playsLive[s.game.home_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.home_team.team_id].yellow).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.redContainer)},[eC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.home_team.team_id].yellow),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.home_team.team_id].yellow[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.home_team.team_id].yellow).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64))],2),r.value.game_status==4&&r.value.is_live==0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.matchInfo),id:"container-match-info"},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.sbado16De)},n.toDisplayString(c(r.value.date_time_utc,1)),3),n.createElementVNode("div",{class:n.normalizeClass(h.$style.sab16092023)},n.toDisplayString(c(r.value.date_time_utc,0)),3),n.createElementVNode("div",{class:n.normalizeClass(h.$style.hour)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.div)},n.toDisplayString(r.value.gameSchedule),3),n.createElementVNode("div",{class:n.normalizeClass(h.$style.cst)},"CST",2)],2),n.createElementVNode("div",{class:n.normalizeClass(h.$style.chivasTvCanal)},n.toDisplayString(r.value.tv_stations.join(", ")),3)],2)):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.matchInfo),id:"container-match-info"},[r.value.is_live?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(c(r.value.date_time_utc,1)),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",{class:n.normalizeClass([h.$style.sbado16De,h.$style.gameDate])},n.toDisplayString(c(r.value.date_time_utc,1)),3),n.createElementVNode("div",{class:n.normalizeClass([h.$style.sab16092023,h.$style.gameDate])},n.toDisplayString(c(r.value.date_time_utc,0)),3)],64)),r.value.is_live?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(h.$style.score)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.divscore)},n.toDisplayString(o.value),3)],2)):(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(h.$style.score)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.divscore)},n.toDisplayString(r.value.score.join(" - ")),3)],2)),n.createElementVNode("div",{class:n.normalizeClass(h.$style.gameStatus)},[r.value.is_live?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.liveMinutes)},[tC,n.createTextVNode(" LIVE - "+n.toDisplayString(i.value)+"' ",1)],2)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(" Finalizado "),r.value.penalties_score_home_team!=0||r.value.penalties_score_visiting_team!=0?(n.openBlock(),n.createElementBlock("span",sC," - Penales "+n.toDisplayString(r.value.penalties_score_home_team)+" - "+n.toDisplayString(r.value.penalties_score_visiting_team),1)):n.createCommentVNode("",!0)],64))],2),s.is_captured==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:4},[r.value.is_live==1||r.value.game_status==1||Object.keys(r.value.minutes).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.viewButtomEvent),onClick:u[0]||(u[0]=f=>d(r.value))},[aC,n.createTextVNode(" "),nC],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],2)),n.createElementVNode("div",{class:n.normalizeClass(h.$style.awayTeam),id:"container-away-team"},[n.createElementVNode("img",{class:n.normalizeClass(h.$style.image62Icon1),alt:"",src:n.unref(Ns)(r.value.visiting_team.team_id,150)},null,10,iC),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.name),id:"team-name"},n.toDisplayString(r.value.visiting_team.colloquial_name),3),n.createElementVNode("img",{class:n.normalizeClass(h.$style.imgAtlasIcon),alt:"",src:n.unref(Ns)(r.value.visiting_team.team_id)},null,10,oC),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.name1),id:"team-name"},n.toDisplayString(r.value.visiting_team.acronym),3),r.value.game_status==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[r.value.is_live==0&&r.value.game_status==1||Object.keys(r.value.minutes).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameAwayteam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("img",rC)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.visiting_goals_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f).replace("(AG)","")),1),p!=r.value.minutes.visiting_goals_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.away_red_cards_minutes.length>0&&r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.away_red_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(h.$style.yellowContainer)},[r.value.minutes.away_red_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("img",lC)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.away_red_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f)),1),p!=r.value.minutes.away_red_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.away_red_cards_minutes.length>0||r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.away_yellow_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:4,class:n.normalizeClass(h.$style.redContainer)},[r.value.minutes.away_yellow_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("img",cC)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.away_yellow_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f))+"'",1),p!=r.value.minutes.away_yellow_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[r.value.is_live==1&&r.value.game_status!=1||r.value.game_status==0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameAwayteam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[Object.keys(s.playsLive).length>0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[s.playsLive[s.game.visiting_team.team_id]&&"goals"in s.playsLive[s.game.visiting_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[dC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.visiting_team.team_id].goals),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.visiting_team.team_id].goals[f].event.map(m=>`${m}'`).join(", ").replace("(AG)","")),1),p!=Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.visiting_team.team_id]&&"red"in s.playsLive[s.game.visiting_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length>0&&Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.yellowContainer)},[hC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.visiting_team.team_id].red),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.visiting_team.team_id].red[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.visiting_team.team_id]&&"yellow"in s.playsLive[s.game.visiting_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length>0||Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.visiting_team.team_id].yellow).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.redContainer)},[uC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.visiting_team.team_id].yellow),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.visiting_team.team_id].yellow[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.visiting_team.team_id].yellow).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64))],2)],2))}},fC={$style:WT},pC=Lt(mC,[["__cssModules",fC]]),gC={class:"calendar-by-game__carousel"},yC="https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",bC={__name:"GSC-CalendarByGame",props:{showVideos:{type:Number,default:0},playsLive:{type:Object,default:()=>{}},infoLive:{type:Object,default:()=>{}},height:{type:String,default:"fit-content"},width:{type:String,default:"100%"},rowHeight:{type:String,default:"fit-content"},oddRowColor:{type:String,default:"#172531"},evenRowColor:{type:String,default:"#0D1D29"},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},isRoundPickerVisible:{type:Boolean,default:!0},isPaginationVisible:{type:Boolean,default:!0},awaitForSeasons:{type:Boolean,default:!1},seasons:{type:Array,default:()=>[]},isCup:{type:Boolean,default:!1},isCupLegacy:{type:Boolean,default:!1},token:{type:String,default:""},pagesWithGames:{type:Array,default:()=>[]},maxGamesToShow:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},areRoundsVisible:{type:Boolean,default:!0},is_captured:{type:Number,default:1},gamesPerMatchDay:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},itemsToShow:{type:Number,default:9},itemsToScroll:{type:Number,default:9},games:{type:Array,default:()=>null},teamId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},avoidTeamIdFilter:{type:Boolean,default:!1},areGamesCarouselType:{type:Boolean,default:!1},defaultGameId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},userTeamId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},sortCalendar:{type:Boolean,default:!0},isTeamGamePerPage:{type:Boolean,default:!1},onlyGamesTeamId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},tournamentType:{type:Number,default:0},checkLiveGamesIntervalMinutes:{type:Number,default:2},gamesEventsIntervalMinutes:{type:Number,default:2},checkStartedLiveGamesMinutes:{type:Number,default:5}},emits:["tournament-selected","change-teams","change-round","change-game-carousel","action","change-games-by-client-privileges","open-modal-event"],setup(s,{emit:e}){const t=s;let a=null,i=null,o=null;const r=n.ref([]),l=n.ref({}),d=n.ref(0),c=n.ref(null),h=n.ref({}),u=n.ref(new Map),f=n.ref(!1),p=n.ref(null),m=n.ref(null),g=n.ref(null),y=n.ref([]),b=n.ref(new Map),S=n.ref(new Set),_=n.computed(()=>t.isCup),C=n.computed(()=>t.isCupLegacy),T=n.computed(()=>({height:t.height,width:t.width})),v=n.computed(()=>{if(t.games)return Ee(t.games,t.isTeamGamePerPage);{const M=u.value.get(h.value.key);return M&&t.isTeamGamePerPage&&t.onlyGamesTeamId?[M[0].filter(W=>W.home_team.team_id===t.onlyGamesTeamId||W.visiting_team.team_id===t.onlyGamesTeamId)]:M||[]}}),E=n.computed(()=>t.areGamesCarouselType?v.value[0]:v.value),N=n.ref([]),L=n.ref([]),R=n.computed(()=>{const M=L.value&&L.value.length?z(l.value):K(l.value),W=N.value.find(H=>H.key===M);return W&&f.value&&($(!1),et(W)),M});n.watch(()=>t.seasons,M=>{M&&M.length&&($(!0),r.value=M.map(W=>W.id),ie(M,!0))},{immediate:!0,deep:!0}),n.watch(u,M=>{if(t.onlyGamesTeamId&&M.size){const W=Array.from(M.values()).reduce((H,G)=>(G.forEach(X=>{const Y=X.find(ke=>ke.home_team.team_id===t.onlyGamesTeamId||ke.visiting_team.team_id===t.onlyGamesTeamId);Y&&H.push(Y)}),H),[]);e("change-games-by-client-privileges",W)}},{immediate:!0});function $(M){f.value=M}function K(M){const W=Object.entries(Object.entries(M).reduce((X,[Y,ke])=>(X[Y]=[],ke.forEach(Pe=>{Pe.games.forEach(ct=>{const Mt=new Date(ct.date_time_utc).getTime()+66e5;X[Y].push(Mt)})}),X),{}));if(!W.length)return"1";const H=new Date().getTime(),G=W.reduce((X,[Y,ke])=>{let Pe=null;return ke.forEach(ct=>{const Mt=ct-H;Mt>=0&&(Pe===null||Mt<Pe)&&(Pe=Mt)}),Pe&&(X.shortestTime===null||Pe<X.shortestTime)&&(X.round=Y,X.shortestTime=Pe),X},{round:"",shortestTime:null});return G.shortestTime!==null?G.round:W[W.length-1][0]}function z(M){let W=1;if(L.value.length){const H=L.value[0];for(const[G,X]of Object.entries(M))for(const Y of X)if(Y.games.find(ke=>ke.game_id===H.game_id))return G}return W}n.watch(()=>t.teamId,()=>{se()},{immediate:!0});async function ae(M,W,H=""){let G=H;try{const X={};t.token&&(X.Authorization=t.token),G||(G="https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",M.forEach((Pe,ct)=>{G+=`${ct===0?"":"&"}seasons=${Pe}`}));const{data:{data:Y,teams:ke}}=await ln.get(G,{headers:X});return{seasonsAndGames:Y,seasonsAndTeams:ke}}catch(X){if(W>0)return ae(M,W-1,G);throw new Error(X)}}function oe(M){for(const W of M)if(!r.value.includes(W.season_id))return!0;return!1}async function ie(M,W){try{l.value={};let H=0;const{seasonsAndGames:G,seasonsAndTeams:X}=await ae(M.map(ke=>ke.id),3);if(W&&oe(G))return;G.forEach(ke=>{const{type:Pe}=M.find(ct=>ct.id===ke.season_id);ke.type=Pe,ke.games.forEach(ct=>{ct.season_id=ke.season_id}),Pe===0&&(H=ke.season_id)}),p.value={seasonsGames:G};const{teams:Y}=X.find(ke=>ke.season_id===H);m.value=Y,e("change-teams",Y),se(),S.value.size?Q():await ce()}catch(H){throw new Error(H)}}async function ce(){try{const M=await Ce(),W=new Set;if(y.value=M.data.reduce((H,G)=>(G.games.forEach(X=>{W.add(X.game_id),H.push(X)}),H),[]),y.value.length){i||await de();const H=[];S.value.forEach(G=>{const X=b.value.get(G);X&&new Date().valueOf()>X.dateTimeMillis&&H.push(G)}),H.length&&H.every(G=>b.value.get(G).isLiveTracked)&&J()}}catch(M){throw new Error(M)}}async function de(){try{const M=[];for(const H of y.value){const G=b.value.get(H.game_id);G&&(G.is_live=1,G.game_status=4),G.isLiveTracked=!0,M.push(ge(H.game_id))}const W=await Promise.all(M);for(const H of W){const G=b.value.get(H.game_id);G&&ue(G,H.plays)}i||he()}catch(M){throw new Error(M)}}function Q(){S.value.size&&S.value.forEach(M=>{const W=b.value.get(M);if(W){const H=new Date().valueOf();if(60*1e3*30+W.dateTimeMillis-H>0){const G=W.dateTimeMillis-H-3e5;setTimeout(()=>{q()},G>0?G:0)}}})}function q(){J(),o||(o=setInterval(()=>{ce()},t.checkLiveGamesIntervalMinutes*60*1e3))}function he(){Z(),i=setInterval(()=>{de()},t.gamesEventsIntervalMinutes*60*1e3)}function J(){clearInterval(o),o=null}function Z(){clearInterval(i),i=null}function ue(M,W){for(const H of W)if(H.category_id===0&&H.game_status_id===13){const G=b.value.get(H.game_id);y.value=y.value.filter(X=>X.game_id!==M.game_id),G.is_live=0,G.game_status=0}}async function ge(M){try{return(await ln.get(`${yC}${M}`,{headers:{Authorization:`${t.token}`}})).data}catch(W){throw new Error(W)}}async function Ce(){try{if(t.seasons.length===0)return[];const M=t.seasons.reduce((G,X)=>`${G}seasons=${X.id}&`,""),W=ln.create({headers:{Authorization:`${t.token}`}}),{data:H}=await W.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${M}`);return H}catch(M){throw new Error(M)}}function se(){if(J(),!m.value)return;b.value.clear(),S.value.clear(),L.value=[];const M=p.value&&p.value.seasonsGames?p.value.seasonsGames.map(W=>{const H=W.games.reduce((G,X)=>{if(t.onlyGamesTeamId&&t.onlyGamesTeamId!==X.home_team&&t.onlyGamesTeamId!==X.visiting_team)return G;const Y={...X},ke=new Date,[Pe,ct,Mt]=Y.date.split("-"),[wi,_i,wO]=Y.schedule.split(":"),ki=new Date(Number(Pe),Number(ct)-1,Number(Mt),Number(wi),Number(_i),Number(wO));return Y.dateTimeMillis=ki.valueOf(),Y.home_team=m.value.find(ql=>ql.team_id===X.home_team),Y.visiting_team=m.value.find(ql=>ql.team_id===X.visiting_team),Y.game_status===4&&ke.getFullYear()===ki.getFullYear()&&ke.getMonth()===ki.getMonth()&&ke.getDate()===ki.getDate()&&S.value.add(Y.game_id),b.value.set(Y.game_id,Y),t.teamId&&Y.home_team.team_id!==t.teamId&&Y.visiting_team.team_id!==t.teamId||(G[X.matchday_abbreviation]?G[X.matchday_abbreviation][X.game_status===3?"canceled":X.date]?G[X.matchday_abbreviation][X.game_status===3?"canceled":X.date].push(Y):G[X.matchday_abbreviation][X.game_status===3?"canceled":X.date]=[Y]:G[X.matchday_abbreviation]={[X.game_status===3?"canceled":X.date]:[Y]},t.userTeamId&&Y.game_status===4&&(Y.home_team.team_id===t.userTeamId||Y.visiting_team.team_id===t.userTeamId)&&L.value.push(Y)),G},{});for(let[G,X]of Object.entries(H))H[G]=Object.entries(X).map(([Y,ke])=>({date:Y,games:ke.sort((Pe,ct)=>Pe.dateTimeMillis-ct.dateTimeMillis)})),H[G].sort((Y,ke)=>Y.date<ke.date?-1:Y.date>ke.date?1:0);return{type:W.type,weight:W.type===0?0:W.type===2?1:2,schedule:H}}):[];M.sort((W,H)=>W.weight-H.weight),l.value=M.reduce((W,H)=>{for(const[G,X]of Object.entries(H.schedule))if(H.type===0)if([1,2].includes(t.tournamentType)){const Y=Nk.get(t.tournamentType);if(Y){const ke=Y.get(G);ke&&(W[ke.matchDayAbbreviation]=X)}}else if(_.value){const Y=G.replace("M",""),ke=Y;C.value?W[Rk[Y]||ke]=X:W[Ik[G]||ke]=X}else W[Number(G.replace("M","")).toString()]=X;else H.type===2?G.charAt(1)=="I"?W[`PI${Number(G.replace("PI",""))}`]=X:W[`R${Number(G.replace("PO",""))}`]=X:H.type===1&&(W[Lk[G]]=X);return W},{}),u.value=new Map,N.value=Array.from(Object.entries(l.value).reduce((W,[H,G],X)=>{const Y=Number(H);let ke="";Number.isNaN(Y)?ke=H:ke=Y<10?`0${Y}`:H,W.set(H,{key:H,value:Y,valueText:ke,index:X});const Pe=G.reduce((Mt,wi)=>(wi.games.forEach(_i=>{_i.game_id===t.defaultGameId&&(g.value=H),_i.roundAbbreviation=Number.isNaN(Y)?Y:`J ${Y}`}),Mt=Mt.concat(wi.games),Mt),[]),ct=Ee(Pe);return u.value.set(H,ct),W},new Map).values())}function Ee(M,W=!1){const H=[];if(t.gamesPerMatchDay>0){let G=[];M.forEach((X,Y)=>{G.push(X),(Y+1)%t.gamesPerMatchDay===0&&(H.push([...G]),G=[])}),G.length&&H.push([...G])}else H.push(M);return W&&t.isTeamGamePerPage&&t.defaultGameId?H.filter(G=>G.game_id===t.defaultGameId||G.gameId===t.defaultGameId):H}async function Te(M){try{const{data:W}=await ln.get("https://kefloixzy1.execute-api.us-west-2.amazonaws.com/prod/tournaments");return W}catch(W){if(M>0)return Te(M-1);throw new Error(W)}}function Fe(){if(window.ResizeObserver)a=new ResizeObserver(()=>{d.value=c.value.clientWidth}),a.observe(c.value);else throw new Error("Resize observer not supported!")}function et(M){h.value.value!==M.value&&(h.value=M,e("change-round",M))}function it(M){t.areGamesCarouselType&&e("change-game-carousel",M.selectedItem)}function ot(M){e("action",M),j(M)}function x(M){e("open-modal-event",M)}function j(M){const W="PLAY_RESUME",H="PLAY_GOALS",G=[607,608,12,55,54,35,14,52,15,53,466,477],X=[12,55,"35_r","54_r"],{game_id:Y,season_id:ke}=M.game;let Pe={seasonId:ke,tournaments:[],isFeaturedPlayers:!1,mainSectionType:1,playListType:1,gameIds:[Y],playerIds:[],goalkeeperIds:[],categoryIds:[],teamId:0,matchResult:[],categorySingleName:"",avoidCategorySingleName:!1,currentPlayIndex:0,playData:null,lastClashedGameId:null,tournamentsLastClashes:null,advancedFilter:{playListTitle:""},objectPlaySync:null};M.action===W?(Pe.categoryIds=G,Pe.advancedFilter.playListTitle="Resumen",e("openmedia",Pe)):M.action===H&&(Pe.categoryIds=X,Pe.advancedFilter.playListTitle="Goles",e("openmedia",Pe))}async function U(){try{if(!t.awaitForSeasons&&!t.games){const M=(await Te(3)).find(G=>G._id===1),W=M.seasons[0],H=[{id:W.id,type:W.type}];M&&M.tournament&&e("tournament-selected",M.tournament),W.related_seasons&&W.related_seasons.length&&H.push(...W.related_seasons.map(G=>({id:G.id,type:G.type}))),await ie(H,!1)}}catch(M){throw new Error(M)}}return n.onMounted(()=>{Fe()}),U(),(M,W)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"calendarByGame",ref:c,class:"calendar-by-game",style:n.normalizeStyle(T.value)},[s.teamId&&!s.avoidTeamIdFilter?(n.openBlock(),n.createBlock(fT,{key:0,"full-tournament-schedule":l.value,"team-id":s.teamId,"show-videos":s.showVideos,"is-landing-mode":!1,"row-height":s.rowHeight,"component-width":d.value,"games-pages":u.value,"is-pagination-visible":s.isPaginationVisible,"is-round-mode":s.isRoundMode,onAction:ot},null,8,["full-tournament-schedule","team-id","show-videos","row-height","component-width","games-pages","is-pagination-visible","is-round-mode"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[s.areRoundsVisible&&N.value?(n.openBlock(),n.createBlock(qk,{key:0,"match-days":N.value,"is-landing-mode":s.isLandingMode,height:"48px","items-to-show":s.itemsToShow,"items-to-scroll":s.itemsToScroll,"component-width":d.value,"default-match-day-key":g.value,"closest-match-day":s.sortCalendar?R.value:"",onChangeMatchDay:et},null,8,["match-days","is-landing-mode","items-to-show","items-to-scroll","component-width","default-match-day-key","closest-match-day"])):n.createCommentVNode("",!0),n.createElementVNode("div",gC,[v.value?(n.openBlock(),n.createBlock(n.unref(Ih),{key:0,"is-pagination-visible":s.isPaginationVisible&&!s.areGamesCarouselType,items:E.value,"are-navigation-arrows-visible":s.areGamesCarouselType?!s.areGamesCarouselType:s.isPaginationVisible,"wrap-around":s.areGamesCarouselType&&!s.isTeamGamePerPage,"items-to-show":s.areGamesCarouselType&&!s.isTeamGamePerPage?1.2:1,"is-main-slide-priority":s.areGamesCarouselType,"are-slides-arrows-visible":s.areGamesCarouselType&&!s.isTeamGamePerPage,"slides-arrows-left-and-right":s.areGamesCarouselType?"30px":"0px","default-item-by-prop":s.areGamesCarouselType?{propName:"game_id",value:s.defaultGameId}:{},onInput:it},{default:n.withCtx(({item:H})=>[s.areGamesCarouselType?(n.openBlock(),n.createBlock(pC,{key:0,is_captured:s.is_captured,game:H,onOpenModalEvent:x,"plays-live":s.playsLive,"info-live":s.infoLive},null,8,["is_captured","game","plays-live","info-live"])):(n.openBlock(),n.createBlock(cT,{key:1,"team-id":s.teamId,"show-videos":s.showVideos,"games-per-page":H,"is-landing-mode":s.isLandingMode,"row-height":s.rowHeight,"component-width":d.value,"is-round-mode":s.isRoundMode,onAction:ot},null,8,["team-id","show-videos","games-per-page","is-landing-mode","row-height","component-width","is-round-mode"]))]),_:1},8,["is-pagination-visible","items","are-navigation-arrows-visible","wrap-around","items-to-show","is-main-slide-priority","are-slides-arrows-visible","slides-arrows-left-and-right","default-item-by-prop"])):n.createCommentVNode("",!0)])],64))],4))}},SC=Lt(bC,[["__scopeId","data-v-ac055c89"]]),wC=["Mi posición","Tabla General","Fases","Play Off"],_C={components:{GscSwitchComponent:yo,GSCGeneraltable:s_,GSCCalendarByGame:SC},props:{privileges:{type:Object,default:()=>{}},isPublic:{type:Boolean,default:!0},season:{type:Object,default:()=>{}},onlyTable:{type:Boolean,default:!0},seasons:{type:Array,default:()=>[]},tournamentType:{type:Number,default:0},tournament:{type:Number,default:1},teamId:{type:Number,default:0},componentWidth:{type:Number,default:768},tournaments:{type:Array,default:()=>[]}},data(){return{selectedOpt:"Mi posición",tokenFree:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"}},computed:{tableTitle(){return this.tournamentType!==0?this.tournamentType===1?"Fases":"Play Off":(this.selectedOpt!=="Calendario"&&this.changeCategory(this.teamId!=0?"Mi posición":"Tabla General"),this.teamId!==0?"Mi posición":"Tabla General")},isGeneralTableVisible(){return wC.includes(this.selectedOpt)}},watch:{tableTitle:{handler(s){this.selectedOpt=s},immediate:!0}},methods:{onAction(s){this.$emit("action",s)},changeCategory(s){this.selectedOpt=s},onOpenMedia(s){this.$emit("openmedia",s)},onOpenProfile(s){this.$emit("onOpenProfile",s)}},mounted(){this.selectedOpt=this.teamId!==0?"Mi posición":"Tabla General"}},kC={key:0,class:"gsc-switch-container"},EC={key:1,class:"gsc-switch-container"},TC={class:"gsc-app-component"},CC={key:0};function xC(s,e,t,a,i,o){const r=n.resolveComponent("GscSwitchComponent"),l=n.resolveComponent("GSCGeneraltable"),d=n.resolveComponent("GSCCalendarByGame");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(t.componentWidth>1e3?"gsc-calendar-table":"gsc-calendar-table-movil")},[t.onlyTable?(n.openBlock(),n.createElementBlock("div",EC,"Mi posicion")):(n.openBlock(),n.createElementBlock("div",kC,[n.createVNode(r,{type:0,arrow:!1,"font-family":"Poppins-Light",buttons:[o.tableTitle,"Calendario"],height:"40px","selected-option":i.selectedOpt,"font-size":t.componentWidth>=768?"16px":"14px",width:"355px",onInput:o.changeCategory},null,8,["buttons","selected-option","font-size","onInput"])])),n.createElementVNode("div",TC,[o.isGeneralTableVisible?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(l,{isPaginationVisible:!0,"current-season-id":t.season.id,"team-default-select":t.teamId,"team-id":t.teamId,type:1,"show-videos":t.isPublic?t.privileges.vr_privileges!=0:!0,tournament:t.tournament,"type-view":t.tournamentType,"await-for-season":"","await-for-tournaments":"","external-tournaments":t.tournaments,onOpenmedia:o.onOpenMedia,onOpenTableProfile:o.onOpenProfile},null,8,["current-season-id","team-default-select","team-id","show-videos","tournament","type-view","external-tournaments","onOpenmedia","onOpenTableProfile"]),n.createElementVNode("div",{onClick:e[0]||(e[0]=c=>s.$router.push({name:"table"})),class:"gsc-app-component-view-all"}," Ver todo ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t.onlyTable?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",CC,[n.createVNode(d,{width:"100%",token:i.tokenFree,seasons:t.seasons,"tournament-type":t.tournamentType,"show-videos":t.isPublic,"row-height":"90px","is-landing-mode":!0,"is-pagination-visible":!0,isRoundPickerVisible:!0,"await-for-seasons":"","items-to-show":9,"items-to-scroll":5,"max-games-to-show":5,"games-per-match-day":5,onOpenmedia:o.onOpenMedia,onAction:o.onAction},null,8,["token","seasons","tournament-type","show-videos","onOpenmedia","onAction"]),n.createElementVNode("div",{onClick:e[1]||(e[1]=c=>this.$router.push({name:"calendar"})),class:"gsc-app-component-view-all"}," Ver todo ")]))],64))])],2)}const vC=qe(_C,[["render",xC],["__scopeId","data-v-c8707277"]]),Mh=["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],$h=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],Vh=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],AC={class:"match"},LC={class:"match__header"},IC={key:0,class:"match__final-tag"},RC={key:1,class:"match__final-tag__no-border"},NC={class:"match__header__match-date"},BC={class:"match__tag"},DC={class:"match__body"},PC={class:"match__data"},OC={class:"match__acronym"},FC=["src"],MC={class:"match__score"},$C=["src"],VC={class:"match__acronym"},UC={class:"match__status"},dn=qe({__name:"PreviousMatch",props:{visitTeam:{type:Object,default:()=>{}},data:{type:Object,default:()=>{}},homeTeam:{type:Object,default:()=>{}},score:{type:String,default:"2 - 1"},journey:{type:[String,Number],default:2},penalScore:{type:String,default:""},infoType:{type:String,default:"postmatch"}},setup(s){const e=s,t=n.computed(()=>{const a=new Date(e.data.date_time_utc);return`${Mh[a.getDay()]}, ${a.getDate()} de ${$h[a.getMonth()]}`});return(a,i)=>{var o,r,l;return n.openBlock(),n.createElementBlock("section",AC,[n.createElementVNode("div",LC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock("div",IC,"FINAL")):(n.openBlock(),n.createElementBlock("div",RC)),n.createElementVNode("div",NC,n.toDisplayString(t.value),1),n.createElementVNode("div",BC,n.toDisplayString(`${Number.isNaN(Number(s.data.roundAbbreviationV2))?"":"J"}${s.data.roundAbbreviationV2}`),1)]),n.createElementVNode("div",DC,[n.createElementVNode("div",PC,[n.createElementVNode("div",OC,n.toDisplayString((o=s.data)==null?void 0:o.home_team_acronym),1),n.createElementVNode("img",{class:"match__img",src:"https://az755631.vo.msecnd.net/teams-80/"+s.data.home_team+".png",alt:"team-img"},null,8,FC),n.createElementVNode("div",MC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(s.data.score[0])+" - "+n.toDisplayString(s.data.score[1]),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString((r=s.data)==null?void 0:r.schedule.replace(":00","")),1)],64))]),n.createElementVNode("img",{class:"match__img",src:"https://az755631.vo.msecnd.net/teams-80/"+s.data.visiting_team+".png",alt:"team-img"},null,8,$C),n.createElementVNode("div",VC,n.toDisplayString((l=s.data)==null?void 0:l.visiting_team_acronym),1)]),n.createElementVNode("div",UC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Finalizado"+n.toDisplayString(s.penalScore?` - Penales ${s.penalScore}`:""),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("CST")],64))])]),n.createElementVNode("div",{class:"match__button",onClick:i[0]||(i[0]=d=>a.$emit("clickMatch"))},"Analizar partido →")])}}},[["__scopeId","data-v-02d713e0"]]),Uh=s=>(n.pushScopeId("data-v-f351b9f3"),s=s(),n.popScopeId(),s),zC=["src"],GC=["src"],jC={class:"coming-match__body"},HC={class:"coming-match__data"},WC=["src"],KC={key:0,class:"coming-match__live"},qC={class:"coming-match__live__score"},YC={class:"coming-match__live__time"},JC=Uh(()=>n.createElementVNode("div",{class:"bullet"},null,-1)),XC=Uh(()=>n.createElementVNode("div",{class:"coming-match__live__time__text"},"LIVE",-1)),ZC={class:"coming-match__live__time__time"},QC={key:1,style:{"margin-top":"16px"}},ex={class:"coming-match__time"},tx={class:"coming-match__cst"},sx={key:0},ax=["src"],Bs=qe({__name:"ComingMatch",props:{small:{type:Boolean,default:!1},visitTeam:{type:Object,default:()=>{}},data:{type:Object,default:()=>{}},homeTeam:{type:Object,default:()=>{}},date:{type:String,default:"Jueves 7 de Abril"},time:{type:String,default:"5: 00"}},setup(s){const e=s,t=n.computed(()=>{const i=new Date(e.data.date_time_utc);return`${Mh[i.getDay()]}, ${i.getDate()} de ${e.small?Vh[i.getMonth()]:$h[i.getMonth()]}`}),a=n.computed(()=>e.data.is_live||e.data.game_status===0);return(i,o)=>{var r,l,d,c,h,u,f,p,m,g,y,b,S,_,C;return n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["coming-match",{small:s.small}])},[n.createElementVNode("img",{class:n.normalizeClass(["coming-match__bg",{small:s.small}]),src:typeof s.data.home_team=="object"?"https://az755631.vo.msecnd.net/teams-150/"+((r=s.data)==null?void 0:r.home_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-150/"+((l=s.data)==null?void 0:l.home_team)+".png",alt:"team-img"},null,10,zC),n.createElementVNode("img",{class:n.normalizeClass(["coming-match__bg",{small:s.small}]),src:typeof s.data.visiting_team=="object"?"https://az755631.vo.msecnd.net/teams-150/"+((d=s.data)==null?void 0:d.visiting_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-150/"+((c=s.data)==null?void 0:c.visiting_team)+".png",alt:"team-img"},null,10,GC),n.createElementVNode("div",jC,[a.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["coming-match__date",{small:s.small}])},n.toDisplayString(`${Number.isNaN(Number(s.data.roundAbbreviationV2))?"":"J"}${s.data.roundAbbreviationV2}`)+" | "+n.toDisplayString(t.value),3)),n.createElementVNode("div",HC,[n.createElementVNode("div",{class:n.normalizeClass(["coming-match__team",{small:s.small}])},[n.createElementVNode("img",{class:n.normalizeClass(["coming-match__img",{small:s.small}]),src:typeof s.data.home_team=="object"?"https://az755631.vo.msecnd.net/teams-80/"+((h=s.data)==null?void 0:h.home_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-80/"+((u=s.data)==null?void 0:u.home_team)+".png",alt:"team-img"},null,10,WC),n.createElementVNode("div",{class:n.normalizeClass(["coming-match__acronym",{small:s.small}])},n.toDisplayString((f=s.data)==null?void 0:f.home_team_name),3)],2),a.value?(n.openBlock(),n.createElementBlock("div",KC,[n.createElementVNode("div",qC,n.toDisplayString((p=s.data)==null?void 0:p.score[0])+" - "+n.toDisplayString((m=s.data)==null?void 0:m.score[1]),1),n.createElementVNode("div",YC,[JC,XC,n.createElementVNode("div",ZC,n.toDisplayString(s.data.currentTimeLive||"0'"),1)])])):(n.openBlock(),n.createElementBlock("div",QC,[n.createElementVNode("div",ex,[s.data.game_status!==4?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString((g=s.data)==null?void 0:g.score[0])+" - "+n.toDisplayString((y=s.data)==null?void 0:y.score[1]),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString((b=s.data)==null?void 0:b.schedule.replace(":00","")),1)],64))]),n.createElementVNode("div",tx,[s.data.game_status===4?(n.openBlock(),n.createElementBlock("span",sx,"CST")):n.createCommentVNode("",!0)])])),n.createElementVNode("div",{class:n.normalizeClass(["coming-match__team away",{small:s.small}])},[n.createElementVNode("div",{class:n.normalizeClass(["coming-match__acronym",{small:s.small}])},n.toDisplayString((S=s.data)==null?void 0:S.visiting_team_name),3),n.createElementVNode("img",{class:n.normalizeClass(["coming-match__img",{small:s.small}]),src:typeof s.data.visiting_team=="object"?"https://az755631.vo.msecnd.net/teams-80/"+((_=s.data)==null?void 0:_.visiting_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-80/"+((C=s.data)==null?void 0:C.visiting_team)+".png",alt:"team-img"},null,10,ax)],2)])]),n.createElementVNode("div",{class:n.normalizeClass(["coming-match__button",{small:s.small}]),onClick:o[0]||(o[0]=T=>i.$emit("clickMatch"))},[s.data.game_status===4?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Analizar previa →")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Analizar partido →")],64))],2)],2)}}},[["__scopeId","data-v-f351b9f3"]]),hn=s=>(n.pushScopeId("data-v-d72712b5"),s=s(),n.popScopeId(),s),nx={class:"game-item__header"},ix={class:"game-item__header__info text-type-1"},ox={key:0,class:"game-item__header__info__live"},rx=hn(()=>n.createElementVNode("div",{class:"game-item__header__info__live__status text-type-2"},[n.createElementVNode("div",{class:"bullet"}),n.createElementVNode("span",null,"LIVE")],-1)),lx={class:"text-type-1"},cx={key:1,class:"game-item__header__info__pre-match text-type-2"},dx=hn(()=>n.createElementVNode("span",{class:"game-item__header__info__pre-match text-type-1"},[n.createTextVNode(" "),n.createElementVNode("small",null,"CST")],-1)),hx={key:2,class:"game-item__header__info__post-match"},ux=[hn(()=>n.createElementVNode("span",{class:"text-type-2"},"Finalizado",-1))],mx={class:"game-item__body"},fx={class:"game-item__body__team__info"},px=["src"],gx={class:"game-item__body__team__info__acronym"},yx={class:"game-item__body__team__score"},bx=[hn(()=>n.createElementVNode("div",null,"Analizar partido →",-1))],Sx=qe({__name:"GameItem",props:{game:{type:Object,default:()=>{}}},emits:["clickMatch"],setup(s,{emit:e}){const t=s,a=n.computed(()=>{let l="";const d=Number(t.game.roundAbbreviationV2);if(l=Number.isNaN(d)?t.game.roundAbbreviationV2:`JOR ${d}`,t.game.game_status===4){const c=new Date(t.game.date_time_utc);l+=` • ${c.getDate()} ${Vh[c.getMonth()]}`}return l}),i=n.computed(()=>t.game.schedule.replace(":00","")),o=n.computed(()=>[{id:t.game.home_team.team_id,teamLogo:t.game.home_team.logo,acronym:t.game.home_team.acronym,score:t.game.score[0]},{id:t.game.visiting_team.team_id,teamLogo:t.game.visiting_team.logo,acronym:t.game.visiting_team.acronym,score:t.game.score[1]}]);function r(){e("clickMatch")}return(l,d)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["game-item",{"is-live":s.game.is_live}])},[n.createElementVNode("div",nx,[n.createElementVNode("div",ix,n.toDisplayString(a.value),1),s.game.is_live?(n.openBlock(),n.createElementBlock("div",ox,[rx,n.createElementVNode("div",lx,n.toDisplayString(s.game.currentTimeLive||"0'"),1)])):s.game.game_status===4?(n.openBlock(),n.createElementBlock("div",cx,[n.createTextVNode(n.toDisplayString(i.value)+" ",1),dx])):(n.openBlock(),n.createElementBlock("div",hx,ux))]),n.createElementVNode("div",mx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,c=>(n.openBlock(),n.createElementBlock("div",{key:c.id,class:"game-item__body__team"},[n.createElementVNode("div",fx,[n.createElementVNode("img",{src:c.teamLogo,alt:"team-logo"},null,8,px),n.createElementVNode("div",gx,n.toDisplayString(c.acronym),1)]),n.createElementVNode("div",yx,[n.withDirectives(n.createElementVNode("div",{class:"game-item__body__team__score__value"},n.toDisplayString(c.score||0),513),[[n.vShow,s.game.is_live||s.game.game_status!==4]])])]))),128))]),n.createElementVNode("div",{class:"game-item__footer",onClick:r},bx)],2))}},[["__scopeId","data-v-d72712b5"]]),wx=qe({__name:"SwitchCustom",props:{modelValue:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,a=n.ref(null);n.watch(()=>t.modelValue,()=>{i()},{immediate:!0});function i(){a.value&&(a.value.checked=t.modelValue)}function o(r){e("update:modelValue",r.target.checked)}return n.onMounted(()=>{i()}),(r,l)=>(n.openBlock(),n.createElementBlock("input",{ref_key:"switchCustom",ref:a,id:"toggle",className:"toggle",type:"checkbox",role:"switch",name:"toggle",onInput:o},null,544))}},[["__scopeId","data-v-9e2bfbd7"]]);/**
|
|
28
|
+
*/const je={itemsToShow:1,itemsToScroll:1,modelValue:0,transition:300,autoplay:0,snapAlign:"center",wrapAround:!1,throttle:16,pauseAutoplayOnHover:!1,mouseDrag:!0,touchDrag:!0,dir:"ltr",breakpoints:void 0,i18n:{ariaNextSlide:"Navigate to next slide",ariaPreviousSlide:"Navigate to previous slide",ariaNavigateToSlide:"Navigate to slide {slideNumber}",ariaGallery:"Gallery",itemXofY:"Item {currentSlide} of {slidesCount}",iconArrowUp:"Arrow pointing upwards",iconArrowDown:"Arrow pointing downwards",iconArrowRight:"Arrow pointing to the right",iconArrowLeft:"Arrow pointing to the left"}},Rh={itemsToShow:{default:je.itemsToShow,type:Number},itemsToScroll:{default:je.itemsToScroll,type:Number},wrapAround:{default:je.wrapAround,type:Boolean},throttle:{default:je.throttle,type:Number},snapAlign:{default:je.snapAlign,validator(s){return["start","end","center","center-even","center-odd"].includes(s)}},transition:{default:je.transition,type:Number},breakpoints:{default:je.breakpoints,type:Object},autoplay:{default:je.autoplay,type:Number},pauseAutoplayOnHover:{default:je.pauseAutoplayOnHover,type:Boolean},modelValue:{default:void 0,type:Number},mouseDrag:{default:je.mouseDrag,type:Boolean},touchDrag:{default:je.touchDrag,type:Boolean},dir:{default:je.dir,validator(s){return["rtl","ltr"].includes(s)}},i18n:{default:je.i18n,type:Object},settings:{default(){return{}},type:Object}};function Bk({config:s,slidesCount:e}){const{snapAlign:t,wrapAround:a,itemsToShow:i=1}=s;if(a)return Math.max(e-1,0);let o;switch(t){case"start":o=e-i;break;case"end":o=e-1;break;case"center":case"center-odd":o=e-Math.ceil((i-.5)/2);break;case"center-even":o=e-Math.ceil(i/2);break;default:o=0;break}return Math.max(o,0)}function Dk({config:s,slidesCount:e}){const{wrapAround:t,snapAlign:a,itemsToShow:i=1}=s;let o=0;if(t||i>e)return o;switch(a){case"start":o=0;break;case"end":o=i-1;break;case"center":case"center-odd":o=Math.floor((i-1)/2);break;case"center-even":o=Math.floor((i-2)/2);break;default:o=0;break}return o}function Fo({val:s,max:e,min:t}){return e<t?s:Math.min(Math.max(s,t),e)}function Pk({config:s,currentSlide:e,slidesCount:t}){const{snapAlign:a,wrapAround:i,itemsToShow:o=1}=s;let r=e;switch(a){case"center":case"center-odd":r-=(o-1)/2;break;case"center-even":r-=(o-2)/2;break;case"end":r-=o-1;break}return i?r:Fo({val:r,max:t-o,min:0})}function Nh(s){return s?s.reduce((e,t)=>{var a;return t.type===n.Fragment?[...e,...Nh(t.children)]:((a=t.type)===null||a===void 0?void 0:a.name)==="CarouselSlide"?[...e,t]:e},[]):[]}function Mo({val:s,max:e,min:t=0}){return s>e?Mo({val:s-(e+1),max:e,min:t}):s<t?Mo({val:s+(e+1),max:e,min:t}):s}function Ok(s,e){let t;return e?function(...a){const i=this;t||(s.apply(i,a),t=!0,setTimeout(()=>t=!1,e))}:s}function Fk(s,e){let t;return function(...a){t&&clearTimeout(t),t=setTimeout(()=>{s(...a),t=null},e)}}function Mk(s="",e={}){return Object.entries(e).reduce((t,[a,i])=>t.replace(`{${a}}`,String(i)),s)}var $k=n.defineComponent({name:"ARIA",setup(){const s=n.inject("config",n.reactive(Object.assign({},je))),e=n.inject("currentSlide",n.ref(0)),t=n.inject("slidesCount",n.ref(0));return()=>n.h("div",{class:["carousel__liveregion","carousel__sr-only"],"aria-live":"polite","aria-atomic":"true"},Mk(s.i18n.itemXofY,{currentSlide:e.value+1,slidesCount:t.value}))}}),Vk=n.defineComponent({name:"Carousel",props:Rh,setup(s,{slots:e,emit:t,expose:a}){var i;const o=n.ref(null),r=n.ref([]),l=n.ref(0),d=n.ref(0),c=n.reactive(Object.assign({},je));let h=Object.assign({},je),u;const f=n.ref((i=s.modelValue)!==null&&i!==void 0?i:0),p=n.ref(0),m=n.ref(0),g=n.ref(0),y=n.ref(0);let b,S;n.provide("config",c),n.provide("slidesCount",d),n.provide("currentSlide",f),n.provide("maxSlide",g),n.provide("minSlide",y),n.provide("slideWidth",l);function _(){u=Object.assign({},s.breakpoints),h=Object.assign(Object.assign(Object.assign({},h),s),{i18n:Object.assign(Object.assign({},h.i18n),s.i18n),breakpoints:void 0}),T(h)}function C(){if(!u||!Object.keys(u).length)return;const x=Object.keys(u).map(U=>Number(U)).sort((U,M)=>+M-+U);let j=Object.assign({},h);x.some(U=>{const M=window.matchMedia(`(min-width: ${U}px)`).matches;return M&&(j=Object.assign(Object.assign({},j),u[U])),M}),T(j)}function T(x){Object.entries(x).forEach(([j,U])=>c[j]=U)}const v=Fk(()=>{C(),N(),E()},16);function E(){if(!o.value)return;const x=o.value.getBoundingClientRect();l.value=x.width/c.itemsToShow}function N(){d.value<=0||(m.value=Math.ceil((d.value-1)/2),g.value=Bk({config:c,slidesCount:d.value}),y.value=Dk({config:c,slidesCount:d.value}),c.wrapAround||(f.value=Fo({val:f.value,max:g.value,min:y.value})))}n.onMounted(()=>{n.nextTick(()=>E()),setTimeout(()=>E(),1e3),C(),q(),window.addEventListener("resize",v,{passive:!0}),t("init")}),n.onUnmounted(()=>{S&&clearTimeout(S),b&&clearInterval(b),window.removeEventListener("resize",v,{passive:!0})});let L=!1;const R={x:0,y:0},$={x:0,y:0},K=n.reactive({x:0,y:0}),z=n.ref(!1),ae=n.ref(!1),oe=()=>{z.value=!0},ie=()=>{z.value=!1};function ce(x){["INPUT","TEXTAREA","SELECT"].includes(x.target.tagName)||(L=x.type==="touchstart",L||x.preventDefault(),!(!L&&x.button!==0||J.value)&&(R.x=L?x.touches[0].clientX:x.clientX,R.y=L?x.touches[0].clientY:x.clientY,document.addEventListener(L?"touchmove":"mousemove",de,!0),document.addEventListener(L?"touchend":"mouseup",Q,!0)))}const de=Ok(x=>{ae.value=!0,$.x=L?x.touches[0].clientX:x.clientX,$.y=L?x.touches[0].clientY:x.clientY;const j=$.x-R.x,U=$.y-R.y;K.y=U,K.x=j},c.throttle);function Q(){const x=c.dir==="rtl"?-1:1,j=Math.sign(K.x)*.4,U=Math.round(K.x/l.value+j)*x;if(U&&!L){const M=W=>{window.removeEventListener("click",M,!0)};window.addEventListener("click",M,!0)}Z(f.value-U),K.x=0,K.y=0,ae.value=!1,document.removeEventListener(L?"touchmove":"mousemove",de,!0),document.removeEventListener(L?"touchend":"mouseup",Q,!0)}function q(){!c.autoplay||c.autoplay<=0||(b=setInterval(()=>{c.pauseAutoplayOnHover&&z.value||ue()},c.autoplay))}function he(){b&&(clearInterval(b),b=null),q()}const J=n.ref(!1);function Z(x){const j=c.wrapAround?x:Fo({val:x,max:g.value,min:y.value});f.value===j||J.value||(t("slide-start",{slidingToIndex:x,currentSlideIndex:f.value,prevSlideIndex:p.value,slidesCount:d.value}),J.value=!0,p.value=f.value,f.value=j,S=setTimeout(()=>{if(c.wrapAround){const U=Mo({val:j,max:g.value,min:0});U!==f.value&&(f.value=U,t("loop",{currentSlideIndex:f.value,slidingToIndex:x}))}t("update:modelValue",f.value),t("slide-end",{currentSlideIndex:f.value,prevSlideIndex:p.value,slidesCount:d.value}),J.value=!1,he()},c.transition))}function ue(){Z(f.value+c.itemsToScroll)}function ge(){Z(f.value-c.itemsToScroll)}const Ce={slideTo:Z,next:ue,prev:ge};n.provide("nav",Ce),n.provide("isSliding",J);const se=n.computed(()=>Pk({config:c,currentSlide:f.value,slidesCount:d.value}));n.provide("slidesToScroll",se);const Ee=n.computed(()=>{const x=c.dir==="rtl"?-1:1,j=se.value*l.value*x;return{transform:`translateX(${K.x-j}px)`,transition:`${J.value?c.transition:0}ms`,margin:c.wrapAround?`0 -${d.value*l.value}px`:"",width:"100%"}});function Te(){_(),C(),N(),E(),he()}Object.keys(Rh).forEach(x=>{["modelValue"].includes(x)||n.watch(()=>s[x],Te)}),n.watch(()=>s.modelValue,x=>{x!==f.value&&Z(Number(x))}),n.watch(d,N),t("before-init"),_();const Fe={config:c,slidesCount:d,slideWidth:l,next:ue,prev:ge,slideTo:Z,currentSlide:f,maxSlide:g,minSlide:y,middleSlide:m};a({updateBreakpointsConfigs:C,updateSlidesData:N,updateSlideWidth:E,initDefaultConfigs:_,restartCarousel:Te,slideTo:Z,next:ue,prev:ge,nav:Ce,data:Fe});const et=e.default||e.slides,it=e.addons,ot=n.reactive(Fe);return()=>{const x=Nh(et==null?void 0:et(ot)),j=(it==null?void 0:it(ot))||[];x.forEach((H,G)=>H.props.index=G);let U=x;if(c.wrapAround){const H=x.map((X,Y)=>n.cloneVNode(X,{index:-x.length+Y,isClone:!0,key:`clone-before-${Y}`})),G=x.map((X,Y)=>n.cloneVNode(X,{index:x.length+Y,isClone:!0,key:`clone-after-${Y}`}));U=[...H,...x,...G]}r.value=x,d.value=Math.max(x.length,1);const M=n.h("ol",{class:"carousel__track",style:Ee.value,onMousedownCapture:c.mouseDrag?ce:null,onTouchstartPassiveCapture:c.touchDrag?ce:null},U),W=n.h("div",{class:"carousel__viewport"},M);return n.h("section",{ref:o,class:{carousel:!0,"is-sliding":J.value,"is-dragging":ae.value,"is-hover":z.value,"carousel--rtl":c.dir==="rtl"},dir:c.dir,"aria-label":c.i18n.ariaGallery,tabindex:"0",onMouseenter:oe,onMouseleave:ie},[W,j,n.h($k)])}}}),$o;(function(s){s.arrowUp="arrowUp",s.arrowDown="arrowDown",s.arrowRight="arrowRight",s.arrowLeft="arrowLeft"})($o||($o={}));const Uk={arrowUp:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z",arrowRight:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z",arrowLeft:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"};function zk(s){return s in $o}const Vo=s=>{const e=n.inject("config",n.reactive(Object.assign({},je))),t=String(s.name),a=`icon${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!t||typeof t!="string"||!zk(t))return;const i=Uk[t],o=n.h("path",{d:i}),r=e.i18n[a]||s.title||t,l=n.h("title",r);return n.h("svg",{class:"carousel__icon",viewBox:"0 0 24 24",role:"img","aria-label":r},[l,o])};Vo.props={name:String,title:String};const Gk=(s,{slots:e,attrs:t})=>{const{next:a,prev:i}=e||{},o=n.inject("config",n.reactive(Object.assign({},je))),r=n.inject("maxSlide",n.ref(1)),l=n.inject("minSlide",n.ref(1)),d=n.inject("currentSlide",n.ref(1)),c=n.inject("nav",{}),{dir:h,wrapAround:u,i18n:f}=o,p=h==="rtl",m=n.h("button",{type:"button",class:["carousel__prev",!u&&d.value<=l.value&&"carousel__prev--disabled",t==null?void 0:t.class],"aria-label":f.ariaPreviousSlide,onClick:c.prev},(i==null?void 0:i())||n.h(Vo,{name:p?"arrowRight":"arrowLeft"})),g=n.h("button",{type:"button",class:["carousel__next",!u&&d.value>=r.value&&"carousel__next--disabled",t==null?void 0:t.class],"aria-label":f.ariaNextSlide,onClick:c.next},(a==null?void 0:a())||n.h(Vo,{name:p?"arrowLeft":"arrowRight"}));return[m,g]};var jk=n.defineComponent({name:"CarouselSlide",props:{index:{type:Number,default:1},isClone:{type:Boolean,default:!1}},setup(s,{slots:e}){const t=n.inject("config",n.reactive(Object.assign({},je))),a=n.inject("currentSlide",n.ref(0)),i=n.inject("slidesToScroll",n.ref(0)),o=n.inject("isSliding",n.ref(!1)),r=n.computed(()=>s.index===a.value),l=n.computed(()=>s.index===a.value-1),d=n.computed(()=>s.index===a.value+1),c=n.computed(()=>{const h=Math.floor(i.value),u=Math.ceil(i.value+t.itemsToShow-1);return s.index>=h&&s.index<=u});return()=>{var h;return n.h("li",{style:{width:`${100/t.itemsToShow}%`},class:{carousel__slide:!0,"carousel__slide--clone":s.isClone,"carousel__slide--visible":c.value,"carousel__slide--active":r.value,"carousel__slide--prev":l.value,"carousel__slide--next":d.value,"carousel__slide--sliding":o.value},"aria-hidden":!c.value},(h=e.default)===null||h===void 0?void 0:h.call(e,{isActive:r.value,isClone:s.isClone,isPrev:l.value,isNext:d.value,isSliding:o.value,isVisible:c.value}))}}});const Lt=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t},Hk={__name:"MatchDay",props:{isLandingMode:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#183143"},numberColor:{type:String,default:"white"},numberFontFamily:{type:String,default:"sans-serif"},numberFontSize:{type:String,default:"14px"},textColor:{type:String,default:"rgba(255, 255, 255, 0.5)"},textFontFamily:{type:String,default:"'Poppins-Regular', sans-serif"},textFontSize:{type:String,default:"8px"},bottomLineColor:{type:String,default:"#cbee6b"},selectedMatchDayBackgroundColor:{type:String,default:"#243b4c"},height:{type:String,default:"fit-content"},matchDay:{type:Object,default:()=>{}},matchDaySelected:{type:Object,default:()=>{}},componentWidth:{type:Number,default:0}},emits:["change-match-day"],setup(s,{emit:e}){const t=s,a=n.computed(()=>{const l={"background-color":t.backgroundColor,height:t.height};return t.matchDay.key===t.matchDaySelected.key&&(l["border-bottom"]=`solid 1px ${t.bottomLineColor}`,l["background-color"]=t.selectedMatchDayBackgroundColor),t.isLandingMode||(l["border-right"]="solid 1px rgba(255, 255, 255, 0.1)"),l}),i=n.computed(()=>({color:t.numberColor,"font-family":t.numberFontFamily,"font-size":t.numberFontSize})),o=n.computed(()=>({color:t.textColor,"font-family":t.textFontFamily,"font-size":t.textFontSize}));function r(l){e("click-match-day",l)}return(l,d)=>(n.openBlock(),n.createElementBlock("div",{class:"match-day",style:n.normalizeStyle({...a.value}),onClick:d[0]||(d[0]=c=>r(s.matchDay))},[n.createElementVNode("div",{class:"match-day__value",style:n.normalizeStyle(i.value)},n.toDisplayString(s.matchDay.valueText),5),Number.isNaN(s.matchDay.value)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:"match-day__text",style:n.normalizeStyle([s.isLandingMode?"margin-top:3px":"margin-top:4px",o.value])},n.toDisplayString(s.isLandingMode||s.componentWidth<=425?"JOR":"JORNADA"),5))],4))}},Wk=Lt(Hk,[["__scopeId","data-v-687d929a"]]),Kk={__name:"MatchDayPicker",props:{matchDays:{type:Array,default:()=>[]},isLandingMode:{type:Boolean,default:!1},backgroundColor:{type:String,default:"#183143"},numberColor:{type:String,default:"white"},numberFontFamily:{type:String,default:"sans-serif"},numberFontSize:{type:String,default:"14px"},textColor:{type:String,default:"rgba(255, 255, 255, 0.5)"},textFontFamily:{type:String,default:"sans-serif"},textFontSize:{type:String,default:"8px"},bottomLineColor:{type:String,default:"#cbee6b"},selectedMatchDayBackgroundColor:{type:String,default:"#243b4c"},height:{type:String,default:"fit-content"},itemsToShow:{type:Number,default:9},itemsToScroll:{type:Number,default:9},defaultMatchDayKey:{type:[String,null],default:""},componentWidth:{type:Number,default:0},closestMatchDay:{type:[Number,String],default:0}},emits:["change-match-day"],setup(s,{emit:e}){const t=s;n.useCssVars(c=>({"26769adc":o.value,"2678c95c":r.value}));const a=n.ref(null),i=n.computed(()=>({itemsToShow:t.itemsToShow,itemsToScroll:t.itemsToScroll,snapAlign:"start"})),o=n.computed(()=>a.value.data.currentSlide.value==0?"none":"inline"),r=n.computed(()=>a.value.data.currentSlide.value==a.value.data.maxSlide.value?"none":"inline"),l=n.ref({});n.watch(()=>t.closestMatchDay,c=>{if(c){const h=t.matchDays.find(u=>u.key===c);d(h||t.matchDays[0],!0)}}),n.watch(()=>t.matchDays,c=>{if(!t.closestMatchDay&&c&&c.length){const h=c.find(u=>u.key===t.defaultMatchDayKey);l.value=h||c[0],e("change-match-day",l.value)}else t.closestMatchDay&&(l.value=c.find(h=>h.key===t.closestMatchDay)||{})},{immediate:!0});function d(c,h=!1){h&&a.value&&a.value.slideTo(c.index),l.value=c,e("change-match-day",l.value)}return(c,h)=>(n.openBlock(),n.createElementBlock("div",{class:"match-day-picker",style:n.normalizeStyle(s.isLandingMode?"border-top-left-radius: 9px; border-top-right-radius: 9px;":"margin-bottom:12px")},[n.createVNode(n.unref(Vk),n.mergeProps(i.value,{ref_key:"matchDayPickerCarousel",ref:a}),{addons:n.withCtx(()=>[n.createVNode(n.unref(Gk))]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.matchDays,u=>(n.openBlock(),n.createBlock(n.unref(jk),{key:u.key},{default:n.withCtx(()=>[n.createVNode(Wk,n.mergeProps(t,{"match-day":u,"match-day-selected":l.value,"is-landing-mode":s.isLandingMode,"component-width":s.componentWidth,onClickMatchDay:d}),null,16,["match-day","match-day-selected","is-landing-mode","component-width"])]),_:2},1024))),128))]),_:1},16)],4))}},qk=Lt(Kk,[["__scopeId","data-v-1621f164"]]);function Ns(s,e=80){return`${{}.TEAM_LOGOS_URL||"https://az755631.vo.msecnd.net/teams-"}${e}/${s}.png`}function Bh(s){if(typeof s=="string"){let e=s.replace("M","J ");return e=e.replace("PO1","CFI"),e=e.replace("PO2","CFV"),e=e.replace("PO3","SFI"),e=e.replace("PO4","SFV"),e=e.replace("PO5","FI"),e=e.replace("PO6","FV"),e}}function Yk(s){let e="";return s.game_status!=4&&(e+="Finalizado"),(s.penalties_score_home_team!=0||s.penalties_score_visiting_team!=0)&&(e+=" - Penales "+s.penalties_score_home_team+" - "+s.penalties_score_visiting_team),e}const Jk={class:"game-info__teams"},Xk={class:"game-info__teams__team__logo"},Zk=["src"],Qk={class:"game-info__teams__detail"},eE={key:0,class:"game-info__teams__detail__pre-game"},tE={class:"game-info__teams__team__logo away"},sE=["src"],aE={key:0},nE={key:0},iE={key:1},oE={__name:"GameInfo",props:{isLandingMode:{type:Boolean,default:!1},isAcronymVisible:{type:Boolean,default:!1},isTelevisionVisible:{type:Boolean,default:!0},game:{type:Object,required:!0},colorPrimary:{type:String,default:"white"},colorSecondary:{type:String,default:"grey"},namesFontSize:{type:String,default:"12px"},timeFontSize:{type:String,default:"12px"},timeZoneFontSize:{type:String,default:"8px"},scoreFontSize:{type:String,default:"13px"},namesFontFamily:{type:String,default:"sans-serif"},scoreFontFamily:{type:String,default:"sans-serif"},additionalInfoFontFamily:{type:String,default:"sans-serif"},additionalInfoFontSize:{type:String,default:"9px"}},setup(s){const e=s,t=n.computed(()=>{let c=e.game.schedule.split(":");return c.pop(),c=c.join(":"),c}),a=n.computed(()=>{let c="120px";return(e.isLandingMode||e.isAcronymVisible)&&(c="70px"),{"min-width":c}}),i=n.computed(()=>({"font-size":e.namesFontSize,"font-family":e.namesFontFamily,color:e.colorPrimary})),o=n.computed(()=>({"font-size":e.additionalInfoFontSize,"font-family":e.additionalInfoFontFamily,color:e.colorSecondary})),r=n.computed(()=>({"font-size":e.scoreFontSize,"font-family":e.scoreFontFamily,color:e.colorPrimary})),l=n.computed(()=>({"font-size":e.timeZoneFontSize,"font-family":e.namesFontFamily,color:e.colorPrimary})),d=n.computed(()=>({"font-size":e.timeFontSize,"font-family":e.namesFontFamily,color:e.colorPrimary}));return(c,h)=>(n.openBlock(),n.createElementBlock("div",{class:"game-info",style:n.normalizeStyle(s.isLandingMode?"gap:5px":"")},[n.createElementVNode("div",Jk,[n.createElementVNode("div",{class:"game-info__teams__team",style:n.normalizeStyle(a.value)},[n.createElementVNode("div",{class:"game-info__teams__team__name",style:n.normalizeStyle(i.value)},n.toDisplayString(s.isLandingMode||s.isAcronymVisible?s.game.home_team.acronym:s.game.home_team.colloquial_name),5),n.createElementVNode("div",Xk,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.home_team.team_id),alt:""},null,8,Zk)])],4),n.createElementVNode("div",Qk,[s.game.game_status===4&&!s.game.is_live?(n.openBlock(),n.createElementBlock("div",eE,[n.createElementVNode("div",null,[n.createElementVNode("span",{style:n.normalizeStyle(d.value)},n.toDisplayString(t.value),5),n.createTextVNode(),n.createElementVNode("span",{style:n.normalizeStyle(l.value)},"CST",4)])])):(n.openBlock(),n.createElementBlock("div",{key:1,class:"game-info__teams__detail__score",style:n.normalizeStyle(r.value)},[n.createElementVNode("span",null,n.toDisplayString(s.game.score[0])+" - "+n.toDisplayString(s.game.score[1]),1)],4))]),n.createElementVNode("div",{class:"game-info__teams__team away",style:n.normalizeStyle(a.value)},[n.createElementVNode("div",tE,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.visiting_team.team_id),alt:""},null,8,sE)]),n.createElementVNode("div",{class:"game-info__teams__team__name",style:n.normalizeStyle(i.value)},n.toDisplayString(s.isLandingMode||s.isAcronymVisible?s.game.visiting_team.acronym:s.game.visiting_team.colloquial_name),5)],4)]),n.createElementVNode("div",{class:"game-info__status",style:n.normalizeStyle([o.value,s.isLandingMode?"line-height: normal":""])},[s.game.game_status===4&&!s.game.is_live?(n.openBlock(),n.createElementBlock("span",aE,[s.isTelevisionVisible?(n.openBlock(),n.createElementBlock("span",nE,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)])):(n.openBlock(),n.createElementBlock("span",iE,n.toDisplayString(n.unref(Yk)(s.game)),1))],4)],4))}},Dh=Lt(oE,[["__scopeId","data-v-a6b3fc44"]]),Ph=s=>(n.pushScopeId("data-v-e2fc9ed0"),s=s(),n.popScopeId(),s),rE={class:"game-status"},lE={key:0,class:"game-status__day__live"},cE=Ph(()=>n.createElementVNode("span",null,"LIVE",-1)),dE=Ph(()=>n.createElementVNode("span",{class:"dot"},null,-1)),hE=[cE,dE],uE={key:0,class:"game-status__round"},mE={__name:"GameStatus",props:{isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},status:{type:Number,default:4},isLive:{type:Boolean,default:!1},dateTimeMillis:{type:Number,default:0},roundAbbreviation:{type:String,default:""},fontSize:{type:String,default:"10px"}},setup(s){const e=s,t=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],a=n.computed(()=>{let r="";if(e.dateTimeMillis){const l=new Date(e.dateTimeMillis);r=`${l.getDate()} ${t[l.getMonth()]}`}return r}),i=n.computed(()=>({"font-size":e.fontSize})),o=n.computed(()=>{let r=[];return e.isLive?r.push("live"):e.status!==1&&r.push("pre-match"),r});return(r,l)=>(n.openBlock(),n.createElementBlock("div",rE,[n.createElementVNode("div",{class:n.normalizeClass(["game-status__day",o.value]),style:n.normalizeStyle(i.value)},[s.isLive?(n.openBlock(),n.createElementBlock("div",lE,hE)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(a.value),1)],64))],6),s.isRoundMode?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",uE,n.toDisplayString(s.roundAbbreviation),1))]))}},Oh=Lt(mE,[["__scopeId","data-v-e2fc9ed0"]]),It={SHOW_GAME_EVENTS:"SHOW_GAME_EVENTS",PLAY_GOALS:"PLAY_GOALS",PLAY_RESUME:"PLAY_RESUME",NOTIFICATION:"NOTIFICATION",STATISTICS:"STATISTICS"},fE=s=>(n.pushScopeId("data-v-5711c5a6"),s=s(),n.popScopeId(),s),pE={class:"actions"},gE={class:"actions__row"},yE=fE(()=>n.createElementVNode("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.87471 3.35132C9.31653 3.35132 9.67471 3.70949 9.67471 4.15132V10.4531C9.67471 10.8949 9.31653 11.2531 8.87471 11.2531C8.43288 11.2531 8.07471 10.8949 8.07471 10.4531V4.15132C8.07471 3.70949 8.43288 3.35132 8.87471 3.35132Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.67549 0.199951C5.11732 0.199951 5.47549 0.558123 5.47549 0.999951V10.4526C5.47549 10.8944 5.11732 11.2526 4.67549 11.2526C4.23366 11.2526 3.87549 10.8944 3.87549 10.4526V0.999951C3.87549 0.558123 4.23366 0.199951 4.67549 0.199951Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.0002 5.45154C1.44202 5.45154 1.8002 5.80971 1.8002 6.25154V10.4527C1.8002 10.8945 1.44202 11.2527 1.0002 11.2527C0.558368 11.2527 0.200195 10.8945 0.200195 10.4527V6.25154C0.200195 5.80971 0.558368 5.45154 1.0002 5.45154Z",fill:"#EEEC6B"})],-1)),bE=[yE],SE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wE=["fill"],_E={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},kE=["fill"],EE={__name:"GameActionsLanding",props:{gameStatus:{type:Number,default:4},isLive:{type:Boolean,default:!1},hasVideo:{type:Boolean,default:!1},iconColor:{type:String,default:"#CBEE6B"},iconBackgroundColor:{type:String,default:"rgba(255, 255, 255, 0.2)"},iconBorderColor:{type:String,default:"rgba(255, 255, 255, 0.1)"},showPlayButton:{type:Boolean,default:!1}},emits:["action"],setup(s,{emit:e}){const t=s,a=n.computed(()=>({backgroundColor:t.iconBackgroundColor,borderColor:t.iconBorderColor}));function i(o){e("action",o)}return(o,r)=>(n.openBlock(),n.createElementBlock("div",pE,[n.createElementVNode("div",gE,[n.createElementVNode("div",{class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:r[0]||(r[0]=l=>i(n.unref(It).STATISTICS))},bE,4),s.showPlayButton&&s.hasVideo?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:r[1]||(r[1]=l=>i(n.unref(It).PLAY_RESUME))},[(n.openBlock(),n.createElementBlock("svg",SE,[n.createElementVNode("path",{d:"M0.442694 7.9474C0.385489 7.90953 0.337676 7.85295 0.304408 7.78375C0.27114 7.71456 0.25368 7.63538 0.253908 7.55475V0.444134C0.253987 0.363779 0.271562 0.284951 0.304765 0.216032C0.337968 0.147113 0.385557 0.090677 0.442475 0.0527243C0.499393 0.0147716 0.563511 -0.00327964 0.628014 0.000489552C0.692517 0.00425874 0.754994 0.0297075 0.808803 0.0741304L5.09491 3.62986C5.14387 3.67036 5.18401 3.7253 5.21178 3.78978C5.23955 3.85426 5.25409 3.92628 5.25409 3.99944C5.25409 4.0726 5.23955 4.14462 5.21178 4.2091C5.18401 4.27358 5.14387 4.32852 5.09491 4.36902L0.808803 7.92559C0.755077 7.97011 0.692648 7.99565 0.628173 7.99949C0.563698 8.00333 0.499593 7.98533 0.442694 7.9474Z",fill:t.iconColor},null,8,wE)]))],4)):n.createCommentVNode("",!0),s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:1,class:"actions__button",onClick:r[2]||(r[2]=l=>i(n.unref(It).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",_E,[n.createElementVNode("path",{d:"M5.056 14.476h2.888c0 .838-.65 1.524-1.444 1.524-.794 0-1.444-.686-1.444-1.524zM13 12.952v.762H0v-.762l1.444-1.523V6.857c0-2.362 1.445-4.419 3.612-5.105v-.228C5.056.686 5.706 0 6.5 0c.794 0 1.444.686 1.444 1.524v.228c2.167.686 3.612 2.743 3.612 5.105v4.572L13 12.952zm-2.889-6.095c0-2.133-1.589-3.81-3.611-3.81-2.022 0-3.611 1.677-3.611 3.81v5.333h7.222V6.857z",fill:t.iconColor},null,8,kE)]))])):n.createCommentVNode("",!0)])]))}},TE=Lt(EE,[["__scopeId","data-v-5711c5a6"]]),Uo=s=>(n.pushScopeId("data-v-d64f8667"),s=s(),n.popScopeId(),s),CE={class:"actions"},xE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},vE=["fill"],AE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},LE=["fill"],IE=Uo(()=>n.createElementVNode("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.87471 3.35132C9.31653 3.35132 9.67471 3.70949 9.67471 4.15132V10.4531C9.67471 10.8949 9.31653 11.2531 8.87471 11.2531C8.43288 11.2531 8.07471 10.8949 8.07471 10.4531V4.15132C8.07471 3.70949 8.43288 3.35132 8.87471 3.35132Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.67549 0.199951C5.11732 0.199951 5.47549 0.558123 5.47549 0.999951V10.4526C5.47549 10.8944 5.11732 11.2526 4.67549 11.2526C4.23366 11.2526 3.87549 10.8944 3.87549 10.4526V0.999951C3.87549 0.558123 4.23366 0.199951 4.67549 0.199951Z",fill:"#EEEC6B"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.0002 5.45154C1.44202 5.45154 1.8002 5.80971 1.8002 6.25154V10.4527C1.8002 10.8945 1.44202 11.2527 1.0002 11.2527C0.558368 11.2527 0.200195 10.8945 0.200195 10.4527V6.25154C0.200195 5.80971 0.558368 5.45154 1.0002 5.45154Z",fill:"#EEEC6B"})],-1)),RE=[IE],NE={key:0,class:"actions__videos"},BE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},DE=["fill"],PE={key:1,class:"actions__videos__thumbnails"},OE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__goals"},null,-1)),FE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__summary"},null,-1)),ME={height:24,width:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},$E=["stroke"],VE={__name:"GameActionsFull",props:{gameStatus:{type:Number,default:4},isLive:{type:Boolean,default:!1},hasVideo:{type:Boolean,default:!1},hasActions:{type:Boolean,default:!0},hasGoals:{type:Boolean,default:!0},areEventsVisible:{type:Boolean,default:!1},iconColor:{type:String,default:"#CBEE6B"},iconBackgroundColor:{type:String,default:"rgba(255, 255, 255, 0.2)"},iconBorderColor:{type:String,default:"rgba(255, 255, 255, 0.1)"},showPlayButton:{type:Boolean,default:!1},arrowColor:{type:String,default:"white"},thumbnailFontFamily:{type:String,default:"sans-serif"},thumbnailFontSize:{type:String,default:"8px"},thumbnailColor:{type:String,default:"rgba(255, 255, 255, 0.5)"},componentWidth:{type:Number,default:400,validator(s){return s>0}}},emits:["action"],setup(s,{emit:e}){const t=s,a=n.computed(()=>({backgroundColor:t.iconBackgroundColor,borderColor:t.iconBorderColor})),i=n.computed(()=>{const d=[];return t.componentWidth<540&&d.push("mobile"),d}),o=n.computed(()=>t.componentWidth>730),r=n.computed(()=>({color:t.thumbnailColor,fontFamily:t.thumbnailFontFamily,fontSize:t.thumbnailFontSize}));function l(d){e("action",d)}return(d,c)=>(n.openBlock(),n.createElementBlock("div",CE,[n.createElementVNode("div",{class:n.normalizeClass(["actions__buttons",i.value])},[s.gameStatus===4444&&!s.isLive&&!o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button",onClick:c[0]||(c[0]=h=>l(n.unref(It).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",xE,[n.createElementVNode("path",{d:"M5.056 14.476h2.888c0 .838-.65 1.524-1.444 1.524-.794 0-1.444-.686-1.444-1.524zM13 12.952v.762H0v-.762l1.444-1.523V6.857c0-2.362 1.445-4.419 3.612-5.105v-.228C5.056.686 5.706 0 6.5 0c.794 0 1.444.686 1.444 1.524v.228c2.167.686 3.612 2.743 3.612 5.105v4.572L13 12.952zm-2.889-6.095c0-2.133-1.589-3.81-3.611-3.81-2.022 0-3.611 1.677-3.611 3.81v5.333h7.222V6.857z",fill:t.iconColor},null,8,vE)]))])):n.createCommentVNode("",!0),s.showPlayButton&&s.hasVideo&&!o.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:c[1]||(c[1]=h=>l(n.unref(It).PLAY_RESUME))},[(n.openBlock(),n.createElementBlock("svg",AE,[n.createElementVNode("path",{d:"M0.442694 7.9474C0.385489 7.90953 0.337676 7.85295 0.304408 7.78375C0.27114 7.71456 0.25368 7.63538 0.253908 7.55475V0.444134C0.253987 0.363779 0.271562 0.284951 0.304765 0.216032C0.337968 0.147113 0.385557 0.090677 0.442475 0.0527243C0.499393 0.0147716 0.563511 -0.00327964 0.628014 0.000489552C0.692517 0.00425874 0.754994 0.0297075 0.808803 0.0741304L5.09491 3.62986C5.14387 3.67036 5.18401 3.7253 5.21178 3.78978C5.23955 3.85426 5.25409 3.92628 5.25409 3.99944C5.25409 4.0726 5.23955 4.14462 5.21178 4.2091C5.18401 4.27358 5.14387 4.32852 5.09491 4.36902L0.808803 7.92559C0.755077 7.97011 0.692648 7.99565 0.628173 7.99949C0.563698 8.00333 0.499593 7.98533 0.442694 7.9474Z",fill:t.iconColor},null,8,LE)]))],4)):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:c[2]||(c[2]=h=>l(n.unref(It).STATISTICS))},RE,4)],2),o.value?(n.openBlock(),n.createElementBlock("div",NE,[s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button",onClick:c[3]||(c[3]=h=>l(n.unref(It).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",BE,[n.createElementVNode("path",{d:"M5.056 14.476h2.888c0 .838-.65 1.524-1.444 1.524-.794 0-1.444-.686-1.444-1.524zM13 12.952v.762H0v-.762l1.444-1.523V6.857c0-2.362 1.445-4.419 3.612-5.105v-.228C5.056.686 5.706 0 6.5 0c.794 0 1.444.686 1.444 1.524v.228c2.167.686 3.612 2.743 3.612 5.105v4.572L13 12.952zm-2.889-6.095c0-2.133-1.589-3.81-3.611-3.81-2.022 0-3.611 1.677-3.611 3.81v5.333h7.222V6.857z",fill:t.iconColor},null,8,DE)]))])):n.createCommentVNode("",!0),s.showPlayButton&&s.hasVideo?(n.openBlock(),n.createElementBlock("div",PE,[s.hasGoals?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__videos__thumbnails__thumbnail",onClick:c[4]||(c[4]=h=>l(n.unref(It).PLAY_GOALS))},[OE,n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__text",style:n.normalizeStyle(r.value)}," Goles ",4)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail",onClick:c[5]||(c[5]=h=>l(n.unref(It).PLAY_RESUME))},[FE,n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__text",style:n.normalizeStyle(r.value)}," Resumen ",4)])])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),(s.gameStatus!==4||s.isLive)&&s.hasActions?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["actions__button expand",{"rotated-180":s.areEventsVisible,mobile:s.componentWidth<540}]),onClick:c[6]||(c[6]=h=>l(n.unref(It).SHOW_GAME_EVENTS))},[(n.openBlock(),n.createElementBlock("svg",ME,[n.createElementVNode("path",{d:"M18.394 9.13501L13.1302 14.3988C12.5086 15.0204 11.4914 15.0204 10.8697 14.3988L5.60596 9.13501",stroke:s.arrowColor},null,8,$E)]))],2)):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["actions__button expand",{"rotated-180":!1,mobile:s.componentWidth<540}])},null,2))]))}},UE=Lt(VE,[["__scopeId","data-v-d64f8667"]]),cn=s=>(n.pushScopeId("data-v-2968a2f6"),s=s(),n.popScopeId(),s),zE={class:"row-landing__game-status"},GE={class:"row-landing__game-actions"},jE={class:"row-full__game-status"},HE={class:"row-full__game-info"},WE={key:0},KE={class:"row-full__game-actions"},qE={class:"game-events-container"},YE=cn(()=>n.createElementVNode("div",{class:"separator"},null,-1)),JE=cn(()=>n.createElementVNode("div",null,null,-1)),XE={class:"game-events__data"},ZE={class:"game-events__data__team"},QE=["src"],eT={class:"game-events__data__team__event__text"},tT={class:"game-events__data__team away"},sT={class:"game-events__data__team__event__text"},aT=["src"],nT=cn(()=>n.createElementVNode("div",null,null,-1)),iT=cn(()=>n.createElementVNode("div",null,null,-1)),oT={__name:"CalendarRow",props:{teamId:{type:Number,default:0},showVideos:{type:Number,default:0},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},game:{type:Object,required:!0},height:{type:String,default:"fit-content"},backgroundColor:{type:String,default:"#172531"},showPlayButton:{type:Boolean,default:!1},componentWidth:{type:Number,default:400,validator(s){return s>0}},televisionFontSize:{type:String,default:"12px"},televisionFontFamily:{type:String,default:"sans-serif"},televisionColor:{type:String,default:"rgba(255, 255, 255, 0.5)"}},emits:["action"],setup(s,{emit:e}){const t=s,a={GOAL:{}.GAME_EVENTS_ICONS_GOAL||"/icn-gol.svg",RED_CARD:{}.GAME_EVENTS_ICONS_RED_CARD||"/icn-expulsion.svg",YELLOW_CARD:{}.GAME_EVENTS_ICONS_YELLOW_CARD||"/icn-amarilla.svg"},i=n.ref(!1),o=n.ref(!1),r=n.computed(()=>{const y={homeTeam:[],awayTeam:[]};return t.game&&t.game.game_status!==4&&!t.game.is_live&&t.game.minutes&&(y.homeTeam.push(...m(t.game.minutes.home_goals_minutes,a.GOAL)),y.homeTeam.push(...m(t.game.minutes.home_red_cards_minutes,a.RED_CARD)),y.homeTeam.push(...m(t.game.minutes.home_yellow_cards_minutes,a.YELLOW_CARD)),y.awayTeam.push(...m(t.game.minutes.visiting_goals_minutes,a.GOAL)),y.awayTeam.push(...m(t.game.minutes.away_red_cards_minutes,a.RED_CARD)),y.awayTeam.push(...m(t.game.minutes.away_yellow_cards_minutes,a.YELLOW_CARD))),y}),l=n.computed(()=>{const y=r.value.homeTeam.length,b=r.value.awayTeam.length;return y+b>0}),d=n.computed(()=>{const y=t.game.score[0],b=t.game.score[1];return y>0||b>0}),c=n.computed(()=>({"background-color":t.backgroundColor})),h=n.computed(()=>({height:t.height})),u=n.computed(()=>{const y={game:[],events:[]};return t.componentWidth<500?(y.events.push("break-point-3"),y.game.push("break-point-2")):t.componentWidth<730?(y.game.push("break-point-2"),y.events.push("break-point-2")):t.componentWidth<910&&(y.game.push("break-point-1"),y.events.push("break-point-1")),y}),f=n.computed(()=>({isLandingMode:t.isLandingMode,game:t.game,colorPrimary:"#fff",colorSecondary:"#fff",namesFontSize:"12px",timeFontSize:"12px",timeZoneFontSize:"8px",scoreFontSize:"13px",namesFontFamily:"sans-serif",scoreFontFamily:"sans-serif",additionalInfoFontFamily:"sans-serif",additionalInfoFontSize:"9px"})),p=n.computed(()=>({"font-size":t.televisionFontSize,"font-family":t.televisionFontFamily,color:t.televisionColor}));n.watch(()=>t.componentWidth,y=>{o.value=y<910});function m(y,b){return y.map(S=>({iconUrl:b,text:S}))}function g(y){y===It.SHOW_GAME_EVENTS?i.value=!i.value:e("action",{action:y,game:t.game})}return(y,b)=>s.isLandingMode?(n.openBlock(),n.createElementBlock("div",{key:0,class:"row-landing",style:n.normalizeStyle(c.value)},[n.createVNode(Dh,{game:s.game,"is-landing-mode":s.isLandingMode},null,8,["game","is-landing-mode"]),n.createElementVNode("div",zE,[n.createVNode(Oh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Bh)(s.game.matchday_abbreviation),"is-landing-mode":s.isLandingMode,"is-round-mode":s.isRoundMode,"font-size":"10px"},null,8,["status","is-live","date-time-millis","round-abbreviation","is-landing-mode","is-round-mode"])]),n.createElementVNode("div",GE,[s.game.home_team?(n.openBlock(),n.createBlock(TE,{key:0,"is-live":!!s.game.is_live,"has-video":s.showVideos==0||s.showVideos==1&&s.teamId==s.game.home_team.team_id?!!s.game.has_video:!1,"game-status":s.game.game_status,"show-play-button":!0,onAction:g},null,8,["is-live","has-video","game-status"])):n.createCommentVNode("",!0)])],4)):(n.openBlock(),n.createElementBlock("div",{key:1,class:"row-full-container",style:n.normalizeStyle(c.value)},[n.createElementVNode("div",{class:n.normalizeClass(["row-full",u.value.game]),style:n.normalizeStyle(h.value)},[n.createElementVNode("div",jE,[n.createVNode(Oh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Bh)(s.game.matchday_abbreviation),"is-landing-mode":s.isLandingMode,"is-round-mode":s.isRoundMode,"font-size":"10px"},null,8,["status","is-live","date-time-millis","round-abbreviation","is-landing-mode","is-round-mode"])]),n.createElementVNode("div",HE,[n.createVNode(Dh,n.mergeProps(f.value,{"is-television-visible":o.value,game:s.game,"is-landing-mode":s.isLandingMode,"is-acronym-visible":s.componentWidth<540}),null,16,["is-television-visible","game","is-landing-mode","is-acronym-visible"])]),s.componentWidth>=910?(n.openBlock(),n.createElementBlock("div",{key:0,class:"row-full__television",style:n.normalizeStyle(p.value)},[!o.value&&(s.game.game_status===4||s.game.is_live)?(n.openBlock(),n.createElementBlock("span",WE,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0),n.createElementVNode("div",KE,[s.game.home_team?(n.openBlock(),n.createBlock(UE,{key:0,"is-live":!!s.game.is_live,"has-video":s.showVideos==0||s.showVideos==1&&s.teamId==s.game.home_team.team_id?!!s.game.has_video:!1,"has-actions":l.value,"has-goals":s.showVideos==0||s.showVideos==1&&s.teamId==s.game.home_team.team_id?d.value:!1,"game-status":s.game.game_status,"show-play-button":!0,"are-events-visible":i.value,"component-width":s.componentWidth,onAction:g},null,8,["is-live","has-video","has-actions","has-goals","game-status","are-events-visible","component-width"])):n.createCommentVNode("",!0)])],6),n.createVNode(n.Transition,null,{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",qE,[YE,n.createElementVNode("div",{class:n.normalizeClass(["game-events",u.value.events])},[JE,n.createElementVNode("div",XE,[n.createElementVNode("div",ZE,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.homeTeam,(S,_)=>(n.openBlock(),n.createElementBlock("div",{key:`h${_}`,class:"game-events__data__team__event"},[n.createElementVNode("img",{src:S.iconUrl},null,8,QE),n.createElementVNode("div",eT,n.toDisplayString(S.text),1)]))),128))]),n.createElementVNode("div",tT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.awayTeam,(S,_)=>(n.openBlock(),n.createElementBlock("div",{key:`a${_}`,class:"game-events__data__team__event"},[n.createElementVNode("div",sT,n.toDisplayString(S.text),1),n.createElementVNode("img",{src:S.iconUrl},null,8,aT)]))),128))])]),nT,iT],2)],512),[[n.vShow,i.value]])]),_:1})],4))}},Fh=Lt(oT,[["__scopeId","data-v-2968a2f6"]]),rT={class:"calendar-table"},lT={__name:"CalendarTable",props:{teamId:{type:Number,default:0},showVideos:{type:Number,default:0},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},gamesPerPage:{type:Array,default:()=>[]},rowHeight:{type:String,default:"fit-content"},oddRowColor:{type:String,default:"#172531"},evenRowColor:{type:String,default:"#0D1D29"},componentWidth:{type:Number,default:400,validator(s){return s>0}}},emits:["action"],setup(s,{emit:e}){const t=s;function a(o){return o%2===0?t.evenRowColor:t.oddRowColor}function i(o){e("action",o)}return(o,r)=>(n.openBlock(),n.createElementBlock("div",rT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.gamesPerPage,(l,d)=>(n.openBlock(),n.createBlock(Fh,{key:l.game_id,game:l,"team-id":s.teamId,"show-videos":s.showVideos,"is-landing-mode":s.isLandingMode,height:s.rowHeight,"background-color":a(d),"component-width":s.componentWidth,"is-round-mode":s.isRoundMode,onAction:i},null,8,["game","team-id","show-videos","is-landing-mode","height","background-color","component-width","is-round-mode"]))),128))]))}},cT=Lt(lT,[["__scopeId","data-v-c7bf1232"]]),dT={class:"calendar-by-team"},hT={class:"playing-as-picker"},uT={class:"calendar-by-team__page"},mT={__name:"CalendarTableByTeam",props:{showVideos:{type:Number,default:0},teamId:{type:Number,default:0},isPaginationVisible:{type:Boolean,default:!0},gamesPages:{type:Map,default:()=>new Map},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},rowHeight:{type:String,default:"fit-content"},nameRowColor:{type:String,default:"#172531"},gameRowColor:{type:String,default:"#0D1D29"},componentWidth:{type:Number,default:400,validator(s){return s>0}}},emits:["action"],setup(s,{emit:e}){const t=s,a=n.ref(0),i=n.computed(()=>{let d=[];if(t.gamesPages.size>0){const c=Array.from(t.gamesPages.entries()).reduce((h,[u,f])=>{const p=Number(u),m=Number.isNaN(p)?u:`Jornada ${p<10?"0":""}${p}`,g=f.reduce((y,b)=>(y.push(...b),y),[]).filter(y=>a.value===0||a.value===1&&y.visiting_team.team_id===t.teamId?!0:a.value===2&&y.home_team.team_id===t.teamId);return g.length>0&&h.push({roundName:m,games:g}),h},[]);d.push(c)}return d});function o(d){e("action",d)}function r(d){document.querySelector("#opc0").classList.remove("selected"),document.querySelector("#opc1").classList.remove("selected"),document.querySelector("#opc2").classList.remove("selected"),a.value=d,document.querySelector("#opc"+d).classList.add("selected")}function l(d){let c=d;switch(d){case"PI1":c="Play In 1";break;case"PI2":c="Play In 2";break;case"R1":c="Repechaje";break;case"CFI":c="Cuartos de final - Ida";break;case"CFV":c="Cuartos de final - Vuelta";break;case"SFI":c="Semifinal - Ida";break;case"SFV":c="Semifinal - Vuelta";break;case"FI":c="Final - Ida";break;case"FV":c="Final - Vuelta";break}return c}return(d,c)=>(n.openBlock(),n.createElementBlock("div",dT,[n.createElementVNode("div",hT,[n.createElementVNode("div",{class:"playing-as-picker__type selected",id:"opc0",onClick:c[0]||(c[0]=h=>r(0))}," Todas "),n.createElementVNode("div",{class:"playing-as-picker__type",id:"opc1",onClick:c[1]||(c[1]=h=>r(1))},"Visitante"),n.createElementVNode("div",{class:"playing-as-picker__type",id:"opc2",onClick:c[2]||(c[2]=h=>r(2))},"Local")]),n.createVNode(n.unref(Ih),{"is-pagination-visible":s.isPaginationVisible,items:i.value},{default:n.withCtx(({item:h})=>[n.createElementVNode("div",uT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h,(u,f)=>(n.openBlock(),n.createElementBlock("div",{key:f,class:"calendar-by-team__page__round"},[n.createElementVNode("div",{class:"calendar-by-team__page__round__round-name",style:n.normalizeStyle([{color:"white"},s.componentWidth<=425?"padding: 5px 10px":""])},n.toDisplayString(l(u.roundName)),5),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.games,p=>(n.openBlock(),n.createBlock(Fh,{key:p.game_id,game:p,"team-id":s.teamId,"show-videos":s.showVideos,"is-landing-mode":s.isLandingMode,height:s.rowHeight,"background-color":s.gameRowColor,"component-width":s.componentWidth,"is-round-mode":s.isRoundMode,onAction:o},null,8,["game","team-id","show-videos","is-landing-mode","height","background-color","component-width","is-round-mode"]))),128))]))),128))])]),_:1},8,["is-pagination-visible","items"])]))}},fT=Lt(mT,[["__scopeId","data-v-6e0e406c"]]),pT="_liveMinutes_1utnm_2",gT="_viewButtomEvent_1utnm_6",yT="_containerEvents_1utnm_20",bT="_sepEvents_1utnm_26",ST="_goalsContainer_1utnm_36",wT="_yellowContainer_1utnm_44",_T="_redContainer_1utnm_52",kT="_containerEventsGameHometeam_1utnm_60",ET="_containerEventsGameAwayteam_1utnm_73",TT="_image62Icon_1utnm_86",CT="_imgChivasIcon_1utnm_95",xT="_nameDesktop_1utnm_102",vT="_nameMobile_1utnm_115",AT="_homeTeam_1utnm_127",LT="_sbado16De_1utnm_138",IT="_gameDate_1utnm_147",RT="_sab16092023_1utnm_151",NT="_div_1utnm_164",BT="_divscore_1utnm_173",DT="_cst_1utnm_183",PT="_hour_1utnm_192",OT="_score_1utnm_193",FT="_chivasTvCanal_1utnm_204",MT="_gameStatus_1utnm_216",$T="_matchInfo_1utnm_227",VT="_image62Icon1_1utnm_241",UT="_name_1utnm_102",zT="_imgAtlasIcon_1utnm_263",GT="_name1_1utnm_270",jT="_awayTeam_1utnm_282",HT="_matchCard_1utnm_293",WT={liveMinutes:pT,viewButtomEvent:gT,containerEvents:yT,sepEvents:bT,goalsContainer:ST,yellowContainer:wT,redContainer:_T,containerEventsGameHometeam:kT,containerEventsGameAwayteam:ET,image62Icon:TT,imgChivasIcon:CT,nameDesktop:xT,nameMobile:vT,homeTeam:AT,sbado16De:LT,gameDate:IT,sab16092023:RT,div:NT,divscore:BT,cst:DT,hour:PT,score:OT,chivasTvCanal:FT,gameStatus:MT,matchInfo:$T,image62Icon1:VT,name:UT,imgAtlasIcon:zT,name1:GT,awayTeam:jT,matchCard:HT},KT=["src"],qT=["src"],YT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),JT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),XT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),ZT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),QT=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),eC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),tC=n.createElementVNode("img",{src:"http://golstatsimages.blob.core.windows.net/todoelfut/point-indicador-live.png"},null,-1),sC={key:0},aC=n.createElementVNode("div",null,"ver eventos",-1),nC=n.createElementVNode("img",{width:"13",style:{"margin-top":"1px"},src:"http://golstatsimages.blob.core.windows.net/todoelfut/arrow-live-down.png"},null,-1),iC=["src"],oC=["src"],rC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},lC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},cC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},dC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),hC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),uC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),mC={__name:"CardPreMatch",props:{game:{type:Object,default:()=>{}},playsLive:{type:Object,default:()=>{}},is_captured:{type:Number,default:1},infoLive:{type:Object,default:()=>{}}},emits:["open-modal-event"],setup(s,{emit:e}){const t=s,a=new Map([[1,45],[2,90],[3,105],[4,120]]),i=n.computed(()=>{const h=a.get(t.infoLive.recent_lapse);return h&&h<t.infoLive.minute?`${h}' + ${t.infoLive.minute-h}'`:`${t.infoLive.minute}'`}),o=n.computed(()=>{let h=0,u=0,f=!1;var p=!1;return Object.keys(t.infoLive).includes("score")&&(t.infoLive.score["own_"+t.game.home_team.team_id]!=null&&t.infoLive.score["own_"+t.game.home_team.team_id]!=0&&(p=!0),t.infoLive.score["own_"+t.game.visiting_team.team_id]!=null&&t.infoLive.score["own_"+t.game.visiting_team.team_id]!=0&&(f=!0),f?t.infoLive.score[t.game.home_team.team_id]!=null&&(h=parseInt(t.infoLive.score[t.game.home_team.team_id])+parseInt(t.infoLive.score["own_"+t.game.visiting_team.team_id])):t.infoLive.score[t.game.home_team.team_id]!=null&&(h=parseInt(t.infoLive.score[t.game.home_team.team_id])),p?t.infoLive.score[t.game.visiting_team.team_id]!=null&&(u=parseInt(t.infoLive.score[t.game.visiting_team.team_id])+parseInt(t.infoLive.score["own_"+t.game.home_team.team_id])):t.infoLive.score[t.game.visiting_team.team_id]!=null&&(u=parseInt(t.infoLive.score[t.game.visiting_team.team_id]))),h+" - "+u}),r=n.computed(()=>{const h={...t.game};return h.gameSchedule=t.game.schedule.split(":"),h.gameSchedule.pop(),h.gameSchedule=h.gameSchedule.join(":"),h});function l(h){let u=h.split(" "),f=u[u.length-2];return f.includes("+")?u[u.length-3]+"+"+u[u.length-1]:(f=u[u.length-1],f)}function d(h){e("open-modal-event",h)}function c(h,u){const f=new Date(h);if(u==1){const p=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],m=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];return`${p[f.getDay()]} ${f.getDate()} de ${m[f.getMonth()]}`}else return`${f.getDate()}-${f.getMonth()+1}-${f.getFullYear()}`}return(h,u)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(h.$style.matchCard)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.homeTeam),id:"container-home-team"},[n.createElementVNode("img",{class:n.normalizeClass(h.$style.image62Icon),alt:"",src:n.unref(Ns)(r.value.home_team.team_id,150)},null,10,KT),n.createElementVNode("img",{class:n.normalizeClass(h.$style.imgChivasIcon),alt:"",src:n.unref(Ns)(r.value.home_team.team_id)},null,10,qT),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.nameDesktop),id:"team-name"},n.toDisplayString(r.value.home_team.colloquial_name),3),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.nameMobile),id:"team-name"},n.toDisplayString(r.value.home_team.acronym),3),r.value.game_status==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[r.value.is_live==0&&r.value.game_status==1||Object.keys(r.value.minutes).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameHometeam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[r.value.minutes.home_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[YT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.home_goals_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f).replace("(AG)","")),1),p!=r.value.minutes.home_goals_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.home_red_cards_minutes.length>0&&r.value.minutes.home_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.home_red_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(h.$style.yellowContainer)},[JT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.home_red_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f)),1),p!=r.value.minutes.home_red_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.home_red_cards_minutes.length>0||r.value.minutes.home_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.home_yellow_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:4,class:n.normalizeClass(h.$style.redContainer)},[XT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.home_yellow_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f)),1),p!=r.value.minutes.home_yellow_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[r.value.is_live==1&&r.value.game_status!=1||r.value.game_status==0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameHometeam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[Object.keys(s.playsLive).length>0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[s.playsLive[s.game.home_team.team_id]&&"goals"in s.playsLive[s.game.home_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[Object.keys(s.playsLive[s.game.home_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[ZT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.home_team.team_id].goals),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.home_team.team_id].goals[f].event.map(m=>`${m}'`).join(", ").replace("(AG)","")),1),p!=Object.keys(s.playsLive[s.game.home_team.team_id].goals).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.home_team.team_id]&&"red"in s.playsLive[s.game.home_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[Object.keys(s.playsLive[s.game.home_team.team_id].red).length>0&&Object.keys(s.playsLive[s.game.home_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.home_team.team_id].red).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.yellowContainer)},[QT,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.home_team.team_id].red),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.home_team.team_id].red[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.home_team.team_id].red).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.home_team.team_id]&&"yellow"in s.playsLive[s.game.home_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[Object.keys(s.playsLive[s.game.home_team.team_id].red).length>0||Object.keys(s.playsLive[s.game.home_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.home_team.team_id].yellow).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.redContainer)},[eC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.home_team.team_id].yellow),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.home_team.team_id].yellow[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.home_team.team_id].yellow).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64))],2),r.value.game_status==4&&r.value.is_live==0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.matchInfo),id:"container-match-info"},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.sbado16De)},n.toDisplayString(c(r.value.date_time_utc,1)),3),n.createElementVNode("div",{class:n.normalizeClass(h.$style.sab16092023)},n.toDisplayString(c(r.value.date_time_utc,0)),3),n.createElementVNode("div",{class:n.normalizeClass(h.$style.hour)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.div)},n.toDisplayString(r.value.gameSchedule),3),n.createElementVNode("div",{class:n.normalizeClass(h.$style.cst)},"CST",2)],2),n.createElementVNode("div",{class:n.normalizeClass(h.$style.chivasTvCanal)},n.toDisplayString(r.value.tv_stations.join(", ")),3)],2)):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.matchInfo),id:"container-match-info"},[r.value.is_live?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(c(r.value.date_time_utc,1)),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",{class:n.normalizeClass([h.$style.sbado16De,h.$style.gameDate])},n.toDisplayString(c(r.value.date_time_utc,1)),3),n.createElementVNode("div",{class:n.normalizeClass([h.$style.sab16092023,h.$style.gameDate])},n.toDisplayString(c(r.value.date_time_utc,0)),3)],64)),r.value.is_live?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(h.$style.score)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.divscore)},n.toDisplayString(o.value),3)],2)):(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(h.$style.score)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.divscore)},n.toDisplayString(r.value.score.join(" - ")),3)],2)),n.createElementVNode("div",{class:n.normalizeClass(h.$style.gameStatus)},[r.value.is_live?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.liveMinutes)},[tC,n.createTextVNode(" LIVE - "+n.toDisplayString(i.value)+"' ",1)],2)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(" Finalizado "),r.value.penalties_score_home_team!=0||r.value.penalties_score_visiting_team!=0?(n.openBlock(),n.createElementBlock("span",sC," - Penales "+n.toDisplayString(r.value.penalties_score_home_team)+" - "+n.toDisplayString(r.value.penalties_score_visiting_team),1)):n.createCommentVNode("",!0)],64))],2),s.is_captured==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:4},[r.value.is_live==1||r.value.game_status==1||Object.keys(r.value.minutes).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.viewButtomEvent),onClick:u[0]||(u[0]=f=>d(r.value))},[aC,n.createTextVNode(" "),nC],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],2)),n.createElementVNode("div",{class:n.normalizeClass(h.$style.awayTeam),id:"container-away-team"},[n.createElementVNode("img",{class:n.normalizeClass(h.$style.image62Icon1),alt:"",src:n.unref(Ns)(r.value.visiting_team.team_id,150)},null,10,iC),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.name),id:"team-name"},n.toDisplayString(r.value.visiting_team.colloquial_name),3),n.createElementVNode("img",{class:n.normalizeClass(h.$style.imgAtlasIcon),alt:"",src:n.unref(Ns)(r.value.visiting_team.team_id)},null,10,oC),n.createElementVNode("h3",{class:n.normalizeClass(h.$style.name1),id:"team-name"},n.toDisplayString(r.value.visiting_team.acronym),3),r.value.game_status==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[r.value.is_live==0&&r.value.game_status==1||Object.keys(r.value.minutes).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameAwayteam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("img",rC)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.visiting_goals_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f).replace("(AG)","")),1),p!=r.value.minutes.visiting_goals_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.away_red_cards_minutes.length>0&&r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.away_red_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(h.$style.yellowContainer)},[r.value.minutes.away_red_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("img",lC)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.away_red_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f)),1),p!=r.value.minutes.away_red_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0),r.value.minutes.away_red_cards_minutes.length>0||r.value.minutes.visiting_goals_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),r.value.minutes.away_yellow_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("div",{key:4,class:n.normalizeClass(h.$style.redContainer)},[r.value.minutes.away_yellow_cards_minutes.length>0?(n.openBlock(),n.createElementBlock("img",cC)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.minutes.away_yellow_cards_minutes,(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(l(f))+"'",1),p!=r.value.minutes.away_yellow_cards_minutes.length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[r.value.is_live==1&&r.value.game_status!=1||r.value.game_status==0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.containerEventsGameAwayteam)},[n.createElementVNode("div",{class:n.normalizeClass(h.$style.containerEvents)},[Object.keys(s.playsLive).length>0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[s.playsLive[s.game.visiting_team.team_id]&&"goals"in s.playsLive[s.game.visiting_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.goalsContainer)},[dC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.visiting_team.team_id].goals),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.visiting_team.team_id].goals[f].event.map(m=>`${m}'`).join(", ").replace("(AG)","")),1),p!=Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.visiting_team.team_id]&&"red"in s.playsLive[s.game.visiting_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length>0&&Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.yellowContainer)},[hC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.visiting_team.team_id].red),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.visiting_team.team_id].red[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),s.playsLive[s.game.visiting_team.team_id]&&"yellow"in s.playsLive[s.game.visiting_team.team_id]?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[Object.keys(s.playsLive[s.game.visiting_team.team_id].red).length>0||Object.keys(s.playsLive[s.game.visiting_team.team_id].goals).length>0?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(h.$style.sepEvents)}," | ",2)):n.createCommentVNode("",!0),Object.keys(s.playsLive[s.game.visiting_team.team_id].yellow).length>0?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(h.$style.redContainer)},[uC,(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Object.keys(s.playsLive[s.game.visiting_team.team_id].yellow),(f,p)=>(n.openBlock(),n.createElementBlock("div",{key:p},[n.createTextVNode(n.toDisplayString(s.playsLive[s.game.visiting_team.team_id].yellow[f].event.map(m=>`${m}'`).join(", ")),1),p!=Object.keys(s.playsLive[s.game.visiting_team.team_id].yellow).length-1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(", ")],64)):n.createCommentVNode("",!0)]))),128))],2)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0)],2)],2)):n.createCommentVNode("",!0)],64))],2)],2))}},fC={$style:WT},pC=Lt(mC,[["__cssModules",fC]]),gC={class:"calendar-by-game__carousel"},yC="https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",bC={__name:"GSC-CalendarByGame",props:{showVideos:{type:Number,default:0},playsLive:{type:Object,default:()=>{}},infoLive:{type:Object,default:()=>{}},height:{type:String,default:"fit-content"},width:{type:String,default:"100%"},rowHeight:{type:String,default:"fit-content"},oddRowColor:{type:String,default:"#172531"},evenRowColor:{type:String,default:"#0D1D29"},isLandingMode:{type:Boolean,default:!1},isRoundMode:{type:Boolean,default:!1},isRoundPickerVisible:{type:Boolean,default:!0},isPaginationVisible:{type:Boolean,default:!0},awaitForSeasons:{type:Boolean,default:!1},seasons:{type:Array,default:()=>[]},isCup:{type:Boolean,default:!1},isCupLegacy:{type:Boolean,default:!1},token:{type:String,default:""},pagesWithGames:{type:Array,default:()=>[]},maxGamesToShow:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},areRoundsVisible:{type:Boolean,default:!0},is_captured:{type:Number,default:1},gamesPerMatchDay:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},itemsToShow:{type:Number,default:9},itemsToScroll:{type:Number,default:9},games:{type:Array,default:()=>null},teamId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},avoidTeamIdFilter:{type:Boolean,default:!1},areGamesCarouselType:{type:Boolean,default:!1},defaultGameId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},userTeamId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},sortCalendar:{type:Boolean,default:!0},isTeamGamePerPage:{type:Boolean,default:!1},onlyGamesTeamId:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},tournamentType:{type:Number,default:0},checkLiveGamesIntervalMinutes:{type:Number,default:2},gamesEventsIntervalMinutes:{type:Number,default:2},checkStartedLiveGamesMinutes:{type:Number,default:5}},emits:["tournament-selected","change-teams","change-round","change-game-carousel","action","change-games-by-client-privileges","open-modal-event"],setup(s,{emit:e}){const t=s;let a=null,i=null,o=null;const r=n.ref([]),l=n.ref({}),d=n.ref(0),c=n.ref(null),h=n.ref({}),u=n.ref(new Map),f=n.ref(!1),p=n.ref(null),m=n.ref(null),g=n.ref(null),y=n.ref([]),b=n.ref(new Map),S=n.ref(new Set),_=n.computed(()=>t.isCup),C=n.computed(()=>t.isCupLegacy),T=n.computed(()=>({height:t.height,width:t.width})),v=n.computed(()=>{if(t.games)return Ee(t.games,t.isTeamGamePerPage);{const M=u.value.get(h.value.key);return M&&t.isTeamGamePerPage&&t.onlyGamesTeamId?[M[0].filter(W=>W.home_team.team_id===t.onlyGamesTeamId||W.visiting_team.team_id===t.onlyGamesTeamId)]:M||[]}}),E=n.computed(()=>t.areGamesCarouselType?v.value[0]:v.value),N=n.ref([]),L=n.ref([]),R=n.computed(()=>{const M=L.value&&L.value.length?z(l.value):K(l.value),W=N.value.find(H=>H.key===M);return W&&f.value&&($(!1),et(W)),M});n.watch(()=>t.seasons,M=>{M&&M.length&&($(!0),r.value=M.map(W=>W.id),ie(M,!0))},{immediate:!0,deep:!0}),n.watch(u,M=>{if(t.onlyGamesTeamId&&M.size){const W=Array.from(M.values()).reduce((H,G)=>(G.forEach(X=>{const Y=X.find(ke=>ke.home_team.team_id===t.onlyGamesTeamId||ke.visiting_team.team_id===t.onlyGamesTeamId);Y&&H.push(Y)}),H),[]);e("change-games-by-client-privileges",W)}},{immediate:!0});function $(M){f.value=M}function K(M){const W=Object.entries(Object.entries(M).reduce((X,[Y,ke])=>(X[Y]=[],ke.forEach(Pe=>{Pe.games.forEach(ct=>{const Mt=new Date(ct.date_time_utc).getTime()+66e5;X[Y].push(Mt)})}),X),{}));if(!W.length)return"1";const H=new Date().getTime(),G=W.reduce((X,[Y,ke])=>{let Pe=null;return ke.forEach(ct=>{const Mt=ct-H;Mt>=0&&(Pe===null||Mt<Pe)&&(Pe=Mt)}),Pe&&(X.shortestTime===null||Pe<X.shortestTime)&&(X.round=Y,X.shortestTime=Pe),X},{round:"",shortestTime:null});return G.shortestTime!==null?G.round:W[W.length-1][0]}function z(M){let W=1;if(L.value.length){const H=L.value[0];for(const[G,X]of Object.entries(M))for(const Y of X)if(Y.games.find(ke=>ke.game_id===H.game_id))return G}return W}n.watch(()=>t.teamId,()=>{se()},{immediate:!0});async function ae(M,W,H=""){let G=H;try{const X={};t.token&&(X.Authorization=t.token),G||(G="https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",M.forEach((Pe,ct)=>{G+=`${ct===0?"":"&"}seasons=${Pe}`}));const{data:{data:Y,teams:ke}}=await ln.get(G,{headers:X});return{seasonsAndGames:Y,seasonsAndTeams:ke}}catch(X){if(W>0)return ae(M,W-1,G);throw new Error(X)}}function oe(M){for(const W of M)if(!r.value.includes(W.season_id))return!0;return!1}async function ie(M,W){try{l.value={};let H=0;const{seasonsAndGames:G,seasonsAndTeams:X}=await ae(M.map(ke=>ke.id),3);if(W&&oe(G))return;G.forEach(ke=>{const{type:Pe}=M.find(ct=>ct.id===ke.season_id);ke.type=Pe,ke.games.forEach(ct=>{ct.season_id=ke.season_id}),Pe===0&&(H=ke.season_id)}),p.value={seasonsGames:G};const{teams:Y}=X.find(ke=>ke.season_id===H);m.value=Y,e("change-teams",Y),se(),S.value.size?Q():await ce()}catch(H){throw new Error(H)}}async function ce(){try{const M=await Ce(),W=new Set;if(y.value=M.data.reduce((H,G)=>(G.games.forEach(X=>{W.add(X.game_id),H.push(X)}),H),[]),y.value.length){i||await de();const H=[];S.value.forEach(G=>{const X=b.value.get(G);X&&new Date().valueOf()>X.dateTimeMillis&&H.push(G)}),H.length&&H.every(G=>b.value.get(G).isLiveTracked)&&J()}}catch(M){throw new Error(M)}}async function de(){try{const M=[];for(const H of y.value){const G=b.value.get(H.game_id);G&&(G.is_live=1,G.game_status=4),G.isLiveTracked=!0,M.push(ge(H.game_id))}const W=await Promise.all(M);for(const H of W){const G=b.value.get(H.game_id);G&&ue(G,H.plays)}i||he()}catch(M){throw new Error(M)}}function Q(){S.value.size&&S.value.forEach(M=>{const W=b.value.get(M);if(W){const H=new Date().valueOf();if(60*1e3*30+W.dateTimeMillis-H>0){const G=W.dateTimeMillis-H-3e5;setTimeout(()=>{q()},G>0?G:0)}}})}function q(){J(),o||(o=setInterval(()=>{ce()},t.checkLiveGamesIntervalMinutes*60*1e3))}function he(){Z(),i=setInterval(()=>{de()},t.gamesEventsIntervalMinutes*60*1e3)}function J(){clearInterval(o),o=null}function Z(){clearInterval(i),i=null}function ue(M,W){for(const H of W)if(H.category_id===0&&H.game_status_id===13){const G=b.value.get(H.game_id);y.value=y.value.filter(X=>X.game_id!==M.game_id),G.is_live=0,G.game_status=0}}async function ge(M){try{return(await ln.get(`${yC}${M}`,{headers:{Authorization:`${t.token}`}})).data}catch(W){throw new Error(W)}}async function Ce(){try{if(t.seasons.length===0)return[];const M=t.seasons.reduce((G,X)=>`${G}seasons=${X.id}&`,""),W=ln.create({headers:{Authorization:`${t.token}`}}),{data:H}=await W.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${M}`);return H}catch(M){throw new Error(M)}}function se(){if(J(),!m.value)return;b.value.clear(),S.value.clear(),L.value=[];const M=p.value&&p.value.seasonsGames?p.value.seasonsGames.map(W=>{const H=W.games.reduce((G,X)=>{if(t.onlyGamesTeamId&&t.onlyGamesTeamId!==X.home_team&&t.onlyGamesTeamId!==X.visiting_team)return G;const Y={...X},ke=new Date,[Pe,ct,Mt]=Y.date.split("-"),[wi,_i,wO]=Y.schedule.split(":"),ki=new Date(Number(Pe),Number(ct)-1,Number(Mt),Number(wi),Number(_i),Number(wO));return Y.dateTimeMillis=ki.valueOf(),Y.home_team=m.value.find(ql=>ql.team_id===X.home_team),Y.visiting_team=m.value.find(ql=>ql.team_id===X.visiting_team),Y.game_status===4&&ke.getFullYear()===ki.getFullYear()&&ke.getMonth()===ki.getMonth()&&ke.getDate()===ki.getDate()&&S.value.add(Y.game_id),b.value.set(Y.game_id,Y),t.teamId&&Y.home_team.team_id!==t.teamId&&Y.visiting_team.team_id!==t.teamId||(G[X.matchday_abbreviation]?G[X.matchday_abbreviation][X.game_status===3?"canceled":X.date]?G[X.matchday_abbreviation][X.game_status===3?"canceled":X.date].push(Y):G[X.matchday_abbreviation][X.game_status===3?"canceled":X.date]=[Y]:G[X.matchday_abbreviation]={[X.game_status===3?"canceled":X.date]:[Y]},t.userTeamId&&Y.game_status===4&&(Y.home_team.team_id===t.userTeamId||Y.visiting_team.team_id===t.userTeamId)&&L.value.push(Y)),G},{});for(let[G,X]of Object.entries(H))H[G]=Object.entries(X).map(([Y,ke])=>({date:Y,games:ke.sort((Pe,ct)=>Pe.dateTimeMillis-ct.dateTimeMillis)})),H[G].sort((Y,ke)=>Y.date<ke.date?-1:Y.date>ke.date?1:0);return{type:W.type,weight:W.type===0?0:W.type===2?1:2,schedule:H}}):[];M.sort((W,H)=>W.weight-H.weight),l.value=M.reduce((W,H)=>{for(const[G,X]of Object.entries(H.schedule))if(H.type===0)if([1,2].includes(t.tournamentType)){const Y=Nk.get(t.tournamentType);if(Y){const ke=Y.get(G);ke&&(W[ke.matchDayAbbreviation]=X)}}else if(_.value){const Y=G.replace("M",""),ke=Y;C.value?W[Rk[Y]||ke]=X:W[Ik[G]||ke]=X}else W[Number(G.replace("M","")).toString()]=X;else H.type===2?G.charAt(1)=="I"?W[`PI${Number(G.replace("PI",""))}`]=X:W[`R${Number(G.replace("PO",""))}`]=X:H.type===1&&(W[Lk[G]]=X);return W},{}),u.value=new Map,N.value=Array.from(Object.entries(l.value).reduce((W,[H,G],X)=>{const Y=Number(H);let ke="";Number.isNaN(Y)?ke=H:ke=Y<10?`0${Y}`:H,W.set(H,{key:H,value:Y,valueText:ke,index:X});const Pe=G.reduce((Mt,wi)=>(wi.games.forEach(_i=>{_i.game_id===t.defaultGameId&&(g.value=H),_i.roundAbbreviation=Number.isNaN(Y)?Y:`J ${Y}`}),Mt=Mt.concat(wi.games),Mt),[]),ct=Ee(Pe);return u.value.set(H,ct),W},new Map).values())}function Ee(M,W=!1){const H=[];if(t.gamesPerMatchDay>0){let G=[];M.forEach((X,Y)=>{G.push(X),(Y+1)%t.gamesPerMatchDay===0&&(H.push([...G]),G=[])}),G.length&&H.push([...G])}else H.push(M);return W&&t.isTeamGamePerPage&&t.defaultGameId?H.filter(G=>G.game_id===t.defaultGameId||G.gameId===t.defaultGameId):H}async function Te(M){try{const{data:W}=await ln.get("https://kefloixzy1.execute-api.us-west-2.amazonaws.com/prod/tournaments");return W}catch(W){if(M>0)return Te(M-1);throw new Error(W)}}function Fe(){if(window.ResizeObserver)a=new ResizeObserver(()=>{d.value=c.value.clientWidth}),a.observe(c.value);else throw new Error("Resize observer not supported!")}function et(M){h.value.value!==M.value&&(h.value=M,e("change-round",M))}function it(M){t.areGamesCarouselType&&e("change-game-carousel",M.selectedItem)}function ot(M){e("action",M),j(M)}function x(M){e("open-modal-event",M)}function j(M){const W="PLAY_RESUME",H="PLAY_GOALS",G=[607,608,12,55,54,35,14,52,15,53,466,477],X=[12,55,"35_r","54_r"],{game_id:Y,season_id:ke}=M.game;let Pe={seasonId:ke,tournaments:[],isFeaturedPlayers:!1,mainSectionType:1,playListType:1,gameIds:[Y],playerIds:[],goalkeeperIds:[],categoryIds:[],teamId:0,matchResult:[],categorySingleName:"",avoidCategorySingleName:!1,currentPlayIndex:0,playData:null,lastClashedGameId:null,tournamentsLastClashes:null,advancedFilter:{playListTitle:""},objectPlaySync:null};M.action===W?(Pe.categoryIds=G,Pe.advancedFilter.playListTitle="Resumen",e("openmedia",Pe)):M.action===H&&(Pe.categoryIds=X,Pe.advancedFilter.playListTitle="Goles",e("openmedia",Pe))}async function U(){try{if(!t.awaitForSeasons&&!t.games){const M=(await Te(3)).find(G=>G._id===1),W=M.seasons[0],H=[{id:W.id,type:W.type}];M&&M.tournament&&e("tournament-selected",M.tournament),W.related_seasons&&W.related_seasons.length&&H.push(...W.related_seasons.map(G=>({id:G.id,type:G.type}))),await ie(H,!1)}}catch(M){throw new Error(M)}}return n.onMounted(()=>{Fe()}),U(),(M,W)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"calendarByGame",ref:c,class:"calendar-by-game",style:n.normalizeStyle(T.value)},[s.teamId&&!s.avoidTeamIdFilter?(n.openBlock(),n.createBlock(fT,{key:0,"full-tournament-schedule":l.value,"team-id":s.teamId,"show-videos":s.showVideos,"is-landing-mode":!1,"row-height":s.rowHeight,"component-width":d.value,"games-pages":u.value,"is-pagination-visible":s.isPaginationVisible,"is-round-mode":s.isRoundMode,onAction:ot},null,8,["full-tournament-schedule","team-id","show-videos","row-height","component-width","games-pages","is-pagination-visible","is-round-mode"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[s.areRoundsVisible&&N.value?(n.openBlock(),n.createBlock(qk,{key:0,"match-days":N.value,"is-landing-mode":s.isLandingMode,height:"48px","items-to-show":s.itemsToShow,"items-to-scroll":s.itemsToScroll,"component-width":d.value,"default-match-day-key":g.value,"closest-match-day":s.sortCalendar?R.value:"",onChangeMatchDay:et},null,8,["match-days","is-landing-mode","items-to-show","items-to-scroll","component-width","default-match-day-key","closest-match-day"])):n.createCommentVNode("",!0),n.createElementVNode("div",gC,[v.value?(n.openBlock(),n.createBlock(n.unref(Ih),{key:0,"is-pagination-visible":s.isPaginationVisible&&!s.areGamesCarouselType,items:E.value,"are-navigation-arrows-visible":s.areGamesCarouselType?!s.areGamesCarouselType:s.isPaginationVisible,"wrap-around":s.areGamesCarouselType&&!s.isTeamGamePerPage,"items-to-show":s.areGamesCarouselType&&!s.isTeamGamePerPage?1.2:1,"is-main-slide-priority":s.areGamesCarouselType,"are-slides-arrows-visible":s.areGamesCarouselType&&!s.isTeamGamePerPage,"slides-arrows-left-and-right":s.areGamesCarouselType?"30px":"0px","default-item-by-prop":s.areGamesCarouselType?{propName:"game_id",value:s.defaultGameId}:{},onInput:it},{default:n.withCtx(({item:H})=>[s.areGamesCarouselType?(n.openBlock(),n.createBlock(pC,{key:0,is_captured:s.is_captured,game:H,onOpenModalEvent:x,"plays-live":s.playsLive,"info-live":s.infoLive},null,8,["is_captured","game","plays-live","info-live"])):(n.openBlock(),n.createBlock(cT,{key:1,"team-id":s.teamId,"show-videos":s.showVideos,"games-per-page":H,"is-landing-mode":s.isLandingMode,"row-height":s.rowHeight,"component-width":d.value,"is-round-mode":s.isRoundMode,onAction:ot},null,8,["team-id","show-videos","games-per-page","is-landing-mode","row-height","component-width","is-round-mode"]))]),_:1},8,["is-pagination-visible","items","are-navigation-arrows-visible","wrap-around","items-to-show","is-main-slide-priority","are-slides-arrows-visible","slides-arrows-left-and-right","default-item-by-prop"])):n.createCommentVNode("",!0)])],64))],4))}},SC=Lt(bC,[["__scopeId","data-v-ac055c89"]]),wC=["Mi posición","Tabla General","Fases","Play Off"],_C={components:{GscSwitchComponent:yo,GSCGeneraltable:s_,GSCCalendarByGame:SC},props:{privileges:{type:Object,default:()=>{}},isPublic:{type:Boolean,default:!0},season:{type:Object,default:()=>{}},onlyTable:{type:Boolean,default:!0},seasons:{type:Array,default:()=>[]},tournamentType:{type:Number,default:0},tournament:{type:Number,default:1},teamId:{type:Number,default:0},componentWidth:{type:Number,default:768},tournaments:{type:Array,default:()=>[]}},data(){return{selectedOpt:"Mi posición",tokenFree:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"}},computed:{tableTitle(){return this.tournamentType!==0?this.tournamentType===1?"Fases":"Play Off":(this.selectedOpt!=="Calendario"&&this.changeCategory(this.teamId!=0?"Mi posición":"Tabla General"),this.teamId!==0?"Mi posición":"Tabla General")},isGeneralTableVisible(){return wC.includes(this.selectedOpt)}},watch:{tableTitle:{handler(s){this.selectedOpt=s},immediate:!0}},methods:{onAction(s){this.$emit("action",s)},changeCategory(s){this.selectedOpt=s},onOpenMedia(s){this.$emit("openmedia",s)},onOpenProfile(s){this.$emit("onOpenProfile",s)}},mounted(){this.selectedOpt=this.teamId!==0?"Mi posición":"Tabla General"}},kC={key:0,class:"gsc-switch-container"},EC={key:1,class:"gsc-switch-container"},TC={class:"gsc-app-component"},CC={key:0};function xC(s,e,t,a,i,o){const r=n.resolveComponent("GscSwitchComponent"),l=n.resolveComponent("GSCGeneraltable"),d=n.resolveComponent("GSCCalendarByGame");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(t.componentWidth>1e3?"gsc-calendar-table":"gsc-calendar-table-movil")},[t.onlyTable?(n.openBlock(),n.createElementBlock("div",EC,"Mi posicion")):(n.openBlock(),n.createElementBlock("div",kC,[n.createVNode(r,{type:0,arrow:!1,"font-family":"Poppins-Light",buttons:[o.tableTitle,"Calendario"],height:"40px","selected-option":i.selectedOpt,"font-size":t.componentWidth>=768?"16px":"14px",width:"355px",onInput:o.changeCategory},null,8,["buttons","selected-option","font-size","onInput"])])),n.createElementVNode("div",TC,[o.isGeneralTableVisible?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(l,{isPaginationVisible:!0,"current-season-id":t.season.id,"team-default-select":t.teamId,"team-id":t.teamId,type:1,"show-videos":t.isPublic?t.privileges.vr_privileges!=0:!0,tournament:t.tournament,"type-view":t.tournamentType,"await-for-season":"","await-for-tournaments":"","external-tournaments":t.tournaments,onOpenmedia:o.onOpenMedia,onOpenTableProfile:o.onOpenProfile},null,8,["current-season-id","team-default-select","team-id","show-videos","tournament","type-view","external-tournaments","onOpenmedia","onOpenTableProfile"]),n.createElementVNode("div",{onClick:e[0]||(e[0]=c=>s.$router.push({name:"table"})),class:"gsc-app-component-view-all"}," Ver todo ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t.onlyTable?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",CC,[n.createVNode(d,{width:"100%",token:i.tokenFree,seasons:t.seasons,"tournament-type":t.tournamentType,"show-videos":t.isPublic,"row-height":"90px","is-landing-mode":!0,"is-pagination-visible":!0,isRoundPickerVisible:!0,"await-for-seasons":"","items-to-show":9,"items-to-scroll":5,"max-games-to-show":5,"games-per-match-day":5,onOpenmedia:o.onOpenMedia,onAction:o.onAction},null,8,["token","seasons","tournament-type","show-videos","onOpenmedia","onAction"]),n.createElementVNode("div",{onClick:e[1]||(e[1]=c=>this.$router.push({name:"calendar"})),class:"gsc-app-component-view-all"}," Ver todo ")]))],64))])],2)}const vC=qe(_C,[["render",xC],["__scopeId","data-v-c8707277"]]),Mh=["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],$h=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],Vh=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],AC={class:"match"},LC={class:"match__header"},IC={key:0,class:"match__final-tag"},RC={key:1,class:"match__final-tag__no-border"},NC={class:"match__header__match-date"},BC={class:"match__tag"},DC={class:"match__body"},PC={class:"match__data"},OC={class:"match__acronym"},FC=["src"],MC={class:"match__score"},$C=["src"],VC={class:"match__acronym"},UC={class:"match__status"},dn=qe({__name:"PreviousMatch",props:{visitTeam:{type:Object,default:()=>{}},data:{type:Object,default:()=>{}},homeTeam:{type:Object,default:()=>{}},score:{type:String,default:"2 - 1"},journey:{type:[String,Number],default:2},penalScore:{type:String,default:""},infoType:{type:String,default:"postmatch"}},setup(s){const e=s,t=n.computed(()=>{const a=new Date(e.data.date_time_utc);return`${Mh[a.getDay()]}, ${a.getDate()} de ${$h[a.getMonth()]}`});return(a,i)=>{var o,r,l;return n.openBlock(),n.createElementBlock("section",AC,[n.createElementVNode("div",LC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock("div",IC,"FINAL")):(n.openBlock(),n.createElementBlock("div",RC)),n.createElementVNode("div",NC,n.toDisplayString(t.value),1),n.createElementVNode("div",BC,n.toDisplayString(`${Number.isNaN(Number(s.data.roundAbbreviationV2))?"":"J"}${s.data.roundAbbreviationV2}`),1)]),n.createElementVNode("div",DC,[n.createElementVNode("div",PC,[n.createElementVNode("div",OC,n.toDisplayString((o=s.data)==null?void 0:o.home_team_acronym),1),n.createElementVNode("img",{class:"match__img",src:"https://az755631.vo.msecnd.net/teams-80/"+s.data.home_team+".png",alt:"team-img"},null,8,FC),n.createElementVNode("div",MC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(s.data.score[0])+" - "+n.toDisplayString(s.data.score[1]),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString((r=s.data)==null?void 0:r.schedule.replace(":00","")),1)],64))]),n.createElementVNode("img",{class:"match__img",src:"https://az755631.vo.msecnd.net/teams-80/"+s.data.visiting_team+".png",alt:"team-img"},null,8,$C),n.createElementVNode("div",VC,n.toDisplayString((l=s.data)==null?void 0:l.visiting_team_acronym),1)]),n.createElementVNode("div",UC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Finalizado"+n.toDisplayString(s.penalScore?` - Penales ${s.penalScore}`:""),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("CST")],64))])]),n.createElementVNode("div",{class:"match__button",onClick:i[0]||(i[0]=d=>a.$emit("clickMatch"))},"Analizar partido →")])}}},[["__scopeId","data-v-02d713e0"]]),Uh=s=>(n.pushScopeId("data-v-1b8ec784"),s=s(),n.popScopeId(),s),zC=["src"],GC=["src"],jC={class:"coming-match__body"},HC={class:"coming-match__data"},WC=["src"],KC={key:0,class:"coming-match__live"},qC={class:"coming-match__live__score"},YC={class:"coming-match__live__time"},JC=Uh(()=>n.createElementVNode("div",{class:"bullet"},null,-1)),XC=Uh(()=>n.createElementVNode("div",{class:"coming-match__live__time__text"},"LIVE",-1)),ZC={class:"coming-match__live__time__time"},QC={key:1,style:{"margin-top":"16px"}},ex={class:"coming-match__time"},tx={class:"coming-match__cst"},sx={key:0},ax=["src"],Bs=qe({__name:"ComingMatch",props:{small:{type:Boolean,default:!1},visitTeam:{type:Object,default:()=>{}},data:{type:Object,default:()=>{}},homeTeam:{type:Object,default:()=>{}},date:{type:String,default:"Jueves 7 de Abril"},time:{type:String,default:"5: 00"}},setup(s){const e=s,t=n.computed(()=>{const i=new Date(e.data.date_time_utc);return`${Mh[i.getDay()]}, ${i.getDate()} de ${e.small?Vh[i.getMonth()]:$h[i.getMonth()]}`}),a=n.computed(()=>e.data.is_live||e.data.game_status===0);return(i,o)=>{var r,l,d,c,h,u,f,p,m,g,y,b,S,_,C;return n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["coming-match",{small:s.small}])},[n.createElementVNode("img",{class:n.normalizeClass(["coming-match__bg",{small:s.small}]),src:typeof s.data.home_team=="object"?"https://az755631.vo.msecnd.net/teams-150/"+((r=s.data)==null?void 0:r.home_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-150/"+((l=s.data)==null?void 0:l.home_team)+".png",alt:"team-img"},null,10,zC),n.createElementVNode("img",{class:n.normalizeClass(["coming-match__bg",{small:s.small}]),src:typeof s.data.visiting_team=="object"?"https://az755631.vo.msecnd.net/teams-150/"+((d=s.data)==null?void 0:d.visiting_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-150/"+((c=s.data)==null?void 0:c.visiting_team)+".png",alt:"team-img"},null,10,GC),n.createElementVNode("div",jC,[a.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["coming-match__date",{small:s.small}])},n.toDisplayString(`${Number.isNaN(Number(s.data.roundAbbreviationV2))?"":"J"}${s.data.roundAbbreviationV2}`)+" | "+n.toDisplayString(t.value),3)),n.createElementVNode("div",HC,[n.createElementVNode("div",{class:n.normalizeClass(["coming-match__team",{small:s.small}])},[n.createElementVNode("img",{class:n.normalizeClass(["coming-match__img",{small:s.small}]),src:typeof s.data.home_team=="object"?"https://az755631.vo.msecnd.net/teams-80/"+((h=s.data)==null?void 0:h.home_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-80/"+((u=s.data)==null?void 0:u.home_team)+".png",alt:"team-img"},null,10,WC),n.createElementVNode("div",{class:n.normalizeClass(["coming-match__acronym",{small:s.small}])},n.toDisplayString((f=s.data)==null?void 0:f.home_team_name),3)],2),a.value?(n.openBlock(),n.createElementBlock("div",KC,[n.createElementVNode("div",qC,n.toDisplayString((p=s.data)==null?void 0:p.score[0])+" - "+n.toDisplayString((m=s.data)==null?void 0:m.score[1]),1),n.createElementVNode("div",YC,[JC,XC,n.createElementVNode("div",ZC,n.toDisplayString(s.data.currentTimeLive||"0'"),1)])])):(n.openBlock(),n.createElementBlock("div",QC,[n.createElementVNode("div",ex,[s.data.game_status!==4?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString((g=s.data)==null?void 0:g.score[0])+" - "+n.toDisplayString((y=s.data)==null?void 0:y.score[1]),1)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString((b=s.data)==null?void 0:b.schedule.replace(":00","")),1)],64))]),n.createElementVNode("div",tx,[s.data.game_status===4?(n.openBlock(),n.createElementBlock("span",sx,"CST")):n.createCommentVNode("",!0)])])),n.createElementVNode("div",{class:n.normalizeClass(["coming-match__team away",{small:s.small}])},[n.createElementVNode("div",{class:n.normalizeClass(["coming-match__acronym",{small:s.small}])},n.toDisplayString((S=s.data)==null?void 0:S.visiting_team_name),3),n.createElementVNode("img",{class:n.normalizeClass(["coming-match__img",{small:s.small}]),src:typeof s.data.visiting_team=="object"?"https://az755631.vo.msecnd.net/teams-80/"+((_=s.data)==null?void 0:_.visiting_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-80/"+((C=s.data)==null?void 0:C.visiting_team)+".png",alt:"team-img"},null,10,ax)],2)])]),n.createElementVNode("div",{class:n.normalizeClass(["coming-match__button",{small:s.small}]),onClick:o[0]||(o[0]=T=>i.$emit("clickMatch"))},[s.data.game_status===4&&!s.data.is_live?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Analizar previa →")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Analizar partido →")],64))],2)],2)}}},[["__scopeId","data-v-1b8ec784"]]),hn=s=>(n.pushScopeId("data-v-d72712b5"),s=s(),n.popScopeId(),s),nx={class:"game-item__header"},ix={class:"game-item__header__info text-type-1"},ox={key:0,class:"game-item__header__info__live"},rx=hn(()=>n.createElementVNode("div",{class:"game-item__header__info__live__status text-type-2"},[n.createElementVNode("div",{class:"bullet"}),n.createElementVNode("span",null,"LIVE")],-1)),lx={class:"text-type-1"},cx={key:1,class:"game-item__header__info__pre-match text-type-2"},dx=hn(()=>n.createElementVNode("span",{class:"game-item__header__info__pre-match text-type-1"},[n.createTextVNode(" "),n.createElementVNode("small",null,"CST")],-1)),hx={key:2,class:"game-item__header__info__post-match"},ux=[hn(()=>n.createElementVNode("span",{class:"text-type-2"},"Finalizado",-1))],mx={class:"game-item__body"},fx={class:"game-item__body__team__info"},px=["src"],gx={class:"game-item__body__team__info__acronym"},yx={class:"game-item__body__team__score"},bx=[hn(()=>n.createElementVNode("div",null,"Analizar partido →",-1))],Sx=qe({__name:"GameItem",props:{game:{type:Object,default:()=>{}}},emits:["clickMatch"],setup(s,{emit:e}){const t=s,a=n.computed(()=>{let l="";const d=Number(t.game.roundAbbreviationV2);if(l=Number.isNaN(d)?t.game.roundAbbreviationV2:`JOR ${d}`,t.game.game_status===4){const c=new Date(t.game.date_time_utc);l+=` • ${c.getDate()} ${Vh[c.getMonth()]}`}return l}),i=n.computed(()=>t.game.schedule.replace(":00","")),o=n.computed(()=>[{id:t.game.home_team.team_id,teamLogo:t.game.home_team.logo,acronym:t.game.home_team.acronym,score:t.game.score[0]},{id:t.game.visiting_team.team_id,teamLogo:t.game.visiting_team.logo,acronym:t.game.visiting_team.acronym,score:t.game.score[1]}]);function r(){e("clickMatch")}return(l,d)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["game-item",{"is-live":s.game.is_live}])},[n.createElementVNode("div",nx,[n.createElementVNode("div",ix,n.toDisplayString(a.value),1),s.game.is_live?(n.openBlock(),n.createElementBlock("div",ox,[rx,n.createElementVNode("div",lx,n.toDisplayString(s.game.currentTimeLive||"0'"),1)])):s.game.game_status===4?(n.openBlock(),n.createElementBlock("div",cx,[n.createTextVNode(n.toDisplayString(i.value)+" ",1),dx])):(n.openBlock(),n.createElementBlock("div",hx,ux))]),n.createElementVNode("div",mx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,c=>(n.openBlock(),n.createElementBlock("div",{key:c.id,class:"game-item__body__team"},[n.createElementVNode("div",fx,[n.createElementVNode("img",{src:c.teamLogo,alt:"team-logo"},null,8,px),n.createElementVNode("div",gx,n.toDisplayString(c.acronym),1)]),n.createElementVNode("div",yx,[n.withDirectives(n.createElementVNode("div",{class:"game-item__body__team__score__value"},n.toDisplayString(c.score||0),513),[[n.vShow,s.game.is_live||s.game.game_status!==4]])])]))),128))]),n.createElementVNode("div",{class:"game-item__footer",onClick:r},bx)],2))}},[["__scopeId","data-v-d72712b5"]]),wx=qe({__name:"SwitchCustom",props:{modelValue:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,a=n.ref(null);n.watch(()=>t.modelValue,()=>{i()},{immediate:!0});function i(){a.value&&(a.value.checked=t.modelValue)}function o(r){e("update:modelValue",r.target.checked)}return n.onMounted(()=>{i()}),(r,l)=>(n.openBlock(),n.createElementBlock("input",{ref_key:"switchCustom",ref:a,id:"toggle",className:"toggle",type:"checkbox",role:"switch",name:"toggle",onInput:o},null,544))}},[["__scopeId","data-v-9e2bfbd7"]]);/**
|
|
29
29
|
* Vue 3 Carousel 0.3.3
|
|
30
30
|
* (c) 2024
|
|
31
31
|
* @license MIT
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
`),c=[],h=e?CB(e.baseTime,e.timescale):0;let u="00:00.000",f=0,p=0,m,g=!0;l.oncue=function(y){const b=t[a];let S=t.ccOffset;const _=(f-h)/9e4;if(b!=null&&b.new&&(p!==void 0?S=t.ccOffset=b.start:rD(t,a,_)),_){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}S=_-t.presentationOffset}const C=y.endTime-y.startTime,T=wt((y.startTime+S-p)*9e4,i*9e4)/9e4;y.startTime=Math.max(T,0),y.endTime=Math.max(T+C,0);const v=y.text.trim();y.text=decodeURIComponent(encodeURIComponent(v)),y.id||(y.id=Ol(y.startTime,y.endTime,v)),y.endTime>0&&c.push(y)},l.onparsingerror=function(y){m=y},l.onflush=function(){if(m){r(m);return}o(c)},d.forEach(y=>{if(g)if(Dl(y,"X-TIMESTAMP-MAP=")){g=!1,y.slice(16).split(",").forEach(b=>{Dl(b,"LOCAL:")?u=b.slice(6):Dl(b,"MPEGTS:")&&(f=parseInt(b.slice(7)))});try{p=oD(u)/1e3}catch(b){m=b}return}else y===""&&(g=!1);l.parse(y+`
|
|
65
65
|
`)}),l.flush()}const Fl="stpp.ttml.im1t",Vp=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Up=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,cD={left:"start",center:"center",right:"end",start:"start",end:"end"};function zp(s,e,t,a){const i=ye(new Uint8Array(s),["mdat"]);if(i.length===0){a(new Error("Could not parse IMSC1 mdat"));return}const o=i.map(l=>Ut(l)),r=TB(e.baseTime,1,e.timescale);try{o.forEach(l=>t(dD(l,r)))}catch(l){a(l)}}function dD(s,e){const i=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const o={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(o).reduce((u,f)=>(u[f]=i.getAttribute(`ttp:${f}`)||o[f],u),{}),l=i.getAttribute("xml:space")!=="preserve",d=Gp(Ml(i,"styling","style")),c=Gp(Ml(i,"layout","region")),h=Ml(i,"body","[begin]");return[].map.call(h,u=>{const f=jp(u,l);if(!f||!u.hasAttribute("begin"))return null;const p=Vl(u.getAttribute("begin"),r),m=Vl(u.getAttribute("dur"),r);let g=Vl(u.getAttribute("end"),r);if(p===null)throw Hp(u);if(g===null){if(m===null)throw Hp(u);g=p+m}const y=new Nl(p-e,g-e,f);y.id=Ol(y.startTime,y.endTime,y.text);const b=c[u.getAttribute("region")],S=d[u.getAttribute("style")],_=hD(b,S,d),{textAlign:C}=_;if(C){const T=cD[C];T&&(y.lineAlign=T),y.align=C}return Ge(y,_),y}).filter(u=>u!==null)}function Ml(s,e,t){const a=s.getElementsByTagName(e)[0];return a?[].slice.call(a.querySelectorAll(t)):[]}function Gp(s){return s.reduce((e,t)=>{const a=t.getAttribute("xml:id");return a&&(e[a]=t),e},{})}function jp(s,e){return[].slice.call(s.childNodes).reduce((t,a,i)=>{var o;return a.nodeName==="br"&&i?t+`
|
|
66
66
|
`:(o=a.childNodes)!=null&&o.length?jp(a,e):e?t+a.textContent.trim().replace(/\s+/g," "):t+a.textContent},"")}function hD(s,e,t){const a="http://www.w3.org/ns/ttml#styling";let i=null;const o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(i=t[r]),o.reduce((l,d)=>{const c=$l(e,a,d)||$l(s,a,d)||$l(i,a,d);return c&&(l[d]=c),l},{})}function $l(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Hp(s){return new Error(`Could not parse ttml timestamp ${s}`)}function Vl(s,e){if(!s)return null;let t=Fp(s);return t===null&&(Vp.test(s)?t=uD(s,e):Up.test(s)&&(t=mD(s,e))),t}function uD(s,e){const t=Vp.exec(s),a=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+a/e.frameRate}function mD(s,e){const t=Up.exec(s),a=Number(t[1]);switch(t[2]){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/e.frameRate;case"t":return a/e.tickRate}return a}class fD{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=qp(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(w.FRAG_LOADING,this.onFragLoading,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this),e.on(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(w.FRAG_LOADING,this.onFragLoading,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this),e.off(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new hi(this,"textTrack1"),t=new hi(this,"textTrack2"),a=new hi(this,"textTrack3"),i=new hi(this,"textTrack4");this.cea608Parser1=new Op(1,e,t),this.cea608Parser2=new Op(3,a,i)}}addCues(e,t,a,i,o){let r=!1;for(let l=o.length;l--;){const d=o[l],c=pD(d[0],d[1],t,a);if(c>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],a),r=!0,c/(a-t)>.5))return}if(r||o.push([t,a]),this.config.renderTextTracksNatively){const l=this.captionsTracks[e];this.Cues.newCue(l,t,a,i)}else{const l=this.Cues.newCue(null,t,a,i);this.hls.trigger(w.CUES_PARSED,{type:"captions",cues:l,track:e})}}onInitPtsFound(e,{frag:t,id:a,initPTS:i,timescale:o}){const{unparsedVttFrags:r}=this;a==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:o}),r.length&&(this.unparsedVttFrags=[],r.forEach(l=>{this.onFragLoaded(w.FRAG_LOADED,l)}))}getExistingTrack(e,t){const{media:a}=this;if(a)for(let i=0;i<a.textTracks.length;i++){const o=a.textTracks[i];if(Kp(o,{name:e,lang:t,attrs:{}}))return o}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:a,media:i}=this,{label:o,languageCode:r}=t[e],l=this.getExistingTrack(o,r);if(l)a[e]=l,$s(a[e]),Ff(a[e],i);else{const d=this.createTextTrack("captions",o,r);d&&(d[e]=!0,a[e]=d)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const a=t.label,i={_id:e,label:a,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,a){const i=this.media;if(i)return i.addTextTrack(e,t,a)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{$s(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=qp(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let a=0;a<t.length;a++)$s(t[a])}onSubtitleTracksUpdated(e,t){const a=t.subtitleTracks||[],i=a.some(o=>o.textCodec===Fl);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Ap(this.tracks,a)){this.tracks=a;return}if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){const r=this.media,l=r?Kn(r.textTracks):null;if(this.tracks.forEach((d,c)=>{let h;if(l){let u=null;for(let f=0;f<l.length;f++)if(l[f]&&Kp(l[f],d)){u=l[f],l[f]=null;break}u&&(h=u)}if(h)$s(h);else{const u=Wp(d);h=this.createTextTrack(u,d.name,d.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),l!=null&&l.length){const d=l.filter(c=>c!==null).map(c=>c.label);d.length&&A.warn(`Media element contains unused subtitle tracks: ${d.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const r=this.tracks.map(l=>({label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}));this.hls.trigger(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(a=>{const i=/(?:CC|SERVICE)([1-4])/.exec(a.instreamId);if(!i)return;const o=`textTrack${i[1]}`,r=this.captionsProperties[o];r&&(r.label=a.name,a.lang&&(r.languageCode=a.lang),r.media=a)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===le.MAIN){var a,i;const{cea608Parser1:o,cea608Parser2:r,lastSn:l}=this,{cc:d,sn:c}=t.frag,h=(a=(i=t.part)==null?void 0:i.index)!=null?a:-1;o&&r&&(c!==l+1||c===l&&h!==this.lastPartIndex+1||d!==this.lastCc)&&(o.reset(),r.reset()),this.lastCc=d,this.lastSn=c,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:a,payload:i}=t;if(a.type===le.SUBTITLE)if(i.byteLength){const o=a.decryptdata,r="stats"in t;if(o==null||!o.encrypted||r){const l=this.tracks[a.level],d=this.vttCCs;d[a.cc]||(d[a.cc]={start:a.start,prevCC:this.prevCC,new:!0},this.prevCC=a.cc),l&&l.textCodec===Fl?this._parseIMSC1(a,i):this._parseVTTs(t)}}else this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const a=this.hls;zp(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),a.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{A.log(`Failed to parse IMSC1: ${i}`),a.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:a,payload:i}=e,{initPTS:o,unparsedVttFrags:r}=this,l=o.length-1;if(!o[a.cc]&&l===-1){r.push(e);return}const d=this.hls,c=(t=a.initSegment)!=null&&t.data?St(a.initSegment.data,new Uint8Array(i)):i;lD(c,this.initPTS[a.cc],this.vttCCs,a.cc,a.start,h=>{this._appendCues(h,a.level),d.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},h=>{const u=h.message==="Missing initPTS for VTT MPEGTS";u?r.push(e):this._fallbackToIMSC1(a,i),A.log(`Failed to parse VTT cue: ${h}`),!(u&&l>a.cc)&&d.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:h})})}_fallbackToIMSC1(e,t){const a=this.tracks[e.level];a.textCodec||zp(t,this.initPTS[e.cc],()=>{a.textCodec=Fl,this._parseIMSC1(e,t)},()=>{a.textCodec="wvtt"})}_appendCues(e,t){const a=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(o=>Mf(i,o))}else{const i=this.tracks[t];if(!i)return;const o=i.default?"default":"subtitles"+t;a.trigger(w.CUES_PARSED,{type:"subtitles",cues:e,track:o})}}onFragDecrypted(e,t){const{frag:a}=t;a.type===le.SUBTITLE&&this.onFragLoaded(w.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:a,cea608Parser2:i}=this;if(!this.enabled||!a||!i)return;const{frag:o,samples:r}=t;if(!(o.type===le.MAIN&&this.closedCaptionsForLevel(o)==="NONE"))for(let l=0;l<r.length;l++){const d=r[l].bytes;if(d){const c=this.extractCea608Data(d);a.addData(r[l].pts,c[0]),i.addData(r[l].pts,c[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:a,endOffsetSubtitles:i,type:o}){const{media:r}=this;if(!(!r||r.currentTime<a)){if(!o||o==="video"){const{captionsTracks:l}=this;Object.keys(l).forEach(d=>cl(l[d],t,a))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:l}=this;Object.keys(l).forEach(d=>cl(l[d],t,i))}}}extractCea608Data(e){const t=[[],[]],a=e[0]&31;let i=2;for(let o=0;o<a;o++){const r=e[i++],l=127&e[i++],d=127&e[i++];if(l===0&&d===0)continue;if((4&r)!==0){const h=3&r;(h===0||h===1)&&(t[h].push(l),t[h].push(d))}}return t}}function Wp(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Kp(s,e){return!!s&&s.kind===Wp(e)&&Il(e,s)}function pD(s,e,t,a){return Math.min(e,a)-Math.max(s,t)}function qp(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Ul{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(w.BUFFER_CODECS,this.onBufferCodecs,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(w.BUFFER_CODECS,this.onBufferCodecs,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const a=this.hls.levels[t.droppedLevel];this.isLevelAllowed(a)&&this.restrictedLevels.push({bitrate:a.bitrate,height:a.height,width:a.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const a=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,a.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&ne(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,a=this.getMaxLevel(e.length-1);a!==this.autoLevelCapping&&A.log(`Setting autoLevelCapping to ${a}: ${e[a].height}p@${e[a].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=a,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const a=t.filter((i,o)=>this.isLevelAllowed(i)&&o<=e);return this.clientRect=null,Ul.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const a=e.getBoundingClientRect();t.width=a.width,t.height=a.height,!t.width&&!t.height&&(t.width=a.right-a.left||e.width||0,t.height=a.bottom-a.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(a=>e.bitrate===a.bitrate&&e.width===a.width&&e.height===a.height)}static getMaxLevelByMediaSize(e,t,a){if(!(e!=null&&e.length))return-1;const i=(l,d)=>d?l.width!==d.width||l.height!==d.height:!0;let o=e.length-1;const r=Math.max(t,a);for(let l=0;l<e.length;l+=1){const d=e[l];if((d.width>=r||d.height>=r)&&i(d,e[l+1])){o=l;break}}return o}}class gD{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const a=this.hls.config;if(a.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),a.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,a){const i=performance.now();if(t){if(this.lastTime){const o=i-this.lastTime,r=a-this.lastDroppedFrames,l=t-this.lastDecodedFrames,d=1e3*r/o,c=this.hls;if(c.trigger(w.FPS_DROP,{currentDropped:r,currentDecoded:l,totalDroppedFrames:a}),d>0&&r>c.config.fpsDroppedMonitoringThreshold*l){let h=c.currentLevel;A.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=h)&&(h=h-1,c.trigger(w.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:c.currentLevel}),c.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=a,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const mi="[eme]";class qs{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=qs.CDMCleanupPromise?[qs.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=A.debug.bind(A,mi),this.log=A.log.bind(A,mi),this.warn=A.warn.bind(A,mi),this.error=A.error.bind(A,mi),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(w.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:a}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===Be.WIDEVINE&&a)return a;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,a=t[e];if(a)return a.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,a=(r,l,d)=>!!r&&d.indexOf(r)===l,i=t.map(r=>r.audioCodec).filter(a),o=t.map(r=>r.videoCodec).filter(a);return i.length+o.length===0&&o.push("avc1.42e01e"),new Promise((r,l)=>{const d=c=>{const h=c.shift();this.getMediaKeysPromise(h,i,o).then(u=>r({keySystem:h,mediaKeys:u})).catch(u=>{c.length?d(c):u instanceof _t?l(u):l(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};d(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:a}=this.config;if(typeof a!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${a}`;return lf===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return a(e,t)}getMediaKeysPromise(e,t,a){const i=k6(e,t,a,this.config.drmSystemOptions),o=this.keySystemAccessPromises[e];let r=o==null?void 0:o.keySystemAccess;if(!r){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),r=this.requestMediaKeySystemAccess(e,i);const l=this.keySystemAccessPromises[e]={keySystemAccess:r};return r.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),r.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),l.mediaKeys=d.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),c.then(u=>u?this.setMediaKeysServerCertificate(h,e,u):h))),l.mediaKeys.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),l.mediaKeys})}return r.then(()=>o.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:a}){this.log(`Creating key-system session "${t}" keyId: ${zt.hexDump(e.keyId||[])}`);const i=a.createSession(),o={decryptdata:e,keySystem:t,mediaKeys:a,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(o),o}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const a=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),o="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(a,o,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return zt.hexDump(e.keyId)}updateKeySession(e,t){var a;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${zt.hexDump(((a=e.decryptdata)==null?void 0:a.keyId)||[])}
|
|
67
|
-
} (data length: ${t&&t.byteLength})`),i.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,a)=>{const i=Qr(this.config),o=e.map(nf).filter(r=>!!r&&i.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(o).then(({keySystem:r})=>{const l=rf(r);l?t(l):a(new Error(`Unable to find format for key-system "${r}"`))}).catch(a)})}loadKey(e){const t=e.keyInfo.decryptdata,a=this.getKeyIdString(t),i=`(keyId: ${a} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let o=this.keyIdToKeySessionPromise[a];return o||(o=this.keyIdToKeySessionPromise[a]=this.getKeySystemForKeyPromise(t).then(({keySystem:r,mediaKeys:l})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(r,l).then(()=>{this.throwIfDestroyed();const d=this.createMediaKeySessionContext({keySystem:r,mediaKeys:l,decryptdata:t});return this.generateRequestWithPreferredKeySession(d,"cenc",t.pssh,"playlist-key")}))),o.catch(r=>this.handleError(r))),o}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof _t?this.hls.trigger(w.ERROR,e.data):this.hls.trigger(w.ERROR,{type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){const i=nf(e.keyFormat),o=i?[i]:Qr(this.config);return this.attemptKeySystemAccess(o)}return a}getKeySystemSelectionPromise(e){if(e.length||(e=Qr(this.config)),e.length===0)throw new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:a}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),a===null)return;let o,r;if(t==="sinf"&&this.config.drmSystems[Be.FAIRPLAY]){const u=Ke(new Uint8Array(a));try{const f=Xr(JSON.parse(u).sinf),p=yf(new Uint8Array(f));if(!p)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=p.subarray(8,24),r=Be.FAIRPLAY}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}}else{const u=K6(a),f=u.filter(p=>p.systemId===_a.WIDEVINE)[0];if(!f){u.length===0||u.some(p=>!p.systemId)?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${u.map(p=>of(p.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(r=of(f.systemId),f.version===0&&f.data){const p=f.data.length-22;o=f.data.subarray(p,p+16)}}if(!r||!o)return;const l=zt.hexDump(o),{keyIdToKeySessionPromise:d,mediaKeySessions:c}=this;let h=d[l];for(let u=0;u<c.length;u++){const f=c[u],p=f.decryptdata;if(!p.keyId)continue;const m=zt.hexDump(p.keyId);if(l===m||p.uri.replace(/-/g,"").indexOf(l)!==-1){if(h=d[m],p.pssh)break;delete d[m],p.pssh=new Uint8Array(a),p.keyId=o,h=d[l]=h.then(()=>this.generateRequestWithPreferredKeySession(f,t,a,"encrypted-event-key-match"));break}}h||(h=d[l]=this.getKeySystemSelectionPromise([r]).then(({keySystem:u,mediaKeys:f})=>{var p;this.throwIfDestroyed();const m=new Ea("ISO-23001-7",l,(p=rf(u))!=null?p:"");return m.pssh=new Uint8Array(a),m.keyId=o,this.attemptSetMediaKeys(u,f).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:m,keySystem:u,mediaKeys:f});return this.generateRequestWithPreferredKeySession(g,t,a,"encrypted-event-no-match")})})),h.catch(u=>this.handleError(u))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const a=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(a).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),a.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(o=>a.indexOf(o)===-1)})}generateRequestWithPreferredKeySession(e,t,a,i){var o,r;const l=(o=this.config.drmSystems)==null||(r=o[e.keySystem])==null?void 0:r.generateRequest;if(l)try{const m=l.call(this.hls,t,a,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,a=e.decryptdata.pssh=m.initData?new Uint8Array(m.initData):null}catch(m){var d;if(this.warn(m.message),(d=this.hls)!=null&&d.config.debug)throw m}if(a===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${c} (init data type: ${t} length: ${a?a.byteLength:null})`);const h=new Ll,u=e._onmessage=m=>{const g=e.mediaKeysSession;if(!g){h.emit("error",new Error("invalid state"));return}const{messageType:y,message:b}=m;this.log(`"${y}" message event for session "${g.sessionId}" message size: ${b.byteLength}`),y==="license-request"||y==="license-renewal"?this.renewLicense(e,b).catch(S=>{this.handleError(S),h.emit("error",S)}):y==="license-release"?e.keySystem===Be.FAIRPLAY&&(this.updateKeySession(e,Zr("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${y}"`)},f=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const y=e.keyStatus;h.emit("keyStatus",y),y==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",f);const p=new Promise((m,g)=>{h.on("error",g),h.on("keyStatus",y=>{y.startsWith("usable")?m():y==="output-restricted"?g(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):y==="internal-error"?g(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${y}"`)):y==="expired"?g(new Error("key expired while generating request")):this.warn(`unhandled key status change "${y}"`)})});return e.mediaKeysSession.generateRequest(t,a).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${c}`)}).catch(m=>{throw new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>p).catch(m=>{throw h.removeAllListeners(),this.removeSession(e),m}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,a)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${zt.hexDump("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))} session keyId: ${zt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,a=t.loader,i=new a(t),o=this.getServerCertificateUrl(e);return o?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,l)=>{const d={responseType:"arraybuffer",url:o},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,p,m,g)=>{r(f.data)},onError:(f,p,m,g)=>{l(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Xe({url:d.url,data:void 0},f)},`"${e}" certificate request failed (${o}). Status: ${f.code} (${f.text})`))},onTimeout:(f,p,m)=>{l(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:d.url,data:void 0}},`"${e}" certificate request timed out (${o})`))},onAbort:(f,p,m)=>{l(new Error("aborted"))}};i.load(d,h,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,a){return new Promise((i,o)=>{e.setServerCertificate(a).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${a==null?void 0:a.byteLength}) on "${t}"`),i(e)}).catch(r=>{o(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(a=>this.updateKeySession(e,new Uint8Array(a)).catch(i=>{throw new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const a=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!a.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(a,"application/xml"),o=i.querySelectorAll("HttpHeader");if(o.length>0){let h;for(let u=0,f=o.length;u<f;u++){var r,l;h=o[u];const p=(r=h.querySelector("name"))==null?void 0:r.textContent,m=(l=h.querySelector("value"))==null?void 0:l.textContent;p&&m&&e.setRequestHeader(p,m)}}const d=i.querySelector("Challenge"),c=d==null?void 0:d.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return Zr(atob(c))}setupLicenseXHR(e,t,a,i){const o=this.config.licenseXhrSetup;return o?Promise.resolve().then(()=>{if(!a.decryptdata)throw new Error("Key removed");return o.call(this.hls,e,t,a,i)}).catch(r=>{if(!a.decryptdata)throw r;return e.open("POST",t,!0),o.call(this.hls,e,t,a,i)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const a=this.config.keyLoadPolicy.default;return new Promise((i,o)=>{const r=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${r}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return o(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let d=l.response;this.log(`License received ${d instanceof ArrayBuffer?d.byteLength:d}`);const c=this.config.licenseResponseCallback;if(c)try{d=c.call(this.hls,l,r,e)}catch(h){this.error(h)}i(d)}else{const d=a.errorRetry,c=d?d.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||l.status>=400&&l.status<500)o(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:l,response:{url:r,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${r}). Status: ${l.status} (${l.statusText})`));else{const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,o)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,r,e,t).then(({xhr:d,licenseChallenge:c})=>{e.keySystem==Be.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(d,c)),d.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const a=t.media;this.media=a,a.addEventListener("encrypted",this.onMediaEncrypted),a.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ea.clearKeyUriToKeyIdMap();const a=t.length;qs.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{a&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const a=t.reduce((i,o)=>(i.indexOf(o.keyFormat)===-1&&i.push(o.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${a.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(a)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:a}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),a&&a.readyState!==XMLHttpRequest.DONE&&a.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(o=>{this.log(`Could not remove session: ${o}`)}).then(()=>t.close()).catch(o=>{this.log(`Could not close session: ${o}`)})}}}qs.CDMCleanupPromise=void 0;class _t extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var lt;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(lt||(lt={}));var zl;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(zl||(zl={}));var Cs;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(Cs||(Cs={}));const yD={[Cs.OBJECT]:["br","d","ot","tb"],[Cs.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Cs.SESSION]:["cid","pr","sf","sid","st","v"],[Cs.STATUS]:["bs","rtp"]};class Ys{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(a=>a instanceof Ys?a:new Ys(a))),this.value=e,this.params=t}}class Yp{constructor(e){this.description=void 0,this.description=e}}const bD="Dict";function SD(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function wD(s,e,t,a){return new Error(`failed to ${s} "${SD(e)}" as ${t}`,{cause:a})}const Jp="Bare Item",_D="Boolean",kD="Byte Sequence",ED="Decimal",TD="Integer";function CD(s){return s<-999999999999999||999999999999999<s}const xD=/[\x00-\x1f\x7f]+/,vD="Token",AD="Key";function Kt(s,e,t){return wD("serialize",s,e,t)}function LD(s){if(typeof s!="boolean")throw Kt(s,_D);return s?"?1":"?0"}function ID(s){return btoa(String.fromCharCode(...s))}function RD(s){if(ArrayBuffer.isView(s)===!1)throw Kt(s,kD);return`:${ID(s)}:`}function Xp(s){if(CD(s))throw Kt(s,TD);return s.toString()}function ND(s){return`@${Xp(s.getTime()/1e3)}`}function Zp(s,e){if(s<0)return-Zp(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const i=Math.floor(s*t);return(i%2===0?i:i+1)/t}else return Math.round(s*t)/t}function BD(s){const e=Zp(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Kt(s,ED);const t=e.toString();return t.includes(".")?t:`${t}.0`}const DD="String";function PD(s){if(xD.test(s))throw Kt(s,DD);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function OD(s){return s.description||s.toString().slice(7,-1)}function Qp(s){const e=OD(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Kt(e,vD);return e}function Gl(s){switch(typeof s){case"number":if(!ne(s))throw Kt(s,Jp);return Number.isInteger(s)?Xp(s):BD(s);case"string":return PD(s);case"symbol":return Qp(s);case"boolean":return LD(s);case"object":if(s instanceof Date)return ND(s);if(s instanceof Uint8Array)return RD(s);if(s instanceof Yp)return Qp(s);default:throw Kt(s,Jp)}}function jl(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw Kt(s,AD);return s}function Hl(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${jl(e)}`:`;${jl(e)}=${Gl(t)}`).join("")}function eg(s){return s instanceof Ys?`${Gl(s.value)}${Hl(s.params)}`:Gl(s)}function FD(s){return`(${s.value.map(eg).join(" ")})${Hl(s.params)}`}function MD(s,e={whitespace:!0}){if(typeof s!="object")throw Kt(s,bD);const t=s instanceof Map?s.entries():Object.entries(s),a=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,o])=>{o instanceof Ys||(o=new Ys(o));let r=jl(i);return o.value===!0?r+=Hl(o.params):(r+="=",Array.isArray(o.value)?r+=FD(o):r+=eg(o)),r}).join(`,${a}`)}function $D(s,e){return MD(s,e)}const VD=s=>s==="ot"||s==="sf"||s==="st",UD=s=>typeof s=="number"?ne(s):s!=null&&s!==""&&s!==!1;function zD(s,e){const t=new URL(s),a=new URL(e);if(t.origin!==a.origin)return s;const i=t.pathname.split("/").slice(1),o=a.pathname.split("/").slice(1,-1);for(;i[0]===o[0];)i.shift(),o.shift();for(;o.length;)o.shift(),i.unshift("..");return i.join("/")}function GD(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const o=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?o:o&3|8).toString(16)})}}}const fi=s=>Math.round(s),jD=(s,e)=>(e!=null&&e.baseUrl&&(s=zD(s,e.baseUrl)),encodeURIComponent(s)),pi=s=>fi(s/100)*100,HD={br:fi,d:fi,bl:pi,dl:pi,mtp:pi,nor:jD,rtp:pi,tb:fi};function WD(s,e){const t={};if(s==null||typeof s!="object")return t;const a=Object.keys(s).sort(),i=Ge({},HD,e==null?void 0:e.formatters),o=e==null?void 0:e.filter;return a.forEach(r=>{if(o!=null&&o(r))return;let l=s[r];const d=i[r];d&&(l=d(l,e)),!(r==="v"&&l===1)&&(r=="pr"&&l===1||UD(l)&&(VD(r)&&typeof l=="string"&&(l=new Yp(l)),t[r]=l))}),t}function tg(s,e={}){return s?$D(WD(s,e),Ge({whitespace:!1},e)):""}function KD(s,e={}){if(!s)return{};const t=Object.entries(s),a=Object.entries(yD).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((o,r)=>{var l,d;const[c,h]=r,u=((l=a.find(f=>f[1].includes(c)))==null?void 0:l[0])||Cs.REQUEST;return(d=o[u])!=null||(o[u]={}),o[u][c]=h,o},{});return Object.entries(i).reduce((o,[r,l])=>(o[r]=tg(l,e),o),{})}function qD(s,e,t){return Ge(s,KD(e,t))}const YD="CMCD";function JD(s,e={}){if(!s)return"";const t=tg(s,e);return`${YD}=${encodeURIComponent(t)}`}const sg=/CMCD=[^&#]+/;function XD(s,e,t){const a=JD(e,t);if(!a)return s;if(sg.test(s))return s.replace(sg,a);const i=s.includes("?")?"&":"?";return`${s}${i}${a}`}class ZD{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:lt.MANIFEST,su:!this.initialized})}catch(o){A.warn("Could not generate manifest CMCD data.",o)}},this.applyFragmentData=i=>{try{const o=i.frag,r=this.hls.levels[o.level],l=this.getObjectType(o),d={d:o.duration*1e3,ot:l};(l===lt.VIDEO||l===lt.AUDIO||l==lt.MUXED)&&(d.br=r.bitrate/1e3,d.tb=this.getTopBandwidth(l)/1e3,d.bl=this.getBufferLength(l)),this.apply(i,d)}catch(o){A.warn("Could not generate segment CMCD data.",o)}},this.hls=e;const t=this.config=e.config,{cmcd:a}=t;a!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||GD(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.includeKeys=a.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHED,this.onMediaDetached,this),e.on(w.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHED,this.onMediaDetached,this),e.off(w.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var a,i;this.audioBuffer=(a=t.tracks.audio)==null?void 0:a.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:zl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ge(t,this.createData());const a=t.ot===lt.INIT||t.ot===lt.VIDEO||t.ot===lt.MUXED;this.starved&&a&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((o,r)=>(i.includes(r)&&(o[r]=t[r]),o),{})),this.useHeaders?(e.headers||(e.headers={}),qD(e.headers,t)):e.url=XD(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return lt.TIMED_TEXT;if(e.sn==="initSegment")return lt.INIT;if(t==="audio")return lt.AUDIO;if(t==="main")return this.hls.audioTracks.length?lt.VIDEO:lt.MUXED}getTopBandwidth(e){let t=0,a;const i=this.hls;if(e===lt.AUDIO)a=i.audioTracks;else{const o=i.maxAutoLevel,r=o>-1?o+1:i.levels.length;a=i.levels.slice(0,r)}for(const o of a)o.bitrate>t&&(t=o.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,a=e===lt.AUDIO?this.audioBuffer:this.videoBuffer;return!a||!t?NaN:De.bufferInfo(a,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}}const QD=3e5;class eP{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=A.log.bind(A,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(a=>a!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:a}=t;a!==null&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:a}=t;if((a==null?void 0:a.action)===nt.SendAlternateToPenaltyBox&&a.flags===Pt.MoveAllAlternatesMatchingHost){const i=this.levels;let o=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:l,pathwayId:d,type:c}=t.context;l&&i?r=this.getPathwayForGroupId(l,c,r):d&&(r=d)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!o&&i&&(o=i.reduce((l,d)=>(l.indexOf(d.pathwayId)===-1&&l.push(d.pathwayId),l),[])),o&&o.length>1&&(this.updatePathwayPriority(o),a.resolved=this.pathwayId!==r),a.resolved||A.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${i&&i.length} priorities: ${JSON.stringify(o)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const a=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${a}"`),t=this.getLevelsForPathway(a),this.pathwayId=a}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const a=this.penalizedPathways,i=performance.now();Object.keys(a).forEach(o=>{i-a[o]>QD&&delete a[o]});for(let o=0;o<e.length;o++){const r=e[o];if(r in a)continue;if(r===this.pathwayId)return;const l=this.hls.nextLoadLevel,d=this.hls.levels[l];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,Kf(t),this.hls.trigger(w.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[l];d&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==d.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==d.bitrate&&this.log(`Unstable Pathways change from bitrate ${d.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,t,a){const i=this.getLevelsForPathway(a).concat(this.levels||[]);for(let o=0;o<i.length;o++)if(t===xe.AUDIO_TRACK&&i[o].hasAudioGroup(e)||t===xe.SUBTITLE_TRACK&&i[o].hasSubtitleGroup(e))return i[o].pathwayId;return a}clonePathways(e){const t=this.levels;if(!t)return;const a={},i={};e.forEach(o=>{const{ID:r,"BASE-ID":l,"URI-REPLACEMENT":d}=o;if(t.some(h=>h.pathwayId===r))return;const c=this.getLevelsForPathway(l).map(h=>{const u=new Oe(h.attrs);u["PATHWAY-ID"]=r;const f=u.AUDIO&&`${u.AUDIO}_clone_${r}`,p=u.SUBTITLES&&`${u.SUBTITLES}_clone_${r}`;f&&(a[u.AUDIO]=f,u.AUDIO=f),p&&(i[u.SUBTITLES]=p,u.SUBTITLES=p);const m=ng(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),g=new Vs({attrs:u,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:m,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let y=1;y<h.audioGroups.length;y++)g.addGroupId("audio",`${h.audioGroups[y]}_clone_${r}`);if(h.subtitleGroups)for(let y=1;y<h.subtitleGroups.length;y++)g.addGroupId("text",`${h.subtitleGroups[y]}_clone_${r}`);return g});t.push(...c),ag(this.audioTracks,a,d,r),ag(this.subtitleTracks,i,d,r)})}loadSteeringManifest(e){const t=this.hls.config,a=t.loader;this.loader&&this.loader.destroy(),this.loader=new a(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+h)}const o={responseType:"json",url:i.href},r=t.steeringManifestLoadPolicy.default,l=r.errorRetry||r.timeoutRetry||{},d={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},c={onSuccess:(h,u,f,p)=>{this.log(`Loaded steering manifest: "${i}"`);const m=h.data;if(m.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":b}=m;if(g)try{this.uri=new self.URL(g,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||f.url),y&&this.clonePathways(y);const S={steeringManifest:m,url:i.toString()};this.hls.trigger(w.STEERING_MANIFEST_LOADED,S),b&&this.updatePathwayPriority(b)},onError:(h,u,f,p)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${u.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let m=this.timeToLoad*1e3;if(h.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const y=g.getResponseHeader("Retry-After");y&&(m=parseFloat(y)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,m)},onTimeout:(h,u,f)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(o,d,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var a;const i=(a=this.hls)==null?void 0:a.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function ag(s,e,t,a){s&&Object.keys(e).forEach(i=>{const o=s.filter(r=>r.groupId===i).map(r=>{const l=Ge({},r);return l.details=void 0,l.attrs=new Oe(l.attrs),l.url=l.attrs.URI=ng(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),l.groupId=l.attrs["GROUP-ID"]=e[i],l.attrs["PATHWAY-ID"]=a,l});s.push(...o)})}function ng(s,e,t,a){const{HOST:i,PARAMS:o,[t]:r}=a;let l;e&&(l=r==null?void 0:r[e],l&&(s=l));const d=new self.URL(s);return i&&!l&&(d.host=i),o&&Object.keys(o).sort().forEach(c=>{c&&d.searchParams.set(c,o[c])}),d.href}const tP=/^age:\s*[\d.]+\s*$/im;class ig{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new $n,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,a){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=a,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const a=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const o=this.xhrSetup;o?Promise.resolve().then(()=>{if(!(this.loader!==a||this.stats.aborted))return o(a,t.url)}).catch(r=>{if(!(this.loader!==a||this.stats.aborted))return a.open("GET",t.url,!0),o(a,t.url)}).then(()=>{this.loader!==a||this.stats.aborted||this.openAndSendXhr(a,t,e)}).catch(r=>{this.callbacks.onError({code:a.status,text:r.message},t,a,i)}):this.openAndSendXhr(a,t,e)}openAndSendXhr(e,t,a){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:o,maxLoadTimeMs:r}=a.loadPolicy;if(i)for(const l in i)e.setRequestHeader(l,i[l]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),a.timeout=o&&ne(o)?o:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:a}=this;if(!e||!t)return;const i=t.readyState,o=this.config;if(!a.aborted&&i>=2&&(a.loading.first===0&&(a.loading.first=Math.max(self.performance.now(),a.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(a.loading.first-a.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const r=t.status,l=t.responseType!=="text";if(r>=200&&r<300&&(l&&t.response||t.responseText!==null)){a.loading.end=Math.max(self.performance.now(),a.loading.first);const d=l?t.response:t.responseText,c=t.responseType==="arraybuffer"?d.byteLength:d.length;if(a.loaded=a.total=c,a.bwEstimate=a.total*8e3/(a.loading.end-a.loading.first),!this.callbacks)return;const h=this.callbacks.onProgress;if(h&&h(a,e,d,t),!this.callbacks)return;const u={url:t.responseURL,data:d,code:r};this.callbacks.onSuccess(u,a,e,t)}else{const d=o.loadPolicy.errorRetry,c=a.retry,h={url:e.url,data:void 0,code:r};Zn(d,c,!1,h)?this.retry(d):(A.error(`${r} while loading ${e.url}`),this.callbacks.onError({code:r,text:t.statusText},e,t,a))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Zn(e,t,!0))this.retry(e);else{var a;A.warn(`timeout while loading ${(a=this.context)==null?void 0:a.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:a}=this;this.retryDelay=pl(e,a.retry),a.retry++,A.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${a.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&tP.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function sP(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const aP=/(\d+)-(\d+)\/(\d+)/;class og{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||rP,this.controller=new self.AbortController,this.stats=new $n}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,a){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const o=nP(e,this.controller.signal),r=a.onProgress,l=e.responseType==="arraybuffer",d=l?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:h}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=a,this.request=this.fetchSetup(e,o),self.clearTimeout(this.requestTimeout),t.timeout=c&&ne(c)?c:h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const f=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},h-(f-i.loading.start)),!u.ok){const{status:p,statusText:m}=u;throw new lP(m||"fetch, bad network response",p,u)}return i.loading.first=f,i.total=oP(u.headers)||i.total,r&&ne(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,r):l?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const p=u[d];p&&(i.loaded=i.total=p);const m={url:f.url,data:u,code:f.status};r&&!ne(t.highWaterMark)&&r(i,e,u,f),a.onSuccess(m,i,e,f)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const f=u&&u.code||0,p=u?u.message:null;a.onError({code:f,text:p},e,u?u.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,a,i=0,o){const r=new ip,l=e.body.getReader(),d=()=>l.read().then(c=>{if(c.done)return r.dataLength&&o(t,a,r.flush(),e),Promise.resolve(new ArrayBuffer(0));const h=c.value,u=h.length;return t.loaded+=u,u<i||r.dataLength?(r.push(h),r.dataLength>=i&&o(t,a,r.flush(),e)):o(t,a,h,e),d()}).catch(()=>Promise.reject());return d()}}function nP(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ge({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function iP(s){const e=aP.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function oP(s){const e=s.get("Content-Range");if(e){const a=iP(e);if(ne(a))return a}const t=s.get("Content-Length");if(t)return parseInt(t)}function rP(s,e){return new self.Request(s.url,e)}class lP extends Error{constructor(e,t,a){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=a}}const cP=/\s/,dP={newCue(s,e,t,a){const i=[];let o,r,l,d,c;const h=self.VTTCue||self.TextTrackCue;for(let f=0;f<a.rows.length;f++)if(o=a.rows[f],l=!0,d=0,c="",!o.isEmpty()){var u;for(let g=0;g<o.chars.length;g++)cP.test(o.chars[g].uchar)&&l?d++:(c+=o.chars[g].uchar,l=!1);o.cueStartTime=e,e===t&&(t+=1e-4),d>=16?d--:d++;const p=$p(c.trim()),m=Ol(e,t,p);s!=null&&(u=s.cues)!=null&&u.getCueById(m)||(r=new h(e,t,p),r.id=m,r.line=f+1,r.align="left",r.position=10+Math.min(80,Math.floor(d*8/32)*10),i.push(r))}return s&&i.length&&(i.sort((f,p)=>f.line==="auto"||p.line==="auto"?0:f.line>8&&p.line>8?p.line-f.line:f.line-p.line),i.forEach(f=>Mf(s,f))),i}},hP={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},rg=Xe(Xe({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:ig,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:MN,bufferController:zB,capLevelController:Ul,errorController:xN,fpsController:gD,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:lf,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:hP},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},uP()),{},{subtitleStreamController:MB,subtitleTrackController:VB,timelineController:fD,audioStreamController:OB,audioTrackController:FB,emeController:qs,cmcdController:ZD,contentSteeringController:eP});function uP(){return{cueHandler:dP,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function mP(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Wl(s),a=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return a.forEach(o=>{const r=`${o==="level"?"playlist":o}LoadPolicy`,l=e[r]===void 0,d=[];i.forEach(c=>{const h=`${o}Loading${c}`,u=e[h];if(u!==void 0&&l){d.push(h);const f=t[r].default;switch(e[r]={default:f},c){case"TimeOut":f.maxLoadTimeMs=u,f.maxTimeToFirstByteMs=u;break;case"MaxRetry":f.errorRetry.maxNumRetry=u,f.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":f.errorRetry.retryDelayMs=u,f.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=u,f.timeoutRetry.maxRetryDelayMs=u;break}}}),d.length&&A.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(e[r])}`)}),Xe(Xe({},t),e)}function Wl(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Wl):Object.keys(s).reduce((e,t)=>(e[t]=Wl(s[t]),e),{}):s}function fP(s){const e=s.loader;e!==og&&e!==ig?(A.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):sP()&&(s.loader=og,s.progressive=!0,s.enableSoftwareAES=!0,A.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Kl;class pP extends yl{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.LEVEL_LOADED,this.onLevelLoaded,this),e.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.LEVEL_LOADED,this.onLevelLoaded,this),e.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const a=this.hls.config.preferManagedMediaSource,i=[],o={},r={};let l=!1,d=!1,c=!1;t.levels.forEach(h=>{var u,f;const p=h.attrs;let{audioCodec:m,videoCodec:g}=h;((u=m)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(Kl||(Kl=/chrome|firefox/i.test(navigator.userAgent)),Kl&&(h.audioCodec=m=void 0)),m&&(h.audioCodec=m=Wn(m,a)),((f=g)==null?void 0:f.indexOf("avc1"))===0&&(g=h.videoCodec=tN(g));const{width:y,height:b,unknownCodecs:S}=h;if(l||(l=!!(y&&b)),d||(d=!!g),c||(c=!!m),S!=null&&S.length||m&&!ol(m,"audio",a)||g&&!ol(g,"video",a))return;const{CODECS:_,"FRAME-RATE":C,"HDCP-LEVEL":T,"PATHWAY-ID":v,RESOLUTION:E,"VIDEO-RANGE":N}=p,R=`${`${v||"."}-`}${h.bitrate}-${E}-${C}-${_}-${N}-${T}`;if(o[R])if(o[R].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const $=r[R]+=1;h.attrs["PATHWAY-ID"]=new Array($+1).join(".");const K=new Vs(h);o[R]=K,i.push(K)}else o[R].addGroupId("audio",p.AUDIO),o[R].addGroupId("text",p.SUBTITLES);else{const $=new Vs(h);o[R]=$,r[R]=1,i.push($)}}),this.filterAndSortMediaOptions(i,t,l,d,c)}filterAndSortMediaOptions(e,t,a,i,o){let r=[],l=[],d=e;if((a||i)&&o&&(d=d.filter(({videoCodec:m,videoRange:g,width:y,height:b})=>(!!m||!!(y&&b))&&fN(g))),d.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const m=new Error("no level with compatible codecs found in manifest");this.hls.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:m,reason:m.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:m}=this.hls.config;r=t.audioTracks.filter(g=>!g.audioCodec||ol(g.audioCodec,"audio",m)),lg(r)}t.subtitles&&(l=t.subtitles,lg(l));const c=d.slice(0);d.sort((m,g)=>{if(m.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"])return(m.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&m.height!==g.height)return m.height-g.height;if(m.frameRate!==g.frameRate)return m.frameRate-g.frameRate;if(m.videoRange!==g.videoRange)return Yn.indexOf(m.videoRange)-Yn.indexOf(g.videoRange);if(m.videoCodec!==g.videoCodec){const y=Cf(m.videoCodec),b=Cf(g.videoCodec);if(y!==b)return b-y}if(m.uri===g.uri&&m.codecSet!==g.codecSet){const y=Hn(m.codecSet),b=Hn(g.codecSet);if(y!==b)return b-y}return m.averageBitrate!==g.averageBitrate?m.averageBitrate-g.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let m=0;m<c.length;m++)if(c[m].pathwayId===d[0].pathwayId){h=c[m];break}}this._levels=d;for(let m=0;m<d.length;m++)if(d[m]===h){var u;this._firstLevel=m;const g=h.bitrate,y=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${g}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const b=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);b>y&&y===rg.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=b)}break}const f=o&&!i,p={levels:d,audioTracks:r,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:i,altAudio:!f&&r.some(m=>!!m.url)};this.hls.trigger(w.MANIFEST_PARSED,p),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(w.ERROR,{type:fe.OTHER_ERROR,details:B.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:h,reason:h.message}),u)return;e=Math.min(e,t.length-1)}const a=this.currentLevelIndex,i=this.currentLevel,o=i?i.attrs["PATHWAY-ID"]:void 0,r=t[e],l=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,a===e&&r.details&&i&&o===l)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${l?" with Pathway "+l:""} from level ${a}${o?" with Pathway "+o:""}`);const d={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(w.LEVEL_SWITCHING,d);const c=r.details;if(!c||c.live){const h=this.switchParams(r.uri,i==null?void 0:i.details,c);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===xe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===le.MAIN){const a=t.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var a;const{level:i,details:o}=t,r=this._levels[i];if(!r){var l;this.warn(`Invalid level index ${i}`),(l=t.deliveryDirectives)!=null&&l.skip&&(o.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0),this.playlistLoaded(i,t,r.details)):(a=t.deliveryDirectives)!=null&&a.skip&&(o.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){let i=a.uri;if(e)try{i=e.addDirectives(i)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}const o=a.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${o?" Pathway "+o:""} ${i}`),this.clearTimer(),this.hls.trigger(w.LEVEL_LOADING,{url:i,level:t,pathwayId:a.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const a=this._levels.filter((i,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(r=>r.level=-1)),!1));Kf(a),this._levels=a,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(w.LEVELS_UPDATED,{levels:a})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:a}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(w.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:a}))}}function lg(s){const e={};s.forEach(t=>{const a=t.groupId||"";t.id=e[a]=e[a]||0,e[a]++})}class gP{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const a in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[a].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=B.KEY_LOAD_ERROR,a,i,o){return new Zt({type:fe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:a,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:a,cc:i}=e;for(let o=0;o<t.length;o++){const r=t[o];if(i<=r.cc&&(a==="initSegment"||r.sn==="initSegment"||a<r.sn)){this.emeController.selectKeySystemFormat(r).then(l=>{r.setKeyFormat(l)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var a,i;t&&e.setKeyFormat(t);const o=e.decryptdata;if(!o){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,B.KEY_LOAD_ERROR,c))}const r=o.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,B.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));let l=this.keyUriToKeyInfo[r];if((a=l)!=null&&a.decryptdata.key)return o.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if((i=l)!=null&&i.keyLoadPromise){var d;switch((d=l.mediaKeySessionContext)==null?void 0:d.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then(c=>(o.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:l}))}}switch(l=this.keyUriToKeyInfo[r]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,B.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${o.method}"`)))}}loadKeyEME(e,t){const a={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(a);if(i)return(e.keyLoadPromise=i.then(o=>(e.mediaKeySessionContext=o,a))).catch(o=>{throw e.keyLoadPromise=null,o})}return Promise.resolve(a)}loadKeyHTTP(e,t){const a=this.config,i=a.loader,o=new i(a);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise((r,l)=>{const d={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=a.keyLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,p,m,g)=>{const{frag:y,keyInfo:b,url:S}=m;if(!y.decryptdata||b!==this.keyUriToKeyInfo[S])return l(this.createKeyLoadError(y,B.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));b.decryptdata.key=y.decryptdata.key=new Uint8Array(f.data),y.keyLoader=null,b.loader=null,r({frag:y,keyInfo:b})},onError:(f,p,m,g)=>{this.resetLoader(p),l(this.createKeyLoadError(t,B.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),m,Xe({url:d.url,data:void 0},f)))},onTimeout:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,B.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,B.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};o.load(d,h,u)})}resetLoader(e){const{frag:t,keyInfo:a,url:i}=e,o=a.loader;t.keyLoader===o&&(t.keyLoader=null,a.loader=null),delete this.keyUriToKeyInfo[i],o&&o.destroy()}}function cg(){return self.SourceBuffer||self.WebKitSourceBuffer}function dg(){if(!Es())return!1;const e=cg();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function yP(){if(!dg())return!1;const s=Es();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(Ta(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(Ta(e,"audio"))))}function bP(){var s;const e=cg();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const SP=250,gi=2,wP=.1,_P=.05;class kP{constructor(e,t,a,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=a,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:a,media:i,stalled:o}=this;if(i===null)return;const{currentTime:r,seeking:l}=i,d=this.seeking&&!l,c=!this.seeking&&l;if(this.seeking=l,r!==e){if(this.moved=!0,l||(this.nudgeRetry=0),o!==null){if(this.stallReported){const y=self.performance.now()-o;A.warn(`playback not stuck anymore @${r}, after ${Math.round(y)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||d){this.stalled=null;return}if(i.paused&&!l||i.ended||i.playbackRate===0||!De.getBuffered(i).length){this.nudgeRetry=0;return}const h=De.bufferInfo(i,r,0),u=h.nextStart||0;if(l){const y=h.len>gi,b=!u||t&&t.start<=r||u-r>gi&&!this.fragmentTracker.getPartialFragment(r);if(y||b)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var f;if(!(h.len>0)&&!u)return;const b=Math.max(u,h.start||0)-r,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(S==null||(f=S.details)==null?void 0:f.live)?S.details.targetduration*2:gi,T=this.fragmentTracker.getPartialFragment(r);if(b>0&&(b<=C||T)){i.paused||this._trySkipBufferHole(T);return}}const p=self.performance.now();if(o===null){this.stalled=p;return}const m=p-o;if(!l&&m>=SP&&(this._reportStall(h),!this.media))return;const g=De.bufferInfo(i,r,a.maxBufferHole);this._tryFixBufferStall(g,m)}_tryFixBufferStall(e,t){const{config:a,fragmentTracker:i,media:o}=this;if(o===null)return;const r=o.currentTime,l=i.getPartialFragment(r);l&&(this._trySkipBufferHole(l)||!this.media)||(e.len>a.maxBufferHole||e.nextStart&&e.nextStart-r<a.maxBufferHole)&&t>a.highBufferWatchdogPeriod*1e3&&(A.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:a,stallReported:i}=this;if(!i&&a){this.stallReported=!0;const o=new Error(`Playback stalling at @${a.currentTime} due to low buffer (${JSON.stringify(e)})`);A.warn(o.message),t.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:a,media:i}=this;if(i===null)return 0;const o=i.currentTime,r=De.bufferInfo(i,o,0),l=o<r.start?r.start:r.nextStart;if(l){const d=r.len<=t.maxBufferHole,c=r.len>0&&r.len<1&&i.readyState<3,h=l-o;if(h>0&&(d||c)){if(h>t.maxBufferHole){const{fragmentTracker:f}=this;let p=!1;if(o===0){const m=f.getAppendedFrag(0,le.MAIN);m&&l<m.end&&(p=!0)}if(!p){const m=e||f.getAppendedFrag(o,le.MAIN);if(m){let g=!1,y=m.end;for(;y<l;){const b=f.getPartialFragment(y);if(b)y+=b.duration;else{g=!0;break}}if(g)return 0}}}const u=Math.max(l+_P,o+wP);if(A.warn(`skipping hole, adjusting currentTime from ${o} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const f=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${u}`);a.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:a,nudgeRetry:i}=this;if(a===null)return;const o=a.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const r=o+(i+1)*e.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${o} to ${r}`);A.warn(l.message),a.currentTime=r,t.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1})}else{const r=new Error(`Playhead still not moving while enough data buffered @${o} after ${e.nudgeMaxRetry} nudges`);A.error(r.message),t.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}const EP=100;class TP extends wl{constructor(e,t,a){super(e,t,a,"[stream-controller]",le.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.LEVEL_LOADING,this.onLevelLoading,this),e.on(w.LEVEL_LOADED,this.onLevelLoaded,this),e.on(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(w.ERROR,this.onError,this),e.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(w.BUFFER_CREATED,this.onBufferCreated,this),e.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.LEVEL_LOADED,this.onLevelLoaded,this),e.off(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(w.ERROR,this.onError,this),e.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(w.BUFFER_CREATED,this.onBufferCreated,this),e.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:a}=this;if(this.stopLoad(),this.setInterval(EP),this.level=-1,!this.startFragRequested){let i=a.startLevel;i===-1&&(a.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=a.firstAutoLevel),a.nextLoadLevel=i,this.level=a.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=V.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=V.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case V.WAITING_LEVEL:{const{levels:t,level:a}=this,i=t==null?void 0:t[a],o=i==null?void 0:i.details;if(o&&(!o.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(o))break;this.state=V.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=V.IDLE;break}break}case V.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),a=this.retryDate;if(!a||t>=a||(e=this.media)!=null&&e.seeking){const{levels:i,level:o}=this,r=i==null?void 0:i[o];this.resetStartWhenNotLoaded(r||null),this.state=V.IDLE}}break}this.state===V.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:a,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const o=e.nextLoadLevel;if(!(a!=null&&a[o]))return;const r=a[o],l=this.getMainFwdBufferInfo();if(l===null)return;const d=this.getLevelDetails();if(d&&this._streamEnded(l,d)){const g={};this.altAudio&&(g.type="video"),this.hls.trigger(w.BUFFER_EOS,g),this.state=V.ENDED;return}e.loadLevel!==o&&e.manualLevel===-1&&this.log(`Adapting to level ${o} from level ${this.level}`),this.level=e.nextLoadLevel=o;const c=r.details;if(!c||this.state===V.WAITING_LEVEL||c.live&&this.levelLastLoaded!==r){this.level=o,this.state=V.WAITING_LEVEL;return}const h=l.len,u=this.getMaxBufferLength(r.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:l.end;let p=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&p&&p.sn!=="initSegment"&&this.fragmentTracker.getState(p)!==Ze.OK){var m;const y=((m=this.backtrackFragment)!=null?m:p).sn-c.startSN,b=c.fragments[y-1];b&&p.cc===b.cc&&(p=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,f)){if(!p.gap){const y=this.audioOnly&&!this.altAudio?Re.AUDIO:Re.VIDEO,b=(y===Re.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,y,le.MAIN)}p=this.getNextFragmentLoopLoading(p,c,l,le.MAIN,u)}p&&(p.initSegment&&!p.initSegment.data&&!this.bitrateTest&&(p=p.initSegment),this.loadFragment(p,r,f))}loadFragment(e,t,a){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===Ze.NOT_LOADED||i===Ze.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,a)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,le.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let a;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const o=this.getLevelDetails();if(o!=null&&o.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<o.targetduration*2)return}if(!t.paused&&e){const l=this.hls.nextLoadLevel,d=e[l],c=this.fragLastKbps;c&&this.fragCurrent?a=this.fragCurrent.duration*d.maxBitrate/(1e3*c)+1:a=0}else a=0;const r=this.getBufferedFrag(t.currentTime+a);if(r){const l=this.followingBufferedFrag(r);if(l){this.abortCurrentFrag();const d=l.maxStartPTS?l.maxStartPTS:l.start,c=l.duration,h=Math.max(r.end,d+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case V.KEY_LOADING:case V.FRAG_LOADING:case V.FRAG_LOADING_WAITING_RETRY:case V.PARSING:case V.PARSED:this.state=V.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const a=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new kP(this.config,a,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;ne(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const a=this.getMainFwdBufferInfo();if(a===null||a.len===0){this.warn(`Main forward buffer length on "seeked" event ${a?a.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(w.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let a=!1,i=!1;t.levels.forEach(o=>{const r=o.audioCodec;r&&(a=a||r.indexOf("mp4a.40.2")!==-1,i=i||r.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=a&&i&&!bP(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:a}=this;if(!a||this.state!==V.IDLE)return;const i=a[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=V.WAITING_LEVEL)}onLevelLoaded(e,t){var a;const{levels:i}=this,o=t.level,r=t.details,l=r.totalduration;if(!i){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""}, cc [${r.startCC}, ${r.endCC}] duration:${l}`);const d=i[o],c=this.fragCurrent;c&&(this.state===V.FRAG_LOADING||this.state===V.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let h=0;if(r.live||(a=d.details)!=null&&a.live){var u;if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;h=this.alignPlaylists(r,d.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(d.details=r,this.levelLastLoaded=d,this.hls.trigger(w.LEVEL_UPDATED,{details:r,level:o}),this.state===V.WAITING_LEVEL){if(this.waitForCdnTuneIn(r))return;this.state=V.IDLE}this.startFragRequested?r.live&&this.synchronizeToLiveEdge(r):this.setStartPosition(r,h),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:a,part:i,payload:o}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${a.sn} of level ${a.level} will not be buffered`);return}const l=r[a.level],d=l.details;if(!d){this.warn(`Dropping fragment ${a.sn} of level ${a.level} after level details were reset`),this.fragmentTracker.removeFragment(a);return}const c=l.videoCodec,h=d.PTSKnown||!d.live,u=(t=a.initSegment)==null?void 0:t.data,f=this._getAudioCodec(l),p=this.transmuxer=this.transmuxer||new vp(this.hls,le.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=i?i.index:-1,g=m!==-1,y=new bl(a.level,a.sn,a.stats.chunkCount,o.byteLength,m,g),b=this.initPTS[a.cc];p.push(o,u,f,c,a,i,d.totalduration,h,y,b)}onAudioTrackSwitching(e,t){const a=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const o=this.hls;a&&(o.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(w.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const a=t.id,i=!!this.hls.audioTracks[a].url;if(i){const o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const a=t.tracks;let i,o,r=!1;for(const l in a){const d=a[l];if(d.id==="main"){if(o=l,i=d,l==="video"){const c=a[l];c&&(this.videoBuffer=c.buffer)}}else r=!0}r&&i?(this.log(`Alternate track found, use ${o}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:a,part:i}=t;if(a&&a.type!==le.MAIN)return;if(this.fragContextChanged(a)){this.warn(`Fragment ${a.sn}${i?" p: "+i.index:""} of level ${a.level} finished buffering, but was aborted. state: ${this.state}`),this.state===V.PARSED&&(this.state=V.IDLE);return}const o=i?i.stats:a.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,i)}onError(e,t){var a;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case B.FRAG_GAP:case B.FRAG_PARSING_ERROR:case B.FRAG_DECRYPT_ERROR:case B.FRAG_LOAD_ERROR:case B.FRAG_LOAD_TIMEOUT:case B.KEY_LOAD_ERROR:case B.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.MAIN,t);break;case B.LEVEL_LOAD_ERROR:case B.LEVEL_LOAD_TIMEOUT:case B.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_LEVEL&&((a=t.context)==null?void 0:a.type)===xe.LEVEL&&(this.state=V.IDLE);break;case B.BUFFER_APPEND_ERROR:case B.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===B.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case B.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!De.getBuffered(e).length){const a=this.state!==V.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,a)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=V.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Re.AUDIO||this.audioOnly&&!this.altAudio){const a=(t===Re.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(a,t,le.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let a=this.startPosition;if(a>=0&&t<a){if(e.seeking){this.log(`could not seek to ${a}, already seeking at ${t}`);return}const i=De.getBuffered(e),r=(i.length?i.start(0):0)-a;r>0&&(r<this.config.maxBufferHole||r<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${r} to match buffer start`),a+=r,this.startPosition=a),this.log(`seek to target start position ${a} from current time ${t}`),e.currentTime=a}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(a=>{const{hls:i}=this;if(!a||this.fragContextChanged(e))return;t.fragmentError=0,this.state=V.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=e.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),i.trigger(w.FRAG_LOADED,a),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const a="main",{hls:i}=this,{remuxResult:o,chunkMeta:r}=e,l=this.getCurrentContext(r);if(!l){this.resetWhenMissingContext(r);return}const{frag:d,part:c,level:h}=l,{video:u,text:f,id3:p,initSegment:m}=o,{details:g}=h,y=this.altAudio?void 0:o.audio;if(this.fragContextChanged(d)){this.fragmentTracker.removeFragment(d);return}if(this.state=V.PARSING,m){if(m!=null&&m.tracks){const _=d.initSegment||d;this._bufferInitSegment(h,m.tracks,_,r),i.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:a,tracks:m.tracks})}const b=m.initPTS,S=m.timescale;ne(b)&&(this.initPTS[d.cc]={baseTime:b,timescale:S},i.trigger(w.INIT_PTS_FOUND,{frag:d,id:a,initPTS:b,timescale:S}))}if(u&&g&&d.sn!=="initSegment"){const b=g.fragments[d.sn-1-g.startSN],S=d.sn===g.startSN,_=!b||d.cc>b.cc;if(o.independent!==!1){const{startPTS:C,endPTS:T,startDTS:v,endDTS:E}=u;if(c)c.elementaryStreams[u.type]={startPTS:C,endPTS:T,startDTS:v,endDTS:E};else if(u.firstKeyFrame&&u.independent&&r.id===1&&!_&&(this.couldBacktrack=!0),u.dropped&&u.independent){const N=this.getMainFwdBufferInfo(),L=(N?N.end:this.getLoadPosition())+this.config.maxBufferHole,R=u.firstKeyFramePTS?u.firstKeyFramePTS:C;if(!S&&L<R-this.config.maxBufferHole&&!_){this.backtrack(d);return}else _&&(d.gap=!0);d.setElementaryStreamInfo(u.type,d.start,T,d.start,E,!0)}else S&&C>gi&&(d.gap=!0);d.setElementaryStreamInfo(u.type,C,T,v,E),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(u,d,c,r,S||_)}else if(S||_)d.gap=!0;else{this.backtrack(d);return}}if(y){const{startPTS:b,endPTS:S,startDTS:_,endDTS:C}=y;c&&(c.elementaryStreams[Re.AUDIO]={startPTS:b,endPTS:S,startDTS:_,endDTS:C}),d.setElementaryStreamInfo(Re.AUDIO,b,S,_,C),this.bufferFragmentData(y,d,c,r)}if(g&&p!=null&&(t=p.samples)!=null&&t.length){const b={id:a,frag:d,details:g,samples:p.samples};i.trigger(w.FRAG_PARSING_METADATA,b)}if(g&&f){const b={id:a,frag:d,details:g,samples:f.samples};i.trigger(w.FRAG_PARSING_USERDATA,b)}}_bufferInitSegment(e,t,a,i){if(this.state!==V.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:o,video:r,audiovideo:l}=t;if(o){let d=e.audioCodec;const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const h=o.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&o.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),e.audioCodec&&e.audioCodec!==d&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${d}"`),o.levelCodec=d,o.id="main",this.log(`Init audio buffer, container:${o.container}, codecs[selected/level/parsed]=[${d||""}/${e.audioCodec||""}/${o.codec}]`)}r&&(r.levelCodec=e.videoCodec,r.id="main",this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${r.codec}]`)),l&&this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),this.hls.trigger(w.BUFFER_CODECS,t),Object.keys(t).forEach(d=>{const h=t[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(w.BUFFER_APPENDING,{type:d,data:h,frag:a,part:null,chunkMeta:i,parent:a.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,le.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=V.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const a=e.currentTime;if(De.isBuffered(e,a)?t=this.getAppendedFrag(a):De.isBuffered(e,a+.1)&&(t=this.getAppendedFrag(a+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,o=t.level;(!i||t.sn!==i.sn||i.level!==o)&&(this.fragPlaying=t,this.hls.trigger(w.FRAG_CHANGED,{frag:t}),(!i||i.level!==o)&&this.hls.trigger(w.LEVEL_SWITCHED,{level:o}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,a=this.currentFrag;if(a&&ne(t)&&ne(a.programDateTime)){const i=a.programDateTime+(t-a.start)*1e3;return new Date(i)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ds{static get version(){return"1.5.15"}static isMSESupported(){return dg()}static isSupported(){return yP()}static getMediaSource(){return Es()}static get Events(){return w}static get ErrorTypes(){return fe}static get ErrorDetails(){return B}static get DefaultConfig(){return ds.defaultConfig?ds.defaultConfig:rg}static set DefaultConfig(e){ds.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Ll,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,u6(e.debug||!1,"Hls instance");const t=this.config=mP(ds.DefaultConfig,e);this.userConfig=e,t.progressive&&fP(t);const{abrController:a,bufferController:i,capLevelController:o,errorController:r,fpsController:l}=t,d=new r(this),c=this.abrController=new a(this),h=this.bufferController=new i(this),u=this.capLevelController=new o(this),f=new l(this),p=new oN(this),m=new hN(this),g=t.contentSteeringController,y=g?new g(this):null,b=this.levelController=new pP(this,y),S=new VN(this),_=new gP(this.config),C=this.streamController=new TP(this,S,_);u.setStreamController(C),f.setStreamController(C);const T=[p,b,C];y&&T.splice(1,0,y),this.networkControllers=T;const v=[c,h,u,f,m,S];this.audioTrackController=this.createController(t.audioTrackController,T);const E=t.audioStreamController;E&&T.push(new E(this,S,_)),this.subtitleTrackController=this.createController(t.subtitleTrackController,T);const N=t.subtitleStreamController;N&&T.push(new N(this,S,_)),this.createController(t.timelineController,v),_.emeController=this.emeController=this.createController(t.emeController,v),this.cmcdController=this.createController(t.cmcdController,v),this.latencyController=this.createController(uN,v),this.coreComponents=v,T.push(d);const L=d.onErrorOut;typeof L=="function"&&this.on(w.ERROR,L,d)}createController(e,t){if(e){const a=new e(this);return t&&t.push(a),a}return null}on(e,t,a=this){this._emitter.on(e,t,a)}once(e,t,a=this){this._emitter.once(e,t,a)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,a=this,i){this._emitter.off(e,t,a,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,a){return this._emitter.emit(e,t,a)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(a){if(A.error("An internal error happened while handling event "+e+'. Error message: "'+a.message+'". Here is a stacktrace:',a),!this.triggeringException){this.triggeringException=!0;const i=e===w.ERROR;this.trigger(w.ERROR,{type:fe.OTHER_ERROR,details:B.INTERNAL_EXCEPTION,fatal:i,event:e,error:a}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){A.log("destroy"),this.trigger(w.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){A.log("attachMedia"),this._media=e,this.trigger(w.MEDIA_ATTACHING,{media:e})}detachMedia(){A.log("detachMedia"),this.trigger(w.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,a=this.url,i=this.url=qr.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,A.log(`loadSource:${i}`),t&&a&&(a!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(w.MANIFEST_LOADING,{url:e})}startLoad(e=-1){A.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){A.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){A.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){A.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){A.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){A.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){A.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){A.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){A.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(A.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){mN(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const a=e.length;for(let i=0;i<a;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:a}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,a)for(let o=i;o--;){const r=e[o].attrs["HDCP-LEVEL"];if(r&&r<=a)return o}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}ds.defaultConfig=void 0;const CP=[(s=>(n.pushScopeId("data-v-d3c9a398"),s=s(),n.popScopeId(),s))(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[n.createElementVNode("path",{d:"M5 15L15 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"}),n.createElementVNode("path",{d:"M15 15L5 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],xP={class:"stories__content"},vP={class:"story-container-game"},AP={class:"story-circle"},LP={class:"story-result"},IP={class:"stories__content__stories-bar"},RP={class:"stories__content__video"},NP={class:"stories__content__video__info__date"},BP={class:"stories__content__video__info__data"},DP=qe({__name:"GameStories",props:{stories:{type:Array,default:()=>[]},startStoryIndex:{type:Number,default:0},isFirstGameStories:{type:Boolean,default:!1},isLastGameStories:{type:Boolean,default:!1}},emits:["close","last-story-index","swipe","video-play","video-next-back"],setup(s,{emit:e}){const t=s;n.useCssVars(se=>({"559904cd":y.value,"57a9d8d4":b.value,"57d750a1":v.value}));const a=Wo(),o=[{ids:[607,608],name:"Oportunidad de Gol"},{ids:[12,55],name:"Gol"},{ids:[54,35],name:"Autogol"},{ids:[14,52],name:"Tarjeta Amarilla"},{ids:[15,53],name:"Tarjeta Roja"},{ids:[466,477],name:"Penal Recibido"}].reduce((se,Ee)=>(Ee.ids.forEach(Te=>{se.set(Te,Ee.name)}),se),new Map),r=n.ref(null),l=n.ref(null),d=n.ref([]),c=n.ref(0),h=n.ref(null),u=n.ref(0),f=n.ref(0),p=n.ref(0),m=n.ref(!1),g=n.ref(0),y=n.ref("auto"),b=n.ref("100%"),S=n.ref(null),_=n.ref(0),C=n.ref(null),T=n.ref(null),v=n.computed(()=>Z()?"7vw":"16px"),E=n.computed(()=>d.value[c.value]),N=n.computed(()=>({"--icon-play":`url(${a}/icnplay1.svg)`}));function L(){l.value.muted=!1,l.value.play()}const R=n.computed(()=>!E.value.isHls&&["ios"].includes(Ko()));n.watch(()=>E.value,se=>{se&&K()}),n.watch(()=>t.stories,se=>{if(se.length){c.value=0,p.value=0;const Ee=se.map(Te=>({...Te,progress:0,isHls:Te.url.includes(".m3u8"),date:`${Te.date.getDate()}, ${eu[Te.date.getMonth()]} ${Te.date.getFullYear()}`,data:`${o.get(Te.categoryId)} ${Fx(Te.player.player_name)}`})).sort((Te,Fe)=>Te.startTime-Fe.startTime);t.startStoryIndex>0&&t.startStoryIndex<Ee.length-1&&(Ee.forEach((Te,Fe)=>{Fe<=t.startStoryIndex&&(Te.progress=100)}),c.value=t.startStoryIndex+1,p.value=c.value),d.value=[...Ee]}},{immediate:!0}),n.watch(()=>r.value,se=>{se&&$()},{flush:"post"}),n.watch(()=>h.value,se=>{se&&(Ox()?(se.addEventListener("touchstart",he),se.addEventListener("touchend",J)):(se.addEventListener("mousedown",he),se.addEventListener("mouseup",J)))},{flush:"post"});function $(){l.value=new Ps("#video-plyr",{controls:[],autoplay:!0,playsinline:!0}),l.value.on("loadeddata",ae(l.value)),l.value.on("timeupdate",oe()),K(E.value),l.value.isDestroyed=!1}function K(){E.value.isHls?z(E.value):l.value&&(l.value.source={type:"video",sources:[{src:E.value.url,type:"video/mp4"}]})}function z(se){if(r.value)if(ds.isSupported()){r.value.src=null;let Ee=new ds;Ee.loadSource(se.url),Ee.attachMedia(r.value)}else l.value.source={type:"video",sources:[{src:se.url,type:"video/mp4"}]}}function ae(){const se=document.querySelector(".plyr__video-wrapper");return se&&(_.value=se.getBoundingClientRect()),()=>{l.value.duration>0&&(l.value.currentTime=E.value.startTime||0,l.value.muted=!1,l.value.play(),e("video-play",E.value))}}function oe(){return Ce(),()=>{E.value.currentTime=l.value.currentTime,E.value.progress=(l.value.currentTime-E.value.startTime)/E.value.duration*100,(l.value.currentTime-E.value.startTime)/E.value.duration*100===0?Z()&&(m.value=!0):Z()&&(m.value=!1),(l.value.currentTime-E.value.startTime)/E.value.duration*100<0?T.value&&!Z()&&(T.value.style="display: none",b.value="100%"):T.value&&!Z()&&(T.value.style="display: block",b.value="auto"),l.value.currentTime>=E.value.endTime&&(l.value.pause(),ie())}}function ie(se=1){const Ee=c.value+se;Ee<0?t.isFirstGameStories?l.value&&(l.value.currentTime=E.value.startTime):de("right",E.value):Ee===d.value.length?t.isLastGameStories?q():de("left",E.value):(c.value=Ee,se===1&&(p.value=c.value))}function ce(){u.value>f.value?de("left",E.value):u.value<f.value?de("right",E.value):Q()}function de(se,Ee){e("last-story-index",p.value),e("swipe",{direction:se,currentPlay:Ee})}function Q(){const se=window.innerWidth/2,Ee=u.value<se,Te=E.value.progress;E.value.progress=Ee?0:100,l.value.pause(),e("video-next-back",{eventName:Ee?"stories_video_anterior":"stories_video_siguiente",currentPlay:{...E.value,progress:Te}}),ie(Ee?-1:1)}function q(){l.value.pause(),l.value.muted=!0,e("last-story-index",p.value),e("close",E.value)}function he(se){u.value=se.changedTouches?se.changedTouches[0].clientX:se.clientX}function J(se){f.value=se.changedTouches?se.changedTouches[0].clientX:se.clientX,ce()}function Z(){return/iPhone|iPad/i.test(navigator.userAgent)}function ue(){window.scrollTo(0,100)}function ge(){if(window.scrollTo(0,100),Ko()=="android"){const se=document.querySelector("#stories");se.requestFullscreen(se)}}function Ce(){if(window.ResizeObserver)S.value=new window.ResizeObserver(()=>{C.value&&_.value.height>0&&(C.value.getBoundingClientRect().height>610?y.value="auto":y.value="100dvh",C.value.getBoundingClientRect().height>610?b.value="100%":b.value="auto")}),S.value.observe(C.value);else throw new Error("Resize observer not supported!")}return n.onMounted(()=>{g.value=document.documentElement.scrollTop||document.body.scrollTop,window.scrollTo(0,100),Z()?(window.addEventListener("resize",ue),ue()):(window.addEventListener("orientationchange",ge),ge()),setTimeout(()=>{Ce()},500)}),n.onBeforeUnmount(()=>{window.scrollTo(0,g.value),Z()?window.removeEventListener("resize",ue):(Ko()=="android"&&document.exitFullscreen(),window.removeEventListener("orientationchange",ge)),S.value&&(S.value.disconnect(),S.value=null)}),(se,Ee)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stories",Z()?"stories-safe-areas-iphone":""]),id:"stories",ref_key:"eStories",ref:C,style:n.normalizeStyle(N.value)},[n.createElementVNode("div",{class:n.normalizeClass(["stories__close",Z()?"stories-safe-areas-iphone":""]),onClick:q},CP,2),n.createElementVNode("div",xP,[n.createElementVNode("div",vP,[n.createElementVNode("div",AP,[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle(`background-image: url(${E.value.thumbnail.logoHomeTeam})`)},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle(`background-image: url(${E.value.thumbnail.logoAwayTeam})`)},null,4)]),n.createElementVNode("div",LP,n.toDisplayString(E.value.header.label),1)]),n.createElementVNode("div",{ref_key:"overlay",ref:h,class:"stories__content__overlay"},null,512),n.createElementVNode("div",IP,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(Te,Fe)=>(n.openBlock(),n.createElementBlock("div",{key:Fe,class:"stories__content__stories-bar__item"},[n.createElementVNode("div",{class:"stories__content__stories-bar__item__progress",style:n.normalizeStyle({width:`${Te.progress}%`})},null,4)]))),128))]),n.createElementVNode("div",RP,[n.createElementVNode("div",{class:"stories__content__video__info",ref_key:"videoInfo",ref:T},[n.createElementVNode("div",NP,n.toDisplayString(E.value.date),1),n.createElementVNode("div",BP,n.toDisplayString(E.value.data),1)],512),n.createElementVNode("video",{ref_key:"player",ref:r,id:"video-plyr",controls:"",preload:"auto","data-setup":"{}",playsinline:""},null,512)])]),R.value?(n.openBlock(),n.createElementBlock("button",{key:0,id:"btn_play_ios",style:n.normalizeStyle(m.value?"display:block":"display:none"),onClick:L},null,4)):n.createCommentVNode("",!0)],6))}},[["__scopeId","data-v-d3c9a398"]]),PP={playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00-PI-0",last_played_index:0,group_id:"1",total_plays:55,playlist_type:"1",group_playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00",user_id:"goltesting",created_at:"2023-03-30T15:42:36.402+00:00",playlist:[[136731235,"Liga MX","Apertura 2022",69929,"Aldrete Rodriguez, Adrian","Quintero Huitron, Daniel","Estadio Olímpico Universitario, Ciudad de México.","1 - 0","1 - 0","2022-07-17T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",1259,1278,20,1266,"https://golstatsbets.blob.core.windows.net/video-player/69929_1.mp4"],[139820484,"Liga MX","Apertura 2022",70042,"Davila Zavala, Victor","Mejia, Oscar ","Estadio Nuevo Monumental, Rafaela.","3 - 1","1 - 0","2022-09-18T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",1501,1524,24,1512,"https://golstatsbets.blob.core.windows.net/video-player/70042_1.mp4"],[139566427,"Liga MX","Apertura 2022",69989,"Zaldivar Caviedes, Angel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","1 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",12,"Goals",6569,6588,108,6576,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[139441913,"Liga MX","Apertura 2022",70031,"Vega Rojas, Alexis","Quintero Huitron, Daniel","Estadio Akron, Zapopan.","1 - 0","1 - 0","2022-09-10T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",6207,6237,103,6225,"https://golstatsbets.blob.core.windows.net/video-player/70031_1.mp4"],[139566063,"Liga MX","Apertura 2022",69989,"Guzman Palomeque, Nahuel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","0 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",39,"Saves",2554,2573,41,2561,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[138276096,"Liga MX","Apertura 2022",69983,"Cortizo de la Piedra, Jordi","Guerrero Ramirez, Fernando","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-08-16T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",5020,5046,83,5034,"https://golstatsbets.blob.core.windows.net/video-player/69983_1.mp4"],[139285589,"Liga MX","Apertura 2022",70021,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-09-07T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png",12,"Goals",1123,1152,18,1140,"https://golstatsbets.blob.core.windows.net/video-player/70021_1.mp4"],[139294964,"Liga MX","Apertura 2022",70022,"Cordova Reyes, Francisco","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicolás de los Garza.","3 - 1","1 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",2564,2583,41,2571,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137782451,"Liga MX","Apertura 2022",69968,"Orrantia Trevino, Carlos","Macias Romo, Oscar","Estadio TSM Corona, Torreón.","4 - 0","1 - 0","2022-08-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",4662,4693,77,4681,"https://golstatsbets.blob.core.windows.net/video-player/69968_1.mp4"],[136551560,"Liga MX","Apertura 2022",69924,"Sanchez Guerrero, Richard","Escobedo, Adonai","Estadio Azteca, Ciudad de México.","1 - 0","1 - 0","2022-07-13T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",7032,7064,116,7052,"https://golstatsbets.blob.core.windows.net/video-player/69924_1.mp4"],[136391881,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","1 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",4903,4937,81,4925,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[138158049,"Liga MX","Apertura 2022",69979,"Volpi, Tiago Luis","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",39,"Saves",7207,7226,119,7214,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[138124884,"Liga MX","Apertura 2022",69978,"Vargas Gil, Camilo","Ortiz Nava, Marco Antonio","Default","1 - 1","0 - 0","2022-08-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6080,6099,100,6087,"https://golstatsbets.blob.core.windows.net/video-player/69978_1.mp4"],[139635463,"Liga MX","Apertura 2022",69950,"Fidalgo Fernandez, Alvaro","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",10,"Assists",7096,7123,118,7111,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139769221,"Liga MX","Apertura 2022",70039,"Ochoa Magana, Guillermo","Escobedo, Adonai","Estadio Azteca, Ciudad de México.","2 - 1","0 - 0","2022-09-17T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",39,"Saves",4567,4586,76,4574,"https://golstatsbets.blob.core.windows.net/video-player/70039_1.mp4"],[139405626,"Liga MX","Apertura 2022",70028,"Acevedo Lopez, Carlos","Santander, Luis Enrique","Estadio La Corregidora, Querétaro.","3 - 3","0 - 2","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",55,"Goals",7452,7471,124,7459,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139410464,"Liga MX","Apertura 2022",70030,"Gonzalez Vela Alvizu, Julio","Hernandez Gomez, Fernando","Estadio Nemesio Diez, Toluca.","2 - 2","0 - 1","2022-09-10T05:00:00.000Z","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",55,"Goals",7467,7486,124,7474,"https://golstatsbets.blob.core.windows.net/video-player/70030_1.mp4"],[139902797,"Liga MX","Apertura 2022",70038,"Quinones Quinones, Julian","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",702,"Con enfrentamiento",2334,2353,38,2341,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[139771860,"Liga MX","Apertura 2022",70038,"Andrada, Esteban ","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6859,6878,113,6866,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[136392028,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","0 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",607,"Oportunidad de gol",335,374,5,342,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[136467302,"Liga MX","Apertura 2022",69909,"Jurado Roca, Sebastian","Mejia, Oscar ","Estadio Universitario, San Nicolás de los Garza.","2 - 3","0 - 0","2022-07-02T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",39,"Saves",879,898,14,886,"https://golstatsbets.blob.core.windows.net/video-player/69909_1.mp4"],[138402354,"Liga MX","Apertura 2022",69990,"Beltran Cruz, Fernando","Mejia, Oscar ","Estadio Victoria, Aguascalientes.","0 - 4","0 - 1","2022-08-19T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",12,"Goals",4517,4551,75,4539,"https://golstatsbets.blob.core.windows.net/video-player/69990_1.mp4"],[138157481,"Liga MX","Apertura 2022",69979,"Meneses Villarroel, Jean","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",1900,1925,31,1913,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[140106188,"Liga MX","Apertura 2022",69964,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 1","1 - 0","2022-09-23T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",12,"Goals",461,484,7,472,"https://golstatsbets.blob.core.windows.net/video-player/69964_1.mp4"],[139839994,"Liga MX","Apertura 2022",70043,"Garcia Carpizo, Brian","Montano Robles, Diego","Estadio Caliente, Tijuana.","1 - 1","0 - 1","2022-09-18T05:00:00.000Z","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",2112,2133,34,2121,"https://golstatsbets.blob.core.windows.net/video-player/70043_1.mp4"],[139403868,"Liga MX","Apertura 2022",70028,"Suarez, Leonardo Gabriel","Santander, Luis Enrique","Estadio La Corregidora, Querétaro.","3 - 3","0 - 1","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",4296,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139371616,"Liga MX","Apertura 2022",70027,"Gallardo Vasconcelos, Jesus","Montano Robles, Diego","Estadio Olimpico Benito Juarez, Ciudad Juarez.","0 - 1","0 - 1","2022-09-09T05:00:00.000Z","FC Juarez","https://az755631.vo.msecnd.net/teams-80/3014.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",5724,5750,94,5738,"https://golstatsbets.blob.core.windows.net/video-player/70027_1.mp4"],[139294028,"Liga MX","Apertura 2022",70022,"Thauvin, Florian","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicolás de los Garza.","3 - 1","2 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",6011,6030,99,6018,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137023432,"Liga MX","Apertura 2022",69939,"Gignac, Andre Pierre","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicolás de los Garza.","2 - 0","1 - 0","2022-07-23T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",2829,2854,47,2842,"https://golstatsbets.blob.core.windows.net/video-player/69939_1.mp4"],[139303531,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Olímpico Universitario, Ciudad de México.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",702,"Con enfrentamiento",262,293,3,278,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139303334,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Olímpico Universitario, Ciudad de México.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",10,"Assists",5256,5283,87,5271,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139633795,"Liga MX","Apertura 2022",69950,"Valdes Contreras, Diego","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",607,"Oportunidad de gol",675,701,10,689,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139242728,"Liga MX","Apertura 2022",70020,"Valdes Contreras, Diego","Caceres Hernandez, Victor Alfonso","Estadio Azteca, Ciudad de México.","3 - 0","0 - 0","2022-09-06T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",10,"Assists",2841,2861,46,2849,"https://golstatsbets.blob.core.windows.net/video-player/70020_1.mp4"],[138747150,"Liga MX","Apertura 2022",7e4,"Valdes Contreras, Diego","Miranda Galindo, Erick Yair","Default","1 - 3","0 - 1","2022-08-26T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",2425,2448,39,2436,"https://golstatsbets.blob.core.windows.net/video-player/70000_1.mp4"],[138462163,"Liga MX","Apertura 2022",69995,"Valdes Contreras, Diego","Santander, Luis Enrique","Estadio Azteca, Ciudad de México.","7 - 0","1 - 0","2022-08-20T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",3424,3443,56,3431,"https://golstatsbets.blob.core.windows.net/video-player/69995_1.mp4"],[138832474,"Liga MX","Apertura 2022",70005,"Sambueza, Rubens Oscar","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torreón.","4 - 1","1 - 1","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",6830,6859,113,6847,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"],[137178428,"Liga MX","Apertura 2022",69942,"Ibarra Mina, Alex Renato","Montano Robles, Diego","Estadio Jalisco, Guadalajara.","1 - 2","0 - 1","2022-07-26T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",12,"Goals",2786,2811,45,2799,"https://golstatsbets.blob.core.windows.net/video-player/69942_1.mp4"],[138339473,"Liga MX","Apertura 2022",69985,"Canelo, Pedro Alexis","Referee 1","Azteca","1 - 2","0 - 0","2022-08-17T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",10,"Assists",5133,5159,85,5147,"https://golstatsbets.blob.core.windows.net/video-player/69985_1.mp4"],[136701989,"Liga MX","Apertura 2022",69927,"Gimenez, Santiago Tomas","Macias Romo, Oscar","Estadio Jalisco, Guadalajara.","3 - 2","0 - 1","2022-07-16T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",1374,1397,22,1385,"https://golstatsbets.blob.core.windows.net/video-player/69927_1.mp4"],[139678329,"Liga MX","Apertura 2022",70049,"Antuna Romero, Carlos","Ortiz Nava, Marco Antonio","Estadio Azteca, Ciudad de México.","2 - 1","0 - 0","2022-09-15T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",10,"Assists",6728,6752,111,6740,"https://golstatsbets.blob.core.windows.net/video-player/70049_1.mp4"],[139054131,"Liga MX","Apertura 2022",70010,"Davila Zavala, Victor","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 1","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",6636,6661,110,6649,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137503273,"Liga MX","Apertura 2022",69962,"Davila Zavala, Victor","Macias Romo, Oscar","Estadio Nou Camp, Le&ocuate;n.","3 - 2","1 - 0","2022-07-31T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",1940,1965,31,1953,"https://golstatsbets.blob.core.windows.net/video-player/69962_1.mp4"],[139308851,"Liga MX","Apertura 2022",70025,"Benedetti Roa, Nicolas","Hernandez Gomez, Fernando","Default","1 - 0","1 - 0","2022-09-07T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",1867,1891,31,1879,"https://golstatsbets.blob.core.windows.net/video-player/70025_1.mp4"],[138116335,"Liga MX","Apertura 2022",69976,"Benedetti Roa, Nicolas","Galvan Basulto, Eduardo","Estadio Nou Camp, Le&ocuate;n.","0 - 3","0 - 1","2022-08-13T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",591,629,9,617,"https://golstatsbets.blob.core.windows.net/video-player/69976_1.mp4"],[136791022,"Liga MX","Apertura 2022",69932,"Benedetti Roa, Nicolas","Camacho Peregrina, Jorge","Estadio Hidalgo, Pachuca.","1 - 1","0 - 1","2022-07-18T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",4284,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/69932_1.mp4"],[139414938,"Liga MX","Apertura 2022",70026,"Batista Ochoa, Facundo","Guerrero Ramirez, Fernando","Estadio Victoria, Aguascalientes.","1 - 2","1 - 0","2022-09-10T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",461,490,7,478,"https://golstatsbets.blob.core.windows.net/video-player/70026_1.mp4"],[139051051,"Liga MX","Apertura 2022",70010,"Batista Ochoa, Facundo","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 0","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2731,2750,45,2738,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137828273,"Liga MX","Apertura 2022",69970,"Batista Ochoa, Facundo","Galvan Basulto, Eduardo","Estadio Alfonso Lastras Ramírez, San Luis Potosí.","1 - 2","0 - 1","2022-08-07T05:00:00.000Z","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",849,870,13,858,"https://golstatsbets.blob.core.windows.net/video-player/69970_1.mp4"],[139025773,"Liga MX","Apertura 2022",70009,"Nahuelpan Osten, Ariel","Lopez Penuelas, Ismael","Estadio La Corregidora, Querétaro.","1 - 1","1 - 0","2022-09-01T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",1454,1481,24,1472,"https://golstatsbets.blob.core.windows.net/video-player/70009_1.mp4"],[138063913,"Liga MX","Apertura 2022",69973,"Gonzalez Gonzalez, Arturo","Pacheco Larios, Guillermo","Estadio Victoria, Aguascalientes.","1 - 2","0 - 1","2022-08-12T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",6119,6138,101,6126,"https://golstatsbets.blob.core.windows.net/video-player/69973_1.mp4"],[137780455,"Liga MX","Apertura 2022",69966,"Gonzalez Gonzalez, Arturo","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","5 - 1","1 - 0","2022-08-06T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2292,2321,38,2309,"https://golstatsbets.blob.core.windows.net/video-player/69966_1.mp4"],[140090831,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",585,612,9,600,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[140090832,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",1175,1197,18,1182,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139227464,"Liga MX","Apertura 2022",70018,"Suarez, Leonardo Gabriel","Quintero Huitron, Daniel","Estadio TSM Corona, Torreón.","3 - 1","1 - 0","2022-09-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",7011,7034,116,7022,"https://golstatsbets.blob.core.windows.net/video-player/70018_1.mp4"],[138830649,"Liga MX","Apertura 2022",70005,"Suarez, Leonardo Gabriel","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torreón.","4 - 1","1 - 0","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",4297,4380,71,4304,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"]]},OP=new Map([[1,45],[2,90],[3,105],[4,120]]),FP=[{id:12,name:"Gol"},{id:55,name:"Gol"},{id:39,name:"Atajada"},{id:10,name:"Asistencia"},{id:702,name:"1vs1 exitoso ofensivo"},{id:607,name:"Oportunidad de gol"}].reduce((s,e)=>(s.set(e.id,e.name),s),new Map);let xa=null,yi=null,bi="";const Ft=a6(),MP={components:{GSCSeasonSelect:nI,GSCTournamentSelect:PL,GSCGames:gv,GSCSlider:ea,GSCGridTeamsMatches:hy,GSCPlayersLanding:ry,GSCTops:pA,GSCTableCalendar:vC,DiscoverVideos:t6,CarouselFullScreen:rL,Stories:DP},setup(){const s=n.ref("landingref"),{elementSize:e}=j0(s);return{landingref:s,elementSize:e}},props:{currentSeasonId:{type:Number,default:0},isFemale:{type:Boolean,default:!1},showStories:{type:Boolean,default:!0},season:{type:Number,default:1772},isplayer:{type:Boolean,default:!1},user:{type:Object,default:()=>{}},privileges:{type:Object,default:()=>{}},team:{type:Number,default:0},player:{type:Number,default:0},gamesPerMatchDay:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},token:{type:String,default:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"},tournamentsApiUrl:{type:String,default:""},defaultMediaPlayerSeason:{type:Number,default:0},checkLiveGamesIntervalMinutes:{type:Number,default:2}},data(){return{isPreviousDataLoaded:!1,imagesUrl:Wo(),roundAbbreviationByGameId:new Map,isCarouselFullScreenVisible:!1,isPlaySeeker:!1,keyupdate:0,carouselPlayerQueue:[],gameEventsUrl:"https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",defaultGameId:0,lastSeasonsIds:[],arrayGamesAdd:[],gamesPages:new Map,show_stories:!0,selectedRoundKeyIndex:0,currentStoriesLastIndex:0,selectedRoundKeyIndexVideo:0,selectedRound:"0",selectedRoundVideos:"0",isLeagueSelected:!1,fullTournamentScheduleFull:[],fullTournamentScheduleFullGoals:[],defaultMatchDayKey:null,isCupTournament:!1,retries:3,userTeamGames:[],userTeamGamesForVideos:[],isCupLegacyTournament:!1,tournamentScheduleKeys:[],tournamentScheduleKeysGoals:[],currentTournamentGames:null,currentTournamentTeams:null,gamesUrl:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/",gamesUrl2:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",seasonSelected:{},seasonSelectedDropDowns:{},seasonsSelected:[],gamesAllStories:[],fullTournamentSchedule:{},tournamentSelected:{id:0},tournamentType:0,tournamentSelectedDropDowns:{seasons:[]},playersLength:0,nextRivalId:0,updateTableCalendar:0,loadDiscover:!1,hasNextRival:!1,resumeType:1,goalsType:2,is_public:!1,seasonsGamesMap:new Map,gamesOfTheDayPreMatchIds:new Set,seasonsForLiveGames:[],allLiveGames:[],storiesItems:[],currentStories:[],currentStoryIndex:null,isStoriesVisible:!1,seasonPlayersMap:new Map,currentTournaments:[]}},computed:{teamSelected(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament?0:this.user.team},isGenericLike(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament},isPlaySeekerAvailable(){return[34230,34178,34201].includes(this.user.id)},games(){if(!this.isGenericLike&&!this.isLeagueSelected)return this.fullTournamentSchedule;{const s=this.gamesPages.get(this.selectedRound);return s&&s[0]?s[0].sort((e,t)=>{let a=e.dateTimeMillis,i=t.dateTimeMillis;return e.is_live&&(a-=1e9),t.is_live&&(i-=1e9),a-i}):[]}},latestRound(){return this.userTeamGames&&this.userTeamGames.length&&this.fullTournamentScheduleFullGoals&&this.fullTournamentScheduleFullGoals.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals)},closestRound(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFull):this.getNormalClosestRound(this.fullTournamentScheduleFull)},closestRoundVideos(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals,!0):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals,!0)},containerGridCalendarTable(){return this.elementSize.width<=1e3?"container-grid-calendar-table-mobile":"container-grid-calendar-table"},containerbackground(){return this.elementSize.width<=680?"container-background-movil":"container-background"},containerdata(){return this.elementSize.width<=680?"container-data-movil":"container-data"}},watch:{games:{immediate:!0,deep:!0,async handler(s){if(s&&s.length>0){if(!this.seasonsSelected.length)return;for(let t=0;t<s.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===s[t].game_id);a!==-1&&(this.gamesAllStories[a].is_live=s[t].is_live,this.gamesAllStories[a].game_status=s[t].game_status)}const e=s.filter(t=>t.is_live);for(let t=0;t<e.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===e[t].game_id);if(a!==-1)this.gamesAllStories[a].score=e[t].score;else{this.gamesAllStories.push(e[t]),this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let i=[];for(let o=0;o<this.gamesAllStories.length;o++)this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)===-1?i.push({game_id:this.gamesAllStories[o].game_id,last_index:0,status:1}):i.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].status});this.arrayGamesAdd=i,await ve.post(bi,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let o=0;o<this.arrayGamesAdd.length;o++)this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].index=this.arrayGamesAdd[o].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].status_storie=this.arrayGamesAdd[o].status)}}}}},"allLiveGames.length":{handler(s){s.length===0&&this.resetGamesLiveInterval()}},privileges:{immediate:!0,deep:!0,async handler(s){this.is_public=s!==null}},team:{immediate:!0,deep:!0,async handler(s){s&&this.seasonsSelected.length&&setTimeout(()=>{this.fetchGames(s,this.seasonsSelected)},1e3)}},closestRound(s){this.selectedRoundKeyIndex=this.tournamentScheduleKeys.findIndex(e=>e===s),this.selectedRound=s},latestRound(s){this.selectedRoundKeyIndexVideo=this.tournamentScheduleKeysGoals.findIndex(e=>e===s),this.selectedRoundVideos=s},isCarouselFullScreenVisible:{handler(s){document.getElementsByTagName("html")[0].style.overflow=s?"hidden":"auto"},immediate:!0}},methods:{getOnlyGamesWithGoals(s){return Object.entries(s).reduce((e,[t,a])=>{const i=a.reduce((o,r)=>{const l=r.games.filter(d=>(d.is_live||d.game_status!==4)&&d.score[0]+d.score[1]>0);return l.length&&o.push({...r,games:l}),o},[]);return i.length&&(e[t]=i),e},{})},async onClickPlaySeeker(){try{const e=await(await fetch("https://rhev2kbe0a.execute-api.us-east-2.amazonaws.com/qa/demo/playseeker")).json();this.formatPlaySeekerPlays(e.data||PP)}catch(s){console.error(s)}},formatPlaySeekerPlays(s){let e=[];s&&s.playlist&&s.playlist.length&&(e=s.playlist.reduce((a,i,o)=>{const l={...Object.entries(Ft).reduce((f,[p,m])=>(f[p]=i[m],f),{}),isPlaySeeker:!0,startSeconds:i[Ft.startTime],endSeconds:i[Ft.endTime],totalSeconds:Math.floor(i[Ft.endTime]-i[Ft.startTime]),payloadData:{play_id:i[Ft.playId],total_plays:s.total_plays,play_number:o+1,group_playlist_id:s.group_playlist_id,playlist_id:s.playlist_id,group_id:s.group_id,moment_of_play:i[Ft.momentOfPlay],play_type:i[Ft.categoryId],viewer_second_start:Math.floor(i[Ft.startTime]),intended_second_start:Math.floor(i[Ft.startTime]),intended_second_end:Math.floor(i[Ft.endTime]),latitude_of_user:null,longitude_of_user:null}},[d,c]=l.playerName.split(","),h=d.split(" ");let u="";for(const f of h)if(u+=` ${f}`,f.length>3)break;if(l.playerShortName=c&&d?`${c.trim().charAt(0)}.${u}`:"",!l.mainCategoryName){const[f,p]=l.finalScore.split(" - ");l.arrayScore=[Number(f),Number(p)]}return l.categoryName=FP.get(l.categoryId),a.push(l),a},[]));let t=[];t=e,this.carouselPlayerQueue=t,this.isPlaySeeker=!0,this.isCarouselFullScreenVisible=!0},formatUsername(s){const e=s.split(",");let t="",a="";return e[1]?(a=e[1].trim().split(" "),a[0]?t=a[0]:t=e[1]):e[0]&&(a=e[0].trim().split(" "),a[0]?t=a[0]:t=e[0]),t.trim()},async fetchGameEvents(s){try{return(await ve.get(`${this.gameEventsUrl}${s}`,{headers:{Authorization:`${this.token}`}})).data}catch(e){throw new Error(e)}},async fetchLiveGames(){try{if(this.seasonsForLiveGames.length===0)return[];const s=this.seasonsForLiveGames.reduce((a,i)=>`${a}seasons=${i}&`,""),e=ve.create({headers:{Authorization:`${this.token}`}}),{data:t}=await e.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${s}`);return t}catch(s){throw new Error(s)}},async onClickOpenCarouselVideos(s){try{this.isPlaySeeker=!1;const t=(await this.fetchGameEvents(s)).plays;this.carouselPlayerQueue=t.filter(a=>a.event_type_id===1&&a.video_link!=="-"),this.isCarouselFullScreenVisible=!0}catch(e){throw new Error(e)}},onChangeMatchDayGames(s){this.selectedRound!==s.key&&(this.selectedRound=s.key)},onClickStory({item:s,index:e}){this.openStory(e),this.onClickStories(s)},onClickLive(){const s=this.allLiveGames[0];if(s){const e=this.seasonsGamesMap.get(s.game_id);e&&(this.selectedRound=e.roundAbbreviationV2)}},onClickCloseCarousel(){this.carouselPlayerQueue=[],this.isPlaySeeker=!1,this.isCarouselFullScreenVisible=!1},onChangeIsLeagueSelected(s){this.isLeagueSelected=s},onAction(s){this.$emit("action",s)},onOpenMedia(s){s.type===1&&s.gameIds&&s.gameIds.length>0?this.onClickOpenCarouselVideos(s.gameIds[0]):this.$emit("openmedia",s)},onOpenProfile(s){this.$emit("onOpenProfile",s)},onClickMatch(s){this.$emit("openGame",s)},onClickCalendar(){const s={type:this.isGenericLike||this.isLeagueSelected?0:1,team:this.team,season:this.seasonSelected.id};this.$emit("onClickMyCalendar",s)},moreTops(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openTops",s)},clickProfileBtn(s){this.$emit("openProfile",s)},viewAll(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openAllPlayers",s)},getTotalPlayers(s){this.playersLength=s},clickCard(s){const e={data:s,isPlayer:this.isplayer};this.$emit("clickOnMainCards",e)},async fetchGames(s,e){const t=e.map(i=>`seasons=${i.id}`).join("&"),a=ve.create({headers:{Authorization:`${this.token}`}});this.fullTournamentSchedule=await a.get(this.gamesUrl+s+"?"+t),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch&&(this.fullTournamentSchedule.data.prematch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.prematch.game_id)),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.postmatch&&(this.fullTournamentSchedule.data.postmatch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.postmatch.game_id)),this.nextRivalId=Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0,this.loadDiscover=!0},generateSeasons(s){const e=[{id:s.id,type:s.type}];return s.related_seasons&&s.related_seasons.length&&e.push(...s.related_seasons.map(t=>({id:t.id,type:t.type}))),e},async onInputTournament(s){this.tournamentSelected=s,this.tournamentType=s.tournament_type,this.tournamentSelected.id&&this.tournamentSelected.id!==s.id&&(this.updateTableCalendar+=1),this.tournamentSelectedDropDowns.id!==s.id&&(this.tournamentSelectedDropDowns=s)},getSeasonDependentPromises({season:s,seasons:e}){const t={headers:{Authorization:`${this.token}`}},a=[ve.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/seasons/${s.id}`,t)];a.push(this.fetchSeasonsGamesAndTeams(e.map(o=>o.id),3)),a.push(this.fetchStoriesPlays(s));const i=`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${s.id}/stories`;return i!==bi&&(bi=i,a.push(ve.get(bi,t))),a},async onInputSeason(s){try{if(this.seasonSelected.id!==s.id){this.isPreviousDataLoaded=!1,this.seasonSelected=s,this.seasonsSelected=this.generateSeasons(s);const e=this.getSeasonDependentPromises({season:s,seasons:this.seasonsSelected,retries:3,createdUrl:""}),[t,a,i,o]=await Promise.all(e);this.seasonPlayersMap=new Map,t.data&&t.data.players&&t.data.players.forEach(r=>{this.seasonPlayersMap.set(r.player_id,r)}),o&&o.data?this.arrayGamesAdd=o.data.stories.stories:this.arrayGamesAdd=[],this.resetGamesLiveInterval(),this.seasonSelected=s,this.show_stories=!!s.show_stories,this.seasonsForLiveGames=[s.id,...s.related_seasons.map(r=>r.id)],this.$emit("change-season-id",s.id),this.fillStoriesData(i,a.seasonsAndGames),await this.createFullTournamentScheme({seasons:this.seasonsSelected,seasonsAndGames:a.seasonsAndGames,seasonsAndTeams:a.seasonsAndTeams,applySeasonsValidation:!1}),this.team&&await this.fetchGames(this.team,this.seasonsSelected),this.keyupdate+=1}}catch(e){throw new Error(e)}},ordenarYFiltrarPartidos(s){const e=s.filter(t=>t.game_status===1||t.is_live==1||t.game_status==0);return e.sort((t,a)=>new Date(a.date_time_utc)-new Date(t.date_time_utc)),e.slice(0,18)},async fetchSeasonsGamesAndTeams(s,e,t=""){let a=t;try{const i=ve.create({headers:{Authorization:`${this.token}`}});a||(a=this.gamesUrl2,s.forEach((l,d)=>{a+=`${d===0?"":"&"}seasons=${l}`}));const{data:{data:o,teams:r}}=await i.get(a);return{seasonsAndGames:o,seasonsAndTeams:r}}catch(i){if(e>0)return this.fetchSeasonsGamesAndTeams(s,e-1,a);throw new Error(i)}},async fetchStoriesPlays(s){try{return await ve.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/videos/plays/seasons/"+s.id+"?categories=607&categories=608&categories=12&categories=55&categories=54&categories=35&categories=15&categories=53&type=1")}catch(e){throw new Error(e)}},fillStoriesData(s,e){let t=s.data?s.data.plays:[];this.gamesAllStories=[];for(let i=0;i<e.length;i++)this.gamesAllStories=this.gamesAllStories.concat(e[i].games);this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let a=[];for(let i=0;i<this.gamesAllStories.length;i++)this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)===-1?a.push({game_id:this.gamesAllStories[i].game_id,last_index:0,status:1}):a.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].status});this.arrayGamesAdd=a;for(let i=0;i<this.arrayGamesAdd.length;i++)this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].index=this.arrayGamesAdd[i].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].status_storie=this.arrayGamesAdd[i].status);this.storiesItems=this.getStoriesStructureVideos(t),setTimeout(()=>{this.sendStoriesData()},1e3)},sendStoriesData(){ve.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}})},getTimeSeconds(s){const[e,t]=s.split(":"),[a,i]=t.split(".");return parseInt(e)*60+parseInt(a)+parseInt(i)/1e3},getPlayTime(s,e){let t="",a=0;switch(s[7]){case 1:t=s[11];break;case 2:t=s[13],a=45;break;case 3:t=s[15],a=90;break;case 4:t=s[17],a=105;break;case 5:t=s[19],a=120;break}return(!t||t==="0")&&(t="00:00"),this.getTimeToSeconds(t)+(this.getTimeToSeconds(s[e])-a*60)},abrirNuevaVentana(){window.open("https://goltipster.com/view-all#golTipster","_blank")},getTimeToSeconds(s){const t=s.indexOf(".")>-1?s.substring(0,s.indexOf(".")):s,[a,i,o]=t.split(":").reverse();return(o?Number(o)*60*60:0)+Number(i)*60+Number(a)},getStoriesStructureVideos(s){let e=[];for(let t=0;t<this.gamesAllStories.length;t++){let a=s.filter(r=>r[3]===this.gamesAllStories[t].game_id).map(r=>({playId:r[29],gameId:r[3],player:this.seasonPlayersMap.get(r[1]),categoryId:r[0],date:new Date(r[4]),url:r[35]==2?"https://daijvvc13prpy.cloudfront.net/golstats-videos/"+this.gamesAllStories[t].game_id+"_1/"+this.gamesAllStories[t].game_id+"_1.m3u8":"https://golstatsbets.blob.core.windows.net/video-player/"+this.gamesAllStories[t].game_id+"_1.mp4",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].visiting_team+".png"},header:{label:this.gamesAllStories[t].home_team_acronym+" "+this.gamesAllStories[t].score[0]+":"+this.gamesAllStories[t].score[1]+" "+this.gamesAllStories[t].visiting_team_acronym+" "+this.gamesAllStories[t].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(r,9),endTime:this.getPlayTime(r,10),duration:Math.floor(this.getTimeSeconds(r[10])-this.getTimeSeconds(r[9]))}));const i={},o=a.filter(r=>i[r.playId]?!1:(i[r.playId]=!0,!0));e.push({game_id:this.gamesAllStories[t].game_id,stories:o})}return e},areSeasonsDifferent(s){for(const e of s)if(!this.lastSeasonsIds.includes(e.season_id))return!0;return!1},async createFullTournamentScheme({seasons:s,seasonsAndGames:e,seasonsAndTeams:t,applySeasonsValidation:a}){try{this.seasonsGamesMap=new Map,this.userTeamGames=[],this.userTeamGamesForVideos=[],this.gamesOfTheDayPreMatchIds.clear();let i=0;if(a&&this.areSeasonsDifferent(e))return;e.forEach(l=>{const d=s.find(c=>c.id===l.season_id);d&&(l.type=d.type,l.games.forEach(c=>{c.season_id=l.season_id}),d.type===0&&(i=l.season_id))});const o={seasonsGames:e},r=t.find(l=>l.season_id===i);if(r){const l=r.teams,d=[...o.seasonsGames],c=o&&o.seasonsGames?o.seasonsGames.map(u=>{const f=u.games.reduce((p,m)=>{const g={...m},y=new Date,[b,S,_]=g.date.split("-"),[C,T,v]=g.schedule.split(":"),E=new Date(Number(b),Number(S)-1,Number(_),Number(C),Number(T),Number(v));return g.dateTimeMillis=E.valueOf(),g.home_team=l.find(N=>N.team_id===m.home_team),g.visiting_team=l.find(N=>N.team_id===m.visiting_team),g.game_status===4&&y.getFullYear()===E.getFullYear()&&y.getMonth()===E.getMonth()&&y.getDate()===E.getDate()&&this.gamesOfTheDayPreMatchIds.add(g.game_id),this.seasonsGamesMap.set(g.game_id,g),p[m.matchday_abbreviation]?p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(g):p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[g]:p[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[g]},this.gsData&&this.gsData.teamId&&g.game_status===4&&(g.home_team.team_id===this.gsData.teamId||g.visiting_team.team_id===this.gsData.teamId)&&(this.userTeamGames.push(g),g.score&&g.score[0]+g.score[1]>0&&this.userTeamGamesForVideos.push(g)),p},{});this.userTeamGames.sort((p,m)=>p.dateTimeMillis-m.dateTimeMillis);for(let[p,m]of Object.entries(f))f[p]=Object.entries(m).map(([g,y])=>({date:g,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[p].sort((g,y)=>g.date<y.date?-1:g.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[],h=o&&o.seasonsGames?d.map(u=>{const f=u.games.reduce((p,m)=>{const g={...m};return g.dateTimeMillis=new Date(g.date_time_utc).valueOf(),g.home_team=l.find(y=>y.team_id===m.home_team),g.visiting_team=l.find(y=>y.team_id===m.visiting_team),p[m.matchday_abbreviation]?p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?(g.game_status!=4||g.is_live==1)&&(g.score[0]!=0||g.score[1]!=0)&&p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(g):(g.game_status!=4||g.is_live==1)&&(g.score[0]!=0||g.score[1]!=0)&&(p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[g]):(g.game_status!=4||g.is_live==1)&&(g.score[0]!=0||g.score[1]!=0)&&(p[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[g]}),p},{});this.userTeamGames.sort((p,m)=>p.dateTimeMillis-m.dateTimeMillis);for(let[p,m]of Object.entries(f))f[p]=Object.entries(m).map(([g,y])=>({date:g,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[p].sort((g,y)=>g.date<y.date?-1:g.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[];c.sort((u,f)=>u.weight-f.weight),this.fullTournamentScheduleFull=c.reduce((u,f)=>{for(const[p,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const g=Mu.get(this.tournamentType);if(g){const y=g.get(p);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const g=p.replace("M",""),y=`Jornada ${g}`;this.isCupLegacy?u[Fu[g]||y]=m:u[Ou[p]||y]=m}else u[Number(p.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(p)?u[p]=m:u[`R${Number(p.replace("PO",""))}`]=m:f.type===1&&(u[Pu[p]]=m);return u},{}),this.fullTournamentScheduleFullGoals=h.reduce((u,f)=>{for(const[p,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const g=Mu.get(this.tournamentType);if(g){const y=g.get(p);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const g=p.replace("M",""),y=`Jornada ${g}`;this.isCupLegacy?u[Fu[g]||y]=m:u[Ou[p]||y]=[]}else u[Number(p.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(p)?u[p]=m:u[`R${Number(p.replace("PO",""))}`]=m:f.type===1&&(u[Pu[p]]=m);return u},{}),this.roundAbbreviationByGameId=new Map,this.tournamentScheduleKeys=Array.from(Object.entries(this.fullTournamentScheduleFull).reduce((u,[f,p])=>{const m=Number(f);let g="";Number.isNaN(m)?g=f:g=m<10?`0${m}`:f;let y=!1,b=null;const S=p.reduce((C,T)=>(!b&&T&&T.games&&T.games.length&&(b=T.games[0].matchday_id),T.games.forEach(v=>{this.roundAbbreviationByGameId.set(v.game_id,f),v.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`,v.roundAbbreviationV2=f}),C=C.concat(T.games),C),[]);for(let C=0;C<S.length;C++)(S[C].game_status!=4||S[C].is_live)&&(S[C].score[0]!=0||S[C].score[1]!=0)&&(y=!0);u.set(f,{key:f,value:m,valueText:g,avaible:y,matchDayId:b});const _=this.getPages(S);return this.gamesPages.set(f,_),u},new Map).values()),this.tournamentScheduleKeysGoals=Array.from(Object.entries(this.fullTournamentScheduleFullGoals).reduce((u,[f,p])=>{const m=Number(f);let g="";Number.isNaN(m)?g=f:g=m<10?`0${m}`:f;let y=!1;const b=p.reduce((S,_)=>(_.games.forEach(C=>{C.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`}),S=S.concat(_.games),S),[]);for(let S=0;S<b.length;S++)(b[S].game_status!=4||b[S].is_live&&(b[S].score[0]!=0||b[S].score[1]!=0))&&(y=!0);return u.set(f,{key:f,value:m,valueText:g,avaible:y}),u},new Map).values())}setTimeout(()=>{this.isPreviousDataLoaded=!0,this.checkLiveGames(),this.gamesOfTheDayPreMatchIds.size&&this.createGameOfTheDayTimeouts()},500)}catch(i){throw new Error(i)}finally{this.loadingFlag=!1}},createGameOfTheDayTimeouts(){this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.forEach(s=>{const e=this.seasonsGamesMap.get(s);if(e){const t=new Date().valueOf();if(60*1e3*30+e.dateTimeMillis-t>0){const i=e.dateTimeMillis-t-3e5;setTimeout(()=>{this.createCheckLiveGamesInterval()},i>0?i:0)}}})},resetCheckGamesLiveInterval(){clearInterval(yi),yi=null},createCheckLiveGamesInterval(){this.resetCheckGamesLiveInterval(),yi||(yi=setInterval(()=>{this.checkLiveGames()},this.checkLiveGamesIntervalMinutes*60*1e3))},async checkLiveGames(){try{const s=await this.fetchLiveGames(),e=new Set;if(this.allLiveGames=s.data.reduce((t,a)=>(a.games.forEach(i=>{e.add(i.game_id),t.push(i)}),t),[]),this.allLiveGames.length){xa||await this.fillGameEvents();const t=[];this.gamesOfTheDayPreMatchIds.forEach(a=>{const i=this.seasonsGamesMap.get(a);i&&new Date().valueOf()>i.dateTimeMillis&&t.push(a)}),t.length&&t.every(i=>this.seasonsGamesMap.get(i).isLiveTracked)&&this.resetCheckGamesLiveInterval()}}catch(s){throw new Error(s)}},createGamesEventsInterval(){this.resetGamesLiveInterval(),xa=setInterval(()=>{this.fillGameEvents()},6e4)},resetGamesLiveInterval(){clearInterval(xa),xa=null},removeGameIfFinished(s,e,t=!1){for(const a of e)if(a.category_id===0&&a.game_status_id===13)if(t)s.is_live=0,s.game_status=0;else{const i=this.seasonsGamesMap.get(a.game_id);this.allLiveGames=this.allLiveGames.filter(o=>o.game_id!==s.game_id),i.is_live=0,i.game_status=0}},async fillGameEvents(){try{const s=[];let e=null;for(const a of this.allLiveGames){a.isLiveTracked=!0,this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.delete(a.game_id);const i=this.seasonsGamesMap.get(a.game_id);i&&(i.is_live=1,i.game_status=4),e=this.fullTournamentSchedule&&this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch?this.fullTournamentSchedule.data.prematch:null,e&&e.game_id===a.game_id&&(e.is_live=1,e.game_status=4),s.push(this.fetchGameEvents(a.game_id))}const t=await Promise.all(s);for(const a of t){const i=this.seasonsGamesMap.get(a.game_id);if(i){const o=OP.get(a.recent_lapse);i.currentTimeLive=o&&o<a.minute?`${o}' + ${a.minute-o}'`:`${a.minute}'`;const r=[Number(a.score[i.home_team.team_id.toString()])+Number(a.score[`own_${i.visiting_team.team_id.toString()}`]),Number(a.score[i.visiting_team.team_id.toString()])+Number(a.score[`own_${i.home_team.team_id.toString()}`])],l=r[0],d=r[1];i.score=[Number.isNaN(l)?0:l,Number.isNaN(d)?0:d],this.removeGameIfFinished(i,a.plays),e&&e.game_id===i.game_id&&(e.currentTimeLive=i.currentTimeLive,e.score=i.score,this.removeGameIfFinished(e,a.plays,!0))}}xa||this.createGamesEventsInterval()}catch(s){throw new Error(s)}},getPages(s){const e=[];if(this.gamesPerMatchDay>0){let t=[];s.forEach((a,i)=>{t.push(a),(i+1)%this.gamesPerMatchDay===0&&(e.push([...t]),t=[])}),t.length&&e.push([...t])}else e.push(s);return e},getNormalClosestRound(s,e=!1){const a=e?this.getOnlyGamesWithGoals(s):s,i=Object.entries(Object.entries(a).reduce((l,[d,c])=>(l[d]=[],c.forEach(h=>{h.games.forEach(u=>{const f=new Date(u.date_time_utc).getTime()+66e5;l[d].push(f)})}),l),{}));if(!i.length)return"1";const o=new Date().getTime(),r=i.reduce((l,[d,c])=>{let h=null;return c.forEach(u=>{const f=e?o-u:u-o;f>=0&&(h===null||f<h)&&(h=f)}),h&&(l.shortestTime===null||h<l.shortestTime)&&(l.round=d,l.shortestTime=h),l},{round:"",shortestTime:null});return r.shortestTime!==null?r.round:i[i.length-1][0]},getUserTeamClosestRound(s,e=!1){let t=1;const a=e?this.userTeamGamesForVideos:this.userTeamGames;if(a.length){const i=a[0];for(const[o,r]of Object.entries(s))for(const l of r)if(l.games.find(c=>c.game_id===i.game_id))return o}return t},async changeIndexStory(s){if(this.arrayGamesAdd.length>0){let e=-1,t=-1,a=-1;this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(e=this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(t=this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(a=this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)),e!=-1&&(this.gamesAllStories[t].is_live===1?this.storiesItems[a].stories.length-1==s&&this.storiesItems[a].stories.length>1?this.arrayGamesAdd[e].last_index=s-1:this.arrayGamesAdd[e].last_index=s:this.arrayGamesAdd[e].last_index=s),a!=-1&&this.arrayGamesAdd[e].status>0&&(this.arrayGamesAdd[e].status=s>=this.storiesItems[a].stories.length-1?0:1)}else{this.arrayGamesAdd=[];for(let e=0;e<this.storiesItems.length;e++)this.arrayGamesAdd.push({game_id:this.storiesItems[e].game_id,last_index:this.currentStories[0].gameId==this.storiesItems[e].game_id?s:0,status:this.currentStories[0].gameId==this.storiesItems[e].game_id&&s>=this.storiesItems[e].stories.length-1?0:1})}await ve.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let e=0;e<this.arrayGamesAdd.length;e++)this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)!=-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].index=this.arrayGamesAdd[e].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].status_storie=this.arrayGamesAdd[e].status)},async getLiveGamePlays(s){var a=(await ve.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/live/videos/plays/seasons/"+this.gamesAllStories[s].season_id+"/games/"+this.gamesAllStories[s].game_id)).data.plays.filter(l=>l[0]===607||l[0]===608||l[0]===12||l[0]===55||l[0]===54||l[0]===35||l[0]===15||l[0]===53);let i=a.map(l=>({playId:l[29],gameId:l[3],player:this.seasonPlayersMap.get(l[1]),categoryId:l[0],date:new Date(l[4]),url:"https://falconvideolive.blob.core.windows.net/video-hls-live/"+this.gamesAllStories[s].game_id+"/"+this.gamesAllStories[s].game_id+".m3u8",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].visiting_team+".png"},header:{label:this.gamesAllStories[s].home_team_acronym+" "+this.gamesAllStories[s].score[0]+":"+this.gamesAllStories[s].score[1]+" "+this.gamesAllStories[s].visiting_team_acronym+" "+this.gamesAllStories[s].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(l,9),endTime:this.getPlayTime(l,10),duration:Math.floor(this.getTimeSeconds(l[10])-this.getTimeSeconds(l[9]))}));const o={},r=i.filter(l=>o[l.playId]?!1:(o[l.playId]=!0,!0));this.storiesItems[s]={game_id:this.gamesAllStories[s].game_id,stories:r}},async openStory(s){const e={headers:{Authorization:`${this.token}`}},[t]=await Promise.all([ve.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/games/${this.gamesAllStories[s].game_id}`,e)]);t.data&&t.data.players.forEach(a=>{this.seasonPlayersMap.set(a.player_id,{dob:a.dob,first_name:a.first_name,jersey:a.jersey,last_name:a.last_name,name:a.name,player_name:a.name,nationality:a.nationality,nationality_id:a.nationality_id,nationality_photo:a.nationality_photo,photo:a.photo,player_id:a.player_id,position_id:a.position_id,short_name:a.short_name,team_id:a.team_id})}),this.gamesAllStories[s].is_live==1||this.gamesAllStories[s].game_status==0?(await this.getLiveGamePlays(s),setTimeout(()=>{this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index},100)):(this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index),setTimeout(()=>{this.isStoriesVisible=!0},150)},onCloseStories(s){this.currentStoriesLastIndex=0,this.isStoriesVisible=!1,this.$emit("event-posthog-stories",{event:"stories_cerrar",properties:{play_id:s?s.playId:null,game_id:s?s.gameId:null,category_id:s?s.categoryId:null,start_time:s?s.startTime:null,end_time:s?parseInt(s.currentTime):null,percentage_viewed:s?parseInt(s.progress):null}})},closeStories(){this.currentStoriesLastIndex=0,this.currentStoryIndex=null,this.currentStories=[]},onSwipeStories({direction:s,currentPlay:e}){s==="right"?(this.$emit("event-posthog-stories",{event:"stories_video_siguiente_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex>0&&this.openStory(this.currentStoryIndex-1)):(this.$emit("event-posthog-stories",{event:"stories_video_anterior_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex<this.storiesItems.length-1&&this.openStory(this.currentStoryIndex+1))},onClickNextBackVideo({eventName:s,currentPlay:e}){this.$emit("event-posthog-stories",{event:s,properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}})},onChangeTournaments(s){this.currentTournaments=s},onClickStories(s){this.$emit("event-posthog-stories",{event:"stories_ver_play",properties:{game_id:s.game_id}})},onVideoPlay(s){this.$emit("event-posthog-stories",{event:"stories_play",properties:{play_id:s.playId,game_id:s.gameId,category_id:s.categoryId,start_time:s.startTime,end_time:s.endTime,percentage_viewed:0}})}},async created(){},beforeUnmount(){this.resetGamesLiveInterval()}},Si=s=>(n.pushScopeId("data-v-5fa4dd75"),s=s(),n.popScopeId(),s),$P={class:"gsclanding",ref:"landingref"},VP={key:2,class:"play-seeker-image"},UP={class:"play-seeker-image__info"},zP=Si(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),GP={class:"play-seeker-image__info__legends-and-button"},jP=Si(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),HP={class:"play-icon"},WP=["src"],KP=Si(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),qP={class:"play-seeker-image__players"},YP=["src"],JP={key:3,class:"container-selectors-mobile"},XP={class:"container-selectors-mobile-tournament"},ZP={class:"container-selectors-mobile-season"},QP={key:0,class:"home-item-movil"},eO=Si(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),tO={class:"name-user-movil"},sO={key:1,class:"home-item"},aO={key:2,class:"bar-settings"},nO={class:"name-user"},iO={class:"container-selectors"},oO={class:"selector-tournament"},rO={class:"selector-seasons"},lO={key:3,class:"stories-circle-wrapper"},cO=["onClick"],dO={class:"story-result"},hO={key:0,class:"font-bold"},uO={key:1,class:"font-bold"},mO={class:"story-match"},fO={key:4,class:"container-games"},pO={key:5,class:"container-vr"},gO={key:6,class:"container-players"},yO={class:"container-tops"};function bO(s,e,t,a,i,o){const r=n.resolveComponent("Stories"),l=n.resolveComponent("CarouselFullScreen"),d=n.resolveComponent("GSCTournamentSelect"),c=n.resolveComponent("GSCSeasonSelect"),h=n.resolveComponent("GSCSlider"),u=n.resolveComponent("GSCGames"),f=n.resolveComponent("DiscoverVideos"),p=n.resolveComponent("GSCGridTeamsMatches"),m=n.resolveComponent("GSCTableCalendar"),g=n.resolveComponent("GSCPlayersLanding"),y=n.resolveComponent("GSCTops");return n.openBlock(),n.createElementBlock("div",$P,[i.isStoriesVisible&&t.showStories?(n.openBlock(),n.createBlock(r,{key:0,stories:i.currentStories,"start-story-index":i.currentStoriesLastIndex,"is-first-game-stories":i.currentStoryIndex===0,"is-last-game-stories":i.currentStoryIndex===i.storiesItems.length-1,onLastStoryIndex:o.changeIndexStory,onClose:o.onCloseStories,onSwipe:o.onSwipeStories,onVideoNextBack:o.onClickNextBackVideo,onVideoPlay:o.onVideoPlay},null,8,["stories","start-story-index","is-first-game-stories","is-last-game-stories","onLastStoryIndex","onClose","onSwipe","onVideoNextBack","onVideoPlay"])):n.createCommentVNode("",!0),i.isCarouselFullScreenVisible?(n.openBlock(),n.createBlock(l,{key:1,"player-queue":i.carouselPlayerQueue,"is-play-seeker":i.isPlaySeeker,"playlist-index":0,onClose:o.onClickCloseCarousel},null,8,["player-queue","is-play-seeker","onClose"])):n.createCommentVNode("",!0),o.isPlaySeekerAvailable?(n.openBlock(),n.createElementBlock("div",VP,[n.createElementVNode("div",UP,[zP,n.createElementVNode("div",GP,[jP,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[0]||(e[0]=(...b)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...b))},[n.createElementVNode("div",HP,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,WP)]),KP])])]),n.createElementVNode("div",qP,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,YP)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",JP,[n.createElementVNode("div",XP,[n.createVNode(d,{"current-season-id":t.currentSeasonId,width:"100%","api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",ZP,[n.createVNode(c,{"current-season-id":t.currentSeasonId,width:"100%",seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerbackground)},[n.createElementVNode("div",{class:n.normalizeClass(o.containerdata)},[a.elementSize.width<=680?(n.openBlock(),n.createElementBlock("div",QP,[eO,n.createElementVNode("div",tO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))])])):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",sO,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",aO,[n.createElementVNode("div",nO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))]),n.createElementVNode("div",iO,[n.createElementVNode("div",oO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,"api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",rO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])])):n.createCommentVNode("",!0),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",lO,[(n.openBlock(),n.createBlock(h,{key:i.keyupdate,height:"130px",pxScroll:86,scrollColor:"none",arrowsPosition:"absolute","background-color":"none",arrowsScrollHide:!0,arrowsHideOnNoScroll:!0,arrowsBackground:"rgba(255,255,255,.16)",arrowsContainerBgL:"linear-gradient(270deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsContainerBgR:"linear-gradient(90deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsMargin:0,arrowsRadius:"50%",arrowsBorder:"#ddd"},{default:n.withCtx(()=>[n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.gamesAllStories,(b,S)=>(n.openBlock(),n.createElementBlock("div",{key:S,class:"story-container-game",onClick:_=>o.onClickStory({item:b,index:S})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(b.is_live==1?(b.status_storie==1,"border: 2px solid #cbee6b !important;"):b.status_storie==1?"border: 2px solid #2248a2 !important;":"border: 2px solid #41485B !important;")},[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+b.home_team+".png)")},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+b.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",dO,[n.createTextVNode(n.toDisplayString(b.home_team_acronym)+" ",1),b.score.length>0?(n.openBlock(),n.createElementBlock("span",hO,n.toDisplayString(isNaN(b.score[0])?0:b.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),b.score.length>0?(n.openBlock(),n.createElementBlock("span",uO,n.toDisplayString(isNaN(b.score[1])?0:b.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(b.visiting_team_acronym),1)]),n.createElementVNode("div",mO,n.toDisplayString(b.matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")),1)],8,cO))),128))]),_:1}))])):n.createCommentVNode("",!0),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",fO,[n.createVNode(u,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0),!i.is_public&&i.isPreviousDataLoaded?(n.openBlock(),n.createElementBlock("div",pO,[n.createVNode(f,{"component-width":a.elementSize&&a.elementSize.width?a.elementSize.width:0,videoType:o.isGenericLike?i.goalsType:i.resumeType,team:t.team,player:t.user.player,isplayer:t.isplayer,"is-full":o.isGenericLike==1,"is-league-selected":o.isGenericLike==1,nextRivalTeam:o.isGenericLike||!i.nextRivalId?{id:0}:{id:i.nextRivalId},user:t.user,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":o.closestRoundVideos,seasonSelected:i.seasonSelected,tournamentSelected:i.tournamentSelected,myTournament:t.user.tournament,"default-media-player-season":t.defaultMediaPlayerSeason,onOpenmedia:o.onOpenMedia},null,8,["component-width","videoType","team","player","isplayer","is-full","is-league-selected","nextRivalTeam","user","tournament-schedule-keys","default-match-day-key","seasonSelected","tournamentSelected","myTournament","default-media-player-season","onOpenmedia"])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle(a.elementSize.width<748?"width: 100%":"")},[n.createVNode(p,{isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])],4),n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",gO,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:0,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAll,onTotalPlayers:o.getTotalPlayers,"team-id":t.user.team,"season-id":i.seasonSelected.id,"is-player":!!t.user.player},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id","is-player"])):n.createCommentVNode("",!0)],512)),[[n.vShow,i.playersLength>0]]),n.createElementVNode("div",yO,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(y,{key:0,"tournament-selected":i.tournamentSelected,onMore:o.moreTops,"show-switch":!o.isGenericLike,season:i.seasonSelected.id,"show-more":!i.is_public,"team-id":t.user.team,"active-videos":i.is_public?t.privileges.vr_privileges:!0,onOpenmedia:o.onOpenMedia},null,8,["tournament-selected","onMore","show-switch","season","show-more","team-id","active-videos","onOpenmedia"])):n.createCommentVNode("",!0)]),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:7,class:"b2c-image",onClick:e[1]||(e[1]=(...b)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...b))})):n.createCommentVNode("",!0)],2)],2)],512)}const SO=qe(MP,[["render",bO],["__scopeId","data-v-5fa4dd75"]]);hs.GSCLanding=SO,Object.defineProperty(hs,Symbol.toStringTag,{value:"Module"})});
|
|
67
|
+
} (data length: ${t&&t.byteLength})`),i.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,a)=>{const i=Qr(this.config),o=e.map(nf).filter(r=>!!r&&i.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(o).then(({keySystem:r})=>{const l=rf(r);l?t(l):a(new Error(`Unable to find format for key-system "${r}"`))}).catch(a)})}loadKey(e){const t=e.keyInfo.decryptdata,a=this.getKeyIdString(t),i=`(keyId: ${a} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let o=this.keyIdToKeySessionPromise[a];return o||(o=this.keyIdToKeySessionPromise[a]=this.getKeySystemForKeyPromise(t).then(({keySystem:r,mediaKeys:l})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(r,l).then(()=>{this.throwIfDestroyed();const d=this.createMediaKeySessionContext({keySystem:r,mediaKeys:l,decryptdata:t});return this.generateRequestWithPreferredKeySession(d,"cenc",t.pssh,"playlist-key")}))),o.catch(r=>this.handleError(r))),o}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof _t?this.hls.trigger(w.ERROR,e.data):this.hls.trigger(w.ERROR,{type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){const i=nf(e.keyFormat),o=i?[i]:Qr(this.config);return this.attemptKeySystemAccess(o)}return a}getKeySystemSelectionPromise(e){if(e.length||(e=Qr(this.config)),e.length===0)throw new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:a}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),a===null)return;let o,r;if(t==="sinf"&&this.config.drmSystems[Be.FAIRPLAY]){const u=Ke(new Uint8Array(a));try{const f=Xr(JSON.parse(u).sinf),p=yf(new Uint8Array(f));if(!p)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=p.subarray(8,24),r=Be.FAIRPLAY}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}}else{const u=K6(a),f=u.filter(p=>p.systemId===_a.WIDEVINE)[0];if(!f){u.length===0||u.some(p=>!p.systemId)?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${u.map(p=>of(p.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(r=of(f.systemId),f.version===0&&f.data){const p=f.data.length-22;o=f.data.subarray(p,p+16)}}if(!r||!o)return;const l=zt.hexDump(o),{keyIdToKeySessionPromise:d,mediaKeySessions:c}=this;let h=d[l];for(let u=0;u<c.length;u++){const f=c[u],p=f.decryptdata;if(!p.keyId)continue;const m=zt.hexDump(p.keyId);if(l===m||p.uri.replace(/-/g,"").indexOf(l)!==-1){if(h=d[m],p.pssh)break;delete d[m],p.pssh=new Uint8Array(a),p.keyId=o,h=d[l]=h.then(()=>this.generateRequestWithPreferredKeySession(f,t,a,"encrypted-event-key-match"));break}}h||(h=d[l]=this.getKeySystemSelectionPromise([r]).then(({keySystem:u,mediaKeys:f})=>{var p;this.throwIfDestroyed();const m=new Ea("ISO-23001-7",l,(p=rf(u))!=null?p:"");return m.pssh=new Uint8Array(a),m.keyId=o,this.attemptSetMediaKeys(u,f).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:m,keySystem:u,mediaKeys:f});return this.generateRequestWithPreferredKeySession(g,t,a,"encrypted-event-no-match")})})),h.catch(u=>this.handleError(u))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const a=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(a).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),a.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(o=>a.indexOf(o)===-1)})}generateRequestWithPreferredKeySession(e,t,a,i){var o,r;const l=(o=this.config.drmSystems)==null||(r=o[e.keySystem])==null?void 0:r.generateRequest;if(l)try{const m=l.call(this.hls,t,a,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,a=e.decryptdata.pssh=m.initData?new Uint8Array(m.initData):null}catch(m){var d;if(this.warn(m.message),(d=this.hls)!=null&&d.config.debug)throw m}if(a===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${c} (init data type: ${t} length: ${a?a.byteLength:null})`);const h=new Ll,u=e._onmessage=m=>{const g=e.mediaKeysSession;if(!g){h.emit("error",new Error("invalid state"));return}const{messageType:y,message:b}=m;this.log(`"${y}" message event for session "${g.sessionId}" message size: ${b.byteLength}`),y==="license-request"||y==="license-renewal"?this.renewLicense(e,b).catch(S=>{this.handleError(S),h.emit("error",S)}):y==="license-release"?e.keySystem===Be.FAIRPLAY&&(this.updateKeySession(e,Zr("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${y}"`)},f=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const y=e.keyStatus;h.emit("keyStatus",y),y==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",f);const p=new Promise((m,g)=>{h.on("error",g),h.on("keyStatus",y=>{y.startsWith("usable")?m():y==="output-restricted"?g(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):y==="internal-error"?g(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${y}"`)):y==="expired"?g(new Error("key expired while generating request")):this.warn(`unhandled key status change "${y}"`)})});return e.mediaKeysSession.generateRequest(t,a).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${c}`)}).catch(m=>{throw new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>p).catch(m=>{throw h.removeAllListeners(),this.removeSession(e),m}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,a)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${zt.hexDump("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))} session keyId: ${zt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,a=t.loader,i=new a(t),o=this.getServerCertificateUrl(e);return o?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,l)=>{const d={responseType:"arraybuffer",url:o},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,p,m,g)=>{r(f.data)},onError:(f,p,m,g)=>{l(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Xe({url:d.url,data:void 0},f)},`"${e}" certificate request failed (${o}). Status: ${f.code} (${f.text})`))},onTimeout:(f,p,m)=>{l(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:d.url,data:void 0}},`"${e}" certificate request timed out (${o})`))},onAbort:(f,p,m)=>{l(new Error("aborted"))}};i.load(d,h,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,a){return new Promise((i,o)=>{e.setServerCertificate(a).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${a==null?void 0:a.byteLength}) on "${t}"`),i(e)}).catch(r=>{o(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(a=>this.updateKeySession(e,new Uint8Array(a)).catch(i=>{throw new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const a=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!a.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(a,"application/xml"),o=i.querySelectorAll("HttpHeader");if(o.length>0){let h;for(let u=0,f=o.length;u<f;u++){var r,l;h=o[u];const p=(r=h.querySelector("name"))==null?void 0:r.textContent,m=(l=h.querySelector("value"))==null?void 0:l.textContent;p&&m&&e.setRequestHeader(p,m)}}const d=i.querySelector("Challenge"),c=d==null?void 0:d.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return Zr(atob(c))}setupLicenseXHR(e,t,a,i){const o=this.config.licenseXhrSetup;return o?Promise.resolve().then(()=>{if(!a.decryptdata)throw new Error("Key removed");return o.call(this.hls,e,t,a,i)}).catch(r=>{if(!a.decryptdata)throw r;return e.open("POST",t,!0),o.call(this.hls,e,t,a,i)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const a=this.config.keyLoadPolicy.default;return new Promise((i,o)=>{const r=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${r}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return o(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let d=l.response;this.log(`License received ${d instanceof ArrayBuffer?d.byteLength:d}`);const c=this.config.licenseResponseCallback;if(c)try{d=c.call(this.hls,l,r,e)}catch(h){this.error(h)}i(d)}else{const d=a.errorRetry,c=d?d.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||l.status>=400&&l.status<500)o(new _t({type:fe.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:l,response:{url:r,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${r}). Status: ${l.status} (${l.statusText})`));else{const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,o)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,r,e,t).then(({xhr:d,licenseChallenge:c})=>{e.keySystem==Be.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(d,c)),d.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const a=t.media;this.media=a,a.addEventListener("encrypted",this.onMediaEncrypted),a.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ea.clearKeyUriToKeyIdMap();const a=t.length;qs.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{a&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const a=t.reduce((i,o)=>(i.indexOf(o.keyFormat)===-1&&i.push(o.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${a.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(a)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:a}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),a&&a.readyState!==XMLHttpRequest.DONE&&a.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(o=>{this.log(`Could not remove session: ${o}`)}).then(()=>t.close()).catch(o=>{this.log(`Could not close session: ${o}`)})}}}qs.CDMCleanupPromise=void 0;class _t extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var lt;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(lt||(lt={}));var zl;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(zl||(zl={}));var Cs;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(Cs||(Cs={}));const yD={[Cs.OBJECT]:["br","d","ot","tb"],[Cs.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Cs.SESSION]:["cid","pr","sf","sid","st","v"],[Cs.STATUS]:["bs","rtp"]};class Ys{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(a=>a instanceof Ys?a:new Ys(a))),this.value=e,this.params=t}}class Yp{constructor(e){this.description=void 0,this.description=e}}const bD="Dict";function SD(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function wD(s,e,t,a){return new Error(`failed to ${s} "${SD(e)}" as ${t}`,{cause:a})}const Jp="Bare Item",_D="Boolean",kD="Byte Sequence",ED="Decimal",TD="Integer";function CD(s){return s<-999999999999999||999999999999999<s}const xD=/[\x00-\x1f\x7f]+/,vD="Token",AD="Key";function Kt(s,e,t){return wD("serialize",s,e,t)}function LD(s){if(typeof s!="boolean")throw Kt(s,_D);return s?"?1":"?0"}function ID(s){return btoa(String.fromCharCode(...s))}function RD(s){if(ArrayBuffer.isView(s)===!1)throw Kt(s,kD);return`:${ID(s)}:`}function Xp(s){if(CD(s))throw Kt(s,TD);return s.toString()}function ND(s){return`@${Xp(s.getTime()/1e3)}`}function Zp(s,e){if(s<0)return-Zp(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const i=Math.floor(s*t);return(i%2===0?i:i+1)/t}else return Math.round(s*t)/t}function BD(s){const e=Zp(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Kt(s,ED);const t=e.toString();return t.includes(".")?t:`${t}.0`}const DD="String";function PD(s){if(xD.test(s))throw Kt(s,DD);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function OD(s){return s.description||s.toString().slice(7,-1)}function Qp(s){const e=OD(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Kt(e,vD);return e}function Gl(s){switch(typeof s){case"number":if(!ne(s))throw Kt(s,Jp);return Number.isInteger(s)?Xp(s):BD(s);case"string":return PD(s);case"symbol":return Qp(s);case"boolean":return LD(s);case"object":if(s instanceof Date)return ND(s);if(s instanceof Uint8Array)return RD(s);if(s instanceof Yp)return Qp(s);default:throw Kt(s,Jp)}}function jl(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw Kt(s,AD);return s}function Hl(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${jl(e)}`:`;${jl(e)}=${Gl(t)}`).join("")}function eg(s){return s instanceof Ys?`${Gl(s.value)}${Hl(s.params)}`:Gl(s)}function FD(s){return`(${s.value.map(eg).join(" ")})${Hl(s.params)}`}function MD(s,e={whitespace:!0}){if(typeof s!="object")throw Kt(s,bD);const t=s instanceof Map?s.entries():Object.entries(s),a=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,o])=>{o instanceof Ys||(o=new Ys(o));let r=jl(i);return o.value===!0?r+=Hl(o.params):(r+="=",Array.isArray(o.value)?r+=FD(o):r+=eg(o)),r}).join(`,${a}`)}function $D(s,e){return MD(s,e)}const VD=s=>s==="ot"||s==="sf"||s==="st",UD=s=>typeof s=="number"?ne(s):s!=null&&s!==""&&s!==!1;function zD(s,e){const t=new URL(s),a=new URL(e);if(t.origin!==a.origin)return s;const i=t.pathname.split("/").slice(1),o=a.pathname.split("/").slice(1,-1);for(;i[0]===o[0];)i.shift(),o.shift();for(;o.length;)o.shift(),i.unshift("..");return i.join("/")}function GD(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const o=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?o:o&3|8).toString(16)})}}}const fi=s=>Math.round(s),jD=(s,e)=>(e!=null&&e.baseUrl&&(s=zD(s,e.baseUrl)),encodeURIComponent(s)),pi=s=>fi(s/100)*100,HD={br:fi,d:fi,bl:pi,dl:pi,mtp:pi,nor:jD,rtp:pi,tb:fi};function WD(s,e){const t={};if(s==null||typeof s!="object")return t;const a=Object.keys(s).sort(),i=Ge({},HD,e==null?void 0:e.formatters),o=e==null?void 0:e.filter;return a.forEach(r=>{if(o!=null&&o(r))return;let l=s[r];const d=i[r];d&&(l=d(l,e)),!(r==="v"&&l===1)&&(r=="pr"&&l===1||UD(l)&&(VD(r)&&typeof l=="string"&&(l=new Yp(l)),t[r]=l))}),t}function tg(s,e={}){return s?$D(WD(s,e),Ge({whitespace:!1},e)):""}function KD(s,e={}){if(!s)return{};const t=Object.entries(s),a=Object.entries(yD).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((o,r)=>{var l,d;const[c,h]=r,u=((l=a.find(f=>f[1].includes(c)))==null?void 0:l[0])||Cs.REQUEST;return(d=o[u])!=null||(o[u]={}),o[u][c]=h,o},{});return Object.entries(i).reduce((o,[r,l])=>(o[r]=tg(l,e),o),{})}function qD(s,e,t){return Ge(s,KD(e,t))}const YD="CMCD";function JD(s,e={}){if(!s)return"";const t=tg(s,e);return`${YD}=${encodeURIComponent(t)}`}const sg=/CMCD=[^&#]+/;function XD(s,e,t){const a=JD(e,t);if(!a)return s;if(sg.test(s))return s.replace(sg,a);const i=s.includes("?")?"&":"?";return`${s}${i}${a}`}class ZD{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:lt.MANIFEST,su:!this.initialized})}catch(o){A.warn("Could not generate manifest CMCD data.",o)}},this.applyFragmentData=i=>{try{const o=i.frag,r=this.hls.levels[o.level],l=this.getObjectType(o),d={d:o.duration*1e3,ot:l};(l===lt.VIDEO||l===lt.AUDIO||l==lt.MUXED)&&(d.br=r.bitrate/1e3,d.tb=this.getTopBandwidth(l)/1e3,d.bl=this.getBufferLength(l)),this.apply(i,d)}catch(o){A.warn("Could not generate segment CMCD data.",o)}},this.hls=e;const t=this.config=e.config,{cmcd:a}=t;a!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||GD(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.includeKeys=a.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHED,this.onMediaDetached,this),e.on(w.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHED,this.onMediaDetached,this),e.off(w.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var a,i;this.audioBuffer=(a=t.tracks.audio)==null?void 0:a.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:zl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ge(t,this.createData());const a=t.ot===lt.INIT||t.ot===lt.VIDEO||t.ot===lt.MUXED;this.starved&&a&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((o,r)=>(i.includes(r)&&(o[r]=t[r]),o),{})),this.useHeaders?(e.headers||(e.headers={}),qD(e.headers,t)):e.url=XD(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return lt.TIMED_TEXT;if(e.sn==="initSegment")return lt.INIT;if(t==="audio")return lt.AUDIO;if(t==="main")return this.hls.audioTracks.length?lt.VIDEO:lt.MUXED}getTopBandwidth(e){let t=0,a;const i=this.hls;if(e===lt.AUDIO)a=i.audioTracks;else{const o=i.maxAutoLevel,r=o>-1?o+1:i.levels.length;a=i.levels.slice(0,r)}for(const o of a)o.bitrate>t&&(t=o.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,a=e===lt.AUDIO?this.audioBuffer:this.videoBuffer;return!a||!t?NaN:De.bufferInfo(a,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}}const QD=3e5;class eP{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=A.log.bind(A,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(a=>a!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:a}=t;a!==null&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:a}=t;if((a==null?void 0:a.action)===nt.SendAlternateToPenaltyBox&&a.flags===Pt.MoveAllAlternatesMatchingHost){const i=this.levels;let o=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:l,pathwayId:d,type:c}=t.context;l&&i?r=this.getPathwayForGroupId(l,c,r):d&&(r=d)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!o&&i&&(o=i.reduce((l,d)=>(l.indexOf(d.pathwayId)===-1&&l.push(d.pathwayId),l),[])),o&&o.length>1&&(this.updatePathwayPriority(o),a.resolved=this.pathwayId!==r),a.resolved||A.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${i&&i.length} priorities: ${JSON.stringify(o)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const a=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${a}"`),t=this.getLevelsForPathway(a),this.pathwayId=a}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const a=this.penalizedPathways,i=performance.now();Object.keys(a).forEach(o=>{i-a[o]>QD&&delete a[o]});for(let o=0;o<e.length;o++){const r=e[o];if(r in a)continue;if(r===this.pathwayId)return;const l=this.hls.nextLoadLevel,d=this.hls.levels[l];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,Kf(t),this.hls.trigger(w.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[l];d&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==d.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==d.bitrate&&this.log(`Unstable Pathways change from bitrate ${d.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,t,a){const i=this.getLevelsForPathway(a).concat(this.levels||[]);for(let o=0;o<i.length;o++)if(t===xe.AUDIO_TRACK&&i[o].hasAudioGroup(e)||t===xe.SUBTITLE_TRACK&&i[o].hasSubtitleGroup(e))return i[o].pathwayId;return a}clonePathways(e){const t=this.levels;if(!t)return;const a={},i={};e.forEach(o=>{const{ID:r,"BASE-ID":l,"URI-REPLACEMENT":d}=o;if(t.some(h=>h.pathwayId===r))return;const c=this.getLevelsForPathway(l).map(h=>{const u=new Oe(h.attrs);u["PATHWAY-ID"]=r;const f=u.AUDIO&&`${u.AUDIO}_clone_${r}`,p=u.SUBTITLES&&`${u.SUBTITLES}_clone_${r}`;f&&(a[u.AUDIO]=f,u.AUDIO=f),p&&(i[u.SUBTITLES]=p,u.SUBTITLES=p);const m=ng(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),g=new Vs({attrs:u,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:m,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let y=1;y<h.audioGroups.length;y++)g.addGroupId("audio",`${h.audioGroups[y]}_clone_${r}`);if(h.subtitleGroups)for(let y=1;y<h.subtitleGroups.length;y++)g.addGroupId("text",`${h.subtitleGroups[y]}_clone_${r}`);return g});t.push(...c),ag(this.audioTracks,a,d,r),ag(this.subtitleTracks,i,d,r)})}loadSteeringManifest(e){const t=this.hls.config,a=t.loader;this.loader&&this.loader.destroy(),this.loader=new a(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+h)}const o={responseType:"json",url:i.href},r=t.steeringManifestLoadPolicy.default,l=r.errorRetry||r.timeoutRetry||{},d={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},c={onSuccess:(h,u,f,p)=>{this.log(`Loaded steering manifest: "${i}"`);const m=h.data;if(m.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":b}=m;if(g)try{this.uri=new self.URL(g,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||f.url),y&&this.clonePathways(y);const S={steeringManifest:m,url:i.toString()};this.hls.trigger(w.STEERING_MANIFEST_LOADED,S),b&&this.updatePathwayPriority(b)},onError:(h,u,f,p)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${u.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let m=this.timeToLoad*1e3;if(h.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const y=g.getResponseHeader("Retry-After");y&&(m=parseFloat(y)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,m)},onTimeout:(h,u,f)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(o,d,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var a;const i=(a=this.hls)==null?void 0:a.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function ag(s,e,t,a){s&&Object.keys(e).forEach(i=>{const o=s.filter(r=>r.groupId===i).map(r=>{const l=Ge({},r);return l.details=void 0,l.attrs=new Oe(l.attrs),l.url=l.attrs.URI=ng(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),l.groupId=l.attrs["GROUP-ID"]=e[i],l.attrs["PATHWAY-ID"]=a,l});s.push(...o)})}function ng(s,e,t,a){const{HOST:i,PARAMS:o,[t]:r}=a;let l;e&&(l=r==null?void 0:r[e],l&&(s=l));const d=new self.URL(s);return i&&!l&&(d.host=i),o&&Object.keys(o).sort().forEach(c=>{c&&d.searchParams.set(c,o[c])}),d.href}const tP=/^age:\s*[\d.]+\s*$/im;class ig{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new $n,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,a){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=a,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const a=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const o=this.xhrSetup;o?Promise.resolve().then(()=>{if(!(this.loader!==a||this.stats.aborted))return o(a,t.url)}).catch(r=>{if(!(this.loader!==a||this.stats.aborted))return a.open("GET",t.url,!0),o(a,t.url)}).then(()=>{this.loader!==a||this.stats.aborted||this.openAndSendXhr(a,t,e)}).catch(r=>{this.callbacks.onError({code:a.status,text:r.message},t,a,i)}):this.openAndSendXhr(a,t,e)}openAndSendXhr(e,t,a){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:o,maxLoadTimeMs:r}=a.loadPolicy;if(i)for(const l in i)e.setRequestHeader(l,i[l]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),a.timeout=o&&ne(o)?o:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:a}=this;if(!e||!t)return;const i=t.readyState,o=this.config;if(!a.aborted&&i>=2&&(a.loading.first===0&&(a.loading.first=Math.max(self.performance.now(),a.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(a.loading.first-a.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const r=t.status,l=t.responseType!=="text";if(r>=200&&r<300&&(l&&t.response||t.responseText!==null)){a.loading.end=Math.max(self.performance.now(),a.loading.first);const d=l?t.response:t.responseText,c=t.responseType==="arraybuffer"?d.byteLength:d.length;if(a.loaded=a.total=c,a.bwEstimate=a.total*8e3/(a.loading.end-a.loading.first),!this.callbacks)return;const h=this.callbacks.onProgress;if(h&&h(a,e,d,t),!this.callbacks)return;const u={url:t.responseURL,data:d,code:r};this.callbacks.onSuccess(u,a,e,t)}else{const d=o.loadPolicy.errorRetry,c=a.retry,h={url:e.url,data:void 0,code:r};Zn(d,c,!1,h)?this.retry(d):(A.error(`${r} while loading ${e.url}`),this.callbacks.onError({code:r,text:t.statusText},e,t,a))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Zn(e,t,!0))this.retry(e);else{var a;A.warn(`timeout while loading ${(a=this.context)==null?void 0:a.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:a}=this;this.retryDelay=pl(e,a.retry),a.retry++,A.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${a.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&tP.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function sP(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const aP=/(\d+)-(\d+)\/(\d+)/;class og{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||rP,this.controller=new self.AbortController,this.stats=new $n}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,a){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const o=nP(e,this.controller.signal),r=a.onProgress,l=e.responseType==="arraybuffer",d=l?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:h}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=a,this.request=this.fetchSetup(e,o),self.clearTimeout(this.requestTimeout),t.timeout=c&&ne(c)?c:h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const f=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},h-(f-i.loading.start)),!u.ok){const{status:p,statusText:m}=u;throw new lP(m||"fetch, bad network response",p,u)}return i.loading.first=f,i.total=oP(u.headers)||i.total,r&&ne(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,r):l?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const p=u[d];p&&(i.loaded=i.total=p);const m={url:f.url,data:u,code:f.status};r&&!ne(t.highWaterMark)&&r(i,e,u,f),a.onSuccess(m,i,e,f)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const f=u&&u.code||0,p=u?u.message:null;a.onError({code:f,text:p},e,u?u.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,a,i=0,o){const r=new ip,l=e.body.getReader(),d=()=>l.read().then(c=>{if(c.done)return r.dataLength&&o(t,a,r.flush(),e),Promise.resolve(new ArrayBuffer(0));const h=c.value,u=h.length;return t.loaded+=u,u<i||r.dataLength?(r.push(h),r.dataLength>=i&&o(t,a,r.flush(),e)):o(t,a,h,e),d()}).catch(()=>Promise.reject());return d()}}function nP(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ge({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function iP(s){const e=aP.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function oP(s){const e=s.get("Content-Range");if(e){const a=iP(e);if(ne(a))return a}const t=s.get("Content-Length");if(t)return parseInt(t)}function rP(s,e){return new self.Request(s.url,e)}class lP extends Error{constructor(e,t,a){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=a}}const cP=/\s/,dP={newCue(s,e,t,a){const i=[];let o,r,l,d,c;const h=self.VTTCue||self.TextTrackCue;for(let f=0;f<a.rows.length;f++)if(o=a.rows[f],l=!0,d=0,c="",!o.isEmpty()){var u;for(let g=0;g<o.chars.length;g++)cP.test(o.chars[g].uchar)&&l?d++:(c+=o.chars[g].uchar,l=!1);o.cueStartTime=e,e===t&&(t+=1e-4),d>=16?d--:d++;const p=$p(c.trim()),m=Ol(e,t,p);s!=null&&(u=s.cues)!=null&&u.getCueById(m)||(r=new h(e,t,p),r.id=m,r.line=f+1,r.align="left",r.position=10+Math.min(80,Math.floor(d*8/32)*10),i.push(r))}return s&&i.length&&(i.sort((f,p)=>f.line==="auto"||p.line==="auto"?0:f.line>8&&p.line>8?p.line-f.line:f.line-p.line),i.forEach(f=>Mf(s,f))),i}},hP={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},rg=Xe(Xe({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:ig,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:MN,bufferController:zB,capLevelController:Ul,errorController:xN,fpsController:gD,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:lf,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:hP},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},uP()),{},{subtitleStreamController:MB,subtitleTrackController:VB,timelineController:fD,audioStreamController:OB,audioTrackController:FB,emeController:qs,cmcdController:ZD,contentSteeringController:eP});function uP(){return{cueHandler:dP,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function mP(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Wl(s),a=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return a.forEach(o=>{const r=`${o==="level"?"playlist":o}LoadPolicy`,l=e[r]===void 0,d=[];i.forEach(c=>{const h=`${o}Loading${c}`,u=e[h];if(u!==void 0&&l){d.push(h);const f=t[r].default;switch(e[r]={default:f},c){case"TimeOut":f.maxLoadTimeMs=u,f.maxTimeToFirstByteMs=u;break;case"MaxRetry":f.errorRetry.maxNumRetry=u,f.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":f.errorRetry.retryDelayMs=u,f.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=u,f.timeoutRetry.maxRetryDelayMs=u;break}}}),d.length&&A.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(e[r])}`)}),Xe(Xe({},t),e)}function Wl(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Wl):Object.keys(s).reduce((e,t)=>(e[t]=Wl(s[t]),e),{}):s}function fP(s){const e=s.loader;e!==og&&e!==ig?(A.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):sP()&&(s.loader=og,s.progressive=!0,s.enableSoftwareAES=!0,A.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Kl;class pP extends yl{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.LEVEL_LOADED,this.onLevelLoaded,this),e.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.LEVEL_LOADED,this.onLevelLoaded,this),e.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const a=this.hls.config.preferManagedMediaSource,i=[],o={},r={};let l=!1,d=!1,c=!1;t.levels.forEach(h=>{var u,f;const p=h.attrs;let{audioCodec:m,videoCodec:g}=h;((u=m)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(Kl||(Kl=/chrome|firefox/i.test(navigator.userAgent)),Kl&&(h.audioCodec=m=void 0)),m&&(h.audioCodec=m=Wn(m,a)),((f=g)==null?void 0:f.indexOf("avc1"))===0&&(g=h.videoCodec=tN(g));const{width:y,height:b,unknownCodecs:S}=h;if(l||(l=!!(y&&b)),d||(d=!!g),c||(c=!!m),S!=null&&S.length||m&&!ol(m,"audio",a)||g&&!ol(g,"video",a))return;const{CODECS:_,"FRAME-RATE":C,"HDCP-LEVEL":T,"PATHWAY-ID":v,RESOLUTION:E,"VIDEO-RANGE":N}=p,R=`${`${v||"."}-`}${h.bitrate}-${E}-${C}-${_}-${N}-${T}`;if(o[R])if(o[R].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const $=r[R]+=1;h.attrs["PATHWAY-ID"]=new Array($+1).join(".");const K=new Vs(h);o[R]=K,i.push(K)}else o[R].addGroupId("audio",p.AUDIO),o[R].addGroupId("text",p.SUBTITLES);else{const $=new Vs(h);o[R]=$,r[R]=1,i.push($)}}),this.filterAndSortMediaOptions(i,t,l,d,c)}filterAndSortMediaOptions(e,t,a,i,o){let r=[],l=[],d=e;if((a||i)&&o&&(d=d.filter(({videoCodec:m,videoRange:g,width:y,height:b})=>(!!m||!!(y&&b))&&fN(g))),d.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const m=new Error("no level with compatible codecs found in manifest");this.hls.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:m,reason:m.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:m}=this.hls.config;r=t.audioTracks.filter(g=>!g.audioCodec||ol(g.audioCodec,"audio",m)),lg(r)}t.subtitles&&(l=t.subtitles,lg(l));const c=d.slice(0);d.sort((m,g)=>{if(m.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"])return(m.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&m.height!==g.height)return m.height-g.height;if(m.frameRate!==g.frameRate)return m.frameRate-g.frameRate;if(m.videoRange!==g.videoRange)return Yn.indexOf(m.videoRange)-Yn.indexOf(g.videoRange);if(m.videoCodec!==g.videoCodec){const y=Cf(m.videoCodec),b=Cf(g.videoCodec);if(y!==b)return b-y}if(m.uri===g.uri&&m.codecSet!==g.codecSet){const y=Hn(m.codecSet),b=Hn(g.codecSet);if(y!==b)return b-y}return m.averageBitrate!==g.averageBitrate?m.averageBitrate-g.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let m=0;m<c.length;m++)if(c[m].pathwayId===d[0].pathwayId){h=c[m];break}}this._levels=d;for(let m=0;m<d.length;m++)if(d[m]===h){var u;this._firstLevel=m;const g=h.bitrate,y=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${g}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const b=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);b>y&&y===rg.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=b)}break}const f=o&&!i,p={levels:d,audioTracks:r,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:i,altAudio:!f&&r.some(m=>!!m.url)};this.hls.trigger(w.MANIFEST_PARSED,p),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(w.ERROR,{type:fe.OTHER_ERROR,details:B.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:h,reason:h.message}),u)return;e=Math.min(e,t.length-1)}const a=this.currentLevelIndex,i=this.currentLevel,o=i?i.attrs["PATHWAY-ID"]:void 0,r=t[e],l=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,a===e&&r.details&&i&&o===l)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${l?" with Pathway "+l:""} from level ${a}${o?" with Pathway "+o:""}`);const d={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(w.LEVEL_SWITCHING,d);const c=r.details;if(!c||c.live){const h=this.switchParams(r.uri,i==null?void 0:i.details,c);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===xe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===le.MAIN){const a=t.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var a;const{level:i,details:o}=t,r=this._levels[i];if(!r){var l;this.warn(`Invalid level index ${i}`),(l=t.deliveryDirectives)!=null&&l.skip&&(o.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0),this.playlistLoaded(i,t,r.details)):(a=t.deliveryDirectives)!=null&&a.skip&&(o.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){let i=a.uri;if(e)try{i=e.addDirectives(i)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}const o=a.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${o?" Pathway "+o:""} ${i}`),this.clearTimer(),this.hls.trigger(w.LEVEL_LOADING,{url:i,level:t,pathwayId:a.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const a=this._levels.filter((i,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(r=>r.level=-1)),!1));Kf(a),this._levels=a,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(w.LEVELS_UPDATED,{levels:a})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:a}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(w.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:a}))}}function lg(s){const e={};s.forEach(t=>{const a=t.groupId||"";t.id=e[a]=e[a]||0,e[a]++})}class gP{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const a in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[a].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=B.KEY_LOAD_ERROR,a,i,o){return new Zt({type:fe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:a,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:a,cc:i}=e;for(let o=0;o<t.length;o++){const r=t[o];if(i<=r.cc&&(a==="initSegment"||r.sn==="initSegment"||a<r.sn)){this.emeController.selectKeySystemFormat(r).then(l=>{r.setKeyFormat(l)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var a,i;t&&e.setKeyFormat(t);const o=e.decryptdata;if(!o){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,B.KEY_LOAD_ERROR,c))}const r=o.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,B.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));let l=this.keyUriToKeyInfo[r];if((a=l)!=null&&a.decryptdata.key)return o.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if((i=l)!=null&&i.keyLoadPromise){var d;switch((d=l.mediaKeySessionContext)==null?void 0:d.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then(c=>(o.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:l}))}}switch(l=this.keyUriToKeyInfo[r]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,B.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${o.method}"`)))}}loadKeyEME(e,t){const a={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(a);if(i)return(e.keyLoadPromise=i.then(o=>(e.mediaKeySessionContext=o,a))).catch(o=>{throw e.keyLoadPromise=null,o})}return Promise.resolve(a)}loadKeyHTTP(e,t){const a=this.config,i=a.loader,o=new i(a);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise((r,l)=>{const d={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=a.keyLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,p,m,g)=>{const{frag:y,keyInfo:b,url:S}=m;if(!y.decryptdata||b!==this.keyUriToKeyInfo[S])return l(this.createKeyLoadError(y,B.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));b.decryptdata.key=y.decryptdata.key=new Uint8Array(f.data),y.keyLoader=null,b.loader=null,r({frag:y,keyInfo:b})},onError:(f,p,m,g)=>{this.resetLoader(p),l(this.createKeyLoadError(t,B.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),m,Xe({url:d.url,data:void 0},f)))},onTimeout:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,B.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,B.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};o.load(d,h,u)})}resetLoader(e){const{frag:t,keyInfo:a,url:i}=e,o=a.loader;t.keyLoader===o&&(t.keyLoader=null,a.loader=null),delete this.keyUriToKeyInfo[i],o&&o.destroy()}}function cg(){return self.SourceBuffer||self.WebKitSourceBuffer}function dg(){if(!Es())return!1;const e=cg();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function yP(){if(!dg())return!1;const s=Es();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(Ta(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(Ta(e,"audio"))))}function bP(){var s;const e=cg();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const SP=250,gi=2,wP=.1,_P=.05;class kP{constructor(e,t,a,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=a,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:a,media:i,stalled:o}=this;if(i===null)return;const{currentTime:r,seeking:l}=i,d=this.seeking&&!l,c=!this.seeking&&l;if(this.seeking=l,r!==e){if(this.moved=!0,l||(this.nudgeRetry=0),o!==null){if(this.stallReported){const y=self.performance.now()-o;A.warn(`playback not stuck anymore @${r}, after ${Math.round(y)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||d){this.stalled=null;return}if(i.paused&&!l||i.ended||i.playbackRate===0||!De.getBuffered(i).length){this.nudgeRetry=0;return}const h=De.bufferInfo(i,r,0),u=h.nextStart||0;if(l){const y=h.len>gi,b=!u||t&&t.start<=r||u-r>gi&&!this.fragmentTracker.getPartialFragment(r);if(y||b)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var f;if(!(h.len>0)&&!u)return;const b=Math.max(u,h.start||0)-r,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(S==null||(f=S.details)==null?void 0:f.live)?S.details.targetduration*2:gi,T=this.fragmentTracker.getPartialFragment(r);if(b>0&&(b<=C||T)){i.paused||this._trySkipBufferHole(T);return}}const p=self.performance.now();if(o===null){this.stalled=p;return}const m=p-o;if(!l&&m>=SP&&(this._reportStall(h),!this.media))return;const g=De.bufferInfo(i,r,a.maxBufferHole);this._tryFixBufferStall(g,m)}_tryFixBufferStall(e,t){const{config:a,fragmentTracker:i,media:o}=this;if(o===null)return;const r=o.currentTime,l=i.getPartialFragment(r);l&&(this._trySkipBufferHole(l)||!this.media)||(e.len>a.maxBufferHole||e.nextStart&&e.nextStart-r<a.maxBufferHole)&&t>a.highBufferWatchdogPeriod*1e3&&(A.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:a,stallReported:i}=this;if(!i&&a){this.stallReported=!0;const o=new Error(`Playback stalling at @${a.currentTime} due to low buffer (${JSON.stringify(e)})`);A.warn(o.message),t.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:a,media:i}=this;if(i===null)return 0;const o=i.currentTime,r=De.bufferInfo(i,o,0),l=o<r.start?r.start:r.nextStart;if(l){const d=r.len<=t.maxBufferHole,c=r.len>0&&r.len<1&&i.readyState<3,h=l-o;if(h>0&&(d||c)){if(h>t.maxBufferHole){const{fragmentTracker:f}=this;let p=!1;if(o===0){const m=f.getAppendedFrag(0,le.MAIN);m&&l<m.end&&(p=!0)}if(!p){const m=e||f.getAppendedFrag(o,le.MAIN);if(m){let g=!1,y=m.end;for(;y<l;){const b=f.getPartialFragment(y);if(b)y+=b.duration;else{g=!0;break}}if(g)return 0}}}const u=Math.max(l+_P,o+wP);if(A.warn(`skipping hole, adjusting currentTime from ${o} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const f=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${u}`);a.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:a,nudgeRetry:i}=this;if(a===null)return;const o=a.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const r=o+(i+1)*e.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${o} to ${r}`);A.warn(l.message),a.currentTime=r,t.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1})}else{const r=new Error(`Playhead still not moving while enough data buffered @${o} after ${e.nudgeMaxRetry} nudges`);A.error(r.message),t.trigger(w.ERROR,{type:fe.MEDIA_ERROR,details:B.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}const EP=100;class TP extends wl{constructor(e,t,a){super(e,t,a,"[stream-controller]",le.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.LEVEL_LOADING,this.onLevelLoading,this),e.on(w.LEVEL_LOADED,this.onLevelLoaded,this),e.on(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(w.ERROR,this.onError,this),e.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(w.BUFFER_CREATED,this.onBufferCreated,this),e.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.LEVEL_LOADED,this.onLevelLoaded,this),e.off(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(w.ERROR,this.onError,this),e.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(w.BUFFER_CREATED,this.onBufferCreated,this),e.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:a}=this;if(this.stopLoad(),this.setInterval(EP),this.level=-1,!this.startFragRequested){let i=a.startLevel;i===-1&&(a.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=a.firstAutoLevel),a.nextLoadLevel=i,this.level=a.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=V.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=V.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case V.WAITING_LEVEL:{const{levels:t,level:a}=this,i=t==null?void 0:t[a],o=i==null?void 0:i.details;if(o&&(!o.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(o))break;this.state=V.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=V.IDLE;break}break}case V.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),a=this.retryDate;if(!a||t>=a||(e=this.media)!=null&&e.seeking){const{levels:i,level:o}=this,r=i==null?void 0:i[o];this.resetStartWhenNotLoaded(r||null),this.state=V.IDLE}}break}this.state===V.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:a,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const o=e.nextLoadLevel;if(!(a!=null&&a[o]))return;const r=a[o],l=this.getMainFwdBufferInfo();if(l===null)return;const d=this.getLevelDetails();if(d&&this._streamEnded(l,d)){const g={};this.altAudio&&(g.type="video"),this.hls.trigger(w.BUFFER_EOS,g),this.state=V.ENDED;return}e.loadLevel!==o&&e.manualLevel===-1&&this.log(`Adapting to level ${o} from level ${this.level}`),this.level=e.nextLoadLevel=o;const c=r.details;if(!c||this.state===V.WAITING_LEVEL||c.live&&this.levelLastLoaded!==r){this.level=o,this.state=V.WAITING_LEVEL;return}const h=l.len,u=this.getMaxBufferLength(r.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:l.end;let p=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&p&&p.sn!=="initSegment"&&this.fragmentTracker.getState(p)!==Ze.OK){var m;const y=((m=this.backtrackFragment)!=null?m:p).sn-c.startSN,b=c.fragments[y-1];b&&p.cc===b.cc&&(p=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,f)){if(!p.gap){const y=this.audioOnly&&!this.altAudio?Re.AUDIO:Re.VIDEO,b=(y===Re.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,y,le.MAIN)}p=this.getNextFragmentLoopLoading(p,c,l,le.MAIN,u)}p&&(p.initSegment&&!p.initSegment.data&&!this.bitrateTest&&(p=p.initSegment),this.loadFragment(p,r,f))}loadFragment(e,t,a){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===Ze.NOT_LOADED||i===Ze.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,a)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,le.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let a;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const o=this.getLevelDetails();if(o!=null&&o.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<o.targetduration*2)return}if(!t.paused&&e){const l=this.hls.nextLoadLevel,d=e[l],c=this.fragLastKbps;c&&this.fragCurrent?a=this.fragCurrent.duration*d.maxBitrate/(1e3*c)+1:a=0}else a=0;const r=this.getBufferedFrag(t.currentTime+a);if(r){const l=this.followingBufferedFrag(r);if(l){this.abortCurrentFrag();const d=l.maxStartPTS?l.maxStartPTS:l.start,c=l.duration,h=Math.max(r.end,d+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case V.KEY_LOADING:case V.FRAG_LOADING:case V.FRAG_LOADING_WAITING_RETRY:case V.PARSING:case V.PARSED:this.state=V.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const a=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new kP(this.config,a,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;ne(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const a=this.getMainFwdBufferInfo();if(a===null||a.len===0){this.warn(`Main forward buffer length on "seeked" event ${a?a.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(w.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let a=!1,i=!1;t.levels.forEach(o=>{const r=o.audioCodec;r&&(a=a||r.indexOf("mp4a.40.2")!==-1,i=i||r.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=a&&i&&!bP(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:a}=this;if(!a||this.state!==V.IDLE)return;const i=a[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=V.WAITING_LEVEL)}onLevelLoaded(e,t){var a;const{levels:i}=this,o=t.level,r=t.details,l=r.totalduration;if(!i){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""}, cc [${r.startCC}, ${r.endCC}] duration:${l}`);const d=i[o],c=this.fragCurrent;c&&(this.state===V.FRAG_LOADING||this.state===V.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let h=0;if(r.live||(a=d.details)!=null&&a.live){var u;if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;h=this.alignPlaylists(r,d.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(d.details=r,this.levelLastLoaded=d,this.hls.trigger(w.LEVEL_UPDATED,{details:r,level:o}),this.state===V.WAITING_LEVEL){if(this.waitForCdnTuneIn(r))return;this.state=V.IDLE}this.startFragRequested?r.live&&this.synchronizeToLiveEdge(r):this.setStartPosition(r,h),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:a,part:i,payload:o}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${a.sn} of level ${a.level} will not be buffered`);return}const l=r[a.level],d=l.details;if(!d){this.warn(`Dropping fragment ${a.sn} of level ${a.level} after level details were reset`),this.fragmentTracker.removeFragment(a);return}const c=l.videoCodec,h=d.PTSKnown||!d.live,u=(t=a.initSegment)==null?void 0:t.data,f=this._getAudioCodec(l),p=this.transmuxer=this.transmuxer||new vp(this.hls,le.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=i?i.index:-1,g=m!==-1,y=new bl(a.level,a.sn,a.stats.chunkCount,o.byteLength,m,g),b=this.initPTS[a.cc];p.push(o,u,f,c,a,i,d.totalduration,h,y,b)}onAudioTrackSwitching(e,t){const a=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const o=this.hls;a&&(o.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(w.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const a=t.id,i=!!this.hls.audioTracks[a].url;if(i){const o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const a=t.tracks;let i,o,r=!1;for(const l in a){const d=a[l];if(d.id==="main"){if(o=l,i=d,l==="video"){const c=a[l];c&&(this.videoBuffer=c.buffer)}}else r=!0}r&&i?(this.log(`Alternate track found, use ${o}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:a,part:i}=t;if(a&&a.type!==le.MAIN)return;if(this.fragContextChanged(a)){this.warn(`Fragment ${a.sn}${i?" p: "+i.index:""} of level ${a.level} finished buffering, but was aborted. state: ${this.state}`),this.state===V.PARSED&&(this.state=V.IDLE);return}const o=i?i.stats:a.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,i)}onError(e,t){var a;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case B.FRAG_GAP:case B.FRAG_PARSING_ERROR:case B.FRAG_DECRYPT_ERROR:case B.FRAG_LOAD_ERROR:case B.FRAG_LOAD_TIMEOUT:case B.KEY_LOAD_ERROR:case B.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.MAIN,t);break;case B.LEVEL_LOAD_ERROR:case B.LEVEL_LOAD_TIMEOUT:case B.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_LEVEL&&((a=t.context)==null?void 0:a.type)===xe.LEVEL&&(this.state=V.IDLE);break;case B.BUFFER_APPEND_ERROR:case B.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===B.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case B.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!De.getBuffered(e).length){const a=this.state!==V.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,a)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=V.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Re.AUDIO||this.audioOnly&&!this.altAudio){const a=(t===Re.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(a,t,le.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let a=this.startPosition;if(a>=0&&t<a){if(e.seeking){this.log(`could not seek to ${a}, already seeking at ${t}`);return}const i=De.getBuffered(e),r=(i.length?i.start(0):0)-a;r>0&&(r<this.config.maxBufferHole||r<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${r} to match buffer start`),a+=r,this.startPosition=a),this.log(`seek to target start position ${a} from current time ${t}`),e.currentTime=a}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(a=>{const{hls:i}=this;if(!a||this.fragContextChanged(e))return;t.fragmentError=0,this.state=V.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=e.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),i.trigger(w.FRAG_LOADED,a),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const a="main",{hls:i}=this,{remuxResult:o,chunkMeta:r}=e,l=this.getCurrentContext(r);if(!l){this.resetWhenMissingContext(r);return}const{frag:d,part:c,level:h}=l,{video:u,text:f,id3:p,initSegment:m}=o,{details:g}=h,y=this.altAudio?void 0:o.audio;if(this.fragContextChanged(d)){this.fragmentTracker.removeFragment(d);return}if(this.state=V.PARSING,m){if(m!=null&&m.tracks){const _=d.initSegment||d;this._bufferInitSegment(h,m.tracks,_,r),i.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:a,tracks:m.tracks})}const b=m.initPTS,S=m.timescale;ne(b)&&(this.initPTS[d.cc]={baseTime:b,timescale:S},i.trigger(w.INIT_PTS_FOUND,{frag:d,id:a,initPTS:b,timescale:S}))}if(u&&g&&d.sn!=="initSegment"){const b=g.fragments[d.sn-1-g.startSN],S=d.sn===g.startSN,_=!b||d.cc>b.cc;if(o.independent!==!1){const{startPTS:C,endPTS:T,startDTS:v,endDTS:E}=u;if(c)c.elementaryStreams[u.type]={startPTS:C,endPTS:T,startDTS:v,endDTS:E};else if(u.firstKeyFrame&&u.independent&&r.id===1&&!_&&(this.couldBacktrack=!0),u.dropped&&u.independent){const N=this.getMainFwdBufferInfo(),L=(N?N.end:this.getLoadPosition())+this.config.maxBufferHole,R=u.firstKeyFramePTS?u.firstKeyFramePTS:C;if(!S&&L<R-this.config.maxBufferHole&&!_){this.backtrack(d);return}else _&&(d.gap=!0);d.setElementaryStreamInfo(u.type,d.start,T,d.start,E,!0)}else S&&C>gi&&(d.gap=!0);d.setElementaryStreamInfo(u.type,C,T,v,E),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(u,d,c,r,S||_)}else if(S||_)d.gap=!0;else{this.backtrack(d);return}}if(y){const{startPTS:b,endPTS:S,startDTS:_,endDTS:C}=y;c&&(c.elementaryStreams[Re.AUDIO]={startPTS:b,endPTS:S,startDTS:_,endDTS:C}),d.setElementaryStreamInfo(Re.AUDIO,b,S,_,C),this.bufferFragmentData(y,d,c,r)}if(g&&p!=null&&(t=p.samples)!=null&&t.length){const b={id:a,frag:d,details:g,samples:p.samples};i.trigger(w.FRAG_PARSING_METADATA,b)}if(g&&f){const b={id:a,frag:d,details:g,samples:f.samples};i.trigger(w.FRAG_PARSING_USERDATA,b)}}_bufferInitSegment(e,t,a,i){if(this.state!==V.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:o,video:r,audiovideo:l}=t;if(o){let d=e.audioCodec;const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const h=o.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&o.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),e.audioCodec&&e.audioCodec!==d&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${d}"`),o.levelCodec=d,o.id="main",this.log(`Init audio buffer, container:${o.container}, codecs[selected/level/parsed]=[${d||""}/${e.audioCodec||""}/${o.codec}]`)}r&&(r.levelCodec=e.videoCodec,r.id="main",this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${r.codec}]`)),l&&this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),this.hls.trigger(w.BUFFER_CODECS,t),Object.keys(t).forEach(d=>{const h=t[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(w.BUFFER_APPENDING,{type:d,data:h,frag:a,part:null,chunkMeta:i,parent:a.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,le.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=V.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const a=e.currentTime;if(De.isBuffered(e,a)?t=this.getAppendedFrag(a):De.isBuffered(e,a+.1)&&(t=this.getAppendedFrag(a+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,o=t.level;(!i||t.sn!==i.sn||i.level!==o)&&(this.fragPlaying=t,this.hls.trigger(w.FRAG_CHANGED,{frag:t}),(!i||i.level!==o)&&this.hls.trigger(w.LEVEL_SWITCHED,{level:o}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,a=this.currentFrag;if(a&&ne(t)&&ne(a.programDateTime)){const i=a.programDateTime+(t-a.start)*1e3;return new Date(i)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ds{static get version(){return"1.5.15"}static isMSESupported(){return dg()}static isSupported(){return yP()}static getMediaSource(){return Es()}static get Events(){return w}static get ErrorTypes(){return fe}static get ErrorDetails(){return B}static get DefaultConfig(){return ds.defaultConfig?ds.defaultConfig:rg}static set DefaultConfig(e){ds.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Ll,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,u6(e.debug||!1,"Hls instance");const t=this.config=mP(ds.DefaultConfig,e);this.userConfig=e,t.progressive&&fP(t);const{abrController:a,bufferController:i,capLevelController:o,errorController:r,fpsController:l}=t,d=new r(this),c=this.abrController=new a(this),h=this.bufferController=new i(this),u=this.capLevelController=new o(this),f=new l(this),p=new oN(this),m=new hN(this),g=t.contentSteeringController,y=g?new g(this):null,b=this.levelController=new pP(this,y),S=new VN(this),_=new gP(this.config),C=this.streamController=new TP(this,S,_);u.setStreamController(C),f.setStreamController(C);const T=[p,b,C];y&&T.splice(1,0,y),this.networkControllers=T;const v=[c,h,u,f,m,S];this.audioTrackController=this.createController(t.audioTrackController,T);const E=t.audioStreamController;E&&T.push(new E(this,S,_)),this.subtitleTrackController=this.createController(t.subtitleTrackController,T);const N=t.subtitleStreamController;N&&T.push(new N(this,S,_)),this.createController(t.timelineController,v),_.emeController=this.emeController=this.createController(t.emeController,v),this.cmcdController=this.createController(t.cmcdController,v),this.latencyController=this.createController(uN,v),this.coreComponents=v,T.push(d);const L=d.onErrorOut;typeof L=="function"&&this.on(w.ERROR,L,d)}createController(e,t){if(e){const a=new e(this);return t&&t.push(a),a}return null}on(e,t,a=this){this._emitter.on(e,t,a)}once(e,t,a=this){this._emitter.once(e,t,a)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,a=this,i){this._emitter.off(e,t,a,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,a){return this._emitter.emit(e,t,a)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(a){if(A.error("An internal error happened while handling event "+e+'. Error message: "'+a.message+'". Here is a stacktrace:',a),!this.triggeringException){this.triggeringException=!0;const i=e===w.ERROR;this.trigger(w.ERROR,{type:fe.OTHER_ERROR,details:B.INTERNAL_EXCEPTION,fatal:i,event:e,error:a}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){A.log("destroy"),this.trigger(w.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){A.log("attachMedia"),this._media=e,this.trigger(w.MEDIA_ATTACHING,{media:e})}detachMedia(){A.log("detachMedia"),this.trigger(w.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,a=this.url,i=this.url=qr.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,A.log(`loadSource:${i}`),t&&a&&(a!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(w.MANIFEST_LOADING,{url:e})}startLoad(e=-1){A.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){A.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){A.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){A.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){A.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){A.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){A.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){A.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){A.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(A.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){mN(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const a=e.length;for(let i=0;i<a;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:a}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,a)for(let o=i;o--;){const r=e[o].attrs["HDCP-LEVEL"];if(r&&r<=a)return o}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}ds.defaultConfig=void 0;const CP=[(s=>(n.pushScopeId("data-v-d3c9a398"),s=s(),n.popScopeId(),s))(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[n.createElementVNode("path",{d:"M5 15L15 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"}),n.createElementVNode("path",{d:"M15 15L5 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],xP={class:"stories__content"},vP={class:"story-container-game"},AP={class:"story-circle"},LP={class:"story-result"},IP={class:"stories__content__stories-bar"},RP={class:"stories__content__video"},NP={class:"stories__content__video__info__date"},BP={class:"stories__content__video__info__data"},DP=qe({__name:"GameStories",props:{stories:{type:Array,default:()=>[]},startStoryIndex:{type:Number,default:0},isFirstGameStories:{type:Boolean,default:!1},isLastGameStories:{type:Boolean,default:!1}},emits:["close","last-story-index","swipe","video-play","video-next-back"],setup(s,{emit:e}){const t=s;n.useCssVars(se=>({"559904cd":y.value,"57a9d8d4":b.value,"57d750a1":v.value}));const a=Wo(),o=[{ids:[607,608],name:"Oportunidad de Gol"},{ids:[12,55],name:"Gol"},{ids:[54,35],name:"Autogol"},{ids:[14,52],name:"Tarjeta Amarilla"},{ids:[15,53],name:"Tarjeta Roja"},{ids:[466,477],name:"Penal Recibido"}].reduce((se,Ee)=>(Ee.ids.forEach(Te=>{se.set(Te,Ee.name)}),se),new Map),r=n.ref(null),l=n.ref(null),d=n.ref([]),c=n.ref(0),h=n.ref(null),u=n.ref(0),f=n.ref(0),p=n.ref(0),m=n.ref(!1),g=n.ref(0),y=n.ref("auto"),b=n.ref("100%"),S=n.ref(null),_=n.ref(0),C=n.ref(null),T=n.ref(null),v=n.computed(()=>Z()?"7vw":"16px"),E=n.computed(()=>d.value[c.value]),N=n.computed(()=>({"--icon-play":`url(${a}/icnplay1.svg)`}));function L(){l.value.muted=!1,l.value.play()}const R=n.computed(()=>!E.value.isHls&&["ios"].includes(Ko()));n.watch(()=>E.value,se=>{se&&K()}),n.watch(()=>t.stories,se=>{if(se.length){c.value=0,p.value=0;const Ee=se.map(Te=>({...Te,progress:0,isHls:Te.url.includes(".m3u8"),date:`${Te.date.getDate()}, ${eu[Te.date.getMonth()]} ${Te.date.getFullYear()}`,data:`${o.get(Te.categoryId)} ${Fx(Te.player.player_name)}`})).sort((Te,Fe)=>Te.startTime-Fe.startTime);t.startStoryIndex>0&&t.startStoryIndex<Ee.length-1&&(Ee.forEach((Te,Fe)=>{Fe<=t.startStoryIndex&&(Te.progress=100)}),c.value=t.startStoryIndex+1,p.value=c.value),d.value=[...Ee]}},{immediate:!0}),n.watch(()=>r.value,se=>{se&&$()},{flush:"post"}),n.watch(()=>h.value,se=>{se&&(Ox()?(se.addEventListener("touchstart",he),se.addEventListener("touchend",J)):(se.addEventListener("mousedown",he),se.addEventListener("mouseup",J)))},{flush:"post"});function $(){l.value=new Ps("#video-plyr",{controls:[],autoplay:!0,playsinline:!0}),l.value.on("loadeddata",ae(l.value)),l.value.on("timeupdate",oe()),K(E.value),l.value.isDestroyed=!1}function K(){E.value.isHls?z(E.value):l.value&&(l.value.source={type:"video",sources:[{src:E.value.url,type:"video/mp4"}]})}function z(se){if(r.value)if(ds.isSupported()){r.value.src=null;let Ee=new ds;Ee.loadSource(se.url),Ee.attachMedia(r.value)}else l.value.source={type:"video",sources:[{src:se.url,type:"video/mp4"}]}}function ae(){const se=document.querySelector(".plyr__video-wrapper");return se&&(_.value=se.getBoundingClientRect()),()=>{l.value.duration>0&&(l.value.currentTime=E.value.startTime||0,l.value.muted=!1,l.value.play(),e("video-play",E.value))}}function oe(){return Ce(),()=>{E.value.currentTime=l.value.currentTime,E.value.progress=(l.value.currentTime-E.value.startTime)/E.value.duration*100,(l.value.currentTime-E.value.startTime)/E.value.duration*100===0?Z()&&(m.value=!0):Z()&&(m.value=!1),(l.value.currentTime-E.value.startTime)/E.value.duration*100<0?T.value&&!Z()&&(T.value.style="display: none",b.value="100%"):T.value&&!Z()&&(T.value.style="display: block",b.value="auto"),l.value.currentTime>=E.value.endTime&&(l.value.pause(),ie())}}function ie(se=1){const Ee=c.value+se;Ee<0?t.isFirstGameStories?l.value&&(l.value.currentTime=E.value.startTime):de("right",E.value):Ee===d.value.length?t.isLastGameStories?q():de("left",E.value):(c.value=Ee,se===1&&(p.value=c.value))}function ce(){u.value>f.value?de("left",E.value):u.value<f.value?de("right",E.value):Q()}function de(se,Ee){e("last-story-index",p.value),e("swipe",{direction:se,currentPlay:Ee})}function Q(){const se=window.innerWidth/2,Ee=u.value<se,Te=E.value.progress;E.value.progress=Ee?0:100,l.value.pause(),e("video-next-back",{eventName:Ee?"stories_video_anterior":"stories_video_siguiente",currentPlay:{...E.value,progress:Te}}),ie(Ee?-1:1)}function q(){l.value.pause(),l.value.muted=!0,e("last-story-index",p.value),e("close",E.value)}function he(se){u.value=se.changedTouches?se.changedTouches[0].clientX:se.clientX}function J(se){f.value=se.changedTouches?se.changedTouches[0].clientX:se.clientX,ce()}function Z(){return/iPhone|iPad/i.test(navigator.userAgent)}function ue(){window.scrollTo(0,100)}function ge(){if(window.scrollTo(0,100),Ko()=="android"){const se=document.querySelector("#stories");se.requestFullscreen(se)}}function Ce(){if(window.ResizeObserver)S.value=new window.ResizeObserver(()=>{C.value&&_.value.height>0&&(C.value.getBoundingClientRect().height>610?y.value="auto":y.value="100dvh",C.value.getBoundingClientRect().height>610?b.value="100%":b.value="auto")}),S.value.observe(C.value);else throw new Error("Resize observer not supported!")}return n.onMounted(()=>{g.value=document.documentElement.scrollTop||document.body.scrollTop,window.scrollTo(0,100),Z()?(window.addEventListener("resize",ue),ue()):(window.addEventListener("orientationchange",ge),ge()),setTimeout(()=>{Ce()},500)}),n.onBeforeUnmount(()=>{window.scrollTo(0,g.value),Z()?window.removeEventListener("resize",ue):(Ko()=="android"&&document.exitFullscreen(),window.removeEventListener("orientationchange",ge)),S.value&&(S.value.disconnect(),S.value=null)}),(se,Ee)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stories",Z()?"stories-safe-areas-iphone":""]),id:"stories",ref_key:"eStories",ref:C,style:n.normalizeStyle(N.value)},[n.createElementVNode("div",{class:n.normalizeClass(["stories__close",Z()?"stories-safe-areas-iphone":""]),onClick:q},CP,2),n.createElementVNode("div",xP,[n.createElementVNode("div",vP,[n.createElementVNode("div",AP,[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle(`background-image: url(${E.value.thumbnail.logoHomeTeam})`)},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle(`background-image: url(${E.value.thumbnail.logoAwayTeam})`)},null,4)]),n.createElementVNode("div",LP,n.toDisplayString(E.value.header.label),1)]),n.createElementVNode("div",{ref_key:"overlay",ref:h,class:"stories__content__overlay"},null,512),n.createElementVNode("div",IP,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(Te,Fe)=>(n.openBlock(),n.createElementBlock("div",{key:Fe,class:"stories__content__stories-bar__item"},[n.createElementVNode("div",{class:"stories__content__stories-bar__item__progress",style:n.normalizeStyle({width:`${Te.progress}%`})},null,4)]))),128))]),n.createElementVNode("div",RP,[n.createElementVNode("div",{class:"stories__content__video__info",ref_key:"videoInfo",ref:T},[n.createElementVNode("div",NP,n.toDisplayString(E.value.date),1),n.createElementVNode("div",BP,n.toDisplayString(E.value.data),1)],512),n.createElementVNode("video",{ref_key:"player",ref:r,id:"video-plyr",controls:"",preload:"auto","data-setup":"{}",playsinline:""},null,512)])]),R.value?(n.openBlock(),n.createElementBlock("button",{key:0,id:"btn_play_ios",style:n.normalizeStyle(m.value?"display:block":"display:none"),onClick:L},null,4)):n.createCommentVNode("",!0)],6))}},[["__scopeId","data-v-d3c9a398"]]),PP={playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00-PI-0",last_played_index:0,group_id:"1",total_plays:55,playlist_type:"1",group_playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00",user_id:"goltesting",created_at:"2023-03-30T15:42:36.402+00:00",playlist:[[136731235,"Liga MX","Apertura 2022",69929,"Aldrete Rodriguez, Adrian","Quintero Huitron, Daniel","Estadio Olímpico Universitario, Ciudad de México.","1 - 0","1 - 0","2022-07-17T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",1259,1278,20,1266,"https://golstatsbets.blob.core.windows.net/video-player/69929_1.mp4"],[139820484,"Liga MX","Apertura 2022",70042,"Davila Zavala, Victor","Mejia, Oscar ","Estadio Nuevo Monumental, Rafaela.","3 - 1","1 - 0","2022-09-18T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",1501,1524,24,1512,"https://golstatsbets.blob.core.windows.net/video-player/70042_1.mp4"],[139566427,"Liga MX","Apertura 2022",69989,"Zaldivar Caviedes, Angel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","1 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",12,"Goals",6569,6588,108,6576,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[139441913,"Liga MX","Apertura 2022",70031,"Vega Rojas, Alexis","Quintero Huitron, Daniel","Estadio Akron, Zapopan.","1 - 0","1 - 0","2022-09-10T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",6207,6237,103,6225,"https://golstatsbets.blob.core.windows.net/video-player/70031_1.mp4"],[139566063,"Liga MX","Apertura 2022",69989,"Guzman Palomeque, Nahuel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","0 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",39,"Saves",2554,2573,41,2561,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[138276096,"Liga MX","Apertura 2022",69983,"Cortizo de la Piedra, Jordi","Guerrero Ramirez, Fernando","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-08-16T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",5020,5046,83,5034,"https://golstatsbets.blob.core.windows.net/video-player/69983_1.mp4"],[139285589,"Liga MX","Apertura 2022",70021,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-09-07T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png",12,"Goals",1123,1152,18,1140,"https://golstatsbets.blob.core.windows.net/video-player/70021_1.mp4"],[139294964,"Liga MX","Apertura 2022",70022,"Cordova Reyes, Francisco","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicolás de los Garza.","3 - 1","1 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",2564,2583,41,2571,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137782451,"Liga MX","Apertura 2022",69968,"Orrantia Trevino, Carlos","Macias Romo, Oscar","Estadio TSM Corona, Torreón.","4 - 0","1 - 0","2022-08-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",4662,4693,77,4681,"https://golstatsbets.blob.core.windows.net/video-player/69968_1.mp4"],[136551560,"Liga MX","Apertura 2022",69924,"Sanchez Guerrero, Richard","Escobedo, Adonai","Estadio Azteca, Ciudad de México.","1 - 0","1 - 0","2022-07-13T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",7032,7064,116,7052,"https://golstatsbets.blob.core.windows.net/video-player/69924_1.mp4"],[136391881,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","1 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",4903,4937,81,4925,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[138158049,"Liga MX","Apertura 2022",69979,"Volpi, Tiago Luis","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",39,"Saves",7207,7226,119,7214,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[138124884,"Liga MX","Apertura 2022",69978,"Vargas Gil, Camilo","Ortiz Nava, Marco Antonio","Default","1 - 1","0 - 0","2022-08-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6080,6099,100,6087,"https://golstatsbets.blob.core.windows.net/video-player/69978_1.mp4"],[139635463,"Liga MX","Apertura 2022",69950,"Fidalgo Fernandez, Alvaro","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",10,"Assists",7096,7123,118,7111,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139769221,"Liga MX","Apertura 2022",70039,"Ochoa Magana, Guillermo","Escobedo, Adonai","Estadio Azteca, Ciudad de México.","2 - 1","0 - 0","2022-09-17T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",39,"Saves",4567,4586,76,4574,"https://golstatsbets.blob.core.windows.net/video-player/70039_1.mp4"],[139405626,"Liga MX","Apertura 2022",70028,"Acevedo Lopez, Carlos","Santander, Luis Enrique","Estadio La Corregidora, Querétaro.","3 - 3","0 - 2","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",55,"Goals",7452,7471,124,7459,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139410464,"Liga MX","Apertura 2022",70030,"Gonzalez Vela Alvizu, Julio","Hernandez Gomez, Fernando","Estadio Nemesio Diez, Toluca.","2 - 2","0 - 1","2022-09-10T05:00:00.000Z","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",55,"Goals",7467,7486,124,7474,"https://golstatsbets.blob.core.windows.net/video-player/70030_1.mp4"],[139902797,"Liga MX","Apertura 2022",70038,"Quinones Quinones, Julian","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",702,"Con enfrentamiento",2334,2353,38,2341,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[139771860,"Liga MX","Apertura 2022",70038,"Andrada, Esteban ","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6859,6878,113,6866,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[136392028,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","0 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",607,"Oportunidad de gol",335,374,5,342,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[136467302,"Liga MX","Apertura 2022",69909,"Jurado Roca, Sebastian","Mejia, Oscar ","Estadio Universitario, San Nicolás de los Garza.","2 - 3","0 - 0","2022-07-02T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",39,"Saves",879,898,14,886,"https://golstatsbets.blob.core.windows.net/video-player/69909_1.mp4"],[138402354,"Liga MX","Apertura 2022",69990,"Beltran Cruz, Fernando","Mejia, Oscar ","Estadio Victoria, Aguascalientes.","0 - 4","0 - 1","2022-08-19T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",12,"Goals",4517,4551,75,4539,"https://golstatsbets.blob.core.windows.net/video-player/69990_1.mp4"],[138157481,"Liga MX","Apertura 2022",69979,"Meneses Villarroel, Jean","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",1900,1925,31,1913,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[140106188,"Liga MX","Apertura 2022",69964,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 1","1 - 0","2022-09-23T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",12,"Goals",461,484,7,472,"https://golstatsbets.blob.core.windows.net/video-player/69964_1.mp4"],[139839994,"Liga MX","Apertura 2022",70043,"Garcia Carpizo, Brian","Montano Robles, Diego","Estadio Caliente, Tijuana.","1 - 1","0 - 1","2022-09-18T05:00:00.000Z","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",2112,2133,34,2121,"https://golstatsbets.blob.core.windows.net/video-player/70043_1.mp4"],[139403868,"Liga MX","Apertura 2022",70028,"Suarez, Leonardo Gabriel","Santander, Luis Enrique","Estadio La Corregidora, Querétaro.","3 - 3","0 - 1","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",4296,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139371616,"Liga MX","Apertura 2022",70027,"Gallardo Vasconcelos, Jesus","Montano Robles, Diego","Estadio Olimpico Benito Juarez, Ciudad Juarez.","0 - 1","0 - 1","2022-09-09T05:00:00.000Z","FC Juarez","https://az755631.vo.msecnd.net/teams-80/3014.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",5724,5750,94,5738,"https://golstatsbets.blob.core.windows.net/video-player/70027_1.mp4"],[139294028,"Liga MX","Apertura 2022",70022,"Thauvin, Florian","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicolás de los Garza.","3 - 1","2 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",6011,6030,99,6018,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137023432,"Liga MX","Apertura 2022",69939,"Gignac, Andre Pierre","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicolás de los Garza.","2 - 0","1 - 0","2022-07-23T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",2829,2854,47,2842,"https://golstatsbets.blob.core.windows.net/video-player/69939_1.mp4"],[139303531,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Olímpico Universitario, Ciudad de México.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",702,"Con enfrentamiento",262,293,3,278,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139303334,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Olímpico Universitario, Ciudad de México.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",10,"Assists",5256,5283,87,5271,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139633795,"Liga MX","Apertura 2022",69950,"Valdes Contreras, Diego","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",607,"Oportunidad de gol",675,701,10,689,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139242728,"Liga MX","Apertura 2022",70020,"Valdes Contreras, Diego","Caceres Hernandez, Victor Alfonso","Estadio Azteca, Ciudad de México.","3 - 0","0 - 0","2022-09-06T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",10,"Assists",2841,2861,46,2849,"https://golstatsbets.blob.core.windows.net/video-player/70020_1.mp4"],[138747150,"Liga MX","Apertura 2022",7e4,"Valdes Contreras, Diego","Miranda Galindo, Erick Yair","Default","1 - 3","0 - 1","2022-08-26T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",2425,2448,39,2436,"https://golstatsbets.blob.core.windows.net/video-player/70000_1.mp4"],[138462163,"Liga MX","Apertura 2022",69995,"Valdes Contreras, Diego","Santander, Luis Enrique","Estadio Azteca, Ciudad de México.","7 - 0","1 - 0","2022-08-20T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",3424,3443,56,3431,"https://golstatsbets.blob.core.windows.net/video-player/69995_1.mp4"],[138832474,"Liga MX","Apertura 2022",70005,"Sambueza, Rubens Oscar","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torreón.","4 - 1","1 - 1","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",6830,6859,113,6847,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"],[137178428,"Liga MX","Apertura 2022",69942,"Ibarra Mina, Alex Renato","Montano Robles, Diego","Estadio Jalisco, Guadalajara.","1 - 2","0 - 1","2022-07-26T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",12,"Goals",2786,2811,45,2799,"https://golstatsbets.blob.core.windows.net/video-player/69942_1.mp4"],[138339473,"Liga MX","Apertura 2022",69985,"Canelo, Pedro Alexis","Referee 1","Azteca","1 - 2","0 - 0","2022-08-17T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",10,"Assists",5133,5159,85,5147,"https://golstatsbets.blob.core.windows.net/video-player/69985_1.mp4"],[136701989,"Liga MX","Apertura 2022",69927,"Gimenez, Santiago Tomas","Macias Romo, Oscar","Estadio Jalisco, Guadalajara.","3 - 2","0 - 1","2022-07-16T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",1374,1397,22,1385,"https://golstatsbets.blob.core.windows.net/video-player/69927_1.mp4"],[139678329,"Liga MX","Apertura 2022",70049,"Antuna Romero, Carlos","Ortiz Nava, Marco Antonio","Estadio Azteca, Ciudad de México.","2 - 1","0 - 0","2022-09-15T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",10,"Assists",6728,6752,111,6740,"https://golstatsbets.blob.core.windows.net/video-player/70049_1.mp4"],[139054131,"Liga MX","Apertura 2022",70010,"Davila Zavala, Victor","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 1","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",6636,6661,110,6649,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137503273,"Liga MX","Apertura 2022",69962,"Davila Zavala, Victor","Macias Romo, Oscar","Estadio Nou Camp, Le&ocuate;n.","3 - 2","1 - 0","2022-07-31T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",1940,1965,31,1953,"https://golstatsbets.blob.core.windows.net/video-player/69962_1.mp4"],[139308851,"Liga MX","Apertura 2022",70025,"Benedetti Roa, Nicolas","Hernandez Gomez, Fernando","Default","1 - 0","1 - 0","2022-09-07T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",1867,1891,31,1879,"https://golstatsbets.blob.core.windows.net/video-player/70025_1.mp4"],[138116335,"Liga MX","Apertura 2022",69976,"Benedetti Roa, Nicolas","Galvan Basulto, Eduardo","Estadio Nou Camp, Le&ocuate;n.","0 - 3","0 - 1","2022-08-13T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",591,629,9,617,"https://golstatsbets.blob.core.windows.net/video-player/69976_1.mp4"],[136791022,"Liga MX","Apertura 2022",69932,"Benedetti Roa, Nicolas","Camacho Peregrina, Jorge","Estadio Hidalgo, Pachuca.","1 - 1","0 - 1","2022-07-18T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",4284,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/69932_1.mp4"],[139414938,"Liga MX","Apertura 2022",70026,"Batista Ochoa, Facundo","Guerrero Ramirez, Fernando","Estadio Victoria, Aguascalientes.","1 - 2","1 - 0","2022-09-10T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",461,490,7,478,"https://golstatsbets.blob.core.windows.net/video-player/70026_1.mp4"],[139051051,"Liga MX","Apertura 2022",70010,"Batista Ochoa, Facundo","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 0","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2731,2750,45,2738,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137828273,"Liga MX","Apertura 2022",69970,"Batista Ochoa, Facundo","Galvan Basulto, Eduardo","Estadio Alfonso Lastras Ramírez, San Luis Potosí.","1 - 2","0 - 1","2022-08-07T05:00:00.000Z","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",849,870,13,858,"https://golstatsbets.blob.core.windows.net/video-player/69970_1.mp4"],[139025773,"Liga MX","Apertura 2022",70009,"Nahuelpan Osten, Ariel","Lopez Penuelas, Ismael","Estadio La Corregidora, Querétaro.","1 - 1","1 - 0","2022-09-01T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",1454,1481,24,1472,"https://golstatsbets.blob.core.windows.net/video-player/70009_1.mp4"],[138063913,"Liga MX","Apertura 2022",69973,"Gonzalez Gonzalez, Arturo","Pacheco Larios, Guillermo","Estadio Victoria, Aguascalientes.","1 - 2","0 - 1","2022-08-12T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",6119,6138,101,6126,"https://golstatsbets.blob.core.windows.net/video-player/69973_1.mp4"],[137780455,"Liga MX","Apertura 2022",69966,"Gonzalez Gonzalez, Arturo","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","5 - 1","1 - 0","2022-08-06T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2292,2321,38,2309,"https://golstatsbets.blob.core.windows.net/video-player/69966_1.mp4"],[140090831,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",585,612,9,600,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[140090832,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de México.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",1175,1197,18,1182,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139227464,"Liga MX","Apertura 2022",70018,"Suarez, Leonardo Gabriel","Quintero Huitron, Daniel","Estadio TSM Corona, Torreón.","3 - 1","1 - 0","2022-09-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",7011,7034,116,7022,"https://golstatsbets.blob.core.windows.net/video-player/70018_1.mp4"],[138830649,"Liga MX","Apertura 2022",70005,"Suarez, Leonardo Gabriel","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torreón.","4 - 1","1 - 0","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",4297,4380,71,4304,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"]]},OP=new Map([[1,45],[2,90],[3,105],[4,120]]),FP=[{id:12,name:"Gol"},{id:55,name:"Gol"},{id:39,name:"Atajada"},{id:10,name:"Asistencia"},{id:702,name:"1vs1 exitoso ofensivo"},{id:607,name:"Oportunidad de gol"}].reduce((s,e)=>(s.set(e.id,e.name),s),new Map);let xa=null,yi=null,bi="";const Ft=a6(),MP={components:{GSCSeasonSelect:nI,GSCTournamentSelect:PL,GSCGames:gv,GSCSlider:ea,GSCGridTeamsMatches:hy,GSCPlayersLanding:ry,GSCTops:pA,GSCTableCalendar:vC,DiscoverVideos:t6,CarouselFullScreen:rL,Stories:DP},setup(){const s=n.ref("landingref"),{elementSize:e}=j0(s);return{landingref:s,elementSize:e}},props:{currentSeasonId:{type:Number,default:0},isFemale:{type:Boolean,default:!1},showStories:{type:Boolean,default:!0},season:{type:Number,default:1772},isplayer:{type:Boolean,default:!1},user:{type:Object,default:()=>{}},privileges:{type:Object,default:()=>{}},team:{type:Number,default:0},player:{type:Number,default:0},gamesPerMatchDay:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},token:{type:String,default:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"},tournamentsApiUrl:{type:String,default:""},defaultMediaPlayerSeason:{type:Number,default:0},checkLiveGamesIntervalMinutes:{type:Number,default:2}},data(){return{isPreviousDataLoaded:!1,imagesUrl:Wo(),roundAbbreviationByGameId:new Map,isCarouselFullScreenVisible:!1,isPlaySeeker:!1,keyupdate:0,carouselPlayerQueue:[],gameEventsUrl:"https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",defaultGameId:0,lastSeasonsIds:[],arrayGamesAdd:[],gamesPages:new Map,show_stories:!0,selectedRoundKeyIndex:0,currentStoriesLastIndex:0,selectedRoundKeyIndexVideo:0,selectedRound:"0",selectedRoundVideos:"0",isLeagueSelected:!1,fullTournamentScheduleFull:[],fullTournamentScheduleFullGoals:[],defaultMatchDayKey:null,isCupTournament:!1,retries:3,userTeamGames:[],userTeamGamesForVideos:[],isCupLegacyTournament:!1,tournamentScheduleKeys:[],tournamentScheduleKeysGoals:[],currentTournamentGames:null,currentTournamentTeams:null,gamesUrl:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/",gamesUrl2:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",seasonSelected:{},seasonSelectedDropDowns:{},seasonsSelected:[],gamesAllStories:[],fullTournamentSchedule:{},tournamentSelected:{id:0},tournamentType:0,tournamentSelectedDropDowns:{seasons:[]},playersLength:0,nextRivalId:0,updateTableCalendar:0,loadDiscover:!1,hasNextRival:!1,resumeType:1,goalsType:2,is_public:!1,seasonsGamesMap:new Map,gamesOfTheDayPreMatchIds:new Set,seasonsForLiveGames:[],allLiveGames:[],storiesItems:[],currentStories:[],currentStoryIndex:null,isStoriesVisible:!1,seasonPlayersMap:new Map,currentTournaments:[]}},computed:{teamSelected(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament?0:this.user.team},isGenericLike(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament},isPlaySeekerAvailable(){return[34230,34178,34201].includes(this.user.id)},games(){if(!this.isGenericLike&&!this.isLeagueSelected)return this.fullTournamentSchedule;{const s=this.gamesPages.get(this.selectedRound);return s&&s[0]?s[0].sort((e,t)=>{let a=e.dateTimeMillis,i=t.dateTimeMillis;return e.is_live&&(a-=1e9),t.is_live&&(i-=1e9),a-i}):[]}},latestRound(){return this.userTeamGames&&this.userTeamGames.length&&this.fullTournamentScheduleFullGoals&&this.fullTournamentScheduleFullGoals.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals)},closestRound(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFull):this.getNormalClosestRound(this.fullTournamentScheduleFull)},closestRoundVideos(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals,!0):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals,!0)},containerGridCalendarTable(){return this.elementSize.width<=1e3?"container-grid-calendar-table-mobile":"container-grid-calendar-table"},containerbackground(){return this.elementSize.width<=680?"container-background-movil":"container-background"},containerdata(){return this.elementSize.width<=680?"container-data-movil":"container-data"}},watch:{games:{immediate:!0,deep:!0,async handler(s){if(s&&s.length>0){if(!this.seasonsSelected.length)return;for(let t=0;t<s.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===s[t].game_id);a!==-1&&(this.gamesAllStories[a].is_live=s[t].is_live,this.gamesAllStories[a].game_status=s[t].game_status)}const e=s.filter(t=>t.is_live);for(let t=0;t<e.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===e[t].game_id);if(a!==-1)this.gamesAllStories[a].score=e[t].score;else{this.gamesAllStories.push(e[t]),this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let i=[];for(let o=0;o<this.gamesAllStories.length;o++)this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)===-1?i.push({game_id:this.gamesAllStories[o].game_id,last_index:0,status:1}):i.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].status});this.arrayGamesAdd=i,await ve.post(bi,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let o=0;o<this.arrayGamesAdd.length;o++)this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].index=this.arrayGamesAdd[o].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].status_storie=this.arrayGamesAdd[o].status)}}}}},"allLiveGames.length":{handler(s){s.length===0&&this.resetGamesLiveInterval()}},privileges:{immediate:!0,deep:!0,async handler(s){this.is_public=s!==null}},team:{immediate:!0,deep:!0,async handler(s){s&&this.seasonsSelected.length&&setTimeout(()=>{this.fetchGames(s,this.seasonsSelected)},1e3)}},closestRound(s){this.selectedRoundKeyIndex=this.tournamentScheduleKeys.findIndex(e=>e===s),this.selectedRound=s},latestRound(s){this.selectedRoundKeyIndexVideo=this.tournamentScheduleKeysGoals.findIndex(e=>e===s),this.selectedRoundVideos=s},isCarouselFullScreenVisible:{handler(s){document.getElementsByTagName("html")[0].style.overflow=s?"hidden":"auto"},immediate:!0}},methods:{getOnlyGamesWithGoals(s){return Object.entries(s).reduce((e,[t,a])=>{const i=a.reduce((o,r)=>{const l=r.games.filter(d=>(d.is_live||d.game_status!==4)&&d.score[0]+d.score[1]>0);return l.length&&o.push({...r,games:l}),o},[]);return i.length&&(e[t]=i),e},{})},async onClickPlaySeeker(){try{const e=await(await fetch("https://rhev2kbe0a.execute-api.us-east-2.amazonaws.com/qa/demo/playseeker")).json();this.formatPlaySeekerPlays(e.data||PP)}catch(s){console.error(s)}},formatPlaySeekerPlays(s){let e=[];s&&s.playlist&&s.playlist.length&&(e=s.playlist.reduce((a,i,o)=>{const l={...Object.entries(Ft).reduce((f,[p,m])=>(f[p]=i[m],f),{}),isPlaySeeker:!0,startSeconds:i[Ft.startTime],endSeconds:i[Ft.endTime],totalSeconds:Math.floor(i[Ft.endTime]-i[Ft.startTime]),payloadData:{play_id:i[Ft.playId],total_plays:s.total_plays,play_number:o+1,group_playlist_id:s.group_playlist_id,playlist_id:s.playlist_id,group_id:s.group_id,moment_of_play:i[Ft.momentOfPlay],play_type:i[Ft.categoryId],viewer_second_start:Math.floor(i[Ft.startTime]),intended_second_start:Math.floor(i[Ft.startTime]),intended_second_end:Math.floor(i[Ft.endTime]),latitude_of_user:null,longitude_of_user:null}},[d,c]=l.playerName.split(","),h=d.split(" ");let u="";for(const f of h)if(u+=` ${f}`,f.length>3)break;if(l.playerShortName=c&&d?`${c.trim().charAt(0)}.${u}`:"",!l.mainCategoryName){const[f,p]=l.finalScore.split(" - ");l.arrayScore=[Number(f),Number(p)]}return l.categoryName=FP.get(l.categoryId),a.push(l),a},[]));let t=[];t=e,this.carouselPlayerQueue=t,this.isPlaySeeker=!0,this.isCarouselFullScreenVisible=!0},formatUsername(s){const e=s.split(",");let t="",a="";return e[1]?(a=e[1].trim().split(" "),a[0]?t=a[0]:t=e[1]):e[0]&&(a=e[0].trim().split(" "),a[0]?t=a[0]:t=e[0]),t.trim()},async fetchGameEvents(s){try{return(await ve.get(`${this.gameEventsUrl}${s}`,{headers:{Authorization:`${this.token}`}})).data}catch(e){throw new Error(e)}},async fetchLiveGames(){try{if(this.seasonsForLiveGames.length===0)return[];const s=this.seasonsForLiveGames.reduce((a,i)=>`${a}seasons=${i}&`,""),e=ve.create({headers:{Authorization:`${this.token}`}}),{data:t}=await e.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${s}`);return t}catch(s){throw new Error(s)}},async onClickOpenCarouselVideos(s){try{this.isPlaySeeker=!1;const t=(await this.fetchGameEvents(s)).plays;this.carouselPlayerQueue=t.filter(a=>a.event_type_id===1&&a.video_link!=="-"),this.isCarouselFullScreenVisible=!0}catch(e){throw new Error(e)}},onChangeMatchDayGames(s){this.selectedRound!==s.key&&(this.selectedRound=s.key)},onClickStory({item:s,index:e}){this.openStory(e),this.onClickStories(s)},onClickLive(){const s=this.allLiveGames[0];if(s){const e=this.seasonsGamesMap.get(s.game_id);e&&(this.selectedRound=e.roundAbbreviationV2)}},onClickCloseCarousel(){this.carouselPlayerQueue=[],this.isPlaySeeker=!1,this.isCarouselFullScreenVisible=!1},onChangeIsLeagueSelected(s){this.isLeagueSelected=s},onAction(s){this.$emit("action",s)},onOpenMedia(s){s.type===1&&s.gameIds&&s.gameIds.length>0?this.onClickOpenCarouselVideos(s.gameIds[0]):this.$emit("openmedia",s)},onOpenProfile(s){this.$emit("onOpenProfile",s)},onClickMatch(s){this.$emit("openGame",s)},onClickCalendar(){const s={type:this.isGenericLike||this.isLeagueSelected?0:1,team:this.team,season:this.seasonSelected.id};this.$emit("onClickMyCalendar",s)},moreTops(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openTops",s)},clickProfileBtn(s){this.$emit("openProfile",s)},viewAll(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openAllPlayers",s)},getTotalPlayers(s){this.playersLength=s},clickCard(s){const e={data:s,isPlayer:this.isplayer};this.$emit("clickOnMainCards",e)},async fetchGames(s,e){const t=e.map(i=>`seasons=${i.id}`).join("&"),a=ve.create({headers:{Authorization:`${this.token}`}});this.fullTournamentSchedule=await a.get(this.gamesUrl+s+"?"+t),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch&&(this.fullTournamentSchedule.data.prematch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.prematch.game_id)),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.postmatch&&(this.fullTournamentSchedule.data.postmatch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.postmatch.game_id)),this.nextRivalId=Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0,this.loadDiscover=!0},generateSeasons(s){const e=[{id:s.id,type:s.type}];return s.related_seasons&&s.related_seasons.length&&e.push(...s.related_seasons.map(t=>({id:t.id,type:t.type}))),e},async onInputTournament(s){this.tournamentSelected=s,this.tournamentType=s.tournament_type,this.tournamentSelected.id&&this.tournamentSelected.id!==s.id&&(this.updateTableCalendar+=1),this.tournamentSelectedDropDowns.id!==s.id&&(this.tournamentSelectedDropDowns=s)},getSeasonDependentPromises({season:s,seasons:e}){const t={headers:{Authorization:`${this.token}`}},a=[ve.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/seasons/${s.id}`,t)];a.push(this.fetchSeasonsGamesAndTeams(e.map(o=>o.id),3)),a.push(this.fetchStoriesPlays(s));const i=`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${s.id}/stories`;return i!==bi&&(bi=i,a.push(ve.get(bi,t))),a},async onInputSeason(s){try{if(this.seasonSelected.id!==s.id){this.isPreviousDataLoaded=!1,this.seasonSelected=s,this.seasonsSelected=this.generateSeasons(s);const e=this.getSeasonDependentPromises({season:s,seasons:this.seasonsSelected,retries:3,createdUrl:""}),[t,a,i,o]=await Promise.all(e);this.seasonPlayersMap=new Map,t.data&&t.data.players&&t.data.players.forEach(r=>{this.seasonPlayersMap.set(r.player_id,r)}),o&&o.data?this.arrayGamesAdd=o.data.stories.stories:this.arrayGamesAdd=[],this.resetGamesLiveInterval(),this.seasonSelected=s,this.show_stories=!!s.show_stories,this.seasonsForLiveGames=[s.id,...s.related_seasons.map(r=>r.id)],this.$emit("change-season-id",s.id),this.fillStoriesData(i,a.seasonsAndGames),await this.createFullTournamentScheme({seasons:this.seasonsSelected,seasonsAndGames:a.seasonsAndGames,seasonsAndTeams:a.seasonsAndTeams,applySeasonsValidation:!1}),this.team&&await this.fetchGames(this.team,this.seasonsSelected),this.keyupdate+=1}}catch(e){throw new Error(e)}},ordenarYFiltrarPartidos(s){const e=s.filter(t=>t.game_status===1||t.is_live==1||t.game_status==0);return e.sort((t,a)=>new Date(a.date_time_utc)-new Date(t.date_time_utc)),e.slice(0,18)},async fetchSeasonsGamesAndTeams(s,e,t=""){let a=t;try{const i=ve.create({headers:{Authorization:`${this.token}`}});a||(a=this.gamesUrl2,s.forEach((l,d)=>{a+=`${d===0?"":"&"}seasons=${l}`}));const{data:{data:o,teams:r}}=await i.get(a);return{seasonsAndGames:o,seasonsAndTeams:r}}catch(i){if(e>0)return this.fetchSeasonsGamesAndTeams(s,e-1,a);throw new Error(i)}},async fetchStoriesPlays(s){try{return await ve.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/videos/plays/seasons/"+s.id+"?categories=607&categories=608&categories=12&categories=55&categories=54&categories=35&categories=15&categories=53&type=1")}catch(e){throw new Error(e)}},fillStoriesData(s,e){let t=s.data?s.data.plays:[];this.gamesAllStories=[];for(let i=0;i<e.length;i++)this.gamesAllStories=this.gamesAllStories.concat(e[i].games);this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let a=[];for(let i=0;i<this.gamesAllStories.length;i++)this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)===-1?a.push({game_id:this.gamesAllStories[i].game_id,last_index:0,status:1}):a.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].status});this.arrayGamesAdd=a;for(let i=0;i<this.arrayGamesAdd.length;i++)this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].index=this.arrayGamesAdd[i].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].status_storie=this.arrayGamesAdd[i].status);this.storiesItems=this.getStoriesStructureVideos(t),setTimeout(()=>{this.sendStoriesData()},1e3)},sendStoriesData(){ve.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}})},getTimeSeconds(s){const[e,t]=s.split(":"),[a,i]=t.split(".");return parseInt(e)*60+parseInt(a)+parseInt(i)/1e3},getPlayTime(s,e){let t="",a=0;switch(s[7]){case 1:t=s[11];break;case 2:t=s[13],a=45;break;case 3:t=s[15],a=90;break;case 4:t=s[17],a=105;break;case 5:t=s[19],a=120;break}return(!t||t==="0")&&(t="00:00"),this.getTimeToSeconds(t)+(this.getTimeToSeconds(s[e])-a*60)},abrirNuevaVentana(){window.open("https://goltipster.com/view-all#golTipster","_blank")},getTimeToSeconds(s){const t=s.indexOf(".")>-1?s.substring(0,s.indexOf(".")):s,[a,i,o]=t.split(":").reverse();return(o?Number(o)*60*60:0)+Number(i)*60+Number(a)},getStoriesStructureVideos(s){let e=[];for(let t=0;t<this.gamesAllStories.length;t++){let a=s.filter(r=>r[3]===this.gamesAllStories[t].game_id).map(r=>({playId:r[29],gameId:r[3],player:this.seasonPlayersMap.get(r[1]),categoryId:r[0],date:new Date(r[4]),url:r[35]==2?"https://daijvvc13prpy.cloudfront.net/golstats-videos/"+this.gamesAllStories[t].game_id+"_1/"+this.gamesAllStories[t].game_id+"_1.m3u8":"https://golstatsbets.blob.core.windows.net/video-player/"+this.gamesAllStories[t].game_id+"_1.mp4",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].visiting_team+".png"},header:{label:this.gamesAllStories[t].home_team_acronym+" "+this.gamesAllStories[t].score[0]+":"+this.gamesAllStories[t].score[1]+" "+this.gamesAllStories[t].visiting_team_acronym+" "+this.gamesAllStories[t].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(r,9),endTime:this.getPlayTime(r,10),duration:Math.floor(this.getTimeSeconds(r[10])-this.getTimeSeconds(r[9]))}));const i={},o=a.filter(r=>i[r.playId]?!1:(i[r.playId]=!0,!0));e.push({game_id:this.gamesAllStories[t].game_id,stories:o})}return e},areSeasonsDifferent(s){for(const e of s)if(!this.lastSeasonsIds.includes(e.season_id))return!0;return!1},async createFullTournamentScheme({seasons:s,seasonsAndGames:e,seasonsAndTeams:t,applySeasonsValidation:a}){try{this.seasonsGamesMap=new Map,this.userTeamGames=[],this.userTeamGamesForVideos=[],this.gamesOfTheDayPreMatchIds.clear();let i=0;if(a&&this.areSeasonsDifferent(e))return;e.forEach(l=>{const d=s.find(c=>c.id===l.season_id);d&&(l.type=d.type,l.games.forEach(c=>{c.season_id=l.season_id}),d.type===0&&(i=l.season_id))});const o={seasonsGames:e},r=t.find(l=>l.season_id===i);if(r){const l=r.teams,d=[...o.seasonsGames],c=o&&o.seasonsGames?o.seasonsGames.map(u=>{const f=u.games.reduce((p,m)=>{const g={...m},y=new Date,[b,S,_]=g.date.split("-"),[C,T,v]=g.schedule.split(":"),E=new Date(Number(b),Number(S)-1,Number(_),Number(C),Number(T),Number(v));return g.dateTimeMillis=E.valueOf(),g.home_team=l.find(N=>N.team_id===m.home_team),g.visiting_team=l.find(N=>N.team_id===m.visiting_team),g.game_status===4&&y.getFullYear()===E.getFullYear()&&y.getMonth()===E.getMonth()&&y.getDate()===E.getDate()&&this.gamesOfTheDayPreMatchIds.add(g.game_id),this.seasonsGamesMap.set(g.game_id,g),p[m.matchday_abbreviation]?p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(g):p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[g]:p[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[g]},this.gsData&&this.gsData.teamId&&g.game_status===4&&(g.home_team.team_id===this.gsData.teamId||g.visiting_team.team_id===this.gsData.teamId)&&(this.userTeamGames.push(g),g.score&&g.score[0]+g.score[1]>0&&this.userTeamGamesForVideos.push(g)),p},{});this.userTeamGames.sort((p,m)=>p.dateTimeMillis-m.dateTimeMillis);for(let[p,m]of Object.entries(f))f[p]=Object.entries(m).map(([g,y])=>({date:g,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[p].sort((g,y)=>g.date<y.date?-1:g.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[],h=o&&o.seasonsGames?d.map(u=>{const f=u.games.reduce((p,m)=>{const g={...m};return g.dateTimeMillis=new Date(g.date_time_utc).valueOf(),g.home_team=l.find(y=>y.team_id===m.home_team),g.visiting_team=l.find(y=>y.team_id===m.visiting_team),p[m.matchday_abbreviation]?p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?(g.game_status!=4||g.is_live==1)&&(g.score[0]!=0||g.score[1]!=0)&&p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(g):(g.game_status!=4||g.is_live==1)&&(g.score[0]!=0||g.score[1]!=0)&&(p[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[g]):(g.game_status!=4||g.is_live==1)&&(g.score[0]!=0||g.score[1]!=0)&&(p[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[g]}),p},{});this.userTeamGames.sort((p,m)=>p.dateTimeMillis-m.dateTimeMillis);for(let[p,m]of Object.entries(f))f[p]=Object.entries(m).map(([g,y])=>({date:g,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[p].sort((g,y)=>g.date<y.date?-1:g.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[];c.sort((u,f)=>u.weight-f.weight),this.fullTournamentScheduleFull=c.reduce((u,f)=>{for(const[p,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const g=Mu.get(this.tournamentType);if(g){const y=g.get(p);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const g=p.replace("M",""),y=`Jornada ${g}`;this.isCupLegacy?u[Fu[g]||y]=m:u[Ou[p]||y]=m}else u[Number(p.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(p)?u[p]=m:u[`R${Number(p.replace("PO",""))}`]=m:f.type===1&&(u[Pu[p]]=m);return u},{}),this.fullTournamentScheduleFullGoals=h.reduce((u,f)=>{for(const[p,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const g=Mu.get(this.tournamentType);if(g){const y=g.get(p);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const g=p.replace("M",""),y=`Jornada ${g}`;this.isCupLegacy?u[Fu[g]||y]=m:u[Ou[p]||y]=[]}else u[Number(p.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(p)?u[p]=m:u[`R${Number(p.replace("PO",""))}`]=m:f.type===1&&(u[Pu[p]]=m);return u},{}),this.roundAbbreviationByGameId=new Map,this.tournamentScheduleKeys=Array.from(Object.entries(this.fullTournamentScheduleFull).reduce((u,[f,p])=>{const m=Number(f);let g="";Number.isNaN(m)?g=f:g=m<10?`0${m}`:f;let y=!1,b=null;const S=p.reduce((C,T)=>(!b&&T&&T.games&&T.games.length&&(b=T.games[0].matchday_id),T.games.forEach(v=>{this.roundAbbreviationByGameId.set(v.game_id,f),v.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`,v.roundAbbreviationV2=f}),C=C.concat(T.games),C),[]);for(let C=0;C<S.length;C++)(S[C].game_status!=4||S[C].is_live)&&(S[C].score[0]!=0||S[C].score[1]!=0)&&(y=!0);u.set(f,{key:f,value:m,valueText:g,avaible:y,matchDayId:b});const _=this.getPages(S);return this.gamesPages.set(f,_),u},new Map).values()),this.tournamentScheduleKeysGoals=Array.from(Object.entries(this.fullTournamentScheduleFullGoals).reduce((u,[f,p])=>{const m=Number(f);let g="";Number.isNaN(m)?g=f:g=m<10?`0${m}`:f;let y=!1;const b=p.reduce((S,_)=>(_.games.forEach(C=>{C.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`}),S=S.concat(_.games),S),[]);for(let S=0;S<b.length;S++)(b[S].game_status!=4||b[S].is_live&&(b[S].score[0]!=0||b[S].score[1]!=0))&&(y=!0);return u.set(f,{key:f,value:m,valueText:g,avaible:y}),u},new Map).values())}setTimeout(()=>{this.isPreviousDataLoaded=!0,this.checkLiveGames(),this.gamesOfTheDayPreMatchIds.size&&this.createGameOfTheDayTimeouts()},500)}catch(i){throw new Error(i)}finally{this.loadingFlag=!1}},createGameOfTheDayTimeouts(){this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.forEach(s=>{const e=this.seasonsGamesMap.get(s);if(e){const t=new Date().valueOf();if(60*1e3*30+e.dateTimeMillis-t>0){const i=e.dateTimeMillis-t-3e5;setTimeout(()=>{this.createCheckLiveGamesInterval()},i>0?i:0)}}})},resetCheckGamesLiveInterval(){clearInterval(yi),yi=null},createCheckLiveGamesInterval(){this.resetCheckGamesLiveInterval(),yi||(yi=setInterval(()=>{this.checkLiveGames()},this.checkLiveGamesIntervalMinutes*60*1e3))},async checkLiveGames(){try{const s=await this.fetchLiveGames(),e=new Set;if(this.allLiveGames=s.data.reduce((t,a)=>(a.games.forEach(i=>{e.add(i.game_id),t.push(i)}),t),[]),this.allLiveGames.length){xa||await this.fillGameEvents();const t=[];this.gamesOfTheDayPreMatchIds.forEach(a=>{const i=this.seasonsGamesMap.get(a);i&&new Date().valueOf()>i.dateTimeMillis&&t.push(a)}),t.length&&t.every(i=>this.seasonsGamesMap.get(i).isLiveTracked)&&this.resetCheckGamesLiveInterval()}}catch(s){throw new Error(s)}},createGamesEventsInterval(){this.resetGamesLiveInterval(),xa=setInterval(()=>{this.fillGameEvents()},6e4)},resetGamesLiveInterval(){clearInterval(xa),xa=null},removeGameIfFinished(s,e,t=!1){for(const a of e)if(a.category_id===0&&a.game_status_id===13)if(t)this.fetchGames(this.team,this.seasonsSelected);else{const i=this.seasonsGamesMap.get(a.game_id);this.allLiveGames=this.allLiveGames.filter(o=>o.game_id!==s.game_id),i.is_live=0,i.game_status=0}},async fillGameEvents(){try{const s=[];let e=null;for(const a of this.allLiveGames){a.isLiveTracked=!0,this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.delete(a.game_id);const i=this.seasonsGamesMap.get(a.game_id);i&&(i.is_live=1,i.game_status=4),e=this.fullTournamentSchedule&&this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch?this.fullTournamentSchedule.data.prematch:null,e&&e.game_id===a.game_id&&(e.is_live=1,e.game_status=4),s.push(this.fetchGameEvents(a.game_id))}const t=await Promise.all(s);for(const a of t){const i=this.seasonsGamesMap.get(a.game_id);if(i){const o=OP.get(a.recent_lapse);i.currentTimeLive=o&&o<a.minute?`${o}' + ${a.minute-o}'`:`${a.minute}'`;const r=[Number(a.score[i.home_team.team_id.toString()])+Number(a.score[`own_${i.visiting_team.team_id.toString()}`]),Number(a.score[i.visiting_team.team_id.toString()])+Number(a.score[`own_${i.home_team.team_id.toString()}`])],l=r[0],d=r[1];i.score=[Number.isNaN(l)?0:l,Number.isNaN(d)?0:d],this.removeGameIfFinished(i,a.plays),e&&e.game_id===i.game_id&&(e.currentTimeLive=i.currentTimeLive,e.score=i.score,this.removeGameIfFinished(e,a.plays,!0))}}xa||this.createGamesEventsInterval()}catch(s){throw new Error(s)}},getPages(s){const e=[];if(this.gamesPerMatchDay>0){let t=[];s.forEach((a,i)=>{t.push(a),(i+1)%this.gamesPerMatchDay===0&&(e.push([...t]),t=[])}),t.length&&e.push([...t])}else e.push(s);return e},getNormalClosestRound(s,e=!1){const a=e?this.getOnlyGamesWithGoals(s):s,i=Object.entries(Object.entries(a).reduce((l,[d,c])=>(l[d]=[],c.forEach(h=>{h.games.forEach(u=>{const f=new Date(u.date_time_utc).getTime()+66e5;l[d].push(f)})}),l),{}));if(!i.length)return"1";const o=new Date().getTime(),r=i.reduce((l,[d,c])=>{let h=null;return c.forEach(u=>{const f=e?o-u:u-o;f>=0&&(h===null||f<h)&&(h=f)}),h&&(l.shortestTime===null||h<l.shortestTime)&&(l.round=d,l.shortestTime=h),l},{round:"",shortestTime:null});return r.shortestTime!==null?r.round:i[i.length-1][0]},getUserTeamClosestRound(s,e=!1){let t=1;const a=e?this.userTeamGamesForVideos:this.userTeamGames;if(a.length){const i=a[0];for(const[o,r]of Object.entries(s))for(const l of r)if(l.games.find(c=>c.game_id===i.game_id))return o}return t},async changeIndexStory(s){if(this.arrayGamesAdd.length>0){let e=-1,t=-1,a=-1;this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(e=this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(t=this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(a=this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)),e!=-1&&(this.gamesAllStories[t].is_live===1?this.storiesItems[a].stories.length-1==s&&this.storiesItems[a].stories.length>1?this.arrayGamesAdd[e].last_index=s-1:this.arrayGamesAdd[e].last_index=s:this.arrayGamesAdd[e].last_index=s),a!=-1&&this.arrayGamesAdd[e].status>0&&(this.arrayGamesAdd[e].status=s>=this.storiesItems[a].stories.length-1?0:1)}else{this.arrayGamesAdd=[];for(let e=0;e<this.storiesItems.length;e++)this.arrayGamesAdd.push({game_id:this.storiesItems[e].game_id,last_index:this.currentStories[0].gameId==this.storiesItems[e].game_id?s:0,status:this.currentStories[0].gameId==this.storiesItems[e].game_id&&s>=this.storiesItems[e].stories.length-1?0:1})}await ve.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let e=0;e<this.arrayGamesAdd.length;e++)this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)!=-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].index=this.arrayGamesAdd[e].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].status_storie=this.arrayGamesAdd[e].status)},async getLiveGamePlays(s){var a=(await ve.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/live/videos/plays/seasons/"+this.gamesAllStories[s].season_id+"/games/"+this.gamesAllStories[s].game_id)).data.plays.filter(l=>l[0]===607||l[0]===608||l[0]===12||l[0]===55||l[0]===54||l[0]===35||l[0]===15||l[0]===53);let i=a.map(l=>({playId:l[29],gameId:l[3],player:this.seasonPlayersMap.get(l[1]),categoryId:l[0],date:new Date(l[4]),url:"https://falconvideolive.blob.core.windows.net/video-hls-live/"+this.gamesAllStories[s].game_id+"/"+this.gamesAllStories[s].game_id+".m3u8",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].visiting_team+".png"},header:{label:this.gamesAllStories[s].home_team_acronym+" "+this.gamesAllStories[s].score[0]+":"+this.gamesAllStories[s].score[1]+" "+this.gamesAllStories[s].visiting_team_acronym+" "+this.gamesAllStories[s].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(l,9),endTime:this.getPlayTime(l,10),duration:Math.floor(this.getTimeSeconds(l[10])-this.getTimeSeconds(l[9]))}));const o={},r=i.filter(l=>o[l.playId]?!1:(o[l.playId]=!0,!0));this.storiesItems[s]={game_id:this.gamesAllStories[s].game_id,stories:r}},async openStory(s){const e={headers:{Authorization:`${this.token}`}},[t]=await Promise.all([ve.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/games/${this.gamesAllStories[s].game_id}`,e)]);t.data&&t.data.players.forEach(a=>{this.seasonPlayersMap.set(a.player_id,{dob:a.dob,first_name:a.first_name,jersey:a.jersey,last_name:a.last_name,name:a.name,player_name:a.name,nationality:a.nationality,nationality_id:a.nationality_id,nationality_photo:a.nationality_photo,photo:a.photo,player_id:a.player_id,position_id:a.position_id,short_name:a.short_name,team_id:a.team_id})}),this.gamesAllStories[s].is_live==1||this.gamesAllStories[s].game_status==0?(await this.getLiveGamePlays(s),setTimeout(()=>{this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index},100)):(this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index),setTimeout(()=>{this.isStoriesVisible=!0},150)},onCloseStories(s){this.currentStoriesLastIndex=0,this.isStoriesVisible=!1,this.$emit("event-posthog-stories",{event:"stories_cerrar",properties:{play_id:s?s.playId:null,game_id:s?s.gameId:null,category_id:s?s.categoryId:null,start_time:s?s.startTime:null,end_time:s?parseInt(s.currentTime):null,percentage_viewed:s?parseInt(s.progress):null}})},closeStories(){this.currentStoriesLastIndex=0,this.currentStoryIndex=null,this.currentStories=[]},onSwipeStories({direction:s,currentPlay:e}){s==="right"?(this.$emit("event-posthog-stories",{event:"stories_video_siguiente_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex>0&&this.openStory(this.currentStoryIndex-1)):(this.$emit("event-posthog-stories",{event:"stories_video_anterior_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex<this.storiesItems.length-1&&this.openStory(this.currentStoryIndex+1))},onClickNextBackVideo({eventName:s,currentPlay:e}){this.$emit("event-posthog-stories",{event:s,properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}})},onChangeTournaments(s){this.currentTournaments=s},onClickStories(s){this.$emit("event-posthog-stories",{event:"stories_ver_play",properties:{game_id:s.game_id}})},onVideoPlay(s){this.$emit("event-posthog-stories",{event:"stories_play",properties:{play_id:s.playId,game_id:s.gameId,category_id:s.categoryId,start_time:s.startTime,end_time:s.endTime,percentage_viewed:0}})}},async created(){},beforeUnmount(){this.resetGamesLiveInterval()}},Si=s=>(n.pushScopeId("data-v-4d09d44a"),s=s(),n.popScopeId(),s),$P={class:"gsclanding",ref:"landingref"},VP={key:2,class:"play-seeker-image"},UP={class:"play-seeker-image__info"},zP=Si(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),GP={class:"play-seeker-image__info__legends-and-button"},jP=Si(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),HP={class:"play-icon"},WP=["src"],KP=Si(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),qP={class:"play-seeker-image__players"},YP=["src"],JP={key:3,class:"container-selectors-mobile"},XP={class:"container-selectors-mobile-tournament"},ZP={class:"container-selectors-mobile-season"},QP={key:0,class:"home-item-movil"},eO=Si(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),tO={class:"name-user-movil"},sO={key:1,class:"home-item"},aO={key:2,class:"bar-settings"},nO={class:"name-user"},iO={class:"container-selectors"},oO={class:"selector-tournament"},rO={class:"selector-seasons"},lO={key:3,class:"stories-circle-wrapper"},cO=["onClick"],dO={class:"story-result"},hO={key:0,class:"font-bold"},uO={key:1,class:"font-bold"},mO={class:"story-match"},fO={key:4,class:"container-games"},pO={key:5,class:"container-vr"},gO={key:6,class:"container-players"},yO={class:"container-tops"};function bO(s,e,t,a,i,o){const r=n.resolveComponent("Stories"),l=n.resolveComponent("CarouselFullScreen"),d=n.resolveComponent("GSCTournamentSelect"),c=n.resolveComponent("GSCSeasonSelect"),h=n.resolveComponent("GSCSlider"),u=n.resolveComponent("GSCGames"),f=n.resolveComponent("DiscoverVideos"),p=n.resolveComponent("GSCGridTeamsMatches"),m=n.resolveComponent("GSCTableCalendar"),g=n.resolveComponent("GSCPlayersLanding"),y=n.resolveComponent("GSCTops");return n.openBlock(),n.createElementBlock("div",$P,[i.isStoriesVisible&&t.showStories?(n.openBlock(),n.createBlock(r,{key:0,stories:i.currentStories,"start-story-index":i.currentStoriesLastIndex,"is-first-game-stories":i.currentStoryIndex===0,"is-last-game-stories":i.currentStoryIndex===i.storiesItems.length-1,onLastStoryIndex:o.changeIndexStory,onClose:o.onCloseStories,onSwipe:o.onSwipeStories,onVideoNextBack:o.onClickNextBackVideo,onVideoPlay:o.onVideoPlay},null,8,["stories","start-story-index","is-first-game-stories","is-last-game-stories","onLastStoryIndex","onClose","onSwipe","onVideoNextBack","onVideoPlay"])):n.createCommentVNode("",!0),i.isCarouselFullScreenVisible?(n.openBlock(),n.createBlock(l,{key:1,"player-queue":i.carouselPlayerQueue,"is-play-seeker":i.isPlaySeeker,"playlist-index":0,onClose:o.onClickCloseCarousel},null,8,["player-queue","is-play-seeker","onClose"])):n.createCommentVNode("",!0),o.isPlaySeekerAvailable?(n.openBlock(),n.createElementBlock("div",VP,[n.createElementVNode("div",UP,[zP,n.createElementVNode("div",GP,[jP,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[0]||(e[0]=(...b)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...b))},[n.createElementVNode("div",HP,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,WP)]),KP])])]),n.createElementVNode("div",qP,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,YP)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",JP,[n.createElementVNode("div",XP,[n.createVNode(d,{"current-season-id":t.currentSeasonId,width:"100%","api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",ZP,[n.createVNode(c,{"current-season-id":t.currentSeasonId,width:"100%",seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerbackground)},[n.createElementVNode("div",{class:n.normalizeClass(o.containerdata)},[a.elementSize.width<=680?(n.openBlock(),n.createElementBlock("div",QP,[eO,n.createElementVNode("div",tO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))])])):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",sO,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",aO,[n.createElementVNode("div",nO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))]),n.createElementVNode("div",iO,[n.createElementVNode("div",oO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,"api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",rO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])])):n.createCommentVNode("",!0),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",lO,[(n.openBlock(),n.createBlock(h,{key:i.keyupdate,height:"130px",pxScroll:86,scrollColor:"none",arrowsPosition:"absolute","background-color":"none",arrowsScrollHide:!0,arrowsHideOnNoScroll:!0,arrowsBackground:"rgba(255,255,255,.16)",arrowsContainerBgL:"linear-gradient(270deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsContainerBgR:"linear-gradient(90deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsMargin:0,arrowsRadius:"50%",arrowsBorder:"#ddd"},{default:n.withCtx(()=>[n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.gamesAllStories,(b,S)=>(n.openBlock(),n.createElementBlock("div",{key:S,class:"story-container-game",onClick:_=>o.onClickStory({item:b,index:S})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(b.is_live==1?(b.status_storie==1,"border: 2px solid #cbee6b !important;"):b.status_storie==1?"border: 2px solid #2248a2 !important;":"border: 2px solid #41485B !important;")},[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+b.home_team+".png)")},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+b.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",dO,[n.createTextVNode(n.toDisplayString(b.home_team_acronym)+" ",1),b.score.length>0?(n.openBlock(),n.createElementBlock("span",hO,n.toDisplayString(isNaN(b.score[0])?0:b.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),b.score.length>0?(n.openBlock(),n.createElementBlock("span",uO,n.toDisplayString(isNaN(b.score[1])?0:b.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(b.visiting_team_acronym),1)]),n.createElementVNode("div",mO,n.toDisplayString(b.matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")),1)],8,cO))),128))]),_:1}))])):n.createCommentVNode("",!0),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",fO,[n.createVNode(u,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0),!i.is_public&&i.isPreviousDataLoaded?(n.openBlock(),n.createElementBlock("div",pO,[n.createVNode(f,{"component-width":a.elementSize&&a.elementSize.width?a.elementSize.width:0,videoType:o.isGenericLike?i.goalsType:i.resumeType,team:t.team,player:t.user.player,isplayer:t.isplayer,"is-full":o.isGenericLike==1,"is-league-selected":o.isGenericLike==1,nextRivalTeam:o.isGenericLike||!i.nextRivalId?{id:0}:{id:i.nextRivalId},user:t.user,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":o.closestRoundVideos,seasonSelected:i.seasonSelected,tournamentSelected:i.tournamentSelected,myTournament:t.user.tournament,"default-media-player-season":t.defaultMediaPlayerSeason,onOpenmedia:o.onOpenMedia},null,8,["component-width","videoType","team","player","isplayer","is-full","is-league-selected","nextRivalTeam","user","tournament-schedule-keys","default-match-day-key","seasonSelected","tournamentSelected","myTournament","default-media-player-season","onOpenmedia"])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle(a.elementSize.width<748?"width: 100%":"")},[n.createVNode(p,{isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])],4),n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",gO,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:0,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAll,onTotalPlayers:o.getTotalPlayers,"team-id":t.user.team,"season-id":i.seasonSelected.id,"is-player":!!t.user.player},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id","is-player"])):n.createCommentVNode("",!0)],512)),[[n.vShow,i.playersLength>0]]),n.createElementVNode("div",yO,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(y,{key:0,"tournament-selected":i.tournamentSelected,onMore:o.moreTops,"show-switch":!o.isGenericLike,season:i.seasonSelected.id,"show-more":!i.is_public,"team-id":t.user.team,"active-videos":i.is_public?t.privileges.vr_privileges:!0,onOpenmedia:o.onOpenMedia},null,8,["tournament-selected","onMore","show-switch","season","show-more","team-id","active-videos","onOpenmedia"])):n.createCommentVNode("",!0)]),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:7,class:"b2c-image",onClick:e[1]||(e[1]=(...b)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...b))})):n.createCommentVNode("",!0)],2)],2)],512)}const SO=qe(MP,[["render",bO],["__scopeId","data-v-4d09d44a"]]);hs.GSCLanding=SO,Object.defineProperty(hs,Symbol.toStringTag,{value:"Module"})});
|