@golstats/gsc-landing 1.0.175 → 1.0.176
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 -2
- package/dist/gsc-landing.umd.cjs +6 -6
- 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 He={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:He.itemsToShow,type:Number},itemsToScroll:{default:He.itemsToScroll,type:Number},wrapAround:{default:He.wrapAround,type:Boolean},throttle:{default:He.throttle,type:Number},snapAlign:{default:He.snapAlign,validator(s){return["start","end","center","center-even","center-odd"].includes(s)}},transition:{default:He.transition,type:Number},breakpoints:{default:He.breakpoints,type:Object},autoplay:{default:He.autoplay,type:Number},pauseAutoplayOnHover:{default:He.pauseAutoplayOnHover,type:Boolean},modelValue:{default:void 0,type:Number},mouseDrag:{default:He.mouseDrag,type:Boolean},touchDrag:{default:He.touchDrag,type:Boolean},dir:{default:He.dir,validator(s){return["rtl","ltr"].includes(s)}},i18n:{default:He.i18n,type:Object},settings:{default(){return{}},type:Object}};function Mk({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 Vk({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 Mo({val:s,max:e,min:t}){return e<t?s:Math.min(Math.max(s,t),e)}function $k({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:Mo({val:r,max:t-o,min:0})}function Bh(s){return s?s.reduce((e,t)=>{var a;return t.type===n.Fragment?[...e,...Bh(t.children)]:((a=t.type)===null||a===void 0?void 0:a.name)==="CarouselSlide"?[...e,t]:e},[]):[]}function Vo({val:s,max:e,min:t=0}){return s>e?Vo({val:s-(e+1),max:e,min:t}):s<t?Vo({val:s+(e+1),max:e,min:t}):s}function zk(s,e){let t;return e?function(...a){const i=this;t||(s.apply(i,a),t=!0,setTimeout(()=>t=!1,e))}:s}function Uk(s,e){let t;return function(...a){t&&clearTimeout(t),t=setTimeout(()=>{s(...a),t=null},e)}}function Gk(s="",e={}){return Object.entries(e).reduce((t,[a,i])=>t.replace(`{${a}}`,String(i)),s)}var jk=n.defineComponent({name:"ARIA",setup(){const s=n.inject("config",n.reactive(Object.assign({},He))),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"},Gk(s.i18n.itemXofY,{currentSlide:e.value+1,slidesCount:t.value}))}}),Hk=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({},He));let h=Object.assign({},He),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 w(){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 x(){if(!u||!Object.keys(u).length)return;const C=Object.keys(u).map(U=>Number(U)).sort((U,me)=>+me-+U);let W=Object.assign({},h);C.some(U=>{const me=window.matchMedia(`(min-width: ${U}px)`).matches;return me&&(W=Object.assign(Object.assign({},W),u[U])),me}),T(W)}function T(C){Object.entries(C).forEach(([W,U])=>c[W]=U)}const v=Uk(()=>{x(),B(),E()},16);function E(){if(!o.value)return;const C=o.value.getBoundingClientRect();l.value=C.width/c.itemsToShow}function B(){d.value<=0||(m.value=Math.ceil((d.value-1)/2),g.value=Mk({config:c,slidesCount:d.value}),y.value=Vk({config:c,slidesCount:d.value}),c.wrapAround||(f.value=Mo({val:f.value,max:g.value,min:y.value})))}n.onMounted(()=>{n.nextTick(()=>E()),setTimeout(()=>E(),1e3),x(),q(),window.addEventListener("resize",v,{passive:!0}),t("init")}),n.onUnmounted(()=>{S&&clearTimeout(S),b&&clearInterval(b),window.removeEventListener("resize",v,{passive:!0})});let I=!1;const R={x:0,y:0},M={x:0,y:0},K=n.reactive({x:0,y:0}),H=n.ref(!1),se=n.ref(!1),oe=()=>{H.value=!0},ne=()=>{H.value=!1};function ce(C){["INPUT","TEXTAREA","SELECT"].includes(C.target.tagName)||(I=C.type==="touchstart",I||C.preventDefault(),!(!I&&C.button!==0||J.value)&&(R.x=I?C.touches[0].clientX:C.clientX,R.y=I?C.touches[0].clientY:C.clientY,document.addEventListener(I?"touchmove":"mousemove",de,!0),document.addEventListener(I?"touchend":"mouseup",Z,!0)))}const de=zk(C=>{se.value=!0,M.x=I?C.touches[0].clientX:C.clientX,M.y=I?C.touches[0].clientY:C.clientY;const W=M.x-R.x,U=M.y-R.y;K.y=U,K.x=W},c.throttle);function Z(){const C=c.dir==="rtl"?-1:1,W=Math.sign(K.x)*.4,U=Math.round(K.x/l.value+W)*C;if(U&&!I){const me=j=>{window.removeEventListener("click",me,!0)};window.addEventListener("click",me,!0)}X(f.value-U),K.x=0,K.y=0,se.value=!1,document.removeEventListener(I?"touchmove":"mousemove",de,!0),document.removeEventListener(I?"touchend":"mouseup",Z,!0)}function q(){!c.autoplay||c.autoplay<=0||(b=setInterval(()=>{c.pauseAutoplayOnHover&&H.value||ue()},c.autoplay))}function he(){b&&(clearInterval(b),b=null),q()}const J=n.ref(!1);function X(C){const W=c.wrapAround?C:Mo({val:C,max:g.value,min:y.value});f.value===W||J.value||(t("slide-start",{slidingToIndex:C,currentSlideIndex:f.value,prevSlideIndex:p.value,slidesCount:d.value}),J.value=!0,p.value=f.value,f.value=W,S=setTimeout(()=>{if(c.wrapAround){const U=Vo({val:W,max:g.value,min:0});U!==f.value&&(f.value=U,t("loop",{currentSlideIndex:f.value,slidingToIndex:C}))}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(){X(f.value+c.itemsToScroll)}function be(){X(f.value-c.itemsToScroll)}const xe={slideTo:X,next:ue,prev:be};n.provide("nav",xe),n.provide("isSliding",J);const te=n.computed(()=>$k({config:c,currentSlide:f.value,slidesCount:d.value}));n.provide("slidesToScroll",te);const Te=n.computed(()=>{const C=c.dir==="rtl"?-1:1,W=te.value*l.value*C;return{transform:`translateX(${K.x-W}px)`,transition:`${J.value?c.transition:0}ms`,margin:c.wrapAround?`0 -${d.value*l.value}px`:"",width:"100%"}});function Ce(){w(),x(),B(),E(),he()}Object.keys(Rh).forEach(C=>{["modelValue"].includes(C)||n.watch(()=>s[C],Ce)}),n.watch(()=>s.modelValue,C=>{C!==f.value&&X(Number(C))}),n.watch(d,B),t("before-init"),w();const Oe={config:c,slidesCount:d,slideWidth:l,next:ue,prev:be,slideTo:X,currentSlide:f,maxSlide:g,minSlide:y,middleSlide:m};a({updateBreakpointsConfigs:x,updateSlidesData:B,updateSlideWidth:E,initDefaultConfigs:w,restartCarousel:Ce,slideTo:X,next:ue,prev:be,nav:xe,data:Oe});const ot=e.default||e.slides,tt=e.addons,ct=n.reactive(Oe);return()=>{const C=Bh(ot==null?void 0:ot(ct)),W=(tt==null?void 0:tt(ct))||[];C.forEach((Y,G)=>Y.props.index=G);let U=C;if(c.wrapAround){const Y=C.map(($,z)=>n.cloneVNode($,{index:-C.length+z,isClone:!0,key:`clone-before-${z}`})),G=C.map(($,z)=>n.cloneVNode($,{index:C.length+z,isClone:!0,key:`clone-after-${z}`}));U=[...Y,...C,...G]}r.value=C,d.value=Math.max(C.length,1);const me=n.h("ol",{class:"carousel__track",style:Te.value,onMousedownCapture:c.mouseDrag?ce:null,onTouchstartPassiveCapture:c.touchDrag?ce:null},U),j=n.h("div",{class:"carousel__viewport"},me);return n.h("section",{ref:o,class:{carousel:!0,"is-sliding":J.value,"is-dragging":se.value,"is-hover":H.value,"carousel--rtl":c.dir==="rtl"},dir:c.dir,"aria-label":c.i18n.ariaGallery,tabindex:"0",onMouseenter:oe,onMouseleave:ne},[j,W,n.h(jk)])}}}),$o;(function(s){s.arrowUp="arrowUp",s.arrowDown="arrowDown",s.arrowRight="arrowRight",s.arrowLeft="arrowLeft"})($o||($o={}));const Wk={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 Kk(s){return s in $o}const zo=s=>{const e=n.inject("config",n.reactive(Object.assign({},He))),t=String(s.name),a=`icon${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!t||typeof t!="string"||!Kk(t))return;const i=Wk[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])};zo.props={name:String,title:String};const qk=(s,{slots:e,attrs:t})=>{const{next:a,prev:i}=e||{},o=n.inject("config",n.reactive(Object.assign({},He))),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(zo,{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(zo,{name:p?"arrowLeft":"arrowRight"}));return[m,g]};var Yk=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({},He))),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 It=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t},Nh=s=>(n.pushScopeId("data-v-15f082dd"),s=s(),n.popScopeId(),s),Jk={key:1,class:"match-day__live"},Xk=Nh(()=>n.createElementVNode("div",{class:"match-day__live__bullet"},null,-1)),Zk=Nh(()=>n.createElementVNode("div",{class:"match-day__live__text"},"LIVE",-1)),Qk=[Xk,Zk],eE={__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)&&!s.matchDay.liveGamesIds.size?(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)):s.matchDay.liveGamesIds.size?(n.openBlock(),n.createElementBlock("div",Jk,Qk)):n.createCommentVNode("",!0)],4))}},tE=It(eE,[["__scopeId","data-v-15f082dd"]]),sE={__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(Hk),n.mergeProps(i.value,{ref_key:"matchDayPickerCarousel",ref:a}),{addons:n.withCtx(()=>[n.createVNode(n.unref(qk))]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.matchDays,u=>(n.openBlock(),n.createBlock(n.unref(Yk),{key:u.key},{default:n.withCtx(()=>[n.createVNode(tE,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))}},aE=It(sE,[["__scopeId","data-v-1621f164"]]);function Ns(s,e=80){return`${{}.TEAM_LOGOS_URL||"https://az755631.vo.msecnd.net/teams-"}${e}/${s}.png`}function Dh(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 nE(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 iE={class:"game-info__teams"},oE={class:"game-info__teams__team__logo"},rE=["src"],lE={class:"game-info__teams__detail"},cE={key:0,class:"game-info__teams__detail__pre-game"},dE={class:"game-info__teams__team__logo away"},hE=["src"],uE={key:0},mE={key:0},fE={key:1},pE={__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",iE,[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",oE,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.home_team.team_id),alt:""},null,8,rE)])],4),n.createElementVNode("div",lE,[s.game.game_status===4&&!s.game.is_live?(n.openBlock(),n.createElementBlock("div",cE,[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",dE,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.visiting_team.team_id),alt:""},null,8,hE)]),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",uE,[s.isTelevisionVisible?(n.openBlock(),n.createElementBlock("span",mE,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)])):(n.openBlock(),n.createElementBlock("span",fE,n.toDisplayString(n.unref(nE)(s.game)),1))],4)],4))}},Ph=It(pE,[["__scopeId","data-v-9460f42e"]]),Oh=s=>(n.pushScopeId("data-v-e2fc9ed0"),s=s(),n.popScopeId(),s),gE={class:"game-status"},yE={key:0,class:"game-status__day__live"},bE=Oh(()=>n.createElementVNode("span",null,"LIVE",-1)),SE=Oh(()=>n.createElementVNode("span",{class:"dot"},null,-1)),_E=[bE,SE],wE={key:0,class:"game-status__round"},kE={__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",gE,[n.createElementVNode("div",{class:n.normalizeClass(["game-status__day",o.value]),style:n.normalizeStyle(i.value)},[s.isLive?(n.openBlock(),n.createElementBlock("div",yE,_E)):(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",wE,n.toDisplayString(s.roundAbbreviation),1))]))}},Fh=It(kE,[["__scopeId","data-v-e2fc9ed0"]]),Rt={SHOW_GAME_EVENTS:"SHOW_GAME_EVENTS",PLAY_GOALS:"PLAY_GOALS",PLAY_RESUME:"PLAY_RESUME",NOTIFICATION:"NOTIFICATION",STATISTICS:"STATISTICS"},EE=s=>(n.pushScopeId("data-v-5711c5a6"),s=s(),n.popScopeId(),s),TE={class:"actions"},CE={class:"actions__row"},xE=EE(()=>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)),vE=[xE],AE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},LE=["fill"],IE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},RE=["fill"],BE={__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",TE,[n.createElementVNode("div",CE,[n.createElementVNode("div",{class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:r[0]||(r[0]=l=>i(n.unref(Rt).STATISTICS))},vE,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(Rt).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),s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:1,class:"actions__button",onClick:r[2]||(r[2]=l=>i(n.unref(Rt).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",IE,[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,RE)]))])):n.createCommentVNode("",!0)])]))}},NE=It(BE,[["__scopeId","data-v-5711c5a6"]]),Uo=s=>(n.pushScopeId("data-v-d64f8667"),s=s(),n.popScopeId(),s),DE={class:"actions"},PE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},OE=["fill"],FE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ME=["fill"],VE=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)),$E=[VE],zE={key:0,class:"actions__videos"},UE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},GE=["fill"],jE={key:1,class:"actions__videos__thumbnails"},HE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__goals"},null,-1)),WE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__summary"},null,-1)),KE={height:24,width:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qE=["stroke"],YE={__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",DE,[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(Rt).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",PE,[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,OE)]))])):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(Rt).PLAY_RESUME))},[(n.openBlock(),n.createElementBlock("svg",FE,[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,ME)]))],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(Rt).STATISTICS))},$E,4)],2),o.value?(n.openBlock(),n.createElementBlock("div",zE,[s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button",onClick:c[3]||(c[3]=h=>l(n.unref(Rt).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",UE,[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,GE)]))])):n.createCommentVNode("",!0),s.showPlayButton&&s.hasVideo?(n.openBlock(),n.createElementBlock("div",jE,[s.hasGoals?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__videos__thumbnails__thumbnail",onClick:c[4]||(c[4]=h=>l(n.unref(Rt).PLAY_GOALS))},[HE,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(Rt).PLAY_RESUME))},[WE,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(Rt).SHOW_GAME_EVENTS))},[(n.openBlock(),n.createElementBlock("svg",KE,[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,qE)]))],2)):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["actions__button expand",{"rotated-180":!1,mobile:s.componentWidth<540}])},null,2))]))}},JE=It(YE,[["__scopeId","data-v-d64f8667"]]),mn=s=>(n.pushScopeId("data-v-2968a2f6"),s=s(),n.popScopeId(),s),XE={class:"row-landing__game-status"},ZE={class:"row-landing__game-actions"},QE={class:"row-full__game-status"},eT={class:"row-full__game-info"},tT={key:0},sT={class:"row-full__game-actions"},aT={class:"game-events-container"},nT=mn(()=>n.createElementVNode("div",{class:"separator"},null,-1)),iT=mn(()=>n.createElementVNode("div",null,null,-1)),oT={class:"game-events__data"},rT={class:"game-events__data__team"},lT=["src"],cT={class:"game-events__data__team__event__text"},dT={class:"game-events__data__team away"},hT={class:"game-events__data__team__event__text"},uT=["src"],mT=mn(()=>n.createElementVNode("div",null,null,-1)),fT=mn(()=>n.createElementVNode("div",null,null,-1)),pT={__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===Rt.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(Ph,{game:s.game,"is-landing-mode":s.isLandingMode},null,8,["game","is-landing-mode"]),n.createElementVNode("div",XE,[n.createVNode(Fh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Dh)(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",ZE,[s.game.home_team?(n.openBlock(),n.createBlock(NE,{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",QE,[n.createVNode(Fh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Dh)(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",eT,[n.createVNode(Ph,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",tT,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0),n.createElementVNode("div",sT,[s.game.home_team?(n.openBlock(),n.createBlock(JE,{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",aT,[nT,n.createElementVNode("div",{class:n.normalizeClass(["game-events",u.value.events])},[iT,n.createElementVNode("div",oT,[n.createElementVNode("div",rT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.homeTeam,(S,w)=>(n.openBlock(),n.createElementBlock("div",{key:`h${w}`,class:"game-events__data__team__event"},[n.createElementVNode("img",{src:S.iconUrl},null,8,lT),n.createElementVNode("div",cT,n.toDisplayString(S.text),1)]))),128))]),n.createElementVNode("div",dT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.awayTeam,(S,w)=>(n.openBlock(),n.createElementBlock("div",{key:`a${w}`,class:"game-events__data__team__event"},[n.createElementVNode("div",hT,n.toDisplayString(S.text),1),n.createElementVNode("img",{src:S.iconUrl},null,8,uT)]))),128))])]),mT,fT],2)],512),[[n.vShow,i.value]])]),_:1})],4))}},Mh=It(pT,[["__scopeId","data-v-2968a2f6"]]),gT={class:"calendar-table"},yT={__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",gT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.gamesPerPage,(l,d)=>(n.openBlock(),n.createBlock(Mh,{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))]))}},bT=It(yT,[["__scopeId","data-v-c7bf1232"]]),ST={class:"calendar-by-team"},_T={class:"playing-as-picker"},wT={class:"calendar-by-team__page"},kT={__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",ST,[n.createElementVNode("div",_T,[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",wT,[(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(Mh,{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"])]))}},ET=It(kT,[["__scopeId","data-v-6e0e406c"]]),TT="_liveMinutes_1utnm_2",CT="_viewButtomEvent_1utnm_6",xT="_containerEvents_1utnm_20",vT="_sepEvents_1utnm_26",AT="_goalsContainer_1utnm_36",LT="_yellowContainer_1utnm_44",IT="_redContainer_1utnm_52",RT="_containerEventsGameHometeam_1utnm_60",BT="_containerEventsGameAwayteam_1utnm_73",NT="_image62Icon_1utnm_86",DT="_imgChivasIcon_1utnm_95",PT="_nameDesktop_1utnm_102",OT="_nameMobile_1utnm_115",FT="_homeTeam_1utnm_127",MT="_sbado16De_1utnm_138",VT="_gameDate_1utnm_147",$T="_sab16092023_1utnm_151",zT="_div_1utnm_164",UT="_divscore_1utnm_173",GT="_cst_1utnm_183",jT="_hour_1utnm_192",HT="_score_1utnm_193",WT="_chivasTvCanal_1utnm_204",KT="_gameStatus_1utnm_216",qT="_matchInfo_1utnm_227",YT="_image62Icon1_1utnm_241",JT="_name_1utnm_102",XT="_imgAtlasIcon_1utnm_263",ZT="_name1_1utnm_270",QT="_awayTeam_1utnm_282",eC="_matchCard_1utnm_293",tC={liveMinutes:TT,viewButtomEvent:CT,containerEvents:xT,sepEvents:vT,goalsContainer:AT,yellowContainer:LT,redContainer:IT,containerEventsGameHometeam:RT,containerEventsGameAwayteam:BT,image62Icon:NT,imgChivasIcon:DT,nameDesktop:PT,nameMobile:OT,homeTeam:FT,sbado16De:MT,gameDate:VT,sab16092023:$T,div:zT,divscore:UT,cst:GT,hour:jT,score:HT,chivasTvCanal:WT,gameStatus:KT,matchInfo:qT,image62Icon1:YT,name:JT,imgAtlasIcon:XT,name1:ZT,awayTeam:QT,matchCard:eC},sC=["src"],aC=["src"],nC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),iC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),oC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),rC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),lC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),cC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),dC=n.createElementVNode("img",{src:"http://golstatsimages.blob.core.windows.net/todoelfut/point-indicador-live.png"},null,-1),hC={key:0},uC=n.createElementVNode("div",null,"ver eventos",-1),mC=n.createElementVNode("img",{width:"13",style:{"margin-top":"1px"},src:"http://golstatsimages.blob.core.windows.net/todoelfut/arrow-live-down.png"},null,-1),fC=["src"],pC=["src"],gC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},yC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},bC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},SC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),_C=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),wC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),kC={__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,sC),n.createElementVNode("img",{class:n.normalizeClass(h.$style.imgChivasIcon),alt:"",src:n.unref(Ns)(r.value.home_team.team_id)},null,10,aC),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)},[nC,(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)},[iC,(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)},[oC,(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)},[rC,(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)},[lC,(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)},[cC,(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||r.value.game_status!=1&&r.value.game_status!=4?(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)},[dC,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",hC," - 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))},[uC,n.createTextVNode(" "),mC],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,fC),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,pC),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",gC)):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",yC)):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",bC)):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)},[SC,(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)},[_C,(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)},[wC,(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))}},EC={$style:tC},TC=It(kC,[["__cssModules",EC]]),CC={class:"calendar-by-game__carousel"},xC="https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",vC={__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),w=n.computed(()=>t.isCup),x=n.computed(()=>t.isCupLegacy),T=n.computed(()=>({height:t.height,width:t.width})),v=n.computed(()=>{if(t.games)return Ce(t.games,t.isTeamGamePerPage);{const j=u.value.get(h.value.key);return j&&t.isTeamGamePerPage&&t.onlyGamesTeamId?[j[0].filter(Y=>Y.home_team.team_id===t.onlyGamesTeamId||Y.visiting_team.team_id===t.onlyGamesTeamId)]:j||[]}}),E=n.computed(()=>t.areGamesCarouselType?v.value[0]:v.value),B=n.ref([]),I=n.ref(new Map),R=n.ref([]),M=n.computed(()=>{const j=R.value&&R.value.length?se(l.value):H(l.value),Y=B.value.find(G=>G.key===j);return Y&&f.value&&(K(!1),tt(Y)),j});n.watch(()=>t.seasons,j=>{j&&j.length&&(K(!0),r.value=j.map(Y=>Y.id),ce(j,!0))},{immediate:!0,deep:!0}),n.watch(u,j=>{if(t.onlyGamesTeamId&&j.size){const Y=Array.from(j.values()).reduce((G,$)=>($.forEach(z=>{const ie=z.find(ye=>ye.home_team.team_id===t.onlyGamesTeamId||ye.visiting_team.team_id===t.onlyGamesTeamId);ie&&G.push(ie)}),G),[]);e("change-games-by-client-privileges",Y)}},{immediate:!0});function K(j){f.value=j}function H(j){const Y=new Date().valueOf(),G=Object.entries(Object.entries(j).reduce((z,[ie,ye])=>(z[ie]=null,ye.forEach(Fe=>{Fe.games.forEach(dt=>{if([1,0].includes(dt.game_status)||dt.is_live){const Xs=Y-dt.dateTimeMillis;(z[ie]===null||Xs<z[ie])&&(z[ie]=Xs)}})}),z),{}));if(!G.length)return"1";const $=G.reduce((z,[ie,ye])=>{if(ye!==null){const Fe=I.value.get(ie);(z.shortestMillisToNow===null||ye<z.shortestMillisToNow&&Fe.index>=z.scheduleKey.index)&&(z.shortestMillisToNow=ye,z.round=ie,z.scheduleKey=Fe)}return z},{round:"",shortestMillisToNow:null,scheduleKey:null});return $.shortestMillisToNow!==null?$.round:G[G.length-1][0]}function se(j){let Y=1;if(R.value.length){const G=R.value[0];for(const[$,z]of Object.entries(j))for(const ie of z)if(ie.games.find(ye=>ye.game_id===G.game_id))return $}return Y}n.watch(()=>t.teamId,()=>{Te()},{immediate:!0});async function oe(j,Y,G=""){let $=G;try{const z={};t.token&&(z.Authorization=t.token),$||($="https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",j.forEach((Fe,dt)=>{$+=`${dt===0?"":"&"}seasons=${Fe}`}));const{data:{data:ie,teams:ye}}=await un.get($,{headers:z});return{seasonsAndGames:ie,seasonsAndTeams:ye}}catch(z){if(Y>0)return oe(j,Y-1,$);throw new Error(z)}}function ne(j){for(const Y of j)if(!r.value.includes(Y.season_id))return!0;return!1}async function ce(j,Y){try{l.value={};let G=0;const{seasonsAndGames:$,seasonsAndTeams:z}=await oe(j.map(ye=>ye.id),3);if(Y&&ne($))return;$.forEach(ye=>{const{type:Fe}=j.find(dt=>dt.id===ye.season_id);ye.type=Fe,ye.games.forEach(dt=>{dt.season_id=ye.season_id}),Fe===0&&(G=ye.season_id)}),p.value={seasonsGames:$};const{teams:ie}=z.find(ye=>ye.season_id===G);m.value=ie,e("change-teams",ie),Te(),S.value.size?q():await de()}catch(G){throw new Error(G)}}async function de(){try{const j=await te(),Y=new Set;if(y.value=j.data.reduce((G,$)=>($.games.forEach(z=>{Y.add(z.game_id),G.push(z)}),G),[]),y.value.length){i||await Z();const G=[];S.value.forEach($=>{const z=b.value.get($);z&&new Date().valueOf()>z.dateTimeMillis&&G.push($)}),G.length&&G.every($=>b.value.get($).isLiveTracked)&&X()}}catch(j){throw new Error(j)}}async function Z(){try{const j=[];for(const G of y.value){const $=b.value.get(G.game_id);$&&($.is_live=1,$.game_status=4,$.scheduleKey&&$.scheduleKey.liveGamesIds.add(G.game_id)),$.isLiveTracked=!0,j.push(xe(G.game_id))}const Y=await Promise.all(j);for(const G of Y){const $=b.value.get(G.game_id);if($){const z=[Number(G.score[$.home_team.team_id.toString()])+Number(G.score[`own_${$.visiting_team.team_id.toString()}`]),Number(G.score[$.visiting_team.team_id.toString()])+Number(G.score[`own_${$.home_team.team_id.toString()}`])],ie=z[0],ye=z[1];$.score=[Number.isNaN(ie)?0:ie,Number.isNaN(ye)?0:ye],be($,G.plays)}}i||J()}catch(j){throw new Error(j)}}function q(){S.value.size&&S.value.forEach(j=>{const Y=b.value.get(j);if(Y){const G=new Date().valueOf();if(60*1e3*30+Y.dateTimeMillis-G>0){const $=Y.dateTimeMillis-G-3e5;setTimeout(()=>{he()},$>0?$:0)}}})}function he(){X(),o||(o=setInterval(()=>{de()},t.checkLiveGamesIntervalMinutes*60*1e3))}function J(){ue(),i=setInterval(()=>{Z()},t.gamesEventsIntervalMinutes*60*1e3)}function X(){clearInterval(o),o=null}function ue(){clearInterval(i),i=null}function be(j,Y){for(const G of Y)if(G.category_id===0&&G.game_status_id===13){const $=b.value.get(G.game_id);y.value=y.value.filter(z=>z.game_id!==j.game_id),$.is_live=0,$.game_status=0,$.scheduleKey&&$.scheduleKey.liveGamesIds.delete(j.game_id)}}async function xe(j){try{return(await un.get(`${xC}${j}`,{headers:{Authorization:`${t.token}`}})).data}catch(Y){throw new Error(Y)}}async function te(){try{if(t.seasons.length===0)return[];const j=t.seasons.reduce(($,z)=>`${$}seasons=${z.id}&`,""),Y=un.create({headers:{Authorization:`${t.token}`}}),{data:G}=await Y.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${j}`);return G}catch(j){throw new Error(j)}}function Te(){if(X(),!m.value)return;b.value.clear(),S.value.clear(),R.value=[];const j=p.value&&p.value.seasonsGames?p.value.seasonsGames.map(Y=>{const G=Y.games.reduce(($,z)=>{if(t.onlyGamesTeamId&&t.onlyGamesTeamId!==z.home_team&&t.onlyGamesTeamId!==z.visiting_team)return $;const ie={...z},ye=new Date,[Fe,dt,Xs]=ie.date.split("-"),[La,Ei,Ia]=ie.schedule.split(":"),Ti=new Date(Number(Fe),Number(dt)-1,Number(Xs),Number(La),Number(Ei),Number(Ia));return ie.dateTimeMillis=Ti.valueOf(),ie.home_team=m.value.find(ql=>ql.team_id===z.home_team),ie.visiting_team=m.value.find(ql=>ql.team_id===z.visiting_team),ie.game_status===4&&ye.getFullYear()===Ti.getFullYear()&&ye.getMonth()===Ti.getMonth()&&ye.getDate()===Ti.getDate()&&S.value.add(ie.game_id),b.value.set(ie.game_id,ie),t.teamId&&ie.home_team.team_id!==t.teamId&&ie.visiting_team.team_id!==t.teamId||($[z.matchday_abbreviation]?$[z.matchday_abbreviation][z.game_status===3?"canceled":z.date]?$[z.matchday_abbreviation][z.game_status===3?"canceled":z.date].push(ie):$[z.matchday_abbreviation][z.game_status===3?"canceled":z.date]=[ie]:$[z.matchday_abbreviation]={[z.game_status===3?"canceled":z.date]:[ie]},t.userTeamId&&ie.game_status===4&&(ie.home_team.team_id===t.userTeamId||ie.visiting_team.team_id===t.userTeamId)&&R.value.push(ie)),$},{});for(let[$,z]of Object.entries(G))G[$]=Object.entries(z).map(([ie,ye])=>({date:ie,games:ye.sort((Fe,dt)=>Fe.dateTimeMillis-dt.dateTimeMillis)})),G[$].sort((ie,ye)=>ie.date<ye.date?-1:ie.date>ye.date?1:0);return{type:Y.type,weight:Y.type===0?0:Y.type===2?1:2,schedule:G}}):[];j.sort((Y,G)=>Y.weight-G.weight),l.value=j.reduce((Y,G)=>{for(const[$,z]of Object.entries(G.schedule))if(G.type===0)if([1,2].includes(t.tournamentType)){const ie=Fk.get(t.tournamentType);if(ie){const ye=ie.get($);ye&&(Y[ye.matchDayAbbreviation]=z)}}else if(w.value){const ie=$.replace("M",""),ye=ie;x.value?Y[Ok[ie]||ye]=z:Y[Pk[$]||ye]=z}else Y[Number($.replace("M","")).toString()]=z;else G.type===2?$.charAt(1)=="I"?Y[`PI${Number($.replace("PI",""))}`]=z:Y[`R${Number($.replace("PO",""))}`]=z:G.type===1&&(Y[Dk[$]]=z);return Y},{}),u.value=new Map,I.value.clear(),B.value=Array.from(Object.entries(l.value).reduce((Y,[G,$],z)=>{const ie=Number(G);let ye="";Number.isNaN(ie)?ye=G:ye=ie<10?`0${ie}`:G;const Fe={key:G,value:ie,valueText:ye,index:z,liveGamesIds:new Set};I.value.set(G,Fe),Y.set(G,Fe);const dt=$.reduce((La,Ei)=>(Ei.games.forEach(Ia=>{Ia.game_id===t.defaultGameId&&(g.value=G),Ia.roundAbbreviation=Number.isNaN(ie)?ie:`J ${ie}`,Ia.scheduleKey=Fe}),La=La.concat(Ei.games),La),[]),Xs=Ce(dt);return u.value.set(G,Xs),Y},new Map).values())}function Ce(j,Y=!1){const G=[];if(t.gamesPerMatchDay>0){let $=[];j.forEach((z,ie)=>{$.push(z),(ie+1)%t.gamesPerMatchDay===0&&(G.push([...$]),$=[])}),$.length&&G.push([...$])}else G.push(j);return Y&&t.isTeamGamePerPage&&t.defaultGameId?G.filter($=>$.game_id===t.defaultGameId||$.gameId===t.defaultGameId):G}async function Oe(j){try{const{data:Y}=await un.get("https://kefloixzy1.execute-api.us-west-2.amazonaws.com/prod/tournaments");return Y}catch(Y){if(j>0)return Oe(j-1);throw new Error(Y)}}function ot(){if(window.ResizeObserver)a=new ResizeObserver(()=>{d.value=c.value.clientWidth}),a.observe(c.value);else throw new Error("Resize observer not supported!")}function tt(j){h.value.value!==j.value&&(h.value=j,e("change-round",j))}function ct(j){t.areGamesCarouselType&&e("change-game-carousel",j.selectedItem)}function C(j){e("action",j),U(j)}function W(j){e("open-modal-event",j)}function U(j){const Y="PLAY_RESUME",G="PLAY_GOALS",$=[607,608,12,55,54,35,14,52,15,53,466,477],z=[12,55,"35_r","54_r"],{game_id:ie,season_id:ye}=j.game;let Fe={seasonId:ye,tournaments:[],isFeaturedPlayers:!1,mainSectionType:1,playListType:1,gameIdsToFilter:[ie],playerIds:[],goalkeeperIds:[],categoryIds:[],teamId:0,matchResult:[],categorySingleName:"",avoidCategorySingleName:!1,currentPlayIndex:0,playData:null,lastClashedGameId:null,tournamentsLastClashes:null,advancedFilter:{playListTitle:""},objectPlaySync:null};j.action===Y?(Fe.categoryIds=$,Fe.advancedFilter.playListTitle="Resumen",e("openmedia",Fe)):j.action===G&&(Fe.categoryIds=z,Fe.advancedFilter.playListTitle="Goles",e("openmedia",Fe))}async function me(){try{if(!t.awaitForSeasons&&!t.games){const j=(await Oe(3)).find($=>$._id===1),Y=j.seasons[0],G=[{id:Y.id,type:Y.type}];j&&j.tournament&&e("tournament-selected",j.tournament),Y.related_seasons&&Y.related_seasons.length&&G.push(...Y.related_seasons.map($=>({id:$.id,type:$.type}))),await ce(G,!1)}}catch(j){throw new Error(j)}}return n.onMounted(()=>{ot()}),me(),(j,Y)=>(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(ET,{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:C},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&&B.value?(n.openBlock(),n.createBlock(aE,{key:0,"match-days":B.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?M.value:"",onChangeMatchDay:tt},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",CC,[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:ct},{default:n.withCtx(({item:G})=>[s.areGamesCarouselType?(n.openBlock(),n.createBlock(TC,{key:0,is_captured:s.is_captured,game:G,onOpenModalEvent:W,"plays-live":s.playsLive,"info-live":s.infoLive},null,8,["is_captured","game","plays-live","info-live"])):(n.openBlock(),n.createBlock(bT,{key:1,"team-id":s.teamId,"show-videos":s.showVideos,"games-per-page":G,"is-landing-mode":s.isLandingMode,"row-height":s.rowHeight,"component-width":d.value,"is-round-mode":s.isRoundMode,onAction:C},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))}},AC=It(vC,[["__scopeId","data-v-b77219eb"]]),LC=["Mi posición","Tabla General","Fases","Play Off"],IC={components:{GscSwitchComponent:bo,GSCGeneraltable:rw,GSCCalendarByGame:AC},props:{privileges:{type:Object,default:()=>{}},isPublic:{type:Boolean,default:!0},isPlayer:{type:Boolean,default:!1},isPlayerTournament:{type:Boolean,default:!1},isGeneric:{type:Boolean,default:!1},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 LC.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"}},RC={key:0,class:"gsc-switch-container"},BC={class:"gsc-app-component"},NC={key:0};function DC(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",{key:1,class:n.normalizeClass(["gsc-switch-container",t.isPlayer&&t.isPlayerTournament||!t.isGeneric?"gsc-switch-container-player":""])},[t.isPlayerTournament?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t.isPublic?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Tabla General")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Mi posición")],64))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Tabla General")],64))],2)):(n.openBlock(),n.createElementBlock("div",RC,[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",BC,[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",NC,[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 PC=Ye(IC,[["render",DC],["__scopeId","data-v-3c3487eb"]]),Vh=["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],$h=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],zh=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],OC={class:"match"},FC={class:"match__header"},MC={key:0,class:"match__final-tag"},VC={key:1,class:"match__final-tag__no-border"},$C={class:"match__header__match-date"},zC={class:"match__tag"},UC={class:"match__body"},GC={class:"match__data"},jC={class:"match__acronym"},HC=["src"],WC={class:"match__score"},KC=["src"],qC={class:"match__acronym"},YC={class:"match__status"},fn=Ye({__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`${Vh[a.getDay()]}, ${a.getDate()} de ${$h[a.getMonth()]}`});return(a,i)=>{var o,r,l;return n.openBlock(),n.createElementBlock("section",OC,[n.createElementVNode("div",FC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock("div",MC,"FINAL")):(n.openBlock(),n.createElementBlock("div",VC)),n.createElementVNode("div",$C,n.toDisplayString(t.value),1),n.createElementVNode("div",zC,n.toDisplayString(`${Number.isNaN(Number(s.data.roundAbbreviationV2))?"":"J"}${s.data.roundAbbreviationV2}`),1)]),n.createElementVNode("div",UC,[n.createElementVNode("div",GC,[n.createElementVNode("div",jC,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,HC),n.createElementVNode("div",WC,[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,KC),n.createElementVNode("div",qC,n.toDisplayString((l=s.data)==null?void 0:l.visiting_team_acronym),1)]),n.createElementVNode("div",YC,[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"))},"Ver →")])}}},[["__scopeId","data-v-2d7ed7f2"]]),Uh=s=>(n.pushScopeId("data-v-540e357c"),s=s(),n.popScopeId(),s),JC=["src"],XC=["src"],ZC={class:"coming-match__body"},QC={class:"coming-match__data"},ex=["src"],tx={key:0,class:"coming-match__live"},sx={class:"coming-match__live__score"},ax={class:"coming-match__live__time"},nx=Uh(()=>n.createElementVNode("div",{class:"bullet"},null,-1)),ix=Uh(()=>n.createElementVNode("div",{class:"coming-match__live__time__text"},"LIVE",-1)),ox={class:"coming-match__live__time__time"},rx={key:1,style:{"margin-top":"16px"}},lx={class:"coming-match__time"},cx={class:"coming-match__cst"},dx={key:0},hx=["src"],Ds=Ye({__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`${Vh[i.getDay()]}, ${i.getDate()} de ${e.small?zh[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,w,x;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,JC),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,XC),n.createElementVNode("div",ZC,[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",QC,[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,ex),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",tx,[n.createElementVNode("div",sx,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",ax,[nx,ix,n.createElementVNode("div",ox,n.toDisplayString(s.data.currentTimeLive||"0'"),1)])])):(n.openBlock(),n.createElementBlock("div",rx,[n.createElementVNode("div",lx,[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",cx,[s.data.game_status===4?(n.openBlock(),n.createElementBlock("span",dx,"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/"+((w=s.data)==null?void 0:w.visiting_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-80/"+((x=s.data)==null?void 0:x.visiting_team)+".png",alt:"team-img"},null,10,hx)],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("Ver →")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Ver →")],64))],2)],2)}}},[["__scopeId","data-v-540e357c"]]),pn=s=>(n.pushScopeId("data-v-8a08c1a3"),s=s(),n.popScopeId(),s),ux={class:"game-item__header"},mx={class:"game-item__header__info text-type-1"},fx={key:0,class:"game-item__header__info__live"},px=pn(()=>n.createElementVNode("div",{class:"game-item__header__info__live__status text-type-2"},[n.createElementVNode("div",{class:"bullet"}),n.createElementVNode("span",null,"LIVE")],-1)),gx={class:"text-type-1"},yx={key:1,class:"game-item__header__info__pre-match text-type-2"},bx=pn(()=>n.createElementVNode("span",{class:"game-item__header__info__pre-match text-type-1"},[n.createTextVNode(" "),n.createElementVNode("small",null,"CST")],-1)),Sx={key:2,class:"game-item__header__info__post-match"},_x=[pn(()=>n.createElementVNode("span",{class:"text-type-2"},"Finalizado",-1))],wx={class:"game-item__body"},kx={class:"game-item__body__team__info"},Ex=["src"],Tx={class:"game-item__body__team__info__acronym"},Cx={class:"game-item__body__team__score"},xx=[pn(()=>n.createElementVNode("div",null,"Ver →",-1))],vx=Ye({__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()} ${zh[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",ux,[n.createElementVNode("div",mx,n.toDisplayString(a.value),1),s.game.is_live?(n.openBlock(),n.createElementBlock("div",fx,[px,n.createElementVNode("div",gx,n.toDisplayString(s.game.currentTimeLive||"0'"),1)])):s.game.game_status===4?(n.openBlock(),n.createElementBlock("div",yx,[n.createTextVNode(n.toDisplayString(i.value)+" ",1),bx])):(n.openBlock(),n.createElementBlock("div",Sx,_x))]),n.createElementVNode("div",wx,[(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",kx,[n.createElementVNode("img",{src:c.teamLogo,alt:"team-logo"},null,8,Ex),n.createElementVNode("div",Tx,n.toDisplayString(c.acronym),1)]),n.createElementVNode("div",Cx,[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},xx)],2))}},[["__scopeId","data-v-8a08c1a3"]]),Ax=Ye({__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 He={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:He.itemsToShow,type:Number},itemsToScroll:{default:He.itemsToScroll,type:Number},wrapAround:{default:He.wrapAround,type:Boolean},throttle:{default:He.throttle,type:Number},snapAlign:{default:He.snapAlign,validator(s){return["start","end","center","center-even","center-odd"].includes(s)}},transition:{default:He.transition,type:Number},breakpoints:{default:He.breakpoints,type:Object},autoplay:{default:He.autoplay,type:Number},pauseAutoplayOnHover:{default:He.pauseAutoplayOnHover,type:Boolean},modelValue:{default:void 0,type:Number},mouseDrag:{default:He.mouseDrag,type:Boolean},touchDrag:{default:He.touchDrag,type:Boolean},dir:{default:He.dir,validator(s){return["rtl","ltr"].includes(s)}},i18n:{default:He.i18n,type:Object},settings:{default(){return{}},type:Object}};function Mk({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 Vk({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 Mo({val:s,max:e,min:t}){return e<t?s:Math.min(Math.max(s,t),e)}function $k({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:Mo({val:r,max:t-o,min:0})}function Bh(s){return s?s.reduce((e,t)=>{var a;return t.type===n.Fragment?[...e,...Bh(t.children)]:((a=t.type)===null||a===void 0?void 0:a.name)==="CarouselSlide"?[...e,t]:e},[]):[]}function Vo({val:s,max:e,min:t=0}){return s>e?Vo({val:s-(e+1),max:e,min:t}):s<t?Vo({val:s+(e+1),max:e,min:t}):s}function zk(s,e){let t;return e?function(...a){const i=this;t||(s.apply(i,a),t=!0,setTimeout(()=>t=!1,e))}:s}function Uk(s,e){let t;return function(...a){t&&clearTimeout(t),t=setTimeout(()=>{s(...a),t=null},e)}}function Gk(s="",e={}){return Object.entries(e).reduce((t,[a,i])=>t.replace(`{${a}}`,String(i)),s)}var jk=n.defineComponent({name:"ARIA",setup(){const s=n.inject("config",n.reactive(Object.assign({},He))),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"},Gk(s.i18n.itemXofY,{currentSlide:e.value+1,slidesCount:t.value}))}}),Hk=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({},He));let h=Object.assign({},He),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 w(){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 x(){if(!u||!Object.keys(u).length)return;const C=Object.keys(u).map(U=>Number(U)).sort((U,me)=>+me-+U);let W=Object.assign({},h);C.some(U=>{const me=window.matchMedia(`(min-width: ${U}px)`).matches;return me&&(W=Object.assign(Object.assign({},W),u[U])),me}),T(W)}function T(C){Object.entries(C).forEach(([W,U])=>c[W]=U)}const v=Uk(()=>{x(),B(),E()},16);function E(){if(!o.value)return;const C=o.value.getBoundingClientRect();l.value=C.width/c.itemsToShow}function B(){d.value<=0||(m.value=Math.ceil((d.value-1)/2),g.value=Mk({config:c,slidesCount:d.value}),y.value=Vk({config:c,slidesCount:d.value}),c.wrapAround||(f.value=Mo({val:f.value,max:g.value,min:y.value})))}n.onMounted(()=>{n.nextTick(()=>E()),setTimeout(()=>E(),1e3),x(),q(),window.addEventListener("resize",v,{passive:!0}),t("init")}),n.onUnmounted(()=>{S&&clearTimeout(S),b&&clearInterval(b),window.removeEventListener("resize",v,{passive:!0})});let I=!1;const R={x:0,y:0},M={x:0,y:0},K=n.reactive({x:0,y:0}),H=n.ref(!1),se=n.ref(!1),oe=()=>{H.value=!0},ne=()=>{H.value=!1};function ce(C){["INPUT","TEXTAREA","SELECT"].includes(C.target.tagName)||(I=C.type==="touchstart",I||C.preventDefault(),!(!I&&C.button!==0||J.value)&&(R.x=I?C.touches[0].clientX:C.clientX,R.y=I?C.touches[0].clientY:C.clientY,document.addEventListener(I?"touchmove":"mousemove",de,!0),document.addEventListener(I?"touchend":"mouseup",Z,!0)))}const de=zk(C=>{se.value=!0,M.x=I?C.touches[0].clientX:C.clientX,M.y=I?C.touches[0].clientY:C.clientY;const W=M.x-R.x,U=M.y-R.y;K.y=U,K.x=W},c.throttle);function Z(){const C=c.dir==="rtl"?-1:1,W=Math.sign(K.x)*.4,U=Math.round(K.x/l.value+W)*C;if(U&&!I){const me=j=>{window.removeEventListener("click",me,!0)};window.addEventListener("click",me,!0)}X(f.value-U),K.x=0,K.y=0,se.value=!1,document.removeEventListener(I?"touchmove":"mousemove",de,!0),document.removeEventListener(I?"touchend":"mouseup",Z,!0)}function q(){!c.autoplay||c.autoplay<=0||(b=setInterval(()=>{c.pauseAutoplayOnHover&&H.value||ue()},c.autoplay))}function he(){b&&(clearInterval(b),b=null),q()}const J=n.ref(!1);function X(C){const W=c.wrapAround?C:Mo({val:C,max:g.value,min:y.value});f.value===W||J.value||(t("slide-start",{slidingToIndex:C,currentSlideIndex:f.value,prevSlideIndex:p.value,slidesCount:d.value}),J.value=!0,p.value=f.value,f.value=W,S=setTimeout(()=>{if(c.wrapAround){const U=Vo({val:W,max:g.value,min:0});U!==f.value&&(f.value=U,t("loop",{currentSlideIndex:f.value,slidingToIndex:C}))}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(){X(f.value+c.itemsToScroll)}function be(){X(f.value-c.itemsToScroll)}const xe={slideTo:X,next:ue,prev:be};n.provide("nav",xe),n.provide("isSliding",J);const te=n.computed(()=>$k({config:c,currentSlide:f.value,slidesCount:d.value}));n.provide("slidesToScroll",te);const Te=n.computed(()=>{const C=c.dir==="rtl"?-1:1,W=te.value*l.value*C;return{transform:`translateX(${K.x-W}px)`,transition:`${J.value?c.transition:0}ms`,margin:c.wrapAround?`0 -${d.value*l.value}px`:"",width:"100%"}});function Ce(){w(),x(),B(),E(),he()}Object.keys(Rh).forEach(C=>{["modelValue"].includes(C)||n.watch(()=>s[C],Ce)}),n.watch(()=>s.modelValue,C=>{C!==f.value&&X(Number(C))}),n.watch(d,B),t("before-init"),w();const Oe={config:c,slidesCount:d,slideWidth:l,next:ue,prev:be,slideTo:X,currentSlide:f,maxSlide:g,minSlide:y,middleSlide:m};a({updateBreakpointsConfigs:x,updateSlidesData:B,updateSlideWidth:E,initDefaultConfigs:w,restartCarousel:Ce,slideTo:X,next:ue,prev:be,nav:xe,data:Oe});const ot=e.default||e.slides,tt=e.addons,ct=n.reactive(Oe);return()=>{const C=Bh(ot==null?void 0:ot(ct)),W=(tt==null?void 0:tt(ct))||[];C.forEach((Y,G)=>Y.props.index=G);let U=C;if(c.wrapAround){const Y=C.map(($,z)=>n.cloneVNode($,{index:-C.length+z,isClone:!0,key:`clone-before-${z}`})),G=C.map(($,z)=>n.cloneVNode($,{index:C.length+z,isClone:!0,key:`clone-after-${z}`}));U=[...Y,...C,...G]}r.value=C,d.value=Math.max(C.length,1);const me=n.h("ol",{class:"carousel__track",style:Te.value,onMousedownCapture:c.mouseDrag?ce:null,onTouchstartPassiveCapture:c.touchDrag?ce:null},U),j=n.h("div",{class:"carousel__viewport"},me);return n.h("section",{ref:o,class:{carousel:!0,"is-sliding":J.value,"is-dragging":se.value,"is-hover":H.value,"carousel--rtl":c.dir==="rtl"},dir:c.dir,"aria-label":c.i18n.ariaGallery,tabindex:"0",onMouseenter:oe,onMouseleave:ne},[j,W,n.h(jk)])}}}),$o;(function(s){s.arrowUp="arrowUp",s.arrowDown="arrowDown",s.arrowRight="arrowRight",s.arrowLeft="arrowLeft"})($o||($o={}));const Wk={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 Kk(s){return s in $o}const zo=s=>{const e=n.inject("config",n.reactive(Object.assign({},He))),t=String(s.name),a=`icon${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!t||typeof t!="string"||!Kk(t))return;const i=Wk[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])};zo.props={name:String,title:String};const qk=(s,{slots:e,attrs:t})=>{const{next:a,prev:i}=e||{},o=n.inject("config",n.reactive(Object.assign({},He))),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(zo,{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(zo,{name:p?"arrowLeft":"arrowRight"}));return[m,g]};var Yk=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({},He))),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 It=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t},Nh=s=>(n.pushScopeId("data-v-15f082dd"),s=s(),n.popScopeId(),s),Jk={key:1,class:"match-day__live"},Xk=Nh(()=>n.createElementVNode("div",{class:"match-day__live__bullet"},null,-1)),Zk=Nh(()=>n.createElementVNode("div",{class:"match-day__live__text"},"LIVE",-1)),Qk=[Xk,Zk],eE={__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)&&!s.matchDay.liveGamesIds.size?(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)):s.matchDay.liveGamesIds.size?(n.openBlock(),n.createElementBlock("div",Jk,Qk)):n.createCommentVNode("",!0)],4))}},tE=It(eE,[["__scopeId","data-v-15f082dd"]]),sE={__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(Hk),n.mergeProps(i.value,{ref_key:"matchDayPickerCarousel",ref:a}),{addons:n.withCtx(()=>[n.createVNode(n.unref(qk))]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.matchDays,u=>(n.openBlock(),n.createBlock(n.unref(Yk),{key:u.key},{default:n.withCtx(()=>[n.createVNode(tE,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))}},aE=It(sE,[["__scopeId","data-v-1621f164"]]);function Ns(s,e=80){return`${{}.TEAM_LOGOS_URL||"https://az755631.vo.msecnd.net/teams-"}${e}/${s}.png`}function Dh(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 nE(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 iE={class:"game-info__teams"},oE={class:"game-info__teams__team__logo"},rE=["src"],lE={class:"game-info__teams__detail"},cE={key:0,class:"game-info__teams__detail__pre-game"},dE={class:"game-info__teams__team__logo away"},hE=["src"],uE={key:0},mE={key:0},fE={key:1},pE={__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",iE,[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",oE,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.home_team.team_id),alt:""},null,8,rE)])],4),n.createElementVNode("div",lE,[s.game.game_status===4&&!s.game.is_live?(n.openBlock(),n.createElementBlock("div",cE,[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",dE,[n.createElementVNode("img",{src:n.unref(Ns)(s.game.visiting_team.team_id),alt:""},null,8,hE)]),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",uE,[s.isTelevisionVisible?(n.openBlock(),n.createElementBlock("span",mE,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)])):(n.openBlock(),n.createElementBlock("span",fE,n.toDisplayString(n.unref(nE)(s.game)),1))],4)],4))}},Ph=It(pE,[["__scopeId","data-v-9460f42e"]]),Oh=s=>(n.pushScopeId("data-v-e2fc9ed0"),s=s(),n.popScopeId(),s),gE={class:"game-status"},yE={key:0,class:"game-status__day__live"},bE=Oh(()=>n.createElementVNode("span",null,"LIVE",-1)),SE=Oh(()=>n.createElementVNode("span",{class:"dot"},null,-1)),_E=[bE,SE],wE={key:0,class:"game-status__round"},kE={__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",gE,[n.createElementVNode("div",{class:n.normalizeClass(["game-status__day",o.value]),style:n.normalizeStyle(i.value)},[s.isLive?(n.openBlock(),n.createElementBlock("div",yE,_E)):(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",wE,n.toDisplayString(s.roundAbbreviation),1))]))}},Fh=It(kE,[["__scopeId","data-v-e2fc9ed0"]]),Rt={SHOW_GAME_EVENTS:"SHOW_GAME_EVENTS",PLAY_GOALS:"PLAY_GOALS",PLAY_RESUME:"PLAY_RESUME",NOTIFICATION:"NOTIFICATION",STATISTICS:"STATISTICS"},EE=s=>(n.pushScopeId("data-v-5711c5a6"),s=s(),n.popScopeId(),s),TE={class:"actions"},CE={class:"actions__row"},xE=EE(()=>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)),vE=[xE],AE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},LE=["fill"],IE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},RE=["fill"],BE={__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",TE,[n.createElementVNode("div",CE,[n.createElementVNode("div",{class:"actions__button rounded",style:n.normalizeStyle(a.value),onClick:r[0]||(r[0]=l=>i(n.unref(Rt).STATISTICS))},vE,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(Rt).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),s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:1,class:"actions__button",onClick:r[2]||(r[2]=l=>i(n.unref(Rt).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",IE,[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,RE)]))])):n.createCommentVNode("",!0)])]))}},NE=It(BE,[["__scopeId","data-v-5711c5a6"]]),Uo=s=>(n.pushScopeId("data-v-d64f8667"),s=s(),n.popScopeId(),s),DE={class:"actions"},PE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},OE=["fill"],FE={width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ME=["fill"],VE=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)),$E=[VE],zE={key:0,class:"actions__videos"},UE={width:"13",height:"16",viewBox:"0 0 13 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},GE=["fill"],jE={key:1,class:"actions__videos__thumbnails"},HE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__goals"},null,-1)),WE=Uo(()=>n.createElementVNode("div",{class:"actions__videos__thumbnails__thumbnail__summary"},null,-1)),KE={height:24,width:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qE=["stroke"],YE={__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",DE,[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(Rt).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",PE,[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,OE)]))])):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(Rt).PLAY_RESUME))},[(n.openBlock(),n.createElementBlock("svg",FE,[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,ME)]))],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(Rt).STATISTICS))},$E,4)],2),o.value?(n.openBlock(),n.createElementBlock("div",zE,[s.gameStatus===4444&&!s.isLive?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__button",onClick:c[3]||(c[3]=h=>l(n.unref(Rt).NOTIFICATION))},[(n.openBlock(),n.createElementBlock("svg",UE,[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,GE)]))])):n.createCommentVNode("",!0),s.showPlayButton&&s.hasVideo?(n.openBlock(),n.createElementBlock("div",jE,[s.hasGoals?(n.openBlock(),n.createElementBlock("div",{key:0,class:"actions__videos__thumbnails__thumbnail",onClick:c[4]||(c[4]=h=>l(n.unref(Rt).PLAY_GOALS))},[HE,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(Rt).PLAY_RESUME))},[WE,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(Rt).SHOW_GAME_EVENTS))},[(n.openBlock(),n.createElementBlock("svg",KE,[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,qE)]))],2)):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["actions__button expand",{"rotated-180":!1,mobile:s.componentWidth<540}])},null,2))]))}},JE=It(YE,[["__scopeId","data-v-d64f8667"]]),mn=s=>(n.pushScopeId("data-v-2968a2f6"),s=s(),n.popScopeId(),s),XE={class:"row-landing__game-status"},ZE={class:"row-landing__game-actions"},QE={class:"row-full__game-status"},eT={class:"row-full__game-info"},tT={key:0},sT={class:"row-full__game-actions"},aT={class:"game-events-container"},nT=mn(()=>n.createElementVNode("div",{class:"separator"},null,-1)),iT=mn(()=>n.createElementVNode("div",null,null,-1)),oT={class:"game-events__data"},rT={class:"game-events__data__team"},lT=["src"],cT={class:"game-events__data__team__event__text"},dT={class:"game-events__data__team away"},hT={class:"game-events__data__team__event__text"},uT=["src"],mT=mn(()=>n.createElementVNode("div",null,null,-1)),fT=mn(()=>n.createElementVNode("div",null,null,-1)),pT={__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===Rt.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(Ph,{game:s.game,"is-landing-mode":s.isLandingMode},null,8,["game","is-landing-mode"]),n.createElementVNode("div",XE,[n.createVNode(Fh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Dh)(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",ZE,[s.game.home_team?(n.openBlock(),n.createBlock(NE,{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",QE,[n.createVNode(Fh,{status:s.game.game_status,"is-live":!!s.game.is_live,"date-time-millis":s.game.dateTimeMillis,"round-abbreviation":n.unref(Dh)(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",eT,[n.createVNode(Ph,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",tT,n.toDisplayString(s.game.tv_stations.join(", ")),1)):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0),n.createElementVNode("div",sT,[s.game.home_team?(n.openBlock(),n.createBlock(JE,{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",aT,[nT,n.createElementVNode("div",{class:n.normalizeClass(["game-events",u.value.events])},[iT,n.createElementVNode("div",oT,[n.createElementVNode("div",rT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.homeTeam,(S,w)=>(n.openBlock(),n.createElementBlock("div",{key:`h${w}`,class:"game-events__data__team__event"},[n.createElementVNode("img",{src:S.iconUrl},null,8,lT),n.createElementVNode("div",cT,n.toDisplayString(S.text),1)]))),128))]),n.createElementVNode("div",dT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value.awayTeam,(S,w)=>(n.openBlock(),n.createElementBlock("div",{key:`a${w}`,class:"game-events__data__team__event"},[n.createElementVNode("div",hT,n.toDisplayString(S.text),1),n.createElementVNode("img",{src:S.iconUrl},null,8,uT)]))),128))])]),mT,fT],2)],512),[[n.vShow,i.value]])]),_:1})],4))}},Mh=It(pT,[["__scopeId","data-v-2968a2f6"]]),gT={class:"calendar-table"},yT={__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",gT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.gamesPerPage,(l,d)=>(n.openBlock(),n.createBlock(Mh,{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))]))}},bT=It(yT,[["__scopeId","data-v-c7bf1232"]]),ST={class:"calendar-by-team"},_T={class:"playing-as-picker"},wT={class:"calendar-by-team__page"},kT={__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",ST,[n.createElementVNode("div",_T,[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",wT,[(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(Mh,{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"])]))}},ET=It(kT,[["__scopeId","data-v-6e0e406c"]]),TT="_liveMinutes_1utnm_2",CT="_viewButtomEvent_1utnm_6",xT="_containerEvents_1utnm_20",vT="_sepEvents_1utnm_26",AT="_goalsContainer_1utnm_36",LT="_yellowContainer_1utnm_44",IT="_redContainer_1utnm_52",RT="_containerEventsGameHometeam_1utnm_60",BT="_containerEventsGameAwayteam_1utnm_73",NT="_image62Icon_1utnm_86",DT="_imgChivasIcon_1utnm_95",PT="_nameDesktop_1utnm_102",OT="_nameMobile_1utnm_115",FT="_homeTeam_1utnm_127",MT="_sbado16De_1utnm_138",VT="_gameDate_1utnm_147",$T="_sab16092023_1utnm_151",zT="_div_1utnm_164",UT="_divscore_1utnm_173",GT="_cst_1utnm_183",jT="_hour_1utnm_192",HT="_score_1utnm_193",WT="_chivasTvCanal_1utnm_204",KT="_gameStatus_1utnm_216",qT="_matchInfo_1utnm_227",YT="_image62Icon1_1utnm_241",JT="_name_1utnm_102",XT="_imgAtlasIcon_1utnm_263",ZT="_name1_1utnm_270",QT="_awayTeam_1utnm_282",eC="_matchCard_1utnm_293",tC={liveMinutes:TT,viewButtomEvent:CT,containerEvents:xT,sepEvents:vT,goalsContainer:AT,yellowContainer:LT,redContainer:IT,containerEventsGameHometeam:RT,containerEventsGameAwayteam:BT,image62Icon:NT,imgChivasIcon:DT,nameDesktop:PT,nameMobile:OT,homeTeam:FT,sbado16De:MT,gameDate:VT,sab16092023:$T,div:zT,divscore:UT,cst:GT,hour:jT,score:HT,chivasTvCanal:WT,gameStatus:KT,matchInfo:qT,image62Icon1:YT,name:JT,imgAtlasIcon:XT,name1:ZT,awayTeam:QT,matchCard:eC},sC=["src"],aC=["src"],nC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),iC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),oC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),rC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),lC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),cC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),dC=n.createElementVNode("img",{src:"http://golstatsimages.blob.core.windows.net/todoelfut/point-indicador-live.png"},null,-1),hC={key:0},uC=n.createElementVNode("div",null,"ver eventos",-1),mC=n.createElementVNode("img",{width:"13",style:{"margin-top":"1px"},src:"http://golstatsimages.blob.core.windows.net/todoelfut/arrow-live-down.png"},null,-1),fC=["src"],pC=["src"],gC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},yC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},bC={key:0,width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},SC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/players-goals-con-goles.png"},null,-1),_C=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/red_card.png"},null,-1),wC=n.createElementVNode("img",{width:"10",src:"https://az755631.vo.msecnd.net/todoelfut/yellow_card.png"},null,-1),kC={__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,sC),n.createElementVNode("img",{class:n.normalizeClass(h.$style.imgChivasIcon),alt:"",src:n.unref(Ns)(r.value.home_team.team_id)},null,10,aC),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)},[nC,(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)},[iC,(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)},[oC,(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)},[rC,(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)},[lC,(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)},[cC,(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||r.value.game_status!=1&&r.value.game_status!=4?(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)},[dC,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",hC," - 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))},[uC,n.createTextVNode(" "),mC],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,fC),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,pC),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",gC)):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",yC)):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",bC)):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)},[SC,(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)},[_C,(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)},[wC,(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))}},EC={$style:tC},TC=It(kC,[["__cssModules",EC]]),CC={class:"calendar-by-game__carousel"},xC="https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",vC={__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),w=n.computed(()=>t.isCup),x=n.computed(()=>t.isCupLegacy),T=n.computed(()=>({height:t.height,width:t.width})),v=n.computed(()=>{if(t.games)return Ce(t.games,t.isTeamGamePerPage);{const j=u.value.get(h.value.key);return j&&t.isTeamGamePerPage&&t.onlyGamesTeamId?[j[0].filter(Y=>Y.home_team.team_id===t.onlyGamesTeamId||Y.visiting_team.team_id===t.onlyGamesTeamId)]:j||[]}}),E=n.computed(()=>t.areGamesCarouselType?v.value[0]:v.value),B=n.ref([]),I=n.ref(new Map),R=n.ref([]),M=n.computed(()=>{const j=R.value&&R.value.length?se(l.value):H(l.value),Y=B.value.find(G=>G.key===j);return Y&&f.value&&(K(!1),tt(Y)),j});n.watch(()=>t.seasons,j=>{j&&j.length&&(K(!0),r.value=j.map(Y=>Y.id),ce(j,!0))},{immediate:!0,deep:!0}),n.watch(u,j=>{if(t.onlyGamesTeamId&&j.size){const Y=Array.from(j.values()).reduce((G,$)=>($.forEach(z=>{const ie=z.find(ye=>ye.home_team.team_id===t.onlyGamesTeamId||ye.visiting_team.team_id===t.onlyGamesTeamId);ie&&G.push(ie)}),G),[]);e("change-games-by-client-privileges",Y)}},{immediate:!0});function K(j){f.value=j}function H(j){const Y=new Date().valueOf(),G=Object.entries(Object.entries(j).reduce((z,[ie,ye])=>(z[ie]=null,ye.forEach(Fe=>{Fe.games.forEach(dt=>{if([1,0].includes(dt.game_status)||dt.is_live){const Xs=Y-dt.dateTimeMillis;(z[ie]===null||Xs<z[ie])&&(z[ie]=Xs)}})}),z),{}));if(!G.length)return"1";const $=G.reduce((z,[ie,ye])=>{if(ye!==null){const Fe=I.value.get(ie);(z.shortestMillisToNow===null||ye<z.shortestMillisToNow&&Fe.index>=z.scheduleKey.index)&&(z.shortestMillisToNow=ye,z.round=ie,z.scheduleKey=Fe)}return z},{round:"",shortestMillisToNow:null,scheduleKey:null});return $.shortestMillisToNow!==null?$.round:G[G.length-1][0]}function se(j){let Y=1;if(R.value.length){const G=R.value[0];for(const[$,z]of Object.entries(j))for(const ie of z)if(ie.games.find(ye=>ye.game_id===G.game_id))return $}return Y}n.watch(()=>t.teamId,()=>{Te()},{immediate:!0});async function oe(j,Y,G=""){let $=G;try{const z={};t.token&&(z.Authorization=t.token),$||($="https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",j.forEach((Fe,dt)=>{$+=`${dt===0?"":"&"}seasons=${Fe}`}));const{data:{data:ie,teams:ye}}=await un.get($,{headers:z});return{seasonsAndGames:ie,seasonsAndTeams:ye}}catch(z){if(Y>0)return oe(j,Y-1,$);throw new Error(z)}}function ne(j){for(const Y of j)if(!r.value.includes(Y.season_id))return!0;return!1}async function ce(j,Y){try{l.value={};let G=0;const{seasonsAndGames:$,seasonsAndTeams:z}=await oe(j.map(ye=>ye.id),3);if(Y&&ne($))return;$.forEach(ye=>{const{type:Fe}=j.find(dt=>dt.id===ye.season_id);ye.type=Fe,ye.games.forEach(dt=>{dt.season_id=ye.season_id}),Fe===0&&(G=ye.season_id)}),p.value={seasonsGames:$};const{teams:ie}=z.find(ye=>ye.season_id===G);m.value=ie,e("change-teams",ie),Te(),S.value.size?q():await de()}catch(G){throw new Error(G)}}async function de(){try{const j=await te(),Y=new Set;if(y.value=j.data.reduce((G,$)=>($.games.forEach(z=>{Y.add(z.game_id),G.push(z)}),G),[]),y.value.length){i||await Z();const G=[];S.value.forEach($=>{const z=b.value.get($);z&&new Date().valueOf()>z.dateTimeMillis&&G.push($)}),G.length&&G.every($=>b.value.get($).isLiveTracked)&&X()}}catch(j){throw new Error(j)}}async function Z(){try{const j=[];for(const G of y.value){const $=b.value.get(G.game_id);$&&($.is_live=1,$.game_status=4,$.scheduleKey&&$.scheduleKey.liveGamesIds.add(G.game_id)),$.isLiveTracked=!0,j.push(xe(G.game_id))}const Y=await Promise.all(j);for(const G of Y){const $=b.value.get(G.game_id);if($){const z=[Number(G.score[$.home_team.team_id.toString()])+Number(G.score[`own_${$.visiting_team.team_id.toString()}`]),Number(G.score[$.visiting_team.team_id.toString()])+Number(G.score[`own_${$.home_team.team_id.toString()}`])],ie=z[0],ye=z[1];$.score=[Number.isNaN(ie)?0:ie,Number.isNaN(ye)?0:ye],be($,G.plays)}}i||J()}catch(j){throw new Error(j)}}function q(){S.value.size&&S.value.forEach(j=>{const Y=b.value.get(j);if(Y){const G=new Date().valueOf();if(60*1e3*30+Y.dateTimeMillis-G>0){const $=Y.dateTimeMillis-G-3e5;setTimeout(()=>{he()},$>0?$:0)}}})}function he(){X(),o||(o=setInterval(()=>{de()},t.checkLiveGamesIntervalMinutes*60*1e3))}function J(){ue(),i=setInterval(()=>{Z()},t.gamesEventsIntervalMinutes*60*1e3)}function X(){clearInterval(o),o=null}function ue(){clearInterval(i),i=null}function be(j,Y){for(const G of Y)if(G.category_id===0&&G.game_status_id===13){const $=b.value.get(G.game_id);y.value=y.value.filter(z=>z.game_id!==j.game_id),$.is_live=0,$.game_status=0,$.scheduleKey&&$.scheduleKey.liveGamesIds.delete(j.game_id)}}async function xe(j){try{return(await un.get(`${xC}${j}`,{headers:{Authorization:`${t.token}`}})).data}catch(Y){throw new Error(Y)}}async function te(){try{if(t.seasons.length===0)return[];const j=t.seasons.reduce(($,z)=>`${$}seasons=${z.id}&`,""),Y=un.create({headers:{Authorization:`${t.token}`}}),{data:G}=await Y.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${j}`);return G}catch(j){throw new Error(j)}}function Te(){if(X(),!m.value)return;b.value.clear(),S.value.clear(),R.value=[];const j=p.value&&p.value.seasonsGames?p.value.seasonsGames.map(Y=>{const G=Y.games.reduce(($,z)=>{if(t.onlyGamesTeamId&&t.onlyGamesTeamId!==z.home_team&&t.onlyGamesTeamId!==z.visiting_team)return $;const ie={...z},ye=new Date,[Fe,dt,Xs]=ie.date.split("-"),[La,Ei,Ia]=ie.schedule.split(":"),Ti=new Date(Number(Fe),Number(dt)-1,Number(Xs),Number(La),Number(Ei),Number(Ia));return ie.dateTimeMillis=Ti.valueOf(),ie.home_team=m.value.find(ql=>ql.team_id===z.home_team),ie.visiting_team=m.value.find(ql=>ql.team_id===z.visiting_team),ie.game_status===4&&ye.getFullYear()===Ti.getFullYear()&&ye.getMonth()===Ti.getMonth()&&ye.getDate()===Ti.getDate()&&S.value.add(ie.game_id),b.value.set(ie.game_id,ie),t.teamId&&ie.home_team.team_id!==t.teamId&&ie.visiting_team.team_id!==t.teamId||($[z.matchday_abbreviation]?$[z.matchday_abbreviation][z.game_status===3?"canceled":z.date]?$[z.matchday_abbreviation][z.game_status===3?"canceled":z.date].push(ie):$[z.matchday_abbreviation][z.game_status===3?"canceled":z.date]=[ie]:$[z.matchday_abbreviation]={[z.game_status===3?"canceled":z.date]:[ie]},t.userTeamId&&ie.game_status===4&&(ie.home_team.team_id===t.userTeamId||ie.visiting_team.team_id===t.userTeamId)&&R.value.push(ie)),$},{});for(let[$,z]of Object.entries(G))G[$]=Object.entries(z).map(([ie,ye])=>({date:ie,games:ye.sort((Fe,dt)=>Fe.dateTimeMillis-dt.dateTimeMillis)})),G[$].sort((ie,ye)=>ie.date<ye.date?-1:ie.date>ye.date?1:0);return{type:Y.type,weight:Y.type===0?0:Y.type===2?1:2,schedule:G}}):[];j.sort((Y,G)=>Y.weight-G.weight),l.value=j.reduce((Y,G)=>{for(const[$,z]of Object.entries(G.schedule))if(G.type===0)if([1,2].includes(t.tournamentType)){const ie=Fk.get(t.tournamentType);if(ie){const ye=ie.get($);ye&&(Y[ye.matchDayAbbreviation]=z)}}else if(w.value){const ie=$.replace("M",""),ye=ie;x.value?Y[Ok[ie]||ye]=z:Y[Pk[$]||ye]=z}else Y[Number($.replace("M","")).toString()]=z;else G.type===2?$.charAt(1)=="I"?Y[`PI${Number($.replace("PI",""))}`]=z:Y[`R${Number($.replace("PO",""))}`]=z:G.type===1&&(Y[Dk[$]]=z);return Y},{}),u.value=new Map,I.value.clear(),B.value=Array.from(Object.entries(l.value).reduce((Y,[G,$],z)=>{const ie=Number(G);let ye="";Number.isNaN(ie)?ye=G:ye=ie<10?`0${ie}`:G;const Fe={key:G,value:ie,valueText:ye,index:z,liveGamesIds:new Set};I.value.set(G,Fe),Y.set(G,Fe);const dt=$.reduce((La,Ei)=>(Ei.games.forEach(Ia=>{Ia.game_id===t.defaultGameId&&(g.value=G),Ia.roundAbbreviation=Number.isNaN(ie)?ie:`J ${ie}`,Ia.scheduleKey=Fe}),La=La.concat(Ei.games),La),[]),Xs=Ce(dt);return u.value.set(G,Xs),Y},new Map).values())}function Ce(j,Y=!1){const G=[];if(t.gamesPerMatchDay>0){let $=[];j.forEach((z,ie)=>{$.push(z),(ie+1)%t.gamesPerMatchDay===0&&(G.push([...$]),$=[])}),$.length&&G.push([...$])}else G.push(j);return Y&&t.isTeamGamePerPage&&t.defaultGameId?G.filter($=>$.game_id===t.defaultGameId||$.gameId===t.defaultGameId):G}async function Oe(j){try{const{data:Y}=await un.get("https://kefloixzy1.execute-api.us-west-2.amazonaws.com/prod/tournaments");return Y}catch(Y){if(j>0)return Oe(j-1);throw new Error(Y)}}function ot(){if(window.ResizeObserver)a=new ResizeObserver(()=>{d.value=c.value.clientWidth}),a.observe(c.value);else throw new Error("Resize observer not supported!")}function tt(j){h.value.value!==j.value&&(h.value=j,e("change-round",j))}function ct(j){t.areGamesCarouselType&&e("change-game-carousel",j.selectedItem)}function C(j){e("action",j),U(j)}function W(j){e("open-modal-event",j)}function U(j){const Y="PLAY_RESUME",G="PLAY_GOALS",$=[607,608,12,55,54,35,14,52,15,53,466,477],z=[12,55,"35_r","54_r"],{game_id:ie,season_id:ye}=j.game;let Fe={seasonId:ye,tournaments:[],isFeaturedPlayers:!1,mainSectionType:1,playListType:1,gameIdsToFilter:[ie],playerIds:[],goalkeeperIds:[],categoryIds:[],teamId:0,matchResult:[],categorySingleName:"",avoidCategorySingleName:!1,currentPlayIndex:0,playData:null,lastClashedGameId:null,tournamentsLastClashes:null,advancedFilter:{playListTitle:""},objectPlaySync:null};j.action===Y?(Fe.categoryIds=$,Fe.advancedFilter.playListTitle="Resumen",e("openmedia",Fe)):j.action===G&&(Fe.categoryIds=z,Fe.advancedFilter.playListTitle="Goles",e("openmedia",Fe))}async function me(){try{if(!t.awaitForSeasons&&!t.games){const j=(await Oe(3)).find($=>$._id===1),Y=j.seasons[0],G=[{id:Y.id,type:Y.type}];j&&j.tournament&&e("tournament-selected",j.tournament),Y.related_seasons&&Y.related_seasons.length&&G.push(...Y.related_seasons.map($=>({id:$.id,type:$.type}))),await ce(G,!1)}}catch(j){throw new Error(j)}}return n.onMounted(()=>{ot()}),me(),(j,Y)=>(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(ET,{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:C},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&&B.value?(n.openBlock(),n.createBlock(aE,{key:0,"match-days":B.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?M.value:"",onChangeMatchDay:tt},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",CC,[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:ct},{default:n.withCtx(({item:G})=>[s.areGamesCarouselType?(n.openBlock(),n.createBlock(TC,{key:0,is_captured:s.is_captured,game:G,onOpenModalEvent:W,"plays-live":s.playsLive,"info-live":s.infoLive},null,8,["is_captured","game","plays-live","info-live"])):(n.openBlock(),n.createBlock(bT,{key:1,"team-id":s.teamId,"show-videos":s.showVideos,"games-per-page":G,"is-landing-mode":s.isLandingMode,"row-height":s.rowHeight,"component-width":d.value,"is-round-mode":s.isRoundMode,onAction:C},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))}},AC=It(vC,[["__scopeId","data-v-b77219eb"]]),LC=["Mi posición","Tabla General","Fases","Play Off"],IC={components:{GscSwitchComponent:bo,GSCGeneraltable:rw,GSCCalendarByGame:AC},props:{privileges:{type:Object,default:()=>{}},isPublic:{type:Boolean,default:!0},isPlayer:{type:Boolean,default:!1},isPlayerTournament:{type:Boolean,default:!1},isGeneric:{type:Boolean,default:!1},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 LC.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"}},RC={key:0,class:"gsc-switch-container"},BC={class:"gsc-app-component"},NC={key:0};function DC(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",{key:1,class:n.normalizeClass(["gsc-switch-container",t.isPlayer&&t.isPlayerTournament||!t.isGeneric?"gsc-switch-container-player":""])},[t.isPlayerTournament?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t.isPublic?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Tabla General")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t.isGeneric?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Tabla General")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Mi posición")],64))],64))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Tabla General")],64))],2)):(n.openBlock(),n.createElementBlock("div",RC,[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",BC,[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",NC,[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 PC=Ye(IC,[["render",DC],["__scopeId","data-v-588d8b15"]]),Vh=["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],$h=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],zh=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],OC={class:"match"},FC={class:"match__header"},MC={key:0,class:"match__final-tag"},VC={key:1,class:"match__final-tag__no-border"},$C={class:"match__header__match-date"},zC={class:"match__tag"},UC={class:"match__body"},GC={class:"match__data"},jC={class:"match__acronym"},HC=["src"],WC={class:"match__score"},KC=["src"],qC={class:"match__acronym"},YC={class:"match__status"},fn=Ye({__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`${Vh[a.getDay()]}, ${a.getDate()} de ${$h[a.getMonth()]}`});return(a,i)=>{var o,r,l;return n.openBlock(),n.createElementBlock("section",OC,[n.createElementVNode("div",FC,[s.infoType=="postmatch"?(n.openBlock(),n.createElementBlock("div",MC,"FINAL")):(n.openBlock(),n.createElementBlock("div",VC)),n.createElementVNode("div",$C,n.toDisplayString(t.value),1),n.createElementVNode("div",zC,n.toDisplayString(`${Number.isNaN(Number(s.data.roundAbbreviationV2))?"":"J"}${s.data.roundAbbreviationV2}`),1)]),n.createElementVNode("div",UC,[n.createElementVNode("div",GC,[n.createElementVNode("div",jC,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,HC),n.createElementVNode("div",WC,[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,KC),n.createElementVNode("div",qC,n.toDisplayString((l=s.data)==null?void 0:l.visiting_team_acronym),1)]),n.createElementVNode("div",YC,[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"))},"Ver →")])}}},[["__scopeId","data-v-2d7ed7f2"]]),Uh=s=>(n.pushScopeId("data-v-540e357c"),s=s(),n.popScopeId(),s),JC=["src"],XC=["src"],ZC={class:"coming-match__body"},QC={class:"coming-match__data"},ex=["src"],tx={key:0,class:"coming-match__live"},sx={class:"coming-match__live__score"},ax={class:"coming-match__live__time"},nx=Uh(()=>n.createElementVNode("div",{class:"bullet"},null,-1)),ix=Uh(()=>n.createElementVNode("div",{class:"coming-match__live__time__text"},"LIVE",-1)),ox={class:"coming-match__live__time__time"},rx={key:1,style:{"margin-top":"16px"}},lx={class:"coming-match__time"},cx={class:"coming-match__cst"},dx={key:0},hx=["src"],Ds=Ye({__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`${Vh[i.getDay()]}, ${i.getDate()} de ${e.small?zh[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,w,x;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,JC),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,XC),n.createElementVNode("div",ZC,[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",QC,[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,ex),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",tx,[n.createElementVNode("div",sx,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",ax,[nx,ix,n.createElementVNode("div",ox,n.toDisplayString(s.data.currentTimeLive||"0'"),1)])])):(n.openBlock(),n.createElementBlock("div",rx,[n.createElementVNode("div",lx,[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",cx,[s.data.game_status===4?(n.openBlock(),n.createElementBlock("span",dx,"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/"+((w=s.data)==null?void 0:w.visiting_team.team_id)+".png":"https://az755631.vo.msecnd.net/teams-80/"+((x=s.data)==null?void 0:x.visiting_team)+".png",alt:"team-img"},null,10,hx)],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("Ver →")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Ver →")],64))],2)],2)}}},[["__scopeId","data-v-540e357c"]]),pn=s=>(n.pushScopeId("data-v-8a08c1a3"),s=s(),n.popScopeId(),s),ux={class:"game-item__header"},mx={class:"game-item__header__info text-type-1"},fx={key:0,class:"game-item__header__info__live"},px=pn(()=>n.createElementVNode("div",{class:"game-item__header__info__live__status text-type-2"},[n.createElementVNode("div",{class:"bullet"}),n.createElementVNode("span",null,"LIVE")],-1)),gx={class:"text-type-1"},yx={key:1,class:"game-item__header__info__pre-match text-type-2"},bx=pn(()=>n.createElementVNode("span",{class:"game-item__header__info__pre-match text-type-1"},[n.createTextVNode(" "),n.createElementVNode("small",null,"CST")],-1)),Sx={key:2,class:"game-item__header__info__post-match"},_x=[pn(()=>n.createElementVNode("span",{class:"text-type-2"},"Finalizado",-1))],wx={class:"game-item__body"},kx={class:"game-item__body__team__info"},Ex=["src"],Tx={class:"game-item__body__team__info__acronym"},Cx={class:"game-item__body__team__score"},xx=[pn(()=>n.createElementVNode("div",null,"Ver →",-1))],vx=Ye({__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()} ${zh[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",ux,[n.createElementVNode("div",mx,n.toDisplayString(a.value),1),s.game.is_live?(n.openBlock(),n.createElementBlock("div",fx,[px,n.createElementVNode("div",gx,n.toDisplayString(s.game.currentTimeLive||"0'"),1)])):s.game.game_status===4?(n.openBlock(),n.createElementBlock("div",yx,[n.createTextVNode(n.toDisplayString(i.value)+" ",1),bx])):(n.openBlock(),n.createElementBlock("div",Sx,_x))]),n.createElementVNode("div",wx,[(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",kx,[n.createElementVNode("img",{src:c.teamLogo,alt:"team-logo"},null,8,Ex),n.createElementVNode("div",Tx,n.toDisplayString(c.acronym),1)]),n.createElementVNode("div",Cx,[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},xx)],2))}},[["__scopeId","data-v-8a08c1a3"]]),Ax=Ye({__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.4
|
|
30
30
|
* (c) 2024
|
|
31
31
|
* @license MIT
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const a=new this(e);return t.forEach(i=>a.set(i)),a}static accessor(e){const t=(this[um]=this[um]={accessors:{}}).accessors,a=this.prototype;function i(o){const r=_a(o);t[r]||(f4(a,o),t[r]=!0)}return P.isArray(e)?e.forEach(i):i(e),this}}Rn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),P.reduceDescriptors(Rn.prototype,({value:s},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>s,set(a){this[t]=a}}}),P.freezeMethods(Rn);const Dt=Rn;function Lr(s,e){const t=this||vr,a=e||t,i=Dt.from(a.headers);let o=a.data;return P.forEach(s,function(r){o=r.call(t,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function mm(s){return!!(s&&s.__CANCEL__)}function Ms(s,e,t){Ee.call(this,s??"canceled",Ee.ERR_CANCELED,e,t),this.name="CanceledError"}P.inherits(Ms,Ee,{__CANCEL__:!0});function fm(s,e,t){const a=t.config.validateStatus;!t.status||!a||a(t.status)?s(t):e(new Ee("Request failed with status code "+t.status,[Ee.ERR_BAD_REQUEST,Ee.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function p4(s){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return e&&e[1]||""}function g4(s,e){s=s||10;const t=new Array(s),a=new Array(s);let i=0,o=0,r;return e=e!==void 0?e:1e3,function(l){const d=Date.now(),c=a[o];r||(r=d),t[i]=l,a[i]=d;let h=o,u=0;for(;h!==i;)u+=t[h++],h=h%s;if(i=(i+1)%s,i===o&&(o=(o+1)%s),d-r<e)return;const f=c&&d-c;return f?Math.round(u*1e3/f):void 0}}function y4(s,e){let t=0,a=1e3/e,i,o;const r=(l,d=Date.now())=>{t=d,i=null,o&&(clearTimeout(o),o=null),s.apply(null,l)};return[(...l)=>{const d=Date.now(),c=d-t;c>=a?r(l,d):(i=l,o||(o=setTimeout(()=>{o=null,r(i)},a-c)))},()=>i&&r(i)]}const Bn=(s,e,t=3)=>{let a=0;const i=g4(50,250);return y4(o=>{const r=o.loaded,l=o.lengthComputable?o.total:void 0,d=r-a,c=i(d),h=r<=l;a=r;const u={loaded:r,total:l,progress:l?r/l:void 0,bytes:d,rate:c||void 0,estimated:c&&l&&h?(l-r)/c:void 0,event:o,lengthComputable:l!=null,[e?"download":"upload"]:!0};s(u)},t)},pm=(s,e)=>{const t=s!=null;return[a=>e[0]({lengthComputable:t,total:s,loaded:a}),e[1]]},gm=s=>(...e)=>P.asap(()=>s(...e)),b4=yt.hasStandardBrowserEnv?function(){const s=yt.navigator&&/(msie|trident)/i.test(yt.navigator.userAgent),e=document.createElement("a");let t;function a(i){let o=i;return s&&(e.setAttribute("href",o),o=e.href),e.setAttribute("href",o),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return t=a(window.location.href),function(i){const o=P.isString(i)?a(i):i;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}(),S4=yt.hasStandardBrowserEnv?{write(s,e,t,a,i,o){const r=[s+"="+encodeURIComponent(e)];P.isNumber(t)&&r.push("expires="+new Date(t).toGMTString()),P.isString(a)&&r.push("path="+a),P.isString(i)&&r.push("domain="+i),o===!0&&r.push("secure"),document.cookie=r.join("; ")},read(s){const e=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(s){this.write(s,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function _4(s){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function w4(s,e){return e?s.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):s}function ym(s,e){return s&&!_4(e)?w4(s,e):e}const bm=s=>s instanceof Dt?{...s}:s;function ws(s,e){e=e||{};const t={};function a(c,h,u){return P.isPlainObject(c)&&P.isPlainObject(h)?P.merge.call({caseless:u},c,h):P.isPlainObject(h)?P.merge({},h):P.isArray(h)?h.slice():h}function i(c,h,u){if(P.isUndefined(h)){if(!P.isUndefined(c))return a(void 0,c,u)}else return a(c,h,u)}function o(c,h){if(!P.isUndefined(h))return a(void 0,h)}function r(c,h){if(P.isUndefined(h)){if(!P.isUndefined(c))return a(void 0,c)}else return a(void 0,h)}function l(c,h,u){if(u in e)return a(c,h);if(u in s)return a(void 0,c)}const d={url:o,method:o,data:o,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:l,headers:(c,h)=>i(bm(c),bm(h),!0)};return P.forEach(Object.keys(Object.assign({},s,e)),function(c){const h=d[c]||i,u=h(s[c],e[c],c);P.isUndefined(u)&&h!==l||(t[c]=u)}),t}const Sm=s=>{const e=ws({},s);let{data:t,withXSRFToken:a,xsrfHeaderName:i,xsrfCookieName:o,headers:r,auth:l}=e;e.headers=r=Dt.from(r),e.url=lm(ym(e.baseURL,e.url),s.params,s.paramsSerializer),l&&r.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(P.isFormData(t)){if(yt.hasStandardBrowserEnv||yt.hasStandardBrowserWebWorkerEnv)r.setContentType(void 0);else if((d=r.getContentType())!==!1){const[c,...h]=d?d.split(";").map(u=>u.trim()).filter(Boolean):[];r.setContentType([c||"multipart/form-data",...h].join("; "))}}if(yt.hasStandardBrowserEnv&&(a&&P.isFunction(a)&&(a=a(e)),a||a!==!1&&b4(e.url))){const c=i&&o&&S4.read(o);c&&r.set(i,c)}return e},k4=typeof XMLHttpRequest<"u",E4=k4&&function(s){return new Promise(function(e,t){const a=Sm(s);let i=a.data;const o=Dt.from(a.headers).normalize();let{responseType:r,onUploadProgress:l,onDownloadProgress:d}=a,c,h,u,f,p;function m(){f&&f(),p&&p(),a.cancelToken&&a.cancelToken.unsubscribe(c),a.signal&&a.signal.removeEventListener("abort",c)}let g=new XMLHttpRequest;g.open(a.method.toUpperCase(),a.url,!0),g.timeout=a.timeout;function y(){if(!g)return;const S=Dt.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),w={data:!r||r==="text"||r==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:S,config:s,request:g};fm(function(x){e(x),m()},function(x){t(x),m()},w),g=null}"onloadend"in g?g.onloadend=y:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(y)},g.onabort=function(){g&&(t(new Ee("Request aborted",Ee.ECONNABORTED,s,g)),g=null)},g.onerror=function(){t(new Ee("Network Error",Ee.ERR_NETWORK,s,g)),g=null},g.ontimeout=function(){let S=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const w=a.transitional||dm;a.timeoutErrorMessage&&(S=a.timeoutErrorMessage),t(new Ee(S,w.clarifyTimeoutError?Ee.ETIMEDOUT:Ee.ECONNABORTED,s,g)),g=null},i===void 0&&o.setContentType(null),"setRequestHeader"in g&&P.forEach(o.toJSON(),function(S,w){g.setRequestHeader(w,S)}),P.isUndefined(a.withCredentials)||(g.withCredentials=!!a.withCredentials),r&&r!=="json"&&(g.responseType=a.responseType),d&&([u,p]=Bn(d,!0),g.addEventListener("progress",u)),l&&g.upload&&([h,f]=Bn(l),g.upload.addEventListener("progress",h),g.upload.addEventListener("loadend",f)),(a.cancelToken||a.signal)&&(c=S=>{g&&(t(!S||S.type?new Ms(null,s,g):S),g.abort(),g=null)},a.cancelToken&&a.cancelToken.subscribe(c),a.signal&&(a.signal.aborted?c():a.signal.addEventListener("abort",c)));const b=p4(a.url);if(b&&yt.protocols.indexOf(b)===-1){t(new Ee("Unsupported protocol "+b+":",Ee.ERR_BAD_REQUEST,s));return}g.send(i||null)})},T4=(s,e)=>{let t=new AbortController,a;const i=function(d){if(!a){a=!0,r();const c=d instanceof Error?d:this.reason;t.abort(c instanceof Ee?c:new Ms(c instanceof Error?c.message:c))}};let o=e&&setTimeout(()=>{i(new Ee(`timeout ${e} of ms exceeded`,Ee.ETIMEDOUT))},e);const r=()=>{s&&(o&&clearTimeout(o),o=null,s.forEach(d=>{d&&(d.removeEventListener?d.removeEventListener("abort",i):d.unsubscribe(i))}),s=null)};s.forEach(d=>d&&d.addEventListener&&d.addEventListener("abort",i));const{signal:l}=t;return l.unsubscribe=r,[l,()=>{o&&clearTimeout(o),o=null}]},C4=T4,x4=function*(s,e){let t=s.byteLength;if(t<e){yield s;return}let a=0,i;for(;a<t;)i=a+e,yield s.slice(a,i),a=i},v4=async function*(s,e,t){for await(const a of s)yield*x4(ArrayBuffer.isView(a)?a:await t(String(a)),e)},_m=(s,e,t,a,i)=>{const o=v4(s,e,i);let r=0,l,d=c=>{l||(l=!0,a&&a(c))};return new ReadableStream({async pull(c){try{const{done:h,value:u}=await o.next();if(h){d(),c.close();return}let f=u.byteLength;if(t){let p=r+=f;t(p)}c.enqueue(new Uint8Array(u))}catch(h){throw d(h),h}},cancel(c){return d(c),o.return()}},{highWaterMark:2})},Nn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",wm=Nn&&typeof ReadableStream=="function",Ir=Nn&&(typeof TextEncoder=="function"?(s=>e=>s.encode(e))(new TextEncoder):async s=>new Uint8Array(await new Response(s).arrayBuffer())),km=(s,...e)=>{try{return!!s(...e)}catch{return!1}},A4=wm&&km(()=>{let s=!1;const e=new Request(yt.origin,{body:new ReadableStream,method:"POST",get duplex(){return s=!0,"half"}}).headers.has("Content-Type");return s&&!e}),Em=64*1024,Rr=wm&&km(()=>P.isReadableStream(new Response("").body)),Dn={stream:Rr&&(s=>s.body)};Nn&&(s=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Dn[e]&&(Dn[e]=P.isFunction(s[e])?t=>t[e]():(t,a)=>{throw new Ee(`Response type '${e}' is not supported`,Ee.ERR_NOT_SUPPORT,a)})})})(new Response);const L4=async s=>{if(s==null)return 0;if(P.isBlob(s))return s.size;if(P.isSpecCompliantForm(s))return(await new Request(s).arrayBuffer()).byteLength;if(P.isArrayBufferView(s)||P.isArrayBuffer(s))return s.byteLength;if(P.isURLSearchParams(s)&&(s=s+""),P.isString(s))return(await Ir(s)).byteLength},I4=async(s,e)=>P.toFiniteNumber(s.getContentLength())??L4(e),R4=Nn&&(async s=>{let{url:e,method:t,data:a,signal:i,cancelToken:o,timeout:r,onDownloadProgress:l,onUploadProgress:d,responseType:c,headers:h,withCredentials:u="same-origin",fetchOptions:f}=Sm(s);c=c?(c+"").toLowerCase():"text";let[p,m]=i||o||r?C4([i,o],r):[],g,y;const b=()=>{!g&&setTimeout(()=>{p&&p.unsubscribe()}),g=!0};let S;try{if(d&&A4&&t!=="get"&&t!=="head"&&(S=await I4(h,a))!==0){let E=new Request(e,{method:"POST",body:a,duplex:"half"}),B;if(P.isFormData(a)&&(B=E.headers.get("content-type"))&&h.setContentType(B),E.body){const[I,R]=pm(S,Bn(gm(d)));a=_m(E.body,Em,I,R,Ir)}}P.isString(u)||(u=u?"include":"omit");const w="credentials"in Request.prototype;y=new Request(e,{...f,signal:p,method:t.toUpperCase(),headers:h.normalize().toJSON(),body:a,duplex:"half",credentials:w?u:void 0});let x=await fetch(y);const T=Rr&&(c==="stream"||c==="response");if(Rr&&(l||T)){const E={};["status","statusText","headers"].forEach(M=>{E[M]=x[M]});const B=P.toFiniteNumber(x.headers.get("content-length")),[I,R]=l&&pm(B,Bn(gm(l),!0))||[];x=new Response(_m(x.body,Em,I,()=>{R&&R(),T&&b()},Ir),E)}c=c||"text";let v=await Dn[P.findKey(Dn,c)||"text"](x,s);return!T&&b(),m&&m(),await new Promise((E,B)=>{fm(E,B,{data:v,headers:Dt.from(x.headers),status:x.status,statusText:x.statusText,config:s,request:y})})}catch(w){throw b(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new Ee("Network Error",Ee.ERR_NETWORK,s,y),{cause:w.cause||w}):Ee.from(w,w&&w.code,s,y)}}),Br={http:WI,xhr:E4,fetch:R4};P.forEach(Br,(s,e)=>{if(s){try{Object.defineProperty(s,"name",{value:e})}catch{}Object.defineProperty(s,"adapterName",{value:e})}});const Tm=s=>`- ${s}`,B4=s=>P.isFunction(s)||s===null||s===!1,Cm={getAdapter:s=>{s=P.isArray(s)?s:[s];const{length:e}=s;let t,a;const i={};for(let o=0;o<e;o++){t=s[o];let r;if(a=t,!B4(t)&&(a=Br[(r=String(t)).toLowerCase()],a===void 0))throw new Ee(`Unknown adapter '${r}'`);if(a)break;i[r||"#"+o]=a}if(!a){const o=Object.entries(i).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let r=e?o.length>1?`since :
|
|
40
40
|
`+o.map(Tm).join(`
|
|
41
41
|
`):" "+Tm(o[0]):"as no adapter specified";throw new Ee("There is no suitable adapter to dispatch the request "+r,"ERR_NOT_SUPPORT")}return a},adapters:Br};function Nr(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new Ms(null,s)}function xm(s){return Nr(s),s.headers=Dt.from(s.headers),s.data=Lr.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),Cm.getAdapter(s.adapter||vr.adapter)(s).then(function(e){return Nr(s),e.data=Lr.call(s,s.transformResponse,e),e.headers=Dt.from(e.headers),e},function(e){return mm(e)||(Nr(s),e&&e.response&&(e.response.data=Lr.call(s,s.transformResponse,e.response),e.response.headers=Dt.from(e.response.headers))),Promise.reject(e)})}const vm="1.7.5",Dr={};["object","boolean","number","function","string","symbol"].forEach((s,e)=>{Dr[s]=function(t){return typeof t===s||"a"+(e<1?"n ":" ")+s}});const Am={};Dr.transitional=function(s,e,t){function a(i,o){return"[Axios v"+vm+"] Transitional option '"+i+"'"+o+(t?". "+t:"")}return(i,o,r)=>{if(s===!1)throw new Ee(a(o," has been removed"+(e?" in "+e:"")),Ee.ERR_DEPRECATED);return e&&!Am[o]&&(Am[o]=!0,console.warn(a(o," has been deprecated since v"+e+" and will be removed in the near future"))),s?s(i,o,r):!0}};function N4(s,e,t){if(typeof s!="object")throw new Ee("options must be an object",Ee.ERR_BAD_OPTION_VALUE);const a=Object.keys(s);let i=a.length;for(;i-- >0;){const o=a[i],r=e[o];if(r){const l=s[o],d=l===void 0||r(l,o,s);if(d!==!0)throw new Ee("option "+o+" must be "+d,Ee.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Ee("Unknown option "+o,Ee.ERR_BAD_OPTION)}}const Pr={assertOptions:N4,validators:Dr},is=Pr.validators;class Pn{constructor(e){this.defaults=e,this.interceptors={request:new cm,response:new cm}}async request(e,t){try{return await this._request(e,t)}catch(a){if(a instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{a.stack?o&&!String(a.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(a.stack+=`
|
|
42
|
-
`+o):a.stack=o}catch{}}throw a}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ws(this.defaults,t);const{transitional:a,paramsSerializer:i,headers:o}=t;a!==void 0&&Pr.assertOptions(a,{silentJSONParsing:is.transitional(is.boolean),forcedJSONParsing:is.transitional(is.boolean),clarifyTimeoutError:is.transitional(is.boolean)},!1),i!=null&&(P.isFunction(i)?t.paramsSerializer={serialize:i}:Pr.assertOptions(i,{encode:is.function,serialize:is.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let r=o&&P.merge(o.common,o[t.method]);o&&P.forEach(["delete","get","head","post","put","patch","common"],m=>{delete o[m]}),t.headers=Dt.concat(r,o);const l=[];let d=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(d=d&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let h,u=0,f;if(!d){const m=[xm.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,c),f=m.length,h=Promise.resolve(t);u<f;)h=h.then(m[u++],m[u++]);return h}f=l.length;let p=t;for(u=0;u<f;){const m=l[u++],g=l[u++];try{p=m(p)}catch(y){g.call(this,y);break}}try{h=xm.call(this,p)}catch(m){return Promise.reject(m)}for(u=0,f=c.length;u<f;)h=h.then(c[u++],c[u++]);return h}getUri(e){e=ws(this.defaults,e);const t=ym(e.baseURL,e.url);return lm(t,e.params,e.paramsSerializer)}}P.forEach(["delete","get","head","options"],function(s){Pn.prototype[s]=function(e,t){return this.request(ws(t||{},{method:s,url:e,data:(t||{}).data}))}}),P.forEach(["post","put","patch"],function(s){function e(t){return function(a,i,o){return this.request(ws(o||{},{method:s,headers:t?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Pn.prototype[s]=e(),Pn.prototype[s+"Form"]=e(!0)});const On=Pn;class Or{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const a=this;this.promise.then(i=>{if(!a._listeners)return;let o=a._listeners.length;for(;o-- >0;)a._listeners[o](i);a._listeners=null}),this.promise.then=i=>{let o;const r=new Promise(l=>{a.subscribe(l),o=l}).then(i);return r.cancel=function(){a.unsubscribe(o)},r},e(function(i,o,r){a.reason||(a.reason=new Ms(i,o,r),t(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new Or(function(t){e=t}),cancel:e}}}const D4=Or;function P4(s){return function(e){return s.apply(null,e)}}function O4(s){return P.isObject(s)&&s.isAxiosError===!0}const Fr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Fr).forEach(([s,e])=>{Fr[e]=s});const F4=Fr;function Lm(s){const e=new On(s),t=Wu(On.prototype.request,e);return P.extend(t,On.prototype,e,{allOwnKeys:!0}),P.extend(t,e,null,{allOwnKeys:!0}),t.create=function(a){return Lm(ws(s,a))},t}const Ge=Lm(vr);Ge.Axios=On,Ge.CanceledError=Ms,Ge.CancelToken=D4,Ge.isCancel=mm,Ge.VERSION=vm,Ge.toFormData=Ln,Ge.AxiosError=Ee,Ge.Cancel=Ge.CanceledError,Ge.all=function(s){return Promise.all(s)},Ge.spread=P4,Ge.isAxiosError=O4,Ge.mergeConfig=ws,Ge.AxiosHeaders=Dt,Ge.formToJSON=s=>hm(P.isHTMLForm(s)?new FormData(s):s),Ge.getAdapter=Cm.getAdapter,Ge.HttpStatusCode=F4,Ge.default=Ge;const Im=Ge,M4=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t},Mr={name:"ScrollableContainer",props:{backgroundColor:{type:String,default:"#0D1D29"},pxScroll:{type:Number,default:100},arrows:{type:Boolean,default:!0},arrowsHideOnNoScroll:{type:Boolean,default:!1},arrowsScrollHide:{type:Boolean,default:!1},arrowsColor:{type:String,default:"#CBEE6B"},arrowsHeight:{type:Number,default:15},arrowsWidth:{type:Number,default:15},arrowsPadding:{type:Number,default:5},arrowsMargin:{type:Number,default:10},arrowsRadius:{type:String,default:"0%"},arrowsBorder:{type:String,default:"none"},arrowsBackground:{type:String,default:"#0D1D29"},arrowsContainerBgL:{type:String,default:"#0D1D29"},arrowsContainerBgR:{type:String,default:"#0D1D29"},scrollColor:{type:String,default:"#c3e569"},arrowsPosition:{type:String,default:"relative"},height:{type:String,default:"100%"}},data(){return{showLeftArrow:!1,showRightArrow:!0,intervalid1:""}},mounted(){this.getScroll(),this.arrowsHideOnNoScroll&&window.addEventListener("resize",this.resizeSlider),this.arrowsHideOnNoScroll&&this.listenerLoad()},beforeUnmount(){this.arrowsHideOnNoScroll&&window.removeEventListener("resize",this.resizeSlider),this.arrowsHideOnNoScroll&&clearInterval(this.intervalid1)},computed:{getViewBox(){return`-2 0 ${this.arrowsWidth} ${this.arrowsHeight}`},hideShowLeftArrow(){let s="";return this.arrowsPosition=="absolute"?s="leftAbsolute":s="leftRelative",this.arrowsScrollHide?this.showLeftArrow?s+=" showArrowSlide":s+=" hideArrowSlide":s+=" showArrowSlide",s},hideShowRightArrow(){let s="";return this.arrowsPosition=="absolute"?s="rightAbsolute":s="rightRelative",this.arrowsScrollHide?this.showRightArrow?s+=" showArrowSlide":s+=" hideArrowSlide":s+=" showArrowSlide",s}},methods:{scrollLeft(){this.$refs.content.scrollLeft-=this.pxScroll},scrollRight(){this.$refs.content.scrollLeft+=this.pxScroll},getScroll(){let s=0;this.arrowsPosition=="relative"?s=this.$refs.content.scrollWidth-this.$el.clientWidth+this.arrowsMargin*2+this.arrowsWidth*4:s=this.$refs.content.scrollWidth-this.$el.clientWidth,this.$refs.content.scrollLeft==0?this.showLeftArrow=!1:this.showLeftArrow=!0,s>0&&(this.$refs.content.scrollLeft==s?this.showRightArrow=!1:this.showRightArrow=!0),this.arrowsHideOnNoScroll&&this.$refs.content.clientWidth===this.$refs.content.scrollWidth&&(this.showRightArrow=!1)},resizeSlider(){this.getScroll();let s;clearTimeout(s),s=setTimeout(this.getScroll,1e3)},listenerLoad(){this.intervalid1=setInterval((function(){var s=this.$el.clientWidth,e=this.$refs.content.scrollWidth;e>0&&s>0&&(e>s?(this.showRightArrow=!0,clearInterval(this.intervalid1)):clearInterval(this.intervalid1))}).bind(this),3e3)}}},Rm=()=>{n.useCssVars(s=>({"26acffa8":s.backgroundColor,"3d95bef4":s.height,"86ba1cc0":s.arrowsPosition,"140b6ada":s.arrowsPadding+"px","7df46be5":s.arrowsBackground,"33f99798":s.arrowsHeight*2+"px","1c8a858d":s.arrowsWidth*2+"px","4a7876c9":s.arrowsRadius,"2ff67e63":s.arrowsBorder,"59c5dd08":s.arrowsMargin+"px","6658215d":s.arrowsContainerBgL,66582163:s.arrowsContainerBgR,e5900a2e:s.scrollColor}))},Bm=Mr.setup;Mr.setup=Bm?(s,e)=>(Rm(),Bm(s,e)):Rm;const V4={ref:"gscScrollableContainer",class:"scrollable-container"},$4={class:"scrollable-arrows"},z4=["width","height","viewBox"],U4=["stroke"],G4={class:"scrollable-wrapper"},j4={class:"scrollable-arrows"},H4=["width","height","viewBox"],W4=["stroke"];function K4(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",V4,[t.arrows?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["arrows-container",o.hideShowLeftArrow]),onClick:e[0]||(e[0]=(...r)=>o.scrollLeft&&o.scrollLeft(...r))},[n.createElementVNode("div",$4,[(n.openBlock(),n.createElementBlock("svg",{width:t.arrowsWidth,height:t.arrowsHeight,viewBox:o.getViewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{d:"M6.36523 13.788L1.10146 8.52429C0.479824 7.90265 0.479824 6.88541 1.10147 6.26377L6.36523 1",stroke:t.arrowsColor},null,8,U4)],8,z4))])],2)):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"scrollable-content scrollable-content-slider",ref:"content",onScroll:e[1]||(e[1]=(...r)=>o.getScroll&&o.getScroll(...r))},[n.createElementVNode("div",G4,[n.renderSlot(s.$slots,"default",{},void 0,!0)])],544),t.arrows?(n.openBlock(),n.createElementBlock("div",{key:1,id:"arrows-container-right",class:n.normalizeClass(["arrows-container",o.hideShowRightArrow]),onClick:e[2]||(e[2]=(...r)=>o.scrollRight&&o.scrollRight(...r))},[n.createElementVNode("div",j4,[(n.openBlock(),n.createElementBlock("svg",{width:t.arrowsWidth,height:t.arrowsHeight,viewBox:o.getViewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{d:"M0.634765 1.21195L5.89853 6.47571C6.52018 7.09735 6.52018 8.11459 5.89853 8.73623L0.634766 14",stroke:t.arrowsColor},null,8,W4)],8,H4))])],2)):n.createCommentVNode("",!0)],512)}const q4=M4(Mr,[["render",K4],["__scopeId","data-v-7d0811ac"]]),os=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t};let Nm=null;const Vr={components:{},props:{titleCategory:{type:String,default:"RESUMEN"},dateGame:{type:String,default:""},showVideos:{type:Boolean,default:!0},colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},matchday:{type:String,default:""},seasonName:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""}},data(){return{gamesContainerGHWidth:0}},computed:{date(){const s=this.gamesContainerGHWidth;return s<=400?"date400":s<=540?"date540":s<=650?"date650":"date"},seasoncontainer(){const s=this.gamesContainerGHWidth;return s<=400?"season-container400":s<=540?"season-container540":s<=650?"season-container650":"season-container"},matchcontainer(){const s=this.gamesContainerGHWidth;return s<=400?"match-container400":s<=540?"match-container540":s<=650?"match-container650":"match-container"},containerinfogame(){const s=this.gamesContainerGHWidth;return s<=400?"container-info-game400":s<=540?"container-info-game540":s<=650?"container-info-game650":"container-info-game"},playbutton(){const s=this.gamesContainerGHWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},baselogo(){const s=this.gamesContainerGHWidth;return s<=400?"base-logo400":s<=540?"base-logo540":s<=650?"base-logo650":"base-logo"},baselogoright(){const s=this.gamesContainerGHWidth;return s<=400?"base-logo-right400":s<=540?"base-logo-right540":s<=650?"base-logo-right650":"base-logo-right"},thumbnailhighlights(){const s=this.gamesContainerGHWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},teamlogo(){const s=this.gamesContainerGHWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"},logoright(){const s=this.gamesContainerGHWidth;return s<=400?"logo-right400":s<=540?"logo-right540":s<=650?"logo-right650":"logo-right"},secondline(){const s=this.gamesContainerGHWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},titlename(){const s=this.gamesContainerGHWidth;return s<=400?"title-name400":s<=540?"title-name540":s<=650?"title-name650":"title-name"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Nm=new ResizeObserver(()=>{this.gamesContainerGHWidth=this.$refs.gamesContainerGH?this.$refs.gamesContainerGH.clientWidth:0,this.movil=this.gamesContainerGHWidth<740}),Nm.observe(this.$refs.gamesContainerGH);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Dm=()=>{n.useCssVars(s=>({a281566c:s.colorBackgroundHome+"45","692c47db":s.colorBackgroundAway+"45","229d672a":s.colorBackgroundHome,"229a5539":s.colorBackgroundAway}))},Pm=Vr.setup;Vr.setup=Pm?(s,e)=>(Dm(),Pm(s,e)):Dm;const Fn=s=>(n.pushScopeId("data-v-dd4b2ba3"),s=s(),n.popScopeId(),s),Y4=Fn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),J4=[Y4],X4=Fn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1)),Z4=["src"],Q4=Fn(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),eR=Fn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),tR=["src"],sR=["src"],aR={class:"text-container"};function nR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerGH",class:n.normalizeClass(o.thumbnailhighlights)},[t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},J4,2)):n.createCommentVNode("",!0),t.dateGame!=""?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.date)},n.toDisplayString(t.dateGame),3)):n.createCommentVNode("",!0),t.matchday!=""&&t.seasonName!=""?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(o.containerinfogame)},[t.matchday!=""?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.matchcontainer)},n.toDisplayString(t.matchday),3)):n.createCommentVNode("",!0),t.seasonName!=""?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.seasoncontainer)},n.toDisplayString(t.seasonName),3)):n.createCommentVNode("",!0)],2)):n.createCommentVNode("",!0),X4,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,Z4),n.createElementVNode("div",{class:n.normalizeClass([o.baselogo,"position-image"])},null,2),n.createElementVNode("div",{class:n.normalizeClass(o.baselogoright)},null,2),Q4,eR,n.createElementVNode("img",{src:t.logoHome,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,tR),n.createElementVNode("img",{src:t.logoAway,alt:"",class:n.normalizeClass(o.logoright)},null,10,sR),n.createElementVNode("div",aR,[n.createElementVNode("span",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.score),3),n.createElementVNode("div",{class:n.normalizeClass(o.titlename)},n.toDisplayString(t.titleCategory),3)])],2)}const iR=os(Vr,[["render",nR],["__scopeId","data-v-dd4b2ba3"]]);let Om=null;const $r={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},nameCategory:{type:String,default:""},photoProfile:{type:String,default:""},logoHome:{type:String,default:""},logoAway:{type:String,default:""},scoreHome:{type:[String,Number],default:""},scoreAway:{type:[String,Number],default:""},background:{type:String,default:""},typeImg:{type:Number,default:0},nameHomeTeam:{type:String,default:""},nameAwayTeam:{type:String,default:""},namePlayer:{type:String,default:""}},data(){return{gamesContainerCWidth:0}},computed:{playbutton(){const s=this.gamesContainerCWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},teamlogo(){const s=this.gamesContainerCWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"},firstline(){const s=this.gamesContainerCWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},secondline(){const s=this.gamesContainerCWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},playerimage(){const s=this.gamesContainerCWidth;return s<=400?"player-image400":s<=540?"player-image540":s<=650?"player-image650":"player-image"},thumbnailhighlights(){const s=this.gamesContainerCWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Om=new ResizeObserver(()=>{this.gamesContainerCWidth=this.$refs.gamesContainerC?this.$refs.gamesContainerC.clientWidth:0,this.movil=this.gamesContainerCWidth<740}),Om.observe(this.$refs.gamesContainerC);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Fm=()=>{n.useCssVars(s=>({"9cae8720":s.colorBackgroundHome,"58cca122":s.colorBackgroundHome+"36"}))},Mm=$r.setup;$r.setup=Mm?(s,e)=>(Fm(),Mm(s,e)):Fm;const wa=s=>(n.pushScopeId("data-v-ef4021c1"),s=s(),n.popScopeId(),s),oR=wa(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),rR=[oR],lR=wa(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),cR=["src"],dR=wa(()=>n.createElementVNode("div",{class:"base-logo"},null,-1)),hR=["src"],uR=wa(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),mR={class:"text-container"},fR={class:"player-image position-image"},pR=["src"],gR=["src"],yR=["src"],bR=wa(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function SR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerC",class:n.normalizeClass(o.thumbnailhighlights)},[n.createElementVNode("div",{class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},rR,2),lR,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,cR),dR,n.createElementVNode("img",{src:t.logoHome,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,hR),uR,n.createElementVNode("div",mR,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},n.toDisplayString(t.namePlayer),3),n.createElementVNode("span",{class:n.normalizeClass(o.secondline),style:n.normalizeStyle(t.nameCategory=="Balones recuperados en disputa "?"font-size: 25px":"")},n.toDisplayString(t.nameCategory),7)]),n.createElementVNode("div",fR,[t.typeImg==0?(n.openBlock(),n.createElementBlock("img",{key:0,src:t.photoProfile,class:n.normalizeClass(o.playerimage)},null,10,pR)):n.createCommentVNode("",!0),t.typeImg==1?(n.openBlock(),n.createElementBlock("img",{key:1,src:t.photoProfile,alt:""},null,8,gR)):n.createCommentVNode("",!0),t.typeImg==2?(n.openBlock(),n.createElementBlock("img",{key:2,src:t.photoProfile,class:"img-number"},null,8,yR)):n.createCommentVNode("",!0)]),bR],2)}const _R=os($r,[["render",SR],["__scopeId","data-v-ef4021c1"]]);let Vm=null;const zr={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},showVideos:{type:Boolean,default:!0},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""},nameTeam:{type:String,default:""},nameCategory:{type:String,default:""}},data(){return{gamesContainerCTWidth:0}},computed:{playbutton(){const s=this.gamesContainerCTWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},thumbnailhighlights(){const s=this.gamesContainerCTWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},secondline(){const s=this.gamesContainerCTWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},firstline(){const s=this.gamesContainerCTWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},teamlogo(){const s=this.gamesContainerCTWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Vm=new ResizeObserver(()=>{this.gamesContainerCTWidth=this.$refs.gamesContainerCT?this.$refs.gamesContainerCT.clientWidth:0,this.gamesContainerCTWidth<740?this.movil=!0:this.movil=!1}),Vm.observe(this.$refs.gamesContainerCT);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},$m=()=>{n.useCssVars(s=>({"3ce1ca00":s.colorBackgroundHome,"916c7edc":s.colorBackgroundHome+"36"}))},zm=zr.setup;zr.setup=zm?(s,e)=>($m(),zm(s,e)):$m;const Mn=s=>(n.pushScopeId("data-v-191985e2"),s=s(),n.popScopeId(),s),wR=Mn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),kR=[wR],ER=Mn(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),TR=["src"],CR={width:"275",height:"125",viewBox:"0 0 275 125",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"base-logo"},xR=["fill"],vR=["id"],AR=["stop-color"],LR=["stop-color"],IR=["src"],RR=Mn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),BR={class:"text-container"},NR=Mn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function DR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerCT",class:n.normalizeClass(o.thumbnailhighlights)},[t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},kR,2)):n.createCommentVNode("",!0),ER,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,TR),(n.openBlock(),n.createElementBlock("svg",CR,[n.createElementVNode("path",{d:"M274.641 124.094L0 0.675049V124.094H274.641Z",fill:"url(#paint0_linear_7_"+t.nameTeam.replaceAll(" ","")+")"},null,8,xR),n.createElementVNode("defs",null,[n.createElementVNode("linearGradient",{id:"paint0_linear_7_"+t.nameTeam.replaceAll(" ",""),x1:"58.6578",y1:"15.5938",x2:"58.6578",y2:"124.094",gradientUnits:"userSpaceOnUse"},[n.createElementVNode("stop",{"stop-color":t.colorBackgroundHome},null,8,AR),n.createElementVNode("stop",{offset:"1","stop-color":t.colorBackgroundHome},null,8,LR)],8,vR)])])),n.createElementVNode("img",{class:n.normalizeClass(o.teamlogo),src:t.logoHome,alt:""},null,10,IR),RR,n.createElementVNode("div",BR,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},[t.nameTeam!="Local"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.nameTeam),1)],64)):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3)]),NR],2)}const PR=os(zr,[["render",DR],["__scopeId","data-v-191985e2"]]);let Um=null;const Ur={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""},nameTeam:{type:String,default:""},nameCategory:{type:String,default:""}},data(){return{gamesContainerTAWidth:0}},computed:{playbutton(){const s=this.gamesContainerTAWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},thumbnailhighlights(){const s=this.gamesContainerTAWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},secondline(){const s=this.gamesContainerTAWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},firstline(){const s=this.gamesContainerTAWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},teamlogo(){const s=this.gamesContainerTAWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Um=new ResizeObserver(()=>{this.gamesContainerTAWidth=this.$refs.gamesContainerTA?this.$refs.gamesContainerTA.clientWidth:0,this.movil=this.gamesContainerTAWidth<740}),Um.observe(this.$refs.gamesContainerTA);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Gm=()=>{n.useCssVars(s=>({"1e0230d2":s.colorBackgroundHome,"1ae427ca":s.colorBackgroundHome+"36"}))},jm=Ur.setup;Ur.setup=jm?(s,e)=>(Gm(),jm(s,e)):Gm;const Vn=s=>(n.pushScopeId("data-v-61a93c22"),s=s(),n.popScopeId(),s),OR=Vn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),FR=[OR],MR=Vn(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),VR=["src"],$R={width:"275",height:"125",viewBox:"0 0 275 125",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"base-logo-away"},zR=["fill"],UR=["id"],GR=["stop-color"],jR=["stop-color"],HR=["src"],WR=Vn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),KR={class:"text-container"},qR=Vn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function YR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerTA",class:n.normalizeClass(o.thumbnailhighlights)},[n.createElementVNode("div",{class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},FR,2),MR,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,VR),(n.openBlock(),n.createElementBlock("svg",$R,[n.createElementVNode("path",{d:"M274.641 124.094L0 0.675049V124.094H274.641Z",fill:"url(#paint0_linear_7_"+t.nameTeam.replaceAll(" ","")+")"},null,8,zR),n.createElementVNode("defs",null,[n.createElementVNode("linearGradient",{id:"paint0_linear_7_"+t.nameTeam.replaceAll(" ",""),x1:"58.6578",y1:"15.5938",x2:"58.6578",y2:"124.094",gradientUnits:"userSpaceOnUse"},[n.createElementVNode("stop",{"stop-color":t.colorBackgroundAway},null,8,GR),n.createElementVNode("stop",{offset:"1","stop-color":t.colorBackgroundAway},null,8,jR)],8,UR)])])),n.createElementVNode("img",{class:n.normalizeClass(o.teamlogo),src:t.logoHome,alt:""},null,10,HR),WR,n.createElementVNode("div",KR,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},[t.nameTeam!="Away"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.nameTeam),1)],64)):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3)]),qR],2)}const JR=os(Ur,[["render",YR],["__scopeId","data-v-61a93c22"]]);let Hm=null;const Gr={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""},nameTeam:{type:String,default:""},nameCategory:{type:String,default:""}},data(){return{gamesContainerTALWidth:0}},computed:{playbutton(){const s=this.gamesContainerTALWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},thumbnailhighlights(){const s=this.gamesContainerTALWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},secondline(){const s=this.gamesContainerTALWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},firstline(){const s=this.gamesContainerTALWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},teamlogo(){const s=this.gamesContainerTALWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Hm=new ResizeObserver(()=>{this.gamesContainerTALWidth=this.$refs.gamesContainerTAL?this.$refs.gamesContainerTAL.clientWidth:0,this.movil=this.gamesContainerTALWidth<740}),Hm.observe(this.$refs.gamesContainerTAL);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Wm=()=>{n.useCssVars(s=>({"41af18a7":s.colorBackgroundHome,"1387690b":s.colorBackgroundHome+"36"}))},Km=Gr.setup;Gr.setup=Km?(s,e)=>(Wm(),Km(s,e)):Wm;const $n=s=>(n.pushScopeId("data-v-19ce95f3"),s=s(),n.popScopeId(),s),XR=$n(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),ZR=[XR],QR=$n(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),e3=["src"],t3={width:"275",height:"125",viewBox:"0 0 275 125",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"base-logo-away-live"},s3=["fill"],a3=["id"],n3=["stop-color"],i3=["stop-color"],o3=["src"],r3=$n(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),l3={class:"text-container"},c3=$n(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function d3(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerTAL",class:n.normalizeClass(o.thumbnailhighlights)},[n.createElementVNode("div",{class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},ZR,2),QR,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,e3),(n.openBlock(),n.createElementBlock("svg",t3,[n.createElementVNode("path",{d:"M274.641 124.094L0 0.675049V124.094H274.641Z",fill:"url(#paint0_linear_10_"+t.nameTeam.replaceAll(" ","")+")"},null,8,s3),n.createElementVNode("defs",null,[n.createElementVNode("linearGradient",{id:"paint0_linear_10_"+t.nameTeam.replaceAll(" ",""),x1:"58.6578",y1:"15.5938",x2:"58.6578",y2:"124.094",gradientUnits:"userSpaceOnUse"},[n.createElementVNode("stop",{"stop-color":t.colorBackgroundAway},null,8,n3),n.createElementVNode("stop",{offset:"1","stop-color":t.colorBackgroundAway},null,8,i3)],8,a3)])])),n.createElementVNode("img",{class:n.normalizeClass(o.teamlogo),src:t.logoHome,alt:""},null,10,o3),r3,n.createElementVNode("div",l3,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},[t.nameTeam!="Away"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.nameTeam),1)],64)):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3)]),c3],2)}const h3=os(Gr,[["render",d3],["__scopeId","data-v-19ce95f3"]]);let qm=null;const jr={components:{},props:{colorFontHome:{type:String,default:"#000000"},colorFontAway:{type:String,default:"#000000"},type:{type:Number,default:0},showVideos:{type:Boolean,default:!0},playStatus:{type:Number,default:2},matchday:{type:String,default:""},seasonName:{type:String,default:""},colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},nameCategory:{type:String,default:""},showimg:{type:Boolean,default:!0},photoProfile:{type:String,default:""},logoHome:{type:String,default:""},logoAway:{type:String,default:""},date:{type:String,default:""},scoreHome:{type:[String,Number],default:""},scoreAway:{type:[String,Number],default:""},background:{type:String,default:""},typeImg:{type:Number,default:0},nameHomeTeam:{type:String,default:""},nameAwayTeam:{type:String,default:""},namePlayer:{type:String,default:""}},data(){return{gamesContainerGPWidth:0}},computed:{seasoncontainer(){const s=this.gamesContainerGPWidth;return s<=400?"season-container400":s<=540?"season-container540":s<=650?"season-container650":"season-container"},matchcontainer(){const s=this.gamesContainerGPWidth;return s<=400?"match-container400":s<=540?"match-container540":s<=650?"match-container650":"match-container"},seasonnameContainer(){const s=this.gamesContainerGPWidth;return s<=400?"seasonname400":s<=540?"seasonname540":s<=650?"seasonname650":"seasonname"},matchboxContainer(){const s=this.gamesContainerGPWidth;return s<=400?"matchbox400":s<=540?"matchbox540":s<=650?"matchbox650":"matchbox"},containerinfogame(){const s=this.gamesContainerGPWidth;return s<=400?"container-info-game400":s<=540?"container-info-game540":s<=650?"container-info-game650":"container-info-game"},playbutton(){const s=this.gamesContainerGPWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},points(){const s=this.gamesContainerGPWidth;return s<=400?"points400":s<=540?"points540":s<=650?"points650":"points"},teamname(){const s=this.gamesContainerGPWidth;return s<=400?"team-name400":s<=540?"team-name540":s<=650?"team-name650":"team-name"},teamscore(){const s=this.gamesContainerGPWidth;return s<=400?"team-score400":s<=540?"team-score540":s<=650?"team-score650":"team-score"},teamlogo(){const s=this.gamesContainerGPWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"},hometeam(){const s=this.gamesContainerGPWidth;return s<=400?"home-team400":s<=540?"home-team540":s<=650?"home-team650":"home-team"},awayteam(){const s=this.gamesContainerGPWidth;return s<=400?"away-team400":s<=540?"away-team540":s<=650?"away-team650":"away-team"},texttitle(){const s=this.gamesContainerGPWidth;return s<=400?"text-title400":s<=540?"text-title540":s<=650?"text-title650":"text-title"},texttitle2(){const s=this.gamesContainerGPWidth;return s<=400?"text-title2400":s<=540?"text-title2540":s<=650?"text-title2650":"text-title2"},playerimage(){const s=this.gamesContainerGPWidth;return s<=400?"player-image400":s<=540?"player-image540":s<=650?"player-image650":"player-image"},thumbnailhighlights(){const s=this.gamesContainerGPWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)qm=new ResizeObserver(()=>{this.gamesContainerGPWidth=this.$refs.gamesContainerGP?this.$refs.gamesContainerGP.clientWidth:0,this.gamesContainerGPWidth<740?this.movil=!0:this.movil=!1}),qm.observe(this.$refs.gamesContainerGP);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Ym=()=>{n.useCssVars(s=>({"14532c00":s.colorBackgroundHome,"14594fe2":s.colorBackgroundAway,"672ee12c":s.colorBackgroundAway+"62","11fb9192":s.colorBackgroundHome+"36"}))},Jm=jr.setup;jr.setup=Jm?(s,e)=>(Ym(),Jm(s,e)):Ym;const zn=s=>(n.pushScopeId("data-v-77384f47"),s=s(),n.popScopeId(),s),u3=["width","src"],m3=zn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1)),f3=zn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),p3=[f3],g3={class:"player-container"},y3=["src"],b3=["src"],S3=["src"],_3={class:"container-score"},w3=["src"],k3=["src"],E3=["src"],T3=zn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),C3=zn(()=>n.createElementVNode("div",{class:"gradient-color"},null,-1));function x3(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerGP",class:n.normalizeClass(o.thumbnailhighlights)},[t.playStatus!=2?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass((t.playStatus==1,"icon-thumb"))},[n.createElementVNode("img",{width:t.playStatus==1?60:40,src:t.playStatus==1?"http://golstatsimages.blob.core.windows.net/images-library/icn-live@2x.png":"http://golstatsimages.blob.core.windows.net/images-library/icn-info@2x.png"},null,8,u3)],2)):n.createCommentVNode("",!0),m3,t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},p3,2)):n.createCommentVNode("",!0),n.createElementVNode("div",g3,[n.createElementVNode("div",{class:n.normalizeClass(o.containerinfogame)},[n.createElementVNode("div",{class:n.normalizeClass(o.matchcontainer)},[t.matchday?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.matchboxContainer)},n.toDisplayString(t.matchday),3)):n.createCommentVNode("",!0),t.seasonName?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.seasonnameContainer)},n.toDisplayString(t.seasonName),3)):n.createCommentVNode("",!0)],2),t.date?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.seasoncontainer)},n.toDisplayString(t.date),3)):n.createCommentVNode("",!0)],2),t.type==0?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(o.texttitle)},n.toDisplayString(t.nameCategory),3)):(n.openBlock(),n.createElementBlock("span",{key:1,class:n.normalizeClass(o.texttitle2)},n.toDisplayString(t.nameCategory),3)),t.showimg?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[t.typeImg==0?(n.openBlock(),n.createElementBlock("img",{key:0,src:t.photoProfile,class:n.normalizeClass(o.playerimage)},null,10,y3)):n.createCommentVNode("",!0),t.typeImg==1?(n.openBlock(),n.createElementBlock("img",{key:1,src:t.photoProfile,alt:""},null,8,b3)):n.createCommentVNode("",!0),t.typeImg==2?(n.openBlock(),n.createElementBlock("img",{key:2,src:t.photoProfile,class:"img-number"},null,8,S3)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),n.createElementVNode("div",_3,[n.createElementVNode("div",{class:n.normalizeClass(o.hometeam)},[n.createElementVNode("span",{class:n.normalizeClass(o.teamname),style:n.normalizeStyle({color:t.colorFontAway})},n.toDisplayString(t.nameHomeTeam),7),n.createElementVNode("img",{src:t.logoHome,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,w3),n.createElementVNode("span",{class:n.normalizeClass(o.teamscore)},n.toDisplayString(t.scoreHome),3)],2),n.createElementVNode("span",{class:n.normalizeClass(o.points)},":",2),n.createElementVNode("div",{class:n.normalizeClass(o.awayteam)},[n.createElementVNode("span",{class:n.normalizeClass(o.teamscore)},n.toDisplayString(t.scoreAway),3),n.createElementVNode("img",{src:t.logoAway,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,k3),n.createElementVNode("span",{class:n.normalizeClass(o.teamname),style:n.normalizeStyle({color:t.colorFontAway})},n.toDisplayString(t.nameAwayTeam),7)],2)])]),n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,E3),T3,C3],2)}const v3=os(jr,[["render",x3],["__scopeId","data-v-77384f47"]]);let Xm=null;const Hr={components:{},props:{colorFont:{type:String,default:"#000000"},showVideos:{type:Boolean,default:!0},colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},nameCategory:{type:String,default:""},photoProfile:{type:String,default:""},logoHome:{type:String,default:""},logoAway:{type:String,default:""},scoreHome:{type:[String,Number],default:""},scoreAway:{type:[String,Number],default:""},background:{type:String,default:""},typeImg:{type:Number,default:0},nameHomeTeam:{type:String,default:""},nameAwayTeam:{type:String,default:""},namePlayer:{type:String,default:""}},data(){return{gamesContainerSPWidth:0}},computed:{playbutton(){const s=this.gamesContainerSPWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},firstline(){const s=this.gamesContainerSPWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},secondline(){const s=this.gamesContainerSPWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},playername(){const s=this.gamesContainerSPWidth;return s<=400?"player-name400":s<=540?"player-name540":s<=650?"player-name650":"player-name"},playerimage(){const s=this.gamesContainerSPWidth;return s<=400?"player-image400":s<=540?"player-image540":s<=650?"player-image650":"player-image"},thumbnailhighlights(){const s=this.gamesContainerSPWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Xm=new ResizeObserver(()=>{this.gamesContainerSPWidth=this.$refs.gamesContainerSP?this.$refs.gamesContainerSP.clientWidth:0,this.movil=this.gamesContainerSPWidth<740}),Xm.observe(this.$refs.gamesContainerSP);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Zm=()=>{n.useCssVars(s=>({"17845cea":s.colorBackgroundHome+"30","3e8f3cad":s.colorBackgroundHome}))},Qm=Hr.setup;Hr.setup=Qm?(s,e)=>(Zm(),Qm(s,e)):Zm;const Un=s=>(n.pushScopeId("data-v-df5486d2"),s=s(),n.popScopeId(),s),A3=Un(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),L3=[A3],I3={class:"player-image position-image"},R3=["src"],B3=["src"],N3=["src"],D3=["src"],P3=Un(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),O3=["src"],F3=Un(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1)),M3={class:"text-container"},V3=Un(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),$3={class:"base-logo",width:"91",height:"216",viewBox:"0 0 91 216",fill:"none",xmlns:"http://www.w3.org/2000/svg"},z3=["fill"];function U3(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerSP",class:n.normalizeClass(o.thumbnailhighlights)},[t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},L3,2)):n.createCommentVNode("",!0),n.createElementVNode("div",I3,[t.typeImg==0?(n.openBlock(),n.createElementBlock("img",{key:0,src:t.photoProfile,class:n.normalizeClass(o.playerimage)},null,10,R3)):n.createCommentVNode("",!0),t.typeImg==1?(n.openBlock(),n.createElementBlock("img",{key:1,src:t.photoProfile,alt:""},null,8,B3)):n.createCommentVNode("",!0),t.typeImg==2?(n.openBlock(),n.createElementBlock("img",{key:2,src:t.photoProfile,class:"img-number"},null,8,N3)):n.createCommentVNode("",!0)]),n.createElementVNode("img",{src:t.logoHome,alt:"",class:"team-logo"},null,8,D3),P3,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,O3),F3,n.createElementVNode("div",M3,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},"MEJORES JUGADAS",2),n.createElementVNode("span",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3),n.createElementVNode("div",{class:n.normalizeClass(o.playername),style:n.normalizeStyle({color:t.colorFont})},n.toDisplayString(t.namePlayer),7)]),V3,(n.openBlock(),n.createElementBlock("svg",$3,[n.createElementVNode("path",{d:"M91.5 216L0 -0.5H91.5V216Z",fill:t.colorBackgroundHome},null,8,z3)]))],2)}const G3=os(Hr,[["render",U3],["__scopeId","data-v-df5486d2"]]);function j3(s){const e=n.ref({width:0,height:0});function t(){const a=s.value.getBoundingClientRect();e.value.width=a.width,e.value.height=a.height}return n.onMounted(()=>{t(),window.addEventListener("resize",t)}),n.onUnmounted(()=>{window.removeEventListener("resize",t)}),{elementSize:e}}const H3="_ptg_1shb4_2",W3="_ptgtitle_1shb4_7",K3="_ptgtitle450_1shb4_23",q3="_pgtcontainercard_1shb4_39",Y3="_pgtcontainercard350_1shb4_44",J3={ptg:H3,ptgtitle:W3,ptgtitle450:K3,pgtcontainercard:q3,pgtcontainercard350:Y3},Wr={components:{GSCSlider:q4,GSCThumbnailCategory:_R,GSCThumbnailCategoryTeam:PR,GSCThumbnailCategoryTeamAway:JR,GSCThumbnailHighlightGamePlayer:v3,GSCThumbnailCategoryTeamAwayLive:h3,GSCThumbnailSummaryPlayer:G3,GSCThumbnailHighlightGameHistoric:iR},setup(){const s=n.ref("ptgDiv"),{elementSize:e}=j3(s);return{ptgDiv:s,elementSize:e}},props:{isWidget:{type:Boolean,default:!1},teamWidget:{type:Number,default:0},receiveData:{type:Boolean,default:!1},information:{type:Array,default:()=>[]},title:{type:String,default:"100% de sus participaciones en cada partido:"},type:{type:Number,default:0},showVideos:{type:Boolean,default:!0},viewType:{type:Number,default:2},local:{type:Boolean,default:!0},data:{type:Object,default:()=>{}},backgroundColor:{type:String,default:"#0D1D29"},backgroundFooter:{type:String,default:"#192733"},matchdayView:{type:Number,default:1},pxScroll:{type:Number,default:100},arrows:{type:Boolean,default:!0},arrowsScrollHide:{type:Boolean,default:!1},arrowsHideOnNoScroll:{type:Boolean,default:!1},arrowsColor:{type:String,default:"#CBEE6B"},arrowsHeight:{type:Number,default:15},arrowsWidth:{type:Number,default:15},arrowsPadding:{type:Number,default:5},arrowsMargin:{type:Number,default:10},arrowsRadius:{type:String,default:"0%"},arrowsBorder:{type:String,default:"none"},arrowsBackground:{type:String,default:"#0D1D29"},arrowsContainerBgL:{type:String,default:"#0D1D29"},arrowsContainerBgR:{type:String,default:"#0D1D29"},scrollColor:{type:String,default:"#c3e569"},arrowsPosition:{type:String,default:"relative"},height:{type:String,default:"100%"},videoPrivilegesPlayingAs:{type:Set,default:()=>new Set([1,2])},playVideosPrivileges:{type:Object,default:null},awaitForSpecificsPlaysBySeason:{type:Boolean,default:!1},awaitForBestPlaysBySeasonAndTeam:{type:Boolean,default:!1},awaitForBestPlaysBySeasonAndGame:{type:Boolean,default:!1},awaitForTeamsInfo:{type:Boolean,default:!1},specificsPlaysBySeasonResponse:{type:Object,default:null},bestPlaysBySeasonAndTeamResponse:{type:Object,default:null},bestPlaysBySeasonAndGameResponse:{type:Object,default:null},teamsInfoResponse:{type:Object,default:null}},data(){return{token:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE",printData:[],teamsInfo:[],playerPhoto:!0,homeTeam:0,flagGames:[],lastseason:0,arrayMatchdays:[],awayTeam:0,goalCategories:[12,55,"35_r","54_r"],resumeCategories:[607,608,12,55,54,35,14,52,15,53,466,477],lastType:0,lastUrl:"",teamsInfoLastUrl:""}},watch:{data:{immediate:!0,handler(s){this.type!==14&&(this.receiveData||this.getTeamsInfo(s)),this.getStats(s)}},teamsInfoResponse(s){s&&(this.receiveData||this.getTeamsInfo(this.data))},bestPlaysBySeasonAndTeamResponse(s){s&&this.getStats(this.data)},bestPlaysBySeasonAndGameResponse(s){s&&this.getStats(this.data)},specificsPlaysBySeasonResponse(s){s&&this.getStats(this.data)}},computed:{ptgtitleClass(){return this.elementSize.width<=450?this.$style.ptgtitle450:this.$style.ptgtitle},pgtcontainercardClass(){return this.elementSize.width<=350?this.$style.pgtcontainercard350:this.$style.pgtcontainercard}},methods:{getBestPlaysUrl({season:s,player:e,team:t,game:a,category:i}){let o="https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/best-plays/seasons/";return s&&(o+=`${s}`),e&&(o+=`/players/${e}`),t&&(o+=`/teams/${t}`),a&&(o+=`/games/${a}`),i&&(o+=`/categories/${i}`),this.videoPrivilegesPlayingAs.has(1)&&!this.videoPrivilegesPlayingAs.has(2)?o+="?isLocal=1":this.videoPrivilegesPlayingAs.has(2)&&!this.videoPrivilegesPlayingAs.has(1)&&(o+="?isVisitor=1"),this.isWidget&&this.teamWidget!=0&&[3,4,5].includes(this.type)&&(o+=`?t=${this.teamWidget}`),o},getIsSameScenario(s,e){const t=this.lastType===s&&this.lastUrl===e;return t||(this.lastType=s,this.lastUrl=e),t},onclickPlayVideos(s){let e=[],t=s.data.game_id?[s.data.game_id]:null;s.type==2?s.data.position_id==1?s.data.category==0?e=s.isAllPlays?[14,52,15,53,300,301,308,309,310,311,304,305,306,307,260,261,312,265,266,267,268,313,314,43,324,323,478,479,480,481,474,475,476,477,40,26,325,16,51,462,463,151,154,156,591,592,159,162,163,429,165,593,594,168,171,172,430,174,595,596,177,180,181,431,467,358,361,363,366,369,370,469,372,376,378,379,470,381,385,387,388,471,607,608,262,263]:[42,55,324,323,608,39,774,802,52,53,40,54]:e=s.data.category:s.data.category==0?e=s.isAllPlays?[56,57,59,60,326,213,214,215,216,583,584,122,123,124,125,585,586,128,129,130,131,133,327,587,588,136,137,138,139,589,590,142,143,144,145,146,147,485,486,487,488,489,490,491,492,10,27,597,598,538,539,599,600,541,542,601,602,545,546,603,604,548,549,561,562,100,563,564,103,104,105,106,107,108,565,566,111,567,568,114,115,116,117,118,119,4,88,5,34,402,459,460,461,233,403,456,457,458,236,404,453,454,455,240,405,450,451,452,243,408,447,448,449,283,409,444,445,446,285,410,441,442,443,290,411,438,439,440,292,412,435,436,437,297,414,415,416,417,244,418,419,420,421,401,581,582,331,506,530,579,580,334,507,531,577,578,344,508,532,575,576,424,509,533,573,574,341,529,534,571,572,340,528,535,569,570,427,527,536,348,349,350,465,352,353,354,466,14,52,15,53,218,219,220,221,496,497,498,499,500,501,502,503,217,504,505,521,522,543,33,209,208,517,206,207,26,325,16,51,463,151,154,156,591,592,159,162,163,429,165,593,594,168,171,172,430,174,595,596,177,180,181,431,467,358,361,363,366,369,370,469,372,376,378,379,470,381,385,387,388,471,607,608,210,212]:[12,35,10,27,607,61,519,98,101,109,112,121,122,127,128,135,136,141,142,161,170,179,702,730,466,217,211,232,235,239,242,282,284,289,291,296,485,486,487,488,14,15,257]:e=s.data.category:s.type==3?s.data.category==0?e=[607,608,12,55,54,35,14,52,15,53,466,477,40,257,39]:e=s.data.category:s.data.category!=0?e=s.data.category:e=[607,608,12,55,54,35,14,52,15,53,466,477],this.data.isPrematch===1&&(t=null);const a=[1,2,3];let i={type:s.data.has_mxm?1:0,seasonId:s.data.season_id,mainSectionType:1,playListType:s.type,categoryIds:s.categories&&s.categories.length?s.categories:e,gameIds:t,playerIds:s.data.player_id?[s.data.player_id]:[],goalkeeperIds:s.data.position_id==1?s.data.player_id?[s.data.player_id]:[]:[],teamId:s.data.team_id?s.data.team_id:0,matchResult:s.data.matchResult?[s.matchResult]:a,playData:{},advancedFilter:{playListTitle:""}};s.data.category!==0&&(i.advancedFilter.mainCategoryId=s.data.category),this.$emit("openmedia",i)},onClickVideos(s){this.$emit("onClickVideos",s)},onClickCard(s){this.$emit("onClickCard",s)},async getTeamsInfo(s){if(this.awaitForTeamsInfo&&!this.teamsInfoResponse)return;const e="https://d2oco6mqmc.execute-api.us-west-2.amazonaws.com/prod/teamsBySeason/"+s.season;if(e===this.teamsInfoLastUrl)return;this.teamsInfoLastUrl=e;const t=Im.create({headers:{Authorization:`${this.token}`}}),a=this.awaitForTeamsInfo?this.teamsInfoResponse:await t.get(e);for(let i=0;i<a.data.teams.length;i++)this.teamsInfo[a.data.teams[i].team_id]=a.data.teams[i]},async getStats(s){if(!this.receiveData){const i=Im.create({headers:{Authorization:`${this.token}`}});var e=[],t={},a={};if(this.type===0){if(a=await i.get("https://uof4tt5l46.execute-api.us-west-2.amazonaws.com/prod/v3/playerInfo/"+s.season+"/"+s.player),this.videoPrivilegesPlayingAs)if(a.data.seasons[s.season]){const o=a.data.team_id;a.data.seasons[s.season].games_played=a.data.seasons[s.season].games_played.filter(r=>(r.playingAs=r.home_team===o?1:2,this.videoPrivilegesPlayingAs.has(r.playingAs)))}else{const o=a.data.team_id;a.data.national_seasons[s.season].games_played=a.data.national_seasons[s.season].games_played.filter(r=>(r.playingAs=r.home_team===o?1:2,this.videoPrivilegesPlayingAs.has(r.playingAs)))}if(a.data.seasons[s.season])for(let o=0;o<a.data.seasons[s.season].games_played.length;o++)t={player_id:s.player,color:a.data.info_thumbnails.colors.background_color,colorfont:a.data.info_thumbnails.colors.font_color,photo_profile:a.data.info_thumbnails.images.player_in_action[0]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.player_in_action[0]:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png",team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.seasons[s.season].games_played[o].home_team+".png",player_name:a.data.seasons[s.season].games_played[o].home_team_acronym+" "+a.data.seasons[s.season].games_played[o].home_team_score+" : "+a.data.seasons[s.season].games_played[o].visiting_team_score+" "+a.data.seasons[s.season].games_played[o].visiting_team_acronym,team_id_b:a.data.seasons[s.season].games_played[o].home_team,season_id:a.data.seasons[s.season].games_played[o].season_id,name:"",date:this.obtenerNombreCompletoFecha(a.data.seasons[s.season].games_played[o].date),category:0,team_id:a.data.team_id,game_id:a.data.seasons[s.season].games_played[o].game_id,has_mxm:a.data.seasons[s.season].games_played[o].has_mxm,position_id:a.data.position_id,scorehome:a.data.seasons[s.season].games_played[o].home_team_score,scoreaway:a.data.seasons[s.season].games_played[o].visiting_team_score,hometeamacronym:a.data.seasons[s.season].games_played[o].home_team_acronym,visitingteamacronym:a.data.seasons[s.season].games_played[o].visiting_team_acronym,seasonname:a.data.seasons[s.season].name,seasonname2:a.data.seasons[s.season].name.replace("Clausura","CL ").replace("Apertura","AP "),match:a.data.seasons[s.season].games_played[o].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"),score:a.data.seasons[s.season].games_played[o].home_team_score+" : "+a.data.seasons[s.season].games_played[o].visiting_team_score,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.background_player_in_action[0],backgroundhome:a.data.seasons[s.season].games_played[o].info_thumbnails.home_colors.background_color,backgroundaway:a.data.seasons[s.season].games_played[o].info_thumbnails.away_colors.background_color,colorfont_home:a.data.seasons[s.season].games_played[o].info_thumbnails.home_colors.font_color,colorfont_away:a.data.seasons[s.season].games_played[o].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.seasons[s.season].games_played[o].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.seasons[s.season].games_played[o].visiting_team+".png",total:a.data.seasons[s.season].games_played[o].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.seasons[s.season].games_played[o].home_team+"_"+a.data.seasons[s.season].games_played[o].season_id+"_r1.jpg"},e.push(t);else for(let o=0;o<a.data.national_seasons[s.season].games_played.length;o++)t={player_id:s.player,color:a.data.info_thumbnails.colors.background_color,colorfont:a.data.info_thumbnails.colors.font_color,photo_profile:a.data.info_thumbnails.images.player_in_action[0]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.player_in_action[0]:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png",team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.national_seasons[s.season].games_played[o].home_team+".png",player_name:a.data.national_seasons[s.season].games_played[o].home_team_acronym+" "+a.data.national_seasons[s.season].games_played[o].home_team_score+" : "+a.data.national_seasons[s.season].games_played[o].visiting_team_score+" "+a.data.national_seasons[s.season].games_played[o].visiting_team_acronym,team_id_b:a.data.national_seasons[s.season].games_played[o].home_team,season_id:a.data.national_seasons[s.season].games_played[o].season_id,name:"",date:this.obtenerNombreCompletoFecha(a.data.national_seasons[s.season].games_played[o].date),category:0,team_id:a.data.team_id,game_id:a.data.national_seasons[s.season].games_played[o].game_id,position_id:a.data.position_id,scorehome:a.data.national_seasons[s.season].games_played[o].home_team_score,scoreaway:a.data.national_seasons[s.season].games_played[o].visiting_team_score,hometeamacronym:a.data.national_seasons[s.season].games_played[o].home_team_acronym,visitingteamacronym:a.data.national_seasons[s.season].games_played[o].visiting_team_acronym,seasonname:a.data.national_seasons[s.season].name,seasonname2:a.data.national_seasons[s.season].name.replace("Clausura","CL ").replace("Apertura","AP "),match:a.data.national_seasons[s.season].games_played[o].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"),score:a.data.national_seasons[s.season].games_played[o].home_team_score+" : "+a.data.national_seasons[s.season].games_played[o].visiting_team_score,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.background_player_in_action[0],backgroundhome:a.data.national_seasons[s.season].games_played[o].info_thumbnails.home_colors.background_color,backgroundaway:a.data.national_seasons[s.season].games_played[o].info_thumbnails.away_colors.background_color,colorfont_home:a.data.national_seasons[s.season].games_played[o].info_thumbnails.home_colors.font_color,colorfont_away:a.data.national_seasons[s.season].games_played[o].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.national_seasons[s.season].games_played[o].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.national_seasons[s.season].games_played[o].visiting_team+".png",total:a.data.national_seasons[s.season].games_played[o].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.national_seasons[s.season].games_played[o].home_team+"_"+a.data.national_seasons[s.season].games_played[o].season_id+"_r1.jpg"},e.push(t)}if(this.type===1){if(this.awaitForBestPlaysBySeasonAndTeam&&!this.bestPlaysBySeasonAndTeamResponse)return;const o=this.getBestPlaysUrl({season:s.season,team:s.team});if(this.getIsSameScenario(1,o))return;a=this.awaitForBestPlaysBySeasonAndTeam?this.bestPlaysBySeasonAndTeamResponse:await i.get(o);for(let r=0;r<a.data.categories.length;r++){this.playerPhoto=!1;const l=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.background_default_categories.length),d=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.background_default_teams.length);t={player_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.background_default_categories[l],background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.background_default_teams[d],color:a.data.categories[r].info_thumbnails.colors.background_color,team_logo:"https://az755631.vo.msecnd.net/teams-80/"+a.data.categories[r].info_thumbnails.team_logo,player_name:a.data.categories[r].category_name,team_name:this.teamsInfo[a.data.team_id].colloquial_name,team_id:a.data.team_id,colorfont:a.data.categories[r].info_thumbnails.colors.font_color,team_id_b:a.data.team_id,category:a.data.categories[r].categories,season_id:a.data.season_id,total:a.data.categories[r].total,background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.team_id+"_"+a.data.season_id+"_r1.jpg"},e.push(t)}}if(this.type===2){const o=this.getBestPlaysUrl({season:s.season,game:s.game});if(this.getIsSameScenario(2,o))return;a=await i.get(o);for(let r=0;r<a.data.categories.length;r++){this.playerPhoto=!1;const l=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.player_in_action.length),d=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.background_default_categories.length);t={player_action:a.data.categories[r].info_thumbnails.images.player_in_action[l]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.player_in_action[l]:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png",background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.background_default_categories[d],color:a.data.categories[r].info_thumbnails.colors.background_color,team_logo:"https://az755631.vo.msecnd.net/teams-80/"+a.data.categories[r].info_thumbnails.team_logo,player_name:a.data.categories[r].category_name,season_id:s.season,colorfont:a.data.categories[r].info_thumbnails.colors.font_color,player_id:s.player,team_id:a.data.categories[r].info_thumbnails.colors.team_id,category:a.data.categories[r].categories,total:a.data.categories[r].total,background_card:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png"},e.push(t)}}if(this.type===3){if(this.playerPhoto=!1,this.awaitForBestPlaysBySeasonAndGame&&!this.bestPlaysBySeasonAndGameResponse)return;const o=this.getBestPlaysUrl({season:s.season,game:s.game});if(this.getIsSameScenario(3,o))return;a=this.awaitForBestPlaysBySeasonAndGame?this.bestPlaysBySeasonAndGameResponse:await i.get(o),this.playVideosPrivileges&&(this.playVideosPrivileges.canPrivilegesTeamPlayVideos?a.data.games[0].players=a.data.games[0].players.filter(r=>r.team_id==this.playVideosPrivileges.seasonAndPrivileges.teamId):a.data.games[0].players=[]);for(let r=0;r<a.data.games[0].players.length;r++){const l=Math.floor(Math.random()*a.data.games[0].players[r].info_thumbnails.images.background_player_in_action.length),d=Math.floor(Math.random()*a.data.games[0].players[r].info_thumbnails.images.player_in_action.length);t={colorbackgroundhome:a.data.games[0].players[r].info_thumbnails.colors.background_color,colorbackgroundaway:"",nameplayer:a.data.games[0].players[r].player_name,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.games[0].players[r].info_thumbnails.images.background_player_in_action[l],namecategory:"RESUMEN",namehometeam:"",nameawayteam:"",category:0,colorfont:a.data.games[0].players[r].info_thumbnails.colors.font_color,team_id:a.data.games[0].players[r].team_id,player_id:a.data.games[0].players[r].player_id,game_id:a.data.games[0].game_id,has_mxm:a.data.games[0].has_mxm,season_id:a.data.season_id,logohome:a.data.games[0].players[r].team_logo,photoprofile:a.data.games[0].players[r].info_thumbnails.images.player_in_action[d]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.games[0].players[r].info_thumbnails.images.player_in_action[d]:"https://az755631.vo.msecnd.net/players-profile/"+a.data.games[0].players[r].player_id+".png",logoaway:"",scoreaway:"",scorehome:""},e.push(t)}}if(this.type===4){if(this.awaitForSpecificsPlaysBySeason&&!this.specificsPlaysBySeasonResponse)return;this.playerPhoto=!1;const o="https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/specifics-plays/seasons/"+s.season+"/games/"+s.game;if(this.getIsSameScenario(4,o))return;a=this.awaitForSpecificsPlaysBySeason?this.specificsPlaysBySeasonResponse:await i.get(o);for(let r=0;r<a.data.home_team.categories.length;r++){const l=Math.floor(Math.random()*a.data.home_team.categories[r].info_thumbnails.images.background_default_teams.length);t={game_id:a.data.game_id,has_mxm:a.data.has_mxm,season_id:a.data.season_id,team_id:a.data.home_team.team_id,category:a.data.home_team.categories[r].categories.concat(a.data.home_team.categories[r].rival_categories),background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.home_team.categories[r].info_thumbnails.images.background_default_categories[l],player_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.home_team.categories[r].info_thumbnails.images.background_default_categories[l],team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.home_team.team_id+".png",color:a.data.home_team.categories[r].info_thumbnails.colors.background_color,colorfont:a.data.home_team.categories[r].info_thumbnails.colors.font_color,player_name:a.data.home_team.categories[r].category_name,total:a.data.home_team.categories[r].total,team_name:"Local",background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.home_team.team_id+"_"+a.data.season_id+"_r1.jpg"},e.push(t)}}if(this.type===5){if(this.awaitForSpecificsPlaysBySeason&&!this.specificsPlaysBySeasonResponse)return;this.playerPhoto=!1;const o="https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/specifics-plays/seasons/"+s.season+"/games/"+s.game;if(this.getIsSameScenario(5,o))return;a=this.awaitForSpecificsPlaysBySeason?this.specificsPlaysBySeasonResponse:await i.get(o);for(let r=0;r<a.data.visiting_team.categories.length;r++){const l=Math.floor(Math.random()*a.data.visiting_team.categories[r].info_thumbnails.images.background_default_categories.length);t={game_id:a.data.game_id,has_mxm:a.data.has_mxm,season_id:a.data.season_id,team_id:a.data.visiting_team.team_id,category:a.data.visiting_team.categories[r].categories.concat(a.data.visiting_team.categories[r].rival_categories),background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.visiting_team.categories[r].info_thumbnails.images.background_default_categories[l],player_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.visiting_team.categories[r].info_thumbnails.images.background_default_categories[l],team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.visiting_team.team_id+".png",team_name:"Away",color:a.data.visiting_team.categories[r].info_thumbnails.colors.background_color,colorfont:a.data.visiting_team.categories[r].info_thumbnails.colors.font_color,player_name:a.data.visiting_team.categories[r].category_name,total:a.data.visiting_team.categories[r].total,background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.visiting_team.team_id+"_"+a.data.season_id+"_r1.jpg"},e.push(t)}}if(this.type===6){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(6,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",seasonname:"",score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===7){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(7,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",seasonname:"",score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===8){const o=this.getBestPlaysUrl({season:s.season,player:s.player,category:s.category});if(this.getIsSameScenario(8,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,player_id:a.data.player_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+a.data.best_plays[r].info_thumbnails.player_logo,hometeamacronym:a.data.best_plays[r].home_team_acronym,visitingteamacronym:a.data.best_plays[r].away_team_acronym,seasonname:"",score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===9){const o=this.getBestPlaysUrl({season:s.season,player:s.player,category:s.category});if(this.getIsSameScenario(9,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,player_id:a.data.player_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+a.data.best_plays[r].info_thumbnails.player_logo,score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===10){const o="https://ws8d8ye2ii.execute-api.us-west-2.amazonaws.com/prod/v4/seasonsByTeam/"+s.team;if(this.getIsSameScenario(10,o))return;const r=await i.get(o);for(let l=0;l<r.data.seasons[s.season].games.length;l++){const d=Math.floor(Math.random()*r.data.seasons[s.season].games[l].info_thumbnails.images.background_default_games.length);t={photo_profile:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].visiting_team+".png",team_logo:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].home_team+".png",player_name:r.data.seasons[s.season].games[l].home_team_acronym+" "+r.data.seasons[s.season].games[l].home_team_score+" : "+r.data.seasons[s.season].games[l].visiting_team_score+" "+r.data.seasons[s.season].games[l].visiting_team_acronym,team_id:r.data.seasons[s.season].games[l].game_id,team_id_b:r.data.seasons[s.season].games[l].home_team,season_id:r.data.seasons[s.season].games[l].season_id,name:"",category:0,game_id:r.data.seasons[s.season].games[l].game_id,has_mxm:r.data.seasons[s.season].games[l].has_mxm,seasonname:r.data.seasons[s.season].name,match:r.data.seasons[s.season].games[l].matchday_name.replace("Matchday","Jor"),score:r.data.seasons[s.season].games[l].home_team_score+" : "+r.data.seasons[s.season].games[l].visiting_team_score,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data.seasons[s.season].games[l].info_thumbnails.images.background_default_games[d],backgroundhome:r.data.seasons[s.season].games[l].info_thumbnails.home_colors.background_color,backgroundaway:r.data.seasons[s.season].games[l].info_thumbnails.away_colors.background_color,colorfont_home:r.data.best_plays[l].info_thumbnails.home_colors.font_color,colorfont_away:r.data.best_plays[l].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].visiting_team+".png",total:r.data.seasons[s.season].games[l].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+r.data.seasons[s.season].games[l].home_team+"_"+r.data.seasons[s.season].games[l].season_id+"_r1.jpg"},e.push(t)}}if(this.type===11){const o="https://uof4tt5l46.execute-api.us-west-2.amazonaws.com/prod/v3/playerInfo/"+s.season+"/"+s.player;if(this.getIsSameScenario(11,o))return;const r=await i.get(o);for(let l=0;l<r.data.seasons[s.season].games_played.length;l++)t={has_mxm:r.data.seasons[s.season].games_played[l].has_mxm,category:0,player_id:s.player,team_id:r.data.team_id,game_id:r.data.seasons[s.season].games_played[l].game_id,position_id:r.data.position_id,color:r.data.info_thumbnails.colors.background_color,photo_profile:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data.info_thumbnails.images.player_in_action[0],team_logo:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games_played[l].home_team+".png",player_name:r.data.seasons[s.season].games_played[l].home_team_acronym+" "+r.data.seasons[s.season].games_played[l].home_team_score+" : "+r.data.seasons[s.season].games_played[l].visiting_team_score+" "+r.data.seasons[s.season].games_played[l].visiting_team_acronym,team_id_b:r.data.seasons[s.season].games_played[l].home_team,season_id:r.data.seasons[s.season].games_played[l].season_id,name:r.data.seasons[s.season].games_played[l].player_name,seasonname:r.data.seasons[s.season].name,match:r.data.seasons[s.season].games_played[l].matchday_name.replace("Matchday","Jor"),scorehome:r.data.seasons[s.season].games_played[l].home_team_score,scoreaway:r.data.seasons[s.season].games_played[l].visiting_team_score,hometeamacronym:r.data.seasons[s.season].games_played[l].home_team_acronym,visitingteamacronym:r.data.seasons[s.season].games_played[l].visiting_team_acronym,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data.info_thumbnails.images.background_player_in_action[0],backgroundhome:r.data.seasons[s.season].games_played[l].info_thumbnails.home_colors.background_color,backgroundaway:r.data.seasons[s.season].games_played[l].info_thumbnails.away_colors.background_color,colorfont_home:r.data.seasons[s.season].games_played[l].info_thumbnails.home_colors.font_color,colorfont_away:r.data.seasons[s.season].games_played[l].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games_played[l].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games_played[l].visiting_team+".png",total:r.data.seasons[s.season].games_played[l].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+r.data.seasons[s.season].games_played[l].home_team+"_"+r.data.seasons[s.season].games_played[l].season_id+"_r1.jpg"},e.push(t)}if(this.type===12){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(12,o))return;const r=await i.get(o);for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1]},e.push(t)}if(this.type===13){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(13,o))return;const r=await i.get(o);for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1]},e.push(t)}if(this.type===14&&(e=[],s.season)){if(this.lastseason!==s.season){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(14,o))return;const r=await i.get(o);this.flagGames=[],this.arrayMatchdays=[];for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)r.data[l].best_plays[d].score[0]==0&&r.data[l].best_plays[d].score[1]==0||(t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,plays_status:r.data[l].best_plays[d].plays_status,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,date_time:new Date(r.data[l].best_plays[d].date_time_utc).valueOf(),colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1],matchday_id:r.data[l].best_plays[d].matchday_id},this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]?this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id)):(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]=[],this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id))));e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((l,d)=>d.date_time-l.date_time):[]}else e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((o,r)=>r.date_time-o.date_time):[];this.lastseason=s.season}if(this.type===15&&(e=[],s.season)){if(this.lastseason!==s.season){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(15,o))return;const r=await i.get(o);this.flagGames=[],this.arrayMatchdays=[];for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)r.data[l].best_plays[d].score[0]==0&&r.data[l].best_plays[d].score[1]==0||r.data[l].best_plays[d].home_team!=s.team&&r.data[l].best_plays[d].visiting_team!=s.team||(t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,plays_status:r.data[l].best_plays[d].plays_status,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,date_time:new Date(r.data[l].best_plays[d].date_time_utc).valueOf(),colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1],matchday_id:r.data[l].best_plays[d].matchday_id},this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]?this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id)):(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]=[],this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id))));e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((l,d)=>d.date_time-l.date_time):[]}else e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((o,r)=>r.date_time-o.date_time):[];this.lastseason=s.season}if(this.type===16){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(16,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)this.viewType==2&&a.data.best_plays[r].home_team==s.team&&(t={has_mxm:a.data.best_plays[r].has_mxm,category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==1&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==3&&a.data.best_plays[r].visiting_team==s.team&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t))}if(this.type===17){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(17,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)this.viewType==2&&a.data.best_plays[r].home_team==s.team&&(t={has_mxm:a.data.best_plays[r].has_mxm,category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==1&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==3&&a.data.best_plays[r].visiting_team==s.team&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t))}this.printData=e}},obtenerNombreCompletoFecha(s){if(s){const e=new Date(s),t=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"][e.getUTCDay()],a=e.getUTCDate(),i=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"][e.getUTCMonth()];return`${t} ${a} de ${i}`}else return""}},async created(){}},ef=()=>{n.useCssVars(s=>({"4f699db7":s.backgroundColor}))},tf=Wr.setup;Wr.setup=tf?(s,e)=>(ef(),tf(s,e)):ef;function X3(s,e,t,a,i,o){const r=n.resolveComponent("GSCThumbnailSummaryPlayer"),l=n.resolveComponent("GSCThumbnailCategoryTeam"),d=n.resolveComponent("GSCThumbnailCategoryTeamAwayLive"),c=n.resolveComponent("GSCSlider"),h=n.resolveComponent("GSCThumbnailCategory"),u=n.resolveComponent("GSCThumbnailCategoryTeamAway"),f=n.resolveComponent("GSCThumbnailHighlightGamePlayer"),p=n.resolveComponent("GSCThumbnailHighlightGameHistoric");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(s.$style.ptg),ref:"ptgDiv"},[n.createElementVNode("div",{class:n.normalizeClass(o.ptgtitleClass)},n.toDisplayString(t.title),3),t.receiveData?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t.information.length>0?(n.openBlock(),n.createBlock(c,{key:0,backgroundColor:t.backgroundColor,pxScroll:t.pxScroll,arrows:t.arrows,arrowsScrollHide:t.arrowsScrollHide,arrowsHideOnNoScroll:t.arrowsHideOnNoScroll,arrowsColor:t.arrowsColor,arrowsHeight:t.arrowsWidth,arrowsWidth:t.arrowsWidth,arrowsPadding:t.arrowsPadding,arrowsMargin:t.arrowsMargin,arrowsRadius:t.arrowsRadius,arrowsBorder:t.arrowsBorder,arrowsBackground:t.arrowsBackground,arrowsContainerBgL:t.arrowsContainerBgL,arrowsContainerBgR:t.arrowsContainerBgR,scrollColor:t.scrollColor,arrowsPosition:t.arrowsPosition,height:t.height},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.information,(m,g)=>(n.openBlock(),n.createElementBlock("div",{key:g,class:n.normalizeClass(o.pgtcontainercardClass),style:n.normalizeStyle(g==0?"margin-left: 0px !important; color: white;":"")},[t.type==3e3?(n.openBlock(),n.createBlock(r,{key:0,type:"player","color-background-home":m.colorbackgroundhome,"color-background-away":m.colorbackgroundaway,"name-player":m.nameplayer,"type-img":0,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),background:m.background,"name-home-team":m.namehometeam,"name-away-team":m.nameawayteam,"name-category":"RESUMEN","logo-away":m.logoaway,"logo-home":m.logohome,"color-font":m.colorfont,"score-home":m.scorehome,"photo-profile":m.photoprofile,"score-away":m.logoaway,"type-style":"summary"},null,8,["color-background-home","color-background-away","name-player","onOnclickPlayVideos","background","name-home-team","name-away-team","logo-away","logo-home","color-font","score-home","photo-profile","score-away"])):n.createCommentVNode("",!0),t.type==4e3?(n.openBlock(),n.createBlock(l,{key:1,type:"team","show-videos":t.showVideos,"name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-home":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["show-videos","name-team","color-background-home","logo-home","onOnclickPlayVideos","background","name-category"])):n.createCommentVNode("",!0),t.type==5e3?(n.openBlock(),n.createBlock(d,{key:2,type:"team","name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-away":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["name-team","color-background-away","logo-home","onOnclickPlayVideos","background","name-category"])):n.createCommentVNode("",!0)],6))),128))]),_:1},8,["backgroundColor","pxScroll","arrows","arrowsScrollHide","arrowsHideOnNoScroll","arrowsColor","arrowsHeight","arrowsWidth","arrowsPadding","arrowsMargin","arrowsRadius","arrowsBorder","arrowsBackground","arrowsContainerBgL","arrowsContainerBgR","scrollColor","arrowsPosition","height"])):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[i.printData.length>0?(n.openBlock(),n.createBlock(c,{key:0,backgroundColor:t.backgroundColor,pxScroll:t.pxScroll,arrows:t.arrows,arrowsScrollHide:t.arrowsScrollHide,arrowsHideOnNoScroll:t.arrowsHideOnNoScroll,arrowsColor:t.arrowsColor,arrowsHeight:t.arrowsWidth,arrowsWidth:t.arrowsWidth,arrowsPadding:t.arrowsPadding,arrowsMargin:t.arrowsMargin,arrowsRadius:t.arrowsRadius,arrowsBorder:t.arrowsBorder,arrowsBackground:t.arrowsBackground,arrowsContainerBgL:t.arrowsContainerBgL,arrowsContainerBgR:t.arrowsContainerBgR,scrollColor:t.scrollColor,arrowsPosition:t.arrowsPosition,height:t.height},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.printData,(m,g)=>(n.openBlock(),n.createElementBlock("div",{key:g,class:n.normalizeClass(o.pgtcontainercardClass),style:n.normalizeStyle(g==0?"margin-left: 0px !important; color: white;":"")},[t.type==2?(n.openBlock(),n.createBlock(h,{key:0,"color-background-home":m.color,"name-player":t.data.player_name,"type-img":"0",background:m.background_action,"name-category":m.player_name,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),"photo-profile":m.player_action},null,8,["color-background-home","name-player","background","name-category","logo-home","onOnclickPlayVideos","photo-profile"])):t.type==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[m.total>0?(n.openBlock(),n.createBlock(l,{key:0,type:"team","show-videos":t.showVideos,"name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-home":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["show-videos","name-team","color-background-home","logo-home","onOnclickPlayVideos","background","name-category"])):n.createCommentVNode("",!0)],64)):t.type==4?(n.openBlock(),n.createBlock(l,{key:2,type:"team","show-videos":t.showVideos,"name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-home":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["show-videos","name-team","color-background-home","logo-home","onOnclickPlayVideos","background","name-category"])):t.type==5?(n.openBlock(),n.createBlock(u,{key:3,type:"team","name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-away":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["name-team","color-background-away","logo-home","onOnclickPlayVideos","background","name-category"])):t.type==0?(n.openBlock(),n.createBlock(f,{key:4,items:m,type:2,"name-category":"TODAS SUS JUGADAS","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2,isAllPlays:!0}),background:m.background,date:m.date,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname2},null,8,["items","color-background-home","color-background-away","color-font-home","color-font-away","logo-home","logo-away","onOnclickPlayVideos","background","date","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==6?(n.openBlock(),n.createBlock(p,{key:5,items:m,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,background:m.background,"title-category":"GOLES","show-videos":t.showVideos,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3,categories:i.goalCategories}),matchday:m.match,"season-name":m.seasonname,score:m.score},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","background","show-videos","onOnclickPlayVideos","matchday","season-name","score"])):t.type==7||t.type==16?(n.openBlock(),n.createBlock(p,{key:6,items:m,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,background:m.background,"show-videos":t.showVideos,"title-category":"RESUMEN",onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3,categories:i.resumeCategories}),matchday:m.match,"season-name":m.seasonname,score:m.score},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","background","show-videos","onOnclickPlayVideos","matchday","season-name","score"])):t.type==8?(n.openBlock(),n.createBlock(f,{key:7,items:m,type:2,"name-category":"RESUMEN","color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-font-home","color-font-away","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==9?(n.openBlock(),n.createBlock(f,{key:8,items:m,type:2,"name-category":"RESUMEN","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),"logo-away":m.logoaway,background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","onOnclickPlayVideos","logo-away","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==10?(n.openBlock(),n.createBlock(p,{key:9,items:m,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1}),background:m.background,"title-category":"RESUMEN",matchday:m.match,"season-name":m.seasonname,score:m.score},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","matchday","season-name","score"])):t.type==11?(n.openBlock(),n.createBlock(f,{key:10,items:m,type:2,"name-category":"RESUMEN","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","background","name-home-team","name-away-team","matchday","color-font-home","color-font-away","onOnclickPlayVideos","score-home","photo-profile","score-away","season-name"])):t.type==12?(n.openBlock(),n.createBlock(f,{key:11,items:m,type:2,"name-category":"RESUMEN","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,"color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","color-font-home","color-font-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==13?(n.openBlock(),n.createBlock(f,{key:12,items:m,type:2,"name-category":"GOLES","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1,categories:i.goalCategories}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==14||t.type==15||t.type==17?(n.openBlock(),n.createBlock(f,{key:13,items:m,type:2,"show-videos":t.showVideos,"play-status":m.plays_status?m.plays_status:0,"name-category":"GOLES","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1,categories:i.goalCategories}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,showimg:!1,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","show-videos","play-status","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):(n.openBlock(),n.createBlock(r,{key:14,type:"player","color-background-home":m.colorbackgroundhome,"color-background-away":m.colorbackgroundaway,"name-player":m.nameplayer,"type-img":0,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),background:m.background,"name-home-team":m.namehometeam,"name-away-team":m.nameawayteam,"name-category":"RESUMEN","logo-away":m.logoaway,"logo-home":m.logohome,"color-font":m.colorfont,"score-home":m.scorehome,"photo-profile":m.photoprofile,"score-away":m.logoaway,"type-style":"summary"},null,8,["color-background-home","color-background-away","name-player","onOnclickPlayVideos","background","name-home-team","name-away-team","logo-away","logo-home","color-font","score-home","photo-profile","score-away"]))],6))),128))]),_:1},8,["backgroundColor","pxScroll","arrows","arrowsScrollHide","arrowsHideOnNoScroll","arrowsColor","arrowsHeight","arrowsWidth","arrowsPadding","arrowsMargin","arrowsRadius","arrowsBorder","arrowsBackground","arrowsContainerBgL","arrowsContainerBgR","scrollColor","arrowsPosition","height"])):n.createCommentVNode("",!0)],64))],2)}const Z3={name:"DiscoverVideos",components:{GscSwitchComponent:bo,GSCPlayerTeamGame:os(Wr,[["render",X3],["__cssModules",{$style:J3}],["__scopeId","data-v-762f089f"]]),MatchDayPicker:Wh},props:{componentWidth:{type:Number,default:768},myTournament:{type:Number,default:1},videoType:{type:Number,default:1},isplayer:{type:Boolean,default:!1},team:{type:Number,default:0},player:{type:Number,default:0},user:{type:Object,default:()=>{}},nextRivalTeam:{type:Object,default:()=>{}},tournamentSelected:{type:Object,default:()=>({id:0})},defaultMatchDayKey:{type:String,default:""},isLeagueSelected:{type:Boolean,default:!1},isFull:{type:Boolean,default:!1},tournamentScheduleKeys:{type:Array,default:()=>[]},seasonSelected:{type:Object,default:()=>{}},defaultMediaPlayerSeason:{type:Number,default:0}},watch:{seasonSelected:{immediate:!0,deep:!1,async handler(){this.getDataGoals()}},tournamentSelected:{immediate:!0,deep:!1,async handler(s){this.myTournament!==s.id?this.currentTabMoreVideos="Goles":this.currentTabMoreVideos="Goles"}},closestRound(s){this.selectedRoundKeyIndex=this.tournamentScheduleKeys.findIndex(e=>e===s),this.selectedRound=s},activeDropGoals:{handler(s){s&&(this.matchDayPickerKey+=1)},immediate:!0}},data(){return{token:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE",url:"https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/best-plays/seasons/",showVideos:!0,currentTabMoreVideos:"Resumen",currentMobileTab:"Descubre videos",mobileClass:!1,activeDropGoals:!1,matchdayActive:{},resumeCategory:1000001,goalsCategory:1255e3,resumeType:1,goalsType:2,matchDayPickerKey:0}},mounted(){this.mobileClass=window.innerWidth<768,window.addEventListener("resize",this.handleResize)},methods:{async getDataGoals(){try{this.seasonSelected&&this.seasonSelected.id&&(await Ae.create({headers:{Authorization:`${this.token}`}}).get(this.url+this.seasonSelected.id+"/categories/"+this.goalsCategory),this.showVideos=!0)}catch{this.showVideos=!1}},onChangeMatchDay(s){this.matchdayActive=s,this.$emit("change-match-day",s)},handleResize(){this.mobileClass=window.innerWidth<768},onOpenMedia(s,e){e&&(s.type=0),this.$emit("openmedia",s)},onClickOpenMedia(){let t=1,a=[],i=[],o=0,r=this.defaultMediaPlayerSeason||this.user.season,l=[],d=[12,55,"35_r","54_r"],c=[12,35,10,27,607,61,519,98,101,109,112,121,122,127,128,135,136,141,142,161,170,179,702,730,466,217,211,232,235,239,242,282,284,289,291,296,485,486,487,488,14,15,257],h=[55,324,323,608,39,774,802,52,53,40,54];!this.user.is_generic&&this.tournamentSelected.id===this.user.tournament?(r=this.seasonSelected.id,this.user.is_goalkeeper?(a=[this.user.player],l=h,t=2):this.user.is_player?(i=[this.user.player],l=c,t=2):(o=this.user.team,l=d,t=3)):(l=d,t=1);const u={type:0,seasonId:r,tournaments:[],isFeaturedPlayers:!1,mainSectionType:1,playListType:t,gameIds:null,playerIds:i,goalkeeperIds:a,categoryIds:l,teamId:o,matchResult:[1,2,3],categorySingleName:"",avoidCategorySingleName:!1,currentPlayIndex:0,playData:null,lastClashedGameId:null,tournamentsLastClashes:null,advancedFilter:{playListTitle:""},objectPlaySync:null};this.$emit("openmedia",u)}}},Q3={key:0,class:"discover-videos",ref:"discoverVideosRef"},eB={class:"title-and-button"},tB={class:"calendar-container"};function sB(s,e,t,a,i,o){const r=n.resolveComponent("GscSwitchComponent"),l=n.resolveComponent("MatchDayPicker"),d=n.resolveComponent("GSCPlayerTeamGame");return i.showVideos?(n.openBlock(),n.createElementBlock("div",Q3,[n.createElementVNode("div",eB,[n.createElementVNode("div",{class:n.normalizeClass(t.componentWidth>900?"menu-container":"menu-container-movil")},[n.createElementVNode("div",{class:n.normalizeClass(t.componentWidth>768?"title-value":t.componentWidth>600?"title-value-tablet":t.componentWidth>400?"title-value-mobile":"title-value-mobilesm")}," Videos ",2)],2),!t.user.is_generic&&t.myTournament===t.tournamentSelected.id?(n.openBlock(),n.createBlock(r,{key:0,buttons:["Goles","Resumen","Proximo rival"],onInput:e[0]||(e[0]=c=>i.currentTabMoreVideos=c),background:"trasparent",height:"24px",width:t.componentWidth>768?"140px":t.componentWidth>600?"120px":t.componentWidth>400?"100px":"81px","font-size":t.componentWidth>768?"14px":t.componentWidth>600||t.componentWidth>400?"12px":"9.1px","font-family":"Poppins-Light",backgroundOptionActive:"transparent",borderWidth:"2px",type:2,arrow:!1,selectedOption:i.currentTabMoreVideos,onOpenmedia:o.onOpenMedia},null,8,["width","font-size","selectedOption","onOpenmedia"])):n.createCommentVNode("",!0)]),i.currentTabMoreVideos=="Goles"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("div",tB,[n.createCommentVNode("",!0),(n.openBlock(),n.createBlock(l,{height:"48px","margin-top":"5px","disable-matchdays":!0,"match-days":t.tournamentScheduleKeys,"is-landing-mode":!1,"items-to-show":t.componentWidth>600?17:t.componentWidth>400?13:9,"items-to-scroll":t.componentWidth>600?8:t.componentWidth>400?12:9,"default-match-day-key":t.defaultMatchDayKey,key:i.matchDayPickerKey,onChangeMatchDay:o.onChangeMatchDay},null,8,["match-days","items-to-show","items-to-scroll","default-match-day-key","onChangeMatchDay"]))]),n.createVNode(d,{style:{"margin-top":"-30px"},type:14,data:{season:t.seasonSelected.id,category:i.goalsCategory},width:"100%","matchday-view":Object.keys(i.matchdayActive).length>0?i.matchdayActive.matchDayId:1,backgroundColor:"transparent",title:"",onOpenmedia:o.onOpenMedia},null,8,["data","matchday-view","onOpenmedia"])],64)):n.createCommentVNode("",!0),i.currentTabMoreVideos=="Resumen"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t.isplayer?(n.openBlock(),n.createBlock(d,{key:1,type:8,title:"",style:{"margin-top":"-30px"},backgroundColor:"transparent",data:{season:t.seasonSelected.id,player:t.player,category:1000001},width:"100%",onOpenmedia:e[3]||(e[3]=c=>o.onOpenMedia(c,!0))},null,8,["data"])):(n.openBlock(),n.createBlock(d,{key:0,type:7,title:"",style:{"margin-top":"-30px"},backgroundColor:"transparent",data:{season:t.seasonSelected.id,team:t.team,category:i.resumeCategory},width:"100%",onOpenmedia:e[2]||(e[2]=c=>o.onOpenMedia(c,!0))},null,8,["data"]))],64)):n.createCommentVNode("",!0),i.currentTabMoreVideos=="Proximo rival"?(n.openBlock(),n.createBlock(d,{key:2,type:7,style:{"margin-top":"-30px"},title:"",backgroundColor:"transparent",data:{season:t.seasonSelected.id,team:t.nextRivalTeam.id,category:i.resumeCategory},width:"100%",onOpenmedia:e[4]||(e[4]=c=>o.onOpenMedia(c,!0))},null,8,["data"])):n.createCommentVNode("",!0)],512)):n.createCommentVNode("",!0)}const aB=Ye(Z3,[["render",sB],["__scopeId","data-v-b485c3f6"]]),nB=["playId","league","season","gameId","playerName","refereeName","stadiumName","finalScore","scoreAtMomentOfPlay","gameDate","homeTeamName","homeTeamLogo","awayTeamName","awayTeamLogo","categoryId","categoryName","startTime","endTime","minuteOfPlay","momentOfPlay","videoUrl"];let Kr=null;function iB(){return Kr||(Kr=nB.reduce((s,e,t)=>(s[e]=t,s),{})),Kr}function oB(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var sf={exports:{}};(function(s,e){(function(t){var a=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,o=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(d,c,h){if(h=h||{},d=d.trim(),c=c.trim(),!c){if(!h.alwaysNormalize)return d;var u=l.parseURL(d);if(!u)throw new Error("Error trying to parse base URL.");return u.path=l.normalizePath(u.path),l.buildURLFromParts(u)}var f=l.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return h.alwaysNormalize?(f.path=l.normalizePath(f.path),l.buildURLFromParts(f)):c;var p=l.parseURL(d);if(!p)throw new Error("Error trying to parse base URL.");if(!p.netLoc&&p.path&&p.path[0]!=="/"){var m=i.exec(p.path);p.netLoc=m[1],p.path=m[2]}p.netLoc&&!p.path&&(p.path="/");var g={scheme:p.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(g.netLoc=p.netLoc,f.path[0]!=="/"))if(!f.path)g.path=p.path,f.params||(g.params=p.params,f.query||(g.query=p.query));else{var y=p.path,b=y.substring(0,y.lastIndexOf("/")+1)+f.path;g.path=l.normalizePath(b)}return g.path===null&&(g.path=h.alwaysNormalize?l.normalizePath(f.path):f.path),l.buildURLFromParts(g)},parseURL:function(d){var c=a.exec(d);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(d){for(d=d.split("").reverse().join("").replace(o,"");d.length!==(d=d.replace(r,"")).length;);return d.split("").reverse().join("")},buildURLFromParts:function(d){return d.scheme+d.netLoc+d.path+d.params+d.query+d.fragment}};s.exports=l})()})(sf);var qr=sf.exports;function af(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);e&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),t.push.apply(t,a)}return t}function Ze(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?af(Object(t),!0).forEach(function(a){cB(s,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):af(Object(t)).forEach(function(a){Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(t,a))})}return s}function rB(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var a=t.call(s,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function lB(s){var e=rB(s,"string");return typeof e=="symbol"?e:String(e)}function cB(s,e,t){return e=lB(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function je(){return je=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=t[a])}return s},je.apply(this,arguments)}const ae=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},dB=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=hB},hB=Number.MAX_SAFE_INTEGER||9007199254740991;let _=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s}({}),pe=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),N=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const ks=function(){},Yr={trace:ks,debug:ks,log:ks,warn:ks,info:ks,error:ks};let ka=Yr;function uB(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):ks}function mB(s,...e){e.forEach(function(t){ka[t]=s[t]?s[t].bind(s):uB(t)})}function fB(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){mB(s,"debug","log","info","warn","error");try{ka.log(`Debug logs enabled for "${e}" in hls.js version 1.5.16`)}catch{ka=Yr}}else ka=Yr}const A=ka,pB=/^(\d+)x(\d+)$/,nf=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Me{constructor(e){typeof e=="string"&&(e=Me.parseAttrList(e)),je(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const a=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)a[i]=parseInt(t.slice(i*2,i*2+2),16);return a}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const a=this[e];return a?parseFloat(a):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=pB.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const a={},i='"';for(nf.lastIndex=0;(t=nf.exec(e))!==null;){let o=t[2];o.indexOf(i)===0&&o.lastIndexOf(i)===o.length-1&&(o=o.slice(1,-1));const r=t[1].trim();a[r]=o}return a}}function gB(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function yB(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class of{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const a=t.attr;for(const i in a)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==a[i]){A.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=je(new Me({}),a,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const a=new Date(this.attr["END-DATE"]);ae(a.getTime())&&(this._endDate=a)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(ae(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&ae(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Gn{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Be={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class rf{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Be.AUDIO]:null,[Be.VIDEO]:null,[Be.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const a=e.split("@",2);let i;a.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(a[1]),this._byteRange=[i,parseInt(a[0])+i]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=qr.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Jr extends rf{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Gn,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const a=Object.keys(this.levelkeys);if(a.length===1)return this._decryptdata=this.levelkeys[a[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!ae(this.programDateTime))return null;const e=ae(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),a=t.length;if(a>1||a===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,a,i,o,r=!1){const{elementaryStreams:l}=this,d=l[e];if(!d){l[e]={startPTS:t,endPTS:a,startDTS:i,endDTS:o,partial:r};return}d.startPTS=Math.min(d.startPTS,t),d.endPTS=Math.max(d.endPTS,a),d.startDTS=Math.min(d.startDTS,i),d.endDTS=Math.max(d.endDTS,o)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Be.AUDIO]=null,e[Be.VIDEO]=null,e[Be.AUDIOVIDEO]=null}}class bB extends rf{constructor(e,t,a,i,o){super(a),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Gn,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const r=e.enumeratedString("BYTERANGE");r&&this.setByteRange(r,o),o&&(this.fragOffset=o.fragOffset+o.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const SB=10;class _B{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,a=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!a||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&a>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?ae(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||SB}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Xr(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function wB(s){const e=Zr(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function kB(s){const e=function(a,i,o){const r=a[i];a[i]=a[o],a[o]=r};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function EB(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const a=e[1].split(";"),i=a[a.length-1].split(",");if(i.length===2){const o=i[0]==="base64",r=i[1];o?(a.splice(-1,1),t=Xr(r)):t=wB(r)}}return t}function Zr(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const Vs=typeof self<"u"?self:void 0;var De={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},mt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function lf(s){switch(s){case mt.FAIRPLAY:return De.FAIRPLAY;case mt.PLAYREADY:return De.PLAYREADY;case mt.WIDEVINE:return De.WIDEVINE;case mt.CLEARKEY:return De.CLEARKEY}}var Ea={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",FAIRPLAY:"94ce86fb07ff4f43adb893d2fa968ca2",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function cf(s){if(s===Ea.WIDEVINE)return De.WIDEVINE;if(s===Ea.PLAYREADY)return De.PLAYREADY;if(s===Ea.CENC||s===Ea.CLEARKEY)return De.CLEARKEY}function df(s){switch(s){case De.FAIRPLAY:return mt.FAIRPLAY;case De.PLAYREADY:return mt.PLAYREADY;case De.WIDEVINE:return mt.WIDEVINE;case De.CLEARKEY:return mt.CLEARKEY}}function Qr(s){const{drmSystems:e,widevineLicenseUrl:t}=s,a=e?[De.FAIRPLAY,De.WIDEVINE,De.PLAYREADY,De.CLEARKEY].filter(i=>!!e[i]):[];return!a[De.WIDEVINE]&&t&&a.push(De.WIDEVINE),a}const hf=function(s){return Vs!=null&&(s=Vs.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function TB(s,e,t,a){let i;switch(s){case De.FAIRPLAY:i=["cenc","sinf"];break;case De.WIDEVINE:case De.PLAYREADY:i=["cenc"];break;case De.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return CB(i,e,t,a)}function CB(s,e,t,a){return[{initDataTypes:s,persistentState:a.persistentState||"optional",distinctiveIdentifier:a.distinctiveIdentifier||"optional",sessionTypes:a.sessionTypes||[a.sessionType||"temporary"],audioCapabilities:e.map(o=>({contentType:`audio/mp4; codecs="${o}"`,robustness:a.audioRobustness||"",encryptionScheme:a.audioEncryptionScheme||null})),videoCapabilities:t.map(o=>({contentType:`video/mp4; codecs="${o}"`,robustness:a.videoRobustness||"",encryptionScheme:a.videoEncryptionScheme||null}))}]}function Es(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const el=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,uf=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,Ta=(s,e)=>{const t=e;let a=0;for(;el(s,e);){a+=10;const i=jn(s,e+6);a+=i,uf(s,e+10)&&(a+=10),e+=a}if(a>0)return s.subarray(t,t+a)},jn=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},xB=(s,e)=>el(s,e)&&jn(s,e+6)+10<=s.length-e,tl=s=>{const e=ff(s);for(let t=0;t<e.length;t++){const a=e[t];if(mf(a))return BB(a)}},mf=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",vB=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=jn(s,4),a=10;return{type:e,size:t,data:s.subarray(a,a+t)}},ff=s=>{let e=0;const t=[];for(;el(s,e);){const a=jn(s,e+6);e+=10;const i=e+a;for(;e+8<i;){const o=vB(s.subarray(e)),r=AB(o);r&&t.push(r),e+=o.size+10}uf(s,e)&&(e+=10)}return t},AB=s=>s.type==="PRIV"?LB(s):s.type[0]==="W"?RB(s):IB(s),LB=s=>{if(s.size<2)return;const e=zt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},IB=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const a=zt(s.data.subarray(t),!0);t+=a.length+1;const i=zt(s.data.subarray(t));return{key:s.type,info:a,data:i}}const e=zt(s.data.subarray(1));return{key:s.type,data:e}},RB=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const a=zt(s.data.subarray(t),!0);t+=a.length+1;const i=zt(s.data.subarray(t));return{key:s.type,info:a,data:i}}const e=zt(s.data);return{key:s.type,data:e}},BB=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let a=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return a/=45,t&&(a+=4772185884e-2),Math.round(a)}},zt=(s,e=!1)=>{const t=NB();if(t){const c=t.decode(s);if(e){const h=c.indexOf("\0");return h!==-1?c.substring(0,h):c}return c.replace(/\0/g,"")}const a=s.length;let i,o,r,l="",d=0;for(;d<a;){if(i=s[d++],i===0&&e)return l;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(i);break;case 12:case 13:o=s[d++],l+=String.fromCharCode((i&31)<<6|o&63);break;case 14:o=s[d++],r=s[d++],l+=String.fromCharCode((i&15)<<12|(o&63)<<6|(r&63)<<0);break}}return l};let sl;function NB(){if(!navigator.userAgent.includes("PlayStation 4"))return!sl&&typeof self.TextDecoder<"u"&&(sl=new self.TextDecoder("utf-8")),sl}const Ut={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let a=s[t].toString(16);a.length<2&&(a="0"+a),e+=a}return e}},Hn=Math.pow(2,32)-1,DB=[].push,pf={video:1,audio:2,id3:3,text:4};function qe(s){return String.fromCharCode.apply(null,s)}function gf(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function re(s,e){const t=bf(s,e);return t<0?4294967296+t:t}function yf(s,e){let t=re(s,e);return t*=Math.pow(2,32),t+=re(s,e+4),t}function bf(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function al(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function PB(s){const e=s.byteLength;for(let t=0;t<e;){const a=re(s,t);if(a>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=a>1?t+a:e}return!1}function Se(s,e){const t=[];if(!e.length)return t;const a=s.byteLength;for(let i=0;i<a;){const o=re(s,i),r=qe(s.subarray(i+4,i+8)),l=o>1?i+o:a;if(r===e[0])if(e.length===1)t.push(s.subarray(i+8,l));else{const d=Se(s.subarray(i+8,l),e.slice(1));d.length&&DB.apply(t,d)}i=l}return t}function OB(s){const e=[],t=s[0];let a=8;const i=re(s,a);a+=4;let o=0,r=0;t===0?(o=re(s,a),r=re(s,a+4),a+=8):(o=yf(s,a),r=yf(s,a+8),a+=16),a+=2;let l=s.length+r;const d=gf(s,a);a+=2;for(let c=0;c<d;c++){let h=a;const u=re(s,h);h+=4;const f=u&2147483647;if((u&2147483648)>>>31===1)return A.warn("SIDX has hierarchical references (not supported)"),null;const m=re(s,h);h+=4,e.push({referenceSize:f,subsegmentDuration:m,info:{duration:m/i,start:l,end:l+f-1}}),l+=f,h+=4,a=h}return{earliestPresentationTime:o,timescale:i,version:t,referencesCount:d,references:e}}function Sf(s){const e=[],t=Se(s,["moov","trak"]);for(let i=0;i<t.length;i++){const o=t[i],r=Se(o,["tkhd"])[0];if(r){let l=r[0];const d=re(r,l===0?12:20),c=Se(o,["mdia","mdhd"])[0];if(c){l=c[0];const h=re(c,l===0?12:20),u=Se(o,["mdia","hdlr"])[0];if(u){const f=qe(u.subarray(8,12)),p={soun:Be.AUDIO,vide:Be.VIDEO}[f];if(p){const m=Se(o,["mdia","minf","stbl","stsd"])[0],g=FB(m);e[d]={timescale:h,type:p},e[p]=Ze({timescale:h,id:d},g)}}}}}return Se(s,["moov","mvex","trex"]).forEach(i=>{const o=re(i,4),r=e[o];r&&(r.default={duration:re(i,12),flags:re(i,20)})}),e}function FB(s){const e=s.subarray(8),t=e.subarray(86),a=qe(e.subarray(4,8));let i=a;const o=a==="enca"||a==="encv";if(o){const l=Se(e,[a])[0].subarray(a==="enca"?28:78);Se(l,["sinf"]).forEach(c=>{const h=Se(c,["schm"])[0];if(h){const u=qe(h.subarray(4,8));if(u==="cbcs"||u==="cenc"){const f=Se(c,["frma"])[0];f&&(i=qe(f))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const r=Se(t,["avcC"])[0];i+="."+Wn(r[1])+Wn(r[2])+Wn(r[3]);break}case"mp4a":{const r=Se(e,[a])[0],l=Se(r.subarray(28),["esds"])[0];if(l&&l.length>12){let d=4;if(l[d++]!==3)break;d=nl(l,d),d+=2;const c=l[d++];if(c&128&&(d+=2),c&64&&(d+=l[d++]),l[d++]!==4)break;d=nl(l,d);const h=l[d++];if(h===64)i+="."+Wn(h);else break;if(d+=12,l[d++]!==5)break;d=nl(l,d);const u=l[d++];let f=(u&248)>>3;f===31&&(f+=1+((u&7)<<3)+((l[d]&224)>>5)),i+="."+f}break}case"hvc1":case"hev1":{const r=Se(t,["hvcC"])[0],l=r[1],d=["","A","B","C"][l>>6],c=l&31,h=re(r,2),u=(l&32)>>5?"H":"L",f=r[12],p=r.subarray(6,12);i+="."+d+c,i+="."+h.toString(16).toUpperCase(),i+="."+u+f;let m="";for(let g=p.length;g--;){const y=p[g];(y||m)&&(m="."+y.toString(16).toUpperCase()+m)}i+=m;break}case"dvh1":case"dvhe":{const r=Se(t,["dvcC"])[0],l=r[2]>>1&127,d=r[2]<<5&32|r[3]>>3&31;i+="."+Gt(l)+"."+Gt(d);break}case"vp09":{const r=Se(t,["vpcC"])[0],l=r[4],d=r[5],c=r[6]>>4&15;i+="."+Gt(l)+"."+Gt(d)+"."+Gt(c);break}case"av01":{const r=Se(t,["av1C"])[0],l=r[1]>>>5,d=r[1]&31,c=r[2]>>>7?"H":"M",h=(r[2]&64)>>6,u=(r[2]&32)>>5,f=l===2&&h?u?12:10:h?10:8,p=(r[2]&16)>>4,m=(r[2]&8)>>3,g=(r[2]&4)>>2,y=r[2]&3;i+="."+l+"."+Gt(d)+c+"."+Gt(f)+"."+p+"."+m+g+y+"."+Gt(1)+"."+Gt(1)+"."+Gt(1)+"."+0;break}}return{codec:i,encrypted:o}}function nl(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function Wn(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function Gt(s){return(s<10?"0":"")+s}function MB(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&Se(s,["moov","trak"]).forEach(i=>{const r=Se(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let l=Se(r,["enca"]);const d=l.length>0;d||(l=Se(r,["encv"])),l.forEach(c=>{const h=d?c.subarray(28):c.subarray(78);Se(h,["sinf"]).forEach(f=>{const p=_f(f);if(p){const m=p.subarray(8,24);m.some(g=>g!==0)||(A.log(`[eme] Patching keyId in 'enc${d?"a":"v"}>sinf>>tenc' box: ${Ut.hexDump(m)} -> ${Ut.hexDump(t)}`),p.set(t,8))}})})}),s}function _f(s){const e=Se(s,["schm"])[0];if(e){const t=qe(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Se(s,["schi","tenc"])[0]}return null}function VB(s,e){return Se(e,["moof","traf"]).reduce((t,a)=>{const i=Se(a,["tfdt"])[0],o=i[0],r=Se(a,["tfhd"]).reduce((l,d)=>{const c=re(d,4),h=s[c];if(h){let u=re(i,4);if(o===1){if(u===Hn)return A.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),l;u*=Hn+1,u+=re(i,8)}const f=h.timescale||9e4,p=u/f;if(ae(p)&&(l===null||p<l))return p}return l},null);return r!==null&&ae(r)&&(t===null||r<t)?r:t},null)}function $B(s,e){let t=0,a=0,i=0;const o=Se(s,["moof","traf"]);for(let r=0;r<o.length;r++){const l=o[r],d=Se(l,["tfhd"])[0],c=re(d,4),h=e[c];if(!h)continue;const u=h.default,f=re(d,0)|(u==null?void 0:u.flags);let p=u==null?void 0:u.duration;f&8&&(f&2?p=re(d,12):p=re(d,8));const m=h.timescale||9e4,g=Se(l,["trun"]);for(let y=0;y<g.length;y++){if(t=zB(g[y]),!t&&p){const b=re(g[y],4);t=p*b}h.type===Be.VIDEO?a+=t/m:h.type===Be.AUDIO&&(i+=t/m)}}if(a===0&&i===0){let r=1/0,l=0,d=0;const c=Se(s,["sidx"]);for(let h=0;h<c.length;h++){const u=OB(c[h]);if(u!=null&&u.references){r=Math.min(r,u.earliestPresentationTime/u.timescale);const f=u.references.reduce((p,m)=>p+m.info.duration||0,0);l=Math.max(l,f+u.earliestPresentationTime/u.timescale),d=l-r}}if(d&&ae(d))return d}return a||i}function zB(s){const e=re(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let a=0;const i=re(s,4);for(let o=0;o<i;o++){if(e&256){const r=re(s,t);a+=r,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return a}function UB(s,e,t){Se(e,["moof","traf"]).forEach(a=>{Se(a,["tfhd"]).forEach(i=>{const o=re(i,4),r=s[o];if(!r)return;const l=r.timescale||9e4;Se(a,["tfdt"]).forEach(d=>{const c=d[0],h=t*l;if(h){let u=re(d,4);if(c===0)u-=h,u=Math.max(u,0),al(d,4,u);else{u*=Math.pow(2,32),u+=re(d,8),u-=h,u=Math.max(u,0);const f=Math.floor(u/(Hn+1)),p=Math.floor(u%(Hn+1));al(d,4,f),al(d,8,p)}}})})})}function GB(s){const e={valid:null,remainder:null},t=Se(s,["moof"]);if(t.length<2)return e.remainder=s,e;const a=t[t.length-1];return e.valid=Es(s,0,a.byteOffset-8),e.remainder=Es(s,a.byteOffset-8),e}function _t(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function wf(s,e){const t=[],a=e.samples,i=e.timescale,o=e.id;let r=!1;return Se(a,["moof"]).map(d=>{const c=d.byteOffset-8;Se(d,["traf"]).map(u=>{const f=Se(u,["tfdt"]).map(p=>{const m=p[0];let g=re(p,4);return m===1&&(g*=Math.pow(2,32),g+=re(p,8)),g/i})[0];return f!==void 0&&(s=f),Se(u,["tfhd"]).map(p=>{const m=re(p,4),g=re(p,0)&16777215,y=(g&1)!==0,b=(g&2)!==0,S=(g&8)!==0;let w=0;const x=(g&16)!==0;let T=0;const v=(g&32)!==0;let E=8;m===o&&(y&&(E+=8),b&&(E+=4),S&&(w=re(p,E),E+=4),x&&(T=re(p,E),E+=4),v&&(E+=4),e.type==="video"&&(r=jB(e.codec)),Se(u,["trun"]).map(B=>{const I=B[0],R=re(B,0)&16777215,M=(R&1)!==0;let K=0;const H=(R&4)!==0,se=(R&256)!==0;let oe=0;const ne=(R&512)!==0;let ce=0;const de=(R&1024)!==0,Z=(R&2048)!==0;let q=0;const he=re(B,4);let J=8;M&&(K=re(B,J),J+=4),H&&(J+=4);let X=K+c;for(let ue=0;ue<he;ue++){if(se?(oe=re(B,J),J+=4):oe=w,ne?(ce=re(B,J),J+=4):ce=T,de&&(J+=4),Z&&(I===0?q=re(B,J):q=bf(B,J),J+=4),e.type===Be.VIDEO){let be=0;for(;be<ce;){const xe=re(a,X);if(X+=4,HB(r,a[X])){const te=a.subarray(X,X+xe);kf(te,r?2:1,s+q/i,t)}X+=xe,be+=xe+4}}s+=oe/i}}))})})}),t}function jB(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function HB(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function kf(s,e,t,a){const i=Ef(s);let o=0;o+=e;let r=0,l=0,d=0;for(;o<i.length;){r=0;do{if(o>=i.length)break;d=i[o++],r+=d}while(d===255);l=0;do{if(o>=i.length)break;d=i[o++],l+=d}while(d===255);const c=i.length-o;let h=o;if(l<c)o+=l;else if(l>c){A.error(`Malformed SEI payload. ${l} is too small, only ${c} bytes left to parse.`);break}if(r===4){if(i[h++]===181){const f=gf(i,h);if(h+=2,f===49){const p=re(i,h);if(h+=4,p===1195456820){const m=i[h++];if(m===3){const g=i[h++],y=31&g,b=64&g,S=b?2+y*3:0,w=new Uint8Array(S);if(b){w[0]=g;for(let x=1;x<S;x++)w[x]=i[h++]}a.push({type:m,payloadType:r,pts:t,bytes:w})}}}}}else if(r===5&&l>16){const u=[];for(let m=0;m<16;m++){const g=i[h++].toString(16);u.push(g.length==1?"0"+g:g),(m===3||m===5||m===7||m===9)&&u.push("-")}const f=l-16,p=new Uint8Array(f);for(let m=0;m<f;m++)p[m]=i[h++];a.push({payloadType:r,pts:t,uuid:u.join(""),userData:zt(p),userDataBytes:p})}}}function Ef(s){const e=s.byteLength,t=[];let a=1;for(;a<e-2;)s[a]===0&&s[a+1]===0&&s[a+2]===3?(t.push(a+2),a+=2):a++;if(t.length===0)return s;const i=e-t.length,o=new Uint8Array(i);let r=0;for(a=0;a<i;r++,a++)r===t[0]&&(r++,t.shift()),o[a]=s[r];return o}function WB(s){const e=s[0];let t="",a="",i=0,o=0,r=0,l=0,d=0,c=0;if(e===0){for(;qe(s.subarray(c,c+1))!=="\0";)t+=qe(s.subarray(c,c+1)),c+=1;for(t+=qe(s.subarray(c,c+1)),c+=1;qe(s.subarray(c,c+1))!=="\0";)a+=qe(s.subarray(c,c+1)),c+=1;a+=qe(s.subarray(c,c+1)),c+=1,i=re(s,12),o=re(s,16),l=re(s,20),d=re(s,24),c=28}else if(e===1){c+=4,i=re(s,c),c+=4;const u=re(s,c);c+=4;const f=re(s,c);for(c+=4,r=2**32*u+f,dB(r)||(r=Number.MAX_SAFE_INTEGER,A.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=re(s,c),c+=4,d=re(s,c),c+=4;qe(s.subarray(c,c+1))!=="\0";)t+=qe(s.subarray(c,c+1)),c+=1;for(t+=qe(s.subarray(c,c+1)),c+=1;qe(s.subarray(c,c+1))!=="\0";)a+=qe(s.subarray(c,c+1)),c+=1;a+=qe(s.subarray(c,c+1)),c+=1}const h=s.subarray(c,s.byteLength);return{schemeIdUri:t,value:a,timeScale:i,presentationTime:r,presentationTimeDelta:o,eventDuration:l,id:d,payload:h}}function KB(s,...e){const t=e.length;let a=8,i=t;for(;i--;)a+=e[i].byteLength;const o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=a&255,o.set(s,4),i=0,a=8;i<t;i++)o.set(e[i],a),a+=e[i].byteLength;return o}function qB(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let a,i;a=0,i=new Uint8Array;let o;a>0?(o=new Uint8Array(4),e.length>0&&new DataView(o.buffer).setUint32(0,e.length,!1)):o=new Uint8Array;const r=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),KB([112,115,115,104],new Uint8Array([a,0,0,0]),s,o,i,r,t||new Uint8Array)}function YB(s){const e=[];if(s instanceof ArrayBuffer){const t=s.byteLength;let a=0;for(;a+32<t;){const i=new DataView(s,a),o=JB(i);e.push(o),a+=o.size}}return e}function JB(s){const e=s.getUint32(0),t=s.byteOffset,a=s.byteLength;if(a<e)return{offset:t,size:a};if(s.getUint32(4)!==1886614376)return{offset:t,size:e};const o=s.getUint32(8)>>>24;if(o!==0&&o!==1)return{offset:t,size:e};const r=s.buffer,l=Ut.hexDump(new Uint8Array(r,t+12,16)),d=s.getUint32(28);let c=null,h=null;if(o===0){if(e-32<d||d<22)return{offset:t,size:e};h=new Uint8Array(r,t+32,d)}else if(o===1){if(!d||a<t+32+d*16+16)return{offset:t,size:e};c=[];for(let u=0;u<d;u++)c.push(new Uint8Array(r,t+32+u*16,16))}return{version:o,systemId:l,kids:c,data:h,offset:t,size:e}}let Kn={};class Ca{static clearKeyUriToKeyIdMap(){Kn={}}constructor(e,t,a,i=[1],o=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=a,this.keyFormatVersions=i,this.iv=o,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case mt.FAIRPLAY:case mt.WIDEVINE:case mt.PLAYREADY:case mt.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&A.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const a=XB(e);return new Ca(this.method,this.uri,"identity",this.keyFormatVersions,a)}const t=EB(this.uri);if(t)switch(this.keyFormat){case mt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case mt.PLAYREADY:{const a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=qB(a,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),o=String.fromCharCode.apply(null,Array.from(i)),r=o.substring(o.indexOf("<"),o.length),c=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(c){const h=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(h){const u=Xr(h).subarray(0,16);kB(u),this.keyId=u}}break}default:{let a=t.subarray(0,16);if(a.length!==16){const i=new Uint8Array(16);i.set(a,16-a.length),a=i}this.keyId=a;break}}if(!this.keyId||this.keyId.byteLength!==16){let a=Kn[this.uri];if(!a){const i=Object.keys(Kn).length%Number.MAX_SAFE_INTEGER;a=new Uint8Array(16),new DataView(a.buffer,12,4).setUint32(0,i),Kn[this.uri]=a}this.keyId=a}return this}}function XB(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const Tf=/\{\$([a-zA-Z0-9-_]+)\}/g;function Cf(s){return Tf.test(s)}function ft(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let a=t.length;a--;){const i=t[a],o=e[i];o&&(e[i]=il(s,o))}}function il(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(Tf,a=>{const i=a.substring(2,a.length-1),o=t==null?void 0:t[i];return o===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),a):o})}return e}function xf(s,e,t){let a=s.variableList;a||(s.variableList=a={});let i,o;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(i))o=r.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(r){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else i=e.NAME,o=e.VALUE;i in a?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):a[i]=o||""}function ZB(s,e,t){const a=e.IMPORT;if(t&&a in t){let i=s.variableList;i||(s.variableList=i={}),i[a]=t[a]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${a}"`))}function Ts(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function QB(s){return typeof self<"u"&&s===self.ManagedMediaSource}const qn={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function e6(s,e){const t=qn[e];return!!t&&!!t[s.slice(0,4)]}function ol(s,e,t=!0){return!s.split(",").some(a=>!vf(a,e,t))}function vf(s,e,t=!0){var a;const i=Ts(t);return(a=i==null?void 0:i.isTypeSupported(xa(s,e)))!=null?a:!1}function xa(s,e){return`${e}/mp4;codecs="${s}"`}function Af(s){if(s){const e=s.substring(0,4);return qn.video[e]}return 2}function Yn(s){return s.split(",").reduce((e,t)=>{const a=qn.video[t];return a?(a*2+e)/(e?3:2):(qn.audio[t]+e)/(e?2:1)},0)}const rl={};function t6(s,e=!0){if(rl[s])return rl[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let a=0;a<t.length;a++)if(vf(t[a],"audio",e))return rl[s]=t[a],t[a];return s}const s6=/flac|opus/i;function Jn(s,e=!0){return s.replace(s6,t=>t6(t.toLowerCase(),e))}function Lf(s,e){return s&&s!=="mp4a"?s:e&&e.split(",")[0]}function a6(s){const e=s.split(",");for(let t=0;t<e.length;t++){const a=e[t].split(".");if(a.length>2){let i=a.shift()+".";i+=parseInt(a.shift()).toString(16),i+=("000"+parseInt(a.shift()).toString(16)).slice(-4),e[t]=i}}return e.join(",")}const If=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Rf=/#EXT-X-MEDIA:(.*)/g,n6=/^#EXT(?:INF|-X-TARGETDURATION):/m,Bf=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),i6=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class jt{static findGroup(e,t){for(let a=0;a<e.length;a++){const i=e[a];if(i.id===t)return i}}static resolve(e,t){return qr.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return n6.test(e)}static parseMasterPlaylist(e,t){const a=Cf(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:a},o=[];If.lastIndex=0;let r;for(;(r=If.exec(e))!=null;)if(r[1]){var l;const c=new Me(r[1]);ft(i,c,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const h=il(i,r[2]),u={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:jt.resolve(h,t)},f=c.decimalResolution("RESOLUTION");f&&(u.width=f.width,u.height=f.height),o6(c.CODECS,u),(l=u.unknownCodecs)!=null&&l.length||o.push(u),i.levels.push(u)}else if(r[3]){const c=r[3],h=r[4];switch(c){case"SESSION-DATA":{const u=new Me(h);ft(i,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const f=u["DATA-ID"];f&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[f]=u);break}case"SESSION-KEY":{const u=Nf(h,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):A.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const u=new Me(h);ft(i,u,["NAME","VALUE","QUERYPARAM"]),xf(i,u,t)}break}case"CONTENT-STEERING":{const u=new Me(h);ft(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:jt.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=Df(h);break}}}const d=o.length>0&&o.length<i.levels.length;return i.levels=d?o:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,a){let i;const o={},r=a.levels,l={AUDIO:r.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:r.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let d=0;for(Rf.lastIndex=0;(i=Rf.exec(e))!==null;){const c=new Me(i[1]),h=c.TYPE;if(h){const u=l[h],f=o[h]||[];o[h]=f,ft(a,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const p=c.LANGUAGE,m=c["ASSOC-LANGUAGE"],g=c.CHANNELS,y=c.CHARACTERISTICS,b=c["INSTREAM-ID"],S={attrs:c,bitrate:0,id:d++,groupId:c["GROUP-ID"]||"",name:c.NAME||p||"",type:h,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:p,url:c.URI?jt.resolve(c.URI,t):""};if(m&&(S.assocLang=m),g&&(S.channels=g),y&&(S.characteristics=y),b&&(S.instreamId=b),u!=null&&u.length){const w=jt.findGroup(u,S.groupId)||u[0];Pf(S,w,"audioCodec"),Pf(S,w,"textCodec")}f.push(S)}}return o}static parseLevelPlaylist(e,t,a,i,o,r){const l=new _B(t),d=l.fragments;let c=null,h=0,u=0,f=0,p=0,m=null,g=new Jr(i,t),y,b,S,w=-1,x=!1,T=null;for(Bf.lastIndex=0,l.m3u8=e,l.hasVariableRefs=Cf(e);(y=Bf.exec(e))!==null;){x&&(x=!1,g=new Jr(i,t),g.start=f,g.sn=h,g.cc=p,g.level=a,c&&(g.initSegment=c,g.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,T&&(g.setByteRange(T),T=null)));const I=y[1];if(I){g.duration=parseFloat(I);const R=(" "+y[2]).slice(1);g.title=R||null,g.tagList.push(R?["INF",I,R]:["INF",I])}else if(y[3]){if(ae(g.duration)){g.start=f,S&&Mf(g,S,l),g.sn=h,g.level=a,g.cc=p,d.push(g);const R=(" "+y[3]).slice(1);g.relurl=il(l,R),Of(g,m),m=g,f+=g.duration,h++,u=0,x=!0}}else if(y[4]){const R=(" "+y[4]).slice(1);m?g.setByteRange(R,m):g.setByteRange(R)}else if(y[5])g.rawProgramDateTime=(" "+y[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),w===-1&&(w=d.length);else{if(y=y[0].match(i6),!y){A.warn("No matches on slow regex match for level playlist!");continue}for(b=1;b<y.length&&!(typeof y[b]<"u");b++);const R=(" "+y[b]).slice(1),M=(" "+y[b+1]).slice(1),K=y[b+2]?(" "+y[b+2]).slice(1):"";switch(R){case"PLAYLIST-TYPE":l.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":h=l.startSN=parseInt(M);break;case"SKIP":{const H=new Me(M);ft(l,H,["RECENTLY-REMOVED-DATERANGES"]);const se=H.decimalInteger("SKIPPED-SEGMENTS");if(ae(se)){l.skippedSegments=se;for(let ne=se;ne--;)d.unshift(null);h+=se}const oe=H.enumeratedString("RECENTLY-REMOVED-DATERANGES");oe&&(l.recentlyRemovedDateranges=oe.split(" "));break}case"TARGETDURATION":l.targetduration=Math.max(parseInt(M),1);break;case"VERSION":l.version=parseInt(M);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"#":(M||K)&&g.tagList.push(K?[M,K]:[M]);break;case"DISCONTINUITY":p++,g.tagList.push(["DIS"]);break;case"GAP":g.gap=!0,g.tagList.push([R]);break;case"BITRATE":g.tagList.push([R,M]);break;case"DATERANGE":{const H=new Me(M);ft(l,H,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),ft(l,H,H.clientAttrs);const se=new of(H,l.dateRanges[H.ID]);se.isValid||l.skippedSegments?l.dateRanges[se.id]=se:A.warn(`Ignoring invalid DATERANGE tag: "${M}"`),g.tagList.push(["EXT-X-DATERANGE",M]);break}case"DEFINE":{{const H=new Me(M);ft(l,H,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in H?ZB(l,H,r):xf(l,H,t)}break}case"DISCONTINUITY-SEQUENCE":p=parseInt(M);break;case"KEY":{const H=Nf(M,t,l);if(H.isSupported()){if(H.method==="NONE"){S=void 0;break}S||(S={}),S[H.keyFormat]&&(S=je({},S)),S[H.keyFormat]=H}else A.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${M}"`);break}case"START":l.startTimeOffset=Df(M);break;case"MAP":{const H=new Me(M);if(ft(l,H,["BYTERANGE","URI"]),g.duration){const se=new Jr(i,t);Ff(se,H,a,S),c=se,g.initSegment=c,c.rawProgramDateTime&&!g.rawProgramDateTime&&(g.rawProgramDateTime=c.rawProgramDateTime)}else{const se=g.byteRangeEndOffset;if(se){const oe=g.byteRangeStartOffset;T=`${se-oe}@${oe}`}else T=null;Ff(g,H,a,S),c=g,x=!0}break}case"SERVER-CONTROL":{const H=new Me(M);l.canBlockReload=H.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=H.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&H.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=H.optionalFloat("PART-HOLD-BACK",0),l.holdBack=H.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const H=new Me(M);l.partTarget=H.decimalFloatingPoint("PART-TARGET");break}case"PART":{let H=l.partList;H||(H=l.partList=[]);const se=u>0?H[H.length-1]:void 0,oe=u++,ne=new Me(M);ft(l,ne,["BYTERANGE","URI"]);const ce=new bB(ne,g,t,oe,se);H.push(ce),g.duration+=ce.duration;break}case"PRELOAD-HINT":{const H=new Me(M);ft(l,H,["URI"]),l.preloadHint=H;break}case"RENDITION-REPORT":{const H=new Me(M);ft(l,H,["URI"]),l.renditionReports=l.renditionReports||[],l.renditionReports.push(H);break}default:A.warn(`line parsed but not handled: ${y}`);break}}}m&&!m.relurl?(d.pop(),f-=m.duration,l.partList&&(l.fragmentHint=m)):l.partList&&(Of(g,m),g.cc=p,l.fragmentHint=g,S&&Mf(g,S,l));const v=d.length,E=d[0],B=d[v-1];if(f+=l.skippedSegments*l.targetduration,f>0&&v&&B){l.averagetargetduration=f/v;const I=B.sn;l.endSN=I!=="initSegment"?I:0,l.live||(B.endList=!0),E&&(l.startCC=E.cc)}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(f+=l.fragmentHint.duration),l.totalduration=f,l.endCC=p,w>0&&r6(d,w),l}}function Nf(s,e,t){var a,i;const o=new Me(s);ft(t,o,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const r=(a=o.METHOD)!=null?a:"",l=o.URI,d=o.hexadecimalInteger("IV"),c=o.KEYFORMATVERSIONS,h=(i=o.KEYFORMAT)!=null?i:"identity";l&&o.IV&&!d&&A.error(`Invalid IV: ${o.IV}`);const u=l?jt.resolve(l,e):"",f=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Ca(r,u,h,f,d)}function Df(s){const t=new Me(s).decimalFloatingPoint("TIME-OFFSET");return ae(t)?t:null}function o6(s,e){let t=(s||"").split(/[ ,]+/).filter(a=>a);["video","audio","text"].forEach(a=>{const i=t.filter(o=>e6(o,a));i.length&&(e[`${a}Codec`]=i.join(","),t=t.filter(o=>i.indexOf(o)===-1))}),e.unknownCodecs=t}function Pf(s,e,t){const a=e[t];a&&(s[t]=a)}function r6(s,e){let t=s[e];for(let a=e;a--;){const i=s[a];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function Of(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),ae(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function Ff(s,e,t,a){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",a&&(s.levelkeys=a),s.initSegment=null}function Mf(s,e,t){s.levelkeys=e;const{encryptedFragments:a}=t;(!a.length||a[a.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&a.push(s)}var ve={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},le={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Vf(s){const{type:e}=s;switch(e){case ve.AUDIO_TRACK:return le.AUDIO;case ve.SUBTITLE_TRACK:return le.SUBTITLE;default:return le.MAIN}}function ll(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class l6{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,a=t.pLoader,i=t.loader,o=a||i,r=new o(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:a}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ve.MANIFEST,url:a,deliveryDirectives:null})}onLevelLoading(e,t){const{id:a,level:i,pathwayId:o,url:r,deliveryDirectives:l}=t;this.load({id:a,level:i,pathwayId:o,responseType:"text",type:ve.LEVEL,url:r,deliveryDirectives:l})}onAudioTrackLoading(e,t){const{id:a,groupId:i,url:o,deliveryDirectives:r}=t;this.load({id:a,groupId:i,level:null,responseType:"text",type:ve.AUDIO_TRACK,url:o,deliveryDirectives:r})}onSubtitleTrackLoading(e,t){const{id:a,groupId:i,url:o,deliveryDirectives:r}=t;this.load({id:a,groupId:i,level:null,responseType:"text",type:ve.SUBTITLE_TRACK,url:o,deliveryDirectives:r})}load(e){var t;const a=this.hls.config;let i=this.getInternalLoader(e);if(i){const c=i.context;if(c&&c.url===e.url&&c.level===e.level){A.trace("[playlist-loader]: playlist request ongoing");return}A.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let o;if(e.type===ve.MANIFEST?o=a.manifestLoadPolicy.default:o=je({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),ae((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===ve.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===ve.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===ve.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const h=c.partTarget,u=c.targetduration;if(h&&u){const f=Math.max(h*3,u*.8)*1e3;o=je({},o,{maxTimeToFirstByteMs:Math.min(f,o.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(f,o.maxTimeToFirstByteMs)})}}}const r=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},d={onSuccess:(c,h,u,f)=>{const p=this.getInternalLoader(u);this.resetInternalLoader(u.type);const m=c.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(c,u,new Error("no EXTM3U delimiter"),f||null,h);return}h.parsing.start=performance.now(),jt.isMediaPlaylist(m)?this.handleTrackOrLevelPlaylist(c,h,u,f||null,p):this.handleMasterPlaylist(c,h,u,f)},onError:(c,h,u,f)=>{this.handleNetworkError(h,u,!1,c,f)},onTimeout:(c,h,u)=>{this.handleNetworkError(h,u,!0,void 0,c)}};i.load(e,l,d)}handleMasterPlaylist(e,t,a,i){const o=this.hls,r=e.data,l=ll(e,a),d=jt.parseMasterPlaylist(r,l);if(d.playlistParsingError){this.handleManifestParsingError(e,a,d.playlistParsingError,i,t);return}const{contentSteering:c,levels:h,sessionData:u,sessionKeys:f,startTimeOffset:p,variableList:m}=d;this.variableList=m;const{AUDIO:g=[],SUBTITLES:y,"CLOSED-CAPTIONS":b}=jt.parseMasterPlaylistMedia(r,l,d);g.length&&!g.some(w=>!w.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(A.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Me({}),bitrate:0,url:""})),o.trigger(_.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:y,captions:b,contentSteering:c,url:l,stats:t,networkDetails:i,sessionData:u,sessionKeys:f,startTimeOffset:p,variableList:m})}handleTrackOrLevelPlaylist(e,t,a,i,o){const r=this.hls,{id:l,level:d,type:c}=a,h=ll(e,a),u=0,f=ae(d)?d:ae(l)?l:0,p=Vf(a),m=jt.parseLevelPlaylist(e.data,h,f,p,u,this.variableList);if(c===ve.MANIFEST){const g={attrs:new Me({}),bitrate:0,details:m,name:"",url:h};r.trigger(_.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:h,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),a.levelDetails=m,this.handlePlaylistLoaded(m,e,t,a,i,o)}handleManifestParsingError(e,t,a,i,o){this.hls.trigger(_.ERROR,{type:pe.NETWORK_ERROR,details:N.MANIFEST_PARSING_ERROR,fatal:t.type===ve.MANIFEST,url:e.url,err:a,error:a,reason:a.message,response:e,context:t,networkDetails:i,stats:o})}handleNetworkError(e,t,a=!1,i,o){let r=`A network ${a?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===ve.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ve.AUDIO_TRACK||e.type===ve.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const l=new Error(r);A.warn(`[playlist-loader]: ${r}`);let d=N.UNKNOWN,c=!1;const h=this.getInternalLoader(e);switch(e.type){case ve.MANIFEST:d=a?N.MANIFEST_LOAD_TIMEOUT:N.MANIFEST_LOAD_ERROR,c=!0;break;case ve.LEVEL:d=a?N.LEVEL_LOAD_TIMEOUT:N.LEVEL_LOAD_ERROR,c=!1;break;case ve.AUDIO_TRACK:d=a?N.AUDIO_TRACK_LOAD_TIMEOUT:N.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case ve.SUBTITLE_TRACK:d=a?N.SUBTITLE_TRACK_LOAD_TIMEOUT:N.SUBTITLE_LOAD_ERROR,c=!1;break}h&&this.resetInternalLoader(e.type);const u={type:pe.NETWORK_ERROR,details:d,fatal:c,url:e.url,loader:h,context:e,error:l,networkDetails:t,stats:o};if(i){const f=(t==null?void 0:t.url)||e.url;u.response=Ze({url:f,data:void 0},i)}this.hls.trigger(_.ERROR,u)}handlePlaylistLoaded(e,t,a,i,o,r){const l=this.hls,{type:d,level:c,id:h,groupId:u,deliveryDirectives:f}=i,p=ll(t,i),m=Vf(i),g=typeof i.level=="number"&&m===le.MAIN?c:void 0;if(!e.fragments.length){const b=new Error("No Segments found in Playlist");l.trigger(_.ERROR,{type:pe.NETWORK_ERROR,details:N.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:b,reason:b.message,response:t,context:i,level:g,parent:m,networkDetails:o,stats:a});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const y=e.playlistParsingError;if(y){l.trigger(_.ERROR,{type:pe.NETWORK_ERROR,details:N.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:y,reason:y.message,response:t,context:i,level:g,parent:m,networkDetails:o,stats:a});return}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),d){case ve.MANIFEST:case ve.LEVEL:l.trigger(_.LEVEL_LOADED,{details:e,level:g||0,id:h||0,stats:a,networkDetails:o,deliveryDirectives:f});break;case ve.AUDIO_TRACK:l.trigger(_.AUDIO_TRACK_LOADED,{details:e,id:h||0,groupId:u||"",stats:a,networkDetails:o,deliveryDirectives:f});break;case ve.SUBTITLE_TRACK:l.trigger(_.SUBTITLE_TRACK_LOADED,{details:e,id:h||0,groupId:u||"",stats:a,networkDetails:o,deliveryDirectives:f});break}}}function $f(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function zf(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(a){A.debug(`[texttrack-utils]: ${a}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,s.addCue(i)}catch(i){A.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(s.mode=t)}function $s(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function cl(s,e,t,a){const i=s.mode;if(i==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const o=d6(s.cues,e,t);for(let r=0;r<o.length;r++)(!a||a(o[r]))&&s.removeCue(o[r])}i==="disabled"&&(s.mode=i)}function c6(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let a=0,i=t;for(;a<=i;){const o=Math.floor((i+a)/2);if(e<s[o].startTime)i=o-1;else if(e>s[o].startTime&&a<t)a=o+1;else return o}return s[a].startTime-e<e-s[i].startTime?a:i}function d6(s,e,t){const a=[],i=c6(s,e);if(i>-1)for(let o=i,r=s.length;o<r;o++){const l=s[o];if(l.startTime>=e&&l.endTime<=t)a.push(l);else if(l.startTime>t)return a}return a}function Xn(s){const e=[];for(let t=0;t<s.length;t++){const a=s[t];(a.kind==="subtitles"||a.kind==="captions")&&a.label&&e.push(s[t])}return e}var Pt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const h6=.25;function dl(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Uf(s,e,t,a,i){let o=new s(e,t,"");try{o.value=a,i&&(o.type=i)}catch{o=new s(e,t,JSON.stringify(i?Ze({type:i},a):a))}return o}const Zn=(()=>{const s=dl();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function hl(s,e){return s.getTime()/1e3-e}function u6(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class m6{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&($s(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const a=e[t];if(a.kind==="metadata"&&a.label==="id3")return $f(a,this.media),a}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:i}}}=this;if(!a&&!i)return;const{samples:o}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=dl();if(r)for(let l=0;l<o.length;l++){const d=o[l].type;if(d===Pt.emsg&&!a||!i)continue;const c=ff(o[l].data);if(c){const h=o[l].pts;let u=h+o[l].duration;u>Zn&&(u=Zn),u-h<=0&&(u=h+h6);for(let p=0;p<c.length;p++){const m=c[p];if(!mf(m)){this.updateId3CueEnds(h,d);const g=Uf(r,h,u,m,d);g&&this.id3Track.addCue(g)}}}}}updateId3CueEnds(e,t){var a;const i=(a=this.id3Track)==null?void 0:a.cues;if(i)for(let o=i.length;o--;){const r=i[o];r.type===t&&r.startTime<e&&r.endTime===Zn&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:a,type:i}){const{id3Track:o,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:l,enableID3MetadataCues:d}}=r;if(o&&(l||d)){let c;i==="audio"?c=h=>h.type===Pt.audioId3&&d:i==="video"?c=h=>h.type===Pt.emsg&&l:c=h=>h.type===Pt.audioId3&&d||h.type===Pt.emsg&&l,cl(o,t,a,c)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:a,id3Track:i}=this,{dateRanges:o}=t,r=Object.keys(o);if(i){const h=Object.keys(a).filter(u=>!r.includes(u));for(let u=h.length;u--;){const f=h[u];Object.keys(a[f].cues).forEach(p=>{i.removeCue(a[f].cues[p])}),delete a[f]}}const l=t.fragments[t.fragments.length-1];if(r.length===0||!ae(l==null?void 0:l.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const d=l.programDateTime/1e3-l.start,c=dl();for(let h=0;h<r.length;h++){const u=r[h],f=o[u],p=hl(f.startDate,d),m=a[u],g=(m==null?void 0:m.cues)||{};let y=(m==null?void 0:m.durationKnown)||!1,b=Zn;const S=f.endDate;if(S)b=hl(S,d),y=!0;else if(f.endOnNext&&!y){const x=r.reduce((T,v)=>{if(v!==f.id){const E=o[v];if(E.class===f.class&&E.startDate>f.startDate&&(!T||f.startDate<T.startDate))return E}return T},null);x&&(b=hl(x.startDate,d),y=!0)}const w=Object.keys(f.attr);for(let x=0;x<w.length;x++){const T=w[x];if(!gB(T))continue;const v=g[T];if(v)y&&!m.durationKnown&&(v.endTime=b);else if(c){let E=f.attr[T];yB(T)&&(E=u6(E));const B=Uf(c,p,b,{key:T,data:E},Pt.dateRange);B&&(B.id=u,this.id3Track.addCue(B),g[T]=B)}}a[u]={cues:g,dateRange:f,durationKnown:y}}}}class f6{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:a,targetduration:i}=e,{liveSyncDuration:o,liveSyncDurationCount:r,lowLatencyMode:l}=this.config,d=this.hls.userConfig;let c=l&&a||t;(d.liveSyncDuration||d.liveSyncDurationCount||c===0)&&(c=o!==void 0?o:r*i);const h=i;return c+Math.min(this.stallCount*1,h)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,a=this.levelDetails;if(e===null||t===null||a===null)return null;const i=a.edge,o=e-t-this.edgeStalled,r=i-a.totalduration,l=i-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(r,o),l)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const a=e.buffered.length;return(a?e.buffered.end(a-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(_.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(_.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var a;t.details===N.BUFFER_STALLED_ERROR&&(this.stallCount++,(a=this.levelDetails)!=null&&a.live&&A.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const a=this.computeLatency();if(a===null)return;this._latency=a;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:o}=this.config;if(!i||o===1||!t.live)return;const r=this.targetLatency;if(r===null)return;const l=a-r,d=Math.min(this.maxLatency,r+t.targetduration);if(l<d&&l>.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,o)),u=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;e.playbackRate=Math.min(h,Math.max(1,u))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const ul=["NONE","TYPE-0","TYPE-1",null];function p6(s){return ul.indexOf(s)>-1}const Qn=["SDR","PQ","HLG"];function g6(s){return!!s&&Qn.indexOf(s)>-1}var ei={No:"",Yes:"YES",v2:"v2"};function Gf(s){const{canSkipUntil:e,canSkipDateRanges:t,age:a}=s,i=a<e/2;return e&&i?t?ei.v2:ei.Yes:ei.No}class jf{constructor(e,t,a){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=a}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class zs{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Hf(this._audioGroups,e)}hasSubtitleGroup(e){return Hf(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let a=this._audioGroups;a||(a=this._audioGroups=[]),a.indexOf(t)===-1&&a.push(t)}else if(e==="text"){let a=this._subtitleGroups;a||(a=this._subtitleGroups=[]),a.indexOf(t)===-1&&a.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Hf(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function ml(s,e){const t=e.startPTS;if(ae(t)){let a=0,i;e.sn>s.sn?(a=t-s.start,i=s):(a=s.start-t,i=e),i.duration!==a&&(i.duration=a)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function Wf(s,e,t,a,i,o){a-t<=0&&(A.warn("Fragment should have a positive duration",e),a=t+e.duration,o=i+e.duration);let l=t,d=a;const c=e.startPTS,h=e.endPTS;if(ae(c)){const y=Math.abs(c-t);ae(e.deltaPTS)?e.deltaPTS=Math.max(y,e.deltaPTS):e.deltaPTS=y,l=Math.max(t,c),t=Math.min(t,c),i=Math.min(i,e.startDTS),d=Math.min(a,h),a=Math.max(a,h),o=Math.max(o,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=a-e.start,e.startPTS=t,e.maxStartPTS=l,e.startDTS=i,e.endPTS=a,e.minEndPTS=d,e.endDTS=o;const f=e.sn;if(!s||f<s.startSN||f>s.endSN)return 0;let p;const m=f-s.startSN,g=s.fragments;for(g[m]=e,p=m;p>0;p--)ml(g[p],g[p-1]);for(p=m;p<g.length-1;p++)ml(g[p],g[p+1]);return s.fragmentHint&&ml(g[g.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,u}function y6(s,e){let t=null;const a=s.fragments;for(let d=a.length-1;d>=0;d--){const c=a[d].initSegment;if(c){t=c;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let i=0,o;if(_6(s,e,(d,c)=>{d.relurl&&(i=d.cc-c.cc),ae(d.startPTS)&&ae(d.endPTS)&&(c.start=c.startPTS=d.startPTS,c.startDTS=d.startDTS,c.maxStartPTS=d.maxStartPTS,c.endPTS=d.endPTS,c.endDTS=d.endDTS,c.minEndPTS=d.minEndPTS,c.duration=d.endPTS-d.startPTS,c.duration&&(o=c),e.PTSKnown=e.alignedSliding=!0),c.elementaryStreams=d.elementaryStreams,c.loader=d.loader,c.stats=d.stats,d.initSegment&&(c.initSegment=d.initSegment,t=d.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(c=>{var h;c&&(!c.initSegment||c.initSegment.relurl===((h=t)==null?void 0:h.relurl))&&(c.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(d=>!d),e.deltaUpdateFailed){A.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let d=e.skippedSegments;d--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=b6(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const r=e.fragments;if(i){A.warn("discontinuity sliding from playlist, take drift into account");for(let d=0;d<r.length;d++)r[d].cc+=i}e.skippedSegments&&(e.startCC=e.fragments[0].cc),S6(s.partList,e.partList,(d,c)=>{c.elementaryStreams=d.elementaryStreams,c.stats=d.stats}),o?Wf(e,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):Kf(s,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const l=e.advancedDateTime;if(e.advanced&&l){const d=e.edge;e.driftStart||(e.driftStartTime=l,e.driftStart=d),e.driftEndTime=l,e.driftEnd=d}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function b6(s,e,t){const a=je({},s);return t&&t.forEach(i=>{delete a[i]}),Object.keys(e).forEach(i=>{const o=new of(e[i].attr,a[i]);o.isValid?a[i]=o:A.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),a}function S6(s,e,t){if(s&&e){let a=0;for(let i=0,o=s.length;i<=o;i++){const r=s[i],l=e[i+a];r&&l&&r.index===l.index&&r.fragment.sn===l.fragment.sn?t(r,l):a--}}}function _6(s,e,t){const a=e.skippedSegments,i=Math.max(s.startSN,e.startSN)-e.startSN,o=(s.fragmentHint?1:0)+(a?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,r=e.startSN-s.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,d=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let c=i;c<=o;c++){const h=d[r+c];let u=l[c];a&&!u&&c<a&&(u=e.fragments[c]=h),h&&u&&t(h,u)}}function Kf(s,e){const t=e.startSN+e.skippedSegments-s.startSN,a=s.fragments;t<0||t>=a.length||fl(e,a[t].start)}function fl(s,e){if(e){const t=s.fragments;for(let a=s.skippedSegments;a<t.length;a++)t[a].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function w6(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const a=s.fragments;if(a.length&&t*4>e){const o=a[a.length-1].duration*1e3;o<t&&(t=o)}}else t/=2;return Math.round(t)}function k6(s,e,t){if(!(s!=null&&s.details))return null;const a=s.details;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function qf(s,e,t){var a;return s!=null&&s.details?Yf((a=s.details)==null?void 0:a.partList,e,t):null}function Yf(s,e,t){if(s)for(let a=s.length;a--;){const i=s[a];if(i.index===t&&i.fragment.sn===e)return i}return null}function Jf(s){s.forEach((e,t)=>{const{details:a}=e;a!=null&&a.fragments&&a.fragments.forEach(i=>{i.level=t})})}function ti(s){switch(s.details){case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_TIMEOUT:case N.LEVEL_LOAD_TIMEOUT:case N.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Xf(s,e){const t=ti(e);return s.default[`${t?"timeout":"error"}Retry`]}function pl(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function Zf(s){return Ze(Ze({},s),{errorRetry:null,timeoutRetry:null})}function si(s,e,t,a){if(!s)return!1;const i=a==null?void 0:a.code,o=e<s.maxNumRetry&&(E6(i)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,a,o):o}function E6(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Qf={search:function(s,e){let t=0,a=s.length-1,i=null,o=null;for(;t<=a;){i=(t+a)/2|0,o=s[i];const r=e(o);if(r>0)t=i+1;else if(r<0)a=i-1;else return o}return null}};function T6(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!ae(e))return null;const a=s[0].programDateTime;if(e<(a||0))return null;const i=s[s.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let o=0;o<s.length;++o){const r=s[o];if(x6(e,t,r))return r}return null}function ai(s,e,t=0,a=0,i=.005){let o=null;if(s){o=e[s.sn-e[0].sn+1]||null;const l=s.endDTS-t;l>0&&l<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(o=e[0]);if(o&&((!s||s.level===o.level)&&gl(t,a,o)===0||C6(o,s,Math.min(i,a))))return o;const r=Qf.search(e,gl.bind(null,t,a));return r&&(r!==s||!o)?r:o}function C6(s,e,t){if(e&&e.start===0&&e.level<s.level&&(e.endPTS||0)>0){const a=e.tagList.reduce((i,o)=>(o[0]==="INF"&&(i+=parseFloat(o[1])),i),t);return s.start<=a}return!1}function gl(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const a=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-a<=s?1:t.start-a>s&&t.start?-1:0}function x6(s,e,t){const a=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-a>s}function v6(s,e){return Qf.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}var it={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ot={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class A6{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=A.log.bind(A,"[info]:"),this.warn=A.warn.bind(A,"[warning]:"),this.error=A.error.bind(A,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(_.ERROR,this.onError,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.ERROR,this.onError,this),e.off(_.ERROR,this.onErrorOut,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===le.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var a,i;if(t.fatal)return;const o=this.hls,r=t.context;switch(t.details){case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case N.FRAG_PARSING_ERROR:if((a=t.frag)!=null&&a.gap){t.errorAction={action:it.DoNothing,flags:Ot.None};return}case N.FRAG_GAP:case N.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=it.SendAlternateToPenaltyBox;return}case N.LEVEL_EMPTY_ERROR:case N.LEVEL_PARSING_ERROR:{var l,d;const c=t.parent===le.MAIN?t.level:o.loadLevel;t.details===N.LEVEL_EMPTY_ERROR&&((l=t.context)!=null&&(d=l.levelDetails)!=null&&d.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:typeof(r==null?void 0:r.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.SUBTITLE_LOAD_ERROR:case N.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=o.levels[o.loadLevel];if(c&&(r.type===ve.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===ve.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.loadLevel),t.errorAction.action=it.SendAlternateToPenaltyBox,t.errorAction.flags=Ot.MoveAllAlternatesMatchingHost;return}}return;case N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=o.levels[o.loadLevel],h=c==null?void 0:c.attrs["HDCP-LEVEL"];h?t.errorAction={action:it.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}:this.keySystemError(t)}return;case N.BUFFER_ADD_CODEC_ERROR:case N.REMUX_ALLOC_ERROR:case N.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:o.loadLevel);return;case N.INTERNAL_EXCEPTION:case N.BUFFER_APPENDING_ERROR:case N.BUFFER_FULL_ERROR:case N.LEVEL_SWITCH_ERROR:case N.BUFFER_STALLED_ERROR:case N.BUFFER_SEEK_OVER_HOLE:case N.BUFFER_NUDGE_ON_STALL:t.errorAction={action:it.DoNothing,flags:Ot.None};return}t.type===pe.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const a=this.hls,i=Xf(a.config.playlistLoadPolicy,e),o=this.playlistError++;if(si(i,o,ti(e),e.response))return{action:it.RetryRequest,flags:Ot.None,retryConfig:i,retryCount:o};const l=this.getLevelSwitchAction(e,t);return i&&(l.retryConfig=i,l.retryCount=o),l}getFragRetryOrSwitchAction(e){const t=this.hls,a=this.getVariantLevelIndex(e.frag),i=t.levels[a],{fragLoadPolicy:o,keyLoadPolicy:r}=t.config,l=Xf(e.details.startsWith("key")?r:o,e),d=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(i&&(e.details!==N.FRAG_GAP&&i.fragmentError++,si(l,d,ti(e),e.response)))return{action:it.RetryRequest,flags:Ot.None,retryConfig:l,retryCount:d};const c=this.getLevelSwitchAction(e,a);return l&&(c.retryConfig=l,c.retryCount=d),c}getLevelSwitchAction(e,t){const a=this.hls;t==null&&(t=a.loadLevel);const i=this.hls.levels[t];if(i){var o,r;const c=e.details;i.loadError++,c===N.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:u,loadLevel:f,minAutoLevel:p,maxAutoLevel:m}=a;a.autoLevelEnabled||(a.loadLevel=-1);const g=(o=e.frag)==null?void 0:o.type,b=(g===le.AUDIO&&c===N.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===N.BUFFER_ADD_CODEC_ERROR||c===N.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:v})=>i.audioCodec!==v),w=e.sourceBufferName==="video"&&(c===N.BUFFER_ADD_CODEC_ERROR||c===N.BUFFER_APPEND_ERROR)&&u.some(({codecSet:v,audioCodec:E})=>i.codecSet!==v&&i.audioCodec===E),{type:x,groupId:T}=(r=e.context)!=null?r:{};for(let v=u.length;v--;){const E=(v+f)%u.length;if(E!==f&&E>=p&&E<=m&&u[E].loadError===0){var l,d;const B=u[E];if(c===N.FRAG_GAP&&g===le.MAIN&&e.frag){const I=u[E].details;if(I){const R=ai(e.frag,I.fragments,e.frag.start);if(R!=null&&R.gap)continue}}else{if(x===ve.AUDIO_TRACK&&B.hasAudioGroup(T)||x===ve.SUBTITLE_TRACK&&B.hasSubtitleGroup(T))continue;if(g===le.AUDIO&&(l=i.audioGroups)!=null&&l.some(I=>B.hasAudioGroup(I))||g===le.SUBTITLE&&(d=i.subtitleGroups)!=null&&d.some(I=>B.hasSubtitleGroup(I))||b&&i.audioCodec===B.audioCodec||!b&&i.audioCodec!==B.audioCodec||w&&i.codecSet===B.codecSet)continue}h=E;break}}if(h>-1&&a.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:it.SendAlternateToPenaltyBox,flags:Ot.None,nextAutoLevel:h}}return{action:it.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var a;switch((a=t.errorAction)==null?void 0:a.action){case it.DoNothing:break;case it.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==N.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,a=e.errorAction;if(!a)return;const{flags:i,hdcpLevel:o,nextAutoLevel:r}=a;switch(i){case Ot.None:this.switchLevel(e,r);break;case Ot.MoveAllAlternatesMatchingHDCP:o&&(t.maxHdcpLevel=ul[ul.indexOf(o)-1],a.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}a.resolved||this.switchLevel(e,r)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class yl{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=A.log.bind(A,`${t}:`),this.warn=A.warn.bind(A,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,a){const i=t==null?void 0:t.renditionReports;if(i){let o=-1;for(let r=0;r<i.length;r++){const l=i[r];let d;try{d=new self.URL(l.URI,t.url).href}catch(c){A.warn(`Could not construct new URL for Rendition Report: ${c}`),d=l.URI||""}if(d===e){o=r;break}else d===e.substring(0,d.length)&&(o=r)}if(o!==-1){const r=i[o],l=parseInt(r["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let d=parseInt(r["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const h=Math.min(t.age-t.partTarget,t.targetduration);d>=0&&h>t.partTarget&&(d+=1)}const c=a&&Gf(a);return new jf(l,d>=0?d:void 0,c)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,a){const{details:i,stats:o}=t,r=self.performance.now(),l=o.loading.first?Math.max(0,r-o.loading.first):0;if(i.advancedDateTime=Date.now()-l,i.live||a!=null&&a.live){if(i.reloaded(a),a&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),a&&i.fragments.length>0&&y6(a,i),!this.canLoad||!i.live)return;let d,c,h;if(i.canBlockReload&&i.endSN&&i.advanced){const y=this.hls.config.lowLatencyMode,b=i.lastPartSn,S=i.endSN,w=i.lastPartIndex,x=w!==-1,T=b===S,v=y?0:w;x?(c=T?S+1:b,h=T?v:w+1):c=S+1;const E=i.age,B=E+i.ageHeader;let I=Math.min(B-i.partTarget,i.targetduration*1.5);if(I>0){if(a&&I>a.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${a.tuneInGoal} to: ${I} with playlist age: ${i.age}`),I=0;else{const R=Math.floor(I/i.targetduration);if(c+=R,h!==void 0){const M=Math.round(I%i.targetduration/i.partTarget);h+=M}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${E.toFixed(2)}s goal: ${I} skip sn ${R} to part ${h}`)}i.tuneInGoal=I}if(d=this.getDeliveryDirectives(i,t.deliveryDirectives,c,h),y||!T){this.loadPlaylist(d);return}}else(i.canBlockReload||i.canSkipUntil)&&(d=this.getDeliveryDirectives(i,t.deliveryDirectives,c,h));const u=this.hls.mainForwardBufferInfo,f=u?u.end-u.len:0,p=(i.edge-f)*1e3,m=w6(i,p);i.updated&&r>this.requestScheduled+m&&(this.requestScheduled=o.loading.start),c!==void 0&&i.canBlockReload?this.requestScheduled=o.loading.first+m-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+m<r?this.requestScheduled=r:this.requestScheduled-r<=0&&(this.requestScheduled+=m);let g=this.requestScheduled-r;g=Math.max(0,g),this.log(`reload live playlist ${e} in ${Math.round(g)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(d),g)}else this.clearTimer()}getDeliveryDirectives(e,t,a,i){let o=Gf(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(a=t.msn,i=t.part,o=ei.No),new jf(a,i,o)}checkRetry(e){const t=e.details,a=ti(e),i=e.errorAction,{action:o,retryCount:r=0,retryConfig:l}=i||{},d=!!i&&!!l&&(o===it.RetryRequest||!i.resolved&&o===it.SendAlternateToPenaltyBox);if(d){var c;if(this.requestScheduled=-1,r>=l.maxNumRetry)return!1;if(a&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${l.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=pl(l,r);this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${r+1}/${l.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,i.resolved=!0}return d}}class Us{constructor(e,t=0,a=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=a}sample(e,t){const a=Math.pow(this.alpha_,e);this.estimate_=t*(1-a)+a*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class L6{constructor(e,t,a,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=a,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Us(e),this.fast_=new Us(t),this.defaultTTFB_=i,this.ttfb_=new Us(e)}update(e,t){const{slow_:a,fast_:i,ttfb_:o}=this;a.halfLife!==e&&(this.slow_=new Us(e,a.getEstimate(),a.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Us(t,i.getEstimate(),i.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new Us(e,o.getEstimate(),o.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const a=8*t,i=e/1e3,o=a/i;this.fast_.sample(i,o),this.slow_.sample(i,o)}sampleTTFB(e){const t=e/1e3,a=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(a,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const ep={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},tp={};function I6(s,e,t,a,i,o){const r=s.audioCodec?s.audioGroups:null,l=o==null?void 0:o.audioCodec,d=o==null?void 0:o.channels,c=d?parseInt(d):l?1/0:2;let h=null;if(r!=null&&r.length)try{r.length===1&&r[0]?h=e.groups[r[0]].channels:h=r.reduce((u,f)=>{if(f){const p=e.groups[f];if(!p)throw new Error(`Audio track group ${f} not found`);Object.keys(p.channels).forEach(m=>{u[m]=(u[m]||0)+p.channels[m]})}return u},{2:0})}catch{return!0}return s.videoCodec!==void 0&&(s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(a,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(i,8e6))||!!h&&ae(c)&&Object.keys(h).some(u=>parseInt(u)>c)}function R6(s,e,t){const a=s.videoCodec,i=s.audioCodec;if(!a||!i||!t)return Promise.resolve(ep);const o={width:s.width,height:s.height,bitrate:Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)),framerate:s.frameRate||30},r=s.videoRange;r!=="SDR"&&(o.transferFunction=r.toLowerCase());const l=a.split(",").map(d=>({type:"media-source",video:Ze(Ze({},o),{},{contentType:xa(d,"video")})}));return i&&s.audioGroups&&s.audioGroups.forEach(d=>{var c;d&&((c=e.groups[d])==null||c.tracks.forEach(h=>{if(h.groupId===d){const u=h.channels||"",f=parseFloat(u);ae(f)&&f>2&&l.push.apply(l,i.split(",").map(p=>({type:"media-source",audio:{contentType:xa(p,"audio"),channels:""+f}})))}}))}),Promise.all(l.map(d=>{const c=B6(d);return tp[c]||(tp[c]=t.decodingInfo(d))})).then(d=>({supported:!d.some(c=>!c.supported),configurations:l,decodingInfoResults:d})).catch(d=>({supported:!1,configurations:l,decodingInfoResults:[],error:d}))}function B6(s){const{audio:e,video:t}=s,a=t||e;if(a){const i=a.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function N6(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function D6(s,e){let t=!1,a=[];return s&&(t=s!=="SDR",a=[s]),e&&(a=e.allowedVideoRanges||Qn.slice(0),t=e.preferHDR!==void 0?e.preferHDR:N6(),t?a=a.filter(i=>i!=="SDR"):a=["SDR"]),{preferHDR:t,allowedVideoRanges:a}}function P6(s,e,t,a,i){const o=Object.keys(s),r=a==null?void 0:a.channels,l=a==null?void 0:a.audioCodec,d=r&&parseInt(r)===2;let c=!0,h=!1,u=1/0,f=1/0,p=1/0,m=0,g=[];const{preferHDR:y,allowedVideoRanges:b}=D6(e,i);for(let T=o.length;T--;){const v=s[o[T]];c=v.channels[2]>0,u=Math.min(u,v.minHeight),f=Math.min(f,v.minFramerate),p=Math.min(p,v.minBitrate);const E=b.filter(B=>v.videoRanges[B]>0);E.length>0&&(h=!0,g=E)}u=ae(u)?u:0,f=ae(f)?f:0;const S=Math.max(1080,u),w=Math.max(30,f);return p=ae(p)?p:t,t=Math.max(p,t),h||(e=void 0,g=[]),{codecSet:o.reduce((T,v)=>{const E=s[v];if(v===T)return T;if(E.minBitrate>t)return Jt(v,`min bitrate of ${E.minBitrate} > current estimate of ${t}`),T;if(!E.hasDefaultAudio)return Jt(v,"no renditions with default or auto-select sound found"),T;if(l&&v.indexOf(l.substring(0,4))%5!==0)return Jt(v,`audio codec preference "${l}" not found`),T;if(r&&!d){if(!E.channels[r])return Jt(v,`no renditions with ${r} channel sound found (channels options: ${Object.keys(E.channels)})`),T}else if((!l||d)&&c&&E.channels[2]===0)return Jt(v,"no renditions with stereo sound found"),T;return E.minHeight>S?(Jt(v,`min resolution of ${E.minHeight} > maximum of ${S}`),T):E.minFramerate>w?(Jt(v,`min framerate of ${E.minFramerate} > maximum of ${w}`),T):g.some(B=>E.videoRanges[B]>0)?E.maxScore<m?(Jt(v,`max score of ${E.maxScore} < selected max of ${m}`),T):T&&(Yn(v)>=Yn(T)||E.fragmentError>s[T].fragmentError)?T:(m=E.maxScore,v):(Jt(v,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),T)},void 0),videoRanges:g,preferHDR:y,minFramerate:f,minBitrate:p}}function Jt(s,e){A.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function O6(s){return s.reduce((e,t)=>{let a=e.groups[t.groupId];a||(a=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),a.tracks.push(t);const i=t.channels||"2";return a.channels[i]=(a.channels[i]||0)+1,a.hasDefault=a.hasDefault||t.default,a.hasAutoSelect=a.hasAutoSelect||t.autoselect,a.hasDefault&&(e.hasDefaultAudio=!0),a.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function F6(s,e,t,a){return s.slice(t,a+1).reduce((i,o)=>{if(!o.codecSet)return i;const r=o.audioGroups;let l=i[o.codecSet];l||(i[o.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,o.bitrate);const d=Math.min(o.height,o.width);return l.minHeight=Math.min(l.minHeight,d),l.minFramerate=Math.min(l.minFramerate,o.frameRate),l.maxScore=Math.max(l.maxScore,o.score),l.fragmentError+=o.fragmentError,l.videoRanges[o.videoRange]=(l.videoRanges[o.videoRange]||0)+1,r&&r.forEach(c=>{if(!c)return;const h=e.groups[c];h&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(u=>{l.channels[u]=(l.channels[u]||0)+h.channels[u]}))}),i},{})}function Ht(s,e,t){if("attrs"in s){const a=e.indexOf(s);if(a!==-1)return a}for(let a=0;a<e.length;a++){const i=e[a];if(Gs(s,i,t))return a}return-1}function Gs(s,e,t){const{groupId:a,name:i,lang:o,assocLang:r,characteristics:l,default:d}=s,c=s.forced;return(a===void 0||e.groupId===a)&&(i===void 0||e.name===i)&&(o===void 0||e.lang===o)&&(o===void 0||e.assocLang===r)&&(d===void 0||e.default===d)&&(c===void 0||e.forced===c)&&(l===void 0||M6(l,e.characteristics))&&(t===void 0||t(s,e))}function M6(s,e=""){const t=s.split(","),a=e.split(",");return t.length===a.length&&!t.some(i=>a.indexOf(i)===-1)}function js(s,e){const{audioCodec:t,channels:a}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(a===void 0||a===(e.channels||"2"))}function V6(s,e,t,a,i){const o=e[a],l=e.reduce((f,p,m)=>{const g=p.uri;return(f[g]||(f[g]=[])).push(m),f},{})[o.uri];l.length>1&&(a=Math.max.apply(Math,l));const d=o.videoRange,c=o.frameRate,h=o.codecSet.substring(0,4),u=sp(e,a,f=>{if(f.videoRange!==d||f.frameRate!==c||f.codecSet.substring(0,4)!==h)return!1;const p=f.audioGroups,m=t.filter(g=>!p||p.indexOf(g.groupId)!==-1);return Ht(s,m,i)>-1});return u>-1?u:sp(e,a,f=>{const p=f.audioGroups,m=t.filter(g=>!p||p.indexOf(g.groupId)!==-1);return Ht(s,m,i)>-1})}function sp(s,e,t){for(let a=e;a;a--)if(t(s[a]))return a;for(let a=e+1;a<s.length;a++)if(t(s[a]))return a;return-1}class $6{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:a,hls:i}=this,{autoLevelEnabled:o,media:r}=i;if(!t||!r)return;const l=performance.now(),d=a?a.stats:t.stats,c=a?a.duration:t.duration,h=l-d.loading.start,u=i.minAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o||r.paused||!r.playbackRate||!r.readyState)return;const f=i.mainForwardBufferInfo;if(f===null)return;const p=this.bwEstimator.getEstimateTTFB(),m=Math.abs(r.playbackRate);if(h<=Math.max(p,1e3*(c/(m*2))))return;const g=f.len/m,y=d.loading.first?d.loading.first-d.loading.start:-1,b=d.loaded&&y>-1,S=this.getBwEstimate(),w=i.levels,x=w[t.level],T=d.total||Math.max(d.loaded,Math.round(c*x.averageBitrate/8));let v=b?h-y:h;v<1&&b&&(v=Math.min(h,d.loaded*8/S));const E=b?d.loaded*1e3/v:0,B=E?(T-d.loaded)/E:T*8/S+p/1e3;if(B<=g)return;const I=E?E*8:S;let R=Number.POSITIVE_INFINITY,M;for(M=t.level-1;M>u;M--){const H=w[M].maxBitrate;if(R=this.getTimeToLoadFrag(p/1e3,I,c*H,!w[M].details),R<g)break}if(R>=B||R>c*10)return;i.nextLoadLevel=i.nextAutoLevel=M,b?this.bwEstimator.sample(h-Math.min(p,y),d.loaded):this.bwEstimator.sampleTTFB(h);const K=w[M].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>K&&this.resetEstimator(K),this.clearTimer(),A.warn(`[abr] Fragment ${t.sn}${a?" part "+a.index:""} of level ${t.level} is loading too slowly;
|
|
42
|
+
`+o):a.stack=o}catch{}}throw a}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ws(this.defaults,t);const{transitional:a,paramsSerializer:i,headers:o}=t;a!==void 0&&Pr.assertOptions(a,{silentJSONParsing:is.transitional(is.boolean),forcedJSONParsing:is.transitional(is.boolean),clarifyTimeoutError:is.transitional(is.boolean)},!1),i!=null&&(P.isFunction(i)?t.paramsSerializer={serialize:i}:Pr.assertOptions(i,{encode:is.function,serialize:is.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let r=o&&P.merge(o.common,o[t.method]);o&&P.forEach(["delete","get","head","post","put","patch","common"],m=>{delete o[m]}),t.headers=Dt.concat(r,o);const l=[];let d=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(d=d&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let h,u=0,f;if(!d){const m=[xm.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,c),f=m.length,h=Promise.resolve(t);u<f;)h=h.then(m[u++],m[u++]);return h}f=l.length;let p=t;for(u=0;u<f;){const m=l[u++],g=l[u++];try{p=m(p)}catch(y){g.call(this,y);break}}try{h=xm.call(this,p)}catch(m){return Promise.reject(m)}for(u=0,f=c.length;u<f;)h=h.then(c[u++],c[u++]);return h}getUri(e){e=ws(this.defaults,e);const t=ym(e.baseURL,e.url);return lm(t,e.params,e.paramsSerializer)}}P.forEach(["delete","get","head","options"],function(s){Pn.prototype[s]=function(e,t){return this.request(ws(t||{},{method:s,url:e,data:(t||{}).data}))}}),P.forEach(["post","put","patch"],function(s){function e(t){return function(a,i,o){return this.request(ws(o||{},{method:s,headers:t?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Pn.prototype[s]=e(),Pn.prototype[s+"Form"]=e(!0)});const On=Pn;class Or{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const a=this;this.promise.then(i=>{if(!a._listeners)return;let o=a._listeners.length;for(;o-- >0;)a._listeners[o](i);a._listeners=null}),this.promise.then=i=>{let o;const r=new Promise(l=>{a.subscribe(l),o=l}).then(i);return r.cancel=function(){a.unsubscribe(o)},r},e(function(i,o,r){a.reason||(a.reason=new Ms(i,o,r),t(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new Or(function(t){e=t}),cancel:e}}}const D4=Or;function P4(s){return function(e){return s.apply(null,e)}}function O4(s){return P.isObject(s)&&s.isAxiosError===!0}const Fr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Fr).forEach(([s,e])=>{Fr[e]=s});const F4=Fr;function Lm(s){const e=new On(s),t=Wu(On.prototype.request,e);return P.extend(t,On.prototype,e,{allOwnKeys:!0}),P.extend(t,e,null,{allOwnKeys:!0}),t.create=function(a){return Lm(ws(s,a))},t}const Ge=Lm(vr);Ge.Axios=On,Ge.CanceledError=Ms,Ge.CancelToken=D4,Ge.isCancel=mm,Ge.VERSION=vm,Ge.toFormData=Ln,Ge.AxiosError=Ee,Ge.Cancel=Ge.CanceledError,Ge.all=function(s){return Promise.all(s)},Ge.spread=P4,Ge.isAxiosError=O4,Ge.mergeConfig=ws,Ge.AxiosHeaders=Dt,Ge.formToJSON=s=>hm(P.isHTMLForm(s)?new FormData(s):s),Ge.getAdapter=Cm.getAdapter,Ge.HttpStatusCode=F4,Ge.default=Ge;const Im=Ge,M4=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t},Mr={name:"ScrollableContainer",props:{backgroundColor:{type:String,default:"#0D1D29"},pxScroll:{type:Number,default:100},arrows:{type:Boolean,default:!0},arrowsHideOnNoScroll:{type:Boolean,default:!1},arrowsScrollHide:{type:Boolean,default:!1},arrowsColor:{type:String,default:"#CBEE6B"},arrowsHeight:{type:Number,default:15},arrowsWidth:{type:Number,default:15},arrowsPadding:{type:Number,default:5},arrowsMargin:{type:Number,default:10},arrowsRadius:{type:String,default:"0%"},arrowsBorder:{type:String,default:"none"},arrowsBackground:{type:String,default:"#0D1D29"},arrowsContainerBgL:{type:String,default:"#0D1D29"},arrowsContainerBgR:{type:String,default:"#0D1D29"},scrollColor:{type:String,default:"#c3e569"},arrowsPosition:{type:String,default:"relative"},height:{type:String,default:"100%"}},data(){return{showLeftArrow:!1,showRightArrow:!0,intervalid1:""}},mounted(){this.getScroll(),this.arrowsHideOnNoScroll&&window.addEventListener("resize",this.resizeSlider),this.arrowsHideOnNoScroll&&this.listenerLoad()},beforeUnmount(){this.arrowsHideOnNoScroll&&window.removeEventListener("resize",this.resizeSlider),this.arrowsHideOnNoScroll&&clearInterval(this.intervalid1)},computed:{getViewBox(){return`-2 0 ${this.arrowsWidth} ${this.arrowsHeight}`},hideShowLeftArrow(){let s="";return this.arrowsPosition=="absolute"?s="leftAbsolute":s="leftRelative",this.arrowsScrollHide?this.showLeftArrow?s+=" showArrowSlide":s+=" hideArrowSlide":s+=" showArrowSlide",s},hideShowRightArrow(){let s="";return this.arrowsPosition=="absolute"?s="rightAbsolute":s="rightRelative",this.arrowsScrollHide?this.showRightArrow?s+=" showArrowSlide":s+=" hideArrowSlide":s+=" showArrowSlide",s}},methods:{scrollLeft(){this.$refs.content.scrollLeft-=this.pxScroll},scrollRight(){this.$refs.content.scrollLeft+=this.pxScroll},getScroll(){let s=0;this.arrowsPosition=="relative"?s=this.$refs.content.scrollWidth-this.$el.clientWidth+this.arrowsMargin*2+this.arrowsWidth*4:s=this.$refs.content.scrollWidth-this.$el.clientWidth,this.$refs.content.scrollLeft==0?this.showLeftArrow=!1:this.showLeftArrow=!0,s>0&&(this.$refs.content.scrollLeft==s?this.showRightArrow=!1:this.showRightArrow=!0),this.arrowsHideOnNoScroll&&this.$refs.content.clientWidth===this.$refs.content.scrollWidth&&(this.showRightArrow=!1)},resizeSlider(){this.getScroll();let s;clearTimeout(s),s=setTimeout(this.getScroll,1e3)},listenerLoad(){this.intervalid1=setInterval((function(){var s=this.$el.clientWidth,e=this.$refs.content.scrollWidth;e>0&&s>0&&(e>s?(this.showRightArrow=!0,clearInterval(this.intervalid1)):clearInterval(this.intervalid1))}).bind(this),3e3)}}},Rm=()=>{n.useCssVars(s=>({"26acffa8":s.backgroundColor,"3d95bef4":s.height,"86ba1cc0":s.arrowsPosition,"140b6ada":s.arrowsPadding+"px","7df46be5":s.arrowsBackground,"33f99798":s.arrowsHeight*2+"px","1c8a858d":s.arrowsWidth*2+"px","4a7876c9":s.arrowsRadius,"2ff67e63":s.arrowsBorder,"59c5dd08":s.arrowsMargin+"px","6658215d":s.arrowsContainerBgL,66582163:s.arrowsContainerBgR,e5900a2e:s.scrollColor}))},Bm=Mr.setup;Mr.setup=Bm?(s,e)=>(Rm(),Bm(s,e)):Rm;const V4={ref:"gscScrollableContainer",class:"scrollable-container"},$4={class:"scrollable-arrows"},z4=["width","height","viewBox"],U4=["stroke"],G4={class:"scrollable-wrapper"},j4={class:"scrollable-arrows"},H4=["width","height","viewBox"],W4=["stroke"];function K4(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",V4,[t.arrows?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["arrows-container",o.hideShowLeftArrow]),onClick:e[0]||(e[0]=(...r)=>o.scrollLeft&&o.scrollLeft(...r))},[n.createElementVNode("div",$4,[(n.openBlock(),n.createElementBlock("svg",{width:t.arrowsWidth,height:t.arrowsHeight,viewBox:o.getViewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{d:"M6.36523 13.788L1.10146 8.52429C0.479824 7.90265 0.479824 6.88541 1.10147 6.26377L6.36523 1",stroke:t.arrowsColor},null,8,U4)],8,z4))])],2)):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"scrollable-content scrollable-content-slider",ref:"content",onScroll:e[1]||(e[1]=(...r)=>o.getScroll&&o.getScroll(...r))},[n.createElementVNode("div",G4,[n.renderSlot(s.$slots,"default",{},void 0,!0)])],544),t.arrows?(n.openBlock(),n.createElementBlock("div",{key:1,id:"arrows-container-right",class:n.normalizeClass(["arrows-container",o.hideShowRightArrow]),onClick:e[2]||(e[2]=(...r)=>o.scrollRight&&o.scrollRight(...r))},[n.createElementVNode("div",j4,[(n.openBlock(),n.createElementBlock("svg",{width:t.arrowsWidth,height:t.arrowsHeight,viewBox:o.getViewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{d:"M0.634765 1.21195L5.89853 6.47571C6.52018 7.09735 6.52018 8.11459 5.89853 8.73623L0.634766 14",stroke:t.arrowsColor},null,8,W4)],8,H4))])],2)):n.createCommentVNode("",!0)],512)}const q4=M4(Mr,[["render",K4],["__scopeId","data-v-7d0811ac"]]),os=(s,e)=>{const t=s.__vccOpts||s;for(const[a,i]of e)t[a]=i;return t};let Nm=null;const Vr={components:{},props:{titleCategory:{type:String,default:"RESUMEN"},dateGame:{type:String,default:""},showVideos:{type:Boolean,default:!0},colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},matchday:{type:String,default:""},seasonName:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""}},data(){return{gamesContainerGHWidth:0}},computed:{date(){const s=this.gamesContainerGHWidth;return s<=400?"date400":s<=540?"date540":s<=650?"date650":"date"},seasoncontainer(){const s=this.gamesContainerGHWidth;return s<=400?"season-container400":s<=540?"season-container540":s<=650?"season-container650":"season-container"},matchcontainer(){const s=this.gamesContainerGHWidth;return s<=400?"match-container400":s<=540?"match-container540":s<=650?"match-container650":"match-container"},containerinfogame(){const s=this.gamesContainerGHWidth;return s<=400?"container-info-game400":s<=540?"container-info-game540":s<=650?"container-info-game650":"container-info-game"},playbutton(){const s=this.gamesContainerGHWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},baselogo(){const s=this.gamesContainerGHWidth;return s<=400?"base-logo400":s<=540?"base-logo540":s<=650?"base-logo650":"base-logo"},baselogoright(){const s=this.gamesContainerGHWidth;return s<=400?"base-logo-right400":s<=540?"base-logo-right540":s<=650?"base-logo-right650":"base-logo-right"},thumbnailhighlights(){const s=this.gamesContainerGHWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},teamlogo(){const s=this.gamesContainerGHWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"},logoright(){const s=this.gamesContainerGHWidth;return s<=400?"logo-right400":s<=540?"logo-right540":s<=650?"logo-right650":"logo-right"},secondline(){const s=this.gamesContainerGHWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},titlename(){const s=this.gamesContainerGHWidth;return s<=400?"title-name400":s<=540?"title-name540":s<=650?"title-name650":"title-name"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Nm=new ResizeObserver(()=>{this.gamesContainerGHWidth=this.$refs.gamesContainerGH?this.$refs.gamesContainerGH.clientWidth:0,this.movil=this.gamesContainerGHWidth<740}),Nm.observe(this.$refs.gamesContainerGH);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Dm=()=>{n.useCssVars(s=>({a281566c:s.colorBackgroundHome+"45","692c47db":s.colorBackgroundAway+"45","229d672a":s.colorBackgroundHome,"229a5539":s.colorBackgroundAway}))},Pm=Vr.setup;Vr.setup=Pm?(s,e)=>(Dm(),Pm(s,e)):Dm;const Fn=s=>(n.pushScopeId("data-v-dd4b2ba3"),s=s(),n.popScopeId(),s),Y4=Fn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),J4=[Y4],X4=Fn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1)),Z4=["src"],Q4=Fn(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),eR=Fn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),tR=["src"],sR=["src"],aR={class:"text-container"};function nR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerGH",class:n.normalizeClass(o.thumbnailhighlights)},[t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},J4,2)):n.createCommentVNode("",!0),t.dateGame!=""?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.date)},n.toDisplayString(t.dateGame),3)):n.createCommentVNode("",!0),t.matchday!=""&&t.seasonName!=""?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(o.containerinfogame)},[t.matchday!=""?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.matchcontainer)},n.toDisplayString(t.matchday),3)):n.createCommentVNode("",!0),t.seasonName!=""?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.seasoncontainer)},n.toDisplayString(t.seasonName),3)):n.createCommentVNode("",!0)],2)):n.createCommentVNode("",!0),X4,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,Z4),n.createElementVNode("div",{class:n.normalizeClass([o.baselogo,"position-image"])},null,2),n.createElementVNode("div",{class:n.normalizeClass(o.baselogoright)},null,2),Q4,eR,n.createElementVNode("img",{src:t.logoHome,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,tR),n.createElementVNode("img",{src:t.logoAway,alt:"",class:n.normalizeClass(o.logoright)},null,10,sR),n.createElementVNode("div",aR,[n.createElementVNode("span",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.score),3),n.createElementVNode("div",{class:n.normalizeClass(o.titlename)},n.toDisplayString(t.titleCategory),3)])],2)}const iR=os(Vr,[["render",nR],["__scopeId","data-v-dd4b2ba3"]]);let Om=null;const $r={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},nameCategory:{type:String,default:""},photoProfile:{type:String,default:""},logoHome:{type:String,default:""},logoAway:{type:String,default:""},scoreHome:{type:[String,Number],default:""},scoreAway:{type:[String,Number],default:""},background:{type:String,default:""},typeImg:{type:Number,default:0},nameHomeTeam:{type:String,default:""},nameAwayTeam:{type:String,default:""},namePlayer:{type:String,default:""}},data(){return{gamesContainerCWidth:0}},computed:{playbutton(){const s=this.gamesContainerCWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},teamlogo(){const s=this.gamesContainerCWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"},firstline(){const s=this.gamesContainerCWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},secondline(){const s=this.gamesContainerCWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},playerimage(){const s=this.gamesContainerCWidth;return s<=400?"player-image400":s<=540?"player-image540":s<=650?"player-image650":"player-image"},thumbnailhighlights(){const s=this.gamesContainerCWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Om=new ResizeObserver(()=>{this.gamesContainerCWidth=this.$refs.gamesContainerC?this.$refs.gamesContainerC.clientWidth:0,this.movil=this.gamesContainerCWidth<740}),Om.observe(this.$refs.gamesContainerC);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Fm=()=>{n.useCssVars(s=>({"9cae8720":s.colorBackgroundHome,"58cca122":s.colorBackgroundHome+"36"}))},Mm=$r.setup;$r.setup=Mm?(s,e)=>(Fm(),Mm(s,e)):Fm;const wa=s=>(n.pushScopeId("data-v-ef4021c1"),s=s(),n.popScopeId(),s),oR=wa(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),rR=[oR],lR=wa(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),cR=["src"],dR=wa(()=>n.createElementVNode("div",{class:"base-logo"},null,-1)),hR=["src"],uR=wa(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),mR={class:"text-container"},fR={class:"player-image position-image"},pR=["src"],gR=["src"],yR=["src"],bR=wa(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function SR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerC",class:n.normalizeClass(o.thumbnailhighlights)},[n.createElementVNode("div",{class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},rR,2),lR,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,cR),dR,n.createElementVNode("img",{src:t.logoHome,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,hR),uR,n.createElementVNode("div",mR,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},n.toDisplayString(t.namePlayer),3),n.createElementVNode("span",{class:n.normalizeClass(o.secondline),style:n.normalizeStyle(t.nameCategory=="Balones recuperados en disputa "?"font-size: 25px":"")},n.toDisplayString(t.nameCategory),7)]),n.createElementVNode("div",fR,[t.typeImg==0?(n.openBlock(),n.createElementBlock("img",{key:0,src:t.photoProfile,class:n.normalizeClass(o.playerimage)},null,10,pR)):n.createCommentVNode("",!0),t.typeImg==1?(n.openBlock(),n.createElementBlock("img",{key:1,src:t.photoProfile,alt:""},null,8,gR)):n.createCommentVNode("",!0),t.typeImg==2?(n.openBlock(),n.createElementBlock("img",{key:2,src:t.photoProfile,class:"img-number"},null,8,yR)):n.createCommentVNode("",!0)]),bR],2)}const _R=os($r,[["render",SR],["__scopeId","data-v-ef4021c1"]]);let Vm=null;const zr={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},showVideos:{type:Boolean,default:!0},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""},nameTeam:{type:String,default:""},nameCategory:{type:String,default:""}},data(){return{gamesContainerCTWidth:0}},computed:{playbutton(){const s=this.gamesContainerCTWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},thumbnailhighlights(){const s=this.gamesContainerCTWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},secondline(){const s=this.gamesContainerCTWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},firstline(){const s=this.gamesContainerCTWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},teamlogo(){const s=this.gamesContainerCTWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Vm=new ResizeObserver(()=>{this.gamesContainerCTWidth=this.$refs.gamesContainerCT?this.$refs.gamesContainerCT.clientWidth:0,this.gamesContainerCTWidth<740?this.movil=!0:this.movil=!1}),Vm.observe(this.$refs.gamesContainerCT);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},$m=()=>{n.useCssVars(s=>({"3ce1ca00":s.colorBackgroundHome,"916c7edc":s.colorBackgroundHome+"36"}))},zm=zr.setup;zr.setup=zm?(s,e)=>($m(),zm(s,e)):$m;const Mn=s=>(n.pushScopeId("data-v-191985e2"),s=s(),n.popScopeId(),s),wR=Mn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),kR=[wR],ER=Mn(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),TR=["src"],CR={width:"275",height:"125",viewBox:"0 0 275 125",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"base-logo"},xR=["fill"],vR=["id"],AR=["stop-color"],LR=["stop-color"],IR=["src"],RR=Mn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),BR={class:"text-container"},NR=Mn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function DR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerCT",class:n.normalizeClass(o.thumbnailhighlights)},[t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},kR,2)):n.createCommentVNode("",!0),ER,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,TR),(n.openBlock(),n.createElementBlock("svg",CR,[n.createElementVNode("path",{d:"M274.641 124.094L0 0.675049V124.094H274.641Z",fill:"url(#paint0_linear_7_"+t.nameTeam.replaceAll(" ","")+")"},null,8,xR),n.createElementVNode("defs",null,[n.createElementVNode("linearGradient",{id:"paint0_linear_7_"+t.nameTeam.replaceAll(" ",""),x1:"58.6578",y1:"15.5938",x2:"58.6578",y2:"124.094",gradientUnits:"userSpaceOnUse"},[n.createElementVNode("stop",{"stop-color":t.colorBackgroundHome},null,8,AR),n.createElementVNode("stop",{offset:"1","stop-color":t.colorBackgroundHome},null,8,LR)],8,vR)])])),n.createElementVNode("img",{class:n.normalizeClass(o.teamlogo),src:t.logoHome,alt:""},null,10,IR),RR,n.createElementVNode("div",BR,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},[t.nameTeam!="Local"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.nameTeam),1)],64)):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3)]),NR],2)}const PR=os(zr,[["render",DR],["__scopeId","data-v-191985e2"]]);let Um=null;const Ur={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""},nameTeam:{type:String,default:""},nameCategory:{type:String,default:""}},data(){return{gamesContainerTAWidth:0}},computed:{playbutton(){const s=this.gamesContainerTAWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},thumbnailhighlights(){const s=this.gamesContainerTAWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},secondline(){const s=this.gamesContainerTAWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},firstline(){const s=this.gamesContainerTAWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},teamlogo(){const s=this.gamesContainerTAWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Um=new ResizeObserver(()=>{this.gamesContainerTAWidth=this.$refs.gamesContainerTA?this.$refs.gamesContainerTA.clientWidth:0,this.movil=this.gamesContainerTAWidth<740}),Um.observe(this.$refs.gamesContainerTA);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Gm=()=>{n.useCssVars(s=>({"1e0230d2":s.colorBackgroundHome,"1ae427ca":s.colorBackgroundHome+"36"}))},jm=Ur.setup;Ur.setup=jm?(s,e)=>(Gm(),jm(s,e)):Gm;const Vn=s=>(n.pushScopeId("data-v-61a93c22"),s=s(),n.popScopeId(),s),OR=Vn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),FR=[OR],MR=Vn(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),VR=["src"],$R={width:"275",height:"125",viewBox:"0 0 275 125",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"base-logo-away"},zR=["fill"],UR=["id"],GR=["stop-color"],jR=["stop-color"],HR=["src"],WR=Vn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),KR={class:"text-container"},qR=Vn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function YR(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerTA",class:n.normalizeClass(o.thumbnailhighlights)},[n.createElementVNode("div",{class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},FR,2),MR,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,VR),(n.openBlock(),n.createElementBlock("svg",$R,[n.createElementVNode("path",{d:"M274.641 124.094L0 0.675049V124.094H274.641Z",fill:"url(#paint0_linear_7_"+t.nameTeam.replaceAll(" ","")+")"},null,8,zR),n.createElementVNode("defs",null,[n.createElementVNode("linearGradient",{id:"paint0_linear_7_"+t.nameTeam.replaceAll(" ",""),x1:"58.6578",y1:"15.5938",x2:"58.6578",y2:"124.094",gradientUnits:"userSpaceOnUse"},[n.createElementVNode("stop",{"stop-color":t.colorBackgroundAway},null,8,GR),n.createElementVNode("stop",{offset:"1","stop-color":t.colorBackgroundAway},null,8,jR)],8,UR)])])),n.createElementVNode("img",{class:n.normalizeClass(o.teamlogo),src:t.logoHome,alt:""},null,10,HR),WR,n.createElementVNode("div",KR,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},[t.nameTeam!="Away"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.nameTeam),1)],64)):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3)]),qR],2)}const JR=os(Ur,[["render",YR],["__scopeId","data-v-61a93c22"]]);let Hm=null;const Gr={components:{},props:{colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},logoHome:{type:String,default:""},logoAway:{type:String,default:""},score:{type:String,default:""},background:{type:String,default:""},nameTeam:{type:String,default:""},nameCategory:{type:String,default:""}},data(){return{gamesContainerTALWidth:0}},computed:{playbutton(){const s=this.gamesContainerTALWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},thumbnailhighlights(){const s=this.gamesContainerTALWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"},secondline(){const s=this.gamesContainerTALWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},firstline(){const s=this.gamesContainerTALWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},teamlogo(){const s=this.gamesContainerTALWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Hm=new ResizeObserver(()=>{this.gamesContainerTALWidth=this.$refs.gamesContainerTAL?this.$refs.gamesContainerTAL.clientWidth:0,this.movil=this.gamesContainerTALWidth<740}),Hm.observe(this.$refs.gamesContainerTAL);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Wm=()=>{n.useCssVars(s=>({"41af18a7":s.colorBackgroundHome,"1387690b":s.colorBackgroundHome+"36"}))},Km=Gr.setup;Gr.setup=Km?(s,e)=>(Wm(),Km(s,e)):Wm;const $n=s=>(n.pushScopeId("data-v-19ce95f3"),s=s(),n.popScopeId(),s),XR=$n(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),ZR=[XR],QR=$n(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),eB=["src"],tB={width:"275",height:"125",viewBox:"0 0 275 125",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"base-logo-away-live"},sB=["fill"],aB=["id"],nB=["stop-color"],iB=["stop-color"],oB=["src"],rB=$n(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),lB={class:"text-container"},cB=$n(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1));function dB(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerTAL",class:n.normalizeClass(o.thumbnailhighlights)},[n.createElementVNode("div",{class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},ZR,2),QR,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,eB),(n.openBlock(),n.createElementBlock("svg",tB,[n.createElementVNode("path",{d:"M274.641 124.094L0 0.675049V124.094H274.641Z",fill:"url(#paint0_linear_10_"+t.nameTeam.replaceAll(" ","")+")"},null,8,sB),n.createElementVNode("defs",null,[n.createElementVNode("linearGradient",{id:"paint0_linear_10_"+t.nameTeam.replaceAll(" ",""),x1:"58.6578",y1:"15.5938",x2:"58.6578",y2:"124.094",gradientUnits:"userSpaceOnUse"},[n.createElementVNode("stop",{"stop-color":t.colorBackgroundAway},null,8,nB),n.createElementVNode("stop",{offset:"1","stop-color":t.colorBackgroundAway},null,8,iB)],8,aB)])])),n.createElementVNode("img",{class:n.normalizeClass(o.teamlogo),src:t.logoHome,alt:""},null,10,oB),rB,n.createElementVNode("div",lB,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},[t.nameTeam!="Away"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(t.nameTeam),1)],64)):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3)]),cB],2)}const hB=os(Gr,[["render",dB],["__scopeId","data-v-19ce95f3"]]);let qm=null;const jr={components:{},props:{colorFontHome:{type:String,default:"#000000"},colorFontAway:{type:String,default:"#000000"},type:{type:Number,default:0},showVideos:{type:Boolean,default:!0},playStatus:{type:Number,default:2},matchday:{type:String,default:""},seasonName:{type:String,default:""},colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},nameCategory:{type:String,default:""},showimg:{type:Boolean,default:!0},photoProfile:{type:String,default:""},logoHome:{type:String,default:""},logoAway:{type:String,default:""},date:{type:String,default:""},scoreHome:{type:[String,Number],default:""},scoreAway:{type:[String,Number],default:""},background:{type:String,default:""},typeImg:{type:Number,default:0},nameHomeTeam:{type:String,default:""},nameAwayTeam:{type:String,default:""},namePlayer:{type:String,default:""}},data(){return{gamesContainerGPWidth:0}},computed:{seasoncontainer(){const s=this.gamesContainerGPWidth;return s<=400?"season-container400":s<=540?"season-container540":s<=650?"season-container650":"season-container"},matchcontainer(){const s=this.gamesContainerGPWidth;return s<=400?"match-container400":s<=540?"match-container540":s<=650?"match-container650":"match-container"},seasonnameContainer(){const s=this.gamesContainerGPWidth;return s<=400?"seasonname400":s<=540?"seasonname540":s<=650?"seasonname650":"seasonname"},matchboxContainer(){const s=this.gamesContainerGPWidth;return s<=400?"matchbox400":s<=540?"matchbox540":s<=650?"matchbox650":"matchbox"},containerinfogame(){const s=this.gamesContainerGPWidth;return s<=400?"container-info-game400":s<=540?"container-info-game540":s<=650?"container-info-game650":"container-info-game"},playbutton(){const s=this.gamesContainerGPWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},points(){const s=this.gamesContainerGPWidth;return s<=400?"points400":s<=540?"points540":s<=650?"points650":"points"},teamname(){const s=this.gamesContainerGPWidth;return s<=400?"team-name400":s<=540?"team-name540":s<=650?"team-name650":"team-name"},teamscore(){const s=this.gamesContainerGPWidth;return s<=400?"team-score400":s<=540?"team-score540":s<=650?"team-score650":"team-score"},teamlogo(){const s=this.gamesContainerGPWidth;return s<=400?"team-logo400":s<=540?"team-logo540":s<=650?"team-logo650":"team-logo"},hometeam(){const s=this.gamesContainerGPWidth;return s<=400?"home-team400":s<=540?"home-team540":s<=650?"home-team650":"home-team"},awayteam(){const s=this.gamesContainerGPWidth;return s<=400?"away-team400":s<=540?"away-team540":s<=650?"away-team650":"away-team"},texttitle(){const s=this.gamesContainerGPWidth;return s<=400?"text-title400":s<=540?"text-title540":s<=650?"text-title650":"text-title"},texttitle2(){const s=this.gamesContainerGPWidth;return s<=400?"text-title2400":s<=540?"text-title2540":s<=650?"text-title2650":"text-title2"},playerimage(){const s=this.gamesContainerGPWidth;return s<=400?"player-image400":s<=540?"player-image540":s<=650?"player-image650":"player-image"},thumbnailhighlights(){const s=this.gamesContainerGPWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)qm=new ResizeObserver(()=>{this.gamesContainerGPWidth=this.$refs.gamesContainerGP?this.$refs.gamesContainerGP.clientWidth:0,this.gamesContainerGPWidth<740?this.movil=!0:this.movil=!1}),qm.observe(this.$refs.gamesContainerGP);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Ym=()=>{n.useCssVars(s=>({"14532c00":s.colorBackgroundHome,"14594fe2":s.colorBackgroundAway,"672ee12c":s.colorBackgroundAway+"62","11fb9192":s.colorBackgroundHome+"36"}))},Jm=jr.setup;jr.setup=Jm?(s,e)=>(Ym(),Jm(s,e)):Ym;const zn=s=>(n.pushScopeId("data-v-77384f47"),s=s(),n.popScopeId(),s),uB=["width","src"],mB=zn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1)),fB=zn(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),pB=[fB],gB={class:"player-container"},yB=["src"],bB=["src"],SB=["src"],_B={class:"container-score"},wB=["src"],kB=["src"],EB=["src"],TB=zn(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),CB=zn(()=>n.createElementVNode("div",{class:"gradient-color"},null,-1));function xB(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerGP",class:n.normalizeClass(o.thumbnailhighlights)},[t.playStatus!=2?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass((t.playStatus==1,"icon-thumb"))},[n.createElementVNode("img",{width:t.playStatus==1?60:40,src:t.playStatus==1?"http://golstatsimages.blob.core.windows.net/images-library/icn-live@2x.png":"http://golstatsimages.blob.core.windows.net/images-library/icn-info@2x.png"},null,8,uB)],2)):n.createCommentVNode("",!0),mB,t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},pB,2)):n.createCommentVNode("",!0),n.createElementVNode("div",gB,[n.createElementVNode("div",{class:n.normalizeClass(o.containerinfogame)},[n.createElementVNode("div",{class:n.normalizeClass(o.matchcontainer)},[t.matchday?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.matchboxContainer)},n.toDisplayString(t.matchday),3)):n.createCommentVNode("",!0),t.seasonName?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(o.seasonnameContainer)},n.toDisplayString(t.seasonName),3)):n.createCommentVNode("",!0)],2),t.date?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.seasoncontainer)},n.toDisplayString(t.date),3)):n.createCommentVNode("",!0)],2),t.type==0?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(o.texttitle)},n.toDisplayString(t.nameCategory),3)):(n.openBlock(),n.createElementBlock("span",{key:1,class:n.normalizeClass(o.texttitle2)},n.toDisplayString(t.nameCategory),3)),t.showimg?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[t.typeImg==0?(n.openBlock(),n.createElementBlock("img",{key:0,src:t.photoProfile,class:n.normalizeClass(o.playerimage)},null,10,yB)):n.createCommentVNode("",!0),t.typeImg==1?(n.openBlock(),n.createElementBlock("img",{key:1,src:t.photoProfile,alt:""},null,8,bB)):n.createCommentVNode("",!0),t.typeImg==2?(n.openBlock(),n.createElementBlock("img",{key:2,src:t.photoProfile,class:"img-number"},null,8,SB)):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),n.createElementVNode("div",_B,[n.createElementVNode("div",{class:n.normalizeClass(o.hometeam)},[n.createElementVNode("span",{class:n.normalizeClass(o.teamname),style:n.normalizeStyle({color:t.colorFontAway})},n.toDisplayString(t.nameHomeTeam),7),n.createElementVNode("img",{src:t.logoHome,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,wB),n.createElementVNode("span",{class:n.normalizeClass(o.teamscore)},n.toDisplayString(t.scoreHome),3)],2),n.createElementVNode("span",{class:n.normalizeClass(o.points)},":",2),n.createElementVNode("div",{class:n.normalizeClass(o.awayteam)},[n.createElementVNode("span",{class:n.normalizeClass(o.teamscore)},n.toDisplayString(t.scoreAway),3),n.createElementVNode("img",{src:t.logoAway,alt:"",class:n.normalizeClass(o.teamlogo)},null,10,kB),n.createElementVNode("span",{class:n.normalizeClass(o.teamname),style:n.normalizeStyle({color:t.colorFontAway})},n.toDisplayString(t.nameAwayTeam),7)],2)])]),n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,EB),TB,CB],2)}const vB=os(jr,[["render",xB],["__scopeId","data-v-77384f47"]]);let Xm=null;const Hr={components:{},props:{colorFont:{type:String,default:"#000000"},showVideos:{type:Boolean,default:!0},colorBackgroundHome:{type:String,default:"#000000"},colorBackgroundAway:{type:String,default:"#FFFFFF"},nameCategory:{type:String,default:""},photoProfile:{type:String,default:""},logoHome:{type:String,default:""},logoAway:{type:String,default:""},scoreHome:{type:[String,Number],default:""},scoreAway:{type:[String,Number],default:""},background:{type:String,default:""},typeImg:{type:Number,default:0},nameHomeTeam:{type:String,default:""},nameAwayTeam:{type:String,default:""},namePlayer:{type:String,default:""}},data(){return{gamesContainerSPWidth:0}},computed:{playbutton(){const s=this.gamesContainerSPWidth;return s<=400?"play-button400":s<=540?"play-button540":s<=650?"play-button650":"play-button"},firstline(){const s=this.gamesContainerSPWidth;return s<=400?"first-line400":s<=540?"first-line540":s<=650?"first-line650":"first-line"},secondline(){const s=this.gamesContainerSPWidth;return s<=400?"second-line400":s<=540?"second-line540":s<=650?"second-line650":"second-line"},playername(){const s=this.gamesContainerSPWidth;return s<=400?"player-name400":s<=540?"player-name540":s<=650?"player-name650":"player-name"},playerimage(){const s=this.gamesContainerSPWidth;return s<=400?"player-image400":s<=540?"player-image540":s<=650?"player-image650":"player-image"},thumbnailhighlights(){const s=this.gamesContainerSPWidth;return s<=400?"thumbnail-highlights400":s<=540?"thumbnail-highlights540":s<=650?"thumbnail-highlights650":"thumbnail-highlights"}},methods:{onclickPlayVideos(){this.$emit("onclickPlayVideos")},setUpResizeObserver(){if(window.ResizeObserver)Xm=new ResizeObserver(()=>{this.gamesContainerSPWidth=this.$refs.gamesContainerSP?this.$refs.gamesContainerSP.clientWidth:0,this.movil=this.gamesContainerSPWidth<740}),Xm.observe(this.$refs.gamesContainerSP);else throw new Error("Resize observer not supported!")}},mounted(){setTimeout(()=>{this.setUpResizeObserver()},100)}},Zm=()=>{n.useCssVars(s=>({"17845cea":s.colorBackgroundHome+"30","3e8f3cad":s.colorBackgroundHome}))},Qm=Hr.setup;Hr.setup=Qm?(s,e)=>(Zm(),Qm(s,e)):Zm;const Un=s=>(n.pushScopeId("data-v-df5486d2"),s=s(),n.popScopeId(),s),AB=Un(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M6.6041 22.8554C6.42105 22.7512 6.26805 22.5956 6.1616 22.4053C6.05515 22.215 5.99927 21.9973 6.00001 21.7755V2.22137C6.00026 2.00039 6.0565 1.78362 6.16274 1.59409C6.26899 1.40456 6.42127 1.24936 6.6034 1.14499C6.78553 1.04062 6.9907 0.990981 7.1971 1.00135C7.4035 1.01171 7.60342 1.0817 7.77561 1.20386L21.4907 10.9821C21.6473 11.0935 21.7758 11.2446 21.8646 11.4219C21.9535 11.5992 22 11.7973 22 11.9985C22 12.1996 21.9535 12.3977 21.8646 12.575C21.7758 12.7523 21.6473 12.9034 21.4907 13.0148L7.77561 22.7954C7.60369 22.9178 7.40392 22.988 7.19761 22.9986C6.9913 23.0092 6.78617 22.9597 6.6041 22.8554ZM7.14347 21.7779L20.8585 11.9996L7.14347 21.7779Z",fill:"#CBEE6B"})],-1)),LB=[AB],IB={class:"player-image position-image"},RB=["src"],BB=["src"],NB=["src"],DB=["src"],PB=Un(()=>n.createElementVNode("div",{class:"gradient-back position-image"},null,-1)),OB=["src"],FB=Un(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/paper-texture.png",alt:"",class:"paper-texture position-image"},null,-1)),MB={class:"text-container"},VB=Un(()=>n.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/images-library/halftone-texture.png",alt:"",class:"halftone-texture position-image"},null,-1)),$B={class:"base-logo",width:"91",height:"216",viewBox:"0 0 91 216",fill:"none",xmlns:"http://www.w3.org/2000/svg"},zB=["fill"];function UB(s,e,t,a,i,o){return n.openBlock(),n.createElementBlock("div",{ref:"gamesContainerSP",class:n.normalizeClass(o.thumbnailhighlights)},[t.showVideos?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(o.playbutton),onClick:e[0]||(e[0]=(...r)=>o.onclickPlayVideos&&o.onclickPlayVideos(...r))},LB,2)):n.createCommentVNode("",!0),n.createElementVNode("div",IB,[t.typeImg==0?(n.openBlock(),n.createElementBlock("img",{key:0,src:t.photoProfile,class:n.normalizeClass(o.playerimage)},null,10,RB)):n.createCommentVNode("",!0),t.typeImg==1?(n.openBlock(),n.createElementBlock("img",{key:1,src:t.photoProfile,alt:""},null,8,BB)):n.createCommentVNode("",!0),t.typeImg==2?(n.openBlock(),n.createElementBlock("img",{key:2,src:t.photoProfile,class:"img-number"},null,8,NB)):n.createCommentVNode("",!0)]),n.createElementVNode("img",{src:t.logoHome,alt:"",class:"team-logo"},null,8,DB),PB,n.createElementVNode("img",{src:t.background,alt:"",class:"bkg-blackwhite position-image"},null,8,OB),FB,n.createElementVNode("div",MB,[n.createElementVNode("span",{class:n.normalizeClass(o.firstline)},"MEJORES JUGADAS",2),n.createElementVNode("span",{class:n.normalizeClass(o.secondline)},n.toDisplayString(t.nameCategory),3),n.createElementVNode("div",{class:n.normalizeClass(o.playername),style:n.normalizeStyle({color:t.colorFont})},n.toDisplayString(t.namePlayer),7)]),VB,(n.openBlock(),n.createElementBlock("svg",$B,[n.createElementVNode("path",{d:"M91.5 216L0 -0.5H91.5V216Z",fill:t.colorBackgroundHome},null,8,zB)]))],2)}const GB=os(Hr,[["render",UB],["__scopeId","data-v-df5486d2"]]);function jB(s){const e=n.ref({width:0,height:0});function t(){const a=s.value.getBoundingClientRect();e.value.width=a.width,e.value.height=a.height}return n.onMounted(()=>{t(),window.addEventListener("resize",t)}),n.onUnmounted(()=>{window.removeEventListener("resize",t)}),{elementSize:e}}const HB="_ptg_1shb4_2",WB="_ptgtitle_1shb4_7",KB="_ptgtitle450_1shb4_23",qB="_pgtcontainercard_1shb4_39",YB="_pgtcontainercard350_1shb4_44",JB={ptg:HB,ptgtitle:WB,ptgtitle450:KB,pgtcontainercard:qB,pgtcontainercard350:YB},Wr={components:{GSCSlider:q4,GSCThumbnailCategory:_R,GSCThumbnailCategoryTeam:PR,GSCThumbnailCategoryTeamAway:JR,GSCThumbnailHighlightGamePlayer:vB,GSCThumbnailCategoryTeamAwayLive:hB,GSCThumbnailSummaryPlayer:GB,GSCThumbnailHighlightGameHistoric:iR},setup(){const s=n.ref("ptgDiv"),{elementSize:e}=jB(s);return{ptgDiv:s,elementSize:e}},props:{isWidget:{type:Boolean,default:!1},teamWidget:{type:Number,default:0},receiveData:{type:Boolean,default:!1},information:{type:Array,default:()=>[]},title:{type:String,default:"100% de sus participaciones en cada partido:"},type:{type:Number,default:0},showVideos:{type:Boolean,default:!0},viewType:{type:Number,default:2},local:{type:Boolean,default:!0},data:{type:Object,default:()=>{}},backgroundColor:{type:String,default:"#0D1D29"},backgroundFooter:{type:String,default:"#192733"},matchdayView:{type:Number,default:1},pxScroll:{type:Number,default:100},arrows:{type:Boolean,default:!0},arrowsScrollHide:{type:Boolean,default:!1},arrowsHideOnNoScroll:{type:Boolean,default:!1},arrowsColor:{type:String,default:"#CBEE6B"},arrowsHeight:{type:Number,default:15},arrowsWidth:{type:Number,default:15},arrowsPadding:{type:Number,default:5},arrowsMargin:{type:Number,default:10},arrowsRadius:{type:String,default:"0%"},arrowsBorder:{type:String,default:"none"},arrowsBackground:{type:String,default:"#0D1D29"},arrowsContainerBgL:{type:String,default:"#0D1D29"},arrowsContainerBgR:{type:String,default:"#0D1D29"},scrollColor:{type:String,default:"#c3e569"},arrowsPosition:{type:String,default:"relative"},height:{type:String,default:"100%"},videoPrivilegesPlayingAs:{type:Set,default:()=>new Set([1,2])},playVideosPrivileges:{type:Object,default:null},awaitForSpecificsPlaysBySeason:{type:Boolean,default:!1},awaitForBestPlaysBySeasonAndTeam:{type:Boolean,default:!1},awaitForBestPlaysBySeasonAndGame:{type:Boolean,default:!1},awaitForTeamsInfo:{type:Boolean,default:!1},specificsPlaysBySeasonResponse:{type:Object,default:null},bestPlaysBySeasonAndTeamResponse:{type:Object,default:null},bestPlaysBySeasonAndGameResponse:{type:Object,default:null},teamsInfoResponse:{type:Object,default:null}},data(){return{token:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE",printData:[],teamsInfo:[],playerPhoto:!0,homeTeam:0,flagGames:[],lastseason:0,arrayMatchdays:[],awayTeam:0,goalCategories:[12,55,"35_r","54_r"],resumeCategories:[607,608,12,55,54,35,14,52,15,53,466,477],lastType:0,lastUrl:"",teamsInfoLastUrl:""}},watch:{data:{immediate:!0,handler(s){this.type!==14&&(this.receiveData||this.getTeamsInfo(s)),this.getStats(s)}},teamsInfoResponse(s){s&&(this.receiveData||this.getTeamsInfo(this.data))},bestPlaysBySeasonAndTeamResponse(s){s&&this.getStats(this.data)},bestPlaysBySeasonAndGameResponse(s){s&&this.getStats(this.data)},specificsPlaysBySeasonResponse(s){s&&this.getStats(this.data)}},computed:{ptgtitleClass(){return this.elementSize.width<=450?this.$style.ptgtitle450:this.$style.ptgtitle},pgtcontainercardClass(){return this.elementSize.width<=350?this.$style.pgtcontainercard350:this.$style.pgtcontainercard}},methods:{getBestPlaysUrl({season:s,player:e,team:t,game:a,category:i}){let o="https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/best-plays/seasons/";return s&&(o+=`${s}`),e&&(o+=`/players/${e}`),t&&(o+=`/teams/${t}`),a&&(o+=`/games/${a}`),i&&(o+=`/categories/${i}`),this.videoPrivilegesPlayingAs.has(1)&&!this.videoPrivilegesPlayingAs.has(2)?o+="?isLocal=1":this.videoPrivilegesPlayingAs.has(2)&&!this.videoPrivilegesPlayingAs.has(1)&&(o+="?isVisitor=1"),this.isWidget&&this.teamWidget!=0&&[3,4,5].includes(this.type)&&(o+=`?t=${this.teamWidget}`),o},getIsSameScenario(s,e){const t=this.lastType===s&&this.lastUrl===e;return t||(this.lastType=s,this.lastUrl=e),t},onclickPlayVideos(s){let e=[],t=s.data.game_id?[s.data.game_id]:null;s.type==2?s.data.position_id==1?s.data.category==0?e=s.isAllPlays?[14,52,15,53,300,301,308,309,310,311,304,305,306,307,260,261,312,265,266,267,268,313,314,43,324,323,478,479,480,481,474,475,476,477,40,26,325,16,51,462,463,151,154,156,591,592,159,162,163,429,165,593,594,168,171,172,430,174,595,596,177,180,181,431,467,358,361,363,366,369,370,469,372,376,378,379,470,381,385,387,388,471,607,608,262,263]:[42,55,324,323,608,39,774,802,52,53,40,54]:e=s.data.category:s.data.category==0?e=s.isAllPlays?[56,57,59,60,326,213,214,215,216,583,584,122,123,124,125,585,586,128,129,130,131,133,327,587,588,136,137,138,139,589,590,142,143,144,145,146,147,485,486,487,488,489,490,491,492,10,27,597,598,538,539,599,600,541,542,601,602,545,546,603,604,548,549,561,562,100,563,564,103,104,105,106,107,108,565,566,111,567,568,114,115,116,117,118,119,4,88,5,34,402,459,460,461,233,403,456,457,458,236,404,453,454,455,240,405,450,451,452,243,408,447,448,449,283,409,444,445,446,285,410,441,442,443,290,411,438,439,440,292,412,435,436,437,297,414,415,416,417,244,418,419,420,421,401,581,582,331,506,530,579,580,334,507,531,577,578,344,508,532,575,576,424,509,533,573,574,341,529,534,571,572,340,528,535,569,570,427,527,536,348,349,350,465,352,353,354,466,14,52,15,53,218,219,220,221,496,497,498,499,500,501,502,503,217,504,505,521,522,543,33,209,208,517,206,207,26,325,16,51,463,151,154,156,591,592,159,162,163,429,165,593,594,168,171,172,430,174,595,596,177,180,181,431,467,358,361,363,366,369,370,469,372,376,378,379,470,381,385,387,388,471,607,608,210,212]:[12,35,10,27,607,61,519,98,101,109,112,121,122,127,128,135,136,141,142,161,170,179,702,730,466,217,211,232,235,239,242,282,284,289,291,296,485,486,487,488,14,15,257]:e=s.data.category:s.type==3?s.data.category==0?e=[607,608,12,55,54,35,14,52,15,53,466,477,40,257,39]:e=s.data.category:s.data.category!=0?e=s.data.category:e=[607,608,12,55,54,35,14,52,15,53,466,477],this.data.isPrematch===1&&(t=null);const a=[1,2,3];let i={type:s.data.has_mxm?1:0,seasonId:s.data.season_id,mainSectionType:1,playListType:s.type,categoryIds:s.categories&&s.categories.length?s.categories:e,gameIds:t,playerIds:s.data.player_id?[s.data.player_id]:[],goalkeeperIds:s.data.position_id==1?s.data.player_id?[s.data.player_id]:[]:[],teamId:s.data.team_id?s.data.team_id:0,matchResult:s.data.matchResult?[s.matchResult]:a,playData:{},advancedFilter:{playListTitle:""}};s.data.category!==0&&(i.advancedFilter.mainCategoryId=s.data.category),this.$emit("openmedia",i)},onClickVideos(s){this.$emit("onClickVideos",s)},onClickCard(s){this.$emit("onClickCard",s)},async getTeamsInfo(s){if(this.awaitForTeamsInfo&&!this.teamsInfoResponse)return;const e="https://d2oco6mqmc.execute-api.us-west-2.amazonaws.com/prod/teamsBySeason/"+s.season;if(e===this.teamsInfoLastUrl)return;this.teamsInfoLastUrl=e;const t=Im.create({headers:{Authorization:`${this.token}`}}),a=this.awaitForTeamsInfo?this.teamsInfoResponse:await t.get(e);for(let i=0;i<a.data.teams.length;i++)this.teamsInfo[a.data.teams[i].team_id]=a.data.teams[i]},async getStats(s){if(!this.receiveData){const i=Im.create({headers:{Authorization:`${this.token}`}});var e=[],t={},a={};if(this.type===0){if(a=await i.get("https://uof4tt5l46.execute-api.us-west-2.amazonaws.com/prod/v3/playerInfo/"+s.season+"/"+s.player),this.videoPrivilegesPlayingAs)if(a.data.seasons[s.season]){const o=a.data.team_id;a.data.seasons[s.season].games_played=a.data.seasons[s.season].games_played.filter(r=>(r.playingAs=r.home_team===o?1:2,this.videoPrivilegesPlayingAs.has(r.playingAs)))}else{const o=a.data.team_id;a.data.national_seasons[s.season].games_played=a.data.national_seasons[s.season].games_played.filter(r=>(r.playingAs=r.home_team===o?1:2,this.videoPrivilegesPlayingAs.has(r.playingAs)))}if(a.data.seasons[s.season])for(let o=0;o<a.data.seasons[s.season].games_played.length;o++)t={player_id:s.player,color:a.data.info_thumbnails.colors.background_color,colorfont:a.data.info_thumbnails.colors.font_color,photo_profile:a.data.info_thumbnails.images.player_in_action[0]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.player_in_action[0]:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png",team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.seasons[s.season].games_played[o].home_team+".png",player_name:a.data.seasons[s.season].games_played[o].home_team_acronym+" "+a.data.seasons[s.season].games_played[o].home_team_score+" : "+a.data.seasons[s.season].games_played[o].visiting_team_score+" "+a.data.seasons[s.season].games_played[o].visiting_team_acronym,team_id_b:a.data.seasons[s.season].games_played[o].home_team,season_id:a.data.seasons[s.season].games_played[o].season_id,name:"",date:this.obtenerNombreCompletoFecha(a.data.seasons[s.season].games_played[o].date),category:0,team_id:a.data.team_id,game_id:a.data.seasons[s.season].games_played[o].game_id,has_mxm:a.data.seasons[s.season].games_played[o].has_mxm,position_id:a.data.position_id,scorehome:a.data.seasons[s.season].games_played[o].home_team_score,scoreaway:a.data.seasons[s.season].games_played[o].visiting_team_score,hometeamacronym:a.data.seasons[s.season].games_played[o].home_team_acronym,visitingteamacronym:a.data.seasons[s.season].games_played[o].visiting_team_acronym,seasonname:a.data.seasons[s.season].name,seasonname2:a.data.seasons[s.season].name.replace("Clausura","CL ").replace("Apertura","AP "),match:a.data.seasons[s.season].games_played[o].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"),score:a.data.seasons[s.season].games_played[o].home_team_score+" : "+a.data.seasons[s.season].games_played[o].visiting_team_score,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.background_player_in_action[0],backgroundhome:a.data.seasons[s.season].games_played[o].info_thumbnails.home_colors.background_color,backgroundaway:a.data.seasons[s.season].games_played[o].info_thumbnails.away_colors.background_color,colorfont_home:a.data.seasons[s.season].games_played[o].info_thumbnails.home_colors.font_color,colorfont_away:a.data.seasons[s.season].games_played[o].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.seasons[s.season].games_played[o].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.seasons[s.season].games_played[o].visiting_team+".png",total:a.data.seasons[s.season].games_played[o].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.seasons[s.season].games_played[o].home_team+"_"+a.data.seasons[s.season].games_played[o].season_id+"_r1.jpg"},e.push(t);else for(let o=0;o<a.data.national_seasons[s.season].games_played.length;o++)t={player_id:s.player,color:a.data.info_thumbnails.colors.background_color,colorfont:a.data.info_thumbnails.colors.font_color,photo_profile:a.data.info_thumbnails.images.player_in_action[0]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.player_in_action[0]:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png",team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.national_seasons[s.season].games_played[o].home_team+".png",player_name:a.data.national_seasons[s.season].games_played[o].home_team_acronym+" "+a.data.national_seasons[s.season].games_played[o].home_team_score+" : "+a.data.national_seasons[s.season].games_played[o].visiting_team_score+" "+a.data.national_seasons[s.season].games_played[o].visiting_team_acronym,team_id_b:a.data.national_seasons[s.season].games_played[o].home_team,season_id:a.data.national_seasons[s.season].games_played[o].season_id,name:"",date:this.obtenerNombreCompletoFecha(a.data.national_seasons[s.season].games_played[o].date),category:0,team_id:a.data.team_id,game_id:a.data.national_seasons[s.season].games_played[o].game_id,position_id:a.data.position_id,scorehome:a.data.national_seasons[s.season].games_played[o].home_team_score,scoreaway:a.data.national_seasons[s.season].games_played[o].visiting_team_score,hometeamacronym:a.data.national_seasons[s.season].games_played[o].home_team_acronym,visitingteamacronym:a.data.national_seasons[s.season].games_played[o].visiting_team_acronym,seasonname:a.data.national_seasons[s.season].name,seasonname2:a.data.national_seasons[s.season].name.replace("Clausura","CL ").replace("Apertura","AP "),match:a.data.national_seasons[s.season].games_played[o].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"),score:a.data.national_seasons[s.season].games_played[o].home_team_score+" : "+a.data.national_seasons[s.season].games_played[o].visiting_team_score,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.info_thumbnails.images.background_player_in_action[0],backgroundhome:a.data.national_seasons[s.season].games_played[o].info_thumbnails.home_colors.background_color,backgroundaway:a.data.national_seasons[s.season].games_played[o].info_thumbnails.away_colors.background_color,colorfont_home:a.data.national_seasons[s.season].games_played[o].info_thumbnails.home_colors.font_color,colorfont_away:a.data.national_seasons[s.season].games_played[o].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.national_seasons[s.season].games_played[o].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.national_seasons[s.season].games_played[o].visiting_team+".png",total:a.data.national_seasons[s.season].games_played[o].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.national_seasons[s.season].games_played[o].home_team+"_"+a.data.national_seasons[s.season].games_played[o].season_id+"_r1.jpg"},e.push(t)}if(this.type===1){if(this.awaitForBestPlaysBySeasonAndTeam&&!this.bestPlaysBySeasonAndTeamResponse)return;const o=this.getBestPlaysUrl({season:s.season,team:s.team});if(this.getIsSameScenario(1,o))return;a=this.awaitForBestPlaysBySeasonAndTeam?this.bestPlaysBySeasonAndTeamResponse:await i.get(o);for(let r=0;r<a.data.categories.length;r++){this.playerPhoto=!1;const l=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.background_default_categories.length),d=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.background_default_teams.length);t={player_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.background_default_categories[l],background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.background_default_teams[d],color:a.data.categories[r].info_thumbnails.colors.background_color,team_logo:"https://az755631.vo.msecnd.net/teams-80/"+a.data.categories[r].info_thumbnails.team_logo,player_name:a.data.categories[r].category_name,team_name:this.teamsInfo[a.data.team_id].colloquial_name,team_id:a.data.team_id,colorfont:a.data.categories[r].info_thumbnails.colors.font_color,team_id_b:a.data.team_id,category:a.data.categories[r].categories,season_id:a.data.season_id,total:a.data.categories[r].total,background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.team_id+"_"+a.data.season_id+"_r1.jpg"},e.push(t)}}if(this.type===2){const o=this.getBestPlaysUrl({season:s.season,game:s.game});if(this.getIsSameScenario(2,o))return;a=await i.get(o);for(let r=0;r<a.data.categories.length;r++){this.playerPhoto=!1;const l=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.player_in_action.length),d=Math.floor(Math.random()*a.data.categories[r].info_thumbnails.images.background_default_categories.length);t={player_action:a.data.categories[r].info_thumbnails.images.player_in_action[l]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.player_in_action[l]:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png",background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.categories[r].info_thumbnails.images.background_default_categories[d],color:a.data.categories[r].info_thumbnails.colors.background_color,team_logo:"https://az755631.vo.msecnd.net/teams-80/"+a.data.categories[r].info_thumbnails.team_logo,player_name:a.data.categories[r].category_name,season_id:s.season,colorfont:a.data.categories[r].info_thumbnails.colors.font_color,player_id:s.player,team_id:a.data.categories[r].info_thumbnails.colors.team_id,category:a.data.categories[r].categories,total:a.data.categories[r].total,background_card:"https://az755631.vo.msecnd.net/players-profile/"+s.player+".png"},e.push(t)}}if(this.type===3){if(this.playerPhoto=!1,this.awaitForBestPlaysBySeasonAndGame&&!this.bestPlaysBySeasonAndGameResponse)return;const o=this.getBestPlaysUrl({season:s.season,game:s.game});if(this.getIsSameScenario(3,o))return;a=this.awaitForBestPlaysBySeasonAndGame?this.bestPlaysBySeasonAndGameResponse:await i.get(o),this.playVideosPrivileges&&(this.playVideosPrivileges.canPrivilegesTeamPlayVideos?a.data.games[0].players=a.data.games[0].players.filter(r=>r.team_id==this.playVideosPrivileges.seasonAndPrivileges.teamId):a.data.games[0].players=[]);for(let r=0;r<a.data.games[0].players.length;r++){const l=Math.floor(Math.random()*a.data.games[0].players[r].info_thumbnails.images.background_player_in_action.length),d=Math.floor(Math.random()*a.data.games[0].players[r].info_thumbnails.images.player_in_action.length);t={colorbackgroundhome:a.data.games[0].players[r].info_thumbnails.colors.background_color,colorbackgroundaway:"",nameplayer:a.data.games[0].players[r].player_name,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.games[0].players[r].info_thumbnails.images.background_player_in_action[l],namecategory:"RESUMEN",namehometeam:"",nameawayteam:"",category:0,colorfont:a.data.games[0].players[r].info_thumbnails.colors.font_color,team_id:a.data.games[0].players[r].team_id,player_id:a.data.games[0].players[r].player_id,game_id:a.data.games[0].game_id,has_mxm:a.data.games[0].has_mxm,season_id:a.data.season_id,logohome:a.data.games[0].players[r].team_logo,photoprofile:a.data.games[0].players[r].info_thumbnails.images.player_in_action[d]?"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.games[0].players[r].info_thumbnails.images.player_in_action[d]:"https://az755631.vo.msecnd.net/players-profile/"+a.data.games[0].players[r].player_id+".png",logoaway:"",scoreaway:"",scorehome:""},e.push(t)}}if(this.type===4){if(this.awaitForSpecificsPlaysBySeason&&!this.specificsPlaysBySeasonResponse)return;this.playerPhoto=!1;const o="https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/specifics-plays/seasons/"+s.season+"/games/"+s.game;if(this.getIsSameScenario(4,o))return;a=this.awaitForSpecificsPlaysBySeason?this.specificsPlaysBySeasonResponse:await i.get(o);for(let r=0;r<a.data.home_team.categories.length;r++){const l=Math.floor(Math.random()*a.data.home_team.categories[r].info_thumbnails.images.background_default_teams.length);t={game_id:a.data.game_id,has_mxm:a.data.has_mxm,season_id:a.data.season_id,team_id:a.data.home_team.team_id,category:a.data.home_team.categories[r].categories.concat(a.data.home_team.categories[r].rival_categories),background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.home_team.categories[r].info_thumbnails.images.background_default_categories[l],player_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.home_team.categories[r].info_thumbnails.images.background_default_categories[l],team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.home_team.team_id+".png",color:a.data.home_team.categories[r].info_thumbnails.colors.background_color,colorfont:a.data.home_team.categories[r].info_thumbnails.colors.font_color,player_name:a.data.home_team.categories[r].category_name,total:a.data.home_team.categories[r].total,team_name:"Local",background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.home_team.team_id+"_"+a.data.season_id+"_r1.jpg"},e.push(t)}}if(this.type===5){if(this.awaitForSpecificsPlaysBySeason&&!this.specificsPlaysBySeasonResponse)return;this.playerPhoto=!1;const o="https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/specifics-plays/seasons/"+s.season+"/games/"+s.game;if(this.getIsSameScenario(5,o))return;a=this.awaitForSpecificsPlaysBySeason?this.specificsPlaysBySeasonResponse:await i.get(o);for(let r=0;r<a.data.visiting_team.categories.length;r++){const l=Math.floor(Math.random()*a.data.visiting_team.categories[r].info_thumbnails.images.background_default_categories.length);t={game_id:a.data.game_id,has_mxm:a.data.has_mxm,season_id:a.data.season_id,team_id:a.data.visiting_team.team_id,category:a.data.visiting_team.categories[r].categories.concat(a.data.visiting_team.categories[r].rival_categories),background_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.visiting_team.categories[r].info_thumbnails.images.background_default_categories[l],player_action:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.visiting_team.categories[r].info_thumbnails.images.background_default_categories[l],team_logo:"https://az755631.vo.msecnd.net/teams-150/"+a.data.visiting_team.team_id+".png",team_name:"Away",color:a.data.visiting_team.categories[r].info_thumbnails.colors.background_color,colorfont:a.data.visiting_team.categories[r].info_thumbnails.colors.font_color,player_name:a.data.visiting_team.categories[r].category_name,total:a.data.visiting_team.categories[r].total,background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+a.data.visiting_team.team_id+"_"+a.data.season_id+"_r1.jpg"},e.push(t)}}if(this.type===6){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(6,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",seasonname:"",score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===7){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(7,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",seasonname:"",score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===8){const o=this.getBestPlaysUrl({season:s.season,player:s.player,category:s.category});if(this.getIsSameScenario(8,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,player_id:a.data.player_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+a.data.best_plays[r].info_thumbnails.player_logo,hometeamacronym:a.data.best_plays[r].home_team_acronym,visitingteamacronym:a.data.best_plays[r].away_team_acronym,seasonname:"",score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===9){const o=this.getBestPlaysUrl({season:s.season,player:s.player,category:s.category});if(this.getIsSameScenario(9,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,player_id:a.data.player_id,game_id:a.data.best_plays[r].game_id,has_mxm:a.data.best_plays[r].has_mxm,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:"",scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+a.data.best_plays[r].info_thumbnails.player_logo,score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)}if(this.type===10){const o="https://ws8d8ye2ii.execute-api.us-west-2.amazonaws.com/prod/v4/seasonsByTeam/"+s.team;if(this.getIsSameScenario(10,o))return;const r=await i.get(o);for(let l=0;l<r.data.seasons[s.season].games.length;l++){const d=Math.floor(Math.random()*r.data.seasons[s.season].games[l].info_thumbnails.images.background_default_games.length);t={photo_profile:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].visiting_team+".png",team_logo:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].home_team+".png",player_name:r.data.seasons[s.season].games[l].home_team_acronym+" "+r.data.seasons[s.season].games[l].home_team_score+" : "+r.data.seasons[s.season].games[l].visiting_team_score+" "+r.data.seasons[s.season].games[l].visiting_team_acronym,team_id:r.data.seasons[s.season].games[l].game_id,team_id_b:r.data.seasons[s.season].games[l].home_team,season_id:r.data.seasons[s.season].games[l].season_id,name:"",category:0,game_id:r.data.seasons[s.season].games[l].game_id,has_mxm:r.data.seasons[s.season].games[l].has_mxm,seasonname:r.data.seasons[s.season].name,match:r.data.seasons[s.season].games[l].matchday_name.replace("Matchday","Jor"),score:r.data.seasons[s.season].games[l].home_team_score+" : "+r.data.seasons[s.season].games[l].visiting_team_score,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data.seasons[s.season].games[l].info_thumbnails.images.background_default_games[d],backgroundhome:r.data.seasons[s.season].games[l].info_thumbnails.home_colors.background_color,backgroundaway:r.data.seasons[s.season].games[l].info_thumbnails.away_colors.background_color,colorfont_home:r.data.best_plays[l].info_thumbnails.home_colors.font_color,colorfont_away:r.data.best_plays[l].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games[l].visiting_team+".png",total:r.data.seasons[s.season].games[l].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+r.data.seasons[s.season].games[l].home_team+"_"+r.data.seasons[s.season].games[l].season_id+"_r1.jpg"},e.push(t)}}if(this.type===11){const o="https://uof4tt5l46.execute-api.us-west-2.amazonaws.com/prod/v3/playerInfo/"+s.season+"/"+s.player;if(this.getIsSameScenario(11,o))return;const r=await i.get(o);for(let l=0;l<r.data.seasons[s.season].games_played.length;l++)t={has_mxm:r.data.seasons[s.season].games_played[l].has_mxm,category:0,player_id:s.player,team_id:r.data.team_id,game_id:r.data.seasons[s.season].games_played[l].game_id,position_id:r.data.position_id,color:r.data.info_thumbnails.colors.background_color,photo_profile:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data.info_thumbnails.images.player_in_action[0],team_logo:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games_played[l].home_team+".png",player_name:r.data.seasons[s.season].games_played[l].home_team_acronym+" "+r.data.seasons[s.season].games_played[l].home_team_score+" : "+r.data.seasons[s.season].games_played[l].visiting_team_score+" "+r.data.seasons[s.season].games_played[l].visiting_team_acronym,team_id_b:r.data.seasons[s.season].games_played[l].home_team,season_id:r.data.seasons[s.season].games_played[l].season_id,name:r.data.seasons[s.season].games_played[l].player_name,seasonname:r.data.seasons[s.season].name,match:r.data.seasons[s.season].games_played[l].matchday_name.replace("Matchday","Jor"),scorehome:r.data.seasons[s.season].games_played[l].home_team_score,scoreaway:r.data.seasons[s.season].games_played[l].visiting_team_score,hometeamacronym:r.data.seasons[s.season].games_played[l].home_team_acronym,visitingteamacronym:r.data.seasons[s.season].games_played[l].visiting_team_acronym,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data.info_thumbnails.images.background_player_in_action[0],backgroundhome:r.data.seasons[s.season].games_played[l].info_thumbnails.home_colors.background_color,backgroundaway:r.data.seasons[s.season].games_played[l].info_thumbnails.away_colors.background_color,colorfont_home:r.data.seasons[s.season].games_played[l].info_thumbnails.home_colors.font_color,colorfont_away:r.data.seasons[s.season].games_played[l].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games_played[l].home_team+".png",logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data.seasons[s.season].games_played[l].visiting_team+".png",total:r.data.seasons[s.season].games_played[l].matchday_abbreviation.replace("M","Jor "),background_card:"https://az755631.vo.msecnd.net/golstats2-teams/"+r.data.seasons[s.season].games_played[l].home_team+"_"+r.data.seasons[s.season].games_played[l].season_id+"_r1.jpg"},e.push(t)}if(this.type===12){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(12,o))return;const r=await i.get(o);for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1]},e.push(t)}if(this.type===13){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(13,o))return;const r=await i.get(o);for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1]},e.push(t)}if(this.type===14&&(e=[],s.season)){if(this.lastseason!==s.season){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(14,o))return;const r=await i.get(o);this.flagGames=[],this.arrayMatchdays=[];for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)r.data[l].best_plays[d].score[0]==0&&r.data[l].best_plays[d].score[1]==0||(t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,plays_status:r.data[l].best_plays[d].plays_status,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,date_time:new Date(r.data[l].best_plays[d].date_time_utc).valueOf(),colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1],matchday_id:r.data[l].best_plays[d].matchday_id},this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]?this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id)):(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]=[],this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id))));e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((l,d)=>d.date_time-l.date_time):[]}else e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((o,r)=>r.date_time-o.date_time):[];this.lastseason=s.season}if(this.type===15&&(e=[],s.season)){if(this.lastseason!==s.season){const o=this.getBestPlaysUrl({season:s.season,category:s.category});if(this.getIsSameScenario(15,o))return;const r=await i.get(o);this.flagGames=[],this.arrayMatchdays=[];for(let l=0;l<r.data.length;l++)for(let d=0;d<r.data[l].best_plays.length;d++)r.data[l].best_plays[d].score[0]==0&&r.data[l].best_plays[d].score[1]==0||r.data[l].best_plays[d].home_team!=s.team&&r.data[l].best_plays[d].visiting_team!=s.team||(t={has_mxm:r.data[l].best_plays[d].has_mxm,category:r.data[l].best_plays[d].categories,game_id:r.data[l].best_plays[d].game_id,plays_status:r.data[l].best_plays[d].plays_status,season_id:r.data[l].season_id,backgroundhome:r.data[l].best_plays[d].info_thumbnails.home_colors.background_color,backgroundaway:r.data[l].best_plays[d].info_thumbnails.away_colors.background_color,colorfont_home:r.data[l].best_plays[d].info_thumbnails.home_colors.font_color,date_time:new Date(r.data[l].best_plays[d].date_time_utc).valueOf(),colorfont_away:r.data[l].best_plays[d].info_thumbnails.away_colors.font_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+r.data[l].best_plays[d].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+r.data[l].best_plays[d].info_thumbnails.images.background_default_categories[0],match:"",scorehome:r.data[l].best_plays[d].score[0],scoreaway:r.data[l].best_plays[d].score[1],seasonname:"",photo_profile:"https://az755631.vo.msecnd.net/players-profile/"+r.data[l].best_plays[d].info_thumbnails.player_logo,score:r.data[l].best_plays[d].score[0]+" : "+r.data[l].best_plays[d].score[1],matchday_id:r.data[l].best_plays[d].matchday_id},this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]?this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id)):(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id]=[],this.flagGames.includes(t.game_id)||(this.arrayMatchdays[r.data[l].best_plays[d].matchday_id].push(t),this.flagGames.push(t.game_id))));e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((l,d)=>d.date_time-l.date_time):[]}else e=this.arrayMatchdays[this.matchdayView]?this.arrayMatchdays[this.matchdayView].sort((o,r)=>r.date_time-o.date_time):[];this.lastseason=s.season}if(this.type===16){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(16,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)this.viewType==2&&a.data.best_plays[r].home_team==s.team&&(t={has_mxm:a.data.best_plays[r].has_mxm,category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==1&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==3&&a.data.best_plays[r].visiting_team==s.team&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t))}if(this.type===17){const o=this.getBestPlaysUrl({season:s.season,team:s.team,category:s.category});if(this.getIsSameScenario(17,o))return;a=await i.get(o);for(let r=0;r<a.data.best_plays.length;r++)this.viewType==2&&a.data.best_plays[r].home_team==s.team&&(t={has_mxm:a.data.best_plays[r].has_mxm,category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==1&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t)),this.viewType==3&&a.data.best_plays[r].visiting_team==s.team&&(t={category:a.data.best_plays[r].categories,team_id:a.data.team_id,game_id:a.data.best_plays[r].game_id,season_id:a.data.season_id,scorehome:a.data.best_plays[r].score[0],scoreaway:a.data.best_plays[r].score[1],backgroundhome:a.data.best_plays[r].info_thumbnails.home_colors.background_color,colorfont_home:a.data.best_plays[r].info_thumbnails.home_colors.font_color,colorfont_away:a.data.best_plays[r].info_thumbnails.away_colors.font_color,backgroundaway:a.data.best_plays[r].info_thumbnails.away_colors.background_color,logohome:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.home_team_logo,logoaway:"https://az755631.vo.msecnd.net/teams-150/"+a.data.best_plays[r].info_thumbnails.away_team_logo,background:"https://golstatsimages.blob.core.windows.net/images-library/"+a.data.best_plays[r].info_thumbnails.images.background_default_categories[0],match:a.data.best_plays[r].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"),seasonname:a.data.best_plays[r].season_name.replace("Clausura","CL ").replace("Apertura","AP "),score:a.data.best_plays[r].score[0]+" : "+a.data.best_plays[r].score[1]},e.push(t))}this.printData=e}},obtenerNombreCompletoFecha(s){if(s){const e=new Date(s),t=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"][e.getUTCDay()],a=e.getUTCDate(),i=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"][e.getUTCMonth()];return`${t} ${a} de ${i}`}else return""}},async created(){}},ef=()=>{n.useCssVars(s=>({"4f699db7":s.backgroundColor}))},tf=Wr.setup;Wr.setup=tf?(s,e)=>(ef(),tf(s,e)):ef;function XB(s,e,t,a,i,o){const r=n.resolveComponent("GSCThumbnailSummaryPlayer"),l=n.resolveComponent("GSCThumbnailCategoryTeam"),d=n.resolveComponent("GSCThumbnailCategoryTeamAwayLive"),c=n.resolveComponent("GSCSlider"),h=n.resolveComponent("GSCThumbnailCategory"),u=n.resolveComponent("GSCThumbnailCategoryTeamAway"),f=n.resolveComponent("GSCThumbnailHighlightGamePlayer"),p=n.resolveComponent("GSCThumbnailHighlightGameHistoric");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(s.$style.ptg),ref:"ptgDiv"},[n.createElementVNode("div",{class:n.normalizeClass(o.ptgtitleClass)},n.toDisplayString(t.title),3),t.receiveData?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t.information.length>0?(n.openBlock(),n.createBlock(c,{key:0,backgroundColor:t.backgroundColor,pxScroll:t.pxScroll,arrows:t.arrows,arrowsScrollHide:t.arrowsScrollHide,arrowsHideOnNoScroll:t.arrowsHideOnNoScroll,arrowsColor:t.arrowsColor,arrowsHeight:t.arrowsWidth,arrowsWidth:t.arrowsWidth,arrowsPadding:t.arrowsPadding,arrowsMargin:t.arrowsMargin,arrowsRadius:t.arrowsRadius,arrowsBorder:t.arrowsBorder,arrowsBackground:t.arrowsBackground,arrowsContainerBgL:t.arrowsContainerBgL,arrowsContainerBgR:t.arrowsContainerBgR,scrollColor:t.scrollColor,arrowsPosition:t.arrowsPosition,height:t.height},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.information,(m,g)=>(n.openBlock(),n.createElementBlock("div",{key:g,class:n.normalizeClass(o.pgtcontainercardClass),style:n.normalizeStyle(g==0?"margin-left: 0px !important; color: white;":"")},[t.type==3e3?(n.openBlock(),n.createBlock(r,{key:0,type:"player","color-background-home":m.colorbackgroundhome,"color-background-away":m.colorbackgroundaway,"name-player":m.nameplayer,"type-img":0,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),background:m.background,"name-home-team":m.namehometeam,"name-away-team":m.nameawayteam,"name-category":"RESUMEN","logo-away":m.logoaway,"logo-home":m.logohome,"color-font":m.colorfont,"score-home":m.scorehome,"photo-profile":m.photoprofile,"score-away":m.logoaway,"type-style":"summary"},null,8,["color-background-home","color-background-away","name-player","onOnclickPlayVideos","background","name-home-team","name-away-team","logo-away","logo-home","color-font","score-home","photo-profile","score-away"])):n.createCommentVNode("",!0),t.type==4e3?(n.openBlock(),n.createBlock(l,{key:1,type:"team","show-videos":t.showVideos,"name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-home":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["show-videos","name-team","color-background-home","logo-home","onOnclickPlayVideos","background","name-category"])):n.createCommentVNode("",!0),t.type==5e3?(n.openBlock(),n.createBlock(d,{key:2,type:"team","name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-away":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["name-team","color-background-away","logo-home","onOnclickPlayVideos","background","name-category"])):n.createCommentVNode("",!0)],6))),128))]),_:1},8,["backgroundColor","pxScroll","arrows","arrowsScrollHide","arrowsHideOnNoScroll","arrowsColor","arrowsHeight","arrowsWidth","arrowsPadding","arrowsMargin","arrowsRadius","arrowsBorder","arrowsBackground","arrowsContainerBgL","arrowsContainerBgR","scrollColor","arrowsPosition","height"])):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[i.printData.length>0?(n.openBlock(),n.createBlock(c,{key:0,backgroundColor:t.backgroundColor,pxScroll:t.pxScroll,arrows:t.arrows,arrowsScrollHide:t.arrowsScrollHide,arrowsHideOnNoScroll:t.arrowsHideOnNoScroll,arrowsColor:t.arrowsColor,arrowsHeight:t.arrowsWidth,arrowsWidth:t.arrowsWidth,arrowsPadding:t.arrowsPadding,arrowsMargin:t.arrowsMargin,arrowsRadius:t.arrowsRadius,arrowsBorder:t.arrowsBorder,arrowsBackground:t.arrowsBackground,arrowsContainerBgL:t.arrowsContainerBgL,arrowsContainerBgR:t.arrowsContainerBgR,scrollColor:t.scrollColor,arrowsPosition:t.arrowsPosition,height:t.height},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.printData,(m,g)=>(n.openBlock(),n.createElementBlock("div",{key:g,class:n.normalizeClass(o.pgtcontainercardClass),style:n.normalizeStyle(g==0?"margin-left: 0px !important; color: white;":"")},[t.type==2?(n.openBlock(),n.createBlock(h,{key:0,"color-background-home":m.color,"name-player":t.data.player_name,"type-img":"0",background:m.background_action,"name-category":m.player_name,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),"photo-profile":m.player_action},null,8,["color-background-home","name-player","background","name-category","logo-home","onOnclickPlayVideos","photo-profile"])):t.type==1?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[m.total>0?(n.openBlock(),n.createBlock(l,{key:0,type:"team","show-videos":t.showVideos,"name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-home":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["show-videos","name-team","color-background-home","logo-home","onOnclickPlayVideos","background","name-category"])):n.createCommentVNode("",!0)],64)):t.type==4?(n.openBlock(),n.createBlock(l,{key:2,type:"team","show-videos":t.showVideos,"name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-home":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["show-videos","name-team","color-background-home","logo-home","onOnclickPlayVideos","background","name-category"])):t.type==5?(n.openBlock(),n.createBlock(u,{key:3,type:"team","name-team":m.team_name!=null?m.team_name:"","type-style":"category","color-background-away":m.color,"logo-home":m.team_logo,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3}),background:m.player_action,"name-category":m.player_name},null,8,["name-team","color-background-away","logo-home","onOnclickPlayVideos","background","name-category"])):t.type==0?(n.openBlock(),n.createBlock(f,{key:4,items:m,type:2,"name-category":"TODAS SUS JUGADAS","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2,isAllPlays:!0}),background:m.background,date:m.date,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname2},null,8,["items","color-background-home","color-background-away","color-font-home","color-font-away","logo-home","logo-away","onOnclickPlayVideos","background","date","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==6?(n.openBlock(),n.createBlock(p,{key:5,items:m,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,background:m.background,"title-category":"GOLES","show-videos":t.showVideos,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3,categories:i.goalCategories}),matchday:m.match,"season-name":m.seasonname,score:m.score},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","background","show-videos","onOnclickPlayVideos","matchday","season-name","score"])):t.type==7||t.type==16?(n.openBlock(),n.createBlock(p,{key:6,items:m,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,background:m.background,"show-videos":t.showVideos,"title-category":"RESUMEN",onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:3,categories:i.resumeCategories}),matchday:m.match,"season-name":m.seasonname,score:m.score},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","background","show-videos","onOnclickPlayVideos","matchday","season-name","score"])):t.type==8?(n.openBlock(),n.createBlock(f,{key:7,items:m,type:2,"name-category":"RESUMEN","color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-font-home","color-font-away","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==9?(n.openBlock(),n.createBlock(f,{key:8,items:m,type:2,"name-category":"RESUMEN","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),"logo-away":m.logoaway,background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","onOnclickPlayVideos","logo-away","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==10?(n.openBlock(),n.createBlock(p,{key:9,items:m,"color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1}),background:m.background,"title-category":"RESUMEN",matchday:m.match,"season-name":m.seasonname,score:m.score},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","matchday","season-name","score"])):t.type==11?(n.openBlock(),n.createBlock(f,{key:10,items:m,type:2,"name-category":"RESUMEN","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","background","name-home-team","name-away-team","matchday","color-font-home","color-font-away","onOnclickPlayVideos","score-home","photo-profile","score-away","season-name"])):t.type==12?(n.openBlock(),n.createBlock(f,{key:11,items:m,type:2,"name-category":"RESUMEN","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,"color-font-home":m.colorfont_home,"color-font-away":m.colorfont_away,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","color-font-home","color-font-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==13?(n.openBlock(),n.createBlock(f,{key:12,items:m,type:2,"name-category":"GOLES","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1,categories:i.goalCategories}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):t.type==14||t.type==15||t.type==17?(n.openBlock(),n.createBlock(f,{key:13,items:m,type:2,"show-videos":t.showVideos,"play-status":m.plays_status?m.plays_status:0,"name-category":"GOLES","color-background-home":m.backgroundhome,"color-background-away":m.backgroundaway,"logo-home":m.logohome,"logo-away":m.logoaway,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:1,categories:i.goalCategories}),background:m.background,"name-home-team":m.hometeamacronym,"name-away-team":m.visitingteamacronym,matchday:m.match,"score-home":m.scorehome,showimg:!1,"photo-profile":m.photo_profile,"score-away":m.scoreaway,"season-name":m.seasonname},null,8,["items","show-videos","play-status","color-background-home","color-background-away","logo-home","logo-away","onOnclickPlayVideos","background","name-home-team","name-away-team","matchday","score-home","photo-profile","score-away","season-name"])):(n.openBlock(),n.createBlock(r,{key:14,type:"player","color-background-home":m.colorbackgroundhome,"color-background-away":m.colorbackgroundaway,"name-player":m.nameplayer,"type-img":0,onOnclickPlayVideos:y=>o.onclickPlayVideos({data:m,type:2}),background:m.background,"name-home-team":m.namehometeam,"name-away-team":m.nameawayteam,"name-category":"RESUMEN","logo-away":m.logoaway,"logo-home":m.logohome,"color-font":m.colorfont,"score-home":m.scorehome,"photo-profile":m.photoprofile,"score-away":m.logoaway,"type-style":"summary"},null,8,["color-background-home","color-background-away","name-player","onOnclickPlayVideos","background","name-home-team","name-away-team","logo-away","logo-home","color-font","score-home","photo-profile","score-away"]))],6))),128))]),_:1},8,["backgroundColor","pxScroll","arrows","arrowsScrollHide","arrowsHideOnNoScroll","arrowsColor","arrowsHeight","arrowsWidth","arrowsPadding","arrowsMargin","arrowsRadius","arrowsBorder","arrowsBackground","arrowsContainerBgL","arrowsContainerBgR","scrollColor","arrowsPosition","height"])):n.createCommentVNode("",!0)],64))],2)}const ZB={name:"DiscoverVideos",components:{GscSwitchComponent:bo,GSCPlayerTeamGame:os(Wr,[["render",XB],["__cssModules",{$style:JB}],["__scopeId","data-v-762f089f"]]),MatchDayPicker:Wh},props:{componentWidth:{type:Number,default:768},myTournament:{type:Number,default:1},videoType:{type:Number,default:1},isplayer:{type:Boolean,default:!1},team:{type:Number,default:0},player:{type:Number,default:0},user:{type:Object,default:()=>{}},nextRivalTeam:{type:Object,default:()=>{}},tournamentSelected:{type:Object,default:()=>({id:0})},defaultMatchDayKey:{type:String,default:""},isLeagueSelected:{type:Boolean,default:!1},isFull:{type:Boolean,default:!1},tournamentScheduleKeys:{type:Array,default:()=>[]},seasonSelected:{type:Object,default:()=>{}},defaultMediaPlayerSeason:{type:Number,default:0}},watch:{seasonSelected:{immediate:!0,deep:!1,async handler(){this.getDataGoals()}},tournamentSelected:{immediate:!0,deep:!1,async handler(s){this.myTournament!==s.id?this.currentTabMoreVideos="Goles":this.currentTabMoreVideos="Goles"}},closestRound(s){this.selectedRoundKeyIndex=this.tournamentScheduleKeys.findIndex(e=>e===s),this.selectedRound=s},activeDropGoals:{handler(s){s&&(this.matchDayPickerKey+=1)},immediate:!0}},data(){return{token:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE",url:"https://wlduw4woy3.execute-api.us-east-2.amazonaws.com/prod/best-plays/seasons/",showVideos:!0,currentTabMoreVideos:"Resumen",currentMobileTab:"Descubre videos",mobileClass:!1,activeDropGoals:!1,matchdayActive:{},resumeCategory:1000001,goalsCategory:1255e3,resumeType:1,goalsType:2,matchDayPickerKey:0}},mounted(){this.mobileClass=window.innerWidth<768,window.addEventListener("resize",this.handleResize)},methods:{async getDataGoals(){try{this.seasonSelected&&this.seasonSelected.id&&(await Ae.create({headers:{Authorization:`${this.token}`}}).get(this.url+this.seasonSelected.id+"/categories/"+this.goalsCategory),this.showVideos=!0)}catch{this.showVideos=!1}},onChangeMatchDay(s){this.matchdayActive=s,this.$emit("change-match-day",s)},handleResize(){this.mobileClass=window.innerWidth<768},onOpenMedia(s,e){e&&(s.type=0),this.$emit("openmedia",s)},onClickOpenMedia(){let t=1,a=[],i=[],o=0,r=this.defaultMediaPlayerSeason||this.user.season,l=[],d=[12,55,"35_r","54_r"],c=[12,35,10,27,607,61,519,98,101,109,112,121,122,127,128,135,136,141,142,161,170,179,702,730,466,217,211,232,235,239,242,282,284,289,291,296,485,486,487,488,14,15,257],h=[55,324,323,608,39,774,802,52,53,40,54];!this.user.is_generic&&this.tournamentSelected.id===this.user.tournament?(r=this.seasonSelected.id,this.user.is_goalkeeper?(a=[this.user.player],l=h,t=2):this.user.is_player?(i=[this.user.player],l=c,t=2):(o=this.user.team,l=d,t=3)):(l=d,t=1);const u={type:0,seasonId:r,tournaments:[],isFeaturedPlayers:!1,mainSectionType:1,playListType:t,gameIds:null,playerIds:i,goalkeeperIds:a,categoryIds:l,teamId:o,matchResult:[1,2,3],categorySingleName:"",avoidCategorySingleName:!1,currentPlayIndex:0,playData:null,lastClashedGameId:null,tournamentsLastClashes:null,advancedFilter:{playListTitle:""},objectPlaySync:null};this.$emit("openmedia",u)}}},QB={key:0,class:"discover-videos",ref:"discoverVideosRef"},e3={class:"title-and-button"},t3={class:"calendar-container"};function s3(s,e,t,a,i,o){const r=n.resolveComponent("GscSwitchComponent"),l=n.resolveComponent("MatchDayPicker"),d=n.resolveComponent("GSCPlayerTeamGame");return i.showVideos?(n.openBlock(),n.createElementBlock("div",QB,[n.createElementVNode("div",e3,[n.createElementVNode("div",{class:n.normalizeClass(t.componentWidth>900?"menu-container":"menu-container-movil")},[n.createElementVNode("div",{class:n.normalizeClass(t.componentWidth>768?"title-value":t.componentWidth>600?"title-value-tablet":t.componentWidth>400?"title-value-mobile":"title-value-mobilesm")}," Videos ",2)],2),!t.user.is_generic&&t.myTournament===t.tournamentSelected.id?(n.openBlock(),n.createBlock(r,{key:0,buttons:["Goles","Resumen","Proximo rival"],onInput:e[0]||(e[0]=c=>i.currentTabMoreVideos=c),background:"trasparent",height:"24px",width:t.componentWidth>768?"140px":t.componentWidth>600?"120px":t.componentWidth>400?"100px":"81px","font-size":t.componentWidth>768?"14px":t.componentWidth>600||t.componentWidth>400?"12px":"9.1px","font-family":"Poppins-Light",backgroundOptionActive:"transparent",borderWidth:"2px",type:2,arrow:!1,selectedOption:i.currentTabMoreVideos,onOpenmedia:o.onOpenMedia},null,8,["width","font-size","selectedOption","onOpenmedia"])):n.createCommentVNode("",!0)]),i.currentTabMoreVideos=="Goles"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("div",t3,[n.createCommentVNode("",!0),(n.openBlock(),n.createBlock(l,{height:"48px","margin-top":"5px","disable-matchdays":!0,"match-days":t.tournamentScheduleKeys,"is-landing-mode":!1,"items-to-show":t.componentWidth>600?17:t.componentWidth>400?13:9,"items-to-scroll":t.componentWidth>600?8:t.componentWidth>400?12:9,"default-match-day-key":t.defaultMatchDayKey,key:i.matchDayPickerKey,onChangeMatchDay:o.onChangeMatchDay},null,8,["match-days","items-to-show","items-to-scroll","default-match-day-key","onChangeMatchDay"]))]),n.createVNode(d,{style:{"margin-top":"-30px"},type:14,data:{season:t.seasonSelected.id,category:i.goalsCategory},width:"100%","matchday-view":Object.keys(i.matchdayActive).length>0?i.matchdayActive.matchDayId:1,backgroundColor:"transparent",title:"",onOpenmedia:o.onOpenMedia},null,8,["data","matchday-view","onOpenmedia"])],64)):n.createCommentVNode("",!0),i.currentTabMoreVideos=="Resumen"?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t.isplayer?(n.openBlock(),n.createBlock(d,{key:1,type:8,title:"",style:{"margin-top":"-30px"},backgroundColor:"transparent",data:{season:t.seasonSelected.id,player:t.player,category:1000001},width:"100%",onOpenmedia:e[3]||(e[3]=c=>o.onOpenMedia(c,!0))},null,8,["data"])):(n.openBlock(),n.createBlock(d,{key:0,type:7,title:"",style:{"margin-top":"-30px"},backgroundColor:"transparent",data:{season:t.seasonSelected.id,team:t.team,category:i.resumeCategory},width:"100%",onOpenmedia:e[2]||(e[2]=c=>o.onOpenMedia(c,!0))},null,8,["data"]))],64)):n.createCommentVNode("",!0),i.currentTabMoreVideos=="Proximo rival"?(n.openBlock(),n.createBlock(d,{key:2,type:7,style:{"margin-top":"-30px"},title:"",backgroundColor:"transparent",data:{season:t.seasonSelected.id,team:t.nextRivalTeam.id,category:i.resumeCategory},width:"100%",onOpenmedia:e[4]||(e[4]=c=>o.onOpenMedia(c,!0))},null,8,["data"])):n.createCommentVNode("",!0)],512)):n.createCommentVNode("",!0)}const a3=Ye(ZB,[["render",s3],["__scopeId","data-v-b485c3f6"]]),n3=["playId","league","season","gameId","playerName","refereeName","stadiumName","finalScore","scoreAtMomentOfPlay","gameDate","homeTeamName","homeTeamLogo","awayTeamName","awayTeamLogo","categoryId","categoryName","startTime","endTime","minuteOfPlay","momentOfPlay","videoUrl"];let Kr=null;function i3(){return Kr||(Kr=n3.reduce((s,e,t)=>(s[e]=t,s),{})),Kr}function o3(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var sf={exports:{}};(function(s,e){(function(t){var a=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,o=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(d,c,h){if(h=h||{},d=d.trim(),c=c.trim(),!c){if(!h.alwaysNormalize)return d;var u=l.parseURL(d);if(!u)throw new Error("Error trying to parse base URL.");return u.path=l.normalizePath(u.path),l.buildURLFromParts(u)}var f=l.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return h.alwaysNormalize?(f.path=l.normalizePath(f.path),l.buildURLFromParts(f)):c;var p=l.parseURL(d);if(!p)throw new Error("Error trying to parse base URL.");if(!p.netLoc&&p.path&&p.path[0]!=="/"){var m=i.exec(p.path);p.netLoc=m[1],p.path=m[2]}p.netLoc&&!p.path&&(p.path="/");var g={scheme:p.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(g.netLoc=p.netLoc,f.path[0]!=="/"))if(!f.path)g.path=p.path,f.params||(g.params=p.params,f.query||(g.query=p.query));else{var y=p.path,b=y.substring(0,y.lastIndexOf("/")+1)+f.path;g.path=l.normalizePath(b)}return g.path===null&&(g.path=h.alwaysNormalize?l.normalizePath(f.path):f.path),l.buildURLFromParts(g)},parseURL:function(d){var c=a.exec(d);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(d){for(d=d.split("").reverse().join("").replace(o,"");d.length!==(d=d.replace(r,"")).length;);return d.split("").reverse().join("")},buildURLFromParts:function(d){return d.scheme+d.netLoc+d.path+d.params+d.query+d.fragment}};s.exports=l})()})(sf);var qr=sf.exports;function af(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);e&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),t.push.apply(t,a)}return t}function Ze(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?af(Object(t),!0).forEach(function(a){c3(s,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):af(Object(t)).forEach(function(a){Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(t,a))})}return s}function r3(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var a=t.call(s,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function l3(s){var e=r3(s,"string");return typeof e=="symbol"?e:String(e)}function c3(s,e,t){return e=l3(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function je(){return je=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=t[a])}return s},je.apply(this,arguments)}const ae=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},d3=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=h3},h3=Number.MAX_SAFE_INTEGER||9007199254740991;let _=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s}({}),pe=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),N=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const ks=function(){},Yr={trace:ks,debug:ks,log:ks,warn:ks,info:ks,error:ks};let ka=Yr;function u3(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):ks}function m3(s,...e){e.forEach(function(t){ka[t]=s[t]?s[t].bind(s):u3(t)})}function f3(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){m3(s,"debug","log","info","warn","error");try{ka.log(`Debug logs enabled for "${e}" in hls.js version 1.5.16`)}catch{ka=Yr}}else ka=Yr}const A=ka,p3=/^(\d+)x(\d+)$/,nf=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Me{constructor(e){typeof e=="string"&&(e=Me.parseAttrList(e)),je(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const a=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)a[i]=parseInt(t.slice(i*2,i*2+2),16);return a}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const a=this[e];return a?parseFloat(a):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=p3.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const a={},i='"';for(nf.lastIndex=0;(t=nf.exec(e))!==null;){let o=t[2];o.indexOf(i)===0&&o.lastIndexOf(i)===o.length-1&&(o=o.slice(1,-1));const r=t[1].trim();a[r]=o}return a}}function g3(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function y3(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class of{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const a=t.attr;for(const i in a)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==a[i]){A.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=je(new Me({}),a,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const a=new Date(this.attr["END-DATE"]);ae(a.getTime())&&(this._endDate=a)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(ae(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&ae(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Gn{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Be={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class rf{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Be.AUDIO]:null,[Be.VIDEO]:null,[Be.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const a=e.split("@",2);let i;a.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(a[1]),this._byteRange=[i,parseInt(a[0])+i]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=qr.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Jr extends rf{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Gn,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const a=Object.keys(this.levelkeys);if(a.length===1)return this._decryptdata=this.levelkeys[a[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!ae(this.programDateTime))return null;const e=ae(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),a=t.length;if(a>1||a===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,a,i,o,r=!1){const{elementaryStreams:l}=this,d=l[e];if(!d){l[e]={startPTS:t,endPTS:a,startDTS:i,endDTS:o,partial:r};return}d.startPTS=Math.min(d.startPTS,t),d.endPTS=Math.max(d.endPTS,a),d.startDTS=Math.min(d.startDTS,i),d.endDTS=Math.max(d.endDTS,o)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Be.AUDIO]=null,e[Be.VIDEO]=null,e[Be.AUDIOVIDEO]=null}}class b3 extends rf{constructor(e,t,a,i,o){super(a),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Gn,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const r=e.enumeratedString("BYTERANGE");r&&this.setByteRange(r,o),o&&(this.fragOffset=o.fragOffset+o.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const S3=10;class _3{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,a=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!a||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&a>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?ae(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||S3}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Xr(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function w3(s){const e=Zr(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function k3(s){const e=function(a,i,o){const r=a[i];a[i]=a[o],a[o]=r};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function E3(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const a=e[1].split(";"),i=a[a.length-1].split(",");if(i.length===2){const o=i[0]==="base64",r=i[1];o?(a.splice(-1,1),t=Xr(r)):t=w3(r)}}return t}function Zr(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const Vs=typeof self<"u"?self:void 0;var De={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},mt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function lf(s){switch(s){case mt.FAIRPLAY:return De.FAIRPLAY;case mt.PLAYREADY:return De.PLAYREADY;case mt.WIDEVINE:return De.WIDEVINE;case mt.CLEARKEY:return De.CLEARKEY}}var Ea={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",FAIRPLAY:"94ce86fb07ff4f43adb893d2fa968ca2",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function cf(s){if(s===Ea.WIDEVINE)return De.WIDEVINE;if(s===Ea.PLAYREADY)return De.PLAYREADY;if(s===Ea.CENC||s===Ea.CLEARKEY)return De.CLEARKEY}function df(s){switch(s){case De.FAIRPLAY:return mt.FAIRPLAY;case De.PLAYREADY:return mt.PLAYREADY;case De.WIDEVINE:return mt.WIDEVINE;case De.CLEARKEY:return mt.CLEARKEY}}function Qr(s){const{drmSystems:e,widevineLicenseUrl:t}=s,a=e?[De.FAIRPLAY,De.WIDEVINE,De.PLAYREADY,De.CLEARKEY].filter(i=>!!e[i]):[];return!a[De.WIDEVINE]&&t&&a.push(De.WIDEVINE),a}const hf=function(s){return Vs!=null&&(s=Vs.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function T3(s,e,t,a){let i;switch(s){case De.FAIRPLAY:i=["cenc","sinf"];break;case De.WIDEVINE:case De.PLAYREADY:i=["cenc"];break;case De.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return C3(i,e,t,a)}function C3(s,e,t,a){return[{initDataTypes:s,persistentState:a.persistentState||"optional",distinctiveIdentifier:a.distinctiveIdentifier||"optional",sessionTypes:a.sessionTypes||[a.sessionType||"temporary"],audioCapabilities:e.map(o=>({contentType:`audio/mp4; codecs="${o}"`,robustness:a.audioRobustness||"",encryptionScheme:a.audioEncryptionScheme||null})),videoCapabilities:t.map(o=>({contentType:`video/mp4; codecs="${o}"`,robustness:a.videoRobustness||"",encryptionScheme:a.videoEncryptionScheme||null}))}]}function Es(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const el=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,uf=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,Ta=(s,e)=>{const t=e;let a=0;for(;el(s,e);){a+=10;const i=jn(s,e+6);a+=i,uf(s,e+10)&&(a+=10),e+=a}if(a>0)return s.subarray(t,t+a)},jn=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},x3=(s,e)=>el(s,e)&&jn(s,e+6)+10<=s.length-e,tl=s=>{const e=ff(s);for(let t=0;t<e.length;t++){const a=e[t];if(mf(a))return B3(a)}},mf=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",v3=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=jn(s,4),a=10;return{type:e,size:t,data:s.subarray(a,a+t)}},ff=s=>{let e=0;const t=[];for(;el(s,e);){const a=jn(s,e+6);e+=10;const i=e+a;for(;e+8<i;){const o=v3(s.subarray(e)),r=A3(o);r&&t.push(r),e+=o.size+10}uf(s,e)&&(e+=10)}return t},A3=s=>s.type==="PRIV"?L3(s):s.type[0]==="W"?R3(s):I3(s),L3=s=>{if(s.size<2)return;const e=zt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},I3=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const a=zt(s.data.subarray(t),!0);t+=a.length+1;const i=zt(s.data.subarray(t));return{key:s.type,info:a,data:i}}const e=zt(s.data.subarray(1));return{key:s.type,data:e}},R3=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const a=zt(s.data.subarray(t),!0);t+=a.length+1;const i=zt(s.data.subarray(t));return{key:s.type,info:a,data:i}}const e=zt(s.data);return{key:s.type,data:e}},B3=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let a=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return a/=45,t&&(a+=4772185884e-2),Math.round(a)}},zt=(s,e=!1)=>{const t=N3();if(t){const c=t.decode(s);if(e){const h=c.indexOf("\0");return h!==-1?c.substring(0,h):c}return c.replace(/\0/g,"")}const a=s.length;let i,o,r,l="",d=0;for(;d<a;){if(i=s[d++],i===0&&e)return l;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(i);break;case 12:case 13:o=s[d++],l+=String.fromCharCode((i&31)<<6|o&63);break;case 14:o=s[d++],r=s[d++],l+=String.fromCharCode((i&15)<<12|(o&63)<<6|(r&63)<<0);break}}return l};let sl;function N3(){if(!navigator.userAgent.includes("PlayStation 4"))return!sl&&typeof self.TextDecoder<"u"&&(sl=new self.TextDecoder("utf-8")),sl}const Ut={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let a=s[t].toString(16);a.length<2&&(a="0"+a),e+=a}return e}},Hn=Math.pow(2,32)-1,D3=[].push,pf={video:1,audio:2,id3:3,text:4};function qe(s){return String.fromCharCode.apply(null,s)}function gf(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function re(s,e){const t=bf(s,e);return t<0?4294967296+t:t}function yf(s,e){let t=re(s,e);return t*=Math.pow(2,32),t+=re(s,e+4),t}function bf(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function al(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function P3(s){const e=s.byteLength;for(let t=0;t<e;){const a=re(s,t);if(a>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=a>1?t+a:e}return!1}function Se(s,e){const t=[];if(!e.length)return t;const a=s.byteLength;for(let i=0;i<a;){const o=re(s,i),r=qe(s.subarray(i+4,i+8)),l=o>1?i+o:a;if(r===e[0])if(e.length===1)t.push(s.subarray(i+8,l));else{const d=Se(s.subarray(i+8,l),e.slice(1));d.length&&D3.apply(t,d)}i=l}return t}function O3(s){const e=[],t=s[0];let a=8;const i=re(s,a);a+=4;let o=0,r=0;t===0?(o=re(s,a),r=re(s,a+4),a+=8):(o=yf(s,a),r=yf(s,a+8),a+=16),a+=2;let l=s.length+r;const d=gf(s,a);a+=2;for(let c=0;c<d;c++){let h=a;const u=re(s,h);h+=4;const f=u&2147483647;if((u&2147483648)>>>31===1)return A.warn("SIDX has hierarchical references (not supported)"),null;const m=re(s,h);h+=4,e.push({referenceSize:f,subsegmentDuration:m,info:{duration:m/i,start:l,end:l+f-1}}),l+=f,h+=4,a=h}return{earliestPresentationTime:o,timescale:i,version:t,referencesCount:d,references:e}}function Sf(s){const e=[],t=Se(s,["moov","trak"]);for(let i=0;i<t.length;i++){const o=t[i],r=Se(o,["tkhd"])[0];if(r){let l=r[0];const d=re(r,l===0?12:20),c=Se(o,["mdia","mdhd"])[0];if(c){l=c[0];const h=re(c,l===0?12:20),u=Se(o,["mdia","hdlr"])[0];if(u){const f=qe(u.subarray(8,12)),p={soun:Be.AUDIO,vide:Be.VIDEO}[f];if(p){const m=Se(o,["mdia","minf","stbl","stsd"])[0],g=F3(m);e[d]={timescale:h,type:p},e[p]=Ze({timescale:h,id:d},g)}}}}}return Se(s,["moov","mvex","trex"]).forEach(i=>{const o=re(i,4),r=e[o];r&&(r.default={duration:re(i,12),flags:re(i,20)})}),e}function F3(s){const e=s.subarray(8),t=e.subarray(86),a=qe(e.subarray(4,8));let i=a;const o=a==="enca"||a==="encv";if(o){const l=Se(e,[a])[0].subarray(a==="enca"?28:78);Se(l,["sinf"]).forEach(c=>{const h=Se(c,["schm"])[0];if(h){const u=qe(h.subarray(4,8));if(u==="cbcs"||u==="cenc"){const f=Se(c,["frma"])[0];f&&(i=qe(f))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const r=Se(t,["avcC"])[0];i+="."+Wn(r[1])+Wn(r[2])+Wn(r[3]);break}case"mp4a":{const r=Se(e,[a])[0],l=Se(r.subarray(28),["esds"])[0];if(l&&l.length>12){let d=4;if(l[d++]!==3)break;d=nl(l,d),d+=2;const c=l[d++];if(c&128&&(d+=2),c&64&&(d+=l[d++]),l[d++]!==4)break;d=nl(l,d);const h=l[d++];if(h===64)i+="."+Wn(h);else break;if(d+=12,l[d++]!==5)break;d=nl(l,d);const u=l[d++];let f=(u&248)>>3;f===31&&(f+=1+((u&7)<<3)+((l[d]&224)>>5)),i+="."+f}break}case"hvc1":case"hev1":{const r=Se(t,["hvcC"])[0],l=r[1],d=["","A","B","C"][l>>6],c=l&31,h=re(r,2),u=(l&32)>>5?"H":"L",f=r[12],p=r.subarray(6,12);i+="."+d+c,i+="."+h.toString(16).toUpperCase(),i+="."+u+f;let m="";for(let g=p.length;g--;){const y=p[g];(y||m)&&(m="."+y.toString(16).toUpperCase()+m)}i+=m;break}case"dvh1":case"dvhe":{const r=Se(t,["dvcC"])[0],l=r[2]>>1&127,d=r[2]<<5&32|r[3]>>3&31;i+="."+Gt(l)+"."+Gt(d);break}case"vp09":{const r=Se(t,["vpcC"])[0],l=r[4],d=r[5],c=r[6]>>4&15;i+="."+Gt(l)+"."+Gt(d)+"."+Gt(c);break}case"av01":{const r=Se(t,["av1C"])[0],l=r[1]>>>5,d=r[1]&31,c=r[2]>>>7?"H":"M",h=(r[2]&64)>>6,u=(r[2]&32)>>5,f=l===2&&h?u?12:10:h?10:8,p=(r[2]&16)>>4,m=(r[2]&8)>>3,g=(r[2]&4)>>2,y=r[2]&3;i+="."+l+"."+Gt(d)+c+"."+Gt(f)+"."+p+"."+m+g+y+"."+Gt(1)+"."+Gt(1)+"."+Gt(1)+"."+0;break}}return{codec:i,encrypted:o}}function nl(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function Wn(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function Gt(s){return(s<10?"0":"")+s}function M3(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&Se(s,["moov","trak"]).forEach(i=>{const r=Se(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let l=Se(r,["enca"]);const d=l.length>0;d||(l=Se(r,["encv"])),l.forEach(c=>{const h=d?c.subarray(28):c.subarray(78);Se(h,["sinf"]).forEach(f=>{const p=_f(f);if(p){const m=p.subarray(8,24);m.some(g=>g!==0)||(A.log(`[eme] Patching keyId in 'enc${d?"a":"v"}>sinf>>tenc' box: ${Ut.hexDump(m)} -> ${Ut.hexDump(t)}`),p.set(t,8))}})})}),s}function _f(s){const e=Se(s,["schm"])[0];if(e){const t=qe(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Se(s,["schi","tenc"])[0]}return null}function V3(s,e){return Se(e,["moof","traf"]).reduce((t,a)=>{const i=Se(a,["tfdt"])[0],o=i[0],r=Se(a,["tfhd"]).reduce((l,d)=>{const c=re(d,4),h=s[c];if(h){let u=re(i,4);if(o===1){if(u===Hn)return A.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),l;u*=Hn+1,u+=re(i,8)}const f=h.timescale||9e4,p=u/f;if(ae(p)&&(l===null||p<l))return p}return l},null);return r!==null&&ae(r)&&(t===null||r<t)?r:t},null)}function $3(s,e){let t=0,a=0,i=0;const o=Se(s,["moof","traf"]);for(let r=0;r<o.length;r++){const l=o[r],d=Se(l,["tfhd"])[0],c=re(d,4),h=e[c];if(!h)continue;const u=h.default,f=re(d,0)|(u==null?void 0:u.flags);let p=u==null?void 0:u.duration;f&8&&(f&2?p=re(d,12):p=re(d,8));const m=h.timescale||9e4,g=Se(l,["trun"]);for(let y=0;y<g.length;y++){if(t=z3(g[y]),!t&&p){const b=re(g[y],4);t=p*b}h.type===Be.VIDEO?a+=t/m:h.type===Be.AUDIO&&(i+=t/m)}}if(a===0&&i===0){let r=1/0,l=0,d=0;const c=Se(s,["sidx"]);for(let h=0;h<c.length;h++){const u=O3(c[h]);if(u!=null&&u.references){r=Math.min(r,u.earliestPresentationTime/u.timescale);const f=u.references.reduce((p,m)=>p+m.info.duration||0,0);l=Math.max(l,f+u.earliestPresentationTime/u.timescale),d=l-r}}if(d&&ae(d))return d}return a||i}function z3(s){const e=re(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let a=0;const i=re(s,4);for(let o=0;o<i;o++){if(e&256){const r=re(s,t);a+=r,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return a}function U3(s,e,t){Se(e,["moof","traf"]).forEach(a=>{Se(a,["tfhd"]).forEach(i=>{const o=re(i,4),r=s[o];if(!r)return;const l=r.timescale||9e4;Se(a,["tfdt"]).forEach(d=>{const c=d[0],h=t*l;if(h){let u=re(d,4);if(c===0)u-=h,u=Math.max(u,0),al(d,4,u);else{u*=Math.pow(2,32),u+=re(d,8),u-=h,u=Math.max(u,0);const f=Math.floor(u/(Hn+1)),p=Math.floor(u%(Hn+1));al(d,4,f),al(d,8,p)}}})})})}function G3(s){const e={valid:null,remainder:null},t=Se(s,["moof"]);if(t.length<2)return e.remainder=s,e;const a=t[t.length-1];return e.valid=Es(s,0,a.byteOffset-8),e.remainder=Es(s,a.byteOffset-8),e}function _t(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function wf(s,e){const t=[],a=e.samples,i=e.timescale,o=e.id;let r=!1;return Se(a,["moof"]).map(d=>{const c=d.byteOffset-8;Se(d,["traf"]).map(u=>{const f=Se(u,["tfdt"]).map(p=>{const m=p[0];let g=re(p,4);return m===1&&(g*=Math.pow(2,32),g+=re(p,8)),g/i})[0];return f!==void 0&&(s=f),Se(u,["tfhd"]).map(p=>{const m=re(p,4),g=re(p,0)&16777215,y=(g&1)!==0,b=(g&2)!==0,S=(g&8)!==0;let w=0;const x=(g&16)!==0;let T=0;const v=(g&32)!==0;let E=8;m===o&&(y&&(E+=8),b&&(E+=4),S&&(w=re(p,E),E+=4),x&&(T=re(p,E),E+=4),v&&(E+=4),e.type==="video"&&(r=j3(e.codec)),Se(u,["trun"]).map(B=>{const I=B[0],R=re(B,0)&16777215,M=(R&1)!==0;let K=0;const H=(R&4)!==0,se=(R&256)!==0;let oe=0;const ne=(R&512)!==0;let ce=0;const de=(R&1024)!==0,Z=(R&2048)!==0;let q=0;const he=re(B,4);let J=8;M&&(K=re(B,J),J+=4),H&&(J+=4);let X=K+c;for(let ue=0;ue<he;ue++){if(se?(oe=re(B,J),J+=4):oe=w,ne?(ce=re(B,J),J+=4):ce=T,de&&(J+=4),Z&&(I===0?q=re(B,J):q=bf(B,J),J+=4),e.type===Be.VIDEO){let be=0;for(;be<ce;){const xe=re(a,X);if(X+=4,H3(r,a[X])){const te=a.subarray(X,X+xe);kf(te,r?2:1,s+q/i,t)}X+=xe,be+=xe+4}}s+=oe/i}}))})})}),t}function j3(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function H3(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function kf(s,e,t,a){const i=Ef(s);let o=0;o+=e;let r=0,l=0,d=0;for(;o<i.length;){r=0;do{if(o>=i.length)break;d=i[o++],r+=d}while(d===255);l=0;do{if(o>=i.length)break;d=i[o++],l+=d}while(d===255);const c=i.length-o;let h=o;if(l<c)o+=l;else if(l>c){A.error(`Malformed SEI payload. ${l} is too small, only ${c} bytes left to parse.`);break}if(r===4){if(i[h++]===181){const f=gf(i,h);if(h+=2,f===49){const p=re(i,h);if(h+=4,p===1195456820){const m=i[h++];if(m===3){const g=i[h++],y=31&g,b=64&g,S=b?2+y*3:0,w=new Uint8Array(S);if(b){w[0]=g;for(let x=1;x<S;x++)w[x]=i[h++]}a.push({type:m,payloadType:r,pts:t,bytes:w})}}}}}else if(r===5&&l>16){const u=[];for(let m=0;m<16;m++){const g=i[h++].toString(16);u.push(g.length==1?"0"+g:g),(m===3||m===5||m===7||m===9)&&u.push("-")}const f=l-16,p=new Uint8Array(f);for(let m=0;m<f;m++)p[m]=i[h++];a.push({payloadType:r,pts:t,uuid:u.join(""),userData:zt(p),userDataBytes:p})}}}function Ef(s){const e=s.byteLength,t=[];let a=1;for(;a<e-2;)s[a]===0&&s[a+1]===0&&s[a+2]===3?(t.push(a+2),a+=2):a++;if(t.length===0)return s;const i=e-t.length,o=new Uint8Array(i);let r=0;for(a=0;a<i;r++,a++)r===t[0]&&(r++,t.shift()),o[a]=s[r];return o}function W3(s){const e=s[0];let t="",a="",i=0,o=0,r=0,l=0,d=0,c=0;if(e===0){for(;qe(s.subarray(c,c+1))!=="\0";)t+=qe(s.subarray(c,c+1)),c+=1;for(t+=qe(s.subarray(c,c+1)),c+=1;qe(s.subarray(c,c+1))!=="\0";)a+=qe(s.subarray(c,c+1)),c+=1;a+=qe(s.subarray(c,c+1)),c+=1,i=re(s,12),o=re(s,16),l=re(s,20),d=re(s,24),c=28}else if(e===1){c+=4,i=re(s,c),c+=4;const u=re(s,c);c+=4;const f=re(s,c);for(c+=4,r=2**32*u+f,d3(r)||(r=Number.MAX_SAFE_INTEGER,A.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=re(s,c),c+=4,d=re(s,c),c+=4;qe(s.subarray(c,c+1))!=="\0";)t+=qe(s.subarray(c,c+1)),c+=1;for(t+=qe(s.subarray(c,c+1)),c+=1;qe(s.subarray(c,c+1))!=="\0";)a+=qe(s.subarray(c,c+1)),c+=1;a+=qe(s.subarray(c,c+1)),c+=1}const h=s.subarray(c,s.byteLength);return{schemeIdUri:t,value:a,timeScale:i,presentationTime:r,presentationTimeDelta:o,eventDuration:l,id:d,payload:h}}function K3(s,...e){const t=e.length;let a=8,i=t;for(;i--;)a+=e[i].byteLength;const o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=a&255,o.set(s,4),i=0,a=8;i<t;i++)o.set(e[i],a),a+=e[i].byteLength;return o}function q3(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let a,i;a=0,i=new Uint8Array;let o;a>0?(o=new Uint8Array(4),e.length>0&&new DataView(o.buffer).setUint32(0,e.length,!1)):o=new Uint8Array;const r=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),K3([112,115,115,104],new Uint8Array([a,0,0,0]),s,o,i,r,t||new Uint8Array)}function Y3(s){const e=[];if(s instanceof ArrayBuffer){const t=s.byteLength;let a=0;for(;a+32<t;){const i=new DataView(s,a),o=J3(i);e.push(o),a+=o.size}}return e}function J3(s){const e=s.getUint32(0),t=s.byteOffset,a=s.byteLength;if(a<e)return{offset:t,size:a};if(s.getUint32(4)!==1886614376)return{offset:t,size:e};const o=s.getUint32(8)>>>24;if(o!==0&&o!==1)return{offset:t,size:e};const r=s.buffer,l=Ut.hexDump(new Uint8Array(r,t+12,16)),d=s.getUint32(28);let c=null,h=null;if(o===0){if(e-32<d||d<22)return{offset:t,size:e};h=new Uint8Array(r,t+32,d)}else if(o===1){if(!d||a<t+32+d*16+16)return{offset:t,size:e};c=[];for(let u=0;u<d;u++)c.push(new Uint8Array(r,t+32+u*16,16))}return{version:o,systemId:l,kids:c,data:h,offset:t,size:e}}let Kn={};class Ca{static clearKeyUriToKeyIdMap(){Kn={}}constructor(e,t,a,i=[1],o=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=a,this.keyFormatVersions=i,this.iv=o,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case mt.FAIRPLAY:case mt.WIDEVINE:case mt.PLAYREADY:case mt.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&A.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const a=X3(e);return new Ca(this.method,this.uri,"identity",this.keyFormatVersions,a)}const t=E3(this.uri);if(t)switch(this.keyFormat){case mt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case mt.PLAYREADY:{const a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=q3(a,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),o=String.fromCharCode.apply(null,Array.from(i)),r=o.substring(o.indexOf("<"),o.length),c=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(c){const h=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(h){const u=Xr(h).subarray(0,16);k3(u),this.keyId=u}}break}default:{let a=t.subarray(0,16);if(a.length!==16){const i=new Uint8Array(16);i.set(a,16-a.length),a=i}this.keyId=a;break}}if(!this.keyId||this.keyId.byteLength!==16){let a=Kn[this.uri];if(!a){const i=Object.keys(Kn).length%Number.MAX_SAFE_INTEGER;a=new Uint8Array(16),new DataView(a.buffer,12,4).setUint32(0,i),Kn[this.uri]=a}this.keyId=a}return this}}function X3(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const Tf=/\{\$([a-zA-Z0-9-_]+)\}/g;function Cf(s){return Tf.test(s)}function ft(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let a=t.length;a--;){const i=t[a],o=e[i];o&&(e[i]=il(s,o))}}function il(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(Tf,a=>{const i=a.substring(2,a.length-1),o=t==null?void 0:t[i];return o===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),a):o})}return e}function xf(s,e,t){let a=s.variableList;a||(s.variableList=a={});let i,o;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(i))o=r.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(r){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else i=e.NAME,o=e.VALUE;i in a?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):a[i]=o||""}function Z3(s,e,t){const a=e.IMPORT;if(t&&a in t){let i=s.variableList;i||(s.variableList=i={}),i[a]=t[a]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${a}"`))}function Ts(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Q3(s){return typeof self<"u"&&s===self.ManagedMediaSource}const qn={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function e6(s,e){const t=qn[e];return!!t&&!!t[s.slice(0,4)]}function ol(s,e,t=!0){return!s.split(",").some(a=>!vf(a,e,t))}function vf(s,e,t=!0){var a;const i=Ts(t);return(a=i==null?void 0:i.isTypeSupported(xa(s,e)))!=null?a:!1}function xa(s,e){return`${e}/mp4;codecs="${s}"`}function Af(s){if(s){const e=s.substring(0,4);return qn.video[e]}return 2}function Yn(s){return s.split(",").reduce((e,t)=>{const a=qn.video[t];return a?(a*2+e)/(e?3:2):(qn.audio[t]+e)/(e?2:1)},0)}const rl={};function t6(s,e=!0){if(rl[s])return rl[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let a=0;a<t.length;a++)if(vf(t[a],"audio",e))return rl[s]=t[a],t[a];return s}const s6=/flac|opus/i;function Jn(s,e=!0){return s.replace(s6,t=>t6(t.toLowerCase(),e))}function Lf(s,e){return s&&s!=="mp4a"?s:e&&e.split(",")[0]}function a6(s){const e=s.split(",");for(let t=0;t<e.length;t++){const a=e[t].split(".");if(a.length>2){let i=a.shift()+".";i+=parseInt(a.shift()).toString(16),i+=("000"+parseInt(a.shift()).toString(16)).slice(-4),e[t]=i}}return e.join(",")}const If=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Rf=/#EXT-X-MEDIA:(.*)/g,n6=/^#EXT(?:INF|-X-TARGETDURATION):/m,Bf=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),i6=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class jt{static findGroup(e,t){for(let a=0;a<e.length;a++){const i=e[a];if(i.id===t)return i}}static resolve(e,t){return qr.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return n6.test(e)}static parseMasterPlaylist(e,t){const a=Cf(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:a},o=[];If.lastIndex=0;let r;for(;(r=If.exec(e))!=null;)if(r[1]){var l;const c=new Me(r[1]);ft(i,c,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const h=il(i,r[2]),u={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:jt.resolve(h,t)},f=c.decimalResolution("RESOLUTION");f&&(u.width=f.width,u.height=f.height),o6(c.CODECS,u),(l=u.unknownCodecs)!=null&&l.length||o.push(u),i.levels.push(u)}else if(r[3]){const c=r[3],h=r[4];switch(c){case"SESSION-DATA":{const u=new Me(h);ft(i,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const f=u["DATA-ID"];f&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[f]=u);break}case"SESSION-KEY":{const u=Nf(h,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):A.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const u=new Me(h);ft(i,u,["NAME","VALUE","QUERYPARAM"]),xf(i,u,t)}break}case"CONTENT-STEERING":{const u=new Me(h);ft(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:jt.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=Df(h);break}}}const d=o.length>0&&o.length<i.levels.length;return i.levels=d?o:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,a){let i;const o={},r=a.levels,l={AUDIO:r.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:r.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let d=0;for(Rf.lastIndex=0;(i=Rf.exec(e))!==null;){const c=new Me(i[1]),h=c.TYPE;if(h){const u=l[h],f=o[h]||[];o[h]=f,ft(a,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const p=c.LANGUAGE,m=c["ASSOC-LANGUAGE"],g=c.CHANNELS,y=c.CHARACTERISTICS,b=c["INSTREAM-ID"],S={attrs:c,bitrate:0,id:d++,groupId:c["GROUP-ID"]||"",name:c.NAME||p||"",type:h,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:p,url:c.URI?jt.resolve(c.URI,t):""};if(m&&(S.assocLang=m),g&&(S.channels=g),y&&(S.characteristics=y),b&&(S.instreamId=b),u!=null&&u.length){const w=jt.findGroup(u,S.groupId)||u[0];Pf(S,w,"audioCodec"),Pf(S,w,"textCodec")}f.push(S)}}return o}static parseLevelPlaylist(e,t,a,i,o,r){const l=new _3(t),d=l.fragments;let c=null,h=0,u=0,f=0,p=0,m=null,g=new Jr(i,t),y,b,S,w=-1,x=!1,T=null;for(Bf.lastIndex=0,l.m3u8=e,l.hasVariableRefs=Cf(e);(y=Bf.exec(e))!==null;){x&&(x=!1,g=new Jr(i,t),g.start=f,g.sn=h,g.cc=p,g.level=a,c&&(g.initSegment=c,g.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,T&&(g.setByteRange(T),T=null)));const I=y[1];if(I){g.duration=parseFloat(I);const R=(" "+y[2]).slice(1);g.title=R||null,g.tagList.push(R?["INF",I,R]:["INF",I])}else if(y[3]){if(ae(g.duration)){g.start=f,S&&Mf(g,S,l),g.sn=h,g.level=a,g.cc=p,d.push(g);const R=(" "+y[3]).slice(1);g.relurl=il(l,R),Of(g,m),m=g,f+=g.duration,h++,u=0,x=!0}}else if(y[4]){const R=(" "+y[4]).slice(1);m?g.setByteRange(R,m):g.setByteRange(R)}else if(y[5])g.rawProgramDateTime=(" "+y[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),w===-1&&(w=d.length);else{if(y=y[0].match(i6),!y){A.warn("No matches on slow regex match for level playlist!");continue}for(b=1;b<y.length&&!(typeof y[b]<"u");b++);const R=(" "+y[b]).slice(1),M=(" "+y[b+1]).slice(1),K=y[b+2]?(" "+y[b+2]).slice(1):"";switch(R){case"PLAYLIST-TYPE":l.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":h=l.startSN=parseInt(M);break;case"SKIP":{const H=new Me(M);ft(l,H,["RECENTLY-REMOVED-DATERANGES"]);const se=H.decimalInteger("SKIPPED-SEGMENTS");if(ae(se)){l.skippedSegments=se;for(let ne=se;ne--;)d.unshift(null);h+=se}const oe=H.enumeratedString("RECENTLY-REMOVED-DATERANGES");oe&&(l.recentlyRemovedDateranges=oe.split(" "));break}case"TARGETDURATION":l.targetduration=Math.max(parseInt(M),1);break;case"VERSION":l.version=parseInt(M);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"#":(M||K)&&g.tagList.push(K?[M,K]:[M]);break;case"DISCONTINUITY":p++,g.tagList.push(["DIS"]);break;case"GAP":g.gap=!0,g.tagList.push([R]);break;case"BITRATE":g.tagList.push([R,M]);break;case"DATERANGE":{const H=new Me(M);ft(l,H,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),ft(l,H,H.clientAttrs);const se=new of(H,l.dateRanges[H.ID]);se.isValid||l.skippedSegments?l.dateRanges[se.id]=se:A.warn(`Ignoring invalid DATERANGE tag: "${M}"`),g.tagList.push(["EXT-X-DATERANGE",M]);break}case"DEFINE":{{const H=new Me(M);ft(l,H,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in H?Z3(l,H,r):xf(l,H,t)}break}case"DISCONTINUITY-SEQUENCE":p=parseInt(M);break;case"KEY":{const H=Nf(M,t,l);if(H.isSupported()){if(H.method==="NONE"){S=void 0;break}S||(S={}),S[H.keyFormat]&&(S=je({},S)),S[H.keyFormat]=H}else A.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${M}"`);break}case"START":l.startTimeOffset=Df(M);break;case"MAP":{const H=new Me(M);if(ft(l,H,["BYTERANGE","URI"]),g.duration){const se=new Jr(i,t);Ff(se,H,a,S),c=se,g.initSegment=c,c.rawProgramDateTime&&!g.rawProgramDateTime&&(g.rawProgramDateTime=c.rawProgramDateTime)}else{const se=g.byteRangeEndOffset;if(se){const oe=g.byteRangeStartOffset;T=`${se-oe}@${oe}`}else T=null;Ff(g,H,a,S),c=g,x=!0}break}case"SERVER-CONTROL":{const H=new Me(M);l.canBlockReload=H.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=H.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&H.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=H.optionalFloat("PART-HOLD-BACK",0),l.holdBack=H.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const H=new Me(M);l.partTarget=H.decimalFloatingPoint("PART-TARGET");break}case"PART":{let H=l.partList;H||(H=l.partList=[]);const se=u>0?H[H.length-1]:void 0,oe=u++,ne=new Me(M);ft(l,ne,["BYTERANGE","URI"]);const ce=new b3(ne,g,t,oe,se);H.push(ce),g.duration+=ce.duration;break}case"PRELOAD-HINT":{const H=new Me(M);ft(l,H,["URI"]),l.preloadHint=H;break}case"RENDITION-REPORT":{const H=new Me(M);ft(l,H,["URI"]),l.renditionReports=l.renditionReports||[],l.renditionReports.push(H);break}default:A.warn(`line parsed but not handled: ${y}`);break}}}m&&!m.relurl?(d.pop(),f-=m.duration,l.partList&&(l.fragmentHint=m)):l.partList&&(Of(g,m),g.cc=p,l.fragmentHint=g,S&&Mf(g,S,l));const v=d.length,E=d[0],B=d[v-1];if(f+=l.skippedSegments*l.targetduration,f>0&&v&&B){l.averagetargetduration=f/v;const I=B.sn;l.endSN=I!=="initSegment"?I:0,l.live||(B.endList=!0),E&&(l.startCC=E.cc)}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(f+=l.fragmentHint.duration),l.totalduration=f,l.endCC=p,w>0&&r6(d,w),l}}function Nf(s,e,t){var a,i;const o=new Me(s);ft(t,o,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const r=(a=o.METHOD)!=null?a:"",l=o.URI,d=o.hexadecimalInteger("IV"),c=o.KEYFORMATVERSIONS,h=(i=o.KEYFORMAT)!=null?i:"identity";l&&o.IV&&!d&&A.error(`Invalid IV: ${o.IV}`);const u=l?jt.resolve(l,e):"",f=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Ca(r,u,h,f,d)}function Df(s){const t=new Me(s).decimalFloatingPoint("TIME-OFFSET");return ae(t)?t:null}function o6(s,e){let t=(s||"").split(/[ ,]+/).filter(a=>a);["video","audio","text"].forEach(a=>{const i=t.filter(o=>e6(o,a));i.length&&(e[`${a}Codec`]=i.join(","),t=t.filter(o=>i.indexOf(o)===-1))}),e.unknownCodecs=t}function Pf(s,e,t){const a=e[t];a&&(s[t]=a)}function r6(s,e){let t=s[e];for(let a=e;a--;){const i=s[a];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function Of(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),ae(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function Ff(s,e,t,a){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",a&&(s.levelkeys=a),s.initSegment=null}function Mf(s,e,t){s.levelkeys=e;const{encryptedFragments:a}=t;(!a.length||a[a.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&a.push(s)}var ve={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},le={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Vf(s){const{type:e}=s;switch(e){case ve.AUDIO_TRACK:return le.AUDIO;case ve.SUBTITLE_TRACK:return le.SUBTITLE;default:return le.MAIN}}function ll(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class l6{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,a=t.pLoader,i=t.loader,o=a||i,r=new o(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:a}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ve.MANIFEST,url:a,deliveryDirectives:null})}onLevelLoading(e,t){const{id:a,level:i,pathwayId:o,url:r,deliveryDirectives:l}=t;this.load({id:a,level:i,pathwayId:o,responseType:"text",type:ve.LEVEL,url:r,deliveryDirectives:l})}onAudioTrackLoading(e,t){const{id:a,groupId:i,url:o,deliveryDirectives:r}=t;this.load({id:a,groupId:i,level:null,responseType:"text",type:ve.AUDIO_TRACK,url:o,deliveryDirectives:r})}onSubtitleTrackLoading(e,t){const{id:a,groupId:i,url:o,deliveryDirectives:r}=t;this.load({id:a,groupId:i,level:null,responseType:"text",type:ve.SUBTITLE_TRACK,url:o,deliveryDirectives:r})}load(e){var t;const a=this.hls.config;let i=this.getInternalLoader(e);if(i){const c=i.context;if(c&&c.url===e.url&&c.level===e.level){A.trace("[playlist-loader]: playlist request ongoing");return}A.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let o;if(e.type===ve.MANIFEST?o=a.manifestLoadPolicy.default:o=je({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),ae((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===ve.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===ve.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===ve.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const h=c.partTarget,u=c.targetduration;if(h&&u){const f=Math.max(h*3,u*.8)*1e3;o=je({},o,{maxTimeToFirstByteMs:Math.min(f,o.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(f,o.maxTimeToFirstByteMs)})}}}const r=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},d={onSuccess:(c,h,u,f)=>{const p=this.getInternalLoader(u);this.resetInternalLoader(u.type);const m=c.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(c,u,new Error("no EXTM3U delimiter"),f||null,h);return}h.parsing.start=performance.now(),jt.isMediaPlaylist(m)?this.handleTrackOrLevelPlaylist(c,h,u,f||null,p):this.handleMasterPlaylist(c,h,u,f)},onError:(c,h,u,f)=>{this.handleNetworkError(h,u,!1,c,f)},onTimeout:(c,h,u)=>{this.handleNetworkError(h,u,!0,void 0,c)}};i.load(e,l,d)}handleMasterPlaylist(e,t,a,i){const o=this.hls,r=e.data,l=ll(e,a),d=jt.parseMasterPlaylist(r,l);if(d.playlistParsingError){this.handleManifestParsingError(e,a,d.playlistParsingError,i,t);return}const{contentSteering:c,levels:h,sessionData:u,sessionKeys:f,startTimeOffset:p,variableList:m}=d;this.variableList=m;const{AUDIO:g=[],SUBTITLES:y,"CLOSED-CAPTIONS":b}=jt.parseMasterPlaylistMedia(r,l,d);g.length&&!g.some(w=>!w.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(A.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Me({}),bitrate:0,url:""})),o.trigger(_.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:y,captions:b,contentSteering:c,url:l,stats:t,networkDetails:i,sessionData:u,sessionKeys:f,startTimeOffset:p,variableList:m})}handleTrackOrLevelPlaylist(e,t,a,i,o){const r=this.hls,{id:l,level:d,type:c}=a,h=ll(e,a),u=0,f=ae(d)?d:ae(l)?l:0,p=Vf(a),m=jt.parseLevelPlaylist(e.data,h,f,p,u,this.variableList);if(c===ve.MANIFEST){const g={attrs:new Me({}),bitrate:0,details:m,name:"",url:h};r.trigger(_.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:h,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),a.levelDetails=m,this.handlePlaylistLoaded(m,e,t,a,i,o)}handleManifestParsingError(e,t,a,i,o){this.hls.trigger(_.ERROR,{type:pe.NETWORK_ERROR,details:N.MANIFEST_PARSING_ERROR,fatal:t.type===ve.MANIFEST,url:e.url,err:a,error:a,reason:a.message,response:e,context:t,networkDetails:i,stats:o})}handleNetworkError(e,t,a=!1,i,o){let r=`A network ${a?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===ve.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ve.AUDIO_TRACK||e.type===ve.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const l=new Error(r);A.warn(`[playlist-loader]: ${r}`);let d=N.UNKNOWN,c=!1;const h=this.getInternalLoader(e);switch(e.type){case ve.MANIFEST:d=a?N.MANIFEST_LOAD_TIMEOUT:N.MANIFEST_LOAD_ERROR,c=!0;break;case ve.LEVEL:d=a?N.LEVEL_LOAD_TIMEOUT:N.LEVEL_LOAD_ERROR,c=!1;break;case ve.AUDIO_TRACK:d=a?N.AUDIO_TRACK_LOAD_TIMEOUT:N.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case ve.SUBTITLE_TRACK:d=a?N.SUBTITLE_TRACK_LOAD_TIMEOUT:N.SUBTITLE_LOAD_ERROR,c=!1;break}h&&this.resetInternalLoader(e.type);const u={type:pe.NETWORK_ERROR,details:d,fatal:c,url:e.url,loader:h,context:e,error:l,networkDetails:t,stats:o};if(i){const f=(t==null?void 0:t.url)||e.url;u.response=Ze({url:f,data:void 0},i)}this.hls.trigger(_.ERROR,u)}handlePlaylistLoaded(e,t,a,i,o,r){const l=this.hls,{type:d,level:c,id:h,groupId:u,deliveryDirectives:f}=i,p=ll(t,i),m=Vf(i),g=typeof i.level=="number"&&m===le.MAIN?c:void 0;if(!e.fragments.length){const b=new Error("No Segments found in Playlist");l.trigger(_.ERROR,{type:pe.NETWORK_ERROR,details:N.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:b,reason:b.message,response:t,context:i,level:g,parent:m,networkDetails:o,stats:a});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const y=e.playlistParsingError;if(y){l.trigger(_.ERROR,{type:pe.NETWORK_ERROR,details:N.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:y,reason:y.message,response:t,context:i,level:g,parent:m,networkDetails:o,stats:a});return}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),d){case ve.MANIFEST:case ve.LEVEL:l.trigger(_.LEVEL_LOADED,{details:e,level:g||0,id:h||0,stats:a,networkDetails:o,deliveryDirectives:f});break;case ve.AUDIO_TRACK:l.trigger(_.AUDIO_TRACK_LOADED,{details:e,id:h||0,groupId:u||"",stats:a,networkDetails:o,deliveryDirectives:f});break;case ve.SUBTITLE_TRACK:l.trigger(_.SUBTITLE_TRACK_LOADED,{details:e,id:h||0,groupId:u||"",stats:a,networkDetails:o,deliveryDirectives:f});break}}}function $f(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function zf(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(a){A.debug(`[texttrack-utils]: ${a}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,s.addCue(i)}catch(i){A.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(s.mode=t)}function $s(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function cl(s,e,t,a){const i=s.mode;if(i==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const o=d6(s.cues,e,t);for(let r=0;r<o.length;r++)(!a||a(o[r]))&&s.removeCue(o[r])}i==="disabled"&&(s.mode=i)}function c6(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let a=0,i=t;for(;a<=i;){const o=Math.floor((i+a)/2);if(e<s[o].startTime)i=o-1;else if(e>s[o].startTime&&a<t)a=o+1;else return o}return s[a].startTime-e<e-s[i].startTime?a:i}function d6(s,e,t){const a=[],i=c6(s,e);if(i>-1)for(let o=i,r=s.length;o<r;o++){const l=s[o];if(l.startTime>=e&&l.endTime<=t)a.push(l);else if(l.startTime>t)return a}return a}function Xn(s){const e=[];for(let t=0;t<s.length;t++){const a=s[t];(a.kind==="subtitles"||a.kind==="captions")&&a.label&&e.push(s[t])}return e}var Pt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const h6=.25;function dl(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Uf(s,e,t,a,i){let o=new s(e,t,"");try{o.value=a,i&&(o.type=i)}catch{o=new s(e,t,JSON.stringify(i?Ze({type:i},a):a))}return o}const Zn=(()=>{const s=dl();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function hl(s,e){return s.getTime()/1e3-e}function u6(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class m6{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&($s(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const a=e[t];if(a.kind==="metadata"&&a.label==="id3")return $f(a,this.media),a}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:i}}}=this;if(!a&&!i)return;const{samples:o}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=dl();if(r)for(let l=0;l<o.length;l++){const d=o[l].type;if(d===Pt.emsg&&!a||!i)continue;const c=ff(o[l].data);if(c){const h=o[l].pts;let u=h+o[l].duration;u>Zn&&(u=Zn),u-h<=0&&(u=h+h6);for(let p=0;p<c.length;p++){const m=c[p];if(!mf(m)){this.updateId3CueEnds(h,d);const g=Uf(r,h,u,m,d);g&&this.id3Track.addCue(g)}}}}}updateId3CueEnds(e,t){var a;const i=(a=this.id3Track)==null?void 0:a.cues;if(i)for(let o=i.length;o--;){const r=i[o];r.type===t&&r.startTime<e&&r.endTime===Zn&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:a,type:i}){const{id3Track:o,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:l,enableID3MetadataCues:d}}=r;if(o&&(l||d)){let c;i==="audio"?c=h=>h.type===Pt.audioId3&&d:i==="video"?c=h=>h.type===Pt.emsg&&l:c=h=>h.type===Pt.audioId3&&d||h.type===Pt.emsg&&l,cl(o,t,a,c)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:a,id3Track:i}=this,{dateRanges:o}=t,r=Object.keys(o);if(i){const h=Object.keys(a).filter(u=>!r.includes(u));for(let u=h.length;u--;){const f=h[u];Object.keys(a[f].cues).forEach(p=>{i.removeCue(a[f].cues[p])}),delete a[f]}}const l=t.fragments[t.fragments.length-1];if(r.length===0||!ae(l==null?void 0:l.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const d=l.programDateTime/1e3-l.start,c=dl();for(let h=0;h<r.length;h++){const u=r[h],f=o[u],p=hl(f.startDate,d),m=a[u],g=(m==null?void 0:m.cues)||{};let y=(m==null?void 0:m.durationKnown)||!1,b=Zn;const S=f.endDate;if(S)b=hl(S,d),y=!0;else if(f.endOnNext&&!y){const x=r.reduce((T,v)=>{if(v!==f.id){const E=o[v];if(E.class===f.class&&E.startDate>f.startDate&&(!T||f.startDate<T.startDate))return E}return T},null);x&&(b=hl(x.startDate,d),y=!0)}const w=Object.keys(f.attr);for(let x=0;x<w.length;x++){const T=w[x];if(!g3(T))continue;const v=g[T];if(v)y&&!m.durationKnown&&(v.endTime=b);else if(c){let E=f.attr[T];y3(T)&&(E=u6(E));const B=Uf(c,p,b,{key:T,data:E},Pt.dateRange);B&&(B.id=u,this.id3Track.addCue(B),g[T]=B)}}a[u]={cues:g,dateRange:f,durationKnown:y}}}}class f6{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:a,targetduration:i}=e,{liveSyncDuration:o,liveSyncDurationCount:r,lowLatencyMode:l}=this.config,d=this.hls.userConfig;let c=l&&a||t;(d.liveSyncDuration||d.liveSyncDurationCount||c===0)&&(c=o!==void 0?o:r*i);const h=i;return c+Math.min(this.stallCount*1,h)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,a=this.levelDetails;if(e===null||t===null||a===null)return null;const i=a.edge,o=e-t-this.edgeStalled,r=i-a.totalduration,l=i-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(r,o),l)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const a=e.buffered.length;return(a?e.buffered.end(a-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(_.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(_.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var a;t.details===N.BUFFER_STALLED_ERROR&&(this.stallCount++,(a=this.levelDetails)!=null&&a.live&&A.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const a=this.computeLatency();if(a===null)return;this._latency=a;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:o}=this.config;if(!i||o===1||!t.live)return;const r=this.targetLatency;if(r===null)return;const l=a-r,d=Math.min(this.maxLatency,r+t.targetduration);if(l<d&&l>.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,o)),u=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;e.playbackRate=Math.min(h,Math.max(1,u))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const ul=["NONE","TYPE-0","TYPE-1",null];function p6(s){return ul.indexOf(s)>-1}const Qn=["SDR","PQ","HLG"];function g6(s){return!!s&&Qn.indexOf(s)>-1}var ei={No:"",Yes:"YES",v2:"v2"};function Gf(s){const{canSkipUntil:e,canSkipDateRanges:t,age:a}=s,i=a<e/2;return e&&i?t?ei.v2:ei.Yes:ei.No}class jf{constructor(e,t,a){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=a}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class zs{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Hf(this._audioGroups,e)}hasSubtitleGroup(e){return Hf(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let a=this._audioGroups;a||(a=this._audioGroups=[]),a.indexOf(t)===-1&&a.push(t)}else if(e==="text"){let a=this._subtitleGroups;a||(a=this._subtitleGroups=[]),a.indexOf(t)===-1&&a.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Hf(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function ml(s,e){const t=e.startPTS;if(ae(t)){let a=0,i;e.sn>s.sn?(a=t-s.start,i=s):(a=s.start-t,i=e),i.duration!==a&&(i.duration=a)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function Wf(s,e,t,a,i,o){a-t<=0&&(A.warn("Fragment should have a positive duration",e),a=t+e.duration,o=i+e.duration);let l=t,d=a;const c=e.startPTS,h=e.endPTS;if(ae(c)){const y=Math.abs(c-t);ae(e.deltaPTS)?e.deltaPTS=Math.max(y,e.deltaPTS):e.deltaPTS=y,l=Math.max(t,c),t=Math.min(t,c),i=Math.min(i,e.startDTS),d=Math.min(a,h),a=Math.max(a,h),o=Math.max(o,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=a-e.start,e.startPTS=t,e.maxStartPTS=l,e.startDTS=i,e.endPTS=a,e.minEndPTS=d,e.endDTS=o;const f=e.sn;if(!s||f<s.startSN||f>s.endSN)return 0;let p;const m=f-s.startSN,g=s.fragments;for(g[m]=e,p=m;p>0;p--)ml(g[p],g[p-1]);for(p=m;p<g.length-1;p++)ml(g[p],g[p+1]);return s.fragmentHint&&ml(g[g.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,u}function y6(s,e){let t=null;const a=s.fragments;for(let d=a.length-1;d>=0;d--){const c=a[d].initSegment;if(c){t=c;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let i=0,o;if(_6(s,e,(d,c)=>{d.relurl&&(i=d.cc-c.cc),ae(d.startPTS)&&ae(d.endPTS)&&(c.start=c.startPTS=d.startPTS,c.startDTS=d.startDTS,c.maxStartPTS=d.maxStartPTS,c.endPTS=d.endPTS,c.endDTS=d.endDTS,c.minEndPTS=d.minEndPTS,c.duration=d.endPTS-d.startPTS,c.duration&&(o=c),e.PTSKnown=e.alignedSliding=!0),c.elementaryStreams=d.elementaryStreams,c.loader=d.loader,c.stats=d.stats,d.initSegment&&(c.initSegment=d.initSegment,t=d.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(c=>{var h;c&&(!c.initSegment||c.initSegment.relurl===((h=t)==null?void 0:h.relurl))&&(c.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(d=>!d),e.deltaUpdateFailed){A.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let d=e.skippedSegments;d--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=b6(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const r=e.fragments;if(i){A.warn("discontinuity sliding from playlist, take drift into account");for(let d=0;d<r.length;d++)r[d].cc+=i}e.skippedSegments&&(e.startCC=e.fragments[0].cc),S6(s.partList,e.partList,(d,c)=>{c.elementaryStreams=d.elementaryStreams,c.stats=d.stats}),o?Wf(e,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):Kf(s,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const l=e.advancedDateTime;if(e.advanced&&l){const d=e.edge;e.driftStart||(e.driftStartTime=l,e.driftStart=d),e.driftEndTime=l,e.driftEnd=d}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function b6(s,e,t){const a=je({},s);return t&&t.forEach(i=>{delete a[i]}),Object.keys(e).forEach(i=>{const o=new of(e[i].attr,a[i]);o.isValid?a[i]=o:A.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),a}function S6(s,e,t){if(s&&e){let a=0;for(let i=0,o=s.length;i<=o;i++){const r=s[i],l=e[i+a];r&&l&&r.index===l.index&&r.fragment.sn===l.fragment.sn?t(r,l):a--}}}function _6(s,e,t){const a=e.skippedSegments,i=Math.max(s.startSN,e.startSN)-e.startSN,o=(s.fragmentHint?1:0)+(a?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,r=e.startSN-s.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,d=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let c=i;c<=o;c++){const h=d[r+c];let u=l[c];a&&!u&&c<a&&(u=e.fragments[c]=h),h&&u&&t(h,u)}}function Kf(s,e){const t=e.startSN+e.skippedSegments-s.startSN,a=s.fragments;t<0||t>=a.length||fl(e,a[t].start)}function fl(s,e){if(e){const t=s.fragments;for(let a=s.skippedSegments;a<t.length;a++)t[a].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function w6(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const a=s.fragments;if(a.length&&t*4>e){const o=a[a.length-1].duration*1e3;o<t&&(t=o)}}else t/=2;return Math.round(t)}function k6(s,e,t){if(!(s!=null&&s.details))return null;const a=s.details;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function qf(s,e,t){var a;return s!=null&&s.details?Yf((a=s.details)==null?void 0:a.partList,e,t):null}function Yf(s,e,t){if(s)for(let a=s.length;a--;){const i=s[a];if(i.index===t&&i.fragment.sn===e)return i}return null}function Jf(s){s.forEach((e,t)=>{const{details:a}=e;a!=null&&a.fragments&&a.fragments.forEach(i=>{i.level=t})})}function ti(s){switch(s.details){case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_TIMEOUT:case N.LEVEL_LOAD_TIMEOUT:case N.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Xf(s,e){const t=ti(e);return s.default[`${t?"timeout":"error"}Retry`]}function pl(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function Zf(s){return Ze(Ze({},s),{errorRetry:null,timeoutRetry:null})}function si(s,e,t,a){if(!s)return!1;const i=a==null?void 0:a.code,o=e<s.maxNumRetry&&(E6(i)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,a,o):o}function E6(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Qf={search:function(s,e){let t=0,a=s.length-1,i=null,o=null;for(;t<=a;){i=(t+a)/2|0,o=s[i];const r=e(o);if(r>0)t=i+1;else if(r<0)a=i-1;else return o}return null}};function T6(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!ae(e))return null;const a=s[0].programDateTime;if(e<(a||0))return null;const i=s[s.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let o=0;o<s.length;++o){const r=s[o];if(x6(e,t,r))return r}return null}function ai(s,e,t=0,a=0,i=.005){let o=null;if(s){o=e[s.sn-e[0].sn+1]||null;const l=s.endDTS-t;l>0&&l<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(o=e[0]);if(o&&((!s||s.level===o.level)&&gl(t,a,o)===0||C6(o,s,Math.min(i,a))))return o;const r=Qf.search(e,gl.bind(null,t,a));return r&&(r!==s||!o)?r:o}function C6(s,e,t){if(e&&e.start===0&&e.level<s.level&&(e.endPTS||0)>0){const a=e.tagList.reduce((i,o)=>(o[0]==="INF"&&(i+=parseFloat(o[1])),i),t);return s.start<=a}return!1}function gl(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const a=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-a<=s?1:t.start-a>s&&t.start?-1:0}function x6(s,e,t){const a=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-a>s}function v6(s,e){return Qf.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}var it={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ot={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class A6{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=A.log.bind(A,"[info]:"),this.warn=A.warn.bind(A,"[warning]:"),this.error=A.error.bind(A,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(_.ERROR,this.onError,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.ERROR,this.onError,this),e.off(_.ERROR,this.onErrorOut,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===le.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var a,i;if(t.fatal)return;const o=this.hls,r=t.context;switch(t.details){case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case N.FRAG_PARSING_ERROR:if((a=t.frag)!=null&&a.gap){t.errorAction={action:it.DoNothing,flags:Ot.None};return}case N.FRAG_GAP:case N.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=it.SendAlternateToPenaltyBox;return}case N.LEVEL_EMPTY_ERROR:case N.LEVEL_PARSING_ERROR:{var l,d;const c=t.parent===le.MAIN?t.level:o.loadLevel;t.details===N.LEVEL_EMPTY_ERROR&&((l=t.context)!=null&&(d=l.levelDetails)!=null&&d.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:typeof(r==null?void 0:r.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.SUBTITLE_LOAD_ERROR:case N.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=o.levels[o.loadLevel];if(c&&(r.type===ve.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===ve.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.loadLevel),t.errorAction.action=it.SendAlternateToPenaltyBox,t.errorAction.flags=Ot.MoveAllAlternatesMatchingHost;return}}return;case N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=o.levels[o.loadLevel],h=c==null?void 0:c.attrs["HDCP-LEVEL"];h?t.errorAction={action:it.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}:this.keySystemError(t)}return;case N.BUFFER_ADD_CODEC_ERROR:case N.REMUX_ALLOC_ERROR:case N.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:o.loadLevel);return;case N.INTERNAL_EXCEPTION:case N.BUFFER_APPENDING_ERROR:case N.BUFFER_FULL_ERROR:case N.LEVEL_SWITCH_ERROR:case N.BUFFER_STALLED_ERROR:case N.BUFFER_SEEK_OVER_HOLE:case N.BUFFER_NUDGE_ON_STALL:t.errorAction={action:it.DoNothing,flags:Ot.None};return}t.type===pe.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const a=this.hls,i=Xf(a.config.playlistLoadPolicy,e),o=this.playlistError++;if(si(i,o,ti(e),e.response))return{action:it.RetryRequest,flags:Ot.None,retryConfig:i,retryCount:o};const l=this.getLevelSwitchAction(e,t);return i&&(l.retryConfig=i,l.retryCount=o),l}getFragRetryOrSwitchAction(e){const t=this.hls,a=this.getVariantLevelIndex(e.frag),i=t.levels[a],{fragLoadPolicy:o,keyLoadPolicy:r}=t.config,l=Xf(e.details.startsWith("key")?r:o,e),d=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(i&&(e.details!==N.FRAG_GAP&&i.fragmentError++,si(l,d,ti(e),e.response)))return{action:it.RetryRequest,flags:Ot.None,retryConfig:l,retryCount:d};const c=this.getLevelSwitchAction(e,a);return l&&(c.retryConfig=l,c.retryCount=d),c}getLevelSwitchAction(e,t){const a=this.hls;t==null&&(t=a.loadLevel);const i=this.hls.levels[t];if(i){var o,r;const c=e.details;i.loadError++,c===N.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:u,loadLevel:f,minAutoLevel:p,maxAutoLevel:m}=a;a.autoLevelEnabled||(a.loadLevel=-1);const g=(o=e.frag)==null?void 0:o.type,b=(g===le.AUDIO&&c===N.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===N.BUFFER_ADD_CODEC_ERROR||c===N.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:v})=>i.audioCodec!==v),w=e.sourceBufferName==="video"&&(c===N.BUFFER_ADD_CODEC_ERROR||c===N.BUFFER_APPEND_ERROR)&&u.some(({codecSet:v,audioCodec:E})=>i.codecSet!==v&&i.audioCodec===E),{type:x,groupId:T}=(r=e.context)!=null?r:{};for(let v=u.length;v--;){const E=(v+f)%u.length;if(E!==f&&E>=p&&E<=m&&u[E].loadError===0){var l,d;const B=u[E];if(c===N.FRAG_GAP&&g===le.MAIN&&e.frag){const I=u[E].details;if(I){const R=ai(e.frag,I.fragments,e.frag.start);if(R!=null&&R.gap)continue}}else{if(x===ve.AUDIO_TRACK&&B.hasAudioGroup(T)||x===ve.SUBTITLE_TRACK&&B.hasSubtitleGroup(T))continue;if(g===le.AUDIO&&(l=i.audioGroups)!=null&&l.some(I=>B.hasAudioGroup(I))||g===le.SUBTITLE&&(d=i.subtitleGroups)!=null&&d.some(I=>B.hasSubtitleGroup(I))||b&&i.audioCodec===B.audioCodec||!b&&i.audioCodec!==B.audioCodec||w&&i.codecSet===B.codecSet)continue}h=E;break}}if(h>-1&&a.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:it.SendAlternateToPenaltyBox,flags:Ot.None,nextAutoLevel:h}}return{action:it.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var a;switch((a=t.errorAction)==null?void 0:a.action){case it.DoNothing:break;case it.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==N.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,a=e.errorAction;if(!a)return;const{flags:i,hdcpLevel:o,nextAutoLevel:r}=a;switch(i){case Ot.None:this.switchLevel(e,r);break;case Ot.MoveAllAlternatesMatchingHDCP:o&&(t.maxHdcpLevel=ul[ul.indexOf(o)-1],a.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}a.resolved||this.switchLevel(e,r)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class yl{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=A.log.bind(A,`${t}:`),this.warn=A.warn.bind(A,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,a){const i=t==null?void 0:t.renditionReports;if(i){let o=-1;for(let r=0;r<i.length;r++){const l=i[r];let d;try{d=new self.URL(l.URI,t.url).href}catch(c){A.warn(`Could not construct new URL for Rendition Report: ${c}`),d=l.URI||""}if(d===e){o=r;break}else d===e.substring(0,d.length)&&(o=r)}if(o!==-1){const r=i[o],l=parseInt(r["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let d=parseInt(r["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const h=Math.min(t.age-t.partTarget,t.targetduration);d>=0&&h>t.partTarget&&(d+=1)}const c=a&&Gf(a);return new jf(l,d>=0?d:void 0,c)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,a){const{details:i,stats:o}=t,r=self.performance.now(),l=o.loading.first?Math.max(0,r-o.loading.first):0;if(i.advancedDateTime=Date.now()-l,i.live||a!=null&&a.live){if(i.reloaded(a),a&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),a&&i.fragments.length>0&&y6(a,i),!this.canLoad||!i.live)return;let d,c,h;if(i.canBlockReload&&i.endSN&&i.advanced){const y=this.hls.config.lowLatencyMode,b=i.lastPartSn,S=i.endSN,w=i.lastPartIndex,x=w!==-1,T=b===S,v=y?0:w;x?(c=T?S+1:b,h=T?v:w+1):c=S+1;const E=i.age,B=E+i.ageHeader;let I=Math.min(B-i.partTarget,i.targetduration*1.5);if(I>0){if(a&&I>a.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${a.tuneInGoal} to: ${I} with playlist age: ${i.age}`),I=0;else{const R=Math.floor(I/i.targetduration);if(c+=R,h!==void 0){const M=Math.round(I%i.targetduration/i.partTarget);h+=M}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${E.toFixed(2)}s goal: ${I} skip sn ${R} to part ${h}`)}i.tuneInGoal=I}if(d=this.getDeliveryDirectives(i,t.deliveryDirectives,c,h),y||!T){this.loadPlaylist(d);return}}else(i.canBlockReload||i.canSkipUntil)&&(d=this.getDeliveryDirectives(i,t.deliveryDirectives,c,h));const u=this.hls.mainForwardBufferInfo,f=u?u.end-u.len:0,p=(i.edge-f)*1e3,m=w6(i,p);i.updated&&r>this.requestScheduled+m&&(this.requestScheduled=o.loading.start),c!==void 0&&i.canBlockReload?this.requestScheduled=o.loading.first+m-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+m<r?this.requestScheduled=r:this.requestScheduled-r<=0&&(this.requestScheduled+=m);let g=this.requestScheduled-r;g=Math.max(0,g),this.log(`reload live playlist ${e} in ${Math.round(g)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(d),g)}else this.clearTimer()}getDeliveryDirectives(e,t,a,i){let o=Gf(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(a=t.msn,i=t.part,o=ei.No),new jf(a,i,o)}checkRetry(e){const t=e.details,a=ti(e),i=e.errorAction,{action:o,retryCount:r=0,retryConfig:l}=i||{},d=!!i&&!!l&&(o===it.RetryRequest||!i.resolved&&o===it.SendAlternateToPenaltyBox);if(d){var c;if(this.requestScheduled=-1,r>=l.maxNumRetry)return!1;if(a&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${l.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=pl(l,r);this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${r+1}/${l.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,i.resolved=!0}return d}}class Us{constructor(e,t=0,a=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=a}sample(e,t){const a=Math.pow(this.alpha_,e);this.estimate_=t*(1-a)+a*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class L6{constructor(e,t,a,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=a,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Us(e),this.fast_=new Us(t),this.defaultTTFB_=i,this.ttfb_=new Us(e)}update(e,t){const{slow_:a,fast_:i,ttfb_:o}=this;a.halfLife!==e&&(this.slow_=new Us(e,a.getEstimate(),a.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Us(t,i.getEstimate(),i.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new Us(e,o.getEstimate(),o.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const a=8*t,i=e/1e3,o=a/i;this.fast_.sample(i,o),this.slow_.sample(i,o)}sampleTTFB(e){const t=e/1e3,a=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(a,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const ep={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},tp={};function I6(s,e,t,a,i,o){const r=s.audioCodec?s.audioGroups:null,l=o==null?void 0:o.audioCodec,d=o==null?void 0:o.channels,c=d?parseInt(d):l?1/0:2;let h=null;if(r!=null&&r.length)try{r.length===1&&r[0]?h=e.groups[r[0]].channels:h=r.reduce((u,f)=>{if(f){const p=e.groups[f];if(!p)throw new Error(`Audio track group ${f} not found`);Object.keys(p.channels).forEach(m=>{u[m]=(u[m]||0)+p.channels[m]})}return u},{2:0})}catch{return!0}return s.videoCodec!==void 0&&(s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(a,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(i,8e6))||!!h&&ae(c)&&Object.keys(h).some(u=>parseInt(u)>c)}function R6(s,e,t){const a=s.videoCodec,i=s.audioCodec;if(!a||!i||!t)return Promise.resolve(ep);const o={width:s.width,height:s.height,bitrate:Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)),framerate:s.frameRate||30},r=s.videoRange;r!=="SDR"&&(o.transferFunction=r.toLowerCase());const l=a.split(",").map(d=>({type:"media-source",video:Ze(Ze({},o),{},{contentType:xa(d,"video")})}));return i&&s.audioGroups&&s.audioGroups.forEach(d=>{var c;d&&((c=e.groups[d])==null||c.tracks.forEach(h=>{if(h.groupId===d){const u=h.channels||"",f=parseFloat(u);ae(f)&&f>2&&l.push.apply(l,i.split(",").map(p=>({type:"media-source",audio:{contentType:xa(p,"audio"),channels:""+f}})))}}))}),Promise.all(l.map(d=>{const c=B6(d);return tp[c]||(tp[c]=t.decodingInfo(d))})).then(d=>({supported:!d.some(c=>!c.supported),configurations:l,decodingInfoResults:d})).catch(d=>({supported:!1,configurations:l,decodingInfoResults:[],error:d}))}function B6(s){const{audio:e,video:t}=s,a=t||e;if(a){const i=a.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function N6(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function D6(s,e){let t=!1,a=[];return s&&(t=s!=="SDR",a=[s]),e&&(a=e.allowedVideoRanges||Qn.slice(0),t=e.preferHDR!==void 0?e.preferHDR:N6(),t?a=a.filter(i=>i!=="SDR"):a=["SDR"]),{preferHDR:t,allowedVideoRanges:a}}function P6(s,e,t,a,i){const o=Object.keys(s),r=a==null?void 0:a.channels,l=a==null?void 0:a.audioCodec,d=r&&parseInt(r)===2;let c=!0,h=!1,u=1/0,f=1/0,p=1/0,m=0,g=[];const{preferHDR:y,allowedVideoRanges:b}=D6(e,i);for(let T=o.length;T--;){const v=s[o[T]];c=v.channels[2]>0,u=Math.min(u,v.minHeight),f=Math.min(f,v.minFramerate),p=Math.min(p,v.minBitrate);const E=b.filter(B=>v.videoRanges[B]>0);E.length>0&&(h=!0,g=E)}u=ae(u)?u:0,f=ae(f)?f:0;const S=Math.max(1080,u),w=Math.max(30,f);return p=ae(p)?p:t,t=Math.max(p,t),h||(e=void 0,g=[]),{codecSet:o.reduce((T,v)=>{const E=s[v];if(v===T)return T;if(E.minBitrate>t)return Jt(v,`min bitrate of ${E.minBitrate} > current estimate of ${t}`),T;if(!E.hasDefaultAudio)return Jt(v,"no renditions with default or auto-select sound found"),T;if(l&&v.indexOf(l.substring(0,4))%5!==0)return Jt(v,`audio codec preference "${l}" not found`),T;if(r&&!d){if(!E.channels[r])return Jt(v,`no renditions with ${r} channel sound found (channels options: ${Object.keys(E.channels)})`),T}else if((!l||d)&&c&&E.channels[2]===0)return Jt(v,"no renditions with stereo sound found"),T;return E.minHeight>S?(Jt(v,`min resolution of ${E.minHeight} > maximum of ${S}`),T):E.minFramerate>w?(Jt(v,`min framerate of ${E.minFramerate} > maximum of ${w}`),T):g.some(B=>E.videoRanges[B]>0)?E.maxScore<m?(Jt(v,`max score of ${E.maxScore} < selected max of ${m}`),T):T&&(Yn(v)>=Yn(T)||E.fragmentError>s[T].fragmentError)?T:(m=E.maxScore,v):(Jt(v,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),T)},void 0),videoRanges:g,preferHDR:y,minFramerate:f,minBitrate:p}}function Jt(s,e){A.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function O6(s){return s.reduce((e,t)=>{let a=e.groups[t.groupId];a||(a=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),a.tracks.push(t);const i=t.channels||"2";return a.channels[i]=(a.channels[i]||0)+1,a.hasDefault=a.hasDefault||t.default,a.hasAutoSelect=a.hasAutoSelect||t.autoselect,a.hasDefault&&(e.hasDefaultAudio=!0),a.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function F6(s,e,t,a){return s.slice(t,a+1).reduce((i,o)=>{if(!o.codecSet)return i;const r=o.audioGroups;let l=i[o.codecSet];l||(i[o.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,o.bitrate);const d=Math.min(o.height,o.width);return l.minHeight=Math.min(l.minHeight,d),l.minFramerate=Math.min(l.minFramerate,o.frameRate),l.maxScore=Math.max(l.maxScore,o.score),l.fragmentError+=o.fragmentError,l.videoRanges[o.videoRange]=(l.videoRanges[o.videoRange]||0)+1,r&&r.forEach(c=>{if(!c)return;const h=e.groups[c];h&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(u=>{l.channels[u]=(l.channels[u]||0)+h.channels[u]}))}),i},{})}function Ht(s,e,t){if("attrs"in s){const a=e.indexOf(s);if(a!==-1)return a}for(let a=0;a<e.length;a++){const i=e[a];if(Gs(s,i,t))return a}return-1}function Gs(s,e,t){const{groupId:a,name:i,lang:o,assocLang:r,characteristics:l,default:d}=s,c=s.forced;return(a===void 0||e.groupId===a)&&(i===void 0||e.name===i)&&(o===void 0||e.lang===o)&&(o===void 0||e.assocLang===r)&&(d===void 0||e.default===d)&&(c===void 0||e.forced===c)&&(l===void 0||M6(l,e.characteristics))&&(t===void 0||t(s,e))}function M6(s,e=""){const t=s.split(","),a=e.split(",");return t.length===a.length&&!t.some(i=>a.indexOf(i)===-1)}function js(s,e){const{audioCodec:t,channels:a}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(a===void 0||a===(e.channels||"2"))}function V6(s,e,t,a,i){const o=e[a],l=e.reduce((f,p,m)=>{const g=p.uri;return(f[g]||(f[g]=[])).push(m),f},{})[o.uri];l.length>1&&(a=Math.max.apply(Math,l));const d=o.videoRange,c=o.frameRate,h=o.codecSet.substring(0,4),u=sp(e,a,f=>{if(f.videoRange!==d||f.frameRate!==c||f.codecSet.substring(0,4)!==h)return!1;const p=f.audioGroups,m=t.filter(g=>!p||p.indexOf(g.groupId)!==-1);return Ht(s,m,i)>-1});return u>-1?u:sp(e,a,f=>{const p=f.audioGroups,m=t.filter(g=>!p||p.indexOf(g.groupId)!==-1);return Ht(s,m,i)>-1})}function sp(s,e,t){for(let a=e;a;a--)if(t(s[a]))return a;for(let a=e+1;a<s.length;a++)if(t(s[a]))return a;return-1}class $6{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:a,hls:i}=this,{autoLevelEnabled:o,media:r}=i;if(!t||!r)return;const l=performance.now(),d=a?a.stats:t.stats,c=a?a.duration:t.duration,h=l-d.loading.start,u=i.minAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o||r.paused||!r.playbackRate||!r.readyState)return;const f=i.mainForwardBufferInfo;if(f===null)return;const p=this.bwEstimator.getEstimateTTFB(),m=Math.abs(r.playbackRate);if(h<=Math.max(p,1e3*(c/(m*2))))return;const g=f.len/m,y=d.loading.first?d.loading.first-d.loading.start:-1,b=d.loaded&&y>-1,S=this.getBwEstimate(),w=i.levels,x=w[t.level],T=d.total||Math.max(d.loaded,Math.round(c*x.averageBitrate/8));let v=b?h-y:h;v<1&&b&&(v=Math.min(h,d.loaded*8/S));const E=b?d.loaded*1e3/v:0,B=E?(T-d.loaded)/E:T*8/S+p/1e3;if(B<=g)return;const I=E?E*8:S;let R=Number.POSITIVE_INFINITY,M;for(M=t.level-1;M>u;M--){const H=w[M].maxBitrate;if(R=this.getTimeToLoadFrag(p/1e3,I,c*H,!w[M].details),R<g)break}if(R>=B||R>c*10)return;i.nextLoadLevel=i.nextAutoLevel=M,b?this.bwEstimator.sample(h-Math.min(p,y),d.loaded):this.bwEstimator.sampleTTFB(h);const K=w[M].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>K&&this.resetEstimator(K),this.clearTimer(),A.warn(`[abr] Fragment ${t.sn}${a?" part "+a.index:""} of level ${t.level} is loading too slowly;
|
|
43
43
|
Time to underbuffer: ${g.toFixed(3)} s
|
|
44
44
|
Estimated load time for current fragment: ${B.toFixed(3)} s
|
|
45
45
|
Estimated load time for down switch fragment: ${R.toFixed(3)} s
|
|
46
46
|
TTFB estimate: ${y|0} ms
|
|
47
47
|
Current BW estimate: ${ae(S)?S|0:"Unknown"} bps
|
|
48
48
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
49
|
-
Switching to level ${M} @ ${K|0} bps`),i.trigger(_.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:a,stats:d})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(A.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new L6(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(_.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const a=t.frag;if(!this.ignoreFragment(a)){if(!a.bitrateTest){var i;this.fragCurrent=a,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case N.BUFFER_ADD_CODEC_ERROR:case N.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case N.FRAG_LOAD_TIMEOUT:{const a=t.frag,{fragCurrent:i,partCurrent:o}=this;if(a&&i&&a.sn===i.sn&&a.level===i.level){const r=performance.now(),l=o?o.stats:a.stats,d=r-l.loading.start,c=l.loading.first?l.loading.first-l.loading.start:-1;if(l.loaded&&c>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(d-Math.min(u,c),l.loaded)}else this.bwEstimator.sampleTTFB(d)}break}}}getTimeToLoadFrag(e,t,a,i){const o=e+a/t,r=i?this.lastLevelLoadSec:0;return o+r}onLevelLoaded(e,t){const a=this.hls.config,{loading:i}=t.stats,o=i.end-i.start;ae(o)&&(this.lastLevelLoadSec=o/1e3),t.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:a}){const i=a?a.stats:t.stats;if(t.type===le.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const o=a?a.duration:t.duration,r=this.hls.levels[t.level],l=(r.loaded?r.loaded.bytes:0)+i.loaded,d=(r.loaded?r.loaded.duration:0)+o;r.loaded={bytes:l,duration:d},r.realBitrate=Math.round(8*l/d)}if(t.bitrateTest){const o={stats:i,frag:t,part:a,id:t.type};this.onFragBuffered(_.FRAG_BUFFERED,o),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:a,part:i}=t,o=i!=null&&i.stats.loaded?i.stats:a.stats;if(o.aborted||this.ignoreFragment(a))return;const r=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,o.loaded),o.bwEstimate=this.getBwEstimate(),a.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==le.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,a=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,o=this.findBestLevel(a,t,e,0,i,1,1);if(o>-1)return o;const r=this.hls.firstLevel,l=Math.min(Math.max(r,t),e);return A.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${r} clamped to ${l}`),l}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,a=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!a||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const o=a&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,o)&&r[e].loadError<=r[o].loadError)return e}return this._nextAutoLevel=o,this.nextAutoLevelKey=this.getAutoLevelKey(),o}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:a}=this,{maxAutoLevel:i,config:o,minAutoLevel:r}=a,l=t?t.duration:e?e.duration:0,d=this.getBwEstimate(),c=this.getStarvationDelay();let h=o.abrBandWidthFactor,u=o.abrBandWidthUpFactor;if(c){const y=this.findBestLevel(d,r,i,c,0,h,u);if(y>=0)return y}let f=l?Math.min(l,o.maxStarvationDelay):o.maxStarvationDelay;if(!c){const y=this.bitrateTestDelay;y&&(f=(l?Math.min(l,o.maxLoadingDelay):o.maxLoadingDelay)-y,A.info(`[abr] bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),h=u=1)}const p=this.findBestLevel(d,r,i,c,f,h,u);if(A.info(`[abr] ${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${p}`),p>-1)return p;const m=a.levels[r],g=a.levels[a.loadLevel];return(m==null?void 0:m.bitrate)<(g==null?void 0:g.bitrate)?r:a.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const a=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/a}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,a,i,o,r,l){var d;const c=i+o,h=this.lastLoadedFragLevel,u=h===-1?this.hls.firstLevel:h,{fragCurrent:f,partCurrent:p}=this,{levels:m,allAudioTracks:g,loadLevel:y,config:b}=this.hls;if(m.length===1)return 0;const S=m[u],w=!!(S!=null&&(d=S.details)!=null&&d.live),x=y===-1||h===-1;let T,v="SDR",E=(S==null?void 0:S.frameRate)||0;const{audioPreference:B,videoPreference:I}=b,R=this.audioTracksByGroup||(this.audioTracksByGroup=O6(g));if(x){if(this.firstSelection!==-1)return this.firstSelection;const oe=this.codecTiers||(this.codecTiers=F6(m,R,t,a)),ne=P6(oe,v,e,B,I),{codecSet:ce,videoRanges:de,minFramerate:Z,minBitrate:q,preferHDR:he}=ne;T=ce,v=he?de[de.length-1]:de[0],E=Z,e=Math.max(e,q),A.log(`[abr] picked start tier ${JSON.stringify(ne)}`)}else T=S==null?void 0:S.codecSet,v=S==null?void 0:S.videoRange;const M=p?p.duration:f?f.duration:0,K=this.bwEstimator.getEstimateTTFB()/1e3,H=[];for(let oe=a;oe>=t;oe--){var se;const ne=m[oe],ce=oe>u;if(!ne)continue;if(b.useMediaCapabilities&&!ne.supportedResult&&!ne.supportedPromise){const ue=navigator.mediaCapabilities;typeof(ue==null?void 0:ue.decodingInfo)=="function"&&I6(ne,R,v,E,e,B)?(ne.supportedPromise=R6(ne,R,ue),ne.supportedPromise.then(be=>{if(!this.hls)return;ne.supportedResult=be;const xe=this.hls.levels,te=xe.indexOf(ne);be.error?A.warn(`[abr] MediaCapabilities decodingInfo error: "${be.error}" for level ${te} ${JSON.stringify(be)}`):be.supported||(A.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${te} ${JSON.stringify(be)}`),te>-1&&xe.length>1&&(A.log(`[abr] Removing unsupported level ${te}`),this.hls.removeLevel(te)))})):ne.supportedResult=ep}if(T&&ne.codecSet!==T||v&&ne.videoRange!==v||ce&&E>ne.frameRate||!ce&&E>0&&E<ne.frameRate||ne.supportedResult&&!((se=ne.supportedResult.decodingInfoResults)!=null&&se[0].smooth)){H.push(oe);continue}const de=ne.details,Z=(p?de==null?void 0:de.partTarget:de==null?void 0:de.averagetargetduration)||M;let q;ce?q=l*e:q=r*e;const he=M&&i>=M*2&&o===0?m[oe].averageBitrate:m[oe].maxBitrate,J=this.getTimeToLoadFrag(K,q,he*Z,de===void 0);if(q>=he&&(oe===h||ne.loadError===0&&ne.fragmentError===0)&&(J<=K||!ae(J)||w&&!this.bitrateTestDelay||J<c)){const ue=this.forcedAutoLevel;return oe!==y&&(ue===-1||ue!==y)&&(H.length&&A.trace(`[abr] Skipped level(s) ${H.join(",")} of ${a} max with CODECS and VIDEO-RANGE:"${m[H[0]].codecs}" ${m[H[0]].videoRange}; not compatible with "${S.codecs}" ${v}`),A.info(`[abr] switch candidate:${u}->${oe} adjustedbw(${Math.round(q)})-bitrate=${Math.round(q-he)} ttfb:${K.toFixed(1)} avgDuration:${Z.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${J.toFixed(1)} firstSelection:${x} codecSet:${T} videoRange:${v} hls.loadLevel:${y}`)),x&&(this.firstSelection=oe),oe}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:a}=this.hls,i=Math.min(Math.max(e,a),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class z6{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var Qe={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class U6{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(_.BUFFER_APPENDED,this.onBufferAppended,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.BUFFER_APPENDED,this.onBufferAppended,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const a=this.activePartLists[t];if(a)for(let i=a.length;i--;){const o=a[i];if(!o)break;const r=o.end;if(o.start<=e&&r!==null&&e<=r)return o}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:a}=this,i=Object.keys(a);for(let o=i.length;o--;){const r=a[i[o]];if((r==null?void 0:r.body.type)===t&&r.buffered){const l=r.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,t,a,i){this.timeRanges&&(this.timeRanges[e]=t);const o=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(r=>{const l=this.fragments[r];if(!l||o>=l.body.sn)return;if(!l.buffered&&!l.loaded){l.body.type===a&&this.removeFragment(l.body);return}const d=l.range[e];d&&d.time.some(c=>{const h=!this.isTimeBuffered(c.startPTS,c.endPTS,t);return h&&this.removeFragment(l.body),h})})}detectPartialFragments(e){const t=this.timeRanges,{frag:a,part:i}=e;if(!t||a.sn==="initSegment")return;const o=Hs(a),r=this.fragments[o];if(!r||r.buffered&&a.gap)return;const l=!a.relurl;Object.keys(t).forEach(d=>{const c=a.elementaryStreams[d];if(!c)return;const h=t[d],u=l||c.partial===!0;r.range[d]=this.getBufferedTimes(a,i,u,h)}),r.loaded=null,Object.keys(r.range).length?(r.buffered=!0,(r.body.endList=a.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),ni(r)||this.removeParts(a.sn-1,a.type)):this.removeFragment(r.body)}removeParts(e,t){const a=this.activePartLists[t];a&&(this.activePartLists[t]=a.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const a=Hs(e);let i=this.fragments[a];!i&&t&&(i=this.fragments[a]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,a,i){const o={time:[],partial:a},r=e.start,l=e.end,d=e.minEndPTS||l,c=e.maxStartPTS||r;for(let h=0;h<i.length;h++){const u=i.start(h)-this.bufferPadding,f=i.end(h)+this.bufferPadding;if(c>=u&&d<=f){o.time.push({startPTS:Math.max(r,i.start(h)),endPTS:Math.min(l,i.end(h))});break}else if(r<f&&l>u){const p=Math.max(r,i.start(h)),m=Math.min(l,i.end(h));m>p&&(o.partial=!0,o.time.push({startPTS:p,endPTS:m}))}else if(l<=u)break}return o}getPartialFragment(e){let t=null,a,i,o,r=0;const{bufferPadding:l,fragments:d}=this;return Object.keys(d).forEach(c=>{const h=d[c];h&&ni(h)&&(i=h.body.start-l,o=h.body.end+l,e>=i&&e<=o&&(a=Math.min(e-i,o-e),r<=a&&(t=h.body,r=a)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||ni(t))}getState(e){const t=Hs(e),a=this.fragments[t];return a?a.buffered?ni(a)?Qe.PARTIAL:Qe.OK:Qe.APPENDING:Qe.NOT_LOADED}isTimeBuffered(e,t,a){let i,o;for(let r=0;r<a.length;r++){if(i=a.start(r)-this.bufferPadding,o=a.end(r)+this.bufferPadding,e>=i&&t<=o)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:a,part:i}=t;if(a.sn==="initSegment"||a.bitrateTest)return;const o=i?null:t,r=Hs(a);this.fragments[r]={body:a,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:a,part:i,timeRanges:o}=t;if(a.sn==="initSegment")return;const r=a.type;if(i){let l=this.activePartLists[r];l||(this.activePartLists[r]=l=[]),l.push(i)}this.timeRanges=o,Object.keys(o).forEach(l=>{const d=o[l];this.detectEvictedFragments(l,d,r,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Hs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,a,i,o){i&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const l=this.fragments[r];if(!l)return;const d=l.body;d.type!==a||i&&!d.gap||d.start<t&&d.end>e&&(l.buffered||o)&&this.removeFragment(d)})}removeFragment(e){const t=Hs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const a=this.activePartLists[e.type];if(a){const i=e.sn;this.activePartLists[e.type]=a.filter(o=>o.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function ni(s){var e,t,a;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((a=s.range.audiovideo)==null?void 0:a.partial))}function Hs(s){return`${s.type}_${s.level}_${s.sn}`}const G6={length:0,start:()=>0,end:()=>0};class Pe{static isBuffered(e,t){try{if(e){const a=Pe.getBuffered(e);for(let i=0;i<a.length;i++)if(t>=a.start(i)&&t<=a.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,a){try{if(e){const i=Pe.getBuffered(e),o=[];let r;for(r=0;r<i.length;r++)o.push({start:i.start(r),end:i.end(r)});return this.bufferedInfo(o,t,a)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,a){t=Math.max(0,t),e.sort(function(c,h){const u=c.start-h.start;return u||h.end-c.end});let i=[];if(a)for(let c=0;c<e.length;c++){const h=i.length;if(h){const u=i[h-1].end;e[c].start-u<a?e[c].end>u&&(i[h-1].end=e[c].end):i.push(e[c])}else i.push(e[c])}else i=e;let o=0,r,l=t,d=t;for(let c=0;c<i.length;c++){const h=i[c].start,u=i[c].end;if(t+a>=h&&t<u)l=h,d=u,o=d-t;else if(t+a<h){r=h;break}}return{len:o,start:l||0,end:d||0,nextStart:r}}static getBuffered(e){try{return e.buffered}catch(t){return A.log("failed to get media.buffered",t),G6}}}class bl{constructor(e,t,a,i=0,o=-1,r=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=ii(),this.buffering={audio:ii(),video:ii(),audiovideo:ii()},this.level=e,this.sn=t,this.id=a,this.size=i,this.part=o,this.partial=r}}function ii(){return{start:0,executeStart:0,executeEnd:0,end:0}}function oi(s,e){for(let a=0,i=s.length;a<i;a++){var t;if(((t=s[a])==null?void 0:t.cc)===e)return s[a]}return null}function j6(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function H6(s,e){const t=s.fragments,a=e.fragments;if(!a.length||!t.length){A.log("No fragments to align");return}const i=oi(t,a[0].cc);if(!i||i&&!i.startPTS){A.log("No frag in previous level to align on");return}return i}function ap(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function np(s,e){const t=e.fragments;for(let a=0,i=t.length;a<i;a++)ap(t[a],s);e.fragmentHint&&ap(e.fragmentHint,s),e.alignedSliding=!0}function W6(s,e,t){e&&(K6(s,t,e),!t.alignedSliding&&e&&ri(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&Kf(e,t))}function K6(s,e,t){if(j6(s,t,e)){const a=H6(t,e);a&&ae(a.start)&&(A.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),np(a.start,e))}}function ri(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,a=e.fragments;if(!t.length||!a.length)return;let i,o;const r=Math.min(e.endCC,s.endCC);e.startCC<r&&s.startCC<r&&(i=oi(a,r),o=oi(t,r)),(!i||!o)&&(i=a[Math.floor(a.length/2)],o=oi(t,i.cc)||t[Math.floor(t.length/2)]);const l=i.programDateTime,d=o.programDateTime;if(!l||!d)return;const c=(d-l)/1e3-(o.start-i.start);np(c,s)}const ip=Math.pow(2,17);class q6{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const a=e.url;if(!a)return Promise.reject(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${a?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,o=i.fLoader,r=i.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(p=>p[0]==="GAP")){d(rp(e));return}else e.gap=!1;const c=this.loader=e.loader=o?new o(i):new r(i),h=op(e),u=Zf(i.fragLoadPolicy.default),f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:ip};e.stats=c.stats,c.load(h,f,{onSuccess:(p,m,g,y)=>{this.resetLoader(e,c);let b=p.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(b.slice(0,16)),b=b.slice(16)),l({frag:e,part:null,payload:b,networkDetails:y})},onError:(p,m,g,y)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ze({url:a,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:g,stats:y}))},onAbort:(p,m,g)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:p}))},onTimeout:(p,m,g)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:g,stats:p}))},onProgress:(p,m,g,y)=>{t&&t({frag:e,part:null,payload:g,networkDetails:y})}})})}loadPart(e,t,a){this.abort();const i=this.config,o=i.fLoader,r=i.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){d(rp(e,t));return}const c=this.loader=e.loader=o?new o(i):new r(i),h=op(e,t),u=Zf(i.fragLoadPolicy.default),f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ip};t.stats=c.stats,c.load(h,f,{onSuccess:(p,m,g,y)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const b={frag:e,part:t,payload:p.data,networkDetails:y};a(b),l(b)},onError:(p,m,g,y)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Ze({url:h.url,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:g,stats:y}))},onAbort:(p,m,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:p}))},onTimeout:(p,m,g)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:g,stats:p}))}})})}updateStatsFromPart(e,t){const a=e.stats,i=t.stats,o=i.total;if(a.loaded+=i.loaded,o){const d=Math.round(e.duration/t.duration),c=Math.min(Math.round(a.loaded/o),d),u=(d-c)*Math.round(a.loaded/c);a.total=a.loaded+u}else a.total=Math.max(a.loaded,a.total);const r=a.loading,l=i.loading;r.start?r.first+=l.first-l.start:(r.start=l.start,r.first=l.first),r.end=l.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function op(s,e=null){const t=e||s,a={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,o=t.byteRangeEndOffset;if(ae(i)&&ae(o)){var r;let l=i,d=o;if(s.sn==="initSegment"&&((r=s.decryptdata)==null?void 0:r.method)==="AES-128"){const c=o-i;c%16&&(d=o+(16-c%16)),i!==0&&(a.resetIV=!0,l=i-16)}a.rangeStart=l,a.rangeEnd=d}return a}function rp(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),a={type:pe.MEDIA_ERROR,details:N.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(a.part=e),(e||s).stats.aborted=!0,new Xt(a)}class Xt extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Y6{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class J6{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function X6(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Es(s,0,e-t):s}class Z6{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),a=new Uint32Array(4);for(let i=0;i<4;i++)a[i]=t.getUint32(i*4);return a}initTable(){const e=this.sBox,t=this.invSBox,a=this.subMix,i=a[0],o=a[1],r=a[2],l=a[3],d=this.invSubMix,c=d[0],h=d[1],u=d[2],f=d[3],p=new Uint32Array(256);let m=0,g=0,y=0;for(y=0;y<256;y++)y<128?p[y]=y<<1:p[y]=y<<1^283;for(y=0;y<256;y++){let b=g^g<<1^g<<2^g<<3^g<<4;b=b>>>8^b&255^99,e[m]=b,t[b]=m;const S=p[m],w=p[S],x=p[w];let T=p[b]*257^b*16843008;i[m]=T<<24|T>>>8,o[m]=T<<16|T>>>16,r[m]=T<<8|T>>>24,l[m]=T,T=x*16843009^w*65537^S*257^m*16843008,c[b]=T<<24|T>>>8,h[b]=T<<16|T>>>16,u[b]=T<<8|T>>>24,f[b]=T,m?(m=S^p[p[p[x^S]]],g^=p[p[g]]):m=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let a=!0,i=0;for(;i<t.length&&a;)a=t[i]===this.key[i],i++;if(a)return;this.key=t;const o=this.keySize=t.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);const r=this.ksRows=(o+6+1)*4;let l,d;const c=this.keySchedule=new Uint32Array(r),h=this.invKeySchedule=new Uint32Array(r),u=this.sBox,f=this.rcon,p=this.invSubMix,m=p[0],g=p[1],y=p[2],b=p[3];let S,w;for(l=0;l<r;l++){if(l<o){S=c[l]=t[l];continue}w=S,l%o===0?(w=w<<8|w>>>24,w=u[w>>>24]<<24|u[w>>>16&255]<<16|u[w>>>8&255]<<8|u[w&255],w^=f[l/o|0]<<24):o>6&&l%o===4&&(w=u[w>>>24]<<24|u[w>>>16&255]<<16|u[w>>>8&255]<<8|u[w&255]),c[l]=S=(c[l-o]^w)>>>0}for(d=0;d<r;d++)l=r-d,d&3?w=c[l]:w=c[l-4],d<4||l<=4?h[d]=w:h[d]=m[u[w>>>24]]^g[u[w>>>16&255]]^y[u[w>>>8&255]]^b[u[w&255]],h[d]=h[d]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,a){const i=this.keySize+6,o=this.invKeySchedule,r=this.invSBox,l=this.invSubMix,d=l[0],c=l[1],h=l[2],u=l[3],f=this.uint8ArrayToUint32Array_(a);let p=f[0],m=f[1],g=f[2],y=f[3];const b=new Int32Array(e),S=new Int32Array(b.length);let w,x,T,v,E,B,I,R,M,K,H,se,oe,ne;const ce=this.networkToHostOrderSwap;for(;t<b.length;){for(M=ce(b[t]),K=ce(b[t+1]),H=ce(b[t+2]),se=ce(b[t+3]),E=M^o[0],B=se^o[1],I=H^o[2],R=K^o[3],oe=4,ne=1;ne<i;ne++)w=d[E>>>24]^c[B>>16&255]^h[I>>8&255]^u[R&255]^o[oe],x=d[B>>>24]^c[I>>16&255]^h[R>>8&255]^u[E&255]^o[oe+1],T=d[I>>>24]^c[R>>16&255]^h[E>>8&255]^u[B&255]^o[oe+2],v=d[R>>>24]^c[E>>16&255]^h[B>>8&255]^u[I&255]^o[oe+3],E=w,B=x,I=T,R=v,oe=oe+4;w=r[E>>>24]<<24^r[B>>16&255]<<16^r[I>>8&255]<<8^r[R&255]^o[oe],x=r[B>>>24]<<24^r[I>>16&255]<<16^r[R>>8&255]<<8^r[E&255]^o[oe+1],T=r[I>>>24]<<24^r[R>>16&255]<<16^r[E>>8&255]<<8^r[B&255]^o[oe+2],v=r[R>>>24]<<24^r[E>>16&255]<<16^r[B>>8&255]<<8^r[I&255]^o[oe+3],S[t]=ce(w^p),S[t+1]=ce(v^m),S[t+2]=ce(T^g),S[t+3]=ce(x^y),p=M,m=K,g=H,y=se,t=t+4}return S.buffer}}const Q6=16;class Sl{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const a=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?X6(a):a}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,a){return this.useSoftware?new Promise((i,o)=>{this.softwareDecrypt(new Uint8Array(e),t,a);const r=this.flush();r?i(r.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,a)}softwareDecrypt(e,t,a){const{currentIV:i,currentResult:o,remainderData:r}=this;this.logOnce("JS AES decrypt"),r&&(e=_t(r,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;i&&(a=i);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new Z6),d.expandKey(t);const c=o;return this.currentResult=d.decrypt(l.buffer,0,a),this.currentIV=Es(l,-16).buffer,c||null}webCryptoDecrypt(e,t,a){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,a));this.key=t,this.fastAesKey=new J6(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Y6(this.subtle,new Uint8Array(a)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(A.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,a)))}onWebCryptoError(e,t,a){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,a);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const a=e.length-e.length%Q6;return a!==e.length&&(t=Es(e,0,a),this.remainderData=Es(e,a)),t}logOnce(e){this.logEnabled&&(A.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const eN={toString:function(s){let e="";const t=s.length;for(let a=0;a<t;a++)e+=`[${s.start(a).toFixed(3)}-${s.end(a).toFixed(3)}]`;return e}},V={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class _l extends z6{constructor(e,t,a,i,o){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=V.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=o,this.logPrefix=i,this.log=A.log.bind(A,`${i}:`),this.warn=A.warn.bind(A,`${i}:`),this.hls=e,this.fragmentLoader=new q6(e.config),this.keyLoader=a,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Sl(e.config),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=V.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const a=t.partList;if(a!=null&&a.length){const o=a[a.length-1];return Pe.isBuffered(this.media,o.start+o.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const a=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),a.addEventListener("seeking",this.onvseeking),a.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===V.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:a,mediaBuffer:i,state:o}=this,r=a?a.currentTime:0,l=Pe.bufferInfo(i||a,r,e.maxBufferHole);if(this.log(`media seeking to ${ae(r)?r.toFixed(3):r}, state: ${o}`),this.state===V.ENDED)this.resetLoadingState();else if(t){const d=e.maxFragLookUpTolerance,c=t.start-d,h=t.start+t.duration+d;if(!l.len||h<l.start||c>l.end){const u=r>h;(r<c||u)&&(u&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}a&&(this.fragmentTracker.removeFragmentsInRange(r,1/0,this.playlistType,!0),this.lastCurrentTime=r),!this.loadedmetadata&&!l.len&&(this.nextLoadPosition=this.startPosition=r),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=V.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,a){this._loadFragForPlayback(e,t,a)}_loadFragForPlayback(e,t,a){const i=o=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${o.part?" p: "+o.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(o)};this._doFragLoad(e,t,a,i).then(o=>{if(!o)return;const r=this.state;if(this.fragContextChanged(e)){(r===V.FRAG_LOADING||!this.fragCurrent&&r===V.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=V.IDLE);return}"payload"in o&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(_.FRAG_LOADED,o)),this._handleFragmentLoadComplete(o)}).catch(o=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(`Frag error: ${(o==null?void 0:o.message)||o}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:a}=this;if(a.getState(e)===Qe.APPENDING){const o=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,o),l=Math.max(e.duration,r?r.len:this.config.maxBufferLength),d=this.backtrackFragment;((d?e.sn-d.sn:0)===1||this.reduceMaxBufferLength(l,e.duration))&&a.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?a.removeAllFragments():a.hasParts(e.type)&&(a.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),a.getState(e)===Qe.PARTIAL&&a.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,a=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:a};this.hls.trigger(_.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(a=>{if(!a||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return a}).then(a=>{const{hls:i}=this,{payload:o}=a,r=e.decryptdata;if(o&&o.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),r.key.buffer,r.iv.buffer).catch(d=>{throw i.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:e}),d}).then(d=>{const c=self.performance.now();return i.trigger(_.FRAG_DECRYPTED,{frag:e,payload:d,stats:{tstart:l,tdecrypt:c}}),a.payload=d,this.completeInitSegmentLoad(a)})}return this.completeInitSegmentLoad(a)}).catch(a=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(a),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const a=e.frag.stats;this.state=V.IDLE,e.frag.data=new Uint8Array(e.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var a,i,o,r;const l=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===le.MAIN?"level":"track"} ${e.level} (frag:[${((a=e.startPTS)!=null?a:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${l?eN.toString(Pe.getBuffered(l)):"(detached)"})`),e.sn!=="initSegment"){var d;if(e.type!==le.SUBTITLE){const h=e.elementaryStreams;if(!Object.keys(h).some(u=>!!h[u])){this.state=V.IDLE;return}}const c=(d=this.levels)==null?void 0:d[e.level];c!=null&&c.fragmentError&&(this.log(`Resetting level fragment error count of ${c.fragmentError} on frag buffered`),c.fragmentError=0)}this.state=V.IDLE,l&&(!this.loadedmetadata&&e.type==le.MAIN&&l.buffered.length&&((o=this.fragCurrent)==null?void 0:o.sn)===((r=this.fragPrevious)==null?void 0:r.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:a,part:i,partsLoaded:o}=e,r=!o||o.length===0||o.some(d=>!d),l=new bl(a.level,a.sn,a.stats.chunkCount+1,0,i?i.index:-1,!r);t.flush(l)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,a=null,i){var o;const r=t==null?void 0:t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let l=null;if(e.encrypted&&!((o=e.decryptdata)!=null&&o.key)?(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=V.KEY_LOADING,this.fragCurrent=e,l=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(_.KEY_LOADED,h),this.state===V.KEY_LOADING&&(this.state=V.IDLE),h}),this.hls.trigger(_.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(l=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&r.encryptedFragments.length&&this.keyLoader.loadClear(e,r.encryptedFragments),a=Math.max(e.start,a||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const h=r.partList;if(h&&i){a>e.end&&r.fragmentHint&&(e=r.fragmentHint);const u=this.getNextPart(h,e,a);if(u>-1){const f=h[u];this.log(`Loading part sn: ${e.sn} p: ${f.index} cc: ${e.cc} of playlist [${r.startSN}-${r.endSN}] parts [0-${u}-${h.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(a.toFixed(3))}`),this.nextLoadPosition=f.start+f.duration,this.state=V.FRAG_LOADING;let p;return l?p=l.then(m=>!m||this.fragContextChanged(m.frag)?null:this.doFragPartsLoad(e,f,t,i)).catch(m=>this.handleFragLoadError(m)):p=this.doFragPartsLoad(e,f,t,i).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(_.FRAG_LOADING,{frag:e,part:f,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):p}else if(!e.url||this.loadedEndOfParts(h,a))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${r?"of ["+r.startSN+"-"+r.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(a.toFixed(3))}`),ae(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=V.FRAG_LOADING;const d=this.config.progressive;let c;return d&&l?c=l.then(h=>!h||this.fragContextChanged(h==null?void 0:h.frag)?null:this.fragmentLoader.load(e,i)).catch(h=>this.handleFragLoadError(h)):c=Promise.all([this.fragmentLoader.load(e,d?i:void 0),l]).then(([h])=>(!d&&h&&i&&i(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(_.FRAG_LOADING,{frag:e,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,a,i){return new Promise((o,r)=>{var l;const d=[],c=(l=a.details)==null?void 0:l.partList,h=u=>{this.fragmentLoader.loadPart(e,u,i).then(f=>{d[u.index]=f;const p=f.part;this.hls.trigger(_.FRAG_LOADED,f);const m=qf(a,e.sn,u.index+1)||Yf(c,e.sn,u.index+1);if(m)h(m);else return o({frag:e,part:p,partsLoaded:d})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===N.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(_.ERROR,t)}else this.hls.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==V.PARSING){!this.fragCurrent&&this.state!==V.STOPPED&&this.state!==V.ERROR&&(this.state=V.IDLE);return}const{frag:a,part:i,level:o}=t,r=self.performance.now();a.stats.parsing.end=r,i&&(i.stats.parsing.end=r),this.updateLevelTiming(a,i,o,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:a}=this,{level:i,sn:o,part:r}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${o} of level ${i}. The current chunk will not be buffered.`),null;const l=t[i],d=r>-1?qf(l,o,r):null,c=d?d.fragment:k6(l,o,a);return c?(a&&a!==c&&(c.stats=a.stats),{frag:c,part:d,level:l}):null}bufferFragmentData(e,t,a,i,o){var r;if(!e||this.state!==V.PARSING)return;const{data1:l,data2:d}=e;let c=l;if(l&&d&&(c=_t(l,d)),!((r=c)!=null&&r.length))return;const h={type:e.type,frag:t,part:a,chunkMeta:i,parent:t.type,data:c};if(this.hls.trigger(_.BUFFER_APPENDING,h),e.dropped&&e.independent&&!a){if(o)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Pe.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const a=t.currentTime,i=Pe.bufferInfo(t,a,0),o=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,o*.25),l=Math.max(Math.min(e.start-r,i.end-r),a+r);e.start-l>r&&this.flushMainBuffer(l,e.start)}getFwdBufferInfo(e,t){const a=this.getLoadPosition();return ae(a)?this.getFwdBufferInfoAtPos(e,a,t):null}getFwdBufferInfoAtPos(e,t,a){const{config:{maxBufferHole:i}}=this,o=Pe.bufferInfo(e,t,i);if(o.len===0&&o.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,a);if(r&&o.nextStart<r.end)return Pe.bufferInfo(e,t,Math.max(o.nextStart,i))}return o}getMaxBufferLength(e){const{config:t}=this;let a;return e?a=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):a=t.maxBufferLength,Math.min(a,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const a=this.config,i=Math.max(Math.min(e-t,a.maxBufferLength),t),o=Math.max(e-t*3,a.maxMaxBufferLength/2,i);return o>=i?(a.maxMaxBufferLength=o,this.warn(`Reduce max buffer length to ${o}s`),!0):!1}getAppendedFrag(e,t=le.MAIN){const a=this.fragmentTracker.getAppendedFrag(e,le.MAIN);return a&&"fragment"in a?a.fragment:a}getNextFragment(e,t){const a=t.fragments,i=a.length;if(!i)return null;const{config:o}=this,r=a[0].start;let l;if(t.live){const d=o.initialLiveManifestSize;if(i<d)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${d})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r)&&(l=this.getInitialLiveFragment(t,a),this.startPosition=this.nextLoadPosition=l?this.hls.liveSyncPosition||l.start:e)}else e<=r&&(l=a[0]);if(!l){const d=o.lowLatencyMode?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,d,t)}return this.mapToInitFragWhenRequired(l)}isLoopLoading(e,t){const a=this.fragmentTracker.getState(e);return(a===Qe.OK||a===Qe.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,a,i,o){const r=e.gap,l=this.getNextFragment(this.nextLoadPosition,t);if(l===null)return l;if(e=l,r&&e&&!e.gap&&a.nextStart){const d=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,i);if(d!==null&&a.len+d.len>=o)return this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,a){let i=-1,o=!1,r=!0;for(let l=0,d=e.length;l<d;l++){const c=e[l];if(r=r&&!c.independent,i>-1&&a<c.start)break;const h=c.loaded;h?i=-1:(o||c.independent||r)&&c.fragment===t&&(i=l),o=h}return i}loadedEndOfParts(e,t){const a=e[e.length-1];return a&&t>a.start&&a.loaded}getInitialLiveFragment(e,t){const a=this.fragPrevious;let i=null;if(a){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${a.programDateTime}`),i=T6(t,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const o=a.sn+1;if(o>=e.startSN&&o<=e.endSN){const r=t[o-e.startSN];a.cc===r.cc&&(i=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=v6(t,a.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const o=this.hls.liveSyncPosition;o!==null&&(i=this.getFragmentAtPosition(o,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,a){const{config:i}=this;let{fragPrevious:o}=this,{fragments:r,endSN:l}=a;const{fragmentHint:d}=a,{maxFragLookUpTolerance:c}=i,h=a.partList,u=!!(i.lowLatencyMode&&h!=null&&h.length&&d);u&&d&&!this.bitrateTest&&(r=r.concat(d),l=d.sn);let f;if(e<t){const p=e>t-c?0:c;f=ai(o,r,e,p)}else f=r[r.length-1];if(f){const p=f.sn-a.startSN,m=this.fragmentTracker.getState(f);if((m===Qe.OK||m===Qe.PARTIAL&&f.gap)&&(o=f),o&&f.sn===o.sn&&(!u||h[0].fragment.sn>f.sn)&&o&&f.level===o.level){const y=r[p+1];f.sn<l&&this.fragmentTracker.getState(y)!==Qe.OK?f=y:f=null}}return f}synchronizeToLiveEdge(e){const{config:t,media:a}=this;if(!a)return;const i=this.hls.liveSyncPosition,o=a.currentTime,r=e.fragments[0].start,l=e.edge,d=o>=r-t.maxFragLookUpTolerance&&o<=l;if(i!==null&&a.duration>i&&(o<i||!d)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!d&&a.readyState<4||o<l-c)&&(this.loadedmetadata||(this.nextLoadPosition=i),a.readyState&&(this.warn(`Playback: ${o.toFixed(3)} is located too far from the end of live sliding playlist: ${l}, reset currentTime to : ${i.toFixed(3)}`),a.currentTime=i))}}alignPlaylists(e,t,a){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const o=e.fragments[0].start,r=!t,l=e.alignedSliding&&ae(o);if(r||!l&&!o){const{fragPrevious:d}=this;W6(d,a,e);const c=e.fragments[0].start;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${d?d.sn:"na"} fragments: ${i}`),c}return o}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let a=this.startPosition;if(a<t&&(a=-1),a===-1||this.lastCurrentTime===-1){const i=this.startTimeOffset!==null,o=i?this.startTimeOffset:e.startTimeOffset;o!==null&&ae(o)?(a=t+o,o<0&&(a+=e.totalduration),a=Math.min(Math.max(t,a),t+e.totalduration),this.log(`Start time offset ${o} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${a}`),this.startPosition=a):e.live?a=this.hls.liveSyncPosition||t:this.startPosition=a=0,this.lastCurrentTime=a}this.nextLoadPosition=a}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==V.FRAG_LOADING_WAITING_RETRY)&&(this.state=V.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const h=this.getCurrentContext(t.chunkMeta);h&&(t.frag=h.frag)}const a=t.frag;if(!a||a.type!==e||!this.levels)return;if(this.fragContextChanged(a)){var i;this.warn(`Frag load error must match current frag to retry ${a.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const o=t.details===N.FRAG_GAP;o&&this.fragmentTracker.fragBuffered(a,!0);const r=t.errorAction,{action:l,retryCount:d=0,retryConfig:c}=r||{};if(r&&l===it.RetryRequest&&c){this.resetStartWhenNotLoaded(this.levelLastLoaded);const h=pl(c,d);this.warn(`Fragment ${a.sn} of ${e} ${a.level} errored with ${t.details}, retrying loading ${d+1}/${c.maxNumRetry} in ${h}ms`),r.resolved=!0,this.retryDate=self.performance.now()+h,this.state=V.FRAG_LOADING_WAITING_RETRY}else if(c&&r)if(this.resetFragmentErrors(e),d<c.maxNumRetry)!o&&l!==it.RemoveAlternatePermanently&&(r.resolved=!0);else{A.warn(`${t.details} reached or exceeded max retry (${d})`);return}else(r==null?void 0:r.action)===it.SendAlternateToPenaltyBox?this.state=V.WAITING_LEVEL:this.state=V.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===V.PARSING||this.state===V.PARSED){const t=e.frag,a=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,a),o=i&&i.len>.5;o&&this.reduceMaxBufferLength(i.len,(t==null?void 0:t.duration)||10);const r=!o;return r&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${a} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===le.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==V.STOPPED&&(this.state=V.IDLE)}afterBufferFlushed(e,t,a){if(!e)return;const i=Pe.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,a),this.state===V.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=V.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,a,i){var o;const r=a.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((d,c)=>{const h=e.elementaryStreams[c];if(h){const u=h.endPTS-h.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${u})`),d||!1;const f=i?0:Wf(r,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS);return this.hls.trigger(_.LEVEL_PTS_UPDATED,{details:r,level:a,drift:f,type:c,frag:e,start:h.startPTS,end:h.endPTS}),!0}return d},!1)&&((o=this.transmuxer)==null?void 0:o.error)===null){const d=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(a.fragmentError===0&&(a.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(d.message),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of level "${a.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=V.PARSED,this.hls.trigger(_.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class lp{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let a;if(e.length)e.length===1?a=e[0]:a=tN(e,t);else return new Uint8Array(0);return this.reset(),a}reset(){this.chunks.length=0,this.dataLength=0}}function tN(s,e){const t=new Uint8Array(e);let a=0;for(let i=0;i<s.length;i++){const o=s[i];t.set(o,a),a+=o.length}return t}function sN(){return typeof __HLS_WORKER_BUNDLE__=="function"}function aN(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function nN(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Wt(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class wl{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,a,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,a){}demux(e,t){this.cachedData&&(e=_t(this.cachedData,e),this.cachedData=null);let a=Ta(e,0),i=a?a.length:0,o;const r=this._audioTrack,l=this._id3Track,d=a?tl(a):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&ae(d))&&(this.basePTS=iN(d,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),a&&a.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Pt.audioId3,duration:Number.POSITIVE_INFINITY});i<c;){if(this.canParse(e,i)){const h=this.appendFrame(r,e,i);h?(this.frameIndex++,this.lastPTS=h.sample.pts,i+=h.length,o=i):i=c}else xB(e,i)?(a=Ta(e,i),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Pt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=a.length,o=i):i++;if(i===c&&o!==c){const h=Es(e,o);this.cachedData?this.cachedData=_t(this.cachedData,h):this.cachedData=h}}return{audioTrack:r,videoTrack:Wt(),id3Track:l,textTrack:Wt()}}demuxSampleAes(e,t,a){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Wt(),id3Track:this._id3Track,textTrack:Wt()}}destroy(){}}const iN=(s,e,t)=>{if(ae(s))return s*90;const a=t?t.baseTime*9e4/t.timescale:0;return e*9e4+a};function oN(s,e,t,a){let i,o,r,l;const d=navigator.userAgent.toLowerCase(),c=a,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>h.length-1){const f=new Error(`invalid ADTS sampling index:${u}`);s.emit(_.ERROR,_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}return r=(e[t+2]&1)<<2,r|=(e[t+3]&192)>>>6,A.log(`manifest codec:${a}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(d)?u>=6?(i=5,l=new Array(4),o=u-3):(i=2,l=new Array(2),o=u):d.indexOf("android")!==-1?(i=2,l=new Array(2),o=u):(i=5,l=new Array(4),a&&(a.indexOf("mp4a.40.29")!==-1||a.indexOf("mp4a.40.5")!==-1)||!a&&u>=6?o=u-3:((a&&a.indexOf("mp4a.40.2")!==-1&&(u>=6&&r===1||/vivaldi/i.test(d))||!a&&r===1)&&(i=2,l=new Array(2)),o=u)),l[0]=i<<3,l[0]|=(u&14)>>1,l[1]|=(u&1)<<7,l[1]|=r<<3,i===5&&(l[1]|=(o&14)>>1,l[2]=(o&1)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:h[u],channelCount:r,codec:"mp4a.40."+i,manifestCodec:c}}function cp(s,e){return s[e]===255&&(s[e+1]&246)===240}function dp(s,e){return s[e+1]&1?7:9}function kl(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function rN(s,e){return e+5<s.length}function li(s,e){return e+1<s.length&&cp(s,e)}function lN(s,e){return rN(s,e)&&cp(s,e)&&kl(s,e)<=s.length-e}function cN(s,e){if(li(s,e)){const t=dp(s,e);if(e+t>=s.length)return!1;const a=kl(s,e);if(a<=t)return!1;const i=e+a;return i===s.length||li(s,i)}return!1}function hp(s,e,t,a,i){if(!s.samplerate){const o=oN(e,t,a,i);if(!o)return;s.config=o.config,s.samplerate=o.samplerate,s.channelCount=o.channelCount,s.codec=o.codec,s.manifestCodec=o.manifestCodec,A.log(`parsed codec:${s.codec}, rate:${o.samplerate}, channels:${o.channelCount}`)}}function up(s){return 1024*9e4/s}function dN(s,e){const t=dp(s,e);if(e+t<=s.length){const a=kl(s,e)-t;if(a>0)return{headerLength:t,frameLength:a}}}function mp(s,e,t,a,i){const o=up(s.samplerate),r=a+i*o,l=dN(e,t);let d;if(l){const{frameLength:u,headerLength:f}=l,p=f+u,m=Math.max(0,t+p-e.length);m?(d=new Uint8Array(p-f),d.set(e.subarray(t+f,e.length),0)):d=e.subarray(t+f,t+p);const g={unit:d,pts:r};return m||s.samples.push(g),{sample:g,length:p,missing:m}}const c=e.length-t;return d=new Uint8Array(c),d.set(e.subarray(t,e.length),0),{sample:{unit:d,pts:r},length:c,missing:-1}}let ci=null;const hN=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],uN=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],mN=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],fN=[0,1,1,4];function fp(s,e,t,a,i){if(t+24>e.length)return;const o=pp(e,t);if(o&&t+o.frameLength<=e.length){const r=o.samplesPerFrame*9e4/o.sampleRate,l=a+i*r,d={unit:e.subarray(t,t+o.frameLength),pts:l,dts:l};return s.config=[],s.channelCount=o.channelCount,s.samplerate=o.sampleRate,s.samples.push(d),{sample:d,length:o.frameLength,missing:0}}}function pp(s,e){const t=s[e+1]>>3&3,a=s[e+1]>>1&3,i=s[e+2]>>4&15,o=s[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&o!==3){const r=s[e+2]>>1&1,l=s[e+3]>>6,d=t===3?3-a:a===3?3:4,c=hN[d*14+i-1]*1e3,u=uN[(t===3?0:t===2?1:2)*3+o],f=l===3?1:2,p=mN[t][a],m=fN[a],g=p*8*m,y=Math.floor(p*c/u+r)*m;if(ci===null){const w=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ci=w?parseInt(w[1]):0}return!!ci&&ci<=87&&a===2&&c>=224e3&&l===0&&(s[e+3]=s[e+3]|128),{sampleRate:u,channelCount:f,frameLength:y,samplesPerFrame:g}}}function El(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function gp(s,e){return e+1<s.length&&El(s,e)}function pN(s,e){return El(s,e)&&4<=s.length-e}function yp(s,e){if(e+1<s.length&&El(s,e)){const a=pp(s,e);let i=4;a!=null&&a.frameLength&&(i=a.frameLength);const o=e+i;return o===s.length||gp(s,o)}return!1}class gN extends wl{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,a,i){super.resetInitSegment(e,t,a,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Ta(e,0);let a=(t==null?void 0:t.length)||0;if(yp(e,a))return!1;for(let i=e.length;a<i;a++)if(cN(e,a))return A.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return lN(e,t)}appendFrame(e,t,a){hp(e,this.observer,t,a,e.manifestCodec);const i=mp(e,t,a,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const yN=/\/emsg[-/]ID3/i;class bN{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,a,i){const o=this.videoTrack=Wt("video",1),r=this.audioTrack=Wt("audio",1),l=this.txtTrack=Wt("text",1);if(this.id3Track=Wt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const d=Sf(e);if(d.video){const{id:c,timescale:h,codec:u}=d.video;o.id=c,o.timescale=l.timescale=h,o.codec=u}if(d.audio){const{id:c,timescale:h,codec:u}=d.audio;r.id=c,r.timescale=h,r.codec=u}l.id=pf.text,o.sampleDuration=0,o.duration=r.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return PB(e)}demux(e,t){this.timeOffset=t;let a=e;const i=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(a=_t(this.remainderData,e));const l=GB(a);this.remainderData=l.remainder,i.samples=l.valid||new Uint8Array}else i.samples=a;const r=this.extractID3Track(i,t);return o.samples=wf(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,a=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return a.samples=wf(e,t),{videoTrack:t,audioTrack:Wt(),id3Track:i,textTrack:Wt()}}extractID3Track(e,t){const a=this.id3Track;if(e.samples.length){const i=Se(e.samples,["emsg"]);i&&i.forEach(o=>{const r=WB(o);if(yN.test(r.schemeIdUri)){const l=ae(r.presentationTime)?r.presentationTime/r.timeScale:t+r.presentationTimeDelta/r.timeScale;let d=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;d<=.001&&(d=Number.POSITIVE_INFINITY);const c=r.payload;a.samples.push({data:c,len:c.byteLength,dts:l,pts:l,type:Pt.emsg,duration:d})}})}return a}demuxSampleAes(e,t,a){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const bp=(s,e)=>{let t=0,a=5;e+=a;const i=new Uint32Array(1),o=new Uint32Array(1),r=new Uint8Array(1);for(;a>0;){r[0]=s[e];const l=Math.min(a,8),d=8-l;o[0]=4278190080>>>24+d<<d,i[0]=(r[0]&o[0])>>d,t=t?t<<l|i[0]:i[0],e+=1,a-=l}return t};class SN extends wl{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,a,i){super.resetInitSegment(e,t,a,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,a){const i=Sp(e,t,a,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=Ta(e,0);if(!t)return!1;const a=t.length;return e[a]===11&&e[a+1]===119&&tl(t)!==void 0&&bp(e,a)<16}}function Sp(s,e,t,a,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const o=e[t+4]>>6;if(o>=3)return-1;const l=[48e3,44100,32e3][o],d=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][d*3+o]*2;if(t+h>e.length)return-1;const u=e[t+6]>>5;let f=0;u===2?f+=2:(u&1&&u!==1&&(f+=2),u&4&&(f+=2));const p=(e[t+6]<<8|e[t+7])>>12-f&1,g=[2,1,2,3,3,4,4,5][u]+p,y=e[t+5]>>3,b=e[t+5]&7,S=new Uint8Array([o<<6|y<<1|b>>2,(b&3)<<6|u<<3|p<<2|d>>4,d<<4&224]),w=1536/l*9e4,x=a+i*w,T=e.subarray(t,t+h);return s.config=S,s.channelCount=g,s.samplerate=l,s.samples.push({unit:T,pts:x}),h}class _N{constructor(){this.VideoSample=null}createVideoSample(e,t,a,i){return{key:e,frame:!1,pts:t,dts:a,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let a=this.VideoSample,i;if((!a||a.units.length===0)&&(a=e[e.length-1]),(t=a)!=null&&t.units){const o=a.units;i=o[o.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const a=t.samples,i=a.length;if(i){const o=a[i-1];e.pts=o.pts,e.dts=o.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&A.log(e.pts+"/"+e.dts+":"+e.debug)}}class _p{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,a=e.byteLength-t,i=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw new Error("no bytes available");i.set(e.subarray(a,a+o)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=o*8,this.bytesAvailable-=o}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const a=this.word>>>32-t;if(e>32&&A.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?a<<t|this.readBits(t):a}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,a=8,i;for(let o=0;o<e;o++)a!==0&&(i=this.readEG(),a=(t+i+256)%256),t=a===0?t:a}readSPS(){let e=0,t=0,a=0,i=0,o,r,l;const d=this.readUByte.bind(this),c=this.readBits.bind(this),h=this.readUEG.bind(this),u=this.readBoolean.bind(this),f=this.skipBits.bind(this),p=this.skipEG.bind(this),m=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);d();const y=d();if(c(5),f(3),d(),m(),y===100||y===110||y===122||y===244||y===44||y===83||y===86||y===118||y===128){const v=h();if(v===3&&f(1),m(),m(),f(1),u())for(r=v!==3?8:12,l=0;l<r;l++)u()&&(l<6?g(16):g(64))}m();const b=h();if(b===0)h();else if(b===1)for(f(1),p(),p(),o=h(),l=0;l<o;l++)p();m(),f(1);const S=h(),w=h(),x=c(1);x===0&&f(1),f(1),u()&&(e=h(),t=h(),a=h(),i=h());let T=[1,1];if(u()&&u())switch(d()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[d()<<8|d(),d()<<8|d()];break}}return{width:Math.ceil((S+1)*16-e*2-t*2),height:(2-x)*(w+1)*16-(x?2:4)*(a+i),pixelRatio:T}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class wN extends _N{parseAVCPES(e,t,a,i,o){const r=this.parseAVCNALu(e,a.data);let l=this.VideoSample,d,c=!1;a.data=null,l&&r.length&&!e.audFound&&(this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts,"")),r.forEach(h=>{var u;switch(h.type){case 1:{let g=!1;d=!0;const y=h.data;if(c&&y.length>4){const b=new _p(y).readSliceType();(b===2||b===4||b===7||b===9)&&(g=!0)}if(g){var f;(f=l)!=null&&f.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null)}l||(l=this.VideoSample=this.createVideoSample(!0,a.pts,a.dts,"")),l.frame=!0,l.key=g;break}case 5:d=!0,(u=l)!=null&&u.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null),l||(l=this.VideoSample=this.createVideoSample(!0,a.pts,a.dts,"")),l.key=!0,l.frame=!0;break;case 6:{d=!0,kf(h.data,1,a.pts,t.samples);break}case 7:{var p,m;d=!0,c=!0;const g=h.data,b=new _p(g).readSPS();if(!e.sps||e.width!==b.width||e.height!==b.height||((p=e.pixelRatio)==null?void 0:p[0])!==b.pixelRatio[0]||((m=e.pixelRatio)==null?void 0:m[1])!==b.pixelRatio[1]){e.width=b.width,e.height=b.height,e.pixelRatio=b.pixelRatio,e.sps=[g],e.duration=o;const S=g.subarray(1,4);let w="avc1.";for(let x=0;x<3;x++){let T=S[x].toString(16);T.length<2&&(T="0"+T),w+=T}e.codec=w}break}case 8:d=!0,e.pps=[h.data];break;case 9:d=!0,e.audFound=!0,l&&this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts,"");break;case 12:d=!0;break;default:d=!1,l&&(l.debug+="unknown NAL "+h.type+" ");break}l&&d&&l.units.push(h)}),i&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)}parseAVCNALu(e,t){const a=t.byteLength;let i=e.naluState||0;const o=i,r=[];let l=0,d,c,h,u=-1,f=0;for(i===-1&&(u=0,f=t[0]&31,i=0,l=1);l<a;){if(d=t[l++],!i){i=d?0:1;continue}if(i===1){i=d?0:2;continue}if(!d)i=3;else if(d===1){if(c=l-i-1,u>=0){const p={data:t.subarray(u,c),type:f};r.push(p)}else{const p=this.getLastNalUnit(e.samples);p&&(o&&l<=4-o&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-o)),c>0&&(p.data=_t(p.data,t.subarray(0,c)),p.state=0))}l<a?(h=t[l]&31,u=l,f=h,i=0):i=-1}else i=0}if(u>=0&&i>=0){const p={data:t.subarray(u,a),type:f,state:i};r.push(p)}if(r.length===0){const p=this.getLastNalUnit(e.samples);p&&(p.data=_t(p.data,t))}return e.naluState=i,r}}class kN{constructor(e,t,a){this.keyData=void 0,this.decrypter=void 0,this.keyData=a,this.decrypter=new Sl(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,a){const i=e[t].unit;if(i.length<=16)return;const o=i.subarray(16,i.length-i.length%16),r=o.buffer.slice(o.byteOffset,o.byteOffset+o.length);this.decryptBuffer(r).then(l=>{const d=new Uint8Array(l);i.set(d,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,a)})}decryptAacSamples(e,t,a){for(;;t++){if(t>=e.length){a();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,a),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,a=new Int8Array(t);let i=0;for(let o=32;o<e.length-16;o+=160,i+=16)a.set(e.subarray(o,o+16),i);return a}getAvcDecryptedUnit(e,t){const a=new Uint8Array(t);let i=0;for(let o=32;o<e.length-16;o+=160,i+=16)e.set(a.subarray(i,i+16),o);return e}decryptAvcSample(e,t,a,i,o){const r=Ef(o.data),l=this.getAvcEncryptedData(r);this.decryptBuffer(l.buffer).then(d=>{o.data=this.getAvcDecryptedUnit(r,d),this.decrypter.isSync()||this.decryptAvcSamples(e,t,a+1,i)})}decryptAvcSamples(e,t,a,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,a=0){if(t>=e.length){i();return}const o=e[t].units;for(;!(a>=o.length);a++){const r=o[a];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,a,i,r),!this.decrypter.isSync()))return}}}}const et=188;class rs{constructor(e,t,a){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.videoParser=new wN}static probe(e){const t=rs.syncOffset(e);return t>0&&A.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let a=Math.min(et*5,t-et)+1,i=0;for(;i<a;){let o=!1,r=-1,l=0;for(let d=i;d<t;d+=et)if(e[d]===71&&(t-d===et||e[d+et]===71)){if(l++,r===-1&&(r=d,r!==0&&(a=Math.min(r+et*99,e.length-et)+1)),o||(o=Tl(e,d)===0),o&&l>1&&(r===0&&l>2||d+et>a))return r}else{if(l)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:pf[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,a,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=rs.createTrack("video"),this._audioTrack=rs.createTrack("audio",i),this._id3Track=rs.createTrack("id3"),this._txtTrack=rs.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=a,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:a}=this;e&&(e.pesData=null),t&&(t.pesData=null),a&&(a.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,a=!1,i=!1){a||(this.sampleAes=null);let o;const r=this._videoTrack,l=this._audioTrack,d=this._id3Track,c=this._txtTrack;let h=r.pid,u=r.pesData,f=l.pid,p=d.pid,m=l.pesData,g=d.pesData,y=null,b=this.pmtParsed,S=this._pmtId,w=e.length;if(this.remainderData&&(e=_t(this.remainderData,e),w=e.length,this.remainderData=null),w<et&&!i)return this.remainderData=e,{audioTrack:l,videoTrack:r,id3Track:d,textTrack:c};const x=Math.max(0,rs.syncOffset(e));w-=(w-x)%et,w<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,w,e.buffer.byteLength-w));let T=0;for(let E=x;E<w;E+=et)if(e[E]===71){const B=!!(e[E+1]&64),I=Tl(e,E),R=(e[E+3]&48)>>4;let M;if(R>1){if(M=E+5+e[E+4],M===E+et)continue}else M=E+4;switch(I){case h:B&&(u&&(o=Ws(u))&&this.videoParser.parseAVCPES(r,c,o,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(M,E+et)),u.size+=E+et-M);break;case f:if(B){if(m&&(o=Ws(m)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,o);break;case"mp3":this.parseMPEGPES(l,o);break;case"ac3":this.parseAC3PES(l,o);break}m={data:[],size:0}}m&&(m.data.push(e.subarray(M,E+et)),m.size+=E+et-M);break;case p:B&&(g&&(o=Ws(g))&&this.parseID3PES(d,o),g={data:[],size:0}),g&&(g.data.push(e.subarray(M,E+et)),g.size+=E+et-M);break;case 0:B&&(M+=e[M]+1),S=this._pmtId=EN(e,M);break;case S:{B&&(M+=e[M]+1);const K=TN(e,M,this.typeSupported,a,this.observer);h=K.videoPid,h>0&&(r.pid=h,r.segmentCodec=K.segmentVideoCodec),f=K.audioPid,f>0&&(l.pid=f,l.segmentCodec=K.segmentAudioCodec),p=K.id3Pid,p>0&&(d.pid=p),y!==null&&!b&&(A.warn(`MPEG-TS PMT found at ${E} after unknown PID '${y}'. Backtracking to sync byte @${x} to parse all TS packets.`),y=null,E=x-188),b=this.pmtParsed=!0;break}case 17:case 8191:break;default:y=I;break}}else T++;T>0&&di(this.observer,new Error(`Found ${T} TS packet/s that do not start with 0x47`)),r.pesData=u,l.pesData=m,d.pesData=g;const v={audioTrack:l,videoTrack:r,id3Track:d,textTrack:c};return i&&this.extractRemainingSamples(v),v}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:a,id3Track:i,textTrack:o}=e,r=a.pesData,l=t.pesData,d=i.pesData;let c;if(r&&(c=Ws(r))?(this.videoParser.parseAVCPES(a,o,c,!0,this._duration),a.pesData=null):a.pesData=r,l&&(c=Ws(l))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else l!=null&&l.size&&A.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=l;d&&(c=Ws(d))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=d}demuxSampleAes(e,t,a){const i=this.demux(e,a,!0,!this.config.progressive),o=this.sampleAes=new kN(this.observer,this.config,t);return this.decrypt(i,o)}decrypt(e,t){return new Promise(a=>{const{audioTrack:i,videoTrack:o}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{o.samples?t.decryptAvcSamples(o.samples,0,0,()=>{a(e)}):a(e)}):o.samples&&t.decryptAvcSamples(o.samples,0,0,()=>{a(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let a=0;const i=this.aacOverFlow;let o=t.data;if(i){this.aacOverFlow=null;const u=i.missing,f=i.sample.unit.byteLength;if(u===-1)o=_t(i.sample.unit,o);else{const p=f-u;i.sample.unit.set(o.subarray(0,u),p),e.samples.push(i.sample),a=i.missing}}let r,l;for(r=a,l=o.length;r<l-1&&!li(o,r);r++);if(r!==a){let u;const f=r<l-1;if(f?u=`AAC PES did not start with ADTS header,offset:${r}`:u="No ADTS header found in AAC PES",di(this.observer,new Error(u),f),!f)return}hp(e,this.observer,o,r,this.audioCodec);let d;if(t.pts!==void 0)d=t.pts;else if(i){const u=up(e.samplerate);d=i.sample.pts+u}else{A.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,h;for(;r<l;)if(h=mp(e,o,r,d,c),r+=h.length,h.missing){this.aacOverFlow=h;break}else for(c++;r<l-1&&!li(o,r);r++);}parseMPEGPES(e,t){const a=t.data,i=a.length;let o=0,r=0;const l=t.pts;if(l===void 0){A.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<i;)if(gp(a,r)){const d=fp(e,a,r,l,o);if(d)r+=d.length,o++;else break}else r++}parseAC3PES(e,t){{const a=t.data,i=t.pts;if(i===void 0){A.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const o=a.length;let r=0,l=0,d;for(;l<o&&(d=Sp(e,a,l,i,r++))>0;)l+=d}}parseID3PES(e,t){if(t.pts===void 0){A.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const a=je({},t,{type:this._videoTrack?Pt.emsg:Pt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(a)}}function Tl(s,e){return((s[e+1]&31)<<8)+s[e+2]}function EN(s,e){return(s[e+10]&31)<<8|s[e+11]}function TN(s,e,t,a,i){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},r=(s[e+1]&15)<<8|s[e+2],l=e+3+r-4,d=(s[e+10]&15)<<8|s[e+11];for(e+=12+d;e<l;){const c=Tl(s,e),h=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!a){Cl("ADTS AAC");break}case 15:o.audioPid===-1&&(o.audioPid=c);break;case 21:o.id3Pid===-1&&(o.id3Pid=c);break;case 219:if(!a){Cl("H.264");break}case 27:o.videoPid===-1&&(o.videoPid=c,o.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?A.log("MPEG audio found, not supported in this browser"):o.audioPid===-1&&(o.audioPid=c,o.segmentAudioCodec="mp3");break;case 193:if(!a){Cl("AC-3");break}case 129:t.ac3?o.audioPid===-1&&(o.audioPid=c,o.segmentAudioCodec="ac3"):A.log("AC-3 audio found, not supported in this browser");break;case 6:if(o.audioPid===-1&&h>0){let u=e+5,f=h;for(;f>2;){switch(s[u]){case 106:t.ac3!==!0?A.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=c,o.segmentAudioCodec="ac3");break}const m=s[u+1]+2;u+=m,f-=m}}break;case 194:case 135:return di(i,new Error("Unsupported EC-3 in M2TS found")),o;case 36:return di(i,new Error("Unsupported HEVC in M2TS found")),o}e+=h+5}return o}function di(s,e,t){A.warn(`parsing error: ${e.message}`),s.emit(_.ERROR,_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Cl(s){A.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function Ws(s){let e=0,t,a,i,o,r;const l=s.data;if(!s||s.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=_t(l[0],l[1]),l.splice(1,1);if(t=l[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(a=(t[4]<<8)+t[5],a&&a>s.size-6)return null;const c=t[7];c&192&&(o=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,c&64?(r=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,o-r>60*9e4&&(A.warn(`${Math.round((o-r)/9e4)}s delta between PTS and DTS, align them`),o=r)):r=o),i=t[8];let h=i+9;if(s.size<=h)return null;s.size-=h;const u=new Uint8Array(s.size);for(let f=0,p=l.length;f<p;f++){t=l[f];let m=t.byteLength;if(h)if(h>m){h-=m;continue}else t=t.subarray(h),m-=h,h=0;u.set(t,e),e+=m}return a&&(a-=i+3),{data:u,pts:o,dts:r,len:a}}return null}class CN extends wl{resetInitSegment(e,t,a,i){super.resetInitSegment(e,t,a,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Ta(e,0);let a=(t==null?void 0:t.length)||0;if(t&&e[a]===11&&e[a+1]===119&&tl(t)!==void 0&&bp(e,a)<=16)return!1;for(let i=e.length;a<i;a++)if(yp(e,a))return A.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return pN(e,t)}appendFrame(e,t,a){if(this.basePTS!==null)return fp(e,t,a,this.basePTS,this.frameIndex)}}class wp{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const ls=Math.pow(2,32)-1;class L{static init(){L.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in L.types)L.types.hasOwnProperty(e)&&(L.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),a=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);L.HDLR_TYPES={video:t,audio:a};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),o=new Uint8Array([0,0,0,0,0,0,0,0]);L.STTS=L.STSC=L.STCO=o,L.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),L.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),L.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const r=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),d=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,r,d,r,l),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,i))}static box(e,...t){let a=8,i=t.length;const o=i;for(;i--;)a+=t[i].byteLength;const r=new Uint8Array(a);for(r[0]=a>>24&255,r[1]=a>>16&255,r[2]=a>>8&255,r[3]=a&255,r.set(e,4),i=0,a=8;i<o;i++)r.set(t[i],a),a+=t[i].byteLength;return r}static hdlr(e){return L.box(L.types.hdlr,L.HDLR_TYPES[e])}static mdat(e){return L.box(L.types.mdat,e)}static mdhd(e,t){t*=e;const a=Math.floor(t/(ls+1)),i=Math.floor(t%(ls+1));return L.box(L.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return L.box(L.types.mdia,L.mdhd(e.timescale,e.duration),L.hdlr(e.type),L.minf(e))}static mfhd(e){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(e)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(e))}static moof(e,t,a){return L.box(L.types.moof,L.mfhd(e),L.traf(a,t))}static moov(e){let t=e.length;const a=[];for(;t--;)a[t]=L.trak(e[t]);return L.box.apply(null,[L.types.moov,L.mvhd(e[0].timescale,e[0].duration)].concat(a).concat(L.mvex(e)))}static mvex(e){let t=e.length;const a=[];for(;t--;)a[t]=L.trex(e[t]);return L.box.apply(null,[L.types.mvex,...a])}static mvhd(e,t){t*=e;const a=Math.floor(t/(ls+1)),i=Math.floor(t%(ls+1)),o=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return L.box(L.types.mvhd,o)}static sdtp(e){const t=e.samples||[],a=new Uint8Array(4+t.length);let i,o;for(i=0;i<t.length;i++)o=t[i].flags,a[i+4]=o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy;return L.box(L.types.sdtp,a)}static stbl(e){return L.box(L.types.stbl,L.stsd(e),L.box(L.types.stts,L.STTS),L.box(L.types.stsc,L.STSC),L.box(L.types.stsz,L.STSZ),L.box(L.types.stco,L.STCO))}static avc1(e){let t=[],a=[],i,o,r;for(i=0;i<e.sps.length;i++)o=e.sps[i],r=o.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(o));for(i=0;i<e.pps.length;i++)o=e.pps[i],r=o.byteLength,a.push(r>>>8&255),a.push(r&255),a=a.concat(Array.prototype.slice.call(o));const l=L.box(L.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(a))),d=e.width,c=e.height,h=e.pixelRatio[0],u=e.pixelRatio[1];return L.box(L.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,d>>8&255,d&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,u>>24,u>>16&255,u>>8&255,u&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return L.box(L.types.mp4a,L.audioStsd(e),L.box(L.types.esds,L.esds(e)))}static mp3(e){return L.box(L.types[".mp3"],L.audioStsd(e))}static ac3(e){return L.box(L.types["ac-3"],L.audioStsd(e),L.box(L.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?L.box(L.types.stsd,L.STSD,L.mp3(e)):e.segmentCodec==="ac3"?L.box(L.types.stsd,L.STSD,L.ac3(e)):L.box(L.types.stsd,L.STSD,L.mp4a(e)):L.box(L.types.stsd,L.STSD,L.avc1(e))}static tkhd(e){const t=e.id,a=e.duration*e.timescale,i=e.width,o=e.height,r=Math.floor(a/(ls+1)),l=Math.floor(a%(ls+1));return L.box(L.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,l>>24,l>>16&255,l>>8&255,l&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,o>>8&255,o&255,0,0]))}static traf(e,t){const a=L.sdtp(e),i=e.id,o=Math.floor(t/(ls+1)),r=Math.floor(t%(ls+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,r>>24,r>>16&255,r>>8&255,r&255])),L.trun(e,a.length+16+20+8+16+8+8),a)}static trak(e){return e.duration=e.duration||4294967295,L.box(L.types.trak,L.tkhd(e),L.mdia(e))}static trex(e){const t=e.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const a=e.samples||[],i=a.length,o=12+16*i,r=new Uint8Array(o);let l,d,c,h,u,f;for(t+=8+o,r.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),l=0;l<i;l++)d=a[l],c=d.duration,h=d.size,u=d.flags,f=d.cts,r.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*l);return L.box(L.types.trun,r)}static initSegment(e){L.types||L.init();const t=L.moov(e);return _t(L.FTYP,t)}}L.types=void 0,L.HDLR_TYPES=void 0,L.STTS=void 0,L.STSC=void 0,L.STCO=void 0,L.STSZ=void 0,L.VMHD=void 0,L.SMHD=void 0,L.STSD=void 0,L.FTYP=void 0,L.DINF=void 0;const kp=9e4;function xl(s,e,t=1,a=!1){const i=s*e*t;return a?Math.round(i):i}function xN(s,e,t=1,a=!1){return xl(s,e,1/t,a)}function va(s,e=!1){return xl(s,1e3,1/kp,e)}function vN(s,e=1){return xl(s,kp,1/e)}const AN=10*1e3,Ep=1024,LN=1152,IN=1536;let Ks=null,vl=null;class hi{constructor(e,t,a,i=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.ISGenerated=!1,Ks===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ks=r?parseInt(r[1]):0}if(vl===null){const o=navigator.userAgent.match(/Safari\/(\d+)/i);vl=o?parseInt(o[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){A.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){A.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){A.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const a=e.reduce((i,o)=>{const r=o.pts-i;return r<-4294967296?(t=!0,wt(i,o.pts)):r>0?i:o.pts},e[0].pts);return t&&A.debug("PTS rollover detected"),a}remux(e,t,a,i,o,r,l,d){let c,h,u,f,p,m,g=o,y=o;const b=e.pid>-1,S=t.pid>-1,w=t.samples.length,x=e.samples.length>0,T=l&&w>0||w>1;if((!b||x)&&(!S||T)||this.ISGenerated||l){if(this.ISGenerated){var E,B,I,R;const se=this.videoTrackConfig;se&&(t.width!==se.width||t.height!==se.height||((E=t.pixelRatio)==null?void 0:E[0])!==((B=se.pixelRatio)==null?void 0:B[0])||((I=t.pixelRatio)==null?void 0:I[1])!==((R=se.pixelRatio)==null?void 0:R[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,o,r);const M=this.isVideoContiguous;let K=-1,H;if(T&&(K=RN(t.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,K>0){A.warn(`[mp4-remuxer]: Dropped ${K} out of ${w} video samples due to a missing keyframe`);const se=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(K),t.dropped+=K,y+=(t.samples[0].pts-se)/t.inputTimeScale,H=y}else K===-1&&(A.warn(`[mp4-remuxer]: No keyframe found out of ${w} video samples`),m=!1);if(this.ISGenerated){if(x&&T){const se=this.getVideoStartPts(t.samples),ne=(wt(e.samples[0].pts,se)-se)/t.inputTimeScale;g+=Math.max(0,ne),y+=Math.max(0,-ne)}if(x){if(e.samplerate||(A.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,o,r)),h=this.remuxAudio(e,g,this.isAudioContiguous,r,S||T||d===le.AUDIO?y:void 0),T){const se=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(A.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,o,r)),c=this.remuxVideo(t,y,M,se)}}else T&&(c=this.remuxVideo(t,y,M,0));c&&(c.firstKeyFrame=K,c.independent=K!==-1,c.firstKeyFramePTS=H)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(a.samples.length&&(p=Tp(a,o,this._initPTS,this._initDTS)),i.samples.length&&(f=Cp(i,o,this._initPTS))),{audio:h,video:c,initSegment:u,independent:m,text:f,id3:p}}generateIS(e,t,a,i){const o=e.samples,r=t.samples,l=this.typeSupported,d={},c=this._initPTS;let h=!c||i,u="audio/mp4",f,p,m;if(h&&(f=p=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(u="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}d.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&l.mpeg?new Uint8Array(0):L.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(m=e.inputTimeScale,!c||m!==c.timescale?f=p=o[0].pts-Math.round(m*a):h=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:L.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(m=t.inputTimeScale,!c||m!==c.timescale){const g=this.getVideoStartPts(r),y=Math.round(m*a);p=Math.min(p,wt(r[0].dts,g)-y),f=Math.min(f,g-y)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(d).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:f,timescale:m},this._initDTS={baseTime:p,timescale:m}):f=m=void 0,{tracks:d,initPTS:f,timescale:m}}remuxVideo(e,t,a,i){const o=e.inputTimeScale,r=e.samples,l=[],d=r.length,c=this._initPTS;let h=this.nextAvcDts,u=8,f=this.videoSampleDuration,p,m,g=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,b=!1;if(!a||h===null){const Z=t*o,q=r[0].pts-wt(r[0].dts,r[0].pts);Ks&&h!==null&&Math.abs(Z-q-h)<15e3?a=!0:h=Z-q}const S=c.baseTime*o/c.timescale;for(let Z=0;Z<d;Z++){const q=r[Z];q.pts=wt(q.pts-S,h),q.dts=wt(q.dts-S,h),q.dts<r[Z>0?Z-1:Z].dts&&(b=!0)}b&&r.sort(function(Z,q){const he=Z.dts-q.dts,J=Z.pts-q.pts;return he||J}),p=r[0].dts,m=r[r.length-1].dts;const w=m-p,x=w?Math.round(w/(d-1)):f||e.inputTimeScale/30;if(a){const Z=p-h,q=Z>x,he=Z<-1;if((q||he)&&(q?A.warn(`AVC: ${va(Z,!0)} ms (${Z}dts) hole between fragments detected at ${t.toFixed(3)}`):A.warn(`AVC: ${va(-Z,!0)} ms (${Z}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!he||h>=r[0].pts||Ks)){p=h;const J=r[0].pts-Z;if(q)r[0].dts=p,r[0].pts=J;else for(let X=0;X<r.length&&!(r[X].dts>J);X++)r[X].dts-=Z,r[X].pts-=Z;A.log(`Video: Initial PTS/DTS adjusted: ${va(J,!0)}/${va(p,!0)}, delta: ${va(Z,!0)} ms`)}}p=Math.max(0,p);let T=0,v=0,E=p;for(let Z=0;Z<d;Z++){const q=r[Z],he=q.units,J=he.length;let X=0;for(let ue=0;ue<J;ue++)X+=he[ue].data.length;v+=X,T+=J,q.length=X,q.dts<E?(q.dts=E,E+=x/4|0||1):E=q.dts,g=Math.min(q.pts,g),y=Math.max(q.pts,y)}m=r[d-1].dts;const B=v+4*T+8;let I;try{I=new Uint8Array(B)}catch(Z){this.observer.emit(_.ERROR,_.ERROR,{type:pe.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:Z,bytes:B,reason:`fail allocating video mdat ${B}`});return}const R=new DataView(I.buffer);R.setUint32(0,B),I.set(L.types.mdat,4);let M=!1,K=Number.POSITIVE_INFINITY,H=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,oe=Number.NEGATIVE_INFINITY;for(let Z=0;Z<d;Z++){const q=r[Z],he=q.units;let J=0;for(let be=0,xe=he.length;be<xe;be++){const te=he[be],Te=te.data,Ce=te.data.byteLength;R.setUint32(u,Ce),u+=4,I.set(Te,u),u+=Ce,J+=4+Ce}let X;if(Z<d-1)f=r[Z+1].dts-q.dts,X=r[Z+1].pts-q.pts;else{const be=this.config,xe=Z>0?q.dts-r[Z-1].dts:x;if(X=Z>0?q.pts-r[Z-1].pts:x,be.stretchShortVideoTrack&&this.nextAudioPts!==null){const te=Math.floor(be.maxBufferHole*o),Te=(i?g+i*o:this.nextAudioPts)-q.pts;Te>te?(f=Te-xe,f<0?f=xe:M=!0,A.log(`[mp4-remuxer]: It is approximately ${Te/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=xe}else f=xe}const ue=Math.round(q.pts-q.dts);K=Math.min(K,f),se=Math.max(se,f),H=Math.min(H,X),oe=Math.max(oe,X),l.push(new xp(q.key,f,J,ue))}if(l.length){if(Ks){if(Ks<70){const Z=l[0].flags;Z.dependsOn=2,Z.isNonSync=0}}else if(vl&&oe-H<se-K&&x/se<.025&&l[0].cts===0){A.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Z=p;for(let q=0,he=l.length;q<he;q++){const J=Z+l[q].duration,X=Z+l[q].cts;if(q<he-1){const ue=J+l[q+1].cts;l[q].duration=ue-X}else l[q].duration=q?l[q-1].duration:x;l[q].cts=0,Z=J}}}f=M||!f?x:f,this.nextAvcDts=h=m+f,this.videoSampleDuration=f,this.isVideoContiguous=!0;const de={data1:L.moof(e.sequenceNumber++,p,je({},e,{samples:l})),data2:I,startPTS:g/o,endPTS:(y+f)/o,startDTS:p/o,endDTS:h/o,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,de}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return LN;case"ac3":return IN;default:return Ep}}remuxAudio(e,t,a,i,o){const r=e.inputTimeScale,l=e.samplerate?e.samplerate:r,d=r/l,c=this.getSamplesPerFrame(e),h=c*d,u=this._initPTS,f=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,p=[],m=o!==void 0;let g=e.samples,y=f?0:8,b=this.nextAudioPts||-1;const S=t*r,w=u.baseTime*r/u.timescale;if(this.isAudioContiguous=a=a||g.length&&b>0&&(i&&Math.abs(S-b)<9e3||Math.abs(wt(g[0].pts-w,S)-b)<20*h),g.forEach(function(ne){ne.pts=wt(ne.pts-w,S)}),!a||b<0){if(g=g.filter(ne=>ne.pts>=0),!g.length)return;o===0?b=0:i&&!m?b=Math.max(0,S):b=g[0].pts}if(e.segmentCodec==="aac"){const ne=this.config.maxAudioFramesDrift;for(let ce=0,de=b;ce<g.length;ce++){const Z=g[ce],q=Z.pts,he=q-de,J=Math.abs(1e3*he/r);if(he<=-ne*h&&m)ce===0&&(A.warn(`Audio frame @ ${(q/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*he/r)} ms.`),this.nextAudioPts=b=de=q);else if(he>=ne*h&&J<AN&&m){let X=Math.round(he/h);de=q-X*h,de<0&&(X--,de+=h),ce===0&&(this.nextAudioPts=b=de),A.warn(`[mp4-remuxer]: Injecting ${X} audio frame @ ${(de/r).toFixed(3)}s due to ${Math.round(1e3*he/r)} ms gap.`);for(let ue=0;ue<X;ue++){const be=Math.max(de,0);let xe=wp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);xe||(A.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=Z.unit.subarray()),g.splice(ce,0,{unit:xe,pts:be}),de+=h,ce++}}Z.pts=de,de+=h}}let x=null,T=null,v,E=0,B=g.length;for(;B--;)E+=g[B].unit.byteLength;for(let ne=0,ce=g.length;ne<ce;ne++){const de=g[ne],Z=de.unit;let q=de.pts;if(T!==null){const J=p[ne-1];J.duration=Math.round((q-T)/d)}else if(a&&e.segmentCodec==="aac"&&(q=b),x=q,E>0){E+=y;try{v=new Uint8Array(E)}catch(J){this.observer.emit(_.ERROR,_.ERROR,{type:pe.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:J,bytes:E,reason:`fail allocating audio mdat ${E}`});return}f||(new DataView(v.buffer).setUint32(0,E),v.set(L.types.mdat,4))}else return;v.set(Z,y);const he=Z.byteLength;y+=he,p.push(new xp(!0,c,he,0)),T=q}const I=p.length;if(!I)return;const R=p[p.length-1];this.nextAudioPts=b=T+d*R.duration;const M=f?new Uint8Array(0):L.moof(e.sequenceNumber++,x/d,je({},e,{samples:p}));e.samples=[];const K=x/r,H=b/r,oe={data1:M,data2:v,startPTS:K,endPTS:H,startDTS:K,endDTS:H,type:"audio",hasAudio:!0,hasVideo:!1,nb:I};return this.isAudioContiguous=!0,oe}remuxEmptyAudio(e,t,a,i){const o=e.inputTimeScale,r=e.samplerate?e.samplerate:o,l=o/r,d=this.nextAudioPts,c=this._initDTS,h=c.baseTime*9e4/c.timescale,u=(d!==null?d:i.startDTS*o)+h,f=i.endDTS*o+h,p=l*Ep,m=Math.ceil((f-u)/p),g=wp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(A.warn("[mp4-remuxer]: remux empty Audio"),!g){A.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const y=[];for(let b=0;b<m;b++){const S=u+b*p;y.push({unit:g,pts:S,dts:S})}return e.samples=y,this.remuxAudio(e,t,a,!1)}}function wt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function RN(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function Tp(s,e,t,a){const i=s.samples.length;if(!i)return;const o=s.inputTimeScale;for(let l=0;l<i;l++){const d=s.samples[l];d.pts=wt(d.pts-t.baseTime*o/t.timescale,e*o)/o,d.dts=wt(d.dts-a.baseTime*o/a.timescale,e*o)/o}const r=s.samples;return s.samples=[],{samples:r}}function Cp(s,e,t){const a=s.samples.length;if(!a)return;const i=s.inputTimeScale;for(let r=0;r<a;r++){const l=s.samples[r];l.pts=wt(l.pts-t.baseTime*i/t.timescale,e*i)/i}s.samples.sort((r,l)=>r.pts-l.pts);const o=s.samples;return s.samples=[],{samples:o}}class xp{constructor(e,t,a,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=a,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class BN{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,a,i){this.audioCodec=t,this.videoCodec=a,this.generateInitSegment(MB(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:a}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=Sf(e);i.audio&&(t=vp(i.audio,Be.AUDIO)),i.video&&(a=vp(i.video,Be.VIDEO));const o={};i.audio&&i.video?o.audiovideo={container:"video/mp4",codec:t+","+a,initSegment:e,id:"main"}:i.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?o.video={container:"video/mp4",codec:a,initSegment:e,id:"main"}:A.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,a,i,o,r){var l,d;let{initPTS:c,lastEndTime:h}=this;const u={audio:void 0,video:void 0,text:i,id3:a,initSegment:void 0};ae(h)||(h=this.lastEndTime=o||0);const f=t.samples;if(!(f!=null&&f.length))return u;const p={initPTS:void 0,timescale:1};let m=this.initData;if((l=m)!=null&&l.length||(this.generateInitSegment(f),m=this.initData),!((d=m)!=null&&d.length))return A.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1);const g=$B(f,m),y=VB(m,f),b=y===null?o:y;(NN(c,b,o,g)||p.timescale!==c.timescale&&r)&&(p.initPTS=b-o,c&&c.timescale===1&&A.warn(`Adjusting initPTS by ${p.initPTS-c.baseTime}`),this.initPTS=c={baseTime:p.initPTS,timescale:1});const S=e?b-c.baseTime/c.timescale:h,w=S+g;UB(m,f,c.baseTime/c.timescale),g>0?this.lastEndTime=w:(A.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const x=!!m.audio,T=!!m.video;let v="";x&&(v+="audio"),T&&(v+="video");const E={data1:f,startPTS:S,startDTS:S,endPTS:w,endDTS:w,type:v,hasAudio:x,hasVideo:T,nb:1,dropped:0};return u.audio=E.type==="audio"?E:void 0,u.video=E.type!=="audio"?E:void 0,u.initSegment=p,u.id3=Tp(a,o,c,c),i.samples.length&&(u.text=Cp(i,o,c)),u}}function NN(s,e,t,a){if(s===null)return!0;const i=Math.max(a,1),o=e-s.baseTime/s.timescale;return Math.abs(o-t)>i}function vp(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===Be.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Jn(t,!1);const a="mp4a.40.5";return A.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${a}"`),a}return A.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Zt;try{Zt=self.performance.now.bind(self.performance)}catch{A.debug("Unable to use Performance API on this environment"),Zt=Vs==null?void 0:Vs.Date.now}const ui=[{demux:bN,remux:BN},{demux:rs,remux:hi},{demux:gN,remux:hi},{demux:CN,remux:hi}];ui.splice(2,0,{demux:SN,remux:hi});class Ap{constructor(e,t,a,i,o){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=a,this.vendor=i,this.id=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,a,i){const o=a.transmuxing;o.executeStart=Zt();let r=new Uint8Array(e);const{currentTransmuxState:l,transmuxConfig:d}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:h,trackSwitch:u,accurateTimeOffset:f,timeOffset:p,initSegmentChange:m}=i||l,{audioCodec:g,videoCodec:y,defaultInitPts:b,duration:S,initSegmentData:w}=d,x=DN(r,t);if(x&&x.method==="AES-128"){const B=this.getDecrypter();if(B.isSync()){let I=B.softwareDecrypt(r,x.key.buffer,x.iv.buffer);if(a.part>-1&&(I=B.flush()),!I)return o.executeEnd=Zt(),Al(a);r=new Uint8Array(I)}else return this.decryptionPromise=B.webCryptoDecrypt(r,x.key.buffer,x.iv.buffer).then(I=>{const R=this.push(I,null,a);return this.decryptionPromise=null,R}),this.decryptionPromise}const T=this.needsProbing(h,u);if(T){const B=this.configureTransmuxer(r);if(B)return A.warn(`[transmuxer] ${B.message}`),this.observer.emit(_.ERROR,_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,error:B,reason:B.message}),o.executeEnd=Zt(),Al(a)}(h||u||m||T)&&this.resetInitSegment(w,g,y,S,t),(h||m||T)&&this.resetInitialTimestamp(b),c||this.resetContiguity();const v=this.transmux(r,x,p,f,a),E=this.currentTransmuxState;return E.contiguous=!0,E.discontinuity=!1,E.trackSwitch=!1,o.executeEnd=Zt(),v}flush(e){const t=e.transmuxing;t.executeStart=Zt();const{decrypter:a,currentTransmuxState:i,decryptionPromise:o}=this;if(o)return o.then(()=>this.flush(e));const r=[],{timeOffset:l}=i;if(a){const u=a.flush();u&&r.push(this.push(u,null,e))}const{demuxer:d,remuxer:c}=this;if(!d||!c)return t.executeEnd=Zt(),[Al(e)];const h=d.flush(l);return mi(h)?h.then(u=>(this.flushRemux(r,u,e),r)):(this.flushRemux(r,h,e),r)}flushRemux(e,t,a){const{audioTrack:i,videoTrack:o,id3Track:r,textTrack:l}=t,{accurateTimeOffset:d,timeOffset:c}=this.currentTransmuxState;A.log(`[transmuxer.ts]: Flushed fragment ${a.sn}${a.part>-1?" p: "+a.part:""} of level ${a.level}`);const h=this.remuxer.remux(i,o,r,l,c,d,!0,this.id);e.push({remuxResult:h,chunkMeta:a}),a.transmuxing.executeEnd=Zt()}resetInitialTimestamp(e){const{demuxer:t,remuxer:a}=this;!t||!a||(t.resetTimeStamp(e),a.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,a,i,o){const{demuxer:r,remuxer:l}=this;!r||!l||(r.resetInitSegment(e,t,a,i),l.resetInitSegment(e,t,a,o))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,a,i,o){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,a,i,o):r=this.transmuxUnencrypted(e,a,i,o),r}transmuxUnencrypted(e,t,a,i){const{audioTrack:o,videoTrack:r,id3Track:l,textTrack:d}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(o,r,l,d,t,a,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,a,i,o){return this.demuxer.demuxSampleAes(e,t,a).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,a,i,!1,this.id),chunkMeta:o}))}configureTransmuxer(e){const{config:t,observer:a,typeSupported:i,vendor:o}=this;let r;for(let f=0,p=ui.length;f<p;f++){var l;if((l=ui[f].demux)!=null&&l.probe(e)){r=ui[f];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const d=this.demuxer,c=this.remuxer,h=r.remux,u=r.demux;(!c||!(c instanceof h))&&(this.remuxer=new h(a,t,i,o)),(!d||!(d instanceof u))&&(this.demuxer=new u(a,t,i),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Sl(this.config)),e}}function DN(s,e){let t=null;return s.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Al=s=>({remuxResult:{},chunkMeta:s});function mi(s){return"then"in s&&s.then instanceof Function}class PN{constructor(e,t,a,i,o){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=a,this.duration=i,this.defaultInitPts=o||null}}class ON{constructor(e,t,a,i,o,r){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=a,this.trackSwitch=i,this.timeOffset=o,this.initSegmentChange=r}}var Lp={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(t=!1));function i(d,c,h){this.fn=d,this.context=c,this.once=h||!1}function o(d,c,h,u,f){if(typeof h!="function")throw new TypeError("The listener must be a function");var p=new i(h,u||d,f),m=t?t+c:c;return d._events[m]?d._events[m].fn?d._events[m]=[d._events[m],p]:d._events[m].push(p):(d._events[m]=p,d._eventsCount++),d}function r(d,c){--d._eventsCount===0?d._events=new a:delete d._events[c]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],h,u;if(this._eventsCount===0)return c;for(u in h=this._events)e.call(h,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},l.prototype.listeners=function(c){var h=t?t+c:c,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,p=u.length,m=new Array(p);f<p;f++)m[f]=u[f].fn;return m},l.prototype.listenerCount=function(c){var h=t?t+c:c,u=this._events[h];return u?u.fn?1:u.length:0},l.prototype.emit=function(c,h,u,f,p,m){var g=t?t+c:c;if(!this._events[g])return!1;var y=this._events[g],b=arguments.length,S,w;if(y.fn){switch(y.once&&this.removeListener(c,y.fn,void 0,!0),b){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,h),!0;case 3:return y.fn.call(y.context,h,u),!0;case 4:return y.fn.call(y.context,h,u,f),!0;case 5:return y.fn.call(y.context,h,u,f,p),!0;case 6:return y.fn.call(y.context,h,u,f,p,m),!0}for(w=1,S=new Array(b-1);w<b;w++)S[w-1]=arguments[w];y.fn.apply(y.context,S)}else{var x=y.length,T;for(w=0;w<x;w++)switch(y[w].once&&this.removeListener(c,y[w].fn,void 0,!0),b){case 1:y[w].fn.call(y[w].context);break;case 2:y[w].fn.call(y[w].context,h);break;case 3:y[w].fn.call(y[w].context,h,u);break;case 4:y[w].fn.call(y[w].context,h,u,f);break;default:if(!S)for(T=1,S=new Array(b-1);T<b;T++)S[T-1]=arguments[T];y[w].fn.apply(y[w].context,S)}}return!0},l.prototype.on=function(c,h,u){return o(this,c,h,u,!1)},l.prototype.once=function(c,h,u){return o(this,c,h,u,!0)},l.prototype.removeListener=function(c,h,u,f){var p=t?t+c:c;if(!this._events[p])return this;if(!h)return r(this,p),this;var m=this._events[p];if(m.fn)m.fn===h&&(!f||m.once)&&(!u||m.context===u)&&r(this,p);else{for(var g=0,y=[],b=m.length;g<b;g++)(m[g].fn!==h||f&&!m[g].once||u&&m[g].context!==u)&&y.push(m[g]);y.length?this._events[p]=y.length===1?y[0]:y:r(this,p)}return this},l.prototype.removeAllListeners=function(c){var h;return c?(h=t?t+c:c,this._events[h]&&r(this,h)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,s.exports=l})(Lp);var FN=Lp.exports,Ll=oB(FN);class Ip{constructor(e,t,a,i){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const o=e.config;this.hls=e,this.id=t,this.useWorker=!!o.enableWorker,this.onTransmuxComplete=a,this.onFlush=i;const r=(c,h)=>{h=h||{},h.frag=this.frag,h.id=this.id,c===_.ERROR&&(this.error=h.error),this.hls.trigger(c,h)};this.observer=new Ll,this.observer.on(_.FRAG_DECRYPTED,r),this.observer.on(_.ERROR,r);const l=Ts(o.preferManagedMediaSource)||{isTypeSupported:()=>!1},d={mpeg:l.isTypeSupported("audio/mpeg"),mp3:l.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:l.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker<"u"&&(o.workerPath||sN())){try{o.workerPath?(A.log(`loading Web Worker ${o.workerPath} for "${t}"`),this.workerContext=nN(o.workerPath)):(A.log(`injecting Web Worker for "${t}"`),this.workerContext=aN()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:h}=this.workerContext;h.addEventListener("message",this.onwmsg),h.onerror=u=>{const f=new Error(`${u.message} (${u.filename}:${u.lineno})`);o.enableWorker=!1,A.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:f})},h.postMessage({cmd:"init",typeSupported:d,vendor:"",id:t,config:JSON.stringify(o)})}catch(h){A.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.resetWorker(),this.error=null,this.transmuxer=new Ap(this.observer,d,o,"",t)}return}this.transmuxer=new Ap(this.observer,d,o,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,a,i,o,r,l,d,c,h){var u,f;c.transmuxing.start=self.performance.now();const{transmuxer:p}=this,m=r?r.start:o.start,g=o.decryptdata,y=this.frag,b=!(y&&o.cc===y.cc),S=!(y&&c.level===y.level),w=y?c.sn-y.sn:-1,x=this.part?c.part-this.part.index:-1,T=w===0&&c.id>1&&c.id===(y==null?void 0:y.stats.chunkCount),v=!S&&(w===1||w===0&&(x===1||T&&x<=0)),E=self.performance.now();(S||w||o.stats.parsing.start===0)&&(o.stats.parsing.start=E),r&&(x||!v)&&(r.stats.parsing.start=E);const B=!(y&&((u=o.initSegment)==null?void 0:u.url)===((f=y.initSegment)==null?void 0:f.url)),I=new ON(b,v,d,S,m,B);if(!v||b||B){A.log(`[transmuxer-interface, ${o.type}]: Starting new transmux session for sn: ${c.sn} p: ${c.part} level: ${c.level} id: ${c.id}
|
|
49
|
+
Switching to level ${M} @ ${K|0} bps`),i.trigger(_.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:a,stats:d})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(A.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new L6(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(_.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const a=t.frag;if(!this.ignoreFragment(a)){if(!a.bitrateTest){var i;this.fragCurrent=a,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case N.BUFFER_ADD_CODEC_ERROR:case N.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case N.FRAG_LOAD_TIMEOUT:{const a=t.frag,{fragCurrent:i,partCurrent:o}=this;if(a&&i&&a.sn===i.sn&&a.level===i.level){const r=performance.now(),l=o?o.stats:a.stats,d=r-l.loading.start,c=l.loading.first?l.loading.first-l.loading.start:-1;if(l.loaded&&c>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(d-Math.min(u,c),l.loaded)}else this.bwEstimator.sampleTTFB(d)}break}}}getTimeToLoadFrag(e,t,a,i){const o=e+a/t,r=i?this.lastLevelLoadSec:0;return o+r}onLevelLoaded(e,t){const a=this.hls.config,{loading:i}=t.stats,o=i.end-i.start;ae(o)&&(this.lastLevelLoadSec=o/1e3),t.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:a}){const i=a?a.stats:t.stats;if(t.type===le.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const o=a?a.duration:t.duration,r=this.hls.levels[t.level],l=(r.loaded?r.loaded.bytes:0)+i.loaded,d=(r.loaded?r.loaded.duration:0)+o;r.loaded={bytes:l,duration:d},r.realBitrate=Math.round(8*l/d)}if(t.bitrateTest){const o={stats:i,frag:t,part:a,id:t.type};this.onFragBuffered(_.FRAG_BUFFERED,o),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:a,part:i}=t,o=i!=null&&i.stats.loaded?i.stats:a.stats;if(o.aborted||this.ignoreFragment(a))return;const r=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,o.loaded),o.bwEstimate=this.getBwEstimate(),a.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==le.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,a=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,o=this.findBestLevel(a,t,e,0,i,1,1);if(o>-1)return o;const r=this.hls.firstLevel,l=Math.min(Math.max(r,t),e);return A.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${r} clamped to ${l}`),l}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,a=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!a||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const o=a&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,o)&&r[e].loadError<=r[o].loadError)return e}return this._nextAutoLevel=o,this.nextAutoLevelKey=this.getAutoLevelKey(),o}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:a}=this,{maxAutoLevel:i,config:o,minAutoLevel:r}=a,l=t?t.duration:e?e.duration:0,d=this.getBwEstimate(),c=this.getStarvationDelay();let h=o.abrBandWidthFactor,u=o.abrBandWidthUpFactor;if(c){const y=this.findBestLevel(d,r,i,c,0,h,u);if(y>=0)return y}let f=l?Math.min(l,o.maxStarvationDelay):o.maxStarvationDelay;if(!c){const y=this.bitrateTestDelay;y&&(f=(l?Math.min(l,o.maxLoadingDelay):o.maxLoadingDelay)-y,A.info(`[abr] bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),h=u=1)}const p=this.findBestLevel(d,r,i,c,f,h,u);if(A.info(`[abr] ${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${p}`),p>-1)return p;const m=a.levels[r],g=a.levels[a.loadLevel];return(m==null?void 0:m.bitrate)<(g==null?void 0:g.bitrate)?r:a.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const a=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/a}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,a,i,o,r,l){var d;const c=i+o,h=this.lastLoadedFragLevel,u=h===-1?this.hls.firstLevel:h,{fragCurrent:f,partCurrent:p}=this,{levels:m,allAudioTracks:g,loadLevel:y,config:b}=this.hls;if(m.length===1)return 0;const S=m[u],w=!!(S!=null&&(d=S.details)!=null&&d.live),x=y===-1||h===-1;let T,v="SDR",E=(S==null?void 0:S.frameRate)||0;const{audioPreference:B,videoPreference:I}=b,R=this.audioTracksByGroup||(this.audioTracksByGroup=O6(g));if(x){if(this.firstSelection!==-1)return this.firstSelection;const oe=this.codecTiers||(this.codecTiers=F6(m,R,t,a)),ne=P6(oe,v,e,B,I),{codecSet:ce,videoRanges:de,minFramerate:Z,minBitrate:q,preferHDR:he}=ne;T=ce,v=he?de[de.length-1]:de[0],E=Z,e=Math.max(e,q),A.log(`[abr] picked start tier ${JSON.stringify(ne)}`)}else T=S==null?void 0:S.codecSet,v=S==null?void 0:S.videoRange;const M=p?p.duration:f?f.duration:0,K=this.bwEstimator.getEstimateTTFB()/1e3,H=[];for(let oe=a;oe>=t;oe--){var se;const ne=m[oe],ce=oe>u;if(!ne)continue;if(b.useMediaCapabilities&&!ne.supportedResult&&!ne.supportedPromise){const ue=navigator.mediaCapabilities;typeof(ue==null?void 0:ue.decodingInfo)=="function"&&I6(ne,R,v,E,e,B)?(ne.supportedPromise=R6(ne,R,ue),ne.supportedPromise.then(be=>{if(!this.hls)return;ne.supportedResult=be;const xe=this.hls.levels,te=xe.indexOf(ne);be.error?A.warn(`[abr] MediaCapabilities decodingInfo error: "${be.error}" for level ${te} ${JSON.stringify(be)}`):be.supported||(A.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${te} ${JSON.stringify(be)}`),te>-1&&xe.length>1&&(A.log(`[abr] Removing unsupported level ${te}`),this.hls.removeLevel(te)))})):ne.supportedResult=ep}if(T&&ne.codecSet!==T||v&&ne.videoRange!==v||ce&&E>ne.frameRate||!ce&&E>0&&E<ne.frameRate||ne.supportedResult&&!((se=ne.supportedResult.decodingInfoResults)!=null&&se[0].smooth)){H.push(oe);continue}const de=ne.details,Z=(p?de==null?void 0:de.partTarget:de==null?void 0:de.averagetargetduration)||M;let q;ce?q=l*e:q=r*e;const he=M&&i>=M*2&&o===0?m[oe].averageBitrate:m[oe].maxBitrate,J=this.getTimeToLoadFrag(K,q,he*Z,de===void 0);if(q>=he&&(oe===h||ne.loadError===0&&ne.fragmentError===0)&&(J<=K||!ae(J)||w&&!this.bitrateTestDelay||J<c)){const ue=this.forcedAutoLevel;return oe!==y&&(ue===-1||ue!==y)&&(H.length&&A.trace(`[abr] Skipped level(s) ${H.join(",")} of ${a} max with CODECS and VIDEO-RANGE:"${m[H[0]].codecs}" ${m[H[0]].videoRange}; not compatible with "${S.codecs}" ${v}`),A.info(`[abr] switch candidate:${u}->${oe} adjustedbw(${Math.round(q)})-bitrate=${Math.round(q-he)} ttfb:${K.toFixed(1)} avgDuration:${Z.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${J.toFixed(1)} firstSelection:${x} codecSet:${T} videoRange:${v} hls.loadLevel:${y}`)),x&&(this.firstSelection=oe),oe}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:a}=this.hls,i=Math.min(Math.max(e,a),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class z6{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var Qe={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class U6{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(_.BUFFER_APPENDED,this.onBufferAppended,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.BUFFER_APPENDED,this.onBufferAppended,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const a=this.activePartLists[t];if(a)for(let i=a.length;i--;){const o=a[i];if(!o)break;const r=o.end;if(o.start<=e&&r!==null&&e<=r)return o}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:a}=this,i=Object.keys(a);for(let o=i.length;o--;){const r=a[i[o]];if((r==null?void 0:r.body.type)===t&&r.buffered){const l=r.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,t,a,i){this.timeRanges&&(this.timeRanges[e]=t);const o=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(r=>{const l=this.fragments[r];if(!l||o>=l.body.sn)return;if(!l.buffered&&!l.loaded){l.body.type===a&&this.removeFragment(l.body);return}const d=l.range[e];d&&d.time.some(c=>{const h=!this.isTimeBuffered(c.startPTS,c.endPTS,t);return h&&this.removeFragment(l.body),h})})}detectPartialFragments(e){const t=this.timeRanges,{frag:a,part:i}=e;if(!t||a.sn==="initSegment")return;const o=Hs(a),r=this.fragments[o];if(!r||r.buffered&&a.gap)return;const l=!a.relurl;Object.keys(t).forEach(d=>{const c=a.elementaryStreams[d];if(!c)return;const h=t[d],u=l||c.partial===!0;r.range[d]=this.getBufferedTimes(a,i,u,h)}),r.loaded=null,Object.keys(r.range).length?(r.buffered=!0,(r.body.endList=a.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),ni(r)||this.removeParts(a.sn-1,a.type)):this.removeFragment(r.body)}removeParts(e,t){const a=this.activePartLists[t];a&&(this.activePartLists[t]=a.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const a=Hs(e);let i=this.fragments[a];!i&&t&&(i=this.fragments[a]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,a,i){const o={time:[],partial:a},r=e.start,l=e.end,d=e.minEndPTS||l,c=e.maxStartPTS||r;for(let h=0;h<i.length;h++){const u=i.start(h)-this.bufferPadding,f=i.end(h)+this.bufferPadding;if(c>=u&&d<=f){o.time.push({startPTS:Math.max(r,i.start(h)),endPTS:Math.min(l,i.end(h))});break}else if(r<f&&l>u){const p=Math.max(r,i.start(h)),m=Math.min(l,i.end(h));m>p&&(o.partial=!0,o.time.push({startPTS:p,endPTS:m}))}else if(l<=u)break}return o}getPartialFragment(e){let t=null,a,i,o,r=0;const{bufferPadding:l,fragments:d}=this;return Object.keys(d).forEach(c=>{const h=d[c];h&&ni(h)&&(i=h.body.start-l,o=h.body.end+l,e>=i&&e<=o&&(a=Math.min(e-i,o-e),r<=a&&(t=h.body,r=a)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||ni(t))}getState(e){const t=Hs(e),a=this.fragments[t];return a?a.buffered?ni(a)?Qe.PARTIAL:Qe.OK:Qe.APPENDING:Qe.NOT_LOADED}isTimeBuffered(e,t,a){let i,o;for(let r=0;r<a.length;r++){if(i=a.start(r)-this.bufferPadding,o=a.end(r)+this.bufferPadding,e>=i&&t<=o)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:a,part:i}=t;if(a.sn==="initSegment"||a.bitrateTest)return;const o=i?null:t,r=Hs(a);this.fragments[r]={body:a,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:a,part:i,timeRanges:o}=t;if(a.sn==="initSegment")return;const r=a.type;if(i){let l=this.activePartLists[r];l||(this.activePartLists[r]=l=[]),l.push(i)}this.timeRanges=o,Object.keys(o).forEach(l=>{const d=o[l];this.detectEvictedFragments(l,d,r,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Hs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,a,i,o){i&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const l=this.fragments[r];if(!l)return;const d=l.body;d.type!==a||i&&!d.gap||d.start<t&&d.end>e&&(l.buffered||o)&&this.removeFragment(d)})}removeFragment(e){const t=Hs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const a=this.activePartLists[e.type];if(a){const i=e.sn;this.activePartLists[e.type]=a.filter(o=>o.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function ni(s){var e,t,a;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((a=s.range.audiovideo)==null?void 0:a.partial))}function Hs(s){return`${s.type}_${s.level}_${s.sn}`}const G6={length:0,start:()=>0,end:()=>0};class Pe{static isBuffered(e,t){try{if(e){const a=Pe.getBuffered(e);for(let i=0;i<a.length;i++)if(t>=a.start(i)&&t<=a.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,a){try{if(e){const i=Pe.getBuffered(e),o=[];let r;for(r=0;r<i.length;r++)o.push({start:i.start(r),end:i.end(r)});return this.bufferedInfo(o,t,a)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,a){t=Math.max(0,t),e.sort(function(c,h){const u=c.start-h.start;return u||h.end-c.end});let i=[];if(a)for(let c=0;c<e.length;c++){const h=i.length;if(h){const u=i[h-1].end;e[c].start-u<a?e[c].end>u&&(i[h-1].end=e[c].end):i.push(e[c])}else i.push(e[c])}else i=e;let o=0,r,l=t,d=t;for(let c=0;c<i.length;c++){const h=i[c].start,u=i[c].end;if(t+a>=h&&t<u)l=h,d=u,o=d-t;else if(t+a<h){r=h;break}}return{len:o,start:l||0,end:d||0,nextStart:r}}static getBuffered(e){try{return e.buffered}catch(t){return A.log("failed to get media.buffered",t),G6}}}class bl{constructor(e,t,a,i=0,o=-1,r=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=ii(),this.buffering={audio:ii(),video:ii(),audiovideo:ii()},this.level=e,this.sn=t,this.id=a,this.size=i,this.part=o,this.partial=r}}function ii(){return{start:0,executeStart:0,executeEnd:0,end:0}}function oi(s,e){for(let a=0,i=s.length;a<i;a++){var t;if(((t=s[a])==null?void 0:t.cc)===e)return s[a]}return null}function j6(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function H6(s,e){const t=s.fragments,a=e.fragments;if(!a.length||!t.length){A.log("No fragments to align");return}const i=oi(t,a[0].cc);if(!i||i&&!i.startPTS){A.log("No frag in previous level to align on");return}return i}function ap(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function np(s,e){const t=e.fragments;for(let a=0,i=t.length;a<i;a++)ap(t[a],s);e.fragmentHint&&ap(e.fragmentHint,s),e.alignedSliding=!0}function W6(s,e,t){e&&(K6(s,t,e),!t.alignedSliding&&e&&ri(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&Kf(e,t))}function K6(s,e,t){if(j6(s,t,e)){const a=H6(t,e);a&&ae(a.start)&&(A.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),np(a.start,e))}}function ri(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,a=e.fragments;if(!t.length||!a.length)return;let i,o;const r=Math.min(e.endCC,s.endCC);e.startCC<r&&s.startCC<r&&(i=oi(a,r),o=oi(t,r)),(!i||!o)&&(i=a[Math.floor(a.length/2)],o=oi(t,i.cc)||t[Math.floor(t.length/2)]);const l=i.programDateTime,d=o.programDateTime;if(!l||!d)return;const c=(d-l)/1e3-(o.start-i.start);np(c,s)}const ip=Math.pow(2,17);class q6{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const a=e.url;if(!a)return Promise.reject(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${a?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,o=i.fLoader,r=i.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(p=>p[0]==="GAP")){d(rp(e));return}else e.gap=!1;const c=this.loader=e.loader=o?new o(i):new r(i),h=op(e),u=Zf(i.fragLoadPolicy.default),f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:ip};e.stats=c.stats,c.load(h,f,{onSuccess:(p,m,g,y)=>{this.resetLoader(e,c);let b=p.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(b.slice(0,16)),b=b.slice(16)),l({frag:e,part:null,payload:b,networkDetails:y})},onError:(p,m,g,y)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ze({url:a,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:g,stats:y}))},onAbort:(p,m,g)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:p}))},onTimeout:(p,m,g)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:g,stats:p}))},onProgress:(p,m,g,y)=>{t&&t({frag:e,part:null,payload:g,networkDetails:y})}})})}loadPart(e,t,a){this.abort();const i=this.config,o=i.fLoader,r=i.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){d(rp(e,t));return}const c=this.loader=e.loader=o?new o(i):new r(i),h=op(e,t),u=Zf(i.fragLoadPolicy.default),f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ip};t.stats=c.stats,c.load(h,f,{onSuccess:(p,m,g,y)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const b={frag:e,part:t,payload:p.data,networkDetails:y};a(b),l(b)},onError:(p,m,g,y)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Ze({url:h.url,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:g,stats:y}))},onAbort:(p,m,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:p}))},onTimeout:(p,m,g)=>{this.resetLoader(e,c),d(new Xt({type:pe.NETWORK_ERROR,details:N.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:g,stats:p}))}})})}updateStatsFromPart(e,t){const a=e.stats,i=t.stats,o=i.total;if(a.loaded+=i.loaded,o){const d=Math.round(e.duration/t.duration),c=Math.min(Math.round(a.loaded/o),d),u=(d-c)*Math.round(a.loaded/c);a.total=a.loaded+u}else a.total=Math.max(a.loaded,a.total);const r=a.loading,l=i.loading;r.start?r.first+=l.first-l.start:(r.start=l.start,r.first=l.first),r.end=l.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function op(s,e=null){const t=e||s,a={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,o=t.byteRangeEndOffset;if(ae(i)&&ae(o)){var r;let l=i,d=o;if(s.sn==="initSegment"&&((r=s.decryptdata)==null?void 0:r.method)==="AES-128"){const c=o-i;c%16&&(d=o+(16-c%16)),i!==0&&(a.resetIV=!0,l=i-16)}a.rangeStart=l,a.rangeEnd=d}return a}function rp(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),a={type:pe.MEDIA_ERROR,details:N.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(a.part=e),(e||s).stats.aborted=!0,new Xt(a)}class Xt extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Y6{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class J6{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function X6(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Es(s,0,e-t):s}class Z6{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),a=new Uint32Array(4);for(let i=0;i<4;i++)a[i]=t.getUint32(i*4);return a}initTable(){const e=this.sBox,t=this.invSBox,a=this.subMix,i=a[0],o=a[1],r=a[2],l=a[3],d=this.invSubMix,c=d[0],h=d[1],u=d[2],f=d[3],p=new Uint32Array(256);let m=0,g=0,y=0;for(y=0;y<256;y++)y<128?p[y]=y<<1:p[y]=y<<1^283;for(y=0;y<256;y++){let b=g^g<<1^g<<2^g<<3^g<<4;b=b>>>8^b&255^99,e[m]=b,t[b]=m;const S=p[m],w=p[S],x=p[w];let T=p[b]*257^b*16843008;i[m]=T<<24|T>>>8,o[m]=T<<16|T>>>16,r[m]=T<<8|T>>>24,l[m]=T,T=x*16843009^w*65537^S*257^m*16843008,c[b]=T<<24|T>>>8,h[b]=T<<16|T>>>16,u[b]=T<<8|T>>>24,f[b]=T,m?(m=S^p[p[p[x^S]]],g^=p[p[g]]):m=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let a=!0,i=0;for(;i<t.length&&a;)a=t[i]===this.key[i],i++;if(a)return;this.key=t;const o=this.keySize=t.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);const r=this.ksRows=(o+6+1)*4;let l,d;const c=this.keySchedule=new Uint32Array(r),h=this.invKeySchedule=new Uint32Array(r),u=this.sBox,f=this.rcon,p=this.invSubMix,m=p[0],g=p[1],y=p[2],b=p[3];let S,w;for(l=0;l<r;l++){if(l<o){S=c[l]=t[l];continue}w=S,l%o===0?(w=w<<8|w>>>24,w=u[w>>>24]<<24|u[w>>>16&255]<<16|u[w>>>8&255]<<8|u[w&255],w^=f[l/o|0]<<24):o>6&&l%o===4&&(w=u[w>>>24]<<24|u[w>>>16&255]<<16|u[w>>>8&255]<<8|u[w&255]),c[l]=S=(c[l-o]^w)>>>0}for(d=0;d<r;d++)l=r-d,d&3?w=c[l]:w=c[l-4],d<4||l<=4?h[d]=w:h[d]=m[u[w>>>24]]^g[u[w>>>16&255]]^y[u[w>>>8&255]]^b[u[w&255]],h[d]=h[d]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,a){const i=this.keySize+6,o=this.invKeySchedule,r=this.invSBox,l=this.invSubMix,d=l[0],c=l[1],h=l[2],u=l[3],f=this.uint8ArrayToUint32Array_(a);let p=f[0],m=f[1],g=f[2],y=f[3];const b=new Int32Array(e),S=new Int32Array(b.length);let w,x,T,v,E,B,I,R,M,K,H,se,oe,ne;const ce=this.networkToHostOrderSwap;for(;t<b.length;){for(M=ce(b[t]),K=ce(b[t+1]),H=ce(b[t+2]),se=ce(b[t+3]),E=M^o[0],B=se^o[1],I=H^o[2],R=K^o[3],oe=4,ne=1;ne<i;ne++)w=d[E>>>24]^c[B>>16&255]^h[I>>8&255]^u[R&255]^o[oe],x=d[B>>>24]^c[I>>16&255]^h[R>>8&255]^u[E&255]^o[oe+1],T=d[I>>>24]^c[R>>16&255]^h[E>>8&255]^u[B&255]^o[oe+2],v=d[R>>>24]^c[E>>16&255]^h[B>>8&255]^u[I&255]^o[oe+3],E=w,B=x,I=T,R=v,oe=oe+4;w=r[E>>>24]<<24^r[B>>16&255]<<16^r[I>>8&255]<<8^r[R&255]^o[oe],x=r[B>>>24]<<24^r[I>>16&255]<<16^r[R>>8&255]<<8^r[E&255]^o[oe+1],T=r[I>>>24]<<24^r[R>>16&255]<<16^r[E>>8&255]<<8^r[B&255]^o[oe+2],v=r[R>>>24]<<24^r[E>>16&255]<<16^r[B>>8&255]<<8^r[I&255]^o[oe+3],S[t]=ce(w^p),S[t+1]=ce(v^m),S[t+2]=ce(T^g),S[t+3]=ce(x^y),p=M,m=K,g=H,y=se,t=t+4}return S.buffer}}const Q6=16;class Sl{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const a=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?X6(a):a}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,a){return this.useSoftware?new Promise((i,o)=>{this.softwareDecrypt(new Uint8Array(e),t,a);const r=this.flush();r?i(r.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,a)}softwareDecrypt(e,t,a){const{currentIV:i,currentResult:o,remainderData:r}=this;this.logOnce("JS AES decrypt"),r&&(e=_t(r,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;i&&(a=i);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new Z6),d.expandKey(t);const c=o;return this.currentResult=d.decrypt(l.buffer,0,a),this.currentIV=Es(l,-16).buffer,c||null}webCryptoDecrypt(e,t,a){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,a));this.key=t,this.fastAesKey=new J6(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Y6(this.subtle,new Uint8Array(a)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(A.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,a)))}onWebCryptoError(e,t,a){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,a);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const a=e.length-e.length%Q6;return a!==e.length&&(t=Es(e,0,a),this.remainderData=Es(e,a)),t}logOnce(e){this.logEnabled&&(A.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const eN={toString:function(s){let e="";const t=s.length;for(let a=0;a<t;a++)e+=`[${s.start(a).toFixed(3)}-${s.end(a).toFixed(3)}]`;return e}},V={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class _l extends z6{constructor(e,t,a,i,o){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=V.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=o,this.logPrefix=i,this.log=A.log.bind(A,`${i}:`),this.warn=A.warn.bind(A,`${i}:`),this.hls=e,this.fragmentLoader=new q6(e.config),this.keyLoader=a,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Sl(e.config),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=V.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const a=t.partList;if(a!=null&&a.length){const o=a[a.length-1];return Pe.isBuffered(this.media,o.start+o.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const a=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),a.addEventListener("seeking",this.onvseeking),a.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===V.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:a,mediaBuffer:i,state:o}=this,r=a?a.currentTime:0,l=Pe.bufferInfo(i||a,r,e.maxBufferHole);if(this.log(`media seeking to ${ae(r)?r.toFixed(3):r}, state: ${o}`),this.state===V.ENDED)this.resetLoadingState();else if(t){const d=e.maxFragLookUpTolerance,c=t.start-d,h=t.start+t.duration+d;if(!l.len||h<l.start||c>l.end){const u=r>h;(r<c||u)&&(u&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}a&&(this.fragmentTracker.removeFragmentsInRange(r,1/0,this.playlistType,!0),this.lastCurrentTime=r),!this.loadedmetadata&&!l.len&&(this.nextLoadPosition=this.startPosition=r),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=V.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,a){this._loadFragForPlayback(e,t,a)}_loadFragForPlayback(e,t,a){const i=o=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${o.part?" p: "+o.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(o)};this._doFragLoad(e,t,a,i).then(o=>{if(!o)return;const r=this.state;if(this.fragContextChanged(e)){(r===V.FRAG_LOADING||!this.fragCurrent&&r===V.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=V.IDLE);return}"payload"in o&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(_.FRAG_LOADED,o)),this._handleFragmentLoadComplete(o)}).catch(o=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(`Frag error: ${(o==null?void 0:o.message)||o}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:a}=this;if(a.getState(e)===Qe.APPENDING){const o=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,o),l=Math.max(e.duration,r?r.len:this.config.maxBufferLength),d=this.backtrackFragment;((d?e.sn-d.sn:0)===1||this.reduceMaxBufferLength(l,e.duration))&&a.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?a.removeAllFragments():a.hasParts(e.type)&&(a.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),a.getState(e)===Qe.PARTIAL&&a.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,a=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:a};this.hls.trigger(_.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(a=>{if(!a||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return a}).then(a=>{const{hls:i}=this,{payload:o}=a,r=e.decryptdata;if(o&&o.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),r.key.buffer,r.iv.buffer).catch(d=>{throw i.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:e}),d}).then(d=>{const c=self.performance.now();return i.trigger(_.FRAG_DECRYPTED,{frag:e,payload:d,stats:{tstart:l,tdecrypt:c}}),a.payload=d,this.completeInitSegmentLoad(a)})}return this.completeInitSegmentLoad(a)}).catch(a=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(a),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const a=e.frag.stats;this.state=V.IDLE,e.frag.data=new Uint8Array(e.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var a,i,o,r;const l=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===le.MAIN?"level":"track"} ${e.level} (frag:[${((a=e.startPTS)!=null?a:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${l?eN.toString(Pe.getBuffered(l)):"(detached)"})`),e.sn!=="initSegment"){var d;if(e.type!==le.SUBTITLE){const h=e.elementaryStreams;if(!Object.keys(h).some(u=>!!h[u])){this.state=V.IDLE;return}}const c=(d=this.levels)==null?void 0:d[e.level];c!=null&&c.fragmentError&&(this.log(`Resetting level fragment error count of ${c.fragmentError} on frag buffered`),c.fragmentError=0)}this.state=V.IDLE,l&&(!this.loadedmetadata&&e.type==le.MAIN&&l.buffered.length&&((o=this.fragCurrent)==null?void 0:o.sn)===((r=this.fragPrevious)==null?void 0:r.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:a,part:i,partsLoaded:o}=e,r=!o||o.length===0||o.some(d=>!d),l=new bl(a.level,a.sn,a.stats.chunkCount+1,0,i?i.index:-1,!r);t.flush(l)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,a=null,i){var o;const r=t==null?void 0:t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let l=null;if(e.encrypted&&!((o=e.decryptdata)!=null&&o.key)?(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=V.KEY_LOADING,this.fragCurrent=e,l=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(_.KEY_LOADED,h),this.state===V.KEY_LOADING&&(this.state=V.IDLE),h}),this.hls.trigger(_.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(l=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&r.encryptedFragments.length&&this.keyLoader.loadClear(e,r.encryptedFragments),a=Math.max(e.start,a||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const h=r.partList;if(h&&i){a>e.end&&r.fragmentHint&&(e=r.fragmentHint);const u=this.getNextPart(h,e,a);if(u>-1){const f=h[u];this.log(`Loading part sn: ${e.sn} p: ${f.index} cc: ${e.cc} of playlist [${r.startSN}-${r.endSN}] parts [0-${u}-${h.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(a.toFixed(3))}`),this.nextLoadPosition=f.start+f.duration,this.state=V.FRAG_LOADING;let p;return l?p=l.then(m=>!m||this.fragContextChanged(m.frag)?null:this.doFragPartsLoad(e,f,t,i)).catch(m=>this.handleFragLoadError(m)):p=this.doFragPartsLoad(e,f,t,i).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(_.FRAG_LOADING,{frag:e,part:f,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):p}else if(!e.url||this.loadedEndOfParts(h,a))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${r?"of ["+r.startSN+"-"+r.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(a.toFixed(3))}`),ae(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=V.FRAG_LOADING;const d=this.config.progressive;let c;return d&&l?c=l.then(h=>!h||this.fragContextChanged(h==null?void 0:h.frag)?null:this.fragmentLoader.load(e,i)).catch(h=>this.handleFragLoadError(h)):c=Promise.all([this.fragmentLoader.load(e,d?i:void 0),l]).then(([h])=>(!d&&h&&i&&i(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(_.FRAG_LOADING,{frag:e,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,a,i){return new Promise((o,r)=>{var l;const d=[],c=(l=a.details)==null?void 0:l.partList,h=u=>{this.fragmentLoader.loadPart(e,u,i).then(f=>{d[u.index]=f;const p=f.part;this.hls.trigger(_.FRAG_LOADED,f);const m=qf(a,e.sn,u.index+1)||Yf(c,e.sn,u.index+1);if(m)h(m);else return o({frag:e,part:p,partsLoaded:d})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===N.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(_.ERROR,t)}else this.hls.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==V.PARSING){!this.fragCurrent&&this.state!==V.STOPPED&&this.state!==V.ERROR&&(this.state=V.IDLE);return}const{frag:a,part:i,level:o}=t,r=self.performance.now();a.stats.parsing.end=r,i&&(i.stats.parsing.end=r),this.updateLevelTiming(a,i,o,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:a}=this,{level:i,sn:o,part:r}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${o} of level ${i}. The current chunk will not be buffered.`),null;const l=t[i],d=r>-1?qf(l,o,r):null,c=d?d.fragment:k6(l,o,a);return c?(a&&a!==c&&(c.stats=a.stats),{frag:c,part:d,level:l}):null}bufferFragmentData(e,t,a,i,o){var r;if(!e||this.state!==V.PARSING)return;const{data1:l,data2:d}=e;let c=l;if(l&&d&&(c=_t(l,d)),!((r=c)!=null&&r.length))return;const h={type:e.type,frag:t,part:a,chunkMeta:i,parent:t.type,data:c};if(this.hls.trigger(_.BUFFER_APPENDING,h),e.dropped&&e.independent&&!a){if(o)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Pe.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const a=t.currentTime,i=Pe.bufferInfo(t,a,0),o=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,o*.25),l=Math.max(Math.min(e.start-r,i.end-r),a+r);e.start-l>r&&this.flushMainBuffer(l,e.start)}getFwdBufferInfo(e,t){const a=this.getLoadPosition();return ae(a)?this.getFwdBufferInfoAtPos(e,a,t):null}getFwdBufferInfoAtPos(e,t,a){const{config:{maxBufferHole:i}}=this,o=Pe.bufferInfo(e,t,i);if(o.len===0&&o.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,a);if(r&&o.nextStart<r.end)return Pe.bufferInfo(e,t,Math.max(o.nextStart,i))}return o}getMaxBufferLength(e){const{config:t}=this;let a;return e?a=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):a=t.maxBufferLength,Math.min(a,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const a=this.config,i=Math.max(Math.min(e-t,a.maxBufferLength),t),o=Math.max(e-t*3,a.maxMaxBufferLength/2,i);return o>=i?(a.maxMaxBufferLength=o,this.warn(`Reduce max buffer length to ${o}s`),!0):!1}getAppendedFrag(e,t=le.MAIN){const a=this.fragmentTracker.getAppendedFrag(e,le.MAIN);return a&&"fragment"in a?a.fragment:a}getNextFragment(e,t){const a=t.fragments,i=a.length;if(!i)return null;const{config:o}=this,r=a[0].start;let l;if(t.live){const d=o.initialLiveManifestSize;if(i<d)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${d})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r)&&(l=this.getInitialLiveFragment(t,a),this.startPosition=this.nextLoadPosition=l?this.hls.liveSyncPosition||l.start:e)}else e<=r&&(l=a[0]);if(!l){const d=o.lowLatencyMode?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,d,t)}return this.mapToInitFragWhenRequired(l)}isLoopLoading(e,t){const a=this.fragmentTracker.getState(e);return(a===Qe.OK||a===Qe.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,a,i,o){const r=e.gap,l=this.getNextFragment(this.nextLoadPosition,t);if(l===null)return l;if(e=l,r&&e&&!e.gap&&a.nextStart){const d=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,i);if(d!==null&&a.len+d.len>=o)return this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,a){let i=-1,o=!1,r=!0;for(let l=0,d=e.length;l<d;l++){const c=e[l];if(r=r&&!c.independent,i>-1&&a<c.start)break;const h=c.loaded;h?i=-1:(o||c.independent||r)&&c.fragment===t&&(i=l),o=h}return i}loadedEndOfParts(e,t){const a=e[e.length-1];return a&&t>a.start&&a.loaded}getInitialLiveFragment(e,t){const a=this.fragPrevious;let i=null;if(a){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${a.programDateTime}`),i=T6(t,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const o=a.sn+1;if(o>=e.startSN&&o<=e.endSN){const r=t[o-e.startSN];a.cc===r.cc&&(i=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=v6(t,a.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const o=this.hls.liveSyncPosition;o!==null&&(i=this.getFragmentAtPosition(o,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,a){const{config:i}=this;let{fragPrevious:o}=this,{fragments:r,endSN:l}=a;const{fragmentHint:d}=a,{maxFragLookUpTolerance:c}=i,h=a.partList,u=!!(i.lowLatencyMode&&h!=null&&h.length&&d);u&&d&&!this.bitrateTest&&(r=r.concat(d),l=d.sn);let f;if(e<t){const p=e>t-c?0:c;f=ai(o,r,e,p)}else f=r[r.length-1];if(f){const p=f.sn-a.startSN,m=this.fragmentTracker.getState(f);if((m===Qe.OK||m===Qe.PARTIAL&&f.gap)&&(o=f),o&&f.sn===o.sn&&(!u||h[0].fragment.sn>f.sn)&&o&&f.level===o.level){const y=r[p+1];f.sn<l&&this.fragmentTracker.getState(y)!==Qe.OK?f=y:f=null}}return f}synchronizeToLiveEdge(e){const{config:t,media:a}=this;if(!a)return;const i=this.hls.liveSyncPosition,o=a.currentTime,r=e.fragments[0].start,l=e.edge,d=o>=r-t.maxFragLookUpTolerance&&o<=l;if(i!==null&&a.duration>i&&(o<i||!d)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!d&&a.readyState<4||o<l-c)&&(this.loadedmetadata||(this.nextLoadPosition=i),a.readyState&&(this.warn(`Playback: ${o.toFixed(3)} is located too far from the end of live sliding playlist: ${l}, reset currentTime to : ${i.toFixed(3)}`),a.currentTime=i))}}alignPlaylists(e,t,a){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const o=e.fragments[0].start,r=!t,l=e.alignedSliding&&ae(o);if(r||!l&&!o){const{fragPrevious:d}=this;W6(d,a,e);const c=e.fragments[0].start;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${d?d.sn:"na"} fragments: ${i}`),c}return o}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let a=this.startPosition;if(a<t&&(a=-1),a===-1||this.lastCurrentTime===-1){const i=this.startTimeOffset!==null,o=i?this.startTimeOffset:e.startTimeOffset;o!==null&&ae(o)?(a=t+o,o<0&&(a+=e.totalduration),a=Math.min(Math.max(t,a),t+e.totalduration),this.log(`Start time offset ${o} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${a}`),this.startPosition=a):e.live?a=this.hls.liveSyncPosition||t:this.startPosition=a=0,this.lastCurrentTime=a}this.nextLoadPosition=a}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==V.FRAG_LOADING_WAITING_RETRY)&&(this.state=V.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const h=this.getCurrentContext(t.chunkMeta);h&&(t.frag=h.frag)}const a=t.frag;if(!a||a.type!==e||!this.levels)return;if(this.fragContextChanged(a)){var i;this.warn(`Frag load error must match current frag to retry ${a.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const o=t.details===N.FRAG_GAP;o&&this.fragmentTracker.fragBuffered(a,!0);const r=t.errorAction,{action:l,retryCount:d=0,retryConfig:c}=r||{};if(r&&l===it.RetryRequest&&c){this.resetStartWhenNotLoaded(this.levelLastLoaded);const h=pl(c,d);this.warn(`Fragment ${a.sn} of ${e} ${a.level} errored with ${t.details}, retrying loading ${d+1}/${c.maxNumRetry} in ${h}ms`),r.resolved=!0,this.retryDate=self.performance.now()+h,this.state=V.FRAG_LOADING_WAITING_RETRY}else if(c&&r)if(this.resetFragmentErrors(e),d<c.maxNumRetry)!o&&l!==it.RemoveAlternatePermanently&&(r.resolved=!0);else{A.warn(`${t.details} reached or exceeded max retry (${d})`);return}else(r==null?void 0:r.action)===it.SendAlternateToPenaltyBox?this.state=V.WAITING_LEVEL:this.state=V.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===V.PARSING||this.state===V.PARSED){const t=e.frag,a=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,a),o=i&&i.len>.5;o&&this.reduceMaxBufferLength(i.len,(t==null?void 0:t.duration)||10);const r=!o;return r&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${a} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===le.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==V.STOPPED&&(this.state=V.IDLE)}afterBufferFlushed(e,t,a){if(!e)return;const i=Pe.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,a),this.state===V.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=V.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,a,i){var o;const r=a.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((d,c)=>{const h=e.elementaryStreams[c];if(h){const u=h.endPTS-h.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${u})`),d||!1;const f=i?0:Wf(r,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS);return this.hls.trigger(_.LEVEL_PTS_UPDATED,{details:r,level:a,drift:f,type:c,frag:e,start:h.startPTS,end:h.endPTS}),!0}return d},!1)&&((o=this.transmuxer)==null?void 0:o.error)===null){const d=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(a.fragmentError===0&&(a.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(d.message),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of level "${a.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=V.PARSED,this.hls.trigger(_.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class lp{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let a;if(e.length)e.length===1?a=e[0]:a=tN(e,t);else return new Uint8Array(0);return this.reset(),a}reset(){this.chunks.length=0,this.dataLength=0}}function tN(s,e){const t=new Uint8Array(e);let a=0;for(let i=0;i<s.length;i++){const o=s[i];t.set(o,a),a+=o.length}return t}function sN(){return typeof __HLS_WORKER_BUNDLE__=="function"}function aN(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function nN(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Wt(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class wl{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,a,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,a){}demux(e,t){this.cachedData&&(e=_t(this.cachedData,e),this.cachedData=null);let a=Ta(e,0),i=a?a.length:0,o;const r=this._audioTrack,l=this._id3Track,d=a?tl(a):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&ae(d))&&(this.basePTS=iN(d,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),a&&a.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Pt.audioId3,duration:Number.POSITIVE_INFINITY});i<c;){if(this.canParse(e,i)){const h=this.appendFrame(r,e,i);h?(this.frameIndex++,this.lastPTS=h.sample.pts,i+=h.length,o=i):i=c}else x3(e,i)?(a=Ta(e,i),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Pt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=a.length,o=i):i++;if(i===c&&o!==c){const h=Es(e,o);this.cachedData?this.cachedData=_t(this.cachedData,h):this.cachedData=h}}return{audioTrack:r,videoTrack:Wt(),id3Track:l,textTrack:Wt()}}demuxSampleAes(e,t,a){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Wt(),id3Track:this._id3Track,textTrack:Wt()}}destroy(){}}const iN=(s,e,t)=>{if(ae(s))return s*90;const a=t?t.baseTime*9e4/t.timescale:0;return e*9e4+a};function oN(s,e,t,a){let i,o,r,l;const d=navigator.userAgent.toLowerCase(),c=a,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>h.length-1){const f=new Error(`invalid ADTS sampling index:${u}`);s.emit(_.ERROR,_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}return r=(e[t+2]&1)<<2,r|=(e[t+3]&192)>>>6,A.log(`manifest codec:${a}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(d)?u>=6?(i=5,l=new Array(4),o=u-3):(i=2,l=new Array(2),o=u):d.indexOf("android")!==-1?(i=2,l=new Array(2),o=u):(i=5,l=new Array(4),a&&(a.indexOf("mp4a.40.29")!==-1||a.indexOf("mp4a.40.5")!==-1)||!a&&u>=6?o=u-3:((a&&a.indexOf("mp4a.40.2")!==-1&&(u>=6&&r===1||/vivaldi/i.test(d))||!a&&r===1)&&(i=2,l=new Array(2)),o=u)),l[0]=i<<3,l[0]|=(u&14)>>1,l[1]|=(u&1)<<7,l[1]|=r<<3,i===5&&(l[1]|=(o&14)>>1,l[2]=(o&1)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:h[u],channelCount:r,codec:"mp4a.40."+i,manifestCodec:c}}function cp(s,e){return s[e]===255&&(s[e+1]&246)===240}function dp(s,e){return s[e+1]&1?7:9}function kl(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function rN(s,e){return e+5<s.length}function li(s,e){return e+1<s.length&&cp(s,e)}function lN(s,e){return rN(s,e)&&cp(s,e)&&kl(s,e)<=s.length-e}function cN(s,e){if(li(s,e)){const t=dp(s,e);if(e+t>=s.length)return!1;const a=kl(s,e);if(a<=t)return!1;const i=e+a;return i===s.length||li(s,i)}return!1}function hp(s,e,t,a,i){if(!s.samplerate){const o=oN(e,t,a,i);if(!o)return;s.config=o.config,s.samplerate=o.samplerate,s.channelCount=o.channelCount,s.codec=o.codec,s.manifestCodec=o.manifestCodec,A.log(`parsed codec:${s.codec}, rate:${o.samplerate}, channels:${o.channelCount}`)}}function up(s){return 1024*9e4/s}function dN(s,e){const t=dp(s,e);if(e+t<=s.length){const a=kl(s,e)-t;if(a>0)return{headerLength:t,frameLength:a}}}function mp(s,e,t,a,i){const o=up(s.samplerate),r=a+i*o,l=dN(e,t);let d;if(l){const{frameLength:u,headerLength:f}=l,p=f+u,m=Math.max(0,t+p-e.length);m?(d=new Uint8Array(p-f),d.set(e.subarray(t+f,e.length),0)):d=e.subarray(t+f,t+p);const g={unit:d,pts:r};return m||s.samples.push(g),{sample:g,length:p,missing:m}}const c=e.length-t;return d=new Uint8Array(c),d.set(e.subarray(t,e.length),0),{sample:{unit:d,pts:r},length:c,missing:-1}}let ci=null;const hN=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],uN=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],mN=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],fN=[0,1,1,4];function fp(s,e,t,a,i){if(t+24>e.length)return;const o=pp(e,t);if(o&&t+o.frameLength<=e.length){const r=o.samplesPerFrame*9e4/o.sampleRate,l=a+i*r,d={unit:e.subarray(t,t+o.frameLength),pts:l,dts:l};return s.config=[],s.channelCount=o.channelCount,s.samplerate=o.sampleRate,s.samples.push(d),{sample:d,length:o.frameLength,missing:0}}}function pp(s,e){const t=s[e+1]>>3&3,a=s[e+1]>>1&3,i=s[e+2]>>4&15,o=s[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&o!==3){const r=s[e+2]>>1&1,l=s[e+3]>>6,d=t===3?3-a:a===3?3:4,c=hN[d*14+i-1]*1e3,u=uN[(t===3?0:t===2?1:2)*3+o],f=l===3?1:2,p=mN[t][a],m=fN[a],g=p*8*m,y=Math.floor(p*c/u+r)*m;if(ci===null){const w=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ci=w?parseInt(w[1]):0}return!!ci&&ci<=87&&a===2&&c>=224e3&&l===0&&(s[e+3]=s[e+3]|128),{sampleRate:u,channelCount:f,frameLength:y,samplesPerFrame:g}}}function El(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function gp(s,e){return e+1<s.length&&El(s,e)}function pN(s,e){return El(s,e)&&4<=s.length-e}function yp(s,e){if(e+1<s.length&&El(s,e)){const a=pp(s,e);let i=4;a!=null&&a.frameLength&&(i=a.frameLength);const o=e+i;return o===s.length||gp(s,o)}return!1}class gN extends wl{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,a,i){super.resetInitSegment(e,t,a,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Ta(e,0);let a=(t==null?void 0:t.length)||0;if(yp(e,a))return!1;for(let i=e.length;a<i;a++)if(cN(e,a))return A.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return lN(e,t)}appendFrame(e,t,a){hp(e,this.observer,t,a,e.manifestCodec);const i=mp(e,t,a,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const yN=/\/emsg[-/]ID3/i;class bN{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,a,i){const o=this.videoTrack=Wt("video",1),r=this.audioTrack=Wt("audio",1),l=this.txtTrack=Wt("text",1);if(this.id3Track=Wt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const d=Sf(e);if(d.video){const{id:c,timescale:h,codec:u}=d.video;o.id=c,o.timescale=l.timescale=h,o.codec=u}if(d.audio){const{id:c,timescale:h,codec:u}=d.audio;r.id=c,r.timescale=h,r.codec=u}l.id=pf.text,o.sampleDuration=0,o.duration=r.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return P3(e)}demux(e,t){this.timeOffset=t;let a=e;const i=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(a=_t(this.remainderData,e));const l=G3(a);this.remainderData=l.remainder,i.samples=l.valid||new Uint8Array}else i.samples=a;const r=this.extractID3Track(i,t);return o.samples=wf(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,a=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return a.samples=wf(e,t),{videoTrack:t,audioTrack:Wt(),id3Track:i,textTrack:Wt()}}extractID3Track(e,t){const a=this.id3Track;if(e.samples.length){const i=Se(e.samples,["emsg"]);i&&i.forEach(o=>{const r=W3(o);if(yN.test(r.schemeIdUri)){const l=ae(r.presentationTime)?r.presentationTime/r.timeScale:t+r.presentationTimeDelta/r.timeScale;let d=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;d<=.001&&(d=Number.POSITIVE_INFINITY);const c=r.payload;a.samples.push({data:c,len:c.byteLength,dts:l,pts:l,type:Pt.emsg,duration:d})}})}return a}demuxSampleAes(e,t,a){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const bp=(s,e)=>{let t=0,a=5;e+=a;const i=new Uint32Array(1),o=new Uint32Array(1),r=new Uint8Array(1);for(;a>0;){r[0]=s[e];const l=Math.min(a,8),d=8-l;o[0]=4278190080>>>24+d<<d,i[0]=(r[0]&o[0])>>d,t=t?t<<l|i[0]:i[0],e+=1,a-=l}return t};class SN extends wl{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,a,i){super.resetInitSegment(e,t,a,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,a){const i=Sp(e,t,a,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=Ta(e,0);if(!t)return!1;const a=t.length;return e[a]===11&&e[a+1]===119&&tl(t)!==void 0&&bp(e,a)<16}}function Sp(s,e,t,a,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const o=e[t+4]>>6;if(o>=3)return-1;const l=[48e3,44100,32e3][o],d=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][d*3+o]*2;if(t+h>e.length)return-1;const u=e[t+6]>>5;let f=0;u===2?f+=2:(u&1&&u!==1&&(f+=2),u&4&&(f+=2));const p=(e[t+6]<<8|e[t+7])>>12-f&1,g=[2,1,2,3,3,4,4,5][u]+p,y=e[t+5]>>3,b=e[t+5]&7,S=new Uint8Array([o<<6|y<<1|b>>2,(b&3)<<6|u<<3|p<<2|d>>4,d<<4&224]),w=1536/l*9e4,x=a+i*w,T=e.subarray(t,t+h);return s.config=S,s.channelCount=g,s.samplerate=l,s.samples.push({unit:T,pts:x}),h}class _N{constructor(){this.VideoSample=null}createVideoSample(e,t,a,i){return{key:e,frame:!1,pts:t,dts:a,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let a=this.VideoSample,i;if((!a||a.units.length===0)&&(a=e[e.length-1]),(t=a)!=null&&t.units){const o=a.units;i=o[o.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const a=t.samples,i=a.length;if(i){const o=a[i-1];e.pts=o.pts,e.dts=o.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&A.log(e.pts+"/"+e.dts+":"+e.debug)}}class _p{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,a=e.byteLength-t,i=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw new Error("no bytes available");i.set(e.subarray(a,a+o)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=o*8,this.bytesAvailable-=o}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const a=this.word>>>32-t;if(e>32&&A.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?a<<t|this.readBits(t):a}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,a=8,i;for(let o=0;o<e;o++)a!==0&&(i=this.readEG(),a=(t+i+256)%256),t=a===0?t:a}readSPS(){let e=0,t=0,a=0,i=0,o,r,l;const d=this.readUByte.bind(this),c=this.readBits.bind(this),h=this.readUEG.bind(this),u=this.readBoolean.bind(this),f=this.skipBits.bind(this),p=this.skipEG.bind(this),m=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);d();const y=d();if(c(5),f(3),d(),m(),y===100||y===110||y===122||y===244||y===44||y===83||y===86||y===118||y===128){const v=h();if(v===3&&f(1),m(),m(),f(1),u())for(r=v!==3?8:12,l=0;l<r;l++)u()&&(l<6?g(16):g(64))}m();const b=h();if(b===0)h();else if(b===1)for(f(1),p(),p(),o=h(),l=0;l<o;l++)p();m(),f(1);const S=h(),w=h(),x=c(1);x===0&&f(1),f(1),u()&&(e=h(),t=h(),a=h(),i=h());let T=[1,1];if(u()&&u())switch(d()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[d()<<8|d(),d()<<8|d()];break}}return{width:Math.ceil((S+1)*16-e*2-t*2),height:(2-x)*(w+1)*16-(x?2:4)*(a+i),pixelRatio:T}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class wN extends _N{parseAVCPES(e,t,a,i,o){const r=this.parseAVCNALu(e,a.data);let l=this.VideoSample,d,c=!1;a.data=null,l&&r.length&&!e.audFound&&(this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts,"")),r.forEach(h=>{var u;switch(h.type){case 1:{let g=!1;d=!0;const y=h.data;if(c&&y.length>4){const b=new _p(y).readSliceType();(b===2||b===4||b===7||b===9)&&(g=!0)}if(g){var f;(f=l)!=null&&f.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null)}l||(l=this.VideoSample=this.createVideoSample(!0,a.pts,a.dts,"")),l.frame=!0,l.key=g;break}case 5:d=!0,(u=l)!=null&&u.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null),l||(l=this.VideoSample=this.createVideoSample(!0,a.pts,a.dts,"")),l.key=!0,l.frame=!0;break;case 6:{d=!0,kf(h.data,1,a.pts,t.samples);break}case 7:{var p,m;d=!0,c=!0;const g=h.data,b=new _p(g).readSPS();if(!e.sps||e.width!==b.width||e.height!==b.height||((p=e.pixelRatio)==null?void 0:p[0])!==b.pixelRatio[0]||((m=e.pixelRatio)==null?void 0:m[1])!==b.pixelRatio[1]){e.width=b.width,e.height=b.height,e.pixelRatio=b.pixelRatio,e.sps=[g],e.duration=o;const S=g.subarray(1,4);let w="avc1.";for(let x=0;x<3;x++){let T=S[x].toString(16);T.length<2&&(T="0"+T),w+=T}e.codec=w}break}case 8:d=!0,e.pps=[h.data];break;case 9:d=!0,e.audFound=!0,l&&this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts,"");break;case 12:d=!0;break;default:d=!1,l&&(l.debug+="unknown NAL "+h.type+" ");break}l&&d&&l.units.push(h)}),i&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)}parseAVCNALu(e,t){const a=t.byteLength;let i=e.naluState||0;const o=i,r=[];let l=0,d,c,h,u=-1,f=0;for(i===-1&&(u=0,f=t[0]&31,i=0,l=1);l<a;){if(d=t[l++],!i){i=d?0:1;continue}if(i===1){i=d?0:2;continue}if(!d)i=3;else if(d===1){if(c=l-i-1,u>=0){const p={data:t.subarray(u,c),type:f};r.push(p)}else{const p=this.getLastNalUnit(e.samples);p&&(o&&l<=4-o&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-o)),c>0&&(p.data=_t(p.data,t.subarray(0,c)),p.state=0))}l<a?(h=t[l]&31,u=l,f=h,i=0):i=-1}else i=0}if(u>=0&&i>=0){const p={data:t.subarray(u,a),type:f,state:i};r.push(p)}if(r.length===0){const p=this.getLastNalUnit(e.samples);p&&(p.data=_t(p.data,t))}return e.naluState=i,r}}class kN{constructor(e,t,a){this.keyData=void 0,this.decrypter=void 0,this.keyData=a,this.decrypter=new Sl(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,a){const i=e[t].unit;if(i.length<=16)return;const o=i.subarray(16,i.length-i.length%16),r=o.buffer.slice(o.byteOffset,o.byteOffset+o.length);this.decryptBuffer(r).then(l=>{const d=new Uint8Array(l);i.set(d,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,a)})}decryptAacSamples(e,t,a){for(;;t++){if(t>=e.length){a();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,a),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,a=new Int8Array(t);let i=0;for(let o=32;o<e.length-16;o+=160,i+=16)a.set(e.subarray(o,o+16),i);return a}getAvcDecryptedUnit(e,t){const a=new Uint8Array(t);let i=0;for(let o=32;o<e.length-16;o+=160,i+=16)e.set(a.subarray(i,i+16),o);return e}decryptAvcSample(e,t,a,i,o){const r=Ef(o.data),l=this.getAvcEncryptedData(r);this.decryptBuffer(l.buffer).then(d=>{o.data=this.getAvcDecryptedUnit(r,d),this.decrypter.isSync()||this.decryptAvcSamples(e,t,a+1,i)})}decryptAvcSamples(e,t,a,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,a=0){if(t>=e.length){i();return}const o=e[t].units;for(;!(a>=o.length);a++){const r=o[a];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,a,i,r),!this.decrypter.isSync()))return}}}}const et=188;class rs{constructor(e,t,a){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.videoParser=new wN}static probe(e){const t=rs.syncOffset(e);return t>0&&A.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let a=Math.min(et*5,t-et)+1,i=0;for(;i<a;){let o=!1,r=-1,l=0;for(let d=i;d<t;d+=et)if(e[d]===71&&(t-d===et||e[d+et]===71)){if(l++,r===-1&&(r=d,r!==0&&(a=Math.min(r+et*99,e.length-et)+1)),o||(o=Tl(e,d)===0),o&&l>1&&(r===0&&l>2||d+et>a))return r}else{if(l)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:pf[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,a,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=rs.createTrack("video"),this._audioTrack=rs.createTrack("audio",i),this._id3Track=rs.createTrack("id3"),this._txtTrack=rs.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=a,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:a}=this;e&&(e.pesData=null),t&&(t.pesData=null),a&&(a.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,a=!1,i=!1){a||(this.sampleAes=null);let o;const r=this._videoTrack,l=this._audioTrack,d=this._id3Track,c=this._txtTrack;let h=r.pid,u=r.pesData,f=l.pid,p=d.pid,m=l.pesData,g=d.pesData,y=null,b=this.pmtParsed,S=this._pmtId,w=e.length;if(this.remainderData&&(e=_t(this.remainderData,e),w=e.length,this.remainderData=null),w<et&&!i)return this.remainderData=e,{audioTrack:l,videoTrack:r,id3Track:d,textTrack:c};const x=Math.max(0,rs.syncOffset(e));w-=(w-x)%et,w<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,w,e.buffer.byteLength-w));let T=0;for(let E=x;E<w;E+=et)if(e[E]===71){const B=!!(e[E+1]&64),I=Tl(e,E),R=(e[E+3]&48)>>4;let M;if(R>1){if(M=E+5+e[E+4],M===E+et)continue}else M=E+4;switch(I){case h:B&&(u&&(o=Ws(u))&&this.videoParser.parseAVCPES(r,c,o,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(M,E+et)),u.size+=E+et-M);break;case f:if(B){if(m&&(o=Ws(m)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,o);break;case"mp3":this.parseMPEGPES(l,o);break;case"ac3":this.parseAC3PES(l,o);break}m={data:[],size:0}}m&&(m.data.push(e.subarray(M,E+et)),m.size+=E+et-M);break;case p:B&&(g&&(o=Ws(g))&&this.parseID3PES(d,o),g={data:[],size:0}),g&&(g.data.push(e.subarray(M,E+et)),g.size+=E+et-M);break;case 0:B&&(M+=e[M]+1),S=this._pmtId=EN(e,M);break;case S:{B&&(M+=e[M]+1);const K=TN(e,M,this.typeSupported,a,this.observer);h=K.videoPid,h>0&&(r.pid=h,r.segmentCodec=K.segmentVideoCodec),f=K.audioPid,f>0&&(l.pid=f,l.segmentCodec=K.segmentAudioCodec),p=K.id3Pid,p>0&&(d.pid=p),y!==null&&!b&&(A.warn(`MPEG-TS PMT found at ${E} after unknown PID '${y}'. Backtracking to sync byte @${x} to parse all TS packets.`),y=null,E=x-188),b=this.pmtParsed=!0;break}case 17:case 8191:break;default:y=I;break}}else T++;T>0&&di(this.observer,new Error(`Found ${T} TS packet/s that do not start with 0x47`)),r.pesData=u,l.pesData=m,d.pesData=g;const v={audioTrack:l,videoTrack:r,id3Track:d,textTrack:c};return i&&this.extractRemainingSamples(v),v}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:a,id3Track:i,textTrack:o}=e,r=a.pesData,l=t.pesData,d=i.pesData;let c;if(r&&(c=Ws(r))?(this.videoParser.parseAVCPES(a,o,c,!0,this._duration),a.pesData=null):a.pesData=r,l&&(c=Ws(l))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else l!=null&&l.size&&A.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=l;d&&(c=Ws(d))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=d}demuxSampleAes(e,t,a){const i=this.demux(e,a,!0,!this.config.progressive),o=this.sampleAes=new kN(this.observer,this.config,t);return this.decrypt(i,o)}decrypt(e,t){return new Promise(a=>{const{audioTrack:i,videoTrack:o}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{o.samples?t.decryptAvcSamples(o.samples,0,0,()=>{a(e)}):a(e)}):o.samples&&t.decryptAvcSamples(o.samples,0,0,()=>{a(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let a=0;const i=this.aacOverFlow;let o=t.data;if(i){this.aacOverFlow=null;const u=i.missing,f=i.sample.unit.byteLength;if(u===-1)o=_t(i.sample.unit,o);else{const p=f-u;i.sample.unit.set(o.subarray(0,u),p),e.samples.push(i.sample),a=i.missing}}let r,l;for(r=a,l=o.length;r<l-1&&!li(o,r);r++);if(r!==a){let u;const f=r<l-1;if(f?u=`AAC PES did not start with ADTS header,offset:${r}`:u="No ADTS header found in AAC PES",di(this.observer,new Error(u),f),!f)return}hp(e,this.observer,o,r,this.audioCodec);let d;if(t.pts!==void 0)d=t.pts;else if(i){const u=up(e.samplerate);d=i.sample.pts+u}else{A.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,h;for(;r<l;)if(h=mp(e,o,r,d,c),r+=h.length,h.missing){this.aacOverFlow=h;break}else for(c++;r<l-1&&!li(o,r);r++);}parseMPEGPES(e,t){const a=t.data,i=a.length;let o=0,r=0;const l=t.pts;if(l===void 0){A.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<i;)if(gp(a,r)){const d=fp(e,a,r,l,o);if(d)r+=d.length,o++;else break}else r++}parseAC3PES(e,t){{const a=t.data,i=t.pts;if(i===void 0){A.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const o=a.length;let r=0,l=0,d;for(;l<o&&(d=Sp(e,a,l,i,r++))>0;)l+=d}}parseID3PES(e,t){if(t.pts===void 0){A.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const a=je({},t,{type:this._videoTrack?Pt.emsg:Pt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(a)}}function Tl(s,e){return((s[e+1]&31)<<8)+s[e+2]}function EN(s,e){return(s[e+10]&31)<<8|s[e+11]}function TN(s,e,t,a,i){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},r=(s[e+1]&15)<<8|s[e+2],l=e+3+r-4,d=(s[e+10]&15)<<8|s[e+11];for(e+=12+d;e<l;){const c=Tl(s,e),h=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!a){Cl("ADTS AAC");break}case 15:o.audioPid===-1&&(o.audioPid=c);break;case 21:o.id3Pid===-1&&(o.id3Pid=c);break;case 219:if(!a){Cl("H.264");break}case 27:o.videoPid===-1&&(o.videoPid=c,o.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?A.log("MPEG audio found, not supported in this browser"):o.audioPid===-1&&(o.audioPid=c,o.segmentAudioCodec="mp3");break;case 193:if(!a){Cl("AC-3");break}case 129:t.ac3?o.audioPid===-1&&(o.audioPid=c,o.segmentAudioCodec="ac3"):A.log("AC-3 audio found, not supported in this browser");break;case 6:if(o.audioPid===-1&&h>0){let u=e+5,f=h;for(;f>2;){switch(s[u]){case 106:t.ac3!==!0?A.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=c,o.segmentAudioCodec="ac3");break}const m=s[u+1]+2;u+=m,f-=m}}break;case 194:case 135:return di(i,new Error("Unsupported EC-3 in M2TS found")),o;case 36:return di(i,new Error("Unsupported HEVC in M2TS found")),o}e+=h+5}return o}function di(s,e,t){A.warn(`parsing error: ${e.message}`),s.emit(_.ERROR,_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Cl(s){A.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function Ws(s){let e=0,t,a,i,o,r;const l=s.data;if(!s||s.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=_t(l[0],l[1]),l.splice(1,1);if(t=l[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(a=(t[4]<<8)+t[5],a&&a>s.size-6)return null;const c=t[7];c&192&&(o=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,c&64?(r=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,o-r>60*9e4&&(A.warn(`${Math.round((o-r)/9e4)}s delta between PTS and DTS, align them`),o=r)):r=o),i=t[8];let h=i+9;if(s.size<=h)return null;s.size-=h;const u=new Uint8Array(s.size);for(let f=0,p=l.length;f<p;f++){t=l[f];let m=t.byteLength;if(h)if(h>m){h-=m;continue}else t=t.subarray(h),m-=h,h=0;u.set(t,e),e+=m}return a&&(a-=i+3),{data:u,pts:o,dts:r,len:a}}return null}class CN extends wl{resetInitSegment(e,t,a,i){super.resetInitSegment(e,t,a,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Ta(e,0);let a=(t==null?void 0:t.length)||0;if(t&&e[a]===11&&e[a+1]===119&&tl(t)!==void 0&&bp(e,a)<=16)return!1;for(let i=e.length;a<i;a++)if(yp(e,a))return A.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return pN(e,t)}appendFrame(e,t,a){if(this.basePTS!==null)return fp(e,t,a,this.basePTS,this.frameIndex)}}class wp{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const ls=Math.pow(2,32)-1;class L{static init(){L.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in L.types)L.types.hasOwnProperty(e)&&(L.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),a=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);L.HDLR_TYPES={video:t,audio:a};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),o=new Uint8Array([0,0,0,0,0,0,0,0]);L.STTS=L.STSC=L.STCO=o,L.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),L.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),L.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const r=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),d=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,r,d,r,l),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,i))}static box(e,...t){let a=8,i=t.length;const o=i;for(;i--;)a+=t[i].byteLength;const r=new Uint8Array(a);for(r[0]=a>>24&255,r[1]=a>>16&255,r[2]=a>>8&255,r[3]=a&255,r.set(e,4),i=0,a=8;i<o;i++)r.set(t[i],a),a+=t[i].byteLength;return r}static hdlr(e){return L.box(L.types.hdlr,L.HDLR_TYPES[e])}static mdat(e){return L.box(L.types.mdat,e)}static mdhd(e,t){t*=e;const a=Math.floor(t/(ls+1)),i=Math.floor(t%(ls+1));return L.box(L.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return L.box(L.types.mdia,L.mdhd(e.timescale,e.duration),L.hdlr(e.type),L.minf(e))}static mfhd(e){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(e)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(e))}static moof(e,t,a){return L.box(L.types.moof,L.mfhd(e),L.traf(a,t))}static moov(e){let t=e.length;const a=[];for(;t--;)a[t]=L.trak(e[t]);return L.box.apply(null,[L.types.moov,L.mvhd(e[0].timescale,e[0].duration)].concat(a).concat(L.mvex(e)))}static mvex(e){let t=e.length;const a=[];for(;t--;)a[t]=L.trex(e[t]);return L.box.apply(null,[L.types.mvex,...a])}static mvhd(e,t){t*=e;const a=Math.floor(t/(ls+1)),i=Math.floor(t%(ls+1)),o=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return L.box(L.types.mvhd,o)}static sdtp(e){const t=e.samples||[],a=new Uint8Array(4+t.length);let i,o;for(i=0;i<t.length;i++)o=t[i].flags,a[i+4]=o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy;return L.box(L.types.sdtp,a)}static stbl(e){return L.box(L.types.stbl,L.stsd(e),L.box(L.types.stts,L.STTS),L.box(L.types.stsc,L.STSC),L.box(L.types.stsz,L.STSZ),L.box(L.types.stco,L.STCO))}static avc1(e){let t=[],a=[],i,o,r;for(i=0;i<e.sps.length;i++)o=e.sps[i],r=o.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(o));for(i=0;i<e.pps.length;i++)o=e.pps[i],r=o.byteLength,a.push(r>>>8&255),a.push(r&255),a=a.concat(Array.prototype.slice.call(o));const l=L.box(L.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(a))),d=e.width,c=e.height,h=e.pixelRatio[0],u=e.pixelRatio[1];return L.box(L.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,d>>8&255,d&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,u>>24,u>>16&255,u>>8&255,u&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return L.box(L.types.mp4a,L.audioStsd(e),L.box(L.types.esds,L.esds(e)))}static mp3(e){return L.box(L.types[".mp3"],L.audioStsd(e))}static ac3(e){return L.box(L.types["ac-3"],L.audioStsd(e),L.box(L.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?L.box(L.types.stsd,L.STSD,L.mp3(e)):e.segmentCodec==="ac3"?L.box(L.types.stsd,L.STSD,L.ac3(e)):L.box(L.types.stsd,L.STSD,L.mp4a(e)):L.box(L.types.stsd,L.STSD,L.avc1(e))}static tkhd(e){const t=e.id,a=e.duration*e.timescale,i=e.width,o=e.height,r=Math.floor(a/(ls+1)),l=Math.floor(a%(ls+1));return L.box(L.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,l>>24,l>>16&255,l>>8&255,l&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,o>>8&255,o&255,0,0]))}static traf(e,t){const a=L.sdtp(e),i=e.id,o=Math.floor(t/(ls+1)),r=Math.floor(t%(ls+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,r>>24,r>>16&255,r>>8&255,r&255])),L.trun(e,a.length+16+20+8+16+8+8),a)}static trak(e){return e.duration=e.duration||4294967295,L.box(L.types.trak,L.tkhd(e),L.mdia(e))}static trex(e){const t=e.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const a=e.samples||[],i=a.length,o=12+16*i,r=new Uint8Array(o);let l,d,c,h,u,f;for(t+=8+o,r.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),l=0;l<i;l++)d=a[l],c=d.duration,h=d.size,u=d.flags,f=d.cts,r.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*l);return L.box(L.types.trun,r)}static initSegment(e){L.types||L.init();const t=L.moov(e);return _t(L.FTYP,t)}}L.types=void 0,L.HDLR_TYPES=void 0,L.STTS=void 0,L.STSC=void 0,L.STCO=void 0,L.STSZ=void 0,L.VMHD=void 0,L.SMHD=void 0,L.STSD=void 0,L.FTYP=void 0,L.DINF=void 0;const kp=9e4;function xl(s,e,t=1,a=!1){const i=s*e*t;return a?Math.round(i):i}function xN(s,e,t=1,a=!1){return xl(s,e,1/t,a)}function va(s,e=!1){return xl(s,1e3,1/kp,e)}function vN(s,e=1){return xl(s,kp,1/e)}const AN=10*1e3,Ep=1024,LN=1152,IN=1536;let Ks=null,vl=null;class hi{constructor(e,t,a,i=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.ISGenerated=!1,Ks===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ks=r?parseInt(r[1]):0}if(vl===null){const o=navigator.userAgent.match(/Safari\/(\d+)/i);vl=o?parseInt(o[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){A.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){A.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){A.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const a=e.reduce((i,o)=>{const r=o.pts-i;return r<-4294967296?(t=!0,wt(i,o.pts)):r>0?i:o.pts},e[0].pts);return t&&A.debug("PTS rollover detected"),a}remux(e,t,a,i,o,r,l,d){let c,h,u,f,p,m,g=o,y=o;const b=e.pid>-1,S=t.pid>-1,w=t.samples.length,x=e.samples.length>0,T=l&&w>0||w>1;if((!b||x)&&(!S||T)||this.ISGenerated||l){if(this.ISGenerated){var E,B,I,R;const se=this.videoTrackConfig;se&&(t.width!==se.width||t.height!==se.height||((E=t.pixelRatio)==null?void 0:E[0])!==((B=se.pixelRatio)==null?void 0:B[0])||((I=t.pixelRatio)==null?void 0:I[1])!==((R=se.pixelRatio)==null?void 0:R[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,o,r);const M=this.isVideoContiguous;let K=-1,H;if(T&&(K=RN(t.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,K>0){A.warn(`[mp4-remuxer]: Dropped ${K} out of ${w} video samples due to a missing keyframe`);const se=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(K),t.dropped+=K,y+=(t.samples[0].pts-se)/t.inputTimeScale,H=y}else K===-1&&(A.warn(`[mp4-remuxer]: No keyframe found out of ${w} video samples`),m=!1);if(this.ISGenerated){if(x&&T){const se=this.getVideoStartPts(t.samples),ne=(wt(e.samples[0].pts,se)-se)/t.inputTimeScale;g+=Math.max(0,ne),y+=Math.max(0,-ne)}if(x){if(e.samplerate||(A.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,o,r)),h=this.remuxAudio(e,g,this.isAudioContiguous,r,S||T||d===le.AUDIO?y:void 0),T){const se=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(A.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,o,r)),c=this.remuxVideo(t,y,M,se)}}else T&&(c=this.remuxVideo(t,y,M,0));c&&(c.firstKeyFrame=K,c.independent=K!==-1,c.firstKeyFramePTS=H)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(a.samples.length&&(p=Tp(a,o,this._initPTS,this._initDTS)),i.samples.length&&(f=Cp(i,o,this._initPTS))),{audio:h,video:c,initSegment:u,independent:m,text:f,id3:p}}generateIS(e,t,a,i){const o=e.samples,r=t.samples,l=this.typeSupported,d={},c=this._initPTS;let h=!c||i,u="audio/mp4",f,p,m;if(h&&(f=p=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(u="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}d.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&l.mpeg?new Uint8Array(0):L.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(m=e.inputTimeScale,!c||m!==c.timescale?f=p=o[0].pts-Math.round(m*a):h=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:L.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(m=t.inputTimeScale,!c||m!==c.timescale){const g=this.getVideoStartPts(r),y=Math.round(m*a);p=Math.min(p,wt(r[0].dts,g)-y),f=Math.min(f,g-y)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(d).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:f,timescale:m},this._initDTS={baseTime:p,timescale:m}):f=m=void 0,{tracks:d,initPTS:f,timescale:m}}remuxVideo(e,t,a,i){const o=e.inputTimeScale,r=e.samples,l=[],d=r.length,c=this._initPTS;let h=this.nextAvcDts,u=8,f=this.videoSampleDuration,p,m,g=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,b=!1;if(!a||h===null){const Z=t*o,q=r[0].pts-wt(r[0].dts,r[0].pts);Ks&&h!==null&&Math.abs(Z-q-h)<15e3?a=!0:h=Z-q}const S=c.baseTime*o/c.timescale;for(let Z=0;Z<d;Z++){const q=r[Z];q.pts=wt(q.pts-S,h),q.dts=wt(q.dts-S,h),q.dts<r[Z>0?Z-1:Z].dts&&(b=!0)}b&&r.sort(function(Z,q){const he=Z.dts-q.dts,J=Z.pts-q.pts;return he||J}),p=r[0].dts,m=r[r.length-1].dts;const w=m-p,x=w?Math.round(w/(d-1)):f||e.inputTimeScale/30;if(a){const Z=p-h,q=Z>x,he=Z<-1;if((q||he)&&(q?A.warn(`AVC: ${va(Z,!0)} ms (${Z}dts) hole between fragments detected at ${t.toFixed(3)}`):A.warn(`AVC: ${va(-Z,!0)} ms (${Z}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!he||h>=r[0].pts||Ks)){p=h;const J=r[0].pts-Z;if(q)r[0].dts=p,r[0].pts=J;else for(let X=0;X<r.length&&!(r[X].dts>J);X++)r[X].dts-=Z,r[X].pts-=Z;A.log(`Video: Initial PTS/DTS adjusted: ${va(J,!0)}/${va(p,!0)}, delta: ${va(Z,!0)} ms`)}}p=Math.max(0,p);let T=0,v=0,E=p;for(let Z=0;Z<d;Z++){const q=r[Z],he=q.units,J=he.length;let X=0;for(let ue=0;ue<J;ue++)X+=he[ue].data.length;v+=X,T+=J,q.length=X,q.dts<E?(q.dts=E,E+=x/4|0||1):E=q.dts,g=Math.min(q.pts,g),y=Math.max(q.pts,y)}m=r[d-1].dts;const B=v+4*T+8;let I;try{I=new Uint8Array(B)}catch(Z){this.observer.emit(_.ERROR,_.ERROR,{type:pe.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:Z,bytes:B,reason:`fail allocating video mdat ${B}`});return}const R=new DataView(I.buffer);R.setUint32(0,B),I.set(L.types.mdat,4);let M=!1,K=Number.POSITIVE_INFINITY,H=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,oe=Number.NEGATIVE_INFINITY;for(let Z=0;Z<d;Z++){const q=r[Z],he=q.units;let J=0;for(let be=0,xe=he.length;be<xe;be++){const te=he[be],Te=te.data,Ce=te.data.byteLength;R.setUint32(u,Ce),u+=4,I.set(Te,u),u+=Ce,J+=4+Ce}let X;if(Z<d-1)f=r[Z+1].dts-q.dts,X=r[Z+1].pts-q.pts;else{const be=this.config,xe=Z>0?q.dts-r[Z-1].dts:x;if(X=Z>0?q.pts-r[Z-1].pts:x,be.stretchShortVideoTrack&&this.nextAudioPts!==null){const te=Math.floor(be.maxBufferHole*o),Te=(i?g+i*o:this.nextAudioPts)-q.pts;Te>te?(f=Te-xe,f<0?f=xe:M=!0,A.log(`[mp4-remuxer]: It is approximately ${Te/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=xe}else f=xe}const ue=Math.round(q.pts-q.dts);K=Math.min(K,f),se=Math.max(se,f),H=Math.min(H,X),oe=Math.max(oe,X),l.push(new xp(q.key,f,J,ue))}if(l.length){if(Ks){if(Ks<70){const Z=l[0].flags;Z.dependsOn=2,Z.isNonSync=0}}else if(vl&&oe-H<se-K&&x/se<.025&&l[0].cts===0){A.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Z=p;for(let q=0,he=l.length;q<he;q++){const J=Z+l[q].duration,X=Z+l[q].cts;if(q<he-1){const ue=J+l[q+1].cts;l[q].duration=ue-X}else l[q].duration=q?l[q-1].duration:x;l[q].cts=0,Z=J}}}f=M||!f?x:f,this.nextAvcDts=h=m+f,this.videoSampleDuration=f,this.isVideoContiguous=!0;const de={data1:L.moof(e.sequenceNumber++,p,je({},e,{samples:l})),data2:I,startPTS:g/o,endPTS:(y+f)/o,startDTS:p/o,endDTS:h/o,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,de}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return LN;case"ac3":return IN;default:return Ep}}remuxAudio(e,t,a,i,o){const r=e.inputTimeScale,l=e.samplerate?e.samplerate:r,d=r/l,c=this.getSamplesPerFrame(e),h=c*d,u=this._initPTS,f=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,p=[],m=o!==void 0;let g=e.samples,y=f?0:8,b=this.nextAudioPts||-1;const S=t*r,w=u.baseTime*r/u.timescale;if(this.isAudioContiguous=a=a||g.length&&b>0&&(i&&Math.abs(S-b)<9e3||Math.abs(wt(g[0].pts-w,S)-b)<20*h),g.forEach(function(ne){ne.pts=wt(ne.pts-w,S)}),!a||b<0){if(g=g.filter(ne=>ne.pts>=0),!g.length)return;o===0?b=0:i&&!m?b=Math.max(0,S):b=g[0].pts}if(e.segmentCodec==="aac"){const ne=this.config.maxAudioFramesDrift;for(let ce=0,de=b;ce<g.length;ce++){const Z=g[ce],q=Z.pts,he=q-de,J=Math.abs(1e3*he/r);if(he<=-ne*h&&m)ce===0&&(A.warn(`Audio frame @ ${(q/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*he/r)} ms.`),this.nextAudioPts=b=de=q);else if(he>=ne*h&&J<AN&&m){let X=Math.round(he/h);de=q-X*h,de<0&&(X--,de+=h),ce===0&&(this.nextAudioPts=b=de),A.warn(`[mp4-remuxer]: Injecting ${X} audio frame @ ${(de/r).toFixed(3)}s due to ${Math.round(1e3*he/r)} ms gap.`);for(let ue=0;ue<X;ue++){const be=Math.max(de,0);let xe=wp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);xe||(A.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=Z.unit.subarray()),g.splice(ce,0,{unit:xe,pts:be}),de+=h,ce++}}Z.pts=de,de+=h}}let x=null,T=null,v,E=0,B=g.length;for(;B--;)E+=g[B].unit.byteLength;for(let ne=0,ce=g.length;ne<ce;ne++){const de=g[ne],Z=de.unit;let q=de.pts;if(T!==null){const J=p[ne-1];J.duration=Math.round((q-T)/d)}else if(a&&e.segmentCodec==="aac"&&(q=b),x=q,E>0){E+=y;try{v=new Uint8Array(E)}catch(J){this.observer.emit(_.ERROR,_.ERROR,{type:pe.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:J,bytes:E,reason:`fail allocating audio mdat ${E}`});return}f||(new DataView(v.buffer).setUint32(0,E),v.set(L.types.mdat,4))}else return;v.set(Z,y);const he=Z.byteLength;y+=he,p.push(new xp(!0,c,he,0)),T=q}const I=p.length;if(!I)return;const R=p[p.length-1];this.nextAudioPts=b=T+d*R.duration;const M=f?new Uint8Array(0):L.moof(e.sequenceNumber++,x/d,je({},e,{samples:p}));e.samples=[];const K=x/r,H=b/r,oe={data1:M,data2:v,startPTS:K,endPTS:H,startDTS:K,endDTS:H,type:"audio",hasAudio:!0,hasVideo:!1,nb:I};return this.isAudioContiguous=!0,oe}remuxEmptyAudio(e,t,a,i){const o=e.inputTimeScale,r=e.samplerate?e.samplerate:o,l=o/r,d=this.nextAudioPts,c=this._initDTS,h=c.baseTime*9e4/c.timescale,u=(d!==null?d:i.startDTS*o)+h,f=i.endDTS*o+h,p=l*Ep,m=Math.ceil((f-u)/p),g=wp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(A.warn("[mp4-remuxer]: remux empty Audio"),!g){A.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const y=[];for(let b=0;b<m;b++){const S=u+b*p;y.push({unit:g,pts:S,dts:S})}return e.samples=y,this.remuxAudio(e,t,a,!1)}}function wt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function RN(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function Tp(s,e,t,a){const i=s.samples.length;if(!i)return;const o=s.inputTimeScale;for(let l=0;l<i;l++){const d=s.samples[l];d.pts=wt(d.pts-t.baseTime*o/t.timescale,e*o)/o,d.dts=wt(d.dts-a.baseTime*o/a.timescale,e*o)/o}const r=s.samples;return s.samples=[],{samples:r}}function Cp(s,e,t){const a=s.samples.length;if(!a)return;const i=s.inputTimeScale;for(let r=0;r<a;r++){const l=s.samples[r];l.pts=wt(l.pts-t.baseTime*i/t.timescale,e*i)/i}s.samples.sort((r,l)=>r.pts-l.pts);const o=s.samples;return s.samples=[],{samples:o}}class xp{constructor(e,t,a,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=a,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class BN{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,a,i){this.audioCodec=t,this.videoCodec=a,this.generateInitSegment(M3(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:a}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=Sf(e);i.audio&&(t=vp(i.audio,Be.AUDIO)),i.video&&(a=vp(i.video,Be.VIDEO));const o={};i.audio&&i.video?o.audiovideo={container:"video/mp4",codec:t+","+a,initSegment:e,id:"main"}:i.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?o.video={container:"video/mp4",codec:a,initSegment:e,id:"main"}:A.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,a,i,o,r){var l,d;let{initPTS:c,lastEndTime:h}=this;const u={audio:void 0,video:void 0,text:i,id3:a,initSegment:void 0};ae(h)||(h=this.lastEndTime=o||0);const f=t.samples;if(!(f!=null&&f.length))return u;const p={initPTS:void 0,timescale:1};let m=this.initData;if((l=m)!=null&&l.length||(this.generateInitSegment(f),m=this.initData),!((d=m)!=null&&d.length))return A.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1);const g=$3(f,m),y=V3(m,f),b=y===null?o:y;(NN(c,b,o,g)||p.timescale!==c.timescale&&r)&&(p.initPTS=b-o,c&&c.timescale===1&&A.warn(`Adjusting initPTS by ${p.initPTS-c.baseTime}`),this.initPTS=c={baseTime:p.initPTS,timescale:1});const S=e?b-c.baseTime/c.timescale:h,w=S+g;U3(m,f,c.baseTime/c.timescale),g>0?this.lastEndTime=w:(A.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const x=!!m.audio,T=!!m.video;let v="";x&&(v+="audio"),T&&(v+="video");const E={data1:f,startPTS:S,startDTS:S,endPTS:w,endDTS:w,type:v,hasAudio:x,hasVideo:T,nb:1,dropped:0};return u.audio=E.type==="audio"?E:void 0,u.video=E.type!=="audio"?E:void 0,u.initSegment=p,u.id3=Tp(a,o,c,c),i.samples.length&&(u.text=Cp(i,o,c)),u}}function NN(s,e,t,a){if(s===null)return!0;const i=Math.max(a,1),o=e-s.baseTime/s.timescale;return Math.abs(o-t)>i}function vp(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===Be.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Jn(t,!1);const a="mp4a.40.5";return A.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${a}"`),a}return A.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Zt;try{Zt=self.performance.now.bind(self.performance)}catch{A.debug("Unable to use Performance API on this environment"),Zt=Vs==null?void 0:Vs.Date.now}const ui=[{demux:bN,remux:BN},{demux:rs,remux:hi},{demux:gN,remux:hi},{demux:CN,remux:hi}];ui.splice(2,0,{demux:SN,remux:hi});class Ap{constructor(e,t,a,i,o){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=a,this.vendor=i,this.id=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,a,i){const o=a.transmuxing;o.executeStart=Zt();let r=new Uint8Array(e);const{currentTransmuxState:l,transmuxConfig:d}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:h,trackSwitch:u,accurateTimeOffset:f,timeOffset:p,initSegmentChange:m}=i||l,{audioCodec:g,videoCodec:y,defaultInitPts:b,duration:S,initSegmentData:w}=d,x=DN(r,t);if(x&&x.method==="AES-128"){const B=this.getDecrypter();if(B.isSync()){let I=B.softwareDecrypt(r,x.key.buffer,x.iv.buffer);if(a.part>-1&&(I=B.flush()),!I)return o.executeEnd=Zt(),Al(a);r=new Uint8Array(I)}else return this.decryptionPromise=B.webCryptoDecrypt(r,x.key.buffer,x.iv.buffer).then(I=>{const R=this.push(I,null,a);return this.decryptionPromise=null,R}),this.decryptionPromise}const T=this.needsProbing(h,u);if(T){const B=this.configureTransmuxer(r);if(B)return A.warn(`[transmuxer] ${B.message}`),this.observer.emit(_.ERROR,_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,error:B,reason:B.message}),o.executeEnd=Zt(),Al(a)}(h||u||m||T)&&this.resetInitSegment(w,g,y,S,t),(h||m||T)&&this.resetInitialTimestamp(b),c||this.resetContiguity();const v=this.transmux(r,x,p,f,a),E=this.currentTransmuxState;return E.contiguous=!0,E.discontinuity=!1,E.trackSwitch=!1,o.executeEnd=Zt(),v}flush(e){const t=e.transmuxing;t.executeStart=Zt();const{decrypter:a,currentTransmuxState:i,decryptionPromise:o}=this;if(o)return o.then(()=>this.flush(e));const r=[],{timeOffset:l}=i;if(a){const u=a.flush();u&&r.push(this.push(u,null,e))}const{demuxer:d,remuxer:c}=this;if(!d||!c)return t.executeEnd=Zt(),[Al(e)];const h=d.flush(l);return mi(h)?h.then(u=>(this.flushRemux(r,u,e),r)):(this.flushRemux(r,h,e),r)}flushRemux(e,t,a){const{audioTrack:i,videoTrack:o,id3Track:r,textTrack:l}=t,{accurateTimeOffset:d,timeOffset:c}=this.currentTransmuxState;A.log(`[transmuxer.ts]: Flushed fragment ${a.sn}${a.part>-1?" p: "+a.part:""} of level ${a.level}`);const h=this.remuxer.remux(i,o,r,l,c,d,!0,this.id);e.push({remuxResult:h,chunkMeta:a}),a.transmuxing.executeEnd=Zt()}resetInitialTimestamp(e){const{demuxer:t,remuxer:a}=this;!t||!a||(t.resetTimeStamp(e),a.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,a,i,o){const{demuxer:r,remuxer:l}=this;!r||!l||(r.resetInitSegment(e,t,a,i),l.resetInitSegment(e,t,a,o))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,a,i,o){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,a,i,o):r=this.transmuxUnencrypted(e,a,i,o),r}transmuxUnencrypted(e,t,a,i){const{audioTrack:o,videoTrack:r,id3Track:l,textTrack:d}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(o,r,l,d,t,a,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,a,i,o){return this.demuxer.demuxSampleAes(e,t,a).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,a,i,!1,this.id),chunkMeta:o}))}configureTransmuxer(e){const{config:t,observer:a,typeSupported:i,vendor:o}=this;let r;for(let f=0,p=ui.length;f<p;f++){var l;if((l=ui[f].demux)!=null&&l.probe(e)){r=ui[f];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const d=this.demuxer,c=this.remuxer,h=r.remux,u=r.demux;(!c||!(c instanceof h))&&(this.remuxer=new h(a,t,i,o)),(!d||!(d instanceof u))&&(this.demuxer=new u(a,t,i),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Sl(this.config)),e}}function DN(s,e){let t=null;return s.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Al=s=>({remuxResult:{},chunkMeta:s});function mi(s){return"then"in s&&s.then instanceof Function}class PN{constructor(e,t,a,i,o){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=a,this.duration=i,this.defaultInitPts=o||null}}class ON{constructor(e,t,a,i,o,r){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=a,this.trackSwitch=i,this.timeOffset=o,this.initSegmentChange=r}}var Lp={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(t=!1));function i(d,c,h){this.fn=d,this.context=c,this.once=h||!1}function o(d,c,h,u,f){if(typeof h!="function")throw new TypeError("The listener must be a function");var p=new i(h,u||d,f),m=t?t+c:c;return d._events[m]?d._events[m].fn?d._events[m]=[d._events[m],p]:d._events[m].push(p):(d._events[m]=p,d._eventsCount++),d}function r(d,c){--d._eventsCount===0?d._events=new a:delete d._events[c]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],h,u;if(this._eventsCount===0)return c;for(u in h=this._events)e.call(h,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},l.prototype.listeners=function(c){var h=t?t+c:c,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,p=u.length,m=new Array(p);f<p;f++)m[f]=u[f].fn;return m},l.prototype.listenerCount=function(c){var h=t?t+c:c,u=this._events[h];return u?u.fn?1:u.length:0},l.prototype.emit=function(c,h,u,f,p,m){var g=t?t+c:c;if(!this._events[g])return!1;var y=this._events[g],b=arguments.length,S,w;if(y.fn){switch(y.once&&this.removeListener(c,y.fn,void 0,!0),b){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,h),!0;case 3:return y.fn.call(y.context,h,u),!0;case 4:return y.fn.call(y.context,h,u,f),!0;case 5:return y.fn.call(y.context,h,u,f,p),!0;case 6:return y.fn.call(y.context,h,u,f,p,m),!0}for(w=1,S=new Array(b-1);w<b;w++)S[w-1]=arguments[w];y.fn.apply(y.context,S)}else{var x=y.length,T;for(w=0;w<x;w++)switch(y[w].once&&this.removeListener(c,y[w].fn,void 0,!0),b){case 1:y[w].fn.call(y[w].context);break;case 2:y[w].fn.call(y[w].context,h);break;case 3:y[w].fn.call(y[w].context,h,u);break;case 4:y[w].fn.call(y[w].context,h,u,f);break;default:if(!S)for(T=1,S=new Array(b-1);T<b;T++)S[T-1]=arguments[T];y[w].fn.apply(y[w].context,S)}}return!0},l.prototype.on=function(c,h,u){return o(this,c,h,u,!1)},l.prototype.once=function(c,h,u){return o(this,c,h,u,!0)},l.prototype.removeListener=function(c,h,u,f){var p=t?t+c:c;if(!this._events[p])return this;if(!h)return r(this,p),this;var m=this._events[p];if(m.fn)m.fn===h&&(!f||m.once)&&(!u||m.context===u)&&r(this,p);else{for(var g=0,y=[],b=m.length;g<b;g++)(m[g].fn!==h||f&&!m[g].once||u&&m[g].context!==u)&&y.push(m[g]);y.length?this._events[p]=y.length===1?y[0]:y:r(this,p)}return this},l.prototype.removeAllListeners=function(c){var h;return c?(h=t?t+c:c,this._events[h]&&r(this,h)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,s.exports=l})(Lp);var FN=Lp.exports,Ll=o3(FN);class Ip{constructor(e,t,a,i){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const o=e.config;this.hls=e,this.id=t,this.useWorker=!!o.enableWorker,this.onTransmuxComplete=a,this.onFlush=i;const r=(c,h)=>{h=h||{},h.frag=this.frag,h.id=this.id,c===_.ERROR&&(this.error=h.error),this.hls.trigger(c,h)};this.observer=new Ll,this.observer.on(_.FRAG_DECRYPTED,r),this.observer.on(_.ERROR,r);const l=Ts(o.preferManagedMediaSource)||{isTypeSupported:()=>!1},d={mpeg:l.isTypeSupported("audio/mpeg"),mp3:l.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:l.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker<"u"&&(o.workerPath||sN())){try{o.workerPath?(A.log(`loading Web Worker ${o.workerPath} for "${t}"`),this.workerContext=nN(o.workerPath)):(A.log(`injecting Web Worker for "${t}"`),this.workerContext=aN()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:h}=this.workerContext;h.addEventListener("message",this.onwmsg),h.onerror=u=>{const f=new Error(`${u.message} (${u.filename}:${u.lineno})`);o.enableWorker=!1,A.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:f})},h.postMessage({cmd:"init",typeSupported:d,vendor:"",id:t,config:JSON.stringify(o)})}catch(h){A.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.resetWorker(),this.error=null,this.transmuxer=new Ap(this.observer,d,o,"",t)}return}this.transmuxer=new Ap(this.observer,d,o,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,a,i,o,r,l,d,c,h){var u,f;c.transmuxing.start=self.performance.now();const{transmuxer:p}=this,m=r?r.start:o.start,g=o.decryptdata,y=this.frag,b=!(y&&o.cc===y.cc),S=!(y&&c.level===y.level),w=y?c.sn-y.sn:-1,x=this.part?c.part-this.part.index:-1,T=w===0&&c.id>1&&c.id===(y==null?void 0:y.stats.chunkCount),v=!S&&(w===1||w===0&&(x===1||T&&x<=0)),E=self.performance.now();(S||w||o.stats.parsing.start===0)&&(o.stats.parsing.start=E),r&&(x||!v)&&(r.stats.parsing.start=E);const B=!(y&&((u=o.initSegment)==null?void 0:u.url)===((f=y.initSegment)==null?void 0:f.url)),I=new ON(b,v,d,S,m,B);if(!v||b||B){A.log(`[transmuxer-interface, ${o.type}]: Starting new transmux session for sn: ${c.sn} p: ${c.part} level: ${c.level} id: ${c.id}
|
|
50
50
|
discontinuity: ${b}
|
|
51
51
|
trackSwitch: ${S}
|
|
52
52
|
contiguous: ${v}
|
|
53
53
|
accurateTimeOffset: ${d}
|
|
54
54
|
timeOffset: ${m}
|
|
55
|
-
initSegmentChange: ${B}`);const R=new PN(a,i,t,l,h);this.configureTransmuxer(R)}if(this.frag=o,this.part=r,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:c,state:I},e instanceof ArrayBuffer?[e]:[]);else if(p){const R=p.push(e,g,c,I);mi(R)?(p.async=!0,R.then(M=>{this.handleTransmuxComplete(M)}).catch(M=>{this.transmuxerError(M,c,"transmuxer-interface push error")})):(p.async=!1,this.handleTransmuxComplete(R))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let a=t.flush(e);mi(a)||t.async?(mi(a)||(a=Promise.resolve(a)),a.then(o=>{this.handleFlushResult(o,e)}).catch(o=>{this.transmuxerError(o,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}}transmuxerError(e,t,a){this.hls&&(this.error=e,this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:a}))}handleFlushResult(e,t){e.forEach(a=>{this.handleTransmuxComplete(a)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){A.warn(`worker message received with no ${t?"event name":"data"}`);return}const a=this.hls;if(this.hls)switch(t.event){case"init":{var i;const o=(i=this.workerContext)==null?void 0:i.objectURL;o&&self.URL.revokeObjectURL(o);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":A[t.data.logType]&&A[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,a.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Rp(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!qs(s[t].attrs,e[t].attrs))return!1;return!0}function qs(s,e,t){const a=s["STABLE-RENDITION-ID"];return a&&!t?a===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>s[i]!==e[i])}function Il(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}const Bp=100;class MN extends _l{constructor(e,t,a){super(e,t,a,"[audio-stream-controller]",le.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.ERROR,this.onError,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.ERROR,this.onError,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:a,initPTS:i,timescale:o}){if(a==="main"){const r=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:o},this.log(`InitPTS for cc: ${r} found from main: ${i}`),this.videoTrackCC=r,this.state===V.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=V.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Bp),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=V.IDLE):(this.loadedmetadata=!1,this.state=V.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case V.IDLE:this.doTickIdle();break;case V.WAITING_TRACK:{var e;const{levels:a,trackId:i}=this,o=a==null||(e=a[i])==null?void 0:e.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=V.WAITING_INIT_PTS}break}case V.FRAG_LOADING_WAITING_RETRY:{var t;const a=performance.now(),i=this.retryDate;if(!i||a>=i||(t=this.media)!=null&&t.seeking){const{levels:o,trackId:r}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((o==null?void 0:o[r])||null),this.state=V.IDLE}break}case V.WAITING_INIT_PTS:{const a=this.waitingData;if(a){const{frag:i,part:o,cache:r,complete:l}=a;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=V.FRAG_LOADING;const d=r.flush(),c={frag:i,part:o,payload:d,networkDetails:null};this._handleFragmentLoadProgress(c),l&&super._handleFragmentLoadComplete(c)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const d=this.getLoadPosition(),c=Pe.bufferInfo(this.mediaBuffer,d,this.config.maxBufferHole);gl(c.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${c.end} is needed`),this.clearWaitingFragment())}}else this.state=V.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=V.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:a,trackId:i}=this,o=e.config;if(!a&&(this.startFragRequested||!o.startFragPrefetch)||!(t!=null&&t[i]))return;const r=t[i],l=r.details;if(!l||l.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(l)){this.state=V.WAITING_TRACK;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,Be.AUDIO,le.AUDIO));const c=this.getFwdBufferInfo(d,le.AUDIO);if(c===null)return;const{bufferedTrack:h,switchingTrack:u}=this;if(!u&&this._streamEnded(c,l)){e.trigger(_.BUFFER_EOS,{type:"audio"}),this.state=V.ENDED;return}const f=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,le.MAIN),p=c.len,m=this.getMaxBufferLength(f==null?void 0:f.len),g=l.fragments,y=g[0].start;let b=this.flushing?this.getLoadPosition():c.end;if(u&&a){const T=this.getLoadPosition();h&&!qs(u.attrs,h.attrs)&&(b=T),l.PTSKnown&&T<y&&(c.end>y||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=y+.05)}if(p>=m&&!u&&b<g[g.length-1].start)return;let S=this.getNextFragment(b,l),w=!1;if(S&&this.isLoopLoading(S,b)&&(w=!!S.gap,S=this.getNextFragmentLoopLoading(S,l,c,le.MAIN,m)),!S){this.bufferFlushed=!0;return}const x=f&&S.start>f.end+l.targetduration;if(x||!(f!=null&&f.len)&&c.len){const T=this.getAppendedFrag(S.start,le.MAIN);if(T===null||(w||(w=!!T.gap||!!x&&f.len===0),x&&!w||w&&c.nextStart&&c.nextStart<T.end))return}this.loadFragment(S,r,b)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(a=>new zs(a))}onAudioTrackSwitching(e,t){const a=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),a?this.setInterval(Bp):this.resetTransmuxer(),a?(this.switchingTrack=t,this.state=V.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=V.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(_.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var a;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:o,id:r}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${r}`);return}this.log(`Audio track ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`);const l=i[r];let d=0;if(o.live||(a=l.details)!=null&&a.live){this.checkLiveUpdate(o);const h=this.mainDetails;if(o.deltaUpdateFailed||!h)return;if(!l.details&&o.hasProgramDateTime&&h.hasProgramDateTime)ri(o,h),d=o.fragments[0].start;else{var c;d=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details)}}l.details=o,this.levelLastLoaded=l,!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,d),this.state===V.WAITING_TRACK&&!this.waitForCdnTuneIn(o)&&(this.state=V.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:a,part:i,payload:o}=e,{config:r,trackId:l,levels:d}=this;if(!d){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${a.sn} of level ${a.level} will not be buffered`);return}const c=d[l];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const h=c.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(a.start);return}const u=r.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let f=this.transmuxer;f||(f=this.transmuxer=new Ip(this.hls,le.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const p=this.initPTS[a.cc],m=(t=a.initSegment)==null?void 0:t.data;if(p!==void 0){const y=i?i.index:-1,b=y!==-1,S=new bl(a.level,a.sn,a.stats.chunkCount,o.byteLength,y,b);f.push(o,m,u,"",a,i,h.totalduration,!1,S,p)}else{this.log(`Unknown video PTS for cc ${a.cc}, waiting for video PTS before demuxing audio frag ${a.sn} of [${h.startSN} ,${h.endSN}],track ${l}`);const{cache:g}=this.waitingData=this.waitingData||{frag:a,part:i,cache:new lp,complete:!1};g.push(new Uint8Array(o)),this.waitingVideoCC=this.videoTrackCC,this.state=V.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const a=t.tracks.audio;a&&(this.mediaBuffer=a.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:a,part:i}=t;if(a.type!==le.AUDIO){if(!this.loadedmetadata&&a.type===le.MAIN){const o=this.videoBuffer||this.media;o&&Pe.getBuffered(o).length&&(this.loadedmetadata=!0)}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}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(a.sn!=="initSegment"){this.fragPrevious=a;const o=this.switchingTrack;o&&(this.bufferedTrack=o,this.switchingTrack=null,this.hls.trigger(_.AUDIO_TRACK_SWITCHED,Ze({},o)))}this.fragBufferedComplete(a,i)}onError(e,t){var a;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.AUDIO,t);break;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_TRACK&&((a=t.context)==null?void 0:a.type)===ve.AUDIO_TRACK&&(this.state=V.IDLE);break;case N.BUFFER_APPEND_ERROR:case N.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===N.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Be.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Be.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===V.ENDED&&(this.state=V.IDLE);const a=this.mediaBuffer||this.media;a&&(this.afterBufferFlushed(a,t,le.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const a="audio",{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,{details:u}=h,{audio:f,text:p,id3:m,initSegment:g}=o;if(this.fragContextChanged(d)||!u){this.fragmentTracker.removeFragment(d);return}if(this.state=V.PARSING,this.switchingTrack&&f&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const y=d.initSegment||d;this._bufferInitSegment(h,g.tracks,y,r),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:a,tracks:g.tracks})}if(f){const{startPTS:y,endPTS:b,startDTS:S,endDTS:w}=f;c&&(c.elementaryStreams[Be.AUDIO]={startPTS:y,endPTS:b,startDTS:S,endDTS:w}),d.setElementaryStreamInfo(Be.AUDIO,y,b,S,w),this.bufferFragmentData(f,d,c,r)}if(m!=null&&(t=m.samples)!=null&&t.length){const y=je({id:a,frag:d,details:u},m);i.trigger(_.FRAG_PARSING_METADATA,y)}if(p){const y=je({id:a,frag:d,details:u},p);i.trigger(_.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,a,i){if(this.state!==V.PARSING)return;t.video&&delete t.video;const o=t.audio;if(!o)return;o.id="audio";const r=e.audioCodec;this.log(`Init audio buffer, container:${o.container}, codecs[level/parsed]=[${r}/${o.codec}]`),r&&r.split(",").length===1&&(o.levelCodec=r),this.hls.trigger(_.BUFFER_CODECS,t);const l=o.initSegment;if(l!=null&&l.byteLength){const d={type:"audio",frag:a,part:null,chunkMeta:i,parent:a.type,data:l};this.hls.trigger(_.BUFFER_APPENDING,d)}this.tickImmediate()}loadFragment(e,t,a){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===Qe.NOT_LOADED||i===Qe.PARTIAL){var o;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((o=t.details)!=null&&o.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=V.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragments[0].start!==t.details.fragments[0].start&&ri(t.details,r)}else this.startFragRequested=!0,super.loadFragment(e,t,a)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:a}=this,i=a==null?void 0:a.attrs,o=e.attrs;t&&i&&(i.CHANNELS!==o.CHANNELS||a.name!==e.name||a.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(_.AUDIO_TRACK_SWITCHED,Ze({},e))}}class VN extends yl{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:a,groupId:i,details:o}=t,r=this.tracksInGroup[a];if(!r||r.groupId!==i){this.warn(`Audio track with id:${a} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const l=r.details;r.details=t.details,this.log(`Audio track ${a} "${r.name}" lang:${r.lang} group:${i} loaded [${o.startSN}-${o.endSN}]`),a===this.trackId&&this.playlistLoaded(a,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const a=t.audioGroups||null,i=this.groupIds;let o=this.currentTrack;if(!a||(i==null?void 0:i.length)!==(a==null?void 0:a.length)||a!=null&&a.some(l=>(i==null?void 0:i.indexOf(l))===-1)){this.groupIds=a,this.trackId=-1,this.currentTrack=null;const l=this.tracks.filter(f=>!a||a.indexOf(f.groupId)!==-1);if(l.length)this.selectDefaultTrack&&!l.some(f=>f.default)&&(this.selectDefaultTrack=!1),l.forEach((f,p)=>{f.id=p});else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=l;const d=this.hls.config.audioPreference;if(!o&&d){const f=Ht(d,l,js);if(f>-1)o=l[f];else{const p=Ht(d,this.tracks);o=this.tracks[p]}}let c=this.findTrackId(o);c===-1&&o&&(c=this.findTrackId(null));const h={audioTracks:l};this.log(`Updating audio tracks, ${l.length} track(s) found in group(s): ${a==null?void 0:a.join(",")}`),this.hls.trigger(_.AUDIO_TRACKS_UPDATED,h);const u=this.trackId;if(c!==-1&&u===-1)this.setAudioTrack(c);else if(l.length&&u===-1){var r;const f=new Error(`No audio track selected for current audio group-ID(s): ${(r=this.groupIds)==null?void 0:r.join(",")} track count: ${l.length}`);this.warn(f.message),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}else this.shouldReloadPlaylist(o)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===ve.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const a=this.allAudioTracks;if(this.selectDefaultTrack=!1,a.length){const i=this.currentTrack;if(i&&Gs(e,i,js))return i;const o=Ht(e,this.tracksInGroup,js);if(o>-1){const r=this.tracksInGroup[o];return this.setAudioTrack(o),r}else if(i){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const l=V6(e,t.levels,a,r,js);if(l===-1)return null;t.nextLoadLevel=l}if(e.channels||e.audioCodec){const r=Ht(e,a);if(r>-1)return a[r]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const a=this.currentTrack,i=t[e],o=i.details&&!i.details.live;if(e===this.trackId&&i===a&&o||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(_.AUDIO_TRACK_SWITCHING,Ze({},i)),o))return;const r=this.switchParams(i.url,a==null?void 0:a.details,i.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let a=0;a<t.length;a++){const i=t[a];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Gs(e,i,js)))return a}if(e){const{name:a,lang:i,assocLang:o,characteristics:r,audioCodec:l,channels:d}=e;for(let c=0;c<t.length;c++){const h=t[c];if(Gs({name:a,lang:i,assocLang:o,characteristics:r,audioCodec:l,channels:d},h,js))return c}for(let c=0;c<t.length;c++){const h=t[c];if(qs(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const h=t[c];if(qs(e.attrs,h.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const a=t.id,i=t.groupId;let o=t.url;if(e)try{o=e.addDirectives(o)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}this.log(`loading audio-track playlist ${a} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(_.AUDIO_TRACK_LOADING,{url:o,id:a,groupId:i,deliveryDirectives:e||null})}}}const Np=500;class $N extends _l{constructor(e,t,a){super(e,t,a,"[subtitle-stream-controller]",le.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.ERROR,this.onError,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.ERROR,this.onError,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=V.IDLE,this.setInterval(Np),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:a,success:i}=t;if(this.fragPrevious=a,this.state=V.IDLE,!i)return;const o=this.tracksBuffered[this.currentTrackId];if(!o)return;let r;const l=a.start;for(let c=0;c<o.length;c++)if(l>=o[c].start&&l<=o[c].end){r=o[c];break}const d=a.start+a.duration;r?r.end=d:(r={start:l,end:d},o.push(r)),this.fragmentTracker.fragBuffered(a),this.fragBufferedComplete(a,null)}onBufferFlushing(e,t){const{startOffset:a,endOffset:i}=t;if(a===0&&i!==Number.POSITIVE_INFINITY){const o=i-1;if(o<=0)return;t.endOffsetSubtitles=Math.max(0,o),this.tracksBuffered.forEach(r=>{for(let l=0;l<r.length;){if(r[l].end<=o){r.shift();continue}else if(r[l].start<o)r[l].start=o;else break;l++}}),this.fragmentTracker.removeFragmentsInRange(a,o,le.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===le.MAIN){var a;(a=this.media)!=null&&a.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const a=t.frag;(a==null?void 0:a.type)===le.SUBTITLE&&(t.details===N.FRAG_GAP&&this.fragmentTracker.fragBuffered(a,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==V.STOPPED&&(this.state=V.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Rp(this.levels,t)){this.levels=t.map(a=>new zs(a));return}this.tracksBuffered=[],this.levels=t.map(a=>{const i=new zs(a);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,le.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var a;if(this.currentTrackId=t.id,!((a=this.levels)!=null&&a.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(Np)}onSubtitleTrackLoaded(e,t){var a;const{currentTrackId:i,levels:o}=this,{details:r,id:l}=t;if(!o){this.warn(`Subtitle tracks were reset while loading level ${l}`);return}const d=o[l];if(l>=o.length||!d)return;this.log(`Subtitle track ${l} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(r.live||(a=d.details)!=null&&a.live){const u=this.mainDetails;if(r.deltaUpdateFailed||!u)return;const f=u.fragments[0];if(!d.details)r.hasProgramDateTime&&u.hasProgramDateTime?(ri(r,u),c=r.fragments[0].start):f&&(c=f.start,fl(r,c));else{var h;c=this.alignPlaylists(r,d.details,(h=this.levelLastLoaded)==null?void 0:h.details),c===0&&f&&(c=f.start,fl(r,c))}}d.details=r,this.levelLastLoaded=d,l===i&&(!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(this.mainDetails||r,c),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===V.IDLE&&(ai(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),d.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:a}=e,i=t.decryptdata,o=this.hls;if(!this.fragContextChanged(t)&&a&&a.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const r=performance.now();this.decrypter.decrypt(new Uint8Array(a),i.key.buffer,i.iv.buffer).catch(l=>{throw o.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:t}),l}).then(l=>{const d=performance.now();o.trigger(_.FRAG_DECRYPTED,{frag:t,payload:l,stats:{tstart:r,tdecrypt:d}})}).catch(l=>{this.warn(`${l.name}: ${l.message}`),this.state=V.IDLE})}}doTick(){if(!this.media){this.state=V.IDLE;return}if(this.state===V.IDLE){const{currentTrackId:e,levels:t}=this,a=t==null?void 0:t[e];if(!a||!t.length||!a.details)return;const{config:i}=this,o=this.getLoadPosition(),r=Pe.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],o,i.maxBufferHole),{end:l,len:d}=r,c=this.getFwdBufferInfo(this.media,le.MAIN),h=a.details,u=this.getMaxBufferLength(c==null?void 0:c.len)+h.levelTargetDuration;if(d>u)return;const f=h.fragments,p=f.length,m=h.edge;let g=null;const y=this.fragPrevious;if(l<m){const b=i.maxFragLookUpTolerance,S=l>m-b?0:b;g=ai(y,f,Math.max(f[0].start,l),S),!g&&y&&y.start<f[0].start&&(g=f[0])}else g=f[p-1];if(!g)return;if(g=this.mapToInitFragWhenRequired(g),g.sn!=="initSegment"){const b=g.sn-h.startSN,S=f[b-1];S&&S.cc===g.cc&&this.fragmentTracker.getState(S)===Qe.NOT_LOADED&&(g=S)}this.fragmentTracker.getState(g)===Qe.NOT_LOADED&&this.loadFragment(g,a,l)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,a){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,a))}get mediaBufferTimeRanges(){return new zN(this.tracksBuffered[this.currentTrackId]||[])}}class zN{constructor(e){this.buffered=void 0;const t=(a,i,o)=>{if(i=i>>>0,i>o-1)throw new DOMException(`Failed to execute '${a}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${o})`);return e[i][a]};this.buffered={get length(){return e.length},end(a){return t("end",a,e.length)},start(a){return t("start",a,e.length)}}}}class UN extends yl{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const a=Xn(this.media.textTracks);for(let o=0;o<a.length;o++)if(a[o].mode==="hidden")t=a[o];else if(a[o].mode==="showing"){t=a[o];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Xn(this.media.textTracks).forEach(t=>{$s(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:a,groupId:i,details:o}=t,r=this.tracksInGroup[a];if(!r||r.groupId!==i){this.warn(`Subtitle track with id:${a} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const l=r.details;r.details=t.details,this.log(`Subtitle track ${a} "${r.name}" lang:${r.lang} group:${i} loaded [${o.startSN}-${o.endSN}]`),a===this.trackId&&this.playlistLoaded(a,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const a=t.subtitleGroups||null,i=this.groupIds;let o=this.currentTrack;if(!a||(i==null?void 0:i.length)!==(a==null?void 0:a.length)||a!=null&&a.some(r=>(i==null?void 0:i.indexOf(r))===-1)){this.groupIds=a,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(h=>!a||a.indexOf(h.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(h=>h.default)&&(this.selectDefaultTrack=!1),r.forEach((h,u)=>{h.id=u});else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=r;const l=this.hls.config.subtitlePreference;if(!o&&l){this.selectDefaultTrack=!1;const h=Ht(l,r);if(h>-1)o=r[h];else{const u=Ht(l,this.tracks);o=this.tracks[u]}}let d=this.findTrackId(o);d===-1&&o&&(d=this.findTrackId(null));const c={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${a==null?void 0:a.join(",")}" group-id`),this.hls.trigger(_.SUBTITLE_TRACKS_UPDATED,c),d!==-1&&this.trackId===-1&&this.setSubtitleTrack(d)}else this.shouldReloadPlaylist(o)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,a=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const o=t[i];if(!(a&&!o.default||!a&&!e)&&(!e||Gs(o,e)))return i}if(e){for(let i=0;i<t.length;i++){const o=t[i];if(qs(e.attrs,o.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const o=t[i];if(qs(e.attrs,o.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let a=0;a<t.length;a++){const i=t[a];if(Il(i,e))return a}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ve.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const a=this.currentTrack;if(a&&Gs(e,a))return a;const i=Ht(e,this.tracksInGroup);if(i>-1){const o=this.tracksInGroup[i];return this.setSubtitleTrack(i),o}else{if(a)return null;{const o=Ht(e,t);if(o>-1)return t[o]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const a=t.id,i=t.groupId;let o=t.url;if(e)try{o=e.addDirectives(o)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}this.log(`Loading subtitle playlist for id ${a}`),this.hls.trigger(_.SUBTITLE_TRACK_LOADING,{url:o,id:a,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Xn(e.textTracks),a=this.currentTrack;let i;if(a&&(i=t.filter(o=>Il(a,o))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${a.name}" and language "${a.lang}"`)),[].slice.call(t).forEach(o=>{o.mode!=="disabled"&&o!==i&&(o.mode="disabled")}),i){const o=this.subtitleDisplay?"showing":"hidden";i.mode!==o&&(i.mode=o)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!ae(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const a=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:e});return}const o=!!i.details&&!i.details.live;if(e===this.trackId&&i===a&&o)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:r,groupId:l="",name:d,type:c,url:h}=i;this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:r,groupId:l,name:d,type:c,url:h});const u=this.switchParams(i.url,a==null?void 0:a.details,i.details);this.loadPlaylist(u)}}class GN{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,a){const i=this.queues[t];i.push(e),i.length===1&&!a&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const a=new Promise(o=>{t=o}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),a}executeNext(e){const t=this.queues[e];if(t.length){const a=t[0];try{a.execute()}catch(i){A.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),a.onError(i);const o=this.buffers[e];o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Dp=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class jN{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=a=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=a=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:a,mediaSource:i}=this;this.log("Media source opened"),a&&(a.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(_.MEDIA_ATTACHED,{media:a,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:a,_objectUrl:i}=this;a!==i&&A.error(`Media element src was set while attaching MediaSource (${i} > ${a})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=QB(Ts(e.config.preferManagedMediaSource)),this.log=A.log.bind(A,t),this.warn=A.warn.bind(A,t),this.error=A.error.bind(A,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_APPENDING,this.onBufferAppending,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.BUFFER_EOS,this.onBufferEos,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.FRAG_PARSED,this.onFragParsed,this),e.on(_.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_APPENDING,this.onBufferAppending,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_EOS,this.onBufferEos,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.FRAG_PARSED,this.onFragParsed,this),e.off(_.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new GN(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let a=2;(t.audio&&!t.video||!t.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const a=this.media=t.media,i=Ts(this.appendSource);if(a&&i){var o;const r=this.mediaSource=new i;this.log(`created media source: ${(o=r.constructor)==null?void 0:o.name}`),r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.addEventListener("startstreaming",this._onStartStreaming),r.addEventListener("endstreaming",this._onEndStreaming));const l=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{a.removeAttribute("src");const d=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||d&&r instanceof d,Pp(a),HN(a,l),a.load()}catch{a.src=l}else a.src=l;a.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:a}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(e.removeAttribute("src"),this.appendSource&&Pp(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(_.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var a;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(a=this.mediaSource)!=null&&a.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const a=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(r=>{if(a){const d=this.tracks[r];if(d&&typeof d.buffer.changeType=="function"){var l;const{id:c,codec:h,levelCodec:u,container:f,metadata:p}=t[r],m=Lf(d.codec,d.levelCodec),g=m==null?void 0:m.replace(Dp,"$1");let y=Lf(h,u);const b=(l=y)==null?void 0:l.replace(Dp,"$1");if(y&&g!==b){r.slice(0,5)==="audio"&&(y=Jn(y,this.appendSource));const S=`${f};codecs=${y}`;this.appendChangeType(r,S),this.log(`switching codec ${m} to ${y}`),this.tracks[r]={buffer:d.buffer,codec:h,container:f,levelCodec:u,metadata:p,id:c}}}}else this.pendingTracks[r]=t[r]}),a)return;const o=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==o&&(this.log(`${o} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=o),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:a}=this,i={execute:()=>{const o=this.sourceBuffer[e];o&&(this.log(`changing ${e} sourceBuffer type to ${t}`),o.changeType(t)),a.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};a.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:a,operationQueue:i,tracks:o}=this,{data:r,type:l,frag:d,part:c,chunkMeta:h}=t,u=h.buffering[l],f=self.performance.now();u.start=f;const p=d.stats.buffering,m=c?c.stats.buffering:null;p.start===0&&(p.start=f),m&&m.start===0&&(m.start=f);const g=o.audio;let y=!1;l==="audio"&&(g==null?void 0:g.container)==="audio/mpeg"&&(y=!this.lastMpegAudioChunk||h.id===1||this.lastMpegAudioChunk.sn!==h.sn,this.lastMpegAudioChunk=h);const b=d.start,S={execute:()=>{if(u.executeStart=self.performance.now(),y){const w=this.sourceBuffer[l];if(w){const x=b-w.timestampOffset;Math.abs(x)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${b} (delta: ${x}) sn: ${d.sn})`),w.timestampOffset=b)}}this.appendExecutor(r,l)},onStart:()=>{},onComplete:()=>{const w=self.performance.now();u.executeEnd=u.end=w,p.first===0&&(p.first=w),m&&m.first===0&&(m.first=w);const{sourceBuffer:x}=this,T={};for(const v in x)T[v]=Pe.getBuffered(x[v]);this.appendErrors[l]=0,l==="audio"||l==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(_.BUFFER_APPENDED,{type:l,frag:d,part:c,chunkMeta:h,parent:d.type,timeRanges:T})},onError:w=>{const x={type:pe.MEDIA_ERROR,parent:d.type,details:N.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:d,part:c,chunkMeta:h,error:w,err:w,fatal:!1};if(w.code===DOMException.QUOTA_EXCEEDED_ERR)x.details=N.BUFFER_FULL_ERROR;else{const T=++this.appendErrors[l];x.details=N.BUFFER_APPEND_ERROR,this.warn(`Failed ${T}/${a.config.appendErrorMaxRetry} times to append segment in "${l}" sourceBuffer`),T>=a.config.appendErrorMaxRetry&&(x.fatal=!0)}a.trigger(_.ERROR,x)}};i.append(S,l,!!this.pendingTracks[l])}onBufferFlushing(e,t){const{operationQueue:a}=this,i=o=>({execute:this.removeExecutor.bind(this,o,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(_.BUFFER_FLUSHED,{type:o})},onError:r=>{this.warn(`Failed to remove from ${o} SourceBuffer`,r)}});t.type?a.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(o=>{a.append(i(o),o)})}onFragParsed(e,t){const{frag:a,part:i}=t,o=[],r=i?i.elementaryStreams:a.elementaryStreams;r[Be.AUDIOVIDEO]?o.push("audiovideo"):(r[Be.AUDIO]&&o.push("audio"),r[Be.VIDEO]&&o.push("video"));const l=()=>{const d=self.performance.now();a.stats.buffering.end=d,i&&(i.stats.buffering.end=d);const c=i?i.stats:a.stats;this.hls.trigger(_.FRAG_BUFFERED,{frag:a,part:i,stats:c,id:a.type})};o.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${a.type} level: ${a.level} sn: ${a.sn}`),this.blockBuffers(l,o)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,o)=>{const r=this.sourceBuffer[o];return r&&(!t.type||t.type===o)&&(r.ending=!0,r.ended||(r.ended=!0,this.log(`${o} sourceBuffer now EOS`))),i&&!!(!r||r.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(o=>{const r=this.sourceBuffer[o];r&&(r.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:a}=this;if(!a||t===null||!this.getSourceBufferTypes().length)return;const o=e.config,r=a.currentTime,l=t.levelTargetDuration,d=t.live&&o.liveBackBufferLength!==null?o.liveBackBufferLength:o.backBufferLength;if(ae(d)&&d>0){const c=Math.max(d,l),h=Math.floor(r/l)*l-c;this.flushBackBuffer(r,l,h)}if(ae(o.frontBufferFlushThreshold)&&o.frontBufferFlushThreshold>0){const c=Math.max(o.maxBufferLength,o.frontBufferFlushThreshold),h=Math.max(c,l),u=Math.floor(r/l)*l+h;this.flushFrontBuffer(r,l,u)}}flushBackBuffer(e,t,a){const{details:i,sourceBuffer:o}=this;this.getSourceBufferTypes().forEach(l=>{const d=o[l];if(d){const c=Pe.getBuffered(d);if(c.length>0&&a>c.start(0)){if(this.hls.trigger(_.BACK_BUFFER_REACHED,{bufferEnd:a}),i!=null&&i.live)this.hls.trigger(_.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a});else if(d.ended&&c.end(c.length-1)-e<t*2){this.log(`Cannot flush ${l} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:l})}}})}flushFrontBuffer(e,t,a){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach(r=>{const l=i[r];if(l){const d=Pe.getBuffered(l),c=d.length;if(c<2)return;const h=d.start(c-1),u=d.end(c-1);if(a>h||e>=h&&e<=u)return;if(l.ended&&e-u<2*t){this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:h,endOffset:1/0,type:r})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:a,mediaSource:i}=this,o=e.fragments[0].start+e.totalduration,r=a.duration,l=ae(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(o>l&&o>r||!ae(r))&&(this.log(`Updating Media Source duration to ${o.toFixed(3)}`),i.duration=o)}updateSeekableRange(e){const t=this.mediaSource,a=e.fragments;if(a.length&&e.live&&t!=null&&t.setLiveSeekableRange){const o=Math.max(0,a[0].start),r=Math.max(o,o+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${o}-${r}.`),t.setLiveSeekableRange(o,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:a}=this,i=Object.keys(a).length;if(i&&(!e||i===2||"audiovideo"in a)){this.createSourceBuffers(a),this.pendingTracks={};const o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(_.BUFFER_CREATED,{tracks:this.tracks}),o.forEach(r=>{t.executeNext(r)});else{const r=new Error("could not create source buffer for media codec(s)");this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:r,reason:r.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:a}=this;if(!a)throw Error("createSourceBuffers called when mediaSource was null");for(const o in e)if(!t[o]){var i;const r=e[o];if(!r)throw Error(`source buffer exists for track ${o}, however track does not`);let l=((i=r.levelCodec)==null?void 0:i.indexOf(","))===-1?r.levelCodec:r.codec;l&&o.slice(0,5)==="audio"&&(l=Jn(l,this.appendSource));const d=`${r.container};codecs=${l}`;this.log(`creating sourceBuffer(${d})`);try{const c=t[o]=a.addSourceBuffer(d),h=o;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(h,"bufferedchange",(u,f)=>{const p=f.removedRanges;p!=null&&p.length&&this.hls.trigger(_.BUFFER_FLUSHED,{type:o})}),this.tracks[o]={buffer:c,codec:l,container:r.container,levelCodec:r.levelCodec,metadata:r.metadata,id:r.id}}catch(c){this.error(`error while trying to add sourceBuffer: ${c.message}`),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,sourceBufferName:o,mimeType:d})}}}get mediaSrc(){var e,t;const a=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return a==null?void 0:a.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:a}=this;a.current(e).onComplete(),a.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var a;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(a=this.mediaSource)==null?void 0:a.readyState}`);this.error(`${i}`,t),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const o=this.operationQueue.current(e);o&&o.onError(i)}removeExecutor(e,t,a){const{media:i,mediaSource:o,operationQueue:r,sourceBuffer:l}=this,d=l[e];if(!i||!o||!d){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),r.shiftAndExecuteNext(e);return}const c=ae(i.duration)?i.duration:1/0,h=ae(o.duration)?o.duration:1/0,u=Math.max(0,t),f=Math.min(a,c,h);f>u&&(!d.ending||d.ended)?(d.ended=!1,this.log(`Removing [${u},${f}] from the ${e} SourceBuffer`),d.remove(u,f)):r.shiftAndExecuteNext(e)}appendExecutor(e,t){const a=this.sourceBuffer[t];if(!a){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}a.ended=!1,a.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:a}=this,i=t.map(o=>a.appendBlocker(o));Promise.all(i).then(()=>{e(),t.forEach(o=>{const r=this.sourceBuffer[o];r!=null&&r.updating||a.shiftAndExecuteNext(o)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,a){const i=this.sourceBuffer[e];if(!i)return;const o=a.bind(this,e);this.listeners[e].push({event:t,listener:o}),i.addEventListener(t,o)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(a=>{t.removeEventListener(a.event,a.listener)})}}function Pp(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function HN(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const WN={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Op=s=>String.fromCharCode(WN[s]||s),Ft=15,Qt=100,KN={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},qN={17:2,18:4,21:6,22:8,23:10,19:13,20:15},YN={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},JN={25:2,26:4,29:6,30:8,31:10,27:13,28:15},XN=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ZN{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const a=typeof t=="function"?t():t;A.log(`${this.time} [${e}] ${a}`)}}}const Cs=function(e){const t=[];for(let a=0;a<e.length;a++)t.push(e[a].toString(16));return t};class Fp{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let a=0;a<t.length;a++){const i=t[a];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class QN{constructor(){this.uchar=" ",this.penState=new Fp}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class eD{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Fp,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Qt;t++)this.chars.push(new QN);this.logger=e}equals(e){for(let t=0;t<Qt;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Qt;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Qt;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Qt&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Qt)}moveCursor(e){const t=this.pos+e;if(e>1)for(let a=this.pos+1;a<t+1;a++)this.chars[a].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Op(e);if(this.pos>=Qt){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Qt;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let a=0;a<Qt;a++){const i=this.chars[a].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Rl{constructor(e){this.rows=[],this.currRow=Ft-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Ft;t++)this.rows.push(new eD(e));this.logger=e}reset(){for(let e=0;e<Ft;e++)this.rows[e].clear();this.currRow=Ft-1}equals(e){let t=!0;for(let a=0;a<Ft;a++)if(!this.rows[a].equals(e.rows[a])){t=!1;break}return t}copy(e){for(let t=0;t<Ft;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ft;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let l=0;l<Ft;l++)this.rows[l].clear();const o=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const l=r.rows[o].cueStartTime,d=this.logger.time;if(l!==null&&d!==null&&l<d)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(r.rows[o+c])}}this.currRow=t;const a=this.rows[this.currRow];if(e.indent!==null){const o=e.indent,r=Math.max(o-1,0);a.setCursor(e.indent),e.color=a.chars[r].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let a="",i=-1;for(let o=0;o<Ft;o++){const r=this.rows[o].getTextString();r&&(i=o+1,e?t.push("Row "+i+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?a="["+t.join(" | ")+"]":a=t.join(`
|
|
55
|
+
initSegmentChange: ${B}`);const R=new PN(a,i,t,l,h);this.configureTransmuxer(R)}if(this.frag=o,this.part=r,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:c,state:I},e instanceof ArrayBuffer?[e]:[]);else if(p){const R=p.push(e,g,c,I);mi(R)?(p.async=!0,R.then(M=>{this.handleTransmuxComplete(M)}).catch(M=>{this.transmuxerError(M,c,"transmuxer-interface push error")})):(p.async=!1,this.handleTransmuxComplete(R))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let a=t.flush(e);mi(a)||t.async?(mi(a)||(a=Promise.resolve(a)),a.then(o=>{this.handleFlushResult(o,e)}).catch(o=>{this.transmuxerError(o,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}}transmuxerError(e,t,a){this.hls&&(this.error=e,this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:a}))}handleFlushResult(e,t){e.forEach(a=>{this.handleTransmuxComplete(a)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){A.warn(`worker message received with no ${t?"event name":"data"}`);return}const a=this.hls;if(this.hls)switch(t.event){case"init":{var i;const o=(i=this.workerContext)==null?void 0:i.objectURL;o&&self.URL.revokeObjectURL(o);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":A[t.data.logType]&&A[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,a.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Rp(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!qs(s[t].attrs,e[t].attrs))return!1;return!0}function qs(s,e,t){const a=s["STABLE-RENDITION-ID"];return a&&!t?a===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>s[i]!==e[i])}function Il(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}const Bp=100;class MN extends _l{constructor(e,t,a){super(e,t,a,"[audio-stream-controller]",le.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.ERROR,this.onError,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.ERROR,this.onError,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:a,initPTS:i,timescale:o}){if(a==="main"){const r=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:o},this.log(`InitPTS for cc: ${r} found from main: ${i}`),this.videoTrackCC=r,this.state===V.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=V.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Bp),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=V.IDLE):(this.loadedmetadata=!1,this.state=V.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case V.IDLE:this.doTickIdle();break;case V.WAITING_TRACK:{var e;const{levels:a,trackId:i}=this,o=a==null||(e=a[i])==null?void 0:e.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=V.WAITING_INIT_PTS}break}case V.FRAG_LOADING_WAITING_RETRY:{var t;const a=performance.now(),i=this.retryDate;if(!i||a>=i||(t=this.media)!=null&&t.seeking){const{levels:o,trackId:r}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((o==null?void 0:o[r])||null),this.state=V.IDLE}break}case V.WAITING_INIT_PTS:{const a=this.waitingData;if(a){const{frag:i,part:o,cache:r,complete:l}=a;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=V.FRAG_LOADING;const d=r.flush(),c={frag:i,part:o,payload:d,networkDetails:null};this._handleFragmentLoadProgress(c),l&&super._handleFragmentLoadComplete(c)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const d=this.getLoadPosition(),c=Pe.bufferInfo(this.mediaBuffer,d,this.config.maxBufferHole);gl(c.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${c.end} is needed`),this.clearWaitingFragment())}}else this.state=V.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=V.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:a,trackId:i}=this,o=e.config;if(!a&&(this.startFragRequested||!o.startFragPrefetch)||!(t!=null&&t[i]))return;const r=t[i],l=r.details;if(!l||l.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(l)){this.state=V.WAITING_TRACK;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,Be.AUDIO,le.AUDIO));const c=this.getFwdBufferInfo(d,le.AUDIO);if(c===null)return;const{bufferedTrack:h,switchingTrack:u}=this;if(!u&&this._streamEnded(c,l)){e.trigger(_.BUFFER_EOS,{type:"audio"}),this.state=V.ENDED;return}const f=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,le.MAIN),p=c.len,m=this.getMaxBufferLength(f==null?void 0:f.len),g=l.fragments,y=g[0].start;let b=this.flushing?this.getLoadPosition():c.end;if(u&&a){const T=this.getLoadPosition();h&&!qs(u.attrs,h.attrs)&&(b=T),l.PTSKnown&&T<y&&(c.end>y||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=y+.05)}if(p>=m&&!u&&b<g[g.length-1].start)return;let S=this.getNextFragment(b,l),w=!1;if(S&&this.isLoopLoading(S,b)&&(w=!!S.gap,S=this.getNextFragmentLoopLoading(S,l,c,le.MAIN,m)),!S){this.bufferFlushed=!0;return}const x=f&&S.start>f.end+l.targetduration;if(x||!(f!=null&&f.len)&&c.len){const T=this.getAppendedFrag(S.start,le.MAIN);if(T===null||(w||(w=!!T.gap||!!x&&f.len===0),x&&!w||w&&c.nextStart&&c.nextStart<T.end))return}this.loadFragment(S,r,b)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(a=>new zs(a))}onAudioTrackSwitching(e,t){const a=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),a?this.setInterval(Bp):this.resetTransmuxer(),a?(this.switchingTrack=t,this.state=V.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=V.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(_.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var a;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:o,id:r}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${r}`);return}this.log(`Audio track ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`);const l=i[r];let d=0;if(o.live||(a=l.details)!=null&&a.live){this.checkLiveUpdate(o);const h=this.mainDetails;if(o.deltaUpdateFailed||!h)return;if(!l.details&&o.hasProgramDateTime&&h.hasProgramDateTime)ri(o,h),d=o.fragments[0].start;else{var c;d=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details)}}l.details=o,this.levelLastLoaded=l,!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,d),this.state===V.WAITING_TRACK&&!this.waitForCdnTuneIn(o)&&(this.state=V.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:a,part:i,payload:o}=e,{config:r,trackId:l,levels:d}=this;if(!d){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${a.sn} of level ${a.level} will not be buffered`);return}const c=d[l];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const h=c.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(a.start);return}const u=r.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let f=this.transmuxer;f||(f=this.transmuxer=new Ip(this.hls,le.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const p=this.initPTS[a.cc],m=(t=a.initSegment)==null?void 0:t.data;if(p!==void 0){const y=i?i.index:-1,b=y!==-1,S=new bl(a.level,a.sn,a.stats.chunkCount,o.byteLength,y,b);f.push(o,m,u,"",a,i,h.totalduration,!1,S,p)}else{this.log(`Unknown video PTS for cc ${a.cc}, waiting for video PTS before demuxing audio frag ${a.sn} of [${h.startSN} ,${h.endSN}],track ${l}`);const{cache:g}=this.waitingData=this.waitingData||{frag:a,part:i,cache:new lp,complete:!1};g.push(new Uint8Array(o)),this.waitingVideoCC=this.videoTrackCC,this.state=V.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const a=t.tracks.audio;a&&(this.mediaBuffer=a.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:a,part:i}=t;if(a.type!==le.AUDIO){if(!this.loadedmetadata&&a.type===le.MAIN){const o=this.videoBuffer||this.media;o&&Pe.getBuffered(o).length&&(this.loadedmetadata=!0)}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}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(a.sn!=="initSegment"){this.fragPrevious=a;const o=this.switchingTrack;o&&(this.bufferedTrack=o,this.switchingTrack=null,this.hls.trigger(_.AUDIO_TRACK_SWITCHED,Ze({},o)))}this.fragBufferedComplete(a,i)}onError(e,t){var a;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.AUDIO,t);break;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_TRACK&&((a=t.context)==null?void 0:a.type)===ve.AUDIO_TRACK&&(this.state=V.IDLE);break;case N.BUFFER_APPEND_ERROR:case N.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===N.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Be.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Be.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===V.ENDED&&(this.state=V.IDLE);const a=this.mediaBuffer||this.media;a&&(this.afterBufferFlushed(a,t,le.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const a="audio",{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,{details:u}=h,{audio:f,text:p,id3:m,initSegment:g}=o;if(this.fragContextChanged(d)||!u){this.fragmentTracker.removeFragment(d);return}if(this.state=V.PARSING,this.switchingTrack&&f&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const y=d.initSegment||d;this._bufferInitSegment(h,g.tracks,y,r),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:a,tracks:g.tracks})}if(f){const{startPTS:y,endPTS:b,startDTS:S,endDTS:w}=f;c&&(c.elementaryStreams[Be.AUDIO]={startPTS:y,endPTS:b,startDTS:S,endDTS:w}),d.setElementaryStreamInfo(Be.AUDIO,y,b,S,w),this.bufferFragmentData(f,d,c,r)}if(m!=null&&(t=m.samples)!=null&&t.length){const y=je({id:a,frag:d,details:u},m);i.trigger(_.FRAG_PARSING_METADATA,y)}if(p){const y=je({id:a,frag:d,details:u},p);i.trigger(_.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,a,i){if(this.state!==V.PARSING)return;t.video&&delete t.video;const o=t.audio;if(!o)return;o.id="audio";const r=e.audioCodec;this.log(`Init audio buffer, container:${o.container}, codecs[level/parsed]=[${r}/${o.codec}]`),r&&r.split(",").length===1&&(o.levelCodec=r),this.hls.trigger(_.BUFFER_CODECS,t);const l=o.initSegment;if(l!=null&&l.byteLength){const d={type:"audio",frag:a,part:null,chunkMeta:i,parent:a.type,data:l};this.hls.trigger(_.BUFFER_APPENDING,d)}this.tickImmediate()}loadFragment(e,t,a){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===Qe.NOT_LOADED||i===Qe.PARTIAL){var o;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((o=t.details)!=null&&o.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=V.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragments[0].start!==t.details.fragments[0].start&&ri(t.details,r)}else this.startFragRequested=!0,super.loadFragment(e,t,a)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:a}=this,i=a==null?void 0:a.attrs,o=e.attrs;t&&i&&(i.CHANNELS!==o.CHANNELS||a.name!==e.name||a.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(_.AUDIO_TRACK_SWITCHED,Ze({},e))}}class VN extends yl{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:a,groupId:i,details:o}=t,r=this.tracksInGroup[a];if(!r||r.groupId!==i){this.warn(`Audio track with id:${a} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const l=r.details;r.details=t.details,this.log(`Audio track ${a} "${r.name}" lang:${r.lang} group:${i} loaded [${o.startSN}-${o.endSN}]`),a===this.trackId&&this.playlistLoaded(a,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const a=t.audioGroups||null,i=this.groupIds;let o=this.currentTrack;if(!a||(i==null?void 0:i.length)!==(a==null?void 0:a.length)||a!=null&&a.some(l=>(i==null?void 0:i.indexOf(l))===-1)){this.groupIds=a,this.trackId=-1,this.currentTrack=null;const l=this.tracks.filter(f=>!a||a.indexOf(f.groupId)!==-1);if(l.length)this.selectDefaultTrack&&!l.some(f=>f.default)&&(this.selectDefaultTrack=!1),l.forEach((f,p)=>{f.id=p});else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=l;const d=this.hls.config.audioPreference;if(!o&&d){const f=Ht(d,l,js);if(f>-1)o=l[f];else{const p=Ht(d,this.tracks);o=this.tracks[p]}}let c=this.findTrackId(o);c===-1&&o&&(c=this.findTrackId(null));const h={audioTracks:l};this.log(`Updating audio tracks, ${l.length} track(s) found in group(s): ${a==null?void 0:a.join(",")}`),this.hls.trigger(_.AUDIO_TRACKS_UPDATED,h);const u=this.trackId;if(c!==-1&&u===-1)this.setAudioTrack(c);else if(l.length&&u===-1){var r;const f=new Error(`No audio track selected for current audio group-ID(s): ${(r=this.groupIds)==null?void 0:r.join(",")} track count: ${l.length}`);this.warn(f.message),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}else this.shouldReloadPlaylist(o)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===ve.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const a=this.allAudioTracks;if(this.selectDefaultTrack=!1,a.length){const i=this.currentTrack;if(i&&Gs(e,i,js))return i;const o=Ht(e,this.tracksInGroup,js);if(o>-1){const r=this.tracksInGroup[o];return this.setAudioTrack(o),r}else if(i){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const l=V6(e,t.levels,a,r,js);if(l===-1)return null;t.nextLoadLevel=l}if(e.channels||e.audioCodec){const r=Ht(e,a);if(r>-1)return a[r]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const a=this.currentTrack,i=t[e],o=i.details&&!i.details.live;if(e===this.trackId&&i===a&&o||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(_.AUDIO_TRACK_SWITCHING,Ze({},i)),o))return;const r=this.switchParams(i.url,a==null?void 0:a.details,i.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let a=0;a<t.length;a++){const i=t[a];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Gs(e,i,js)))return a}if(e){const{name:a,lang:i,assocLang:o,characteristics:r,audioCodec:l,channels:d}=e;for(let c=0;c<t.length;c++){const h=t[c];if(Gs({name:a,lang:i,assocLang:o,characteristics:r,audioCodec:l,channels:d},h,js))return c}for(let c=0;c<t.length;c++){const h=t[c];if(qs(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const h=t[c];if(qs(e.attrs,h.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const a=t.id,i=t.groupId;let o=t.url;if(e)try{o=e.addDirectives(o)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}this.log(`loading audio-track playlist ${a} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(_.AUDIO_TRACK_LOADING,{url:o,id:a,groupId:i,deliveryDirectives:e||null})}}}const Np=500;class $N extends _l{constructor(e,t,a){super(e,t,a,"[subtitle-stream-controller]",le.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.ERROR,this.onError,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.ERROR,this.onError,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=V.IDLE,this.setInterval(Np),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:a,success:i}=t;if(this.fragPrevious=a,this.state=V.IDLE,!i)return;const o=this.tracksBuffered[this.currentTrackId];if(!o)return;let r;const l=a.start;for(let c=0;c<o.length;c++)if(l>=o[c].start&&l<=o[c].end){r=o[c];break}const d=a.start+a.duration;r?r.end=d:(r={start:l,end:d},o.push(r)),this.fragmentTracker.fragBuffered(a),this.fragBufferedComplete(a,null)}onBufferFlushing(e,t){const{startOffset:a,endOffset:i}=t;if(a===0&&i!==Number.POSITIVE_INFINITY){const o=i-1;if(o<=0)return;t.endOffsetSubtitles=Math.max(0,o),this.tracksBuffered.forEach(r=>{for(let l=0;l<r.length;){if(r[l].end<=o){r.shift();continue}else if(r[l].start<o)r[l].start=o;else break;l++}}),this.fragmentTracker.removeFragmentsInRange(a,o,le.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===le.MAIN){var a;(a=this.media)!=null&&a.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const a=t.frag;(a==null?void 0:a.type)===le.SUBTITLE&&(t.details===N.FRAG_GAP&&this.fragmentTracker.fragBuffered(a,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==V.STOPPED&&(this.state=V.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Rp(this.levels,t)){this.levels=t.map(a=>new zs(a));return}this.tracksBuffered=[],this.levels=t.map(a=>{const i=new zs(a);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,le.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var a;if(this.currentTrackId=t.id,!((a=this.levels)!=null&&a.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(Np)}onSubtitleTrackLoaded(e,t){var a;const{currentTrackId:i,levels:o}=this,{details:r,id:l}=t;if(!o){this.warn(`Subtitle tracks were reset while loading level ${l}`);return}const d=o[l];if(l>=o.length||!d)return;this.log(`Subtitle track ${l} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(r.live||(a=d.details)!=null&&a.live){const u=this.mainDetails;if(r.deltaUpdateFailed||!u)return;const f=u.fragments[0];if(!d.details)r.hasProgramDateTime&&u.hasProgramDateTime?(ri(r,u),c=r.fragments[0].start):f&&(c=f.start,fl(r,c));else{var h;c=this.alignPlaylists(r,d.details,(h=this.levelLastLoaded)==null?void 0:h.details),c===0&&f&&(c=f.start,fl(r,c))}}d.details=r,this.levelLastLoaded=d,l===i&&(!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(this.mainDetails||r,c),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===V.IDLE&&(ai(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),d.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:a}=e,i=t.decryptdata,o=this.hls;if(!this.fragContextChanged(t)&&a&&a.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const r=performance.now();this.decrypter.decrypt(new Uint8Array(a),i.key.buffer,i.iv.buffer).catch(l=>{throw o.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:t}),l}).then(l=>{const d=performance.now();o.trigger(_.FRAG_DECRYPTED,{frag:t,payload:l,stats:{tstart:r,tdecrypt:d}})}).catch(l=>{this.warn(`${l.name}: ${l.message}`),this.state=V.IDLE})}}doTick(){if(!this.media){this.state=V.IDLE;return}if(this.state===V.IDLE){const{currentTrackId:e,levels:t}=this,a=t==null?void 0:t[e];if(!a||!t.length||!a.details)return;const{config:i}=this,o=this.getLoadPosition(),r=Pe.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],o,i.maxBufferHole),{end:l,len:d}=r,c=this.getFwdBufferInfo(this.media,le.MAIN),h=a.details,u=this.getMaxBufferLength(c==null?void 0:c.len)+h.levelTargetDuration;if(d>u)return;const f=h.fragments,p=f.length,m=h.edge;let g=null;const y=this.fragPrevious;if(l<m){const b=i.maxFragLookUpTolerance,S=l>m-b?0:b;g=ai(y,f,Math.max(f[0].start,l),S),!g&&y&&y.start<f[0].start&&(g=f[0])}else g=f[p-1];if(!g)return;if(g=this.mapToInitFragWhenRequired(g),g.sn!=="initSegment"){const b=g.sn-h.startSN,S=f[b-1];S&&S.cc===g.cc&&this.fragmentTracker.getState(S)===Qe.NOT_LOADED&&(g=S)}this.fragmentTracker.getState(g)===Qe.NOT_LOADED&&this.loadFragment(g,a,l)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,a){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,a))}get mediaBufferTimeRanges(){return new zN(this.tracksBuffered[this.currentTrackId]||[])}}class zN{constructor(e){this.buffered=void 0;const t=(a,i,o)=>{if(i=i>>>0,i>o-1)throw new DOMException(`Failed to execute '${a}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${o})`);return e[i][a]};this.buffered={get length(){return e.length},end(a){return t("end",a,e.length)},start(a){return t("start",a,e.length)}}}}class UN extends yl{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const a=Xn(this.media.textTracks);for(let o=0;o<a.length;o++)if(a[o].mode==="hidden")t=a[o];else if(a[o].mode==="showing"){t=a[o];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Xn(this.media.textTracks).forEach(t=>{$s(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:a,groupId:i,details:o}=t,r=this.tracksInGroup[a];if(!r||r.groupId!==i){this.warn(`Subtitle track with id:${a} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const l=r.details;r.details=t.details,this.log(`Subtitle track ${a} "${r.name}" lang:${r.lang} group:${i} loaded [${o.startSN}-${o.endSN}]`),a===this.trackId&&this.playlistLoaded(a,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const a=t.subtitleGroups||null,i=this.groupIds;let o=this.currentTrack;if(!a||(i==null?void 0:i.length)!==(a==null?void 0:a.length)||a!=null&&a.some(r=>(i==null?void 0:i.indexOf(r))===-1)){this.groupIds=a,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(h=>!a||a.indexOf(h.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(h=>h.default)&&(this.selectDefaultTrack=!1),r.forEach((h,u)=>{h.id=u});else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=r;const l=this.hls.config.subtitlePreference;if(!o&&l){this.selectDefaultTrack=!1;const h=Ht(l,r);if(h>-1)o=r[h];else{const u=Ht(l,this.tracks);o=this.tracks[u]}}let d=this.findTrackId(o);d===-1&&o&&(d=this.findTrackId(null));const c={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${a==null?void 0:a.join(",")}" group-id`),this.hls.trigger(_.SUBTITLE_TRACKS_UPDATED,c),d!==-1&&this.trackId===-1&&this.setSubtitleTrack(d)}else this.shouldReloadPlaylist(o)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,a=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const o=t[i];if(!(a&&!o.default||!a&&!e)&&(!e||Gs(o,e)))return i}if(e){for(let i=0;i<t.length;i++){const o=t[i];if(qs(e.attrs,o.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const o=t[i];if(qs(e.attrs,o.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let a=0;a<t.length;a++){const i=t[a];if(Il(i,e))return a}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ve.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const a=this.currentTrack;if(a&&Gs(e,a))return a;const i=Ht(e,this.tracksInGroup);if(i>-1){const o=this.tracksInGroup[i];return this.setSubtitleTrack(i),o}else{if(a)return null;{const o=Ht(e,t);if(o>-1)return t[o]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const a=t.id,i=t.groupId;let o=t.url;if(e)try{o=e.addDirectives(o)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}this.log(`Loading subtitle playlist for id ${a}`),this.hls.trigger(_.SUBTITLE_TRACK_LOADING,{url:o,id:a,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Xn(e.textTracks),a=this.currentTrack;let i;if(a&&(i=t.filter(o=>Il(a,o))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${a.name}" and language "${a.lang}"`)),[].slice.call(t).forEach(o=>{o.mode!=="disabled"&&o!==i&&(o.mode="disabled")}),i){const o=this.subtitleDisplay?"showing":"hidden";i.mode!==o&&(i.mode=o)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!ae(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const a=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:e});return}const o=!!i.details&&!i.details.live;if(e===this.trackId&&i===a&&o)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:r,groupId:l="",name:d,type:c,url:h}=i;this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:r,groupId:l,name:d,type:c,url:h});const u=this.switchParams(i.url,a==null?void 0:a.details,i.details);this.loadPlaylist(u)}}class GN{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,a){const i=this.queues[t];i.push(e),i.length===1&&!a&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const a=new Promise(o=>{t=o}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),a}executeNext(e){const t=this.queues[e];if(t.length){const a=t[0];try{a.execute()}catch(i){A.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),a.onError(i);const o=this.buffers[e];o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Dp=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class jN{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=a=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=a=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:a,mediaSource:i}=this;this.log("Media source opened"),a&&(a.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(_.MEDIA_ATTACHED,{media:a,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:a,_objectUrl:i}=this;a!==i&&A.error(`Media element src was set while attaching MediaSource (${i} > ${a})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=Q3(Ts(e.config.preferManagedMediaSource)),this.log=A.log.bind(A,t),this.warn=A.warn.bind(A,t),this.error=A.error.bind(A,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_APPENDING,this.onBufferAppending,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.BUFFER_EOS,this.onBufferEos,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.FRAG_PARSED,this.onFragParsed,this),e.on(_.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_APPENDING,this.onBufferAppending,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_EOS,this.onBufferEos,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.FRAG_PARSED,this.onFragParsed,this),e.off(_.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new GN(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let a=2;(t.audio&&!t.video||!t.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const a=this.media=t.media,i=Ts(this.appendSource);if(a&&i){var o;const r=this.mediaSource=new i;this.log(`created media source: ${(o=r.constructor)==null?void 0:o.name}`),r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.addEventListener("startstreaming",this._onStartStreaming),r.addEventListener("endstreaming",this._onEndStreaming));const l=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{a.removeAttribute("src");const d=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||d&&r instanceof d,Pp(a),HN(a,l),a.load()}catch{a.src=l}else a.src=l;a.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:a}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(e.removeAttribute("src"),this.appendSource&&Pp(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(_.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var a;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(a=this.mediaSource)!=null&&a.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const a=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(r=>{if(a){const d=this.tracks[r];if(d&&typeof d.buffer.changeType=="function"){var l;const{id:c,codec:h,levelCodec:u,container:f,metadata:p}=t[r],m=Lf(d.codec,d.levelCodec),g=m==null?void 0:m.replace(Dp,"$1");let y=Lf(h,u);const b=(l=y)==null?void 0:l.replace(Dp,"$1");if(y&&g!==b){r.slice(0,5)==="audio"&&(y=Jn(y,this.appendSource));const S=`${f};codecs=${y}`;this.appendChangeType(r,S),this.log(`switching codec ${m} to ${y}`),this.tracks[r]={buffer:d.buffer,codec:h,container:f,levelCodec:u,metadata:p,id:c}}}}else this.pendingTracks[r]=t[r]}),a)return;const o=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==o&&(this.log(`${o} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=o),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:a}=this,i={execute:()=>{const o=this.sourceBuffer[e];o&&(this.log(`changing ${e} sourceBuffer type to ${t}`),o.changeType(t)),a.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};a.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:a,operationQueue:i,tracks:o}=this,{data:r,type:l,frag:d,part:c,chunkMeta:h}=t,u=h.buffering[l],f=self.performance.now();u.start=f;const p=d.stats.buffering,m=c?c.stats.buffering:null;p.start===0&&(p.start=f),m&&m.start===0&&(m.start=f);const g=o.audio;let y=!1;l==="audio"&&(g==null?void 0:g.container)==="audio/mpeg"&&(y=!this.lastMpegAudioChunk||h.id===1||this.lastMpegAudioChunk.sn!==h.sn,this.lastMpegAudioChunk=h);const b=d.start,S={execute:()=>{if(u.executeStart=self.performance.now(),y){const w=this.sourceBuffer[l];if(w){const x=b-w.timestampOffset;Math.abs(x)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${b} (delta: ${x}) sn: ${d.sn})`),w.timestampOffset=b)}}this.appendExecutor(r,l)},onStart:()=>{},onComplete:()=>{const w=self.performance.now();u.executeEnd=u.end=w,p.first===0&&(p.first=w),m&&m.first===0&&(m.first=w);const{sourceBuffer:x}=this,T={};for(const v in x)T[v]=Pe.getBuffered(x[v]);this.appendErrors[l]=0,l==="audio"||l==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(_.BUFFER_APPENDED,{type:l,frag:d,part:c,chunkMeta:h,parent:d.type,timeRanges:T})},onError:w=>{const x={type:pe.MEDIA_ERROR,parent:d.type,details:N.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:d,part:c,chunkMeta:h,error:w,err:w,fatal:!1};if(w.code===DOMException.QUOTA_EXCEEDED_ERR)x.details=N.BUFFER_FULL_ERROR;else{const T=++this.appendErrors[l];x.details=N.BUFFER_APPEND_ERROR,this.warn(`Failed ${T}/${a.config.appendErrorMaxRetry} times to append segment in "${l}" sourceBuffer`),T>=a.config.appendErrorMaxRetry&&(x.fatal=!0)}a.trigger(_.ERROR,x)}};i.append(S,l,!!this.pendingTracks[l])}onBufferFlushing(e,t){const{operationQueue:a}=this,i=o=>({execute:this.removeExecutor.bind(this,o,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(_.BUFFER_FLUSHED,{type:o})},onError:r=>{this.warn(`Failed to remove from ${o} SourceBuffer`,r)}});t.type?a.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(o=>{a.append(i(o),o)})}onFragParsed(e,t){const{frag:a,part:i}=t,o=[],r=i?i.elementaryStreams:a.elementaryStreams;r[Be.AUDIOVIDEO]?o.push("audiovideo"):(r[Be.AUDIO]&&o.push("audio"),r[Be.VIDEO]&&o.push("video"));const l=()=>{const d=self.performance.now();a.stats.buffering.end=d,i&&(i.stats.buffering.end=d);const c=i?i.stats:a.stats;this.hls.trigger(_.FRAG_BUFFERED,{frag:a,part:i,stats:c,id:a.type})};o.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${a.type} level: ${a.level} sn: ${a.sn}`),this.blockBuffers(l,o)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,o)=>{const r=this.sourceBuffer[o];return r&&(!t.type||t.type===o)&&(r.ending=!0,r.ended||(r.ended=!0,this.log(`${o} sourceBuffer now EOS`))),i&&!!(!r||r.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(o=>{const r=this.sourceBuffer[o];r&&(r.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:a}=this;if(!a||t===null||!this.getSourceBufferTypes().length)return;const o=e.config,r=a.currentTime,l=t.levelTargetDuration,d=t.live&&o.liveBackBufferLength!==null?o.liveBackBufferLength:o.backBufferLength;if(ae(d)&&d>0){const c=Math.max(d,l),h=Math.floor(r/l)*l-c;this.flushBackBuffer(r,l,h)}if(ae(o.frontBufferFlushThreshold)&&o.frontBufferFlushThreshold>0){const c=Math.max(o.maxBufferLength,o.frontBufferFlushThreshold),h=Math.max(c,l),u=Math.floor(r/l)*l+h;this.flushFrontBuffer(r,l,u)}}flushBackBuffer(e,t,a){const{details:i,sourceBuffer:o}=this;this.getSourceBufferTypes().forEach(l=>{const d=o[l];if(d){const c=Pe.getBuffered(d);if(c.length>0&&a>c.start(0)){if(this.hls.trigger(_.BACK_BUFFER_REACHED,{bufferEnd:a}),i!=null&&i.live)this.hls.trigger(_.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a});else if(d.ended&&c.end(c.length-1)-e<t*2){this.log(`Cannot flush ${l} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:l})}}})}flushFrontBuffer(e,t,a){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach(r=>{const l=i[r];if(l){const d=Pe.getBuffered(l),c=d.length;if(c<2)return;const h=d.start(c-1),u=d.end(c-1);if(a>h||e>=h&&e<=u)return;if(l.ended&&e-u<2*t){this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:h,endOffset:1/0,type:r})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:a,mediaSource:i}=this,o=e.fragments[0].start+e.totalduration,r=a.duration,l=ae(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(o>l&&o>r||!ae(r))&&(this.log(`Updating Media Source duration to ${o.toFixed(3)}`),i.duration=o)}updateSeekableRange(e){const t=this.mediaSource,a=e.fragments;if(a.length&&e.live&&t!=null&&t.setLiveSeekableRange){const o=Math.max(0,a[0].start),r=Math.max(o,o+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${o}-${r}.`),t.setLiveSeekableRange(o,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:a}=this,i=Object.keys(a).length;if(i&&(!e||i===2||"audiovideo"in a)){this.createSourceBuffers(a),this.pendingTracks={};const o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(_.BUFFER_CREATED,{tracks:this.tracks}),o.forEach(r=>{t.executeNext(r)});else{const r=new Error("could not create source buffer for media codec(s)");this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:r,reason:r.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:a}=this;if(!a)throw Error("createSourceBuffers called when mediaSource was null");for(const o in e)if(!t[o]){var i;const r=e[o];if(!r)throw Error(`source buffer exists for track ${o}, however track does not`);let l=((i=r.levelCodec)==null?void 0:i.indexOf(","))===-1?r.levelCodec:r.codec;l&&o.slice(0,5)==="audio"&&(l=Jn(l,this.appendSource));const d=`${r.container};codecs=${l}`;this.log(`creating sourceBuffer(${d})`);try{const c=t[o]=a.addSourceBuffer(d),h=o;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(h,"bufferedchange",(u,f)=>{const p=f.removedRanges;p!=null&&p.length&&this.hls.trigger(_.BUFFER_FLUSHED,{type:o})}),this.tracks[o]={buffer:c,codec:l,container:r.container,levelCodec:r.levelCodec,metadata:r.metadata,id:r.id}}catch(c){this.error(`error while trying to add sourceBuffer: ${c.message}`),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,sourceBufferName:o,mimeType:d})}}}get mediaSrc(){var e,t;const a=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return a==null?void 0:a.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:a}=this;a.current(e).onComplete(),a.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var a;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(a=this.mediaSource)==null?void 0:a.readyState}`);this.error(`${i}`,t),this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const o=this.operationQueue.current(e);o&&o.onError(i)}removeExecutor(e,t,a){const{media:i,mediaSource:o,operationQueue:r,sourceBuffer:l}=this,d=l[e];if(!i||!o||!d){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),r.shiftAndExecuteNext(e);return}const c=ae(i.duration)?i.duration:1/0,h=ae(o.duration)?o.duration:1/0,u=Math.max(0,t),f=Math.min(a,c,h);f>u&&(!d.ending||d.ended)?(d.ended=!1,this.log(`Removing [${u},${f}] from the ${e} SourceBuffer`),d.remove(u,f)):r.shiftAndExecuteNext(e)}appendExecutor(e,t){const a=this.sourceBuffer[t];if(!a){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}a.ended=!1,a.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:a}=this,i=t.map(o=>a.appendBlocker(o));Promise.all(i).then(()=>{e(),t.forEach(o=>{const r=this.sourceBuffer[o];r!=null&&r.updating||a.shiftAndExecuteNext(o)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,a){const i=this.sourceBuffer[e];if(!i)return;const o=a.bind(this,e);this.listeners[e].push({event:t,listener:o}),i.addEventListener(t,o)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(a=>{t.removeEventListener(a.event,a.listener)})}}function Pp(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function HN(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const WN={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Op=s=>String.fromCharCode(WN[s]||s),Ft=15,Qt=100,KN={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},qN={17:2,18:4,21:6,22:8,23:10,19:13,20:15},YN={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},JN={25:2,26:4,29:6,30:8,31:10,27:13,28:15},XN=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ZN{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const a=typeof t=="function"?t():t;A.log(`${this.time} [${e}] ${a}`)}}}const Cs=function(e){const t=[];for(let a=0;a<e.length;a++)t.push(e[a].toString(16));return t};class Fp{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let a=0;a<t.length;a++){const i=t[a];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class QN{constructor(){this.uchar=" ",this.penState=new Fp}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class eD{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Fp,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Qt;t++)this.chars.push(new QN);this.logger=e}equals(e){for(let t=0;t<Qt;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Qt;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Qt;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Qt&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Qt)}moveCursor(e){const t=this.pos+e;if(e>1)for(let a=this.pos+1;a<t+1;a++)this.chars[a].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Op(e);if(this.pos>=Qt){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Qt;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let a=0;a<Qt;a++){const i=this.chars[a].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Rl{constructor(e){this.rows=[],this.currRow=Ft-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Ft;t++)this.rows.push(new eD(e));this.logger=e}reset(){for(let e=0;e<Ft;e++)this.rows[e].clear();this.currRow=Ft-1}equals(e){let t=!0;for(let a=0;a<Ft;a++)if(!this.rows[a].equals(e.rows[a])){t=!1;break}return t}copy(e){for(let t=0;t<Ft;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ft;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let l=0;l<Ft;l++)this.rows[l].clear();const o=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const l=r.rows[o].cueStartTime,d=this.logger.time;if(l!==null&&d!==null&&l<d)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(r.rows[o+c])}}this.currRow=t;const a=this.rows[this.currRow];if(e.indent!==null){const o=e.indent,r=Math.max(o-1,0);a.setCursor(e.indent),e.color=a.chars[r].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let a="",i=-1;for(let o=0;o<Ft;o++){const r=this.rows[o].getTextString();r&&(i=o+1,e?t.push("Row "+i+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?a="["+t.join(" | ")+"]":a=t.join(`
|
|
56
56
|
`)),a}getTextAndFormat(){return this.rows}}class Mp{constructor(e,t,a){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Rl(a),this.nonDisplayedMemory=new Rl(a),this.lastOutputScreen=new Rl(a),this.currRollUpRow=this.displayedMemory.rows[Ft-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=a}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Ft-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let a=0;a<e.length;a++)this.writeScreen.insertChar(e[a]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const a=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[a]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Vp{constructor(e,t,a){this.channels=void 0,this.currentChannel=0,this.cmdHistory=sD(),this.logger=void 0;const i=this.logger=new ZN;this.channels=[null,new Mp(e,t,i),new Mp(e+1,a,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let a=0;a<t.length;a+=2){const i=t[a]&127,o=t[a+1]&127;let r=!1,l=null;if(i===0&&o===0)continue;this.logger.log(3,()=>"["+Cs([t[a],t[a+1]])+"] -> ("+Cs([i,o])+")");const d=this.cmdHistory;if(i>=16&&i<=31){if(tD(i,o,d)){fi(null,null,d),this.logger.log(3,()=>"Repeated command ("+Cs([i,o])+") is dropped");continue}fi(i,o,this.cmdHistory),r=this.parseCmd(i,o),r||(r=this.parseMidrow(i,o)),r||(r=this.parsePAC(i,o)),r||(r=this.parseBackgroundAttributes(i,o))}else fi(null,null,d);if(!r&&(l=this.parseChars(i,o),l)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(l):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!l&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Cs([i,o])+" orig: "+Cs([t[a],t[a+1]]))}}parseCmd(e,t){const a=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(a||i))return!1;const o=e===20||e===21||e===23?1:2,r=this.channels[o];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=o,!0}parseMidrow(e,t){let a=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?a=1:a=2,a!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[a];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Cs([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let a;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,o=(e===16||e===24)&&t>=64&&t<=95;if(!(i||o))return!1;const r=e<=23?1:2;t>=64&&t<=95?a=r===1?KN[e]:YN[e]:a=r===1?qN[e]:JN[e];const l=this.channels[r];return l?(l.setPAC(this.interpretPAC(a,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let a;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?a=t-96:a=t-64,i.underline=(a&1)===1,a<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(a/2)]:a<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((a-16)/2)*4,i}parseChars(e,t){let a,i=null,o=null;if(e>=25?(a=2,o=e-8):(a=1,o=e),o>=17&&o<=19){let r;o===17?r=t+80:o===18?r=t+112:r=t+144,this.logger.log(2,()=>"Special char '"+Op(r)+"' in channel "+a),i=[r]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+Cs(i).join(",")),i}parseBackgroundAttributes(e,t){const a=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(a||i))return!1;let o;const r={};e===16||e===24?(o=Math.floor((t-32)/2),r.background=XN[o],t%2===1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));const l=e<=23?1:2;return this.channels[l].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}fi(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const a=this.channels[t];a&&a.cueSplitAtTime(e)}}}function fi(s,e,t){t.a=s,t.b=e}function tD(s,e,t){return t.a===s&&t.b===e}function sD(){return{a:null,b:null}}class pi{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,a){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=a,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Bl=function(){if(Vs!=null&&Vs.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(l,d){if(typeof d!="string"||!Array.isArray(l))return!1;const c=d.toLowerCase();return~l.indexOf(c)?c:!1}function a(l){return t(s,l)}function i(l){return t(e,l)}function o(l,...d){let c=1;for(;c<arguments.length;c++){const h=arguments[c];for(const u in h)l[u]=h[u]}return l}function r(l,d,c){const h=this,u={enumerable:!0};h.hasBeenReset=!1;let f="",p=!1,m=l,g=d,y=c,b=null,S="",w=!0,x="auto",T="start",v=50,E="middle",B=50,I="middle";Object.defineProperty(h,"id",o({},u,{get:function(){return f},set:function(R){f=""+R}})),Object.defineProperty(h,"pauseOnExit",o({},u,{get:function(){return p},set:function(R){p=!!R}})),Object.defineProperty(h,"startTime",o({},u,{get:function(){return m},set:function(R){if(typeof R!="number")throw new TypeError("Start time must be set to a number.");m=R,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",o({},u,{get:function(){return g},set:function(R){if(typeof R!="number")throw new TypeError("End time must be set to a number.");g=R,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",o({},u,{get:function(){return y},set:function(R){y=""+R,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",o({},u,{get:function(){return b},set:function(R){b=R,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",o({},u,{get:function(){return S},set:function(R){const M=a(R);if(M===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=M,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",o({},u,{get:function(){return w},set:function(R){w=!!R,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",o({},u,{get:function(){return x},set:function(R){if(typeof R!="number"&&R!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");x=R,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",o({},u,{get:function(){return T},set:function(R){const M=i(R);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");T=M,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",o({},u,{get:function(){return v},set:function(R){if(R<0||R>100)throw new Error("Position must be between 0 and 100.");v=R,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",o({},u,{get:function(){return E},set:function(R){const M=i(R);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");E=M,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",o({},u,{get:function(){return B},set:function(R){if(R<0||R>100)throw new Error("Size must be between 0 and 100.");B=R,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",o({},u,{get:function(){return I},set:function(R){const M=i(R);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");I=M,this.hasBeenReset=!0}})),h.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class aD{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function $p(s){function e(a,i,o,r){return(a|0)*3600+(i|0)*60+(o|0)+parseFloat(r||0)}const t=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class nD{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,a){return a?this.has(e)?this.values[e]:t[a]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,a){for(let i=0;i<a.length;++i)if(t===a[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const a=parseFloat(t);if(a>=0&&a<=100)return this.set(e,a),!0}return!1}}function zp(s,e,t,a){const i=a?s.split(a):[s];for(const o in i){if(typeof i[o]!="string")continue;const r=i[o].split(t);if(r.length!==2)continue;const l=r[0],d=r[1];e(l,d)}}const Nl=new Bl(0,0,""),gi=Nl.align==="middle"?"middle":"center";function iD(s,e,t){const a=s;function i(){const l=$p(s);if(l===null)throw new Error("Malformed timestamp: "+a);return s=s.replace(/^[^\sa-zA-Z-]+/,""),l}function o(l,d){const c=new nD;zp(l,function(f,p){let m;switch(f){case"region":for(let g=t.length-1;g>=0;g--)if(t[g].id===p){c.set(f,t[g].region);break}break;case"vertical":c.alt(f,p,["rl","lr"]);break;case"line":m=p.split(","),c.integer(f,m[0]),c.percent(f,m[0])&&c.set("snapToLines",!1),c.alt(f,m[0],["auto"]),m.length===2&&c.alt("lineAlign",m[1],["start",gi,"end"]);break;case"position":m=p.split(","),c.percent(f,m[0]),m.length===2&&c.alt("positionAlign",m[1],["start",gi,"end","line-left","line-right","auto"]);break;case"size":c.percent(f,p);break;case"align":c.alt(f,p,["start",gi,"end","left","right"]);break}},/:/,/\s/),d.region=c.get("region",null),d.vertical=c.get("vertical","");let h=c.get("line","auto");h==="auto"&&Nl.line===-1&&(h=-1),d.line=h,d.lineAlign=c.get("lineAlign","start"),d.snapToLines=c.get("snapToLines",!0),d.size=c.get("size",100),d.align=c.get("align",gi);let u=c.get("position","auto");u==="auto"&&Nl.position===50&&(u=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=u}function r(){s=s.replace(/^\s+/,"")}if(r(),e.startTime=i(),r(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);s=s.slice(3),r(),e.endTime=i(),r(),o(s,e)}function Up(s){return s.replace(/<br(?: \/)?>/gi,`
|
|
57
57
|
`)}class oD{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new aD,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function a(){let o=t.buffer,r=0;for(o=Up(o);r<o.length&&o[r]!=="\r"&&o[r]!==`
|
|
58
58
|
`;)++r;const l=o.slice(0,r);return o[r]==="\r"&&++r,o[r]===`
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
`).split(`
|
|
64
64
|
`),c=[],h=e?vN(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 w=(f-h)/9e4;if(b!=null&&b.new&&(p!==void 0?S=t.ccOffset=b.start:cD(t,a,w)),w){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}S=w-t.presentationOffset}const x=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+x,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=lD(u)/1e3}catch(b){m=b}return}else y===""&&(g=!1);l.parse(y+`
|
|
65
65
|
`)}),l.flush()}const Fl="stpp.ttml.im1t",Gp=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,jp=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,hD={left:"start",center:"center",right:"end",start:"start",end:"end"};function Hp(s,e,t,a){const i=Se(new Uint8Array(s),["mdat"]);if(i.length===0){a(new Error("Could not parse IMSC1 mdat"));return}const o=i.map(l=>zt(l)),r=xN(e.baseTime,1,e.timescale);try{o.forEach(l=>t(uD(l,r)))}catch(l){a(l)}}function uD(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=Wp(Ml(i,"styling","style")),c=Wp(Ml(i,"layout","region")),h=Ml(i,"body","[begin]");return[].map.call(h,u=>{const f=Kp(u,l);if(!f||!u.hasAttribute("begin"))return null;const p=$l(u.getAttribute("begin"),r),m=$l(u.getAttribute("dur"),r);let g=$l(u.getAttribute("end"),r);if(p===null)throw qp(u);if(g===null){if(m===null)throw qp(u);g=p+m}const y=new Bl(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")],w=mD(b,S,d),{textAlign:x}=w;if(x){const T=hD[x];T&&(y.lineAlign=T),y.align=x}return je(y,w),y}).filter(u=>u!==null)}function Ml(s,e,t){const a=s.getElementsByTagName(e)[0];return a?[].slice.call(a.querySelectorAll(t)):[]}function Wp(s){return s.reduce((e,t)=>{const a=t.getAttribute("xml:id");return a&&(e[a]=t),e},{})}function Kp(s,e){return[].slice.call(s.childNodes).reduce((t,a,i)=>{var o;return a.nodeName==="br"&&i?t+`
|
|
66
|
-
`:(o=a.childNodes)!=null&&o.length?Kp(a,e):e?t+a.textContent.trim().replace(/\s+/g," "):t+a.textContent},"")}function mD(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=Vl(e,a,d)||Vl(s,a,d)||Vl(i,a,d);return c&&(l[d]=c),l},{})}function Vl(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function qp(s){return new Error(`Could not parse ttml timestamp ${s}`)}function $l(s,e){if(!s)return null;let t=$p(s);return t===null&&(Gp.test(s)?t=fD(s,e):jp.test(s)&&(t=pD(s,e))),t}function fD(s,e){const t=Gp.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 pD(s,e){const t=jp.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 gD{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=Xp(),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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(_.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 pi(this,"textTrack1"),t=new pi(this,"textTrack2"),a=new pi(this,"textTrack3"),i=new pi(this,"textTrack4");this.cea608Parser1=new Vp(1,e,t),this.cea608Parser2=new Vp(3,a,i)}}addCues(e,t,a,i,o){let r=!1;for(let l=o.length;l--;){const d=o[l],c=yD(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(_.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(_.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(Jp(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]),$f(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(_.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=Xp(),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(Rp(this.tracks,a)){this.tracks=a;return}if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){const r=this.media,l=r?Xn(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]&&Jp(l[f],d)){u=l[f],l[f]=null;break}u&&(h=u)}if(h)$s(h);else{const u=Yp(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(_.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(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const a=this.hls;Hp(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),a.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{A.log(`Failed to parse IMSC1: ${i}`),a.trigger(_.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?_t(a.initSegment.data,new Uint8Array(i)):i;dD(c,this.initPTS[a.cc],this.vttCCs,a.cc,a.start,h=>{this._appendCues(h,a.level),d.trigger(_.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(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:h})})}_fallbackToIMSC1(e,t){const a=this.tracks[e.level];a.textCodec||Hp(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=>zf(i,o))}else{const i=this.tracks[t];if(!i)return;const o=i.default?"default":"subtitles"+t;a.trigger(_.CUES_PARSED,{type:"subtitles",cues:e,track:o})}}onFragDecrypted(e,t){const{frag:a}=t;a.type===le.SUBTITLE&&this.onFragLoaded(_.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 Yp(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Jp(s,e){return!!s&&s.kind===Yp(e)&&Il(e,s)}function yD(s,e,t,a){return Math.min(e,a)-Math.max(s,t)}function Xp(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class zl{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(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.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&&ae(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,zl.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 bD{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(_.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(_.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(_.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(_.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 yi="[eme]";class Ys{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=Ys.CDMCleanupPromise?[Ys.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=A.debug.bind(A,yi),this.log=A.log.bind(A,yi),this.warn=A.warn.bind(A,yi),this.error=A.error.bind(A,yi),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(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:a}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===De.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 kt?l(u):l(new kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 hf===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=TB(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: ${Ut.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 Ut.hexDump(e.keyId)}updateKeySession(e,t){var a;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${Ut.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(lf).filter(r=>!!r&&i.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(o).then(({keySystem:r})=>{const l=df(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 kt?this.hls.trigger(_.ERROR,e.data):this.hls.trigger(_.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){const i=lf(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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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[De.FAIRPLAY]){const u=qe(new Uint8Array(a));try{const f=Xr(JSON.parse(u).sinf),p=_f(new Uint8Array(f));if(!p)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=p.subarray(8,24),r=De.FAIRPLAY}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}}else{const u=YB(a),f=u.filter(p=>p.systemId===Ea.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=>cf(p.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(r=cf(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=Ut.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=Ut.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 Ca("ISO-23001-7",l,(p=df(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===De.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):y==="internal-error"?g(new kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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: ${Ut.hexDump("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))} session keyId: ${Ut.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Ze({url:d.url,data:void 0},f)},`"${e}" certificate request failed (${o}). Status: ${f.code} (${f.text})`))},onTimeout:(f,p,m)=>{l(new kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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==De.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={},Ca.clearKeyUriToKeyIdMap();const a=t.length;Ys.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}`)})}}}Ys.CDMCleanupPromise=void 0;class kt 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 Ul;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Ul||(Ul={}));var xs;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(xs||(xs={}));const SD={[xs.OBJECT]:["br","d","ot","tb"],[xs.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[xs.SESSION]:["cid","pr","sf","sid","st","v"],[xs.STATUS]:["bs","rtp"]};class Js{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(a=>a instanceof Js?a:new Js(a))),this.value=e,this.params=t}}class Zp{constructor(e){this.description=void 0,this.description=e}}const _D="Dict";function wD(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 kD(s,e,t,a){return new Error(`failed to ${s} "${wD(e)}" as ${t}`,{cause:a})}const Qp="Bare Item",ED="Boolean",TD="Byte Sequence",CD="Decimal",xD="Integer";function vD(s){return s<-999999999999999||999999999999999<s}const AD=/[\x00-\x1f\x7f]+/,LD="Token",ID="Key";function Kt(s,e,t){return kD("serialize",s,e,t)}function RD(s){if(typeof s!="boolean")throw Kt(s,ED);return s?"?1":"?0"}function BD(s){return btoa(String.fromCharCode(...s))}function ND(s){if(ArrayBuffer.isView(s)===!1)throw Kt(s,TD);return`:${BD(s)}:`}function eg(s){if(vD(s))throw Kt(s,xD);return s.toString()}function DD(s){return`@${eg(s.getTime()/1e3)}`}function tg(s,e){if(s<0)return-tg(-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 PD(s){const e=tg(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Kt(s,CD);const t=e.toString();return t.includes(".")?t:`${t}.0`}const OD="String";function FD(s){if(AD.test(s))throw Kt(s,OD);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function MD(s){return s.description||s.toString().slice(7,-1)}function sg(s){const e=MD(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Kt(e,LD);return e}function Gl(s){switch(typeof s){case"number":if(!ae(s))throw Kt(s,Qp);return Number.isInteger(s)?eg(s):PD(s);case"string":return FD(s);case"symbol":return sg(s);case"boolean":return RD(s);case"object":if(s instanceof Date)return DD(s);if(s instanceof Uint8Array)return ND(s);if(s instanceof Zp)return sg(s);default:throw Kt(s,Qp)}}function jl(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw Kt(s,ID);return s}function Hl(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${jl(e)}`:`;${jl(e)}=${Gl(t)}`).join("")}function ag(s){return s instanceof Js?`${Gl(s.value)}${Hl(s.params)}`:Gl(s)}function VD(s){return`(${s.value.map(ag).join(" ")})${Hl(s.params)}`}function $D(s,e={whitespace:!0}){if(typeof s!="object")throw Kt(s,_D);const t=s instanceof Map?s.entries():Object.entries(s),a=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,o])=>{o instanceof Js||(o=new Js(o));let r=jl(i);return o.value===!0?r+=Hl(o.params):(r+="=",Array.isArray(o.value)?r+=VD(o):r+=ag(o)),r}).join(`,${a}`)}function zD(s,e){return $D(s,e)}const UD=s=>s==="ot"||s==="sf"||s==="st",GD=s=>typeof s=="number"?ae(s):s!=null&&s!==""&&s!==!1;function jD(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 HD(){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 bi=s=>Math.round(s),WD=(s,e)=>(e!=null&&e.baseUrl&&(s=jD(s,e.baseUrl)),encodeURIComponent(s)),Si=s=>bi(s/100)*100,KD={br:bi,d:bi,bl:Si,dl:Si,mtp:Si,nor:WD,rtp:Si,tb:bi};function qD(s,e){const t={};if(s==null||typeof s!="object")return t;const a=Object.keys(s).sort(),i=je({},KD,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||GD(l)&&(UD(r)&&typeof l=="string"&&(l=new Zp(l)),t[r]=l))}),t}function ng(s,e={}){return s?zD(qD(s,e),je({whitespace:!1},e)):""}function YD(s,e={}){if(!s)return{};const t=Object.entries(s),a=Object.entries(SD).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])||xs.REQUEST;return(d=o[u])!=null||(o[u]={}),o[u][c]=h,o},{});return Object.entries(i).reduce((o,[r,l])=>(o[r]=ng(l,e),o),{})}function JD(s,e,t){return je(s,YD(e,t))}const XD="CMCD";function ZD(s,e={}){if(!s)return"";const t=ng(s,e);return`${XD}=${encodeURIComponent(t)}`}const ig=/CMCD=[^&#]+/;function QD(s,e,t){const a=ZD(e,t);if(!a)return s;if(ig.test(s))return s.replace(ig,a);const i=s.includes("?")?"&":"?";return`${s}${i}${a}`}class eP{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||HD(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.includeKeys=a.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHED,this.onMediaDetached,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHED,this.onMediaDetached,this),e.off(_.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:Ul.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){je(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={}),JD(e.headers,t)):e.url=QD(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:Pe.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 tP=3e5;class sP{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.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)===it.SendAlternateToPenaltyBox&&a.flags===Ot.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}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]>tP&&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,Jf(t),this.hls.trigger(_.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===ve.AUDIO_TRACK&&i[o].hasAudioGroup(e)||t===ve.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 Me(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=rg(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),g=new zs({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),og(this.audioTracks,a,d,r),og(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(_.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 og(s,e,t,a){s&&Object.keys(e).forEach(i=>{const o=s.filter(r=>r.groupId===i).map(r=>{const l=je({},r);return l.details=void 0,l.attrs=new Me(l.attrs),l.url=l.attrs.URI=rg(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 rg(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 aP=/^age:\s*[\d.]+\s*$/im;class lg{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 Gn,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&&ae(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};si(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(si(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&&aP.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 nP(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const iP=/(\d+)-(\d+)\/(\d+)/;class cg{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||cP,this.controller=new self.AbortController,this.stats=new Gn}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=oP(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&&ae(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 dP(m||"fetch, bad network response",p,u)}return i.loading.first=f,i.total=lP(u.headers)||i.total,r&&ae(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&&!ae(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 lp,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 oP(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(je({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function rP(s){const e=iP.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function lP(s){const e=s.get("Content-Range");if(e){const a=rP(e);if(ae(a))return a}const t=s.get("Content-Length");if(t)return parseInt(t)}function cP(s,e){return new self.Request(s.url,e)}class dP extends Error{constructor(e,t,a){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=a}}const hP=/\s/,uP={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++)hP.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=Up(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=>zf(s,f))),i}},mP={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},dg=Ze(Ze({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:lg,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$6,bufferController:jN,capLevelController:zl,errorController:A6,fpsController:bD,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:hf,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:mP},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},fP()),{},{subtitleStreamController:$N,subtitleTrackController:UN,timelineController:gD,audioStreamController:MN,audioTrackController:VN,emeController:Ys,cmcdController:eP,contentSteeringController:sP});function fP(){return{cueHandler:uP,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 pP(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])}`)}),Ze(Ze({},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 gP(s){const e=s.loader;e!==cg&&e!==lg?(A.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):nP()&&(s.loader=cg,s.progressive=!0,s.enableSoftwareAES=!0,A.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Kl;class yP 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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.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=Jn(m,a)),((f=g)==null?void 0:f.indexOf("avc1"))===0&&(g=h.videoCodec=a6(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:w,"FRAME-RATE":x,"HDCP-LEVEL":T,"PATHWAY-ID":v,RESOLUTION:E,"VIDEO-RANGE":B}=p,R=`${`${v||"."}-`}${h.bitrate}-${E}-${x}-${w}-${B}-${T}`;if(o[R])if(o[R].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const M=r[R]+=1;h.attrs["PATHWAY-ID"]=new Array(M+1).join(".");const K=new zs(h);o[R]=K,i.push(K)}else o[R].addGroupId("audio",p.AUDIO),o[R].addGroupId("text",p.SUBTITLES);else{const M=new zs(h);o[R]=M,r[R]=1,i.push(M)}}),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))&&g6(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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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)),hg(r)}t.subtitles&&(l=t.subtitles,hg(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 Qn.indexOf(m.videoRange)-Qn.indexOf(g.videoRange);if(m.videoCodec!==g.videoCodec){const y=Af(m.videoCodec),b=Af(g.videoCodec);if(y!==b)return b-y}if(m.uri===g.uri&&m.codecSet!==g.codecSet){const y=Yn(m.codecSet),b=Yn(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===dg.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(_.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(_.ERROR,{type:pe.OTHER_ERROR,details:N.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(_.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===ve.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(_.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));Jf(a),this._levels=a,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(_.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(_.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:a}))}}function hg(s){const e={};s.forEach(t=>{const a=t.groupId||"";t.id=e[a]=e[a]||0,e[a]++})}class bP{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=N.KEY_LOAD_ERROR,a,i,o){return new Xt({type:pe.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,N.KEY_LOAD_ERROR,c))}const r=o.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,N.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,N.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,N.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,N.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),m,Ze({url:d.url,data:void 0},f)))},onTimeout:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,N.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,N.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 ug(){return self.SourceBuffer||self.WebKitSourceBuffer}function mg(){if(!Ts())return!1;const e=ug();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function SP(){if(!mg())return!1;const s=Ts();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(xa(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(xa(e,"audio"))))}function _P(){var s;const e=ug();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const wP=250,_i=2,kP=.1,EP=.05;class TP{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||!Pe.getBuffered(i).length){this.nudgeRetry=0;return}const h=Pe.bufferInfo(i,r,0),u=h.nextStart||0;if(l){const y=h.len>_i,b=!u||t&&t.start<=r||u-r>_i&&!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,x=(S==null||(f=S.details)==null?void 0:f.live)?S.details.targetduration*2:_i,T=this.fragmentTracker.getPartialFragment(r);if(b>0&&(b<=x||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>=wP&&(this._reportStall(h),!this.media))return;const g=Pe.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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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=Pe.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+EP,o+kP);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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}const CP=100;class xP extends _l{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(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(_.ERROR,this.onError,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(_.ERROR,this.onError,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.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(CP),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(_.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)!==Qe.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?Be.AUDIO:Be.VIDEO,b=(y===Be.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===Qe.NOT_LOADED||i===Qe.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 TP(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;ae(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(_.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&&!_P(),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(_.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 Ip(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(_.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(_.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 N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.MAIN,t);break;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_LEVEL&&((a=t.context)==null?void 0:a.type)===ve.LEVEL&&(this.state=V.IDLE);break;case N.BUFFER_APPEND_ERROR:case N.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===N.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Pe.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!==Be.AUDIO||this.audioOnly&&!this.altAudio){const a=(t===Be.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=Pe.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(_.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 w=d.initSegment||d;this._bufferInitSegment(h,m.tracks,w,r),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:w,id:a,tracks:m.tracks})}const b=m.initPTS,S=m.timescale;ae(b)&&(this.initPTS[d.cc]={baseTime:b,timescale:S},i.trigger(_.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,w=!b||d.cc>b.cc;if(o.independent!==!1){const{startPTS:x,endPTS:T,startDTS:v,endDTS:E}=u;if(c)c.elementaryStreams[u.type]={startPTS:x,endPTS:T,startDTS:v,endDTS:E};else if(u.firstKeyFrame&&u.independent&&r.id===1&&!w&&(this.couldBacktrack=!0),u.dropped&&u.independent){const B=this.getMainFwdBufferInfo(),I=(B?B.end:this.getLoadPosition())+this.config.maxBufferHole,R=u.firstKeyFramePTS?u.firstKeyFramePTS:x;if(!S&&I<R-this.config.maxBufferHole&&!w){this.backtrack(d);return}else w&&(d.gap=!0);d.setElementaryStreamInfo(u.type,d.start,T,d.start,E,!0)}else S&&x>_i&&(d.gap=!0);d.setElementaryStreamInfo(u.type,x,T,v,E),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(u,d,c,r,S||w)}else if(S||w)d.gap=!0;else{this.backtrack(d);return}}if(y){const{startPTS:b,endPTS:S,startDTS:w,endDTS:x}=y;c&&(c.elementaryStreams[Be.AUDIO]={startPTS:b,endPTS:S,startDTS:w,endDTS:x}),d.setElementaryStreamInfo(Be.AUDIO,b,S,w,x),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(_.FRAG_PARSING_METADATA,b)}if(g&&f){const b={id:a,frag:d,details:g,samples:f.samples};i.trigger(_.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(_.BUFFER_CODECS,t),Object.keys(t).forEach(d=>{const h=t[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(_.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(Pe.isBuffered(e,a)?t=this.getAppendedFrag(a):Pe.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(_.FRAG_CHANGED,{frag:t}),(!i||i.level!==o)&&this.hls.trigger(_.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&&ae(t)&&ae(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 cs{static get version(){return"1.5.16"}static isMSESupported(){return mg()}static isSupported(){return SP()}static getMediaSource(){return Ts()}static get Events(){return _}static get ErrorTypes(){return pe}static get ErrorDetails(){return N}static get DefaultConfig(){return cs.defaultConfig?cs.defaultConfig:dg}static set DefaultConfig(e){cs.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,fB(e.debug||!1,"Hls instance");const t=this.config=pP(cs.DefaultConfig,e);this.userConfig=e,t.progressive&&gP(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 l6(this),m=new m6(this),g=t.contentSteeringController,y=g?new g(this):null,b=this.levelController=new yP(this,y),S=new U6(this),w=new bP(this.config),x=this.streamController=new xP(this,S,w);u.setStreamController(x),f.setStreamController(x);const T=[p,b,x];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,w)),this.subtitleTrackController=this.createController(t.subtitleTrackController,T);const B=t.subtitleStreamController;B&&T.push(new B(this,S,w)),this.createController(t.timelineController,v),w.emeController=this.emeController=this.createController(t.emeController,v),this.cmcdController=this.createController(t.cmcdController,v),this.latencyController=this.createController(f6,v),this.coreComponents=v,T.push(d);const I=d.onErrorOut;typeof I=="function"&&this.on(_.ERROR,I,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===_.ERROR;this.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.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(_.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(_.MEDIA_ATTACHING,{media:e})}detachMedia(){A.log("detachMedia"),this.trigger(_.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(_.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){p6(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}}cs.defaultConfig=void 0;const vP=[(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))],AP={class:"stories__content"},LP={class:"story-container-game"},IP={class:"story-circle"},RP={class:"story-result"},BP={class:"stories__content__stories-bar"},NP={class:"stories__content__video"},DP={class:"stories__content__video__info__date"},PP={class:"stories__content__video__info__data"},OP=Ye({__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(te=>({"559904cd":y.value,"57a9d8d4":b.value,"57d750a1":v.value}));const a=Kh(),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((te,Te)=>(Te.ids.forEach(Ce=>{te.set(Ce,Te.name)}),te),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),w=n.ref(0),x=n.ref(null),T=n.ref(null),v=n.computed(()=>X()?"7vw":"16px"),E=n.computed(()=>d.value[c.value]),B=n.computed(()=>({"--icon-play":`url(${a}/icnplay1.svg)`}));function I(){l.value.muted=!1,l.value.play()}const R=n.computed(()=>!E.value.isHls&&["ios"].includes(Ko()));n.watch(()=>E.value,te=>{te&&K()}),n.watch(()=>t.stories,te=>{if(te.length){c.value=0,p.value=0;const Te=te.map(Ce=>({...Ce,progress:0,isHls:Ce.url.includes(".m3u8"),date:`${Ce.date.getDate()}, ${au[Ce.date.getMonth()]} ${Ce.date.getFullYear()}`,data:`${o.get(Ce.categoryId)} ${Kx(Ce.player.player_name)}`})).sort((Ce,Oe)=>Ce.startTime-Oe.startTime);t.startStoryIndex>0&&t.startStoryIndex<Te.length-1&&(Te.forEach((Ce,Oe)=>{Oe<=t.startStoryIndex&&(Ce.progress=100)}),c.value=t.startStoryIndex+1,p.value=c.value),d.value=[...Te]}},{immediate:!0}),n.watch(()=>r.value,te=>{te&&M()},{flush:"post"}),n.watch(()=>h.value,te=>{te&&(Wx()?(te.addEventListener("touchstart",he),te.addEventListener("touchend",J)):(te.addEventListener("mousedown",he),te.addEventListener("mouseup",J)))},{flush:"post"});function M(){l.value=new Os("#video-plyr",{controls:[],autoplay:!0,playsinline:!0}),l.value.on("loadeddata",se(l.value)),l.value.on("timeupdate",oe()),K(E.value),l.value.isDestroyed=!1}function K(){E.value.isHls?H(E.value):l.value&&(l.value.source={type:"video",sources:[{src:E.value.url,type:"video/mp4"}]})}function H(te){if(r.value)if(cs.isSupported()){r.value.src=null;let Te=new cs;Te.loadSource(te.url),Te.attachMedia(r.value)}else l.value.source={type:"video",sources:[{src:te.url,type:"video/mp4"}]}}function se(){const te=document.querySelector(".plyr__video-wrapper");return te&&(w.value=te.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 xe(),()=>{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?X()&&(m.value=!0):X()&&(m.value=!1),(l.value.currentTime-E.value.startTime)/E.value.duration*100<0?T.value&&!X()&&(T.value.style="display: none",b.value="100%"):T.value&&!X()&&(T.value.style="display: block",b.value="auto"),l.value.currentTime>=E.value.endTime&&(l.value.pause(),ne())}}function ne(te=1){const Te=c.value+te;Te<0?t.isFirstGameStories?l.value&&(l.value.currentTime=E.value.startTime):de("right",E.value):Te===d.value.length?t.isLastGameStories?q():de("left",E.value):(c.value=Te,te===1&&(p.value=c.value))}function ce(){u.value>f.value?de("left",E.value):u.value<f.value?de("right",E.value):Z()}function de(te,Te){e("last-story-index",p.value),e("swipe",{direction:te,currentPlay:Te})}function Z(){const te=window.innerWidth/2,Te=u.value<te,Ce=E.value.progress;E.value.progress=Te?0:100,l.value.pause(),e("video-next-back",{eventName:Te?"stories_video_anterior":"stories_video_siguiente",currentPlay:{...E.value,progress:Ce}}),ne(Te?-1:1)}function q(){l.value.pause(),l.value.muted=!0,e("last-story-index",p.value),e("close",E.value)}function he(te){u.value=te.changedTouches?te.changedTouches[0].clientX:te.clientX}function J(te){f.value=te.changedTouches?te.changedTouches[0].clientX:te.clientX,ce()}function X(){return/iPhone|iPad/i.test(navigator.userAgent)}function ue(){window.scrollTo(0,100)}function be(){if(window.scrollTo(0,100),Ko()=="android"){const te=document.querySelector("#stories");te.requestFullscreen(te)}}function xe(){if(window.ResizeObserver)S.value=new window.ResizeObserver(()=>{x.value&&w.value.height>0&&(x.value.getBoundingClientRect().height>610?y.value="auto":y.value="100dvh",x.value.getBoundingClientRect().height>610?b.value="100%":b.value="auto")}),S.value.observe(x.value);else throw new Error("Resize observer not supported!")}return n.onMounted(()=>{g.value=document.documentElement.scrollTop||document.body.scrollTop,window.scrollTo(0,100),X()?(window.addEventListener("resize",ue),ue()):(window.addEventListener("orientationchange",be),be()),setTimeout(()=>{xe()},500)}),n.onBeforeUnmount(()=>{window.scrollTo(0,g.value),X()?window.removeEventListener("resize",ue):(Ko()=="android"&&document.exitFullscreen(),window.removeEventListener("orientationchange",be)),S.value&&(S.value.disconnect(),S.value=null)}),(te,Te)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stories",X()?"stories-safe-areas-iphone":""]),id:"stories",ref_key:"eStories",ref:x,style:n.normalizeStyle(B.value)},[n.createElementVNode("div",{class:n.normalizeClass(["stories__close",X()?"stories-safe-areas-iphone":""]),onClick:q},vP,2),n.createElementVNode("div",AP,[n.createElementVNode("div",LP,[n.createElementVNode("div",IP,[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",RP,n.toDisplayString(E.value.header.label),1)]),n.createElementVNode("div",{ref_key:"overlay",ref:h,class:"stories__content__overlay"},null,512),n.createElementVNode("div",BP,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(Ce,Oe)=>(n.openBlock(),n.createElementBlock("div",{key:Oe,class:"stories__content__stories-bar__item"},[n.createElementVNode("div",{class:"stories__content__stories-bar__item__progress",style:n.normalizeStyle({width:`${Ce.progress}%`})},null,4)]))),128))]),n.createElementVNode("div",NP,[n.createElementVNode("div",{class:"stories__content__video__info",ref_key:"videoInfo",ref:T},[n.createElementVNode("div",DP,n.toDisplayString(E.value.date),1),n.createElementVNode("div",PP,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:I},null,4)):n.createCommentVNode("",!0)],6))}},[["__scopeId","data-v-d3c9a398"]]),FP={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"]]},MP=new Map([[1,45],[2,90],[3,105],[4,120]]),VP=[{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 Aa=null,wi=null,ki="";const Mt=iB(),$P={components:{GSCSeasonSelect:oI,GSCTournamentSelect:FL,GSCGames:bv,GSCSlider:sa,GSCGridTeamsMatches:gy,GSCPlayersLanding:uy,GSCTops:yA,GSCTableCalendar:PC,DiscoverVideos:aB,CarouselFullScreen:cL,Stories:OP},setup(){const s=n.ref("landingref"),{elementSize:e}=Y0(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:Kh(),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:[],tournamentScheduleKeysByKey:new Map,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 Ae.post(ki,{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||FP)}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(Mt).reduce((f,[p,m])=>(f[p]=i[m],f),{}),isPlaySeeker:!0,startSeconds:i[Mt.startTime],endSeconds:i[Mt.endTime],totalSeconds:Math.floor(i[Mt.endTime]-i[Mt.startTime]),payloadData:{play_id:i[Mt.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[Mt.momentOfPlay],play_type:i[Mt.categoryId],viewer_second_start:Math.floor(i[Mt.startTime]),intended_second_start:Math.floor(i[Mt.startTime]),intended_second_end:Math.floor(i[Mt.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=VP.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 Ae.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=Ae.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=Ae.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=[Ae.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!==ki&&(ki=i,a.push(Ae.get(ki,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=Ae.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 Ae.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(){Ae.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,w]=g.date.split("-"),[x,T,v]=g.schedule.split(":"),E=new Date(Number(b),Number(S)-1,Number(w),Number(x),Number(T),Number(v));return g.dateTimeMillis=E.valueOf(),g.home_team=l.find(B=>B.team_id===m.home_team),g.visiting_team=l.find(B=>B.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=zu.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[$u[g]||y]=m:u[Vu[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[Mu[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=zu.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[$u[g]||y]=m:u[Vu[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[Mu[p]]=m);return u},{}),this.roundAbbreviationByGameId=new Map,this.tournamentScheduleKeysByKey.clear(),this.tournamentScheduleKeys=Array.from(Object.entries(this.fullTournamentScheduleFull).reduce((u,[f,p],m)=>{const g=Number(f);let y="";Number.isNaN(g)?y=f:y=g<10?`0${g}`:f;let b=!1,S=null;const w={key:f,value:g,valueText:y,avaible:b,matchDayId:S,index:m,liveGamesIds:new Set};this.tournamentScheduleKeysByKey.set(f,w);const x=p.reduce((v,E)=>(!S&&E&&E.games&&E.games.length&&(w.matchDayId=E.games[0].matchday_id),E.games.forEach(B=>{this.roundAbbreviationByGameId.set(B.game_id,f),B.roundAbbreviation=Number.isNaN(g)?g:`J ${g}`,B.roundAbbreviationV2=f,B.scheduleKey=w}),v=v.concat(E.games),v),[]);for(const v of x)(v.game_status!==4||v.is_live)&&(v.score[0]!==0||v.score[1]!==0)&&(w.avaible=!0);u.set(f,w);const T=this.getPages(x);return this.gamesPages.set(f,T),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,w)=>(w.games.forEach(x=>{x.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`}),S=S.concat(w.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(wi),wi=null},createCheckLiveGamesInterval(){this.resetCheckGamesLiveInterval(),wi||(wi=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){Aa||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(),Aa=setInterval(()=>{this.fillGameEvents()},6e4)},resetGamesLiveInterval(){clearInterval(Aa),Aa=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,i.scheduleKey&&i.scheduleKey.liveGamesIds.delete(s.game_id)}},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,i.scheduleKey&&i.scheduleKey.liveGamesIds.add(a.game_id)),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=MP.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))}}Aa||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 t=new Date().valueOf(),a=e?this.getOnlyGamesWithGoals(s):s,i=Object.entries(Object.entries(a).reduce((r,[l,d])=>(r[l]=null,d.forEach(c=>{c.games.forEach(h=>{if([1,0].includes(h.game_status)||h.is_live){const u=t-h.dateTimeMillis;(r[l]===null||u<r[l])&&(r[l]=u)}})}),r),{}));if(!i.length)return"1";const o=i.reduce((r,[l,d])=>{if(d!==null){const c=this.tournamentScheduleKeysByKey.get(l);(r.shortestMillisToNow===null||d<r.shortestMillisToNow&&c.index>=r.scheduleKey.index)&&(r.shortestMillisToNow=d,r.round=l,r.scheduleKey=c)}return r},{round:"",shortestMillisToNow:null,scheduleKey:null});return o.shortestMillisToNow!==null?o.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 Ae.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 Ae.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([Ae.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()}},ds=s=>(n.pushScopeId("data-v-b162f159"),s=s(),n.popScopeId(),s),zP={class:"gsclanding",ref:"landingref"},UP={key:2,class:"play-seeker-image"},GP={class:"play-seeker-image__info"},jP=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),HP={class:"play-seeker-image__info__legends-and-button"},WP=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),KP={class:"play-icon"},qP=["src"],YP=ds(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),JP={class:"play-seeker-image__players"},XP=["src"],ZP={key:3,class:"container-selectors-mobile"},QP={class:"container-selectors-mobile-tournament"},e8={class:"container-selectors-mobile-season"},t8={key:0,class:"home-item-movil"},s8=ds(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),a8={class:"name-user-movil"},n8={key:1,class:"home-item"},i8={key:2,class:"bar-settings"},o8={class:"name-user"},r8={class:"container-selectors"},l8={class:"selector-tournament"},c8={class:"selector-seasons"},d8={key:0,class:"container-games"},h8={key:0,class:"container-games"},u8={key:6,class:"container-players"},m8=["onClick"],f8={class:"story-result"},p8={key:0,class:"font-bold"},g8={key:1,class:"font-bold"},y8={class:"story-match"},b8={key:2,class:"play-seeker-image"},S8={class:"play-seeker-image__info"},_8=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),w8={class:"play-seeker-image__info__legends-and-button"},k8=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),E8={class:"play-icon"},T8=["src"],C8=ds(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),x8={class:"play-seeker-image__players"},v8=["src"],A8={key:3,class:"container-selectors-mobile"},L8={class:"container-selectors-mobile-tournament"},I8={class:"container-selectors-mobile-season"},R8={key:0,class:"home-item-movil"},B8=ds(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),N8={class:"name-user-movil"},D8={key:1,class:"home-item"},P8={key:2,class:"bar-settings"},O8={class:"name-user"},F8={class:"container-selectors"},M8={class:"selector-tournament"},V8={class:"selector-seasons"},$8={key:3,class:"container-games"},z8={key:5,class:"container-players"},U8={key:6,class:"stories-circle-wrapper"},G8=["onClick"],j8={class:"story-result"},H8={key:0,class:"font-bold"},W8={key:1,class:"font-bold"},K8={class:"story-match"};function q8(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("GSCGridTeamsMatches"),u=n.resolveComponent("GSCTableCalendar"),f=n.resolveComponent("GSCGames");n.resolveComponent("DiscoverVideos");const p=n.resolveComponent("GSCPlayersLanding"),m=n.resolveComponent("GSCTops"),g=n.resolveComponent("GSCSlider");return n.openBlock(),n.createElementBlock("div",zP,[t.isplayer?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[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",UP,[n.createElementVNode("div",GP,[jP,n.createElementVNode("div",HP,[WP,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[0]||(e[0]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",KP,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,qP)]),YP])])]),n.createElementVNode("div",JP,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,XP)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",ZP,[n.createElementVNode("div",QP,[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",e8,[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",t8,[s8,n.createElementVNode("div",a8,[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",n8,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",i8,[n.createElementVNode("div",o8,[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",r8,[n.createElementVNode("div",l8,[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",c8,[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),t.user.tournament===i.tournamentSelected.id?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[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(h,{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(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,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","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",d8,[n.createVNode(f,{"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)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:4},[Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",h8,[n.createVNode(f,{"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),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(h,{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(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,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","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2)],64)),n.createCommentVNode("",!0),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",u8,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(p,{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",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id?"tops-player":""])},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{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)],2),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",{key:7,class:n.normalizeClass(["stories-circle-wrapper",t.user.tournament===i.tournamentSelected.id?"":"marginsep"])},[(n.openBlock(),n.createBlock(g,{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,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.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/"+y.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/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",f8,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+" ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",p8,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",g8,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",y8,n.toDisplayString(y.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,m8))),128))]),_:1}))],2)):n.createCommentVNode("",!0),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:8,class:"b2c-image",onClick:e[1]||(e[1]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[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",b8,[n.createElementVNode("div",S8,[_8,n.createElementVNode("div",w8,[k8,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[2]||(e[2]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",E8,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,T8)]),C8])])]),n.createElementVNode("div",x8,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,v8)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",A8,[n.createElementVNode("div",L8,[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",I8,[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",R8,[B8,n.createElementVNode("div",N8,[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",D8,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",P8,[n.createElementVNode("div",O8,[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",F8,[n.createElementVNode("div",M8,[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",V8,[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),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",$8,[n.createVNode(f,{"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),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(h,{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(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,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","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",z8,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(p,{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",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id&&!i.is_public&&!o.isGenericLike?"tops-team":""])},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{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)],2),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",U8,[(n.openBlock(),n.createBlock(g,{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,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.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/"+y.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/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",j8,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+" ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",H8,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",W8,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",K8,n.toDisplayString(y.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,G8))),128))]),_:1}))])):n.createCommentVNode("",!0),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:7,class:"b2c-image",onClick:e[3]||(e[3]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64))],512)}const Y8=Ye($P,[["render",q8],["__scopeId","data-v-b162f159"]]);hs.GSCLanding=Y8,Object.defineProperty(hs,Symbol.toStringTag,{value:"Module"})});
|
|
66
|
+
`:(o=a.childNodes)!=null&&o.length?Kp(a,e):e?t+a.textContent.trim().replace(/\s+/g," "):t+a.textContent},"")}function mD(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=Vl(e,a,d)||Vl(s,a,d)||Vl(i,a,d);return c&&(l[d]=c),l},{})}function Vl(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function qp(s){return new Error(`Could not parse ttml timestamp ${s}`)}function $l(s,e){if(!s)return null;let t=$p(s);return t===null&&(Gp.test(s)?t=fD(s,e):jp.test(s)&&(t=pD(s,e))),t}function fD(s,e){const t=Gp.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 pD(s,e){const t=jp.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 gD{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=Xp(),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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(_.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 pi(this,"textTrack1"),t=new pi(this,"textTrack2"),a=new pi(this,"textTrack3"),i=new pi(this,"textTrack4");this.cea608Parser1=new Vp(1,e,t),this.cea608Parser2=new Vp(3,a,i)}}addCues(e,t,a,i,o){let r=!1;for(let l=o.length;l--;){const d=o[l],c=yD(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(_.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(_.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(Jp(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]),$f(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(_.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=Xp(),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(Rp(this.tracks,a)){this.tracks=a;return}if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){const r=this.media,l=r?Xn(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]&&Jp(l[f],d)){u=l[f],l[f]=null;break}u&&(h=u)}if(h)$s(h);else{const u=Yp(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(_.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(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const a=this.hls;Hp(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),a.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{A.log(`Failed to parse IMSC1: ${i}`),a.trigger(_.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?_t(a.initSegment.data,new Uint8Array(i)):i;dD(c,this.initPTS[a.cc],this.vttCCs,a.cc,a.start,h=>{this._appendCues(h,a.level),d.trigger(_.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(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:h})})}_fallbackToIMSC1(e,t){const a=this.tracks[e.level];a.textCodec||Hp(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=>zf(i,o))}else{const i=this.tracks[t];if(!i)return;const o=i.default?"default":"subtitles"+t;a.trigger(_.CUES_PARSED,{type:"subtitles",cues:e,track:o})}}onFragDecrypted(e,t){const{frag:a}=t;a.type===le.SUBTITLE&&this.onFragLoaded(_.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 Yp(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Jp(s,e){return!!s&&s.kind===Yp(e)&&Il(e,s)}function yD(s,e,t,a){return Math.min(e,a)-Math.max(s,t)}function Xp(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class zl{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(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.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&&ae(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,zl.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 bD{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(_.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(_.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(_.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(_.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 yi="[eme]";class Ys{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=Ys.CDMCleanupPromise?[Ys.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=A.debug.bind(A,yi),this.log=A.log.bind(A,yi),this.warn=A.warn.bind(A,yi),this.error=A.error.bind(A,yi),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(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:a}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===De.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 kt?l(u):l(new kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 hf===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=T3(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: ${Ut.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 Ut.hexDump(e.keyId)}updateKeySession(e,t){var a;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${Ut.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(lf).filter(r=>!!r&&i.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(o).then(({keySystem:r})=>{const l=df(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 kt?this.hls.trigger(_.ERROR,e.data):this.hls.trigger(_.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){const i=lf(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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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[De.FAIRPLAY]){const u=qe(new Uint8Array(a));try{const f=Xr(JSON.parse(u).sinf),p=_f(new Uint8Array(f));if(!p)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=p.subarray(8,24),r=De.FAIRPLAY}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}}else{const u=Y3(a),f=u.filter(p=>p.systemId===Ea.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=>cf(p.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(r=cf(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=Ut.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=Ut.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 Ca("ISO-23001-7",l,(p=df(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===De.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):y==="internal-error"?g(new kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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: ${Ut.hexDump("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))} session keyId: ${Ut.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Ze({url:d.url,data:void 0},f)},`"${e}" certificate request failed (${o}). Status: ${f.code} (${f.text})`))},onTimeout:(f,p,m)=>{l(new kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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 kt({type:pe.KEY_SYSTEM_ERROR,details:N.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==De.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={},Ca.clearKeyUriToKeyIdMap();const a=t.length;Ys.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}`)})}}}Ys.CDMCleanupPromise=void 0;class kt 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 Ul;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Ul||(Ul={}));var xs;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(xs||(xs={}));const SD={[xs.OBJECT]:["br","d","ot","tb"],[xs.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[xs.SESSION]:["cid","pr","sf","sid","st","v"],[xs.STATUS]:["bs","rtp"]};class Js{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(a=>a instanceof Js?a:new Js(a))),this.value=e,this.params=t}}class Zp{constructor(e){this.description=void 0,this.description=e}}const _D="Dict";function wD(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 kD(s,e,t,a){return new Error(`failed to ${s} "${wD(e)}" as ${t}`,{cause:a})}const Qp="Bare Item",ED="Boolean",TD="Byte Sequence",CD="Decimal",xD="Integer";function vD(s){return s<-999999999999999||999999999999999<s}const AD=/[\x00-\x1f\x7f]+/,LD="Token",ID="Key";function Kt(s,e,t){return kD("serialize",s,e,t)}function RD(s){if(typeof s!="boolean")throw Kt(s,ED);return s?"?1":"?0"}function BD(s){return btoa(String.fromCharCode(...s))}function ND(s){if(ArrayBuffer.isView(s)===!1)throw Kt(s,TD);return`:${BD(s)}:`}function eg(s){if(vD(s))throw Kt(s,xD);return s.toString()}function DD(s){return`@${eg(s.getTime()/1e3)}`}function tg(s,e){if(s<0)return-tg(-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 PD(s){const e=tg(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Kt(s,CD);const t=e.toString();return t.includes(".")?t:`${t}.0`}const OD="String";function FD(s){if(AD.test(s))throw Kt(s,OD);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function MD(s){return s.description||s.toString().slice(7,-1)}function sg(s){const e=MD(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Kt(e,LD);return e}function Gl(s){switch(typeof s){case"number":if(!ae(s))throw Kt(s,Qp);return Number.isInteger(s)?eg(s):PD(s);case"string":return FD(s);case"symbol":return sg(s);case"boolean":return RD(s);case"object":if(s instanceof Date)return DD(s);if(s instanceof Uint8Array)return ND(s);if(s instanceof Zp)return sg(s);default:throw Kt(s,Qp)}}function jl(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw Kt(s,ID);return s}function Hl(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${jl(e)}`:`;${jl(e)}=${Gl(t)}`).join("")}function ag(s){return s instanceof Js?`${Gl(s.value)}${Hl(s.params)}`:Gl(s)}function VD(s){return`(${s.value.map(ag).join(" ")})${Hl(s.params)}`}function $D(s,e={whitespace:!0}){if(typeof s!="object")throw Kt(s,_D);const t=s instanceof Map?s.entries():Object.entries(s),a=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,o])=>{o instanceof Js||(o=new Js(o));let r=jl(i);return o.value===!0?r+=Hl(o.params):(r+="=",Array.isArray(o.value)?r+=VD(o):r+=ag(o)),r}).join(`,${a}`)}function zD(s,e){return $D(s,e)}const UD=s=>s==="ot"||s==="sf"||s==="st",GD=s=>typeof s=="number"?ae(s):s!=null&&s!==""&&s!==!1;function jD(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 HD(){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 bi=s=>Math.round(s),WD=(s,e)=>(e!=null&&e.baseUrl&&(s=jD(s,e.baseUrl)),encodeURIComponent(s)),Si=s=>bi(s/100)*100,KD={br:bi,d:bi,bl:Si,dl:Si,mtp:Si,nor:WD,rtp:Si,tb:bi};function qD(s,e){const t={};if(s==null||typeof s!="object")return t;const a=Object.keys(s).sort(),i=je({},KD,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||GD(l)&&(UD(r)&&typeof l=="string"&&(l=new Zp(l)),t[r]=l))}),t}function ng(s,e={}){return s?zD(qD(s,e),je({whitespace:!1},e)):""}function YD(s,e={}){if(!s)return{};const t=Object.entries(s),a=Object.entries(SD).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])||xs.REQUEST;return(d=o[u])!=null||(o[u]={}),o[u][c]=h,o},{});return Object.entries(i).reduce((o,[r,l])=>(o[r]=ng(l,e),o),{})}function JD(s,e,t){return je(s,YD(e,t))}const XD="CMCD";function ZD(s,e={}){if(!s)return"";const t=ng(s,e);return`${XD}=${encodeURIComponent(t)}`}const ig=/CMCD=[^&#]+/;function QD(s,e,t){const a=ZD(e,t);if(!a)return s;if(ig.test(s))return s.replace(ig,a);const i=s.includes("?")?"&":"?";return`${s}${i}${a}`}class eP{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||HD(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.includeKeys=a.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHED,this.onMediaDetached,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHED,this.onMediaDetached,this),e.off(_.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:Ul.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){je(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={}),JD(e.headers,t)):e.url=QD(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:Pe.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 tP=3e5;class sP{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.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)===it.SendAlternateToPenaltyBox&&a.flags===Ot.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}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]>tP&&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,Jf(t),this.hls.trigger(_.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===ve.AUDIO_TRACK&&i[o].hasAudioGroup(e)||t===ve.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 Me(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=rg(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),g=new zs({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),og(this.audioTracks,a,d,r),og(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(_.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 og(s,e,t,a){s&&Object.keys(e).forEach(i=>{const o=s.filter(r=>r.groupId===i).map(r=>{const l=je({},r);return l.details=void 0,l.attrs=new Me(l.attrs),l.url=l.attrs.URI=rg(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 rg(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 aP=/^age:\s*[\d.]+\s*$/im;class lg{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 Gn,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&&ae(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};si(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(si(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&&aP.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 nP(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const iP=/(\d+)-(\d+)\/(\d+)/;class cg{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||cP,this.controller=new self.AbortController,this.stats=new Gn}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=oP(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&&ae(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 dP(m||"fetch, bad network response",p,u)}return i.loading.first=f,i.total=lP(u.headers)||i.total,r&&ae(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&&!ae(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 lp,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 oP(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(je({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function rP(s){const e=iP.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function lP(s){const e=s.get("Content-Range");if(e){const a=rP(e);if(ae(a))return a}const t=s.get("Content-Length");if(t)return parseInt(t)}function cP(s,e){return new self.Request(s.url,e)}class dP extends Error{constructor(e,t,a){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=a}}const hP=/\s/,uP={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++)hP.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=Up(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=>zf(s,f))),i}},mP={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},dg=Ze(Ze({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:lg,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$6,bufferController:jN,capLevelController:zl,errorController:A6,fpsController:bD,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:hf,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:mP},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},fP()),{},{subtitleStreamController:$N,subtitleTrackController:UN,timelineController:gD,audioStreamController:MN,audioTrackController:VN,emeController:Ys,cmcdController:eP,contentSteeringController:sP});function fP(){return{cueHandler:uP,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 pP(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])}`)}),Ze(Ze({},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 gP(s){const e=s.loader;e!==cg&&e!==lg?(A.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):nP()&&(s.loader=cg,s.progressive=!0,s.enableSoftwareAES=!0,A.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Kl;class yP 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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.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=Jn(m,a)),((f=g)==null?void 0:f.indexOf("avc1"))===0&&(g=h.videoCodec=a6(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:w,"FRAME-RATE":x,"HDCP-LEVEL":T,"PATHWAY-ID":v,RESOLUTION:E,"VIDEO-RANGE":B}=p,R=`${`${v||"."}-`}${h.bitrate}-${E}-${x}-${w}-${B}-${T}`;if(o[R])if(o[R].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const M=r[R]+=1;h.attrs["PATHWAY-ID"]=new Array(M+1).join(".");const K=new zs(h);o[R]=K,i.push(K)}else o[R].addGroupId("audio",p.AUDIO),o[R].addGroupId("text",p.SUBTITLES);else{const M=new zs(h);o[R]=M,r[R]=1,i.push(M)}}),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))&&g6(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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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)),hg(r)}t.subtitles&&(l=t.subtitles,hg(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 Qn.indexOf(m.videoRange)-Qn.indexOf(g.videoRange);if(m.videoCodec!==g.videoCodec){const y=Af(m.videoCodec),b=Af(g.videoCodec);if(y!==b)return b-y}if(m.uri===g.uri&&m.codecSet!==g.codecSet){const y=Yn(m.codecSet),b=Yn(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===dg.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(_.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(_.ERROR,{type:pe.OTHER_ERROR,details:N.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(_.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===ve.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(_.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));Jf(a),this._levels=a,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(_.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(_.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:a}))}}function hg(s){const e={};s.forEach(t=>{const a=t.groupId||"";t.id=e[a]=e[a]||0,e[a]++})}class bP{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=N.KEY_LOAD_ERROR,a,i,o){return new Xt({type:pe.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,N.KEY_LOAD_ERROR,c))}const r=o.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,N.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,N.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,N.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,N.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),m,Ze({url:d.url,data:void 0},f)))},onTimeout:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,N.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(f,p,m)=>{this.resetLoader(p),l(this.createKeyLoadError(t,N.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 ug(){return self.SourceBuffer||self.WebKitSourceBuffer}function mg(){if(!Ts())return!1;const e=ug();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function SP(){if(!mg())return!1;const s=Ts();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(xa(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(xa(e,"audio"))))}function _P(){var s;const e=ug();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const wP=250,_i=2,kP=.1,EP=.05;class TP{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||!Pe.getBuffered(i).length){this.nudgeRetry=0;return}const h=Pe.bufferInfo(i,r,0),u=h.nextStart||0;if(l){const y=h.len>_i,b=!u||t&&t.start<=r||u-r>_i&&!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,x=(S==null||(f=S.details)==null?void 0:f.live)?S.details.targetduration*2:_i,T=this.fragmentTracker.getPartialFragment(r);if(b>0&&(b<=x||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>=wP&&(this._reportStall(h),!this.media))return;const g=Pe.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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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=Pe.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+EP,o+kP);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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.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(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}const CP=100;class xP extends _l{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(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(_.ERROR,this.onError,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(_.ERROR,this.onError,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.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(CP),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(_.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)!==Qe.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?Be.AUDIO:Be.VIDEO,b=(y===Be.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===Qe.NOT_LOADED||i===Qe.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 TP(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;ae(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(_.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&&!_P(),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(_.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 Ip(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(_.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(_.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 N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.MAIN,t);break;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_LEVEL&&((a=t.context)==null?void 0:a.type)===ve.LEVEL&&(this.state=V.IDLE);break;case N.BUFFER_APPEND_ERROR:case N.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===N.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Pe.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!==Be.AUDIO||this.audioOnly&&!this.altAudio){const a=(t===Be.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=Pe.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(_.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 w=d.initSegment||d;this._bufferInitSegment(h,m.tracks,w,r),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:w,id:a,tracks:m.tracks})}const b=m.initPTS,S=m.timescale;ae(b)&&(this.initPTS[d.cc]={baseTime:b,timescale:S},i.trigger(_.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,w=!b||d.cc>b.cc;if(o.independent!==!1){const{startPTS:x,endPTS:T,startDTS:v,endDTS:E}=u;if(c)c.elementaryStreams[u.type]={startPTS:x,endPTS:T,startDTS:v,endDTS:E};else if(u.firstKeyFrame&&u.independent&&r.id===1&&!w&&(this.couldBacktrack=!0),u.dropped&&u.independent){const B=this.getMainFwdBufferInfo(),I=(B?B.end:this.getLoadPosition())+this.config.maxBufferHole,R=u.firstKeyFramePTS?u.firstKeyFramePTS:x;if(!S&&I<R-this.config.maxBufferHole&&!w){this.backtrack(d);return}else w&&(d.gap=!0);d.setElementaryStreamInfo(u.type,d.start,T,d.start,E,!0)}else S&&x>_i&&(d.gap=!0);d.setElementaryStreamInfo(u.type,x,T,v,E),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(u,d,c,r,S||w)}else if(S||w)d.gap=!0;else{this.backtrack(d);return}}if(y){const{startPTS:b,endPTS:S,startDTS:w,endDTS:x}=y;c&&(c.elementaryStreams[Be.AUDIO]={startPTS:b,endPTS:S,startDTS:w,endDTS:x}),d.setElementaryStreamInfo(Be.AUDIO,b,S,w,x),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(_.FRAG_PARSING_METADATA,b)}if(g&&f){const b={id:a,frag:d,details:g,samples:f.samples};i.trigger(_.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(_.BUFFER_CODECS,t),Object.keys(t).forEach(d=>{const h=t[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(_.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(Pe.isBuffered(e,a)?t=this.getAppendedFrag(a):Pe.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(_.FRAG_CHANGED,{frag:t}),(!i||i.level!==o)&&this.hls.trigger(_.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&&ae(t)&&ae(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 cs{static get version(){return"1.5.16"}static isMSESupported(){return mg()}static isSupported(){return SP()}static getMediaSource(){return Ts()}static get Events(){return _}static get ErrorTypes(){return pe}static get ErrorDetails(){return N}static get DefaultConfig(){return cs.defaultConfig?cs.defaultConfig:dg}static set DefaultConfig(e){cs.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,f3(e.debug||!1,"Hls instance");const t=this.config=pP(cs.DefaultConfig,e);this.userConfig=e,t.progressive&&gP(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 l6(this),m=new m6(this),g=t.contentSteeringController,y=g?new g(this):null,b=this.levelController=new yP(this,y),S=new U6(this),w=new bP(this.config),x=this.streamController=new xP(this,S,w);u.setStreamController(x),f.setStreamController(x);const T=[p,b,x];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,w)),this.subtitleTrackController=this.createController(t.subtitleTrackController,T);const B=t.subtitleStreamController;B&&T.push(new B(this,S,w)),this.createController(t.timelineController,v),w.emeController=this.emeController=this.createController(t.emeController,v),this.cmcdController=this.createController(t.cmcdController,v),this.latencyController=this.createController(f6,v),this.coreComponents=v,T.push(d);const I=d.onErrorOut;typeof I=="function"&&this.on(_.ERROR,I,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===_.ERROR;this.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.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(_.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(_.MEDIA_ATTACHING,{media:e})}detachMedia(){A.log("detachMedia"),this.trigger(_.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(_.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){p6(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}}cs.defaultConfig=void 0;const vP=[(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))],AP={class:"stories__content"},LP={class:"story-container-game"},IP={class:"story-circle"},RP={class:"story-result"},BP={class:"stories__content__stories-bar"},NP={class:"stories__content__video"},DP={class:"stories__content__video__info__date"},PP={class:"stories__content__video__info__data"},OP=Ye({__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(te=>({"559904cd":y.value,"57a9d8d4":b.value,"57d750a1":v.value}));const a=Kh(),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((te,Te)=>(Te.ids.forEach(Ce=>{te.set(Ce,Te.name)}),te),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),w=n.ref(0),x=n.ref(null),T=n.ref(null),v=n.computed(()=>X()?"7vw":"16px"),E=n.computed(()=>d.value[c.value]),B=n.computed(()=>({"--icon-play":`url(${a}/icnplay1.svg)`}));function I(){l.value.muted=!1,l.value.play()}const R=n.computed(()=>!E.value.isHls&&["ios"].includes(Ko()));n.watch(()=>E.value,te=>{te&&K()}),n.watch(()=>t.stories,te=>{if(te.length){c.value=0,p.value=0;const Te=te.map(Ce=>({...Ce,progress:0,isHls:Ce.url.includes(".m3u8"),date:`${Ce.date.getDate()}, ${au[Ce.date.getMonth()]} ${Ce.date.getFullYear()}`,data:`${o.get(Ce.categoryId)} ${Kx(Ce.player.player_name)}`})).sort((Ce,Oe)=>Ce.startTime-Oe.startTime);t.startStoryIndex>0&&t.startStoryIndex<Te.length-1&&(Te.forEach((Ce,Oe)=>{Oe<=t.startStoryIndex&&(Ce.progress=100)}),c.value=t.startStoryIndex+1,p.value=c.value),d.value=[...Te]}},{immediate:!0}),n.watch(()=>r.value,te=>{te&&M()},{flush:"post"}),n.watch(()=>h.value,te=>{te&&(Wx()?(te.addEventListener("touchstart",he),te.addEventListener("touchend",J)):(te.addEventListener("mousedown",he),te.addEventListener("mouseup",J)))},{flush:"post"});function M(){l.value=new Os("#video-plyr",{controls:[],autoplay:!0,playsinline:!0}),l.value.on("loadeddata",se(l.value)),l.value.on("timeupdate",oe()),K(E.value),l.value.isDestroyed=!1}function K(){E.value.isHls?H(E.value):l.value&&(l.value.source={type:"video",sources:[{src:E.value.url,type:"video/mp4"}]})}function H(te){if(r.value)if(cs.isSupported()){r.value.src=null;let Te=new cs;Te.loadSource(te.url),Te.attachMedia(r.value)}else l.value.source={type:"video",sources:[{src:te.url,type:"video/mp4"}]}}function se(){const te=document.querySelector(".plyr__video-wrapper");return te&&(w.value=te.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 xe(),()=>{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?X()&&(m.value=!0):X()&&(m.value=!1),(l.value.currentTime-E.value.startTime)/E.value.duration*100<0?T.value&&!X()&&(T.value.style="display: none",b.value="100%"):T.value&&!X()&&(T.value.style="display: block",b.value="auto"),l.value.currentTime>=E.value.endTime&&(l.value.pause(),ne())}}function ne(te=1){const Te=c.value+te;Te<0?t.isFirstGameStories?l.value&&(l.value.currentTime=E.value.startTime):de("right",E.value):Te===d.value.length?t.isLastGameStories?q():de("left",E.value):(c.value=Te,te===1&&(p.value=c.value))}function ce(){u.value>f.value?de("left",E.value):u.value<f.value?de("right",E.value):Z()}function de(te,Te){e("last-story-index",p.value),e("swipe",{direction:te,currentPlay:Te})}function Z(){const te=window.innerWidth/2,Te=u.value<te,Ce=E.value.progress;E.value.progress=Te?0:100,l.value.pause(),e("video-next-back",{eventName:Te?"stories_video_anterior":"stories_video_siguiente",currentPlay:{...E.value,progress:Ce}}),ne(Te?-1:1)}function q(){l.value.pause(),l.value.muted=!0,e("last-story-index",p.value),e("close",E.value)}function he(te){u.value=te.changedTouches?te.changedTouches[0].clientX:te.clientX}function J(te){f.value=te.changedTouches?te.changedTouches[0].clientX:te.clientX,ce()}function X(){return/iPhone|iPad/i.test(navigator.userAgent)}function ue(){window.scrollTo(0,100)}function be(){if(window.scrollTo(0,100),Ko()=="android"){const te=document.querySelector("#stories");te.requestFullscreen(te)}}function xe(){if(window.ResizeObserver)S.value=new window.ResizeObserver(()=>{x.value&&w.value.height>0&&(x.value.getBoundingClientRect().height>610?y.value="auto":y.value="100dvh",x.value.getBoundingClientRect().height>610?b.value="100%":b.value="auto")}),S.value.observe(x.value);else throw new Error("Resize observer not supported!")}return n.onMounted(()=>{g.value=document.documentElement.scrollTop||document.body.scrollTop,window.scrollTo(0,100),X()?(window.addEventListener("resize",ue),ue()):(window.addEventListener("orientationchange",be),be()),setTimeout(()=>{xe()},500)}),n.onBeforeUnmount(()=>{window.scrollTo(0,g.value),X()?window.removeEventListener("resize",ue):(Ko()=="android"&&document.exitFullscreen(),window.removeEventListener("orientationchange",be)),S.value&&(S.value.disconnect(),S.value=null)}),(te,Te)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stories",X()?"stories-safe-areas-iphone":""]),id:"stories",ref_key:"eStories",ref:x,style:n.normalizeStyle(B.value)},[n.createElementVNode("div",{class:n.normalizeClass(["stories__close",X()?"stories-safe-areas-iphone":""]),onClick:q},vP,2),n.createElementVNode("div",AP,[n.createElementVNode("div",LP,[n.createElementVNode("div",IP,[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",RP,n.toDisplayString(E.value.header.label),1)]),n.createElementVNode("div",{ref_key:"overlay",ref:h,class:"stories__content__overlay"},null,512),n.createElementVNode("div",BP,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(Ce,Oe)=>(n.openBlock(),n.createElementBlock("div",{key:Oe,class:"stories__content__stories-bar__item"},[n.createElementVNode("div",{class:"stories__content__stories-bar__item__progress",style:n.normalizeStyle({width:`${Ce.progress}%`})},null,4)]))),128))]),n.createElementVNode("div",NP,[n.createElementVNode("div",{class:"stories__content__video__info",ref_key:"videoInfo",ref:T},[n.createElementVNode("div",DP,n.toDisplayString(E.value.date),1),n.createElementVNode("div",PP,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:I},null,4)):n.createCommentVNode("",!0)],6))}},[["__scopeId","data-v-d3c9a398"]]),FP={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"]]},MP=new Map([[1,45],[2,90],[3,105],[4,120]]),VP=[{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 Aa=null,wi=null,ki="";const Mt=i3(),$P={components:{GSCSeasonSelect:oI,GSCTournamentSelect:FL,GSCGames:bv,GSCSlider:sa,GSCGridTeamsMatches:gy,GSCPlayersLanding:uy,GSCTops:yA,GSCTableCalendar:PC,DiscoverVideos:a3,CarouselFullScreen:cL,Stories:OP},setup(){const s=n.ref("landingref"),{elementSize:e}=Y0(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:Kh(),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:[],tournamentScheduleKeysByKey:new Map,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 Ae.post(ki,{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||FP)}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(Mt).reduce((f,[p,m])=>(f[p]=i[m],f),{}),isPlaySeeker:!0,startSeconds:i[Mt.startTime],endSeconds:i[Mt.endTime],totalSeconds:Math.floor(i[Mt.endTime]-i[Mt.startTime]),payloadData:{play_id:i[Mt.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[Mt.momentOfPlay],play_type:i[Mt.categoryId],viewer_second_start:Math.floor(i[Mt.startTime]),intended_second_start:Math.floor(i[Mt.startTime]),intended_second_end:Math.floor(i[Mt.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=VP.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 Ae.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=Ae.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=Ae.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=[Ae.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!==ki&&(ki=i,a.push(Ae.get(ki,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=Ae.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 Ae.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(){Ae.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,w]=g.date.split("-"),[x,T,v]=g.schedule.split(":"),E=new Date(Number(b),Number(S)-1,Number(w),Number(x),Number(T),Number(v));return g.dateTimeMillis=E.valueOf(),g.home_team=l.find(B=>B.team_id===m.home_team),g.visiting_team=l.find(B=>B.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=zu.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[$u[g]||y]=m:u[Vu[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[Mu[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=zu.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[$u[g]||y]=m:u[Vu[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[Mu[p]]=m);return u},{}),this.roundAbbreviationByGameId=new Map,this.tournamentScheduleKeysByKey.clear(),this.tournamentScheduleKeys=Array.from(Object.entries(this.fullTournamentScheduleFull).reduce((u,[f,p],m)=>{const g=Number(f);let y="";Number.isNaN(g)?y=f:y=g<10?`0${g}`:f;let b=!1,S=null;const w={key:f,value:g,valueText:y,avaible:b,matchDayId:S,index:m,liveGamesIds:new Set};this.tournamentScheduleKeysByKey.set(f,w);const x=p.reduce((v,E)=>(!S&&E&&E.games&&E.games.length&&(w.matchDayId=E.games[0].matchday_id),E.games.forEach(B=>{this.roundAbbreviationByGameId.set(B.game_id,f),B.roundAbbreviation=Number.isNaN(g)?g:`J ${g}`,B.roundAbbreviationV2=f,B.scheduleKey=w}),v=v.concat(E.games),v),[]);for(const v of x)(v.game_status!==4||v.is_live)&&(v.score[0]!==0||v.score[1]!==0)&&(w.avaible=!0);u.set(f,w);const T=this.getPages(x);return this.gamesPages.set(f,T),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,w)=>(w.games.forEach(x=>{x.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`}),S=S.concat(w.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(wi),wi=null},createCheckLiveGamesInterval(){this.resetCheckGamesLiveInterval(),wi||(wi=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){Aa||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(),Aa=setInterval(()=>{this.fillGameEvents()},6e4)},resetGamesLiveInterval(){clearInterval(Aa),Aa=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,i.scheduleKey&&i.scheduleKey.liveGamesIds.delete(s.game_id)}},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,i.scheduleKey&&i.scheduleKey.liveGamesIds.add(a.game_id)),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=MP.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))}}Aa||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 t=new Date().valueOf(),a=e?this.getOnlyGamesWithGoals(s):s,i=Object.entries(Object.entries(a).reduce((r,[l,d])=>(r[l]=null,d.forEach(c=>{c.games.forEach(h=>{if([1,0].includes(h.game_status)||h.is_live){const u=t-h.dateTimeMillis;(r[l]===null||u<r[l])&&(r[l]=u)}})}),r),{}));if(!i.length)return"1";const o=i.reduce((r,[l,d])=>{if(d!==null){const c=this.tournamentScheduleKeysByKey.get(l);(r.shortestMillisToNow===null||d<r.shortestMillisToNow&&c.index>=r.scheduleKey.index)&&(r.shortestMillisToNow=d,r.round=l,r.scheduleKey=c)}return r},{round:"",shortestMillisToNow:null,scheduleKey:null});return o.shortestMillisToNow!==null?o.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 Ae.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 Ae.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([Ae.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()}},ds=s=>(n.pushScopeId("data-v-b162f159"),s=s(),n.popScopeId(),s),zP={class:"gsclanding",ref:"landingref"},UP={key:2,class:"play-seeker-image"},GP={class:"play-seeker-image__info"},jP=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),HP={class:"play-seeker-image__info__legends-and-button"},WP=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),KP={class:"play-icon"},qP=["src"],YP=ds(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),JP={class:"play-seeker-image__players"},XP=["src"],ZP={key:3,class:"container-selectors-mobile"},QP={class:"container-selectors-mobile-tournament"},e8={class:"container-selectors-mobile-season"},t8={key:0,class:"home-item-movil"},s8=ds(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),a8={class:"name-user-movil"},n8={key:1,class:"home-item"},i8={key:2,class:"bar-settings"},o8={class:"name-user"},r8={class:"container-selectors"},l8={class:"selector-tournament"},c8={class:"selector-seasons"},d8={key:0,class:"container-games"},h8={key:0,class:"container-games"},u8={key:6,class:"container-players"},m8=["onClick"],f8={class:"story-result"},p8={key:0,class:"font-bold"},g8={key:1,class:"font-bold"},y8={class:"story-match"},b8={key:2,class:"play-seeker-image"},S8={class:"play-seeker-image__info"},_8=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),w8={class:"play-seeker-image__info__legends-and-button"},k8=ds(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),E8={class:"play-icon"},T8=["src"],C8=ds(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),x8={class:"play-seeker-image__players"},v8=["src"],A8={key:3,class:"container-selectors-mobile"},L8={class:"container-selectors-mobile-tournament"},I8={class:"container-selectors-mobile-season"},R8={key:0,class:"home-item-movil"},B8=ds(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),N8={class:"name-user-movil"},D8={key:1,class:"home-item"},P8={key:2,class:"bar-settings"},O8={class:"name-user"},F8={class:"container-selectors"},M8={class:"selector-tournament"},V8={class:"selector-seasons"},$8={key:3,class:"container-games"},z8={key:5,class:"container-players"},U8={key:6,class:"stories-circle-wrapper"},G8=["onClick"],j8={class:"story-result"},H8={key:0,class:"font-bold"},W8={key:1,class:"font-bold"},K8={class:"story-match"};function q8(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("GSCGridTeamsMatches"),u=n.resolveComponent("GSCTableCalendar"),f=n.resolveComponent("GSCGames");n.resolveComponent("DiscoverVideos");const p=n.resolveComponent("GSCPlayersLanding"),m=n.resolveComponent("GSCTops"),g=n.resolveComponent("GSCSlider");return n.openBlock(),n.createElementBlock("div",zP,[t.isplayer?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[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",UP,[n.createElementVNode("div",GP,[jP,n.createElementVNode("div",HP,[WP,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[0]||(e[0]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",KP,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,qP)]),YP])])]),n.createElementVNode("div",JP,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,XP)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",ZP,[n.createElementVNode("div",QP,[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",e8,[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",t8,[s8,n.createElementVNode("div",a8,[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",n8,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",i8,[n.createElementVNode("div",o8,[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",r8,[n.createElementVNode("div",l8,[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",c8,[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),t.user.tournament===i.tournamentSelected.id?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[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(h,{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(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,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","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",d8,[n.createVNode(f,{"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)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:4},[Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",h8,[n.createVNode(f,{"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),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(h,{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(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,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","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2)],64)),n.createCommentVNode("",!0),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",u8,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(p,{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",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id?"tops-player":""])},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{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)],2),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",{key:7,class:n.normalizeClass(["stories-circle-wrapper",t.user.tournament===i.tournamentSelected.id?"":"marginsep"])},[(n.openBlock(),n.createBlock(g,{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,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.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/"+y.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/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",f8,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+" ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",p8,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",g8,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",y8,n.toDisplayString(y.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,m8))),128))]),_:1}))],2)):n.createCommentVNode("",!0),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:8,class:"b2c-image",onClick:e[1]||(e[1]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[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",b8,[n.createElementVNode("div",S8,[_8,n.createElementVNode("div",w8,[k8,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[2]||(e[2]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",E8,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,T8)]),C8])])]),n.createElementVNode("div",x8,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,v8)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",A8,[n.createElementVNode("div",L8,[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",I8,[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",R8,[B8,n.createElementVNode("div",N8,[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",D8,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",P8,[n.createElementVNode("div",O8,[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",F8,[n.createElementVNode("div",M8,[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",V8,[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),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",$8,[n.createVNode(f,{"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),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(h,{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(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,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","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4)],2),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",z8,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(p,{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",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id&&!i.is_public&&!o.isGenericLike?"tops-team":""])},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{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)],2),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",U8,[(n.openBlock(),n.createBlock(g,{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,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.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/"+y.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/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",j8,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+" ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",H8,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",W8,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",K8,n.toDisplayString(y.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,G8))),128))]),_:1}))])):n.createCommentVNode("",!0),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:7,class:"b2c-image",onClick:e[3]||(e[3]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64))],512)}const Y8=Ye($P,[["render",q8],["__scopeId","data-v-b162f159"]]);hs.GSCLanding=Y8,Object.defineProperty(hs,Symbol.toStringTag,{value:"Module"})});
|