@mux/mux-player 3.3.3-canary.2 → 3.3.3

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.
@@ -1,4 +1,4 @@
1
- var Vg=i=>{throw TypeError(i)};var gc=(i,e,t)=>e.has(i)||Vg("Cannot "+t);var Se=(i,e,t)=>(gc(i,e,"read from private field"),t?t.call(i):e.get(i)),It=(i,e,t)=>e.has(i)?Vg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Bt=(i,e,t,r)=>(gc(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),ze=(i,e,t)=>(gc(i,e,"access private method"),t);var Gs=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends Gs{}globalThis.DocumentFragment=i}var qn=class extends Gs{},vc=class extends Gs{},J_={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(qn)}},jn,Ec=class{constructor(e,t={}){It(this,jn);Bt(this,jn,t==null?void 0:t.detail)}get detail(){return Se(this,jn)}initCustomEvent(){}};jn=new WeakMap;function eA(i,e){return new qn}var Wg={document:{createElement:eA},DocumentFragment,customElements:J_,CustomEvent:Ec,EventTarget:Gs,HTMLElement:qn,HTMLVideoElement:vc},Yg=typeof window=="undefined"||typeof globalThis.customElements=="undefined",kt=Yg?Wg:globalThis,Ks=Yg?Wg.document:globalThis.document;var $={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},pe={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},bc={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_WIDTH:"mediaWidth"},qg=Object.entries(bc),y=qg.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),tA={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},Ki=qg.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...tA}),RC=Object.entries(Ki).reduce((i,[e,t])=>{let r=y[e];return r&&(i[t]=r),i},{userinactivechange:"userinactive"}),jg=Object.entries(y).reduce((i,[e,t])=>{let r=Ki[e];return r&&(i[t]=r),i},{userinactive:"userinactivechange"}),Lt={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},lr={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var yc={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},$t={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Zt={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var zg={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};function Xg(i){return i==null?void 0:i.map(rA).join(" ")}function Qg(i){return i==null?void 0:i.split(/\s+/).map(sA)}function rA(i){if(i){let{id:e,width:t,height:r}=i;return[e,t,r].filter(s=>s!=null).join(":")}}function sA(i){if(i){let[e,t,r]=i.split(":");return{id:e,width:+t,height:+r}}}function Zg(i){return i==null?void 0:i.map(nA).join(" ")}function Jg(i){return i==null?void 0:i.split(/\s+/).map(aA)}function nA(i){if(i){let{id:e,kind:t,language:r,label:s}=i;return[e,t,r,s].filter(n=>n!=null).join(":")}}function aA(i){if(i){let[e,t,r,s]=i.split(":");return{id:e,kind:t,language:r,label:s}}}function e0(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Vs(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function Co(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}var Mo=i=>new Promise(e=>setTimeout(e,i));var t0=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],oA=(i,e)=>{let t=i===1?t0[e].singular:t0[e].plural;return`${i} ${t}`},Mr=i=>{if(!Vs(i))return"";let e=Math.abs(i),t=e!==i,r=new Date(0,0,0,0,0,e,0);return`${[r.getHours(),r.getMinutes(),r.getSeconds()].map((o,l)=>o&&oA(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function fi(i,e){let t=!1;i<0&&(t=!0,i=0-i),i=i<0?0:i;let r=Math.floor(i%60),s=Math.floor(i/60%60),n=Math.floor(i/3600),a=Math.floor(e/60%60),o=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=s=r="0"),n=n>0||o>0?n+":":"",s=((n||a>=10)&&s<10?"0"+s:s)+":",r=r<10?"0"+r:r,(t?"-":"")+n+s+r}var LC=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});var Tc={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute",live:"live","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var i0,dA={en:Tc},r0=((i0=globalThis.navigator)==null?void 0:i0.language.split("-")[0])||"en",s0=i=>{r0=i};var H=(i,e={})=>{var t;return(((t=dA[r0])==null?void 0:t[i])||Tc[i]).replace(/\{(\w+)\}/g,(s,n)=>e[n]!==void 0?String(e[n]):`{${n}}`)};var Po=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},Oo=class extends Po{},No=class extends Oo{constructor(){super(...arguments),this.role=null}},_c=class{observe(){}unobserve(){}disconnect(){}},n0={createElement:function(){return new zn.HTMLElement},createElementNS:function(){return new zn.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},zn={ResizeObserver:_c,document:n0,Node:Oo,Element:No,HTMLElement:class extends No{constructor(){super(...arguments),this.innerHTML=""}get content(){return new zn.DocumentFragment}},DocumentFragment:class extends Po{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(i){return null},setItem(i,e){},removeItem(i){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(i){return{matches:!1,media:i}}},a0=typeof window=="undefined"||typeof window.customElements=="undefined",o0=Object.keys(zn).every(i=>i in globalThis),x=a0&&!o0?zn:globalThis,F=a0&&!o0?n0:globalThis.document;var l0=new WeakMap,Ac=i=>{let e=l0.get(i);return e||l0.set(i,e=new Set),e},d0=new x.ResizeObserver(i=>{for(let e of i)for(let t of Ac(e.target))t(e)});function Vi(i,e){Ac(i).add(e),d0.observe(i)}function Wi(i,e){let t=Ac(i);t.delete(e),t.size||d0.unobserve(i)}function u0(i){let e={};for(let t of i)e[t.name]=t.value;return e}function Ke(i){var e;return(e=Uo(i))!=null?e:mi(i,"media-controller")}function Uo(i){var e;let{MEDIA_CONTROLLER:t}=pe,r=i.getAttribute(t);if(r)return(e=Pr(i))==null?void 0:e.getElementById(r)}var Fo=(i,e,t=".value")=>{let r=i.querySelector(t);r&&(r.textContent=e)},uA=(i,e)=>{let t=`slot[name="${e}"]`,r=i.shadowRoot.querySelector(t);return r?r.children:[]},Bo=(i,e)=>uA(i,e)[0],At=(i,e)=>!i||!e?!1:i!=null&&i.contains(e)?!0:At(i,e.getRootNode().host),mi=(i,e)=>{if(!i)return null;let t=i.closest(e);return t||mi(i.getRootNode().host,e)};function Xn(i=document){var e;let t=i==null?void 0:i.activeElement;return t?(e=Xn(t.shadowRoot))!=null?e:t:null}function Pr(i){var e;let t=(e=i==null?void 0:i.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function $o(i,{depth:e=3,checkOpacity:t=!0,checkVisibilityCSS:r=!0}={}){if(i.checkVisibility)return i.checkVisibility({checkOpacity:t,checkVisibilityCSS:r});let s=i;for(;s&&e>0;){let n=getComputedStyle(s);if(t&&n.opacity==="0"||r&&n.visibility==="hidden"||n.display==="none")return!1;s=s.parentElement,e--}return!0}function c0(i,e,t,r){let s=r.x-t.x,n=r.y-t.y,a=s*s+n*n;if(a===0)return 0;let o=((i-t.x)*s+(e-t.y)*n)/a;return Math.max(0,Math.min(1,o))}function Ce(i,e){let t=cA(i,r=>r===e);return t||Sc(i,e)}function cA(i,e){var t,r;let s;for(s of(t=i.querySelectorAll("style:not([media])"))!=null?t:[]){let n;try{n=(r=s.sheet)==null?void 0:r.cssRules}catch{continue}for(let a of n!=null?n:[])if(e(a.selectorText))return a}}function Sc(i,e){var t,r;let s=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=s==null?void 0:s[s.length-1];return n!=null&&n.sheet?(n==null||n.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(r=n.sheet.cssRules)==null?void 0:r[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function ve(i,e,t=Number.NaN){let r=i.getAttribute(e);return r!=null?+r:t}function ye(i,e,t){let r=+t;if(t==null||Number.isNaN(r)){i.hasAttribute(e)&&i.removeAttribute(e);return}ve(i,e,void 0)!==r&&i.setAttribute(e,`${r}`)}function ae(i,e){return i.hasAttribute(e)}function oe(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}ae(i,e)!=t&&i.toggleAttribute(e,t)}function ue(i,e,t=null){var r;return(r=i.getAttribute(e))!=null?r:t}function ce(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}let r=`${t}`;ue(i,e,void 0)!==r&&i.setAttribute(e,r)}var h0=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},dr=(i,e,t)=>(h0(i,e,"read from private field"),t?t.call(i):e.get(i)),hA=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ho=(i,e,t,r)=>(h0(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),wt,f0=F.createElement("template");f0.innerHTML=`
1
+ var Vg=i=>{throw TypeError(i)};var gc=(i,e,t)=>e.has(i)||Vg("Cannot "+t);var Se=(i,e,t)=>(gc(i,e,"read from private field"),t?t.call(i):e.get(i)),It=(i,e,t)=>e.has(i)?Vg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Bt=(i,e,t,r)=>(gc(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),ze=(i,e,t)=>(gc(i,e,"access private method"),t);var Gs=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends Gs{}globalThis.DocumentFragment=i}var qn=class extends Gs{},vc=class extends Gs{},J_={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(qn)}},jn,Ec=class{constructor(e,t={}){It(this,jn);Bt(this,jn,t==null?void 0:t.detail)}get detail(){return Se(this,jn)}initCustomEvent(){}};jn=new WeakMap;function eA(i,e){return new qn}var Wg={document:{createElement:eA},DocumentFragment,customElements:J_,CustomEvent:Ec,EventTarget:Gs,HTMLElement:qn,HTMLVideoElement:vc},Yg=typeof window=="undefined"||typeof globalThis.customElements=="undefined",kt=Yg?Wg:globalThis,Ks=Yg?Wg.document:globalThis.document;var $={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},pe={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},bc={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_WIDTH:"mediaWidth"},qg=Object.entries(bc),y=qg.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),tA={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},Ki=qg.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...tA}),IC=Object.entries(Ki).reduce((i,[e,t])=>{let r=y[e];return r&&(i[t]=r),i},{userinactivechange:"userinactive"}),jg=Object.entries(y).reduce((i,[e,t])=>{let r=Ki[e];return r&&(i[t]=r),i},{userinactive:"userinactivechange"}),Lt={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},lr={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var yc={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},$t={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Zt={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var zg={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};function Xg(i){return i==null?void 0:i.map(rA).join(" ")}function Qg(i){return i==null?void 0:i.split(/\s+/).map(sA)}function rA(i){if(i){let{id:e,width:t,height:r}=i;return[e,t,r].filter(s=>s!=null).join(":")}}function sA(i){if(i){let[e,t,r]=i.split(":");return{id:e,width:+t,height:+r}}}function Zg(i){return i==null?void 0:i.map(nA).join(" ")}function Jg(i){return i==null?void 0:i.split(/\s+/).map(aA)}function nA(i){if(i){let{id:e,kind:t,language:r,label:s}=i;return[e,t,r,s].filter(n=>n!=null).join(":")}}function aA(i){if(i){let[e,t,r,s]=i.split(":");return{id:e,kind:t,language:r,label:s}}}function e0(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Vs(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function Co(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}var Mo=i=>new Promise(e=>setTimeout(e,i));var t0=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],oA=(i,e)=>{let t=i===1?t0[e].singular:t0[e].plural;return`${i} ${t}`},Mr=i=>{if(!Vs(i))return"";let e=Math.abs(i),t=e!==i,r=new Date(0,0,0,0,0,e,0);return`${[r.getHours(),r.getMinutes(),r.getSeconds()].map((o,l)=>o&&oA(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function fi(i,e){let t=!1;i<0&&(t=!0,i=0-i),i=i<0?0:i;let r=Math.floor(i%60),s=Math.floor(i/60%60),n=Math.floor(i/3600),a=Math.floor(e/60%60),o=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=s=r="0"),n=n>0||o>0?n+":":"",s=((n||a>=10)&&s<10?"0"+s:s)+":",r=r<10?"0"+r:r,(t?"-":"")+n+s+r}var wC=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});var Tc={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute",live:"live","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var i0,dA={en:Tc},r0=((i0=globalThis.navigator)==null?void 0:i0.language.split("-")[0])||"en",s0=i=>{r0=i};var H=(i,e={})=>{var t;return(((t=dA[r0])==null?void 0:t[i])||Tc[i]).replace(/\{(\w+)\}/g,(s,n)=>e[n]!==void 0?String(e[n]):`{${n}}`)};var Po=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},Oo=class extends Po{},No=class extends Oo{constructor(){super(...arguments),this.role=null}},_c=class{observe(){}unobserve(){}disconnect(){}},n0={createElement:function(){return new zn.HTMLElement},createElementNS:function(){return new zn.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},zn={ResizeObserver:_c,document:n0,Node:Oo,Element:No,HTMLElement:class extends No{constructor(){super(...arguments),this.innerHTML=""}get content(){return new zn.DocumentFragment}},DocumentFragment:class extends Po{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(i){return null},setItem(i,e){},removeItem(i){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(i){return{matches:!1,media:i}}},a0=typeof window=="undefined"||typeof window.customElements=="undefined",o0=Object.keys(zn).every(i=>i in globalThis),x=a0&&!o0?zn:globalThis,F=a0&&!o0?n0:globalThis.document;var l0=new WeakMap,Ac=i=>{let e=l0.get(i);return e||l0.set(i,e=new Set),e},d0=new x.ResizeObserver(i=>{for(let e of i)for(let t of Ac(e.target))t(e)});function Vi(i,e){Ac(i).add(e),d0.observe(i)}function Wi(i,e){let t=Ac(i);t.delete(e),t.size||d0.unobserve(i)}function u0(i){let e={};for(let t of i)e[t.name]=t.value;return e}function Ke(i){var e;return(e=Uo(i))!=null?e:mi(i,"media-controller")}function Uo(i){var e;let{MEDIA_CONTROLLER:t}=pe,r=i.getAttribute(t);if(r)return(e=Pr(i))==null?void 0:e.getElementById(r)}var Fo=(i,e,t=".value")=>{let r=i.querySelector(t);r&&(r.textContent=e)},uA=(i,e)=>{let t=`slot[name="${e}"]`,r=i.shadowRoot.querySelector(t);return r?r.children:[]},Bo=(i,e)=>uA(i,e)[0],At=(i,e)=>!i||!e?!1:i!=null&&i.contains(e)?!0:At(i,e.getRootNode().host),mi=(i,e)=>{if(!i)return null;let t=i.closest(e);return t||mi(i.getRootNode().host,e)};function Xn(i=document){var e;let t=i==null?void 0:i.activeElement;return t?(e=Xn(t.shadowRoot))!=null?e:t:null}function Pr(i){var e;let t=(e=i==null?void 0:i.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function $o(i,{depth:e=3,checkOpacity:t=!0,checkVisibilityCSS:r=!0}={}){if(i.checkVisibility)return i.checkVisibility({checkOpacity:t,checkVisibilityCSS:r});let s=i;for(;s&&e>0;){let n=getComputedStyle(s);if(t&&n.opacity==="0"||r&&n.visibility==="hidden"||n.display==="none")return!1;s=s.parentElement,e--}return!0}function c0(i,e,t,r){let s=r.x-t.x,n=r.y-t.y,a=s*s+n*n;if(a===0)return 0;let o=((i-t.x)*s+(e-t.y)*n)/a;return Math.max(0,Math.min(1,o))}function Ce(i,e){let t=cA(i,r=>r===e);return t||Sc(i,e)}function cA(i,e){var t,r;let s;for(s of(t=i.querySelectorAll("style:not([media])"))!=null?t:[]){let n;try{n=(r=s.sheet)==null?void 0:r.cssRules}catch{continue}for(let a of n!=null?n:[])if(e(a.selectorText))return a}}function Sc(i,e){var t,r;let s=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=s==null?void 0:s[s.length-1];return n!=null&&n.sheet?(n==null||n.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(r=n.sheet.cssRules)==null?void 0:r[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function ve(i,e,t=Number.NaN){let r=i.getAttribute(e);return r!=null?+r:t}function ye(i,e,t){let r=+t;if(t==null||Number.isNaN(r)){i.hasAttribute(e)&&i.removeAttribute(e);return}ve(i,e,void 0)!==r&&i.setAttribute(e,`${r}`)}function ae(i,e){return i.hasAttribute(e)}function oe(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}ae(i,e)!=t&&i.toggleAttribute(e,t)}function ue(i,e,t=null){var r;return(r=i.getAttribute(e))!=null?r:t}function ce(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}let r=`${t}`;ue(i,e,void 0)!==r&&i.setAttribute(e,r)}var h0=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},dr=(i,e,t)=>(h0(i,e,"read from private field"),t?t.call(i):e.get(i)),hA=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ho=(i,e,t,r)=>(h0(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),wt,f0=F.createElement("template");f0.innerHTML=`
2
2
  <style>
3
3
  :host {
4
4
  display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));
@@ -1277,7 +1277,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1277
1277
  `),d=[],u=e?tk(e.baseTime,e.timescale):0,c="00:00.000",h=0,f=0,m,p=!0;o.oncue=function(g){let E=t[r],b=t.ccOffset,T=(h-u)/9e4;if(E!=null&&E.new&&(f!==void 0?b=t.ccOffset=E.start:Tk(t,r,T)),T){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}b=T-t.presentationOffset}let _=g.endTime-g.startTime,A=Yt((g.startTime+b-f)*9e4,s*9e4)/9e4;g.startTime=Math.max(A,0),g.endTime=Math.max(A+_,0);let R=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(R)),g.id||(g.id=Bm(g.startTime,g.endTime,R)),g.endTime>0&&d.push(g)},o.onparsingerror=function(g){m=g},o.onflush=function(){if(m){a(m);return}n(d)},l.forEach(g=>{if(p)if(ff(g,"X-TIMESTAMP-MAP=")){p=!1,g.slice(16).split(",").forEach(E=>{ff(E,"LOCAL:")?c=E.slice(6):ff(E,"MPEGTS:")&&(h=parseInt(E.slice(7)))});try{f=yk(c)/1e3}catch(E){m=E}return}else g===""&&(p=!1);o.parse(g+`
1278
1278
  `)}),o.flush()}var pf="stpp.ttml.im1t",fy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,my=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ak={left:"start",center:"center",right:"end",start:"start",end:"end"};function fb(i,e,t,r){let s=fe(new Uint8Array(i),["mdat"]);if(s.length===0){r(new Error("Could not parse IMSC1 mdat"));return}let n=s.map(o=>Di(o)),a=ek(e.baseTime,1,e.timescale);try{n.forEach(o=>t(Sk(o,a)))}catch(o){r(o)}}function Sk(i,e){let s=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");let n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((c,h)=>(c[h]=s.getAttribute(`ttp:${h}`)||n[h],c),{}),o=s.getAttribute("xml:space")!=="preserve",l=mb(gf(s,"styling","style")),d=mb(gf(s,"layout","region")),u=gf(s,"body","[begin]");return[].map.call(u,c=>{let h=py(c,o);if(!h||!c.hasAttribute("begin"))return null;let f=Ef(c.getAttribute("begin"),a),m=Ef(c.getAttribute("dur"),a),p=Ef(c.getAttribute("end"),a);if(f===null)throw pb(c);if(p===null){if(m===null)throw pb(c);p=f+m}let g=new Fm(f-e,p-e,h);g.id=Bm(g.startTime,g.endTime,g.text);let E=d[c.getAttribute("region")],b=l[c.getAttribute("style")],T=xk(E,b,l),{textAlign:_}=T;if(_){let A=Ak[_];A&&(g.lineAlign=A),g.align=_}return et(g,T),g}).filter(c=>c!==null)}function gf(i,e,t){let r=i.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(t)):[]}function mb(i){return i.reduce((e,t)=>{let r=t.getAttribute("xml:id");return r&&(e[r]=t),e},{})}function py(i,e){return[].slice.call(i.childNodes).reduce((t,r,s)=>{var n;return r.nodeName==="br"&&s?t+`
1279
1279
  `:(n=r.childNodes)!=null&&n.length?py(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}function xk(i,e,t){let r="http://www.w3.org/ns/ttml#styling",s=null,n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(s=t[a]),n.reduce((o,l)=>{let d=vf(e,r,l)||vf(i,r,l)||vf(s,r,l);return d&&(o[l]=d),o},{})}function vf(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function pb(i){return new Error(`Could not parse ttml timestamp ${i}`)}function Ef(i,e){if(!i)return null;let t=uy(i);return t===null&&(fy.test(i)?t=Rk(i,e):my.test(i)&&(t=Ik(i,e))),t}function Rk(i,e){let t=fy.exec(i),r=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+r/e.frameRate}function Ik(i,e){let t=my.exec(i),r=Number(t[1]);switch(t[2]){case"h":return r*3600;case"m":return r*60;case"ms":return r*1e3;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}var pm=class{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=vb(),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(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(v.FRAG_LOADING,this.onFragLoading,this),e.on(v.FRAG_LOADED,this.onFragLoaded,this),e.on(v.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(v.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(v.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(v.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(v.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(v.FRAG_LOADING,this.onFragLoading,this),e.off(v.FRAG_LOADED,this.onFragLoaded,this),e.off(v.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(v.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(v.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(v.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(v.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)){let e=new _n(this,"textTrack1"),t=new _n(this,"textTrack2"),r=new _n(this,"textTrack3"),s=new _n(this,"textTrack4");this.cea608Parser1=new Kd(1,e,t),this.cea608Parser2=new Kd(3,r,s)}}addCues(e,t,r,s,n){let a=!1;for(let o=n.length;o--;){let l=n[o],d=kk(l[0],l[1],t,r);if(d>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],r),a=!0,d/(r-t)>.5))return}if(a||n.push([t,r]),this.config.renderTextTracksNatively){let o=this.captionsTracks[e];this.Cues.newCue(o,t,r,s)}else{let o=this.Cues.newCue(null,t,r,s);this.hls.trigger(v.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:r,initPTS:s,timescale:n}){let{unparsedVttFrags:a}=this;r==="main"&&(this.initPTS[t.cc]={baseTime:s,timescale:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(o=>{this.onFragLoaded(v.FRAG_LOADED,o)}))}getExistingTrack(e,t){let{media:r}=this;if(r)for(let s=0;s<r.textTracks.length;s++){let n=r.textTracks[s];if(gb(n,{name:e,lang:t,attrs:{}}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:r,media:s}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(n,a);if(o)r[e]=o,Tn(r[e]),Fb(r[e],s);else{let l=this.createTextTrack("captions",n,a);l&&(l[e]=!0,r[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let r=t.label,s={_id:e,label:r,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(v.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,r){let s=this.media;if(s)return s.addTextTrack(e,t,r)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){let{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Tn(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=vb(),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(){let{media:e}=this;if(!e)return;let t=e.textTracks;if(t)for(let r=0;r<t.length;r++)Tn(t[r])}onSubtitleTracksUpdated(e,t){let r=t.subtitleTracks||[],s=r.some(n=>n.textCodec===pf);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(ly(this.tracks,r)){this.tracks=r;return}if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){let a=this.media,o=a?md(a.textTracks):null;if(this.tracks.forEach((l,d)=>{let u;if(o){let c=null;for(let h=0;h<o.length;h++)if(o[h]&&gb(o[h],l)){c=o[h],o[h]=null;break}c&&(u=c)}if(u)Tn(u);else{let c=gy(l);u=this.createTextTrack(c,l.name,l.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),o!=null&&o.length){let l=o.filter(d=>d!==null).map(d=>d.label);l.length&&k.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){let a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(v.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(r=>{let s=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(!s)return;let n=`textTrack${s[1]}`,a=this.captionsProperties[n];a&&(a.label=r.name,r.lang&&(a.languageCode=r.lang),a.media=r)})}closedCaptionsForLevel(e){let t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===se.MAIN){var r,s;let{cea608Parser1:n,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:d}=t.frag,u=(r=(s=t.part)==null?void 0:s.index)!=null?r:-1;n&&a&&(d!==o+1||d===o&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=d,this.lastPartIndex=u}}onFragLoaded(e,t){let{frag:r,payload:s}=t;if(r.type===se.SUBTITLE)if(s.byteLength){let n=r.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){let o=this.tracks[r.level],l=this.vttCCs;l[r.cc]||(l[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),o&&o.textCodec===pf?this._parseIMSC1(r,s):this._parseVTTs(t)}}else this.hls.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){let r=this.hls;fb(t,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),r.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{k.log(`Failed to parse IMSC1: ${s}`),r.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var t;let{frag:r,payload:s}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[r.cc]&&o===-1){a.push(e);return}let l=this.hls,d=(t=r.initSegment)!=null&&t.data?qt(r.initSegment.data,new Uint8Array(s)):s;_k(d,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,u=>{this._appendCues(u,r.level),l.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},u=>{let c=u.message==="Missing initPTS for VTT MPEGTS";c?a.push(e):this._fallbackToIMSC1(r,s),k.log(`Failed to parse VTT cue: ${u}`),!(c&&o>r.cc)&&l.trigger(v.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:u})})}_fallbackToIMSC1(e,t){let r=this.tracks[e.level];r.textCodec||fb(t,this.initPTS[e.cc],()=>{r.textCodec=pf,this._parseIMSC1(e,t)},()=>{r.textCodec="wvtt"})}_appendCues(e,t){let r=this.hls;if(this.config.renderTextTracksNatively){let s=this.textTracks[t];if(!s||s.mode==="disabled")return;e.forEach(n=>Bb(s,n))}else{let s=this.tracks[t];if(!s)return;let n=s.default?"default":"subtitles"+t;r.trigger(v.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){let{frag:r}=t;r.type===se.SUBTITLE&&this.onFragLoaded(v.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();let{cea608Parser1:r,cea608Parser2:s}=this;if(!this.enabled||!r||!s)return;let{frag:n,samples:a}=t;if(!(n.type===se.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let o=0;o<a.length;o++){let l=a[o].bytes;if(l){let d=this.extractCea608Data(l);r.addData(a[o].pts,d[0]),s.addData(a[o].pts,d[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:r,endOffsetSubtitles:s,type:n}){let{media:a}=this;if(!(!a||a.currentTime<r)){if(!n||n==="video"){let{captionsTracks:o}=this;Object.keys(o).forEach(l=>Rf(o[l],t,r))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){let{textTracks:o}=this;Object.keys(o).forEach(l=>Rf(o[l],t,s))}}}extractCea608Data(e){let t=[[],[]],r=e[0]&31,s=2;for(let n=0;n<r;n++){let a=e[s++],o=127&e[s++],l=127&e[s++];if(o===0&&l===0)continue;if((4&a)!==0){let u=3&a;(u===0||u===1)&&(t[u].push(o),t[u].push(l))}}return t}};function gy(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function gb(i,e){return!!i&&i.kind===gy(e)&&tm(e,i)}function kk(i,e,t,r){return Math.min(e,r)-Math.max(i,t)}function vb(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}var gm=class i{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(){let{hls:e}=this;e.on(v.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.BUFFER_CODECS,this.onBufferCodecs,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){let{hls:e}=this;e.off(v.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.BUFFER_CODECS,this.onBufferCodecs,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){let r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.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){let r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&z(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}let e=this.hls.levels;if(e.length){let t=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&k.log(`Setting autoLevelCapping to ${r}: ${e[r].height}p@${e[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=r,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){let t=this.hls.levels;if(!t.length)return-1;let r=t.filter((s,n)=>this.isLevelAllowed(s)&&n<=e);return this.clientRect=null,i.getMaxLevelByMediaSize(r,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;let e=this.media,t={width:0,height:0};if(e){let r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,!t.width&&!t.height&&(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.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(r=>e.bitrate===r.bitrate&&e.width===r.width&&e.height===r.height)}static getMaxLevelByMediaSize(e,t,r){if(!(e!=null&&e.length))return-1;let s=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0,n=e.length-1,a=Math.max(t,r);for(let o=0;o<e.length;o+=1){let l=e[o];if((l.width>=a||l.height>=a)&&s(l,e[o+1])){n=o;break}}return n}},vm=class{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(v.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(v.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let r=this.hls.config;if(r.capLevelOnFPSDrop){let s=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,r){let s=performance.now();if(t){if(this.lastTime){let n=s-this.lastTime,a=r-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,d=this.hls;if(d.trigger(v.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:r}),l>0&&a>d.config.fpsDroppedMonitoringThreshold*o){let u=d.currentLevel;k.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=u)&&(u=u-1,d.trigger(v.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:d.currentLevel}),d.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},hd="[eme]",Vd=class i{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=i.CDMCleanupPromise?[i.CDMCleanupPromise]:[],this.debug=k.debug.bind(k,hd),this.log=k.log.bind(k,hd),this.warn=k.warn.bind(k,hd),this.error=k.error.bind(k,hd),this.onMediaEncrypted=t=>{let{initDataType:r,initData:s}=t,n=`"${t.type}" event: init data type: "${r}"`;if(this.debug(n),s!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=rd(this.config));let o=a.map(ef).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{let o=Zh(a),l,d;if(r==="sinf"){if(o!==Ie.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${r}" for selected key-system ${o}`);return}let m=rt(new Uint8Array(s));try{let p=wm(JSON.parse(m).sinf),g=Mb(p);if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=g.subarray(8,24),d=Ie.FAIRPLAY}catch(p){this.warn(`${n} Failed to parse sinf: ${p}`);return}}else{if(o!==Ie.WIDEVINE&&o!==Ie.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${r}" for selected key-system ${o}`);return}let m=GR(s),p=m.filter(E=>!!E.systemId&&Jh(E.systemId)===o);p.length>1&&this.warn(`${n} Using first of ${p.length} pssh found for selected key-system ${o}`);let g=p[0];if(!g){m.length===0||m.some(E=>!E.systemId)?this.warn(`${n} contains incomplete or invalid pssh data`):this.log(`ignoring ${n} for ${m.map(E=>Jh(E.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(d=Jh(g.systemId),g.version===0&&g.data)if(d===Ie.WIDEVINE){let E=g.data.length-22;l=g.data.subarray(E,E+16)}else d===Ie.PLAYREADY&&(l=xb(g.data))}if(!d||!l){this.log(`Unable to handle ${n} with key-system ${o}`);return}let u=ki.hexDump(l),{keyIdToKeySessionPromise:c,mediaKeySessions:h}=this,f=c[u];for(let m=0;m<h.length;m++){let p=h[m],g=p.decryptdata;if(!g.keyId)continue;let E=ki.hexDump(g.keyId);if(u===E||g.uri.replace(/-/g,"").indexOf(u)!==-1){if(f=c[E],g.pssh)break;delete c[E],g.pssh=new Uint8Array(s),g.keyId=l,f=c[u]=f.then(()=>this.generateRequestWithPreferredKeySession(p,r,s,"encrypted-event-key-match")),f.catch(b=>this.handleError(b));break}}if(!f){if(d!==o){this.log(`Ignoring "${n}" with ${d} init data for selected key-system ${o}`);return}f=c[u]=this.getKeySystemSelectionPromise([d]).then(({keySystem:m,mediaKeys:p})=>{var g;this.throwIfDestroyed();let E=new Da("ISO-23001-7",u,(g=ef(m))!=null?g:"");return E.pssh=new Uint8Array(s),E.keyId=l,this.attemptSetMediaKeys(m,p).then(()=>{this.throwIfDestroyed();let b=this.createMediaKeySessionContext({decryptdata:E,keySystem:m,mediaKeys:p});return this.generateRequestWithPreferredKeySession(b,r,s,"encrypted-event-no-match")})}),f.catch(m=>this.handleError(m))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();let e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(v.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(v.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(v.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(v.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(v.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(v.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){let{drmSystems:t,widevineLicenseUrl:r}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===Ie.WIDEVINE&&r)return r}getLicenseServerUrlOrThrow(e){let t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){let{drmSystems:t}=this.config,r=t[e];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){let t=this.hls.levels,r=(a,o,l)=>!!a&&l.indexOf(a)===o,s=t.map(a=>a.audioCodec).filter(r),n=t.map(a=>a.videoCodec).filter(r);return s.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{let l=d=>{let u=d.shift();this.getMediaKeysPromise(u,s,n).then(c=>a({keySystem:u,mediaKeys:c})).catch(c=>{d.length?l(d):c instanceof Mt?o(c):o(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_ACCESS,error:c,fatal:!0},c.message))})};l(e)})}requestMediaKeySystemAccess(e,t){let{requestMediaKeySystemAccessFunc:r}=this.config;if(typeof r!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${r}`;return Sb===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return r(e,t)}getMediaKeysPromise(e,t,r){let s=vR(e,t,r,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e],a=n==null?void 0:n.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),a=this.requestMediaKeySystemAccess(e,s);let o=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),a.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);let d=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=l.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),d.then(c=>c?this.setMediaKeysServerCertificate(u,e,c):u))),o.mediaKeys.catch(u=>{this.error(`Failed to create media-keys for "${e}"}: ${u}`)}),o.mediaKeys})}return a.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:r}){this.log(`Creating key-system session "${t}" keyId: ${ki.hexDump(e.keyId||[])}`);let s=r.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:r,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){let t=e.decryptdata;if(t.pssh){let r=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(r,n,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 ki.hexDump(e.keyId)}updateKeySession(e,t){var r;let s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${ki.hexDump(((r=e.decryptdata)==null?void 0:r.keyId)||[])}
1280
- } (data length: ${t&&t.byteLength})`),s.update(t)}selectKeySystemFormat(e){let 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,r)=>{let s=rd(this.config),n=e.map(Zh).filter(a=>!!a&&s.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{let o=ef(a);o?t(o):r(new Error(`Unable to find format for key-system "${a}"`))}).catch(r)})}loadKey(e){let t=e.keyInfo.decryptdata,r=this.getKeyIdString(t),s=`(keyId: ${r} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let n=this.keyIdToKeySessionPromise[r];return n||(n=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(a,o).then(()=>{this.throwIfDestroyed();let l=this.createMediaKeySessionContext({keySystem:a,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),n.catch(a=>this.handleError(a))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Mt?this.hls.trigger(v.ERROR,e.data):this.hls.trigger(v.ERROR,{type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){let t=this.getKeyIdString(e),r=this.keyIdToKeySessionPromise[t];if(!r){let s=Zh(e.keyFormat),n=s?[s]:rd(this.config);return this.attemptKeySystemAccess(n)}return r}getKeySystemSelectionPromise(e){if(e.length||(e=rd(this.config)),e.length===0)throw new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){let r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let s=Promise.all(r).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>r.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,r,s){var n,a;let o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{let m=o.call(this.hls,t,r,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,r=e.decryptdata.pssh=m.initData?new Uint8Array(m.initData):null}catch(m){var l;if(this.warn(m.message),(l=this.hls)!=null&&l.config.debug)throw m}if(r===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);let d=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${d} (init data type: ${t} length: ${r?r.byteLength:null})`);let u=new Um,c=e._onmessage=m=>{let p=e.mediaKeysSession;if(!p){u.emit("error",new Error("invalid state"));return}let{messageType:g,message:E}=m;this.log(`"${g}" message event for session "${p.sessionId}" message size: ${E.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,E).catch(b=>{this.handleError(b),u.emit("error",b)}):g==="license-release"?e.keySystem===Ie.FAIRPLAY&&(this.updateKeySession(e,Af("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},h=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);let g=e.keyStatus;u.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${d}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",c),e.mediaKeysSession.addEventListener("keystatuseschange",h);let f=new Promise((m,p)=>{u.on("error",p),u.on("keyStatus",g=>{g.startsWith("usable")?m():g==="output-restricted"?p(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?p(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?p(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,r).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${d}`)}).catch(m=>{throw new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>f).catch(m=>{throw u.removeAllListeners(),this.removeSession(e),m}).then(()=>(u.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,r)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ki.hexDump("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))} session keyId: ${ki.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){let t=this.config,r=t.loader,s=new r(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{let l={responseType:"arraybuffer",url:n},d=t.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{a(h.data)},onError:(h,f,m,p)=>{o(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:mt({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,m)=>{o(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(h,f,m)=>{o(new Error("aborted"))}};s.load(l,u,c)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,r){return new Promise((s,n)=>{e.setServerCertificate(r).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${r==null?void 0:r.byteLength}) on "${t}"`),s(e)}).catch(a=>{n(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(r=>this.updateKeySession(e,new Uint8Array(r)).catch(s=>{throw new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:s,fatal:!0},s.message)}))}unpackPlayReadyKeyMessage(e,t){let r=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;let s=new DOMParser().parseFromString(r,"application/xml"),n=s.querySelectorAll("HttpHeader");if(n.length>0){let u;for(let c=0,h=n.length;c<h;c++){var a,o;u=n[c];let f=(a=u.querySelector("name"))==null?void 0:a.textContent,m=(o=u.querySelector("value"))==null?void 0:o.textContent;f&&m&&e.setRequestHeader(f,m)}}let l=s.querySelector("Challenge"),d=l==null?void 0:l.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Af(atob(d))}setupLicenseXHR(e,t,r,s){let n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!r.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,r,s)}).catch(a=>{if(!r.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,r,s)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||s})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){let r=this.config.keyLoadPolicy.default;return new Promise((s,n)=>{let a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);let o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);let d=this.config.licenseResponseCallback;if(d)try{l=d.call(this.hls,o,a,e)}catch(u){this.error(u)}s(l)}else{let l=r.errorRetry,d=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||o.status>=400&&o.status<500)n(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{let u=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(s,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:d})=>{e.keySystem==Ie.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(l,d)),l.send(d)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let r=t.media;this.media=r,r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){let 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={},Da.clearKeyUriToKeyIdMap();let r=t.length;i.CDMCleanupPromise=Promise.all(t.map(s=>this.removeSession(s)).concat(e==null?void 0:e.setMediaKeys(null).catch(s=>{this.log(`Could not clear media keys: ${s}`)}))).then(()=>{r&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){let r=t.reduce((s,n)=>(s.indexOf(n.keyFormat)===-1&&s.push(n.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:r}=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),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}};Vd.CDMCleanupPromise=void 0;var Mt=class 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}},yt;(function(i){i.MANIFEST="m",i.AUDIO="a",i.VIDEO="v",i.MUXED="av",i.INIT="i",i.CAPTION="c",i.TIMED_TEXT="tt",i.KEY="k",i.OTHER="o"})(yt||(yt={}));var Em;(function(i){i.DASH="d",i.HLS="h",i.SMOOTH="s",i.OTHER="o"})(Em||(Em={}));var ns;(function(i){i.OBJECT="CMCD-Object",i.REQUEST="CMCD-Request",i.SESSION="CMCD-Session",i.STATUS="CMCD-Status"})(ns||(ns={}));var Lk={[ns.OBJECT]:["br","d","ot","tb"],[ns.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[ns.SESSION]:["cid","pr","sf","sid","st","v"],[ns.STATUS]:["bs","rtp"]},Ba=class i{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(r=>r instanceof i?r:new i(r))),this.value=e,this.params=t}},Wd=class{constructor(e){this.description=void 0,this.description=e}},wk="Dict";function Dk(i){return Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":typeof i=="object"?JSON.stringify(i):String(i)}function Ck(i,e,t,r){return new Error(`failed to ${i} "${Dk(e)}" as ${t}`,{cause:r})}var Eb="Bare Item",Mk="Boolean",Pk="Byte Sequence",Ok="Decimal",Nk="Integer";function Uk(i){return i<-999999999999999||999999999999999<i}var Fk=/[\x00-\x1f\x7f]+/,Bk="Token",$k="Key";function Ci(i,e,t){return Ck("serialize",i,e,t)}function Hk(i){if(typeof i!="boolean")throw Ci(i,Mk);return i?"?1":"?0"}function Gk(i){return btoa(String.fromCharCode(...i))}function Kk(i){if(ArrayBuffer.isView(i)===!1)throw Ci(i,Pk);return`:${Gk(i)}:`}function vy(i){if(Uk(i))throw Ci(i,Nk);return i.toString()}function Vk(i){return`@${vy(i.getTime()/1e3)}`}function Ey(i,e){if(i<0)return-Ey(-i,e);let t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){let s=Math.floor(i*t);return(s%2===0?s:s+1)/t}else return Math.round(i*t)/t}function Wk(i){let e=Ey(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ci(i,Ok);let t=e.toString();return t.includes(".")?t:`${t}.0`}var Yk="String";function qk(i){if(Fk.test(i))throw Ci(i,Yk);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function jk(i){return i.description||i.toString().slice(7,-1)}function bb(i){let e=jk(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ci(e,Bk);return e}function bm(i){switch(typeof i){case"number":if(!z(i))throw Ci(i,Eb);return Number.isInteger(i)?vy(i):Wk(i);case"string":return qk(i);case"symbol":return bb(i);case"boolean":return Hk(i);case"object":if(i instanceof Date)return Vk(i);if(i instanceof Uint8Array)return Kk(i);if(i instanceof Wd)return bb(i);default:throw Ci(i,Eb)}}function ym(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw Ci(i,$k);return i}function $m(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${ym(e)}`:`;${ym(e)}=${bm(t)}`).join("")}function by(i){return i instanceof Ba?`${bm(i.value)}${$m(i.params)}`:bm(i)}function zk(i){return`(${i.value.map(by).join(" ")})${$m(i.params)}`}function Xk(i,e={whitespace:!0}){if(typeof i!="object")throw Ci(i,wk);let t=i instanceof Map?i.entries():Object.entries(i),r=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([s,n])=>{n instanceof Ba||(n=new Ba(n));let a=ym(s);return n.value===!0?a+=$m(n.params):(a+="=",Array.isArray(n.value)?a+=zk(n):a+=by(n)),a}).join(`,${r}`)}function Qk(i,e){return Xk(i,e)}var Zk=i=>i==="ot"||i==="sf"||i==="st",Jk=i=>typeof i=="number"?z(i):i!=null&&i!==""&&i!==!1;function eL(i,e){let t=new URL(i),r=new URL(e);if(t.origin!==r.origin)return i;let s=t.pathname.split("/").slice(1),n=r.pathname.split("/").slice(1,-1);for(;s[0]===n[0];)s.shift(),n.shift();for(;n.length;)n.shift(),s.unshift("..");return s.join("/")}function tL(){try{return crypto.randomUUID()}catch{try{let 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,s=>{let n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?n:n&3|8).toString(16)})}}}var bd=i=>Math.round(i),iL=(i,e)=>(e!=null&&e.baseUrl&&(i=eL(i,e.baseUrl)),encodeURIComponent(i)),fd=i=>bd(i/100)*100,rL={br:bd,d:bd,bl:fd,dl:fd,mtp:fd,nor:iL,rtp:fd,tb:bd};function sL(i,e){let t={};if(i==null||typeof i!="object")return t;let r=Object.keys(i).sort(),s=et({},rL,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return r.forEach(a=>{if(n!=null&&n(a))return;let o=i[a],l=s[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||Jk(o)&&(Zk(a)&&typeof o=="string"&&(o=new Wd(o)),t[a]=o))}),t}function yy(i,e={}){return i?Qk(sL(i,e),et({whitespace:!1},e)):""}function nL(i,e={}){if(!i)return{};let t=Object.entries(i),r=Object.entries(Lk).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=t.reduce((n,a)=>{var o,l;let[d,u]=a,c=((o=r.find(h=>h[1].includes(d)))==null?void 0:o[0])||ns.REQUEST;return(l=n[c])!=null||(n[c]={}),n[c][d]=u,n},{});return Object.entries(s).reduce((n,[a,o])=>(n[a]=yy(o,e),n),{})}function aL(i,e,t){return et(i,nL(e,t))}var oL="CMCD";function lL(i,e={}){if(!i)return"";let t=yy(i,e);return`${oL}=${encodeURIComponent(t)}`}var yb=/CMCD=[^&#]+/;function dL(i,e,t){let r=lL(e,t);if(!r)return i;if(yb.test(i))return i.replace(yb,r);let s=i.includes("?")?"&":"?";return`${i}${s}${r}`}var Tm=class{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=s=>{try{this.apply(s,{ot:yt.MANIFEST,su:!this.initialized})}catch(n){k.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=s=>{try{let n=s.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===yt.VIDEO||o===yt.AUDIO||o==yt.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(s,l)}catch(n){k.warn("Could not generate segment CMCD data.",n)}},this.hls=e;let t=this.config=e.config,{cmcd:r}=t;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||tL(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHED,this.onMediaDetached,this),e.on(v.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHED,this.onMediaDetached,this),e.off(v.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 r,s;this.audioBuffer=(r=t.tracks.audio)==null?void 0:r.buffer,this.videoBuffer=(s=t.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:Em.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){et(t,this.createData());let r=t.ot===yt.INIT||t.ot===yt.VIDEO||t.ot===yt.MUXED;this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);let{includeKeys:s}=this;s&&(t=Object.keys(t).reduce((n,a)=>(s.includes(a)&&(n[a]=t[a]),n),{})),this.useHeaders?(e.headers||(e.headers={}),aL(e.headers,t)):e.url=dL(e.url,t)}getObjectType(e){let{type:t}=e;if(t==="subtitle")return yt.TIMED_TEXT;if(e.sn==="initSegment")return yt.INIT;if(t==="audio")return yt.AUDIO;if(t==="main")return this.hls.audioTracks.length?yt.VIDEO:yt.MUXED}getTopBandwidth(e){let t=0,r,s=this.hls;if(e===yt.AUDIO)r=s.audioTracks;else{let n=s.maxAutoLevel,a=n>-1?n+1:s.levels.length;r=s.levels.slice(0,a)}for(let n of r)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){let t=this.hls.media,r=e===yt.AUDIO?this.audioBuffer:this.videoBuffer;return!r||!t?NaN:Ge.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}},uL=3e5,_m=class{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=k.log.bind(k,"[content-steering]:"),this.registerListeners()}registerListeners(){let e=this.hls;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let 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){let t=this.levels;t&&(this.levels=t.filter(r=>r!==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){let{contentSteering:r}=t;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:r}=t;if((r==null?void 0:r.action)===ht.SendAlternateToPenaltyBox&&r.flags===oi.MoveAllAlternatesMatchingHost){let s=this.levels,n=this.pathwayPriority,a=this.pathwayId;if(t.context){let{groupId:o,pathwayId:l,type:d}=t.context;o&&s?a=this.getPathwayForGroupId(o,d,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&s&&(n=s.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),r.resolved=this.pathwayId!==a),r.resolved||k.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${s&&s.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){let r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),t=this.getLevelsForPathway(r),this.pathwayId=r}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,r=this.penalizedPathways,s=performance.now();Object.keys(r).forEach(n=>{s-r[n]>uL&&delete r[n]});for(let n=0;n<e.length;n++){let a=e[n];if(a in r)continue;if(a===this.pathwayId)return;let o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Kb(t),this.hls.trigger(v.LEVELS_UPDATED,{levels:t});let d=this.hls.levels[o];l&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,r){let s=this.getLevelsForPathway(r).concat(this.levels||[]);for(let n=0;n<s.length;n++)if(t===Ae.AUDIO_TRACK&&s[n].hasAudioGroup(e)||t===Ae.SUBTITLE_TRACK&&s[n].hasSubtitleGroup(e))return s[n].pathwayId;return r}clonePathways(e){let t=this.levels;if(!t)return;let r={},s={};e.forEach(n=>{let{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(u=>u.pathwayId===a))return;let d=this.getLevelsForPathway(o).map(u=>{let c=new Ye(u.attrs);c["PATHWAY-ID"]=a;let h=c.AUDIO&&`${c.AUDIO}_clone_${a}`,f=c.SUBTITLES&&`${c.SUBTITLES}_clone_${a}`;h&&(r[c.AUDIO]=h,c.AUDIO=h),f&&(s[c.SUBTITLES]=f,c.SUBTITLES=f);let m=Ty(u.uri,c["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),p=new br({attrs:c,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:m,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let g=1;g<u.audioGroups.length;g++)p.addGroupId("audio",`${u.audioGroups[g]}_clone_${a}`);if(u.subtitleGroups)for(let g=1;g<u.subtitleGroups.length;g++)p.addGroupId("text",`${u.subtitleGroups[g]}_clone_${a}`);return p});t.push(...d),Tb(this.audioTracks,r,l,a),Tb(this.subtitleTracks,s,l,a)})}loadSteeringManifest(e){let t=this.hls.config,r=t.loader;this.loader&&this.loader.destroy(),this.loader=new r(t);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){let u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+u)}let n={responseType:"json",url:s.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},d={onSuccess:(u,c,h,f)=>{this.log(`Loaded steering manifest: "${s}"`);let m=u.data;if(m.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;let{"RELOAD-URI":p,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":E}=m;if(p)try{this.uri=new self.URL(p,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||h.url),g&&this.clonePathways(g);let b={steeringManifest:m,url:s.toString()};this.hls.trigger(v.STEERING_MANIFEST_LOADED,b),E&&this.updatePathwayPriority(E)},onError:(u,c,h,f)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${c.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${c.url} no longer available`);return}let m=this.timeToLoad*1e3;if(u.code===429){let p=this.loader;if(typeof(p==null?void 0:p.getResponseHeader)=="function"){let g=p.getResponseHeader("Retry-After");g&&(m=parseFloat(g)*1e3)}this.log(`Steering manifest ${c.url} rate limited`);return}this.scheduleRefresh(this.uri||c.url,m)},onTimeout:(u,c,h)=>{this.log(`Timeout loading steering manifest (${c.url})`),this.scheduleRefresh(this.uri||c.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(n,l,d)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;let s=(r=this.hls)==null?void 0:r.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}};function Tb(i,e,t,r){i&&Object.keys(e).forEach(s=>{let n=i.filter(a=>a.groupId===s).map(a=>{let o=et({},a);return o.details=void 0,o.attrs=new Ye(o.attrs),o.url=o.attrs.URI=Ty(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[s],o.attrs["PATHWAY-ID"]=r,o});i.push(...n)})}function Ty(i,e,t,r){let{HOST:s,PARAMS:n,[t]:a}=r,o;e&&(o=a==null?void 0:a[e],o&&(i=o));let l=new self.URL(i);return s&&!o&&(l.host=s),n&&Object.keys(n).sort().forEach(d=>{d&&l.searchParams.set(d,n[d])}),l.href}var cL=/^age:\s*[\d.]+\s*$/im,Yd=class{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 Sn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let 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,r){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=r,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let r=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;let n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==r||this.stats.aborted))return n(r,t.url)}).catch(a=>{if(!(this.loader!==r||this.stats.aborted))return r.open("GET",t.url,!0),n(r,t.url)}).then(()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,t,e)}).catch(a=>{this.callbacks.onError({code:r.status,text:a.message},t,r,s)}):this.openAndSendXhr(r,t,e)}openAndSendXhr(e,t,r){e.readyState||e.open("GET",t.url,!0);let s=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=r.loadPolicy;if(s)for(let o in s)e.setRequestHeader(o,s[o]);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),r.timeout=n&&z(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:r}=this;if(!e||!t)return;let s=t.readyState,n=this.config;if(!r.aborted&&s>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let a=t.status,o=t.responseType==="text"?t.responseText:null;if(a>=200&&a<300){let c=o!=null?o:t.response;if(c!=null){r.loading.end=Math.max(self.performance.now(),r.loading.first);let h=t.responseType==="arraybuffer"?c.byteLength:c.length;if(r.loaded=r.total=h,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first),!this.callbacks)return;let f=this.callbacks.onProgress;if(f&&f(r,e,c,t),!this.callbacks)return;let m={url:t.responseURL,data:c,code:a};this.callbacks.onSuccess(m,r,e,t);return}}let l=n.loadPolicy.errorRetry,d=r.retry,u={url:e.url,data:void 0,code:a};wd(l,d,!1,u)?this.retry(l):(k.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,r))}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(wd(e,t,!0))this.retry(e);else{var r;k.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);let s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:r}=this;this.retryDelay=Mm(e,r.retry),r.retry++,k.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${r.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){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&cL.test(this.loader.getAllResponseHeaders())){let 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 hL(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var fL=/(\d+)-(\d+)\/(\d+)/,qd=class{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||vL,this.controller=new self.AbortController,this.stats=new Sn}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,r){let s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();let n=mL(e,this.controller.signal),a=r.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:d,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=d&&z(d)?d:u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},t.timeout),self.fetch(this.request).then(c=>{this.response=this.loader=c;let h=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},u-(h-s.loading.start)),!c.ok){let{status:f,statusText:m}=c;throw new Am(m||"fetch, bad network response",f,c)}return s.loading.first=h,s.total=gL(c.headers)||s.total,a&&z(t.highWaterMark)?this.loadProgressively(c,s,e,t.highWaterMark,a):o?c.arrayBuffer():e.responseType==="json"?c.json():c.text()}).then(c=>{let h=this.response;if(!h)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);let f=c[l];f&&(s.loaded=s.total=f);let m={url:h.url,data:c,code:h.status};a&&!z(t.highWaterMark)&&a(s,e,c,h),r.onSuccess(m,s,e,h)}).catch(c=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;let h=c&&c.code||0,f=c?c.message:null;r.onError({code:h,text:f},e,c?c.details:null,s)})}getCacheAge(){let e=null;if(this.response){let 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,r,s=0,n){let a=new Md,o=e.body.getReader(),l=()=>o.read().then(d=>{if(d.done)return a.dataLength&&n(t,r,a.flush(),e),Promise.resolve(new ArrayBuffer(0));let u=d.value,c=u.length;return t.loaded+=c,c<s||a.dataLength?(a.push(u),a.dataLength>=s&&n(t,r,a.flush(),e)):n(t,r,u,e),l()}).catch(()=>Promise.reject());return l()}};function mL(i,e){let t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(et({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function pL(i){let e=fL.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function gL(i){let e=i.get("Content-Range");if(e){let r=pL(e);if(z(r))return r}let t=i.get("Content-Length");if(t)return parseInt(t)}function vL(i,e){return new self.Request(i.url,e)}var Am=class extends Error{constructor(e,t,r){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=r}},EL=/\s/,bL={newCue(i,e,t,r){let s=[],n,a,o,l,d,u=self.VTTCue||self.TextTrackCue;for(let h=0;h<r.rows.length;h++)if(n=r.rows[h],o=!0,l=0,d="",!n.isEmpty()){var c;for(let p=0;p<n.chars.length;p++)EL.test(n.chars[p].uchar)&&o?l++:(d+=n.chars[p].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;let f=hy(d.trim()),m=Bm(e,t,f);i!=null&&(c=i.cues)!=null&&c.getCueById(m)||(a=new u(e,t,f),a.id=m,a.line=h+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),s.push(a))}return i&&s.length&&(s.sort((h,f)=>h.line==="auto"||f.line==="auto"?0:h.line>8&&f.line>8?f.line-h.line:h.line-f.line),s.forEach(h=>Bb(i,h))),s}},yL={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},_y=mt(mt({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:Yd,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Of,bufferController:om,capLevelController:gm,errorController:Mf,fpsController:vm,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:Sb,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:yL},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},TL()),{},{subtitleStreamController:rm,subtitleTrackController:nm,timelineController:pm,audioStreamController:em,audioTrackController:im,emeController:Vd,cmcdController:Tm,contentSteeringController:_m});function TL(){return{cueHandler:bL,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 _L(i,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"');let t=Sm(i),r=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(n=>{let a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];s.forEach(d=>{let u=`${n}Loading${d}`,c=e[u];if(c!==void 0&&o){l.push(u);let h=t[a].default;switch(e[a]={default:h},d){case"TimeOut":h.maxLoadTimeMs=c,h.maxTimeToFirstByteMs=c;break;case"MaxRetry":h.errorRetry.maxNumRetry=c,h.timeoutRetry.maxNumRetry=c;break;case"RetryDelay":h.errorRetry.retryDelayMs=c,h.timeoutRetry.retryDelayMs=c;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=c,h.timeoutRetry.maxRetryDelayMs=c;break}}}),l.length&&k.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(e[a])}`)}),mt(mt({},t),e)}function Sm(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Sm):Object.keys(i).reduce((e,t)=>(e[t]=Sm(i[t]),e),{}):i}function AL(i){let e=i.loader;e!==qd&&e!==Yd?(k.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):hL()&&(i.loader=qd,i.progressive=!0,i.enableSoftwareAES=!0,k.log("[config]: Progressive streaming enabled, using FetchLoader"))}var bf,xm=class extends Ma{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(){let{hls:e}=this;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this),e.on(v.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this),e.off(v.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){let r=this.hls.config.preferManagedMediaSource,s=[],n={},a={},o=!1,l=!1,d=!1;t.levels.forEach(u=>{var c,h;let f=u.attrs,{audioCodec:m,videoCodec:p}=u;((c=m)==null?void 0:c.indexOf("mp4a.40.34"))!==-1&&(bf||(bf=/chrome|firefox/i.test(navigator.userAgent)),bf&&(u.audioCodec=m=void 0)),m&&(u.audioCodec=m=Rd(m,r)),((h=p)==null?void 0:h.indexOf("avc1"))===0&&(p=u.videoCodec=XR(p));let{width:g,height:E,unknownCodecs:b}=u;if(o||(o=!!(g&&E)),l||(l=!!p),d||(d=!!m),b!=null&&b.length||m&&!nf(m,"audio",r)||p&&!nf(p,"video",r))return;let{CODECS:T,"FRAME-RATE":_,"HDCP-LEVEL":A,"PATHWAY-ID":R,RESOLUTION:S,"VIDEO-RANGE":D}=f,L=`${`${R||"."}-`}${u.bitrate}-${S}-${_}-${T}-${D}-${A}`;if(n[L])if(n[L].uri!==u.url&&!u.attrs["PATHWAY-ID"]){let P=a[L]+=1;u.attrs["PATHWAY-ID"]=new Array(P+1).join(".");let U=new br(u);n[L]=U,s.push(U)}else n[L].addGroupId("audio",f.AUDIO),n[L].addGroupId("text",f.SUBTITLES);else{let P=new br(u);n[L]=P,a[L]=1,s.push(P)}}),this.filterAndSortMediaOptions(s,t,o,l,d)}filterAndSortMediaOptions(e,t,r,s,n){let a=[],o=[],l=e;if((r||s)&&n&&(l=l.filter(({videoCodec:m,videoRange:p,width:g,height:E})=>(!!m||!!(g&&E))&&aI(p))),l.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)}`);let m=new Error("no level with compatible codecs found in manifest");this.hls.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:m,reason:m.message})}});return}if(t.audioTracks){let{preferManagedMediaSource:m}=this.hls.config;a=t.audioTracks.filter(p=>!p.audioCodec||nf(p.audioCodec,"audio",m)),_b(a)}t.subtitles&&(o=t.subtitles,_b(o));let d=l.slice(0);l.sort((m,p)=>{if(m.attrs["HDCP-LEVEL"]!==p.attrs["HDCP-LEVEL"])return(m.attrs["HDCP-LEVEL"]||"")>(p.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&m.height!==p.height)return m.height-p.height;if(m.frameRate!==p.frameRate)return m.frameRate-p.frameRate;if(m.videoRange!==p.videoRange)return Id.indexOf(m.videoRange)-Id.indexOf(p.videoRange);if(m.videoCodec!==p.videoCodec){let g=UE(m.videoCodec),E=UE(p.videoCodec);if(g!==E)return E-g}if(m.uri===p.uri&&m.codecSet!==p.codecSet){let g=xd(m.codecSet),E=xd(p.codecSet);if(g!==E)return E-g}return m.averageBitrate!==p.averageBitrate?m.averageBitrate-p.averageBitrate:0});let u=d[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==d.length)){for(let m=0;m<d.length;m++)if(d[m].pathwayId===l[0].pathwayId){u=d[m];break}}this._levels=l;for(let m=0;m<l.length;m++)if(l[m]===u){var c;this._firstLevel=m;let p=u.bitrate,g=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${p}`),((c=this.hls.userConfig)==null?void 0:c.abrEwmaDefaultEstimate)===void 0){let E=Math.min(p,this.hls.config.abrEwmaDefaultEstimateMax);E>g&&g===_y.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=E)}break}let h=n&&!s,f={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:s,altAudio:!h&&a.some(m=>!!m.url)};this.hls.trigger(v.MANIFEST_PARSED,f),(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){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let u=new Error("invalid level idx"),c=e<0;if(this.hls.trigger(v.ERROR,{type:le.OTHER_ERROR,details:C.LEVEL_SWITCH_ERROR,level:e,fatal:c,error:u,reason:u.message}),c)return;e=Math.min(e,t.length-1)}let r=this.currentLevelIndex,s=this.currentLevel,n=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,r===e&&a.details&&s&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${r}${n?" with Pathway "+n:""}`);let l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(v.LEVEL_SWITCHING,l);let d=a.details;if(!d||d.live){let u=this.switchParams(a.uri,s==null?void 0:s.details,d);this.loadPlaylist(u)}}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){let 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===Ae.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===se.MAIN){let r=t.elementaryStreams;if(!Object.keys(r).some(n=>!!r[n]))return;let s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var r;let{level:s,details:n}=t,a=this._levels[s];if(!a){var o;this.warn(`Invalid level index ${s}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}s===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(s,t,a.details)):(r=t.deliveryDirectives)!=null&&r.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();let t=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){let s=r.uri;if(e)try{s=e.addDirectives(s)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}let n=r.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${n?" Pathway "+n:""} ${s}`),this.clearTimer(),this.hls.trigger(v.LEVEL_LOADING,{url:s,level:t,pathwayId:r.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;let r=this._levels.filter((s,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(a=>a.level=-1)),!1));Kb(r),this._levels=r,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(v.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(v.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}};function _b(i){let e={};i.forEach(t=>{let r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++})}var Rm=class{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let r in this.keyUriToKeyInfo){let s=this.keyUriToKeyInfo[r].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.abort()}}}detach(){for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=C.KEY_LOAD_ERROR,r,s,n){return new di({type:le.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:r,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){let{sn:r,cc:s}=e;for(let n=0;n<t.length;n++){let a=t[n];if(s<=a.cc&&(r==="initSegment"||a.sn==="initSegment"||r<a.sn)){this.emeController.selectKeySystemFormat(a).then(o=>{a.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var r,s;t&&e.setKeyFormat(t);let n=e.decryptdata;if(!n){let d=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,C.KEY_LOAD_ERROR,d))}let a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((r=o)!=null&&r.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((s=o)!=null&&s.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(d=>(n.key=d.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){let r={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){let s=this.emeController.loadKey(r);if(s)return(e.keyLoadPromise=s.then(n=>(e.mediaKeySessionContext=n,r))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(r)}loadKeyHTTP(e,t){let r=this.config,s=r.loader,n=new s(r);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{let l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=r.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{let{frag:g,keyInfo:E,url:b}=m;if(!g.decryptdata||E!==this.keyUriToKeyInfo[b])return o(this.createKeyLoadError(g,C.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));E.decryptdata.key=g.decryptdata.key=new Uint8Array(h.data),g.keyLoader=null,E.loader=null,a({frag:g,keyInfo:E})},onError:(h,f,m,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),m,mt({url:l.url,data:void 0},h)))},onTimeout:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};n.load(l,u,c)})}resetLoader(e){let{frag:t,keyInfo:r,url:s}=e,n=r.loader;t.keyLoader===n&&(t.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[s],n&&n.destroy()}};function Ay(){return self.SourceBuffer||self.WebKitSourceBuffer}function Sy(){if(!ls())return!1;let e=Ay();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function SL(){if(!Sy())return!1;let i=ls();return typeof(i==null?void 0:i.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Ca(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Ca(e,"audio"))))}function xL(){var i;let e=Ay();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}var RL=250,yd=2,IL=.1,kL=.05,Im=class{constructor(e,t,r,s){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=r,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){let{config:r,media:s,stalled:n}=this;if(s===null)return;let{currentTime:a,seeking:o}=s,l=this.seeking&&!o,d=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),n!==null){if(this.stallReported){let g=self.performance.now()-n;k.warn(`playback not stuck anymore @${a}, after ${Math.round(g)}ms`),this.stallReported=!1}this.stalled=null}return}if(d||l){this.stalled=null;return}if(s.paused&&!o||s.ended||s.playbackRate===0||!Ge.getBuffered(s).length){this.nudgeRetry=0;return}let u=Ge.bufferInfo(s,a,0),c=u.nextStart||0;if(o){let g=u.len>yd,E=!c||t&&t.start<=a||c-a>yd&&!this.fragmentTracker.getPartialFragment(a);if(g||E)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(u.len>0)&&!c)return;let E=Math.max(c,u.start||0)-a,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=(b==null||(h=b.details)==null?void 0:h.live)?b.details.targetduration*2:yd,A=this.fragmentTracker.getPartialFragment(a);if(E>0&&(E<=_||A)){s.paused||this._trySkipBufferHole(A);return}}let f=self.performance.now();if(n===null){this.stalled=f;return}let m=f-n;if(!o&&m>=RL&&(this._reportStall(u),!this.media))return;let p=Ge.bufferInfo(s,a,r.maxBufferHole);this._tryFixBufferStall(p,m)}_tryFixBufferStall(e,t){let{config:r,fragmentTracker:s,media:n}=this;if(n===null)return;let a=n.currentTime,o=s.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>r.maxBufferHole||e.nextStart&&e.nextStart-a<r.maxBufferHole)&&t>r.highBufferWatchdogPeriod*1e3&&(k.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){let{hls:t,media:r,stallReported:s}=this;if(!s&&r){this.stallReported=!0;let n=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${JSON.stringify(e)})`);k.warn(n.message),t.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){let{config:t,hls:r,media:s}=this;if(s===null)return 0;let n=s.currentTime,a=Ge.bufferInfo(s,n,0),o=n<a.start?a.start:a.nextStart;if(o){let l=a.len<=t.maxBufferHole,d=a.len>0&&a.len<1&&s.readyState<3,u=o-n;if(u>0&&(l||d)){if(u>t.maxBufferHole){let{fragmentTracker:h}=this,f=!1;if(n===0){let m=h.getAppendedFrag(0,se.MAIN);m&&o<m.end&&(f=!0)}if(!f){let m=e||h.getAppendedFrag(n,se.MAIN);if(m){let p=!1,g=m.end;for(;g<o;){let E=h.getPartialFragment(g);if(E)g+=E.duration;else{p=!0;break}}if(p)return 0}}}let c=Math.max(o+kL,n+IL);if(k.warn(`skipping hole, adjusting currentTime from ${n} to ${c}`),this.moved=!0,this.stalled=null,s.currentTime=c,e&&!e.gap){let h=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${c}`);r.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return c}}return 0}_tryNudgeBuffer(){let{config:e,hls:t,media:r,nudgeRetry:s}=this;if(r===null)return;let n=r.currentTime;if(this.nudgeRetry++,s<e.nudgeMaxRetry){let a=n+(s+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);k.warn(o.message),r.currentTime=a,t.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{let a=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);k.error(a.message),t.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}},LL=100,km=class extends Na{constructor(e,t,r){super(e,t,r,"[stream-controller]",se.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(){let{hls:e}=this;e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.LEVEL_LOADING,this.onLevelLoading,this),e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(v.ERROR,this.onError,this),e.on(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(v.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(v.BUFFER_CREATED,this.onBufferCreated,this),e.on(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){let{hls:e}=this;e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(v.ERROR,this.onError,this),e.off(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(v.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(v.BUFFER_CREATED,this.onBufferCreated,this),e.off(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){let{lastCurrentTime:t,hls:r}=this;if(this.stopLoad(),this.setInterval(LL),this.level=-1,!this.startFragRequested){let s=r.startLevel;s===-1&&(r.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=r.firstAutoLevel),r.nextLoadLevel=s,this.level=r.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=O.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=O.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case O.WAITING_LEVEL:{let{levels:t,level:r}=this,s=t==null?void 0:t[r],n=s==null?void 0:s.details;if(n&&(!n.live||this.levelLastLoaded===s)){if(this.waitForCdnTuneIn(n))break;this.state=O.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=O.IDLE;break}break}case O.FRAG_LOADING_WAITING_RETRY:{var e;let t=self.performance.now(),r=this.retryDate;if(!r||t>=r||(e=this.media)!=null&&e.seeking){let{levels:s,level:n}=this,a=s==null?void 0:s[n];this.resetStartWhenNotLoaded(a||null),this.state=O.IDLE}}break}this.state===O.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:r,media:s}=this;if(t===null||!s&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(r!=null&&r[n]))return;let a=r[n],o=this.getMainFwdBufferInfo();if(o===null)return;let l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){let p={};this.altAudio&&(p.type="video"),this.hls.trigger(v.BUFFER_EOS,p),this.state=O.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;let d=a.details;if(!d||this.state===O.WAITING_LEVEL||d.live&&this.levelLastLoaded!==a){this.level=n,this.state=O.WAITING_LEVEL;return}let u=o.len,c=this.getMaxBufferLength(a.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);let h=this.backtrackFragment?this.backtrackFragment.start:o.end,f=this.getNextFragment(h,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&f.sn!=="initSegment"&&this.fragmentTracker.getState(f)!==ft.OK){var m;let g=((m=this.backtrackFragment)!=null?m:f).sn-d.startSN,E=d.fragments[g-1];E&&f.cc===E.cc&&(f=E,this.fragmentTracker.removeFragment(E))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,h)){if(!f.gap){let g=this.audioOnly&&!this.altAudio?De.AUDIO:De.VIDEO,E=(g===De.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;E&&this.afterBufferFlushed(E,g,se.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,se.MAIN,c)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,h))}loadFragment(e,t,r){let s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===ft.NOT_LOADED||s===ft.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,r)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,se.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let r,s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);let n=this.getLevelDetails();if(n!=null&&n.live){let o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){let o=this.hls.nextLoadLevel,l=e[o],d=this.fragLastKbps;d&&this.fragCurrent?r=this.fragCurrent.duration*l.maxBitrate/(1e3*d)+1:r=0}else r=0;let a=this.getBufferedFrag(t.currentTime+r);if(a){let o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();let l=o.maxStartPTS?o.maxStartPTS:o.start,d=o.duration,u=Math.max(a.end,l+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case O.KEY_LOADING:case O.FRAG_LOADING:case O.FRAG_LOADING_WAITING_RETRY:case O.PARSING:case O.PARSED:this.state=O.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let r=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new Im(this.config,r,this.fragmentTracker,this.hls)}onMediaDetaching(){let{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(){let e=this.media,t=e?e.currentTime:null;z(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);let r=this.getMainFwdBufferInfo();if(r===null||r.len===0){this.warn(`Main forward buffer length on "seeked" event ${r?r.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(v.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 r=!1,s=!1;t.levels.forEach(n=>{let a=n.audioCodec;a&&(r=r||a.indexOf("mp4a.40.2")!==-1,s=s||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=r&&s&&!xL(),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){let{levels:r}=this;if(!r||this.state!==O.IDLE)return;let s=r[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=O.WAITING_LEVEL)}onLevelLoaded(e,t){var r;let{levels:s}=this,n=t.level,a=t.details,o=a.totalduration;if(!s){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);let l=s[n],d=this.fragCurrent;d&&(this.state===O.FRAG_LOADING||this.state===O.FRAG_LOADING_WAITING_RETRY)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let u=0;if(a.live||(r=l.details)!=null&&r.live){var c;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;u=this.alignPlaylists(a,l.details,(c=this.levelLastLoaded)==null?void 0:c.details)}if(l.details=a,this.levelLastLoaded=l,this.hls.trigger(v.LEVEL_UPDATED,{details:a,level:n}),this.state===O.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=O.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,u),this.tick()}_handleFragmentLoadProgress(e){var t;let{frag:r,part:s,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}let o=a[r.level],l=o.details;if(!l){this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),this.fragmentTracker.removeFragment(r);return}let d=o.videoCodec,u=l.PTSKnown||!l.live,c=(t=r.initSegment)==null?void 0:t.data,h=this._getAudioCodec(o),f=this.transmuxer=this.transmuxer||new $d(this.hls,se.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=s?s.index:-1,p=m!==-1,g=new Pa(r.level,r.sn,r.stats.chunkCount,n.byteLength,m,p),E=this.initPTS[r.cc];f.push(n,c,h,d,r,s,l.totalduration,u,g,E)}onAudioTrackSwitching(e,t){let r=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;let a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();let n=this.hls;r&&(n.trigger(v.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(v.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let r=t.id,s=!!this.hls.audioTracks[r].url;if(s){let n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=s,this.tick()}onBufferCreated(e,t){let r=t.tracks,s,n,a=!1;for(let o in r){let l=r[o];if(l.id==="main"){if(n=o,s=l,o==="video"){let d=r[o];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:r,part:s}=t;if(r&&r.type!==se.MAIN)return;if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),this.state===O.PARSED&&(this.state=O.IDLE);return}let n=s?s.stats:r.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,s)}onError(e,t){var r;if(t.fatal){this.state=O.ERROR;return}switch(t.details){case C.FRAG_GAP:case C.FRAG_PARSING_ERROR:case C.FRAG_DECRYPT_ERROR:case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(se.MAIN,t);break;case C.LEVEL_LOAD_ERROR:case C.LEVEL_LOAD_TIMEOUT:case C.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===O.WAITING_LEVEL&&((r=t.context)==null?void 0:r.type)===Ae.LEVEL&&(this.state=O.IDLE);break;case C.BUFFER_APPEND_ERROR:case C.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===C.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case C.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){let{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ge.getBuffered(e).length){let r=this.state!==O.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,r)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=O.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==De.AUDIO||this.audioOnly&&!this.altAudio){let r=(t===De.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,t,se.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(){let{media:e}=this;if(!e)return;let t=e.currentTime,r=this.startPosition;if(r>=0&&t<r){if(e.seeking){this.log(`could not seek to ${r}, already seeking at ${t}`);return}let s=Ge.getBuffered(e),a=(s.length?s.start(0):0)-r;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),r+=a,this.startPosition=r),this.log(`seek to target start position ${r} from current time ${t}`),e.currentTime=r}}_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(r=>{let{hls:s}=this;if(!r||this.fragContextChanged(e))return;t.fragmentError=0,this.state=O.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),s.trigger(v.FRAG_LOADED,r),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;let r="main",{hls:s}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}let{frag:l,part:d,level:u}=o,{video:c,text:h,id3:f,initSegment:m}=n,{details:p}=u,g=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=O.PARSING,m){if(m!=null&&m.tracks){let T=l.initSegment||l;this._bufferInitSegment(u,m.tracks,T,a),s.trigger(v.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:r,tracks:m.tracks})}let E=m.initPTS,b=m.timescale;z(E)&&(this.initPTS[l.cc]={baseTime:E,timescale:b},s.trigger(v.INIT_PTS_FOUND,{frag:l,id:r,initPTS:E,timescale:b}))}if(c&&p&&l.sn!=="initSegment"){let E=p.fragments[l.sn-1-p.startSN],b=l.sn===p.startSN,T=!E||l.cc>E.cc;if(n.independent!==!1){let{startPTS:_,endPTS:A,startDTS:R,endDTS:S}=c;if(d)d.elementaryStreams[c.type]={startPTS:_,endPTS:A,startDTS:R,endDTS:S};else if(c.firstKeyFrame&&c.independent&&a.id===1&&!T&&(this.couldBacktrack=!0),c.dropped&&c.independent){let D=this.getMainFwdBufferInfo(),M=(D?D.end:this.getLoadPosition())+this.config.maxBufferHole,L=c.firstKeyFramePTS?c.firstKeyFramePTS:_;if(!b&&M<L-this.config.maxBufferHole&&!T){this.backtrack(l);return}else T&&(l.gap=!0);l.setElementaryStreamInfo(c.type,l.start,A,l.start,S,!0)}else b&&_>yd&&(l.gap=!0);l.setElementaryStreamInfo(c.type,_,A,R,S),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(c,l,d,a,b||T)}else if(b||T)l.gap=!0;else{this.backtrack(l);return}}if(g){let{startPTS:E,endPTS:b,startDTS:T,endDTS:_}=g;d&&(d.elementaryStreams[De.AUDIO]={startPTS:E,endPTS:b,startDTS:T,endDTS:_}),l.setElementaryStreamInfo(De.AUDIO,E,b,T,_),this.bufferFragmentData(g,l,d,a)}if(p&&f!=null&&(t=f.samples)!=null&&t.length){let E={id:r,frag:l,details:p,samples:f.samples};s.trigger(v.FRAG_PARSING_METADATA,E)}if(p&&h){let E={id:r,frag:l,details:p,samples:h.samples};s.trigger(v.FRAG_PARSING_USERDATA,E)}}_bufferInitSegment(e,t,r,s){if(this.state!==O.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;let{audio:n,video:a,audiovideo:o}=t;if(n){let l=e.audioCodec,d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");let u=n.metadata;u&&"channelCount"in u&&(u.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),n.levelCodec=l,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${n.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(v.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{let u=t[l].initSegment;u!=null&&u.byteLength&&this.hls.trigger(v.BUFFER_APPENDING,{type:l,data:u,frag:r,part:null,chunkMeta:s,parent:r.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,se.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=O.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let r=e.currentTime;if(Ge.isBuffered(e,r)?t=this.getAppendedFrag(r):Ge.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){this.backtrackFragment=null;let s=this.fragPlaying,n=t.level;(!s||t.sn!==s.sn||s.level!==n)&&(this.fragPlaying=t,this.hls.trigger(v.FRAG_CHANGED,{frag:t}),(!s||s.level!==n)&&this.hls.trigger(v.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){let e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){let e=this.media;if(e){let t=e.currentTime,r=this.currentFrag;if(r&&z(t)&&z(r.programDateTime)){let s=r.programDateTime+(t-r.start)*1e3;return new Date(s)}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},$a=class i{static get version(){return"1.5.20"}static isMSESupported(){return Sy()}static isSupported(){return SL()}static getMediaSource(){return ls()}static get Events(){return v}static get ErrorTypes(){return le}static get ErrorDetails(){return C}static get DefaultConfig(){return i.defaultConfig?i.defaultConfig:_y}static set DefaultConfig(e){i.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 Um,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,dR(e.debug||!1,"Hls instance");let t=this.config=_L(i.DefaultConfig,e);this.userConfig=e,t.progressive&&AL(t);let{abrController:r,bufferController:s,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),d=this.abrController=new r(this),u=this.bufferController=new s(this),c=this.capLevelController=new n(this),h=new o(this),f=new xf(this),m=new kf(this),p=t.contentSteeringController,g=p?new p(this):null,E=this.levelController=new xm(this,g),b=new Uf(this),T=new Rm(this.config),_=this.streamController=new km(this,b,T);c.setStreamController(_),h.setStreamController(_);let A=[f,E,_];g&&A.splice(1,0,g),this.networkControllers=A;let R=[d,u,c,h,m,b];this.audioTrackController=this.createController(t.audioTrackController,A);let S=t.audioStreamController;S&&A.push(new S(this,b,T)),this.subtitleTrackController=this.createController(t.subtitleTrackController,A);let D=t.subtitleStreamController;D&&A.push(new D(this,b,T)),this.createController(t.timelineController,R),T.emeController=this.emeController=this.createController(t.emeController,R),this.cmcdController=this.createController(t.cmcdController,R),this.latencyController=this.createController(Lf,R),this.coreComponents=R,A.push(l);let M=l.onErrorOut;typeof M=="function"&&this.on(v.ERROR,M,l)}createController(e,t){if(e){let r=new e(this);return t&&t.push(r),r}return null}on(e,t,r=this){this._emitter.on(e,t,r)}once(e,t,r=this){this._emitter.once(e,t,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,r=this,s){this._emitter.off(e,t,r,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,r){return this._emitter.emit(e,t,r)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(r){if(k.error("An internal error happened while handling event "+e+'. Error message: "'+r.message+'". Here is a stacktrace:',r),!this.triggeringException){this.triggeringException=!0;let s=e===v.ERROR;this.trigger(v.ERROR,{type:le.OTHER_ERROR,details:C.INTERNAL_EXCEPTION,fatal:s,event:e,error:r}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){k.log("destroy"),this.trigger(v.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;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){k.log("attachMedia"),this._media=e,this.trigger(v.MEDIA_ATTACHING,{media:e})}detachMedia(){k.log("detachMedia"),this.trigger(v.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();let t=this.media,r=this.url,s=this.url=Lm.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,k.log(`loadSource:${s}`),t&&r&&(r!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(v.MANIFEST_LOADING,{url:e})}startLoad(e=-1){k.log(`startLoad(${e})`),this.started=!0,this.resumeBuffering();for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(e),!(!this.started||!this.networkControllers));t++);}stopLoad(){k.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}resumeBuffering(){k.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()})}pauseBuffering(){k.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()})}swapAudioCodec(){k.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){k.log("recoverMediaError");let e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){let e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){k.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){k.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){k.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){k.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){k.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){let 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(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(k.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){nI(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(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let r=e.length;for(let s=0;s<r;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){let{levels:e,autoLevelCapping:t,maxHdcpLevel:r}=this,s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,r)for(let n=s;n--;){let a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=r)return n}return s}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(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){let 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}};$a.defaultConfig=void 0;var Te=$a,Ue={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},te={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},Ga=i=>i===Ue.VIDEO?"playback":i,yr=class Ha extends Error{constructor(e,t=Ha.MEDIA_ERR_CUSTOM,r,s){var n;super(e),this.name="MediaError",this.code=t,this.context=s,this.fatal=r!=null?r:t>=Ha.MEDIA_ERR_NETWORK&&t<=Ha.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(n=Ha.defaultMessages[this.code])!=null?n:"")}};yr.MEDIA_ERR_ABORTED=1,yr.MEDIA_ERR_NETWORK=2,yr.MEDIA_ERR_DECODE=3,yr.MEDIA_ERR_SRC_NOT_SUPPORTED=4,yr.MEDIA_ERR_ENCRYPTED=5,yr.MEDIA_ERR_CUSTOM=100,yr.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var V=yr,wL=i=>i==null,zm=(i,e)=>wL(e)?!1:i in e,Km={ANY:"any",MUTED:"muted"},Re={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},jt={MSE:"mse",NATIVE:"native"},zd={HEADER:"header",QUERY:"query",NONE:"none"},In=Object.values(zd),tr={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Vm={HLS:tr.M3U8},VN=Object.keys(Vm),WN=[...Object.values(tr),"hls","HLS"];var DL="en",Wm={code:DL},tt=(i,e,t,r,s=i)=>{s.addEventListener(e,t,r),i.addEventListener("teardown",()=>{s.removeEventListener(e,t)},{once:!0})};function CL(i,e,t){e&&t>e&&(t=e);for(let r=0;r<i.length;r++)if(i.start(r)<=t&&i.end(r)>=t)return!0;return!1}var eu=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),r=i.slice(e);return[t,r]},tu=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return zm(t,Vm)?Vm[t]:e}return ML(i)},Py=i=>i==="VOD"?Re.ON_DEMAND:Re.LIVE,Oy=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,ML=i=>{let{src:e}=i;if(!e)return"";let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let r=t.lastIndexOf(".");if(r<0)return OL(i)?tr.M3U8:"";let s=t.slice(r+1).toUpperCase();return zm(s,tr)?tr[s]:""},PL="mux.com",OL=({src:i,customDomain:e=PL})=>{let t;try{t=new URL(`${i}`)}catch{return!1}let r=t.protocol==="https:",s=t.hostname===`stream.${e}`.toLowerCase(),n=t.pathname.split("/"),a=n.length===2,o=!(n!=null&&n[1].includes("."));return r&&s&&a&&o},_r=i=>{let e=(i!=null?i:"").split(".")[1];if(e)try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(s){return"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}catch{return}},NL=({exp:i},e=Date.now())=>!i||i*1e3<e,UL=({sub:i},e)=>i!==e,FL=({aud:i},e)=>!i,BL=({aud:i},e)=>i!==e,Ny="en";function X(i,e=!0){var t,r;let s=e&&(r=(t=Wm)==null?void 0:t[i])!=null?r:i,n=e?Wm.code:Ny;return new $L(s,n)}var $L=class{constructor(i,e=(t=>(t=Wm)!=null?t:Ny)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,t)=>{var r;return(r=i[t])!=null?r:""})}toString(){return this.message}},HL=Object.values(Km),xy=i=>typeof i=="boolean"||typeof i=="string"&&HL.includes(i),GL=(i,e,t)=>{let{autoplay:r}=i,s=!1,n=!1,a=xy(r)?r:!!r,o=()=>{s||tt(e,"playing",()=>{s=!0},{once:!0})};if(o(),tt(e,"loadstart",()=>{s=!1,o(),Hm(e,a)},{once:!0}),tt(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==Re.UNKNOWN?n=i.streamType===Re.LIVE:n=!Number.isFinite(e.duration)),Hm(e,a)},{once:!0}),t&&t.once(Te.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==Re.UNKNOWN?n=i.streamType===Re.LIVE:n=(u=d.details.live)!=null?u:!1}),!a){let l=()=>{!n||Number.isFinite(i.startTime)||(t!=null&&t.liveSyncPosition?e.currentTime=t.liveSyncPosition:Number.isFinite(e.seekable.end(0))&&(e.currentTime=e.seekable.end(0)))};t&&tt(e,"play",()=>{e.preload==="metadata"?t.once(Te.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{s||(a=xy(l)?l:!!l,Hm(e,a))}},Hm=(i,e)=>{if(!e)return;let t=i.muted,r=()=>i.muted=t;switch(e){case Km.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(r)});break;case Km.MUTED:i.muted=!0,i.play().catch(r);break;default:i.play().catch(()=>{});break}},KL=({preload:i,src:e},t,r)=>{let s=c=>{c!=null&&["","none","metadata","auto"].includes(c)?t.setAttribute("preload",c):t.removeAttribute("preload")};if(!r)return s(i),s;let n=!1,a=!1,o=r.config.maxBufferLength,l=r.config.maxBufferSize,d=c=>{s(c);let h=c!=null?c:t.preload;a||h==="none"||(h==="metadata"?(r.config.maxBufferLength=1,r.config.maxBufferSize=1):(r.config.maxBufferLength=o,r.config.maxBufferSize=l),u())},u=()=>{!n&&e&&(n=!0,r.loadSource(e))};return tt(t,"play",()=>{a=!0,r.config.maxBufferLength=o,r.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function VL(i,e){var t;if(!("videoTracks"in i))return;let r=new WeakMap;e.on(Te.Events.MANIFEST_PARSED,function(d,u){l();let c=i.addVideoTrack("main");c.selected=!0;for(let[h,f]of u.levels.entries()){let m=c.addRendition(f.url[0],f.width,f.height,f.videoCodec,f.bitrate);r.set(f,`${h}`),m.id=`${h}`}}),e.on(Te.Events.AUDIO_TRACKS_UPDATED,function(d,u){o();for(let c of u.audioTracks){let h=c.default?"main":"alternative",f=i.addAudioTrack(h,c.name,c.lang);f.id=`${c.id}`,c.default&&(f.enabled=!0)}}),i.audioTracks.addEventListener("change",()=>{var d;let u=+((d=[...i.audioTracks].find(h=>h.enabled))==null?void 0:d.id),c=e.audioTracks.map(h=>h.id);u!=e.audioTrack&&c.includes(u)&&(e.audioTrack=u)}),e.on(Te.Events.LEVELS_UPDATED,function(d,u){var c;let h=i.videoTracks[(c=i.videoTracks.selectedIndex)!=null?c:0];if(!h)return;let f=u.levels.map(m=>r.get(m));for(let m of i.videoRenditions)m.id&&!f.includes(m.id)&&h.removeRendition(m)});let s=d=>{let u=d.target.selectedIndex;u!=e.nextLevel&&n(u)},n=d=>{let u=i.currentTime,c=!1,h=(f,m)=>{c||(c=!Number.isFinite(m.endOffset))};e.on(Te.Events.BUFFER_FLUSHING,h),e.nextLevel=d,e.off(Te.Events.BUFFER_FLUSHING,h),c||e.trigger(Te.Events.BUFFER_FLUSHING,{startOffset:u+10,endOffset:1/0,type:"video"})};(t=i.videoRenditions)==null||t.addEventListener("change",s);let a=()=>{for(let d of i.videoTracks)i.removeVideoTrack(d)},o=()=>{for(let d of i.audioTracks)i.removeAudioTrack(d)},l=()=>{a(),o()};e.once(Te.Events.DESTROYING,l)}var Gm=i=>"time"in i?i.time:i.startTime;function WL(i,e){e.on(Te.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(s,{tracks:n})=>{n.forEach(a=>{var o,l;let d=(o=a.subtitleTrack)!=null?o:a.closedCaptions,u=e.subtitleTracks.findIndex(({lang:h,name:f,type:m})=>h==(d==null?void 0:d.lang)&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;iu(i,a.kind,a.label,d==null?void 0:d.lang,c,a.default)})});let t=()=>{if(!e.subtitleTracks.length)return;let s=Array.from(i.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind));if(!s)return;let n=e.subtitleTracks[e.subtitleTrack],a=n?n.default?"default":`${e.subtitleTracks[e.subtitleTrack].type.toLowerCase()}${e.subtitleTrack}`:void 0;if(e.subtitleTrack<0||(s==null?void 0:s.id)!==a){let o=e.subtitleTracks.findIndex(({lang:l,name:d,type:u,default:c})=>s.id==="default"&&c||l==s.language&&d===s.label&&u.toLowerCase()===s.kind);e.subtitleTrack=o}(s==null?void 0:s.id)===a&&s.cues&&Array.from(s.cues).forEach(o=>{s.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(Te.Events.CUES_PARSED,(s,{track:n,cues:a})=>{let o=i.textTracks.getTrackById(n);if(!o)return;let l=o.mode==="disabled";l&&(o.mode="hidden"),a.forEach(d=>{var u;(u=o.cues)!=null&&u.getCueById(d.id)||o.addCue(d)}),l&&(o.mode="disabled")}),e.once(Te.Events.DESTROYING,()=>{i.textTracks.removeEventListener("change",t),i.querySelectorAll("track[data-removeondestroy]").forEach(s=>{s.remove()})});let r=()=>{Array.from(i.textTracks).forEach(s=>{var n,a;if(!["subtitles","caption"].includes(s.kind)&&(s.label==="thumbnails"||s.kind==="chapters")){if(!((n=s.cues)!=null&&n.length)){let o="track";s.kind&&(o+=`[kind="${s.kind}"]`),s.label&&(o+=`[label="${s.label}"]`);let l=i.querySelector(o),d=(a=l==null?void 0:l.getAttribute("src"))!=null?a:"";l==null||l.removeAttribute("src"),setTimeout(()=>{l==null||l.setAttribute("src",d)},0)}s.mode!=="hidden"&&(s.mode="hidden")}})};e.once(Te.Events.MANIFEST_LOADED,r),e.once(Te.Events.MEDIA_ATTACHED,r)}function iu(i,e,t,r,s,n){let a=document.createElement("track");return a.kind=e,a.label=t,r&&(a.srclang=r),s&&(a.id=s),n&&(a.default=!0),a.track.mode=["subtitles","captions"].includes(e)?"disabled":"hidden",a.setAttribute("data-removeondestroy",""),i.append(a),a.track}function Uy(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),r=>r.track===e);t==null||t.remove()}function Ka(i,e,t){var r;return(r=Array.from(i.querySelectorAll("track")).find(s=>s.track.label===e&&s.track.kind===t))==null?void 0:r.track}async function Fy(i,e,t,r){let s=Ka(i,t,r);return s||(s=iu(i,r,t),s.mode="hidden",await new Promise(n=>setTimeout(()=>n(void 0),0))),s.mode!=="hidden"&&(s.mode="hidden"),[...e].sort((n,a)=>Gm(a)-Gm(n)).forEach(n=>{var a,o;let l=n.value,d=Gm(n);if("endTime"in n&&n.endTime!=null)s==null||s.addCue(new VTTCue(d,n.endTime,r==="chapters"?l:JSON.stringify(l!=null?l:null)));else{let u=Array.prototype.findIndex.call(s==null?void 0:s.cues,m=>m.startTime>=d),c=(a=s==null?void 0:s.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=s==null?void 0:s.cues)==null?void 0:o[u-1];f&&(f.endTime=d),s==null||s.addCue(new VTTCue(d,h,r==="chapters"?l:JSON.stringify(l!=null?l:null)))}}),i.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),s}var Xm="cuepoints",By=Object.freeze({label:Xm});async function Qm(i,e,t=By){return Fy(i,e,t.label,"metadata")}var Ym=i=>({time:i.startTime,value:JSON.parse(i.text)});function $y(i,e={label:Xm}){let t=Ka(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,r=>Ym(r)):[]}function Zm(i,e={label:Xm}){var t,r;let s=Ka(i,e.label,"metadata");if(!((t=s==null?void 0:s.activeCues)!=null&&t.length))return;if(s.activeCues.length===1)return Ym(s.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((r=s.activeCues)!=null?r:[],({startTime:o,endTime:l})=>o<=n&&l>n);return Ym(a||s.activeCues[0])}async function YL(i,e=By){return new Promise(t=>{tt(i,"loadstart",async()=>{let r=await Qm(i,[],e);tt(i,"cuechange",()=>{let s=Zm(i);if(s){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:s});i.dispatchEvent(n)}},{},r),t(r)})})}var Jm="chapters",Hy=Object.freeze({label:Jm}),qm=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function ep(i,e,t=Hy){return Fy(i,e,t.label,"chapters")}function Gy(i,e={label:Jm}){var t;let r=Ka(i,e.label,"chapters");return(t=r==null?void 0:r.cues)!=null&&t.length?Array.from(r.cues,s=>qm(s)):[]}function tp(i,e={label:Jm}){var t,r;let s=Ka(i,e.label,"chapters");if(!((t=s==null?void 0:s.activeCues)!=null&&t.length))return;if(s.activeCues.length===1)return qm(s.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((r=s.activeCues)!=null?r:[],({startTime:o,endTime:l})=>o<=n&&l>n);return qm(a||s.activeCues[0])}async function qL(i,e=Hy){return new Promise(t=>{tt(i,"loadstart",async()=>{let r=await ep(i,[],e);tt(i,"cuechange",()=>{let s=tp(i);if(s){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:s});i.dispatchEvent(n)}},{},r),t(r)})})}function Ky(i,e){if(e){let t=e.playingDate;if(t!=null)return new Date(t.getTime()-i.currentTime*1e3)}return typeof i.getStartDate=="function"?i.getStartDate():new Date(NaN)}function Vy(i,e){if(e&&e.playingDate)return e.playingDate;if(typeof i.getStartDate=="function"){let t=i.getStartDate();return new Date(t.getTime()+i.currentTime*1e3)}return new Date(NaN)}var Rn={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},jL=i=>{if(i===Ue.VIDEO)return Rn.VIDEO;if(i===Ue.DRM)return Rn.DRM},zL=(i,e)=>{var t,r;let s=Ga(i),n=`${s}Token`;return(t=e.tokens)!=null&&t[s]?(r=e.tokens)==null?void 0:r[s]:zm(n,e)?e[n]:void 0},Zd=(i,e,t,r=!1,s=!(n=>(n=globalThis.navigator)==null?void 0:n.onLine)())=>{var n,a;if(s){let g=X("Your device appears to be offline",r),E,b=V.MEDIA_ERR_NETWORK,T=new V(g,b,!0,E);return T.errorCategory=e,T.muxCode=te.NETWORK_OFFLINE,T.data=i,T}let o="status"in i?i.status:i.code,l=Date.now(),d=V.MEDIA_ERR_NETWORK;if(o===200)return;let u=Ga(e),c=zL(e,t),h=jL(e),[f]=eu((n=t.playbackId)!=null?n:"");if(!o||!f)return;let m=_r(c);if(c&&!m){let g=X("The {tokenNamePrefix}-token provided is invalid or malformed.",r).format({tokenNamePrefix:u}),E=X("Compact JWT string: {token}",r).format({token:c}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_MALFORMED,b.data=i,b}if(o>=500){let g=new V("",d,!0);return g.errorCategory=e,g.muxCode=te.NETWORK_UNKNOWN_ERROR,g}if(o===403)if(m){if(NL(m,l)){let g={timeStyle:"medium",dateStyle:"medium"},E=X("The video\u2019s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:u}),b=X("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat("en",g).format((a=m.exp)!=null?a:0*1e3),currentDate:new Intl.DateTimeFormat("en",g).format(l)}),T=new V(E,d,!0,b);return T.errorCategory=e,T.muxCode=te.NETWORK_TOKEN_EXPIRED,T.data=i,T}if(UL(m,f)){let g=X("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:u}),E=X("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",r).format({tokenNamePrefix:u,playbackId:f,tokenPlaybackId:m.sub}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_SUB_MISMATCH,b.data=i,b}if(FL(m,h)){let g=X("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:u}),E=X("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",r).format({tokenNamePrefix:u,expectedAud:h}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_AUD_MISSING,b.data=i,b}if(BL(m,h)){let g=X("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:u}),E=X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",r).format({tokenNamePrefix:u,expectedAud:h,aud:m.aud}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_AUD_MISMATCH,b.data=i,b}}else{let g=X("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",r).format({tokenNamePrefix:u,category:e}),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_MISSING,b.data=i,b}if(o===412){let g=X("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_NOT_READY,b.data=i,b}if(o===404){let g=X("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_NOT_FOUND,b.data=i,b}if(o===400){let g=X("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_INVALID_URL,b.data=i,b}let p=new V("",d,!0);return p.errorCategory=e,p.muxCode=te.NETWORK_UNKNOWN_ERROR,p.data=i,p},Ry=Te.DefaultConfig.capLevelController,Wy=class Yy extends Ry{constructor(e){super(e)}get levels(){var e;return(e=this.hls.levels)!=null?e:[]}getValidLevels(e){return this.levels.filter((t,r)=>this.isLevelAllowed(t)&&r<=e)}getMaxLevel(e){let t=super.getMaxLevel(e),r=this.getValidLevels(e);if(!r[t])return t;let s=Math.min(r[t].width,r[t].height),n=Yy.minMaxResolution;return s>=n?t:Ry.getMaxLevelByMediaSize(r,n*(16/9),n)}};Wy.minMaxResolution=720;var XL=Wy,QL=XL,Xd={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},ZL=i=>{if(i.includes("fps"))return Xd.FAIRPLAY;if(i.includes("playready"))return Xd.PLAYREADY;if(i.includes("widevine"))return Xd.WIDEVINE},JL=async i=>fetch(i).then(e=>e.status!==200?Promise.reject(e):e.text()).then(e=>{let t=e.split(`
1280
+ } (data length: ${t&&t.byteLength})`),s.update(t)}selectKeySystemFormat(e){let 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,r)=>{let s=rd(this.config),n=e.map(Zh).filter(a=>!!a&&s.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{let o=ef(a);o?t(o):r(new Error(`Unable to find format for key-system "${a}"`))}).catch(r)})}loadKey(e){let t=e.keyInfo.decryptdata,r=this.getKeyIdString(t),s=`(keyId: ${r} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let n=this.keyIdToKeySessionPromise[r];return n||(n=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(a,o).then(()=>{this.throwIfDestroyed();let l=this.createMediaKeySessionContext({keySystem:a,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),n.catch(a=>this.handleError(a))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Mt?this.hls.trigger(v.ERROR,e.data):this.hls.trigger(v.ERROR,{type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){let t=this.getKeyIdString(e),r=this.keyIdToKeySessionPromise[t];if(!r){let s=Zh(e.keyFormat),n=s?[s]:rd(this.config);return this.attemptKeySystemAccess(n)}return r}getKeySystemSelectionPromise(e){if(e.length||(e=rd(this.config)),e.length===0)throw new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){let r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let s=Promise.all(r).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>r.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,r,s){var n,a;let o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{let m=o.call(this.hls,t,r,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,r=e.decryptdata.pssh=m.initData?new Uint8Array(m.initData):null}catch(m){var l;if(this.warn(m.message),(l=this.hls)!=null&&l.config.debug)throw m}if(r===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);let d=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${d} (init data type: ${t} length: ${r?r.byteLength:null})`);let u=new Um,c=e._onmessage=m=>{let p=e.mediaKeysSession;if(!p){u.emit("error",new Error("invalid state"));return}let{messageType:g,message:E}=m;this.log(`"${g}" message event for session "${p.sessionId}" message size: ${E.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,E).catch(b=>{this.handleError(b),u.emit("error",b)}):g==="license-release"?e.keySystem===Ie.FAIRPLAY&&(this.updateKeySession(e,Af("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},h=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);let g=e.keyStatus;u.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${d}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",c),e.mediaKeysSession.addEventListener("keystatuseschange",h);let f=new Promise((m,p)=>{u.on("error",p),u.on("keyStatus",g=>{g.startsWith("usable")?m():g==="output-restricted"?p(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?p(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?p(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,r).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${d}`)}).catch(m=>{throw new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>f).catch(m=>{throw u.removeAllListeners(),this.removeSession(e),m}).then(()=>(u.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,r)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ki.hexDump("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))} session keyId: ${ki.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){let t=this.config,r=t.loader,s=new r(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{let l={responseType:"arraybuffer",url:n},d=t.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{a(h.data)},onError:(h,f,m,p)=>{o(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:mt({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,m)=>{o(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(h,f,m)=>{o(new Error("aborted"))}};s.load(l,u,c)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,r){return new Promise((s,n)=>{e.setServerCertificate(r).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${r==null?void 0:r.byteLength}) on "${t}"`),s(e)}).catch(a=>{n(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(r=>this.updateKeySession(e,new Uint8Array(r)).catch(s=>{throw new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:s,fatal:!0},s.message)}))}unpackPlayReadyKeyMessage(e,t){let r=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;let s=new DOMParser().parseFromString(r,"application/xml"),n=s.querySelectorAll("HttpHeader");if(n.length>0){let u;for(let c=0,h=n.length;c<h;c++){var a,o;u=n[c];let f=(a=u.querySelector("name"))==null?void 0:a.textContent,m=(o=u.querySelector("value"))==null?void 0:o.textContent;f&&m&&e.setRequestHeader(f,m)}}let l=s.querySelector("Challenge"),d=l==null?void 0:l.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Af(atob(d))}setupLicenseXHR(e,t,r,s){let n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!r.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,r,s)}).catch(a=>{if(!r.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,r,s)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||s})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){let r=this.config.keyLoadPolicy.default;return new Promise((s,n)=>{let a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);let o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);let d=this.config.licenseResponseCallback;if(d)try{l=d.call(this.hls,o,a,e)}catch(u){this.error(u)}s(l)}else{let l=r.errorRetry,d=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||o.status>=400&&o.status<500)n(new Mt({type:le.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{let u=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(s,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:d})=>{e.keySystem==Ie.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(l,d)),l.send(d)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let r=t.media;this.media=r,r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){let 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={},Da.clearKeyUriToKeyIdMap();let r=t.length;i.CDMCleanupPromise=Promise.all(t.map(s=>this.removeSession(s)).concat(e==null?void 0:e.setMediaKeys(null).catch(s=>{this.log(`Could not clear media keys: ${s}`)}))).then(()=>{r&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){let r=t.reduce((s,n)=>(s.indexOf(n.keyFormat)===-1&&s.push(n.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:r}=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),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}};Vd.CDMCleanupPromise=void 0;var Mt=class 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}},yt;(function(i){i.MANIFEST="m",i.AUDIO="a",i.VIDEO="v",i.MUXED="av",i.INIT="i",i.CAPTION="c",i.TIMED_TEXT="tt",i.KEY="k",i.OTHER="o"})(yt||(yt={}));var Em;(function(i){i.DASH="d",i.HLS="h",i.SMOOTH="s",i.OTHER="o"})(Em||(Em={}));var ns;(function(i){i.OBJECT="CMCD-Object",i.REQUEST="CMCD-Request",i.SESSION="CMCD-Session",i.STATUS="CMCD-Status"})(ns||(ns={}));var Lk={[ns.OBJECT]:["br","d","ot","tb"],[ns.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[ns.SESSION]:["cid","pr","sf","sid","st","v"],[ns.STATUS]:["bs","rtp"]},Ba=class i{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(r=>r instanceof i?r:new i(r))),this.value=e,this.params=t}},Wd=class{constructor(e){this.description=void 0,this.description=e}},wk="Dict";function Dk(i){return Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":typeof i=="object"?JSON.stringify(i):String(i)}function Ck(i,e,t,r){return new Error(`failed to ${i} "${Dk(e)}" as ${t}`,{cause:r})}var Eb="Bare Item",Mk="Boolean",Pk="Byte Sequence",Ok="Decimal",Nk="Integer";function Uk(i){return i<-999999999999999||999999999999999<i}var Fk=/[\x00-\x1f\x7f]+/,Bk="Token",$k="Key";function Ci(i,e,t){return Ck("serialize",i,e,t)}function Hk(i){if(typeof i!="boolean")throw Ci(i,Mk);return i?"?1":"?0"}function Gk(i){return btoa(String.fromCharCode(...i))}function Kk(i){if(ArrayBuffer.isView(i)===!1)throw Ci(i,Pk);return`:${Gk(i)}:`}function vy(i){if(Uk(i))throw Ci(i,Nk);return i.toString()}function Vk(i){return`@${vy(i.getTime()/1e3)}`}function Ey(i,e){if(i<0)return-Ey(-i,e);let t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){let s=Math.floor(i*t);return(s%2===0?s:s+1)/t}else return Math.round(i*t)/t}function Wk(i){let e=Ey(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ci(i,Ok);let t=e.toString();return t.includes(".")?t:`${t}.0`}var Yk="String";function qk(i){if(Fk.test(i))throw Ci(i,Yk);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function jk(i){return i.description||i.toString().slice(7,-1)}function bb(i){let e=jk(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ci(e,Bk);return e}function bm(i){switch(typeof i){case"number":if(!z(i))throw Ci(i,Eb);return Number.isInteger(i)?vy(i):Wk(i);case"string":return qk(i);case"symbol":return bb(i);case"boolean":return Hk(i);case"object":if(i instanceof Date)return Vk(i);if(i instanceof Uint8Array)return Kk(i);if(i instanceof Wd)return bb(i);default:throw Ci(i,Eb)}}function ym(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw Ci(i,$k);return i}function $m(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${ym(e)}`:`;${ym(e)}=${bm(t)}`).join("")}function by(i){return i instanceof Ba?`${bm(i.value)}${$m(i.params)}`:bm(i)}function zk(i){return`(${i.value.map(by).join(" ")})${$m(i.params)}`}function Xk(i,e={whitespace:!0}){if(typeof i!="object")throw Ci(i,wk);let t=i instanceof Map?i.entries():Object.entries(i),r=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([s,n])=>{n instanceof Ba||(n=new Ba(n));let a=ym(s);return n.value===!0?a+=$m(n.params):(a+="=",Array.isArray(n.value)?a+=zk(n):a+=by(n)),a}).join(`,${r}`)}function Qk(i,e){return Xk(i,e)}var Zk=i=>i==="ot"||i==="sf"||i==="st",Jk=i=>typeof i=="number"?z(i):i!=null&&i!==""&&i!==!1;function eL(i,e){let t=new URL(i),r=new URL(e);if(t.origin!==r.origin)return i;let s=t.pathname.split("/").slice(1),n=r.pathname.split("/").slice(1,-1);for(;s[0]===n[0];)s.shift(),n.shift();for(;n.length;)n.shift(),s.unshift("..");return s.join("/")}function tL(){try{return crypto.randomUUID()}catch{try{let 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,s=>{let n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?n:n&3|8).toString(16)})}}}var bd=i=>Math.round(i),iL=(i,e)=>(e!=null&&e.baseUrl&&(i=eL(i,e.baseUrl)),encodeURIComponent(i)),fd=i=>bd(i/100)*100,rL={br:bd,d:bd,bl:fd,dl:fd,mtp:fd,nor:iL,rtp:fd,tb:bd};function sL(i,e){let t={};if(i==null||typeof i!="object")return t;let r=Object.keys(i).sort(),s=et({},rL,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return r.forEach(a=>{if(n!=null&&n(a))return;let o=i[a],l=s[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||Jk(o)&&(Zk(a)&&typeof o=="string"&&(o=new Wd(o)),t[a]=o))}),t}function yy(i,e={}){return i?Qk(sL(i,e),et({whitespace:!1},e)):""}function nL(i,e={}){if(!i)return{};let t=Object.entries(i),r=Object.entries(Lk).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=t.reduce((n,a)=>{var o,l;let[d,u]=a,c=((o=r.find(h=>h[1].includes(d)))==null?void 0:o[0])||ns.REQUEST;return(l=n[c])!=null||(n[c]={}),n[c][d]=u,n},{});return Object.entries(s).reduce((n,[a,o])=>(n[a]=yy(o,e),n),{})}function aL(i,e,t){return et(i,nL(e,t))}var oL="CMCD";function lL(i,e={}){if(!i)return"";let t=yy(i,e);return`${oL}=${encodeURIComponent(t)}`}var yb=/CMCD=[^&#]+/;function dL(i,e,t){let r=lL(e,t);if(!r)return i;if(yb.test(i))return i.replace(yb,r);let s=i.includes("?")?"&":"?";return`${i}${s}${r}`}var Tm=class{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=s=>{try{this.apply(s,{ot:yt.MANIFEST,su:!this.initialized})}catch(n){k.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=s=>{try{let n=s.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===yt.VIDEO||o===yt.AUDIO||o==yt.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(s,l)}catch(n){k.warn("Could not generate segment CMCD data.",n)}},this.hls=e;let t=this.config=e.config,{cmcd:r}=t;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||tL(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHED,this.onMediaDetached,this),e.on(v.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHED,this.onMediaDetached,this),e.off(v.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 r,s;this.audioBuffer=(r=t.tracks.audio)==null?void 0:r.buffer,this.videoBuffer=(s=t.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:Em.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){et(t,this.createData());let r=t.ot===yt.INIT||t.ot===yt.VIDEO||t.ot===yt.MUXED;this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);let{includeKeys:s}=this;s&&(t=Object.keys(t).reduce((n,a)=>(s.includes(a)&&(n[a]=t[a]),n),{})),this.useHeaders?(e.headers||(e.headers={}),aL(e.headers,t)):e.url=dL(e.url,t)}getObjectType(e){let{type:t}=e;if(t==="subtitle")return yt.TIMED_TEXT;if(e.sn==="initSegment")return yt.INIT;if(t==="audio")return yt.AUDIO;if(t==="main")return this.hls.audioTracks.length?yt.VIDEO:yt.MUXED}getTopBandwidth(e){let t=0,r,s=this.hls;if(e===yt.AUDIO)r=s.audioTracks;else{let n=s.maxAutoLevel,a=n>-1?n+1:s.levels.length;r=s.levels.slice(0,a)}for(let n of r)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){let t=this.hls.media,r=e===yt.AUDIO?this.audioBuffer:this.videoBuffer;return!r||!t?NaN:Ge.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}},uL=3e5,_m=class{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=k.log.bind(k,"[content-steering]:"),this.registerListeners()}registerListeners(){let e=this.hls;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let 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){let t=this.levels;t&&(this.levels=t.filter(r=>r!==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){let{contentSteering:r}=t;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:r}=t;if((r==null?void 0:r.action)===ht.SendAlternateToPenaltyBox&&r.flags===oi.MoveAllAlternatesMatchingHost){let s=this.levels,n=this.pathwayPriority,a=this.pathwayId;if(t.context){let{groupId:o,pathwayId:l,type:d}=t.context;o&&s?a=this.getPathwayForGroupId(o,d,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&s&&(n=s.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),r.resolved=this.pathwayId!==a),r.resolved||k.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${s&&s.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){let r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),t=this.getLevelsForPathway(r),this.pathwayId=r}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,r=this.penalizedPathways,s=performance.now();Object.keys(r).forEach(n=>{s-r[n]>uL&&delete r[n]});for(let n=0;n<e.length;n++){let a=e[n];if(a in r)continue;if(a===this.pathwayId)return;let o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Kb(t),this.hls.trigger(v.LEVELS_UPDATED,{levels:t});let d=this.hls.levels[o];l&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,r){let s=this.getLevelsForPathway(r).concat(this.levels||[]);for(let n=0;n<s.length;n++)if(t===Ae.AUDIO_TRACK&&s[n].hasAudioGroup(e)||t===Ae.SUBTITLE_TRACK&&s[n].hasSubtitleGroup(e))return s[n].pathwayId;return r}clonePathways(e){let t=this.levels;if(!t)return;let r={},s={};e.forEach(n=>{let{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(u=>u.pathwayId===a))return;let d=this.getLevelsForPathway(o).map(u=>{let c=new Ye(u.attrs);c["PATHWAY-ID"]=a;let h=c.AUDIO&&`${c.AUDIO}_clone_${a}`,f=c.SUBTITLES&&`${c.SUBTITLES}_clone_${a}`;h&&(r[c.AUDIO]=h,c.AUDIO=h),f&&(s[c.SUBTITLES]=f,c.SUBTITLES=f);let m=Ty(u.uri,c["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),p=new br({attrs:c,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:m,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let g=1;g<u.audioGroups.length;g++)p.addGroupId("audio",`${u.audioGroups[g]}_clone_${a}`);if(u.subtitleGroups)for(let g=1;g<u.subtitleGroups.length;g++)p.addGroupId("text",`${u.subtitleGroups[g]}_clone_${a}`);return p});t.push(...d),Tb(this.audioTracks,r,l,a),Tb(this.subtitleTracks,s,l,a)})}loadSteeringManifest(e){let t=this.hls.config,r=t.loader;this.loader&&this.loader.destroy(),this.loader=new r(t);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){let u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+u)}let n={responseType:"json",url:s.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},d={onSuccess:(u,c,h,f)=>{this.log(`Loaded steering manifest: "${s}"`);let m=u.data;if(m.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;let{"RELOAD-URI":p,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":E}=m;if(p)try{this.uri=new self.URL(p,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||h.url),g&&this.clonePathways(g);let b={steeringManifest:m,url:s.toString()};this.hls.trigger(v.STEERING_MANIFEST_LOADED,b),E&&this.updatePathwayPriority(E)},onError:(u,c,h,f)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${c.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${c.url} no longer available`);return}let m=this.timeToLoad*1e3;if(u.code===429){let p=this.loader;if(typeof(p==null?void 0:p.getResponseHeader)=="function"){let g=p.getResponseHeader("Retry-After");g&&(m=parseFloat(g)*1e3)}this.log(`Steering manifest ${c.url} rate limited`);return}this.scheduleRefresh(this.uri||c.url,m)},onTimeout:(u,c,h)=>{this.log(`Timeout loading steering manifest (${c.url})`),this.scheduleRefresh(this.uri||c.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(n,l,d)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;let s=(r=this.hls)==null?void 0:r.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}};function Tb(i,e,t,r){i&&Object.keys(e).forEach(s=>{let n=i.filter(a=>a.groupId===s).map(a=>{let o=et({},a);return o.details=void 0,o.attrs=new Ye(o.attrs),o.url=o.attrs.URI=Ty(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[s],o.attrs["PATHWAY-ID"]=r,o});i.push(...n)})}function Ty(i,e,t,r){let{HOST:s,PARAMS:n,[t]:a}=r,o;e&&(o=a==null?void 0:a[e],o&&(i=o));let l=new self.URL(i);return s&&!o&&(l.host=s),n&&Object.keys(n).sort().forEach(d=>{d&&l.searchParams.set(d,n[d])}),l.href}var cL=/^age:\s*[\d.]+\s*$/im,Yd=class{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 Sn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let 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,r){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=r,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let r=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;let n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==r||this.stats.aborted))return n(r,t.url)}).catch(a=>{if(!(this.loader!==r||this.stats.aborted))return r.open("GET",t.url,!0),n(r,t.url)}).then(()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,t,e)}).catch(a=>{this.callbacks.onError({code:r.status,text:a.message},t,r,s)}):this.openAndSendXhr(r,t,e)}openAndSendXhr(e,t,r){e.readyState||e.open("GET",t.url,!0);let s=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=r.loadPolicy;if(s)for(let o in s)e.setRequestHeader(o,s[o]);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),r.timeout=n&&z(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:r}=this;if(!e||!t)return;let s=t.readyState,n=this.config;if(!r.aborted&&s>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let a=t.status,o=t.responseType==="text"?t.responseText:null;if(a>=200&&a<300){let c=o!=null?o:t.response;if(c!=null){r.loading.end=Math.max(self.performance.now(),r.loading.first);let h=t.responseType==="arraybuffer"?c.byteLength:c.length;if(r.loaded=r.total=h,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first),!this.callbacks)return;let f=this.callbacks.onProgress;if(f&&f(r,e,c,t),!this.callbacks)return;let m={url:t.responseURL,data:c,code:a};this.callbacks.onSuccess(m,r,e,t);return}}let l=n.loadPolicy.errorRetry,d=r.retry,u={url:e.url,data:void 0,code:a};wd(l,d,!1,u)?this.retry(l):(k.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,r))}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(wd(e,t,!0))this.retry(e);else{var r;k.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);let s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:r}=this;this.retryDelay=Mm(e,r.retry),r.retry++,k.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${r.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){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&cL.test(this.loader.getAllResponseHeaders())){let 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 hL(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var fL=/(\d+)-(\d+)\/(\d+)/,qd=class{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||vL,this.controller=new self.AbortController,this.stats=new Sn}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,r){let s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();let n=mL(e,this.controller.signal),a=r.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:d,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=d&&z(d)?d:u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},t.timeout),self.fetch(this.request).then(c=>{this.response=this.loader=c;let h=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},u-(h-s.loading.start)),!c.ok){let{status:f,statusText:m}=c;throw new Am(m||"fetch, bad network response",f,c)}return s.loading.first=h,s.total=gL(c.headers)||s.total,a&&z(t.highWaterMark)?this.loadProgressively(c,s,e,t.highWaterMark,a):o?c.arrayBuffer():e.responseType==="json"?c.json():c.text()}).then(c=>{let h=this.response;if(!h)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);let f=c[l];f&&(s.loaded=s.total=f);let m={url:h.url,data:c,code:h.status};a&&!z(t.highWaterMark)&&a(s,e,c,h),r.onSuccess(m,s,e,h)}).catch(c=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;let h=c&&c.code||0,f=c?c.message:null;r.onError({code:h,text:f},e,c?c.details:null,s)})}getCacheAge(){let e=null;if(this.response){let 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,r,s=0,n){let a=new Md,o=e.body.getReader(),l=()=>o.read().then(d=>{if(d.done)return a.dataLength&&n(t,r,a.flush(),e),Promise.resolve(new ArrayBuffer(0));let u=d.value,c=u.length;return t.loaded+=c,c<s||a.dataLength?(a.push(u),a.dataLength>=s&&n(t,r,a.flush(),e)):n(t,r,u,e),l()}).catch(()=>Promise.reject());return l()}};function mL(i,e){let t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(et({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function pL(i){let e=fL.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function gL(i){let e=i.get("Content-Range");if(e){let r=pL(e);if(z(r))return r}let t=i.get("Content-Length");if(t)return parseInt(t)}function vL(i,e){return new self.Request(i.url,e)}var Am=class extends Error{constructor(e,t,r){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=r}},EL=/\s/,bL={newCue(i,e,t,r){let s=[],n,a,o,l,d,u=self.VTTCue||self.TextTrackCue;for(let h=0;h<r.rows.length;h++)if(n=r.rows[h],o=!0,l=0,d="",!n.isEmpty()){var c;for(let p=0;p<n.chars.length;p++)EL.test(n.chars[p].uchar)&&o?l++:(d+=n.chars[p].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;let f=hy(d.trim()),m=Bm(e,t,f);i!=null&&(c=i.cues)!=null&&c.getCueById(m)||(a=new u(e,t,f),a.id=m,a.line=h+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),s.push(a))}return i&&s.length&&(s.sort((h,f)=>h.line==="auto"||f.line==="auto"?0:h.line>8&&f.line>8?f.line-h.line:h.line-f.line),s.forEach(h=>Bb(i,h))),s}},yL={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},_y=mt(mt({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:Yd,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Of,bufferController:om,capLevelController:gm,errorController:Mf,fpsController:vm,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:Sb,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:yL},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},TL()),{},{subtitleStreamController:rm,subtitleTrackController:nm,timelineController:pm,audioStreamController:em,audioTrackController:im,emeController:Vd,cmcdController:Tm,contentSteeringController:_m});function TL(){return{cueHandler:bL,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 _L(i,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"');let t=Sm(i),r=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(n=>{let a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];s.forEach(d=>{let u=`${n}Loading${d}`,c=e[u];if(c!==void 0&&o){l.push(u);let h=t[a].default;switch(e[a]={default:h},d){case"TimeOut":h.maxLoadTimeMs=c,h.maxTimeToFirstByteMs=c;break;case"MaxRetry":h.errorRetry.maxNumRetry=c,h.timeoutRetry.maxNumRetry=c;break;case"RetryDelay":h.errorRetry.retryDelayMs=c,h.timeoutRetry.retryDelayMs=c;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=c,h.timeoutRetry.maxRetryDelayMs=c;break}}}),l.length&&k.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(e[a])}`)}),mt(mt({},t),e)}function Sm(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Sm):Object.keys(i).reduce((e,t)=>(e[t]=Sm(i[t]),e),{}):i}function AL(i){let e=i.loader;e!==qd&&e!==Yd?(k.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):hL()&&(i.loader=qd,i.progressive=!0,i.enableSoftwareAES=!0,k.log("[config]: Progressive streaming enabled, using FetchLoader"))}var bf,xm=class extends Ma{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(){let{hls:e}=this;e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this),e.on(v.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this),e.off(v.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){let r=this.hls.config.preferManagedMediaSource,s=[],n={},a={},o=!1,l=!1,d=!1;t.levels.forEach(u=>{var c,h;let f=u.attrs,{audioCodec:m,videoCodec:p}=u;((c=m)==null?void 0:c.indexOf("mp4a.40.34"))!==-1&&(bf||(bf=/chrome|firefox/i.test(navigator.userAgent)),bf&&(u.audioCodec=m=void 0)),m&&(u.audioCodec=m=Rd(m,r)),((h=p)==null?void 0:h.indexOf("avc1"))===0&&(p=u.videoCodec=XR(p));let{width:g,height:E,unknownCodecs:b}=u;if(o||(o=!!(g&&E)),l||(l=!!p),d||(d=!!m),b!=null&&b.length||m&&!nf(m,"audio",r)||p&&!nf(p,"video",r))return;let{CODECS:T,"FRAME-RATE":_,"HDCP-LEVEL":A,"PATHWAY-ID":R,RESOLUTION:S,"VIDEO-RANGE":D}=f,L=`${`${R||"."}-`}${u.bitrate}-${S}-${_}-${T}-${D}-${A}`;if(n[L])if(n[L].uri!==u.url&&!u.attrs["PATHWAY-ID"]){let P=a[L]+=1;u.attrs["PATHWAY-ID"]=new Array(P+1).join(".");let U=new br(u);n[L]=U,s.push(U)}else n[L].addGroupId("audio",f.AUDIO),n[L].addGroupId("text",f.SUBTITLES);else{let P=new br(u);n[L]=P,a[L]=1,s.push(P)}}),this.filterAndSortMediaOptions(s,t,o,l,d)}filterAndSortMediaOptions(e,t,r,s,n){let a=[],o=[],l=e;if((r||s)&&n&&(l=l.filter(({videoCodec:m,videoRange:p,width:g,height:E})=>(!!m||!!(g&&E))&&aI(p))),l.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)}`);let m=new Error("no level with compatible codecs found in manifest");this.hls.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:m,reason:m.message})}});return}if(t.audioTracks){let{preferManagedMediaSource:m}=this.hls.config;a=t.audioTracks.filter(p=>!p.audioCodec||nf(p.audioCodec,"audio",m)),_b(a)}t.subtitles&&(o=t.subtitles,_b(o));let d=l.slice(0);l.sort((m,p)=>{if(m.attrs["HDCP-LEVEL"]!==p.attrs["HDCP-LEVEL"])return(m.attrs["HDCP-LEVEL"]||"")>(p.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&m.height!==p.height)return m.height-p.height;if(m.frameRate!==p.frameRate)return m.frameRate-p.frameRate;if(m.videoRange!==p.videoRange)return Id.indexOf(m.videoRange)-Id.indexOf(p.videoRange);if(m.videoCodec!==p.videoCodec){let g=UE(m.videoCodec),E=UE(p.videoCodec);if(g!==E)return E-g}if(m.uri===p.uri&&m.codecSet!==p.codecSet){let g=xd(m.codecSet),E=xd(p.codecSet);if(g!==E)return E-g}return m.averageBitrate!==p.averageBitrate?m.averageBitrate-p.averageBitrate:0});let u=d[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==d.length)){for(let m=0;m<d.length;m++)if(d[m].pathwayId===l[0].pathwayId){u=d[m];break}}this._levels=l;for(let m=0;m<l.length;m++)if(l[m]===u){var c;this._firstLevel=m;let p=u.bitrate,g=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${p}`),((c=this.hls.userConfig)==null?void 0:c.abrEwmaDefaultEstimate)===void 0){let E=Math.min(p,this.hls.config.abrEwmaDefaultEstimateMax);E>g&&g===_y.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=E)}break}let h=n&&!s,f={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:s,altAudio:!h&&a.some(m=>!!m.url)};this.hls.trigger(v.MANIFEST_PARSED,f),(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){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let u=new Error("invalid level idx"),c=e<0;if(this.hls.trigger(v.ERROR,{type:le.OTHER_ERROR,details:C.LEVEL_SWITCH_ERROR,level:e,fatal:c,error:u,reason:u.message}),c)return;e=Math.min(e,t.length-1)}let r=this.currentLevelIndex,s=this.currentLevel,n=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,r===e&&a.details&&s&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${r}${n?" with Pathway "+n:""}`);let l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(v.LEVEL_SWITCHING,l);let d=a.details;if(!d||d.live){let u=this.switchParams(a.uri,s==null?void 0:s.details,d);this.loadPlaylist(u)}}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){let 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===Ae.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===se.MAIN){let r=t.elementaryStreams;if(!Object.keys(r).some(n=>!!r[n]))return;let s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var r;let{level:s,details:n}=t,a=this._levels[s];if(!a){var o;this.warn(`Invalid level index ${s}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}s===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(s,t,a.details)):(r=t.deliveryDirectives)!=null&&r.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();let t=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){let s=r.uri;if(e)try{s=e.addDirectives(s)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}let n=r.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${n?" Pathway "+n:""} ${s}`),this.clearTimer(),this.hls.trigger(v.LEVEL_LOADING,{url:s,level:t,pathwayId:r.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;let r=this._levels.filter((s,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(a=>a.level=-1)),!1));Kb(r),this._levels=r,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(v.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(v.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}};function _b(i){let e={};i.forEach(t=>{let r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++})}var Rm=class{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let r in this.keyUriToKeyInfo){let s=this.keyUriToKeyInfo[r].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.abort()}}}detach(){for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=C.KEY_LOAD_ERROR,r,s,n){return new di({type:le.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:r,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){let{sn:r,cc:s}=e;for(let n=0;n<t.length;n++){let a=t[n];if(s<=a.cc&&(r==="initSegment"||a.sn==="initSegment"||r<a.sn)){this.emeController.selectKeySystemFormat(a).then(o=>{a.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var r,s;t&&e.setKeyFormat(t);let n=e.decryptdata;if(!n){let d=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,C.KEY_LOAD_ERROR,d))}let a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((r=o)!=null&&r.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((s=o)!=null&&s.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(d=>(n.key=d.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,C.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){let r={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){let s=this.emeController.loadKey(r);if(s)return(e.keyLoadPromise=s.then(n=>(e.mediaKeySessionContext=n,r))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(r)}loadKeyHTTP(e,t){let r=this.config,s=r.loader,n=new s(r);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{let l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=r.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{let{frag:g,keyInfo:E,url:b}=m;if(!g.decryptdata||E!==this.keyUriToKeyInfo[b])return o(this.createKeyLoadError(g,C.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));E.decryptdata.key=g.decryptdata.key=new Uint8Array(h.data),g.keyLoader=null,E.loader=null,a({frag:g,keyInfo:E})},onError:(h,f,m,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),m,mt({url:l.url,data:void 0},h)))},onTimeout:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,C.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};n.load(l,u,c)})}resetLoader(e){let{frag:t,keyInfo:r,url:s}=e,n=r.loader;t.keyLoader===n&&(t.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[s],n&&n.destroy()}};function Ay(){return self.SourceBuffer||self.WebKitSourceBuffer}function Sy(){if(!ls())return!1;let e=Ay();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function SL(){if(!Sy())return!1;let i=ls();return typeof(i==null?void 0:i.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Ca(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Ca(e,"audio"))))}function xL(){var i;let e=Ay();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}var RL=250,yd=2,IL=.1,kL=.05,Im=class{constructor(e,t,r,s){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=r,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){let{config:r,media:s,stalled:n}=this;if(s===null)return;let{currentTime:a,seeking:o}=s,l=this.seeking&&!o,d=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),n!==null){if(this.stallReported){let g=self.performance.now()-n;k.warn(`playback not stuck anymore @${a}, after ${Math.round(g)}ms`),this.stallReported=!1}this.stalled=null}return}if(d||l){this.stalled=null;return}if(s.paused&&!o||s.ended||s.playbackRate===0||!Ge.getBuffered(s).length){this.nudgeRetry=0;return}let u=Ge.bufferInfo(s,a,0),c=u.nextStart||0;if(o){let g=u.len>yd,E=!c||t&&t.start<=a||c-a>yd&&!this.fragmentTracker.getPartialFragment(a);if(g||E)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(u.len>0)&&!c)return;let E=Math.max(c,u.start||0)-a,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=(b==null||(h=b.details)==null?void 0:h.live)?b.details.targetduration*2:yd,A=this.fragmentTracker.getPartialFragment(a);if(E>0&&(E<=_||A)){s.paused||this._trySkipBufferHole(A);return}}let f=self.performance.now();if(n===null){this.stalled=f;return}let m=f-n;if(!o&&m>=RL&&(this._reportStall(u),!this.media))return;let p=Ge.bufferInfo(s,a,r.maxBufferHole);this._tryFixBufferStall(p,m)}_tryFixBufferStall(e,t){let{config:r,fragmentTracker:s,media:n}=this;if(n===null)return;let a=n.currentTime,o=s.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>r.maxBufferHole||e.nextStart&&e.nextStart-a<r.maxBufferHole)&&t>r.highBufferWatchdogPeriod*1e3&&(k.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){let{hls:t,media:r,stallReported:s}=this;if(!s&&r){this.stallReported=!0;let n=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${JSON.stringify(e)})`);k.warn(n.message),t.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){let{config:t,hls:r,media:s}=this;if(s===null)return 0;let n=s.currentTime,a=Ge.bufferInfo(s,n,0),o=n<a.start?a.start:a.nextStart;if(o){let l=a.len<=t.maxBufferHole,d=a.len>0&&a.len<1&&s.readyState<3,u=o-n;if(u>0&&(l||d)){if(u>t.maxBufferHole){let{fragmentTracker:h}=this,f=!1;if(n===0){let m=h.getAppendedFrag(0,se.MAIN);m&&o<m.end&&(f=!0)}if(!f){let m=e||h.getAppendedFrag(n,se.MAIN);if(m){let p=!1,g=m.end;for(;g<o;){let E=h.getPartialFragment(g);if(E)g+=E.duration;else{p=!0;break}}if(p)return 0}}}let c=Math.max(o+kL,n+IL);if(k.warn(`skipping hole, adjusting currentTime from ${n} to ${c}`),this.moved=!0,this.stalled=null,s.currentTime=c,e&&!e.gap){let h=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${c}`);r.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return c}}return 0}_tryNudgeBuffer(){let{config:e,hls:t,media:r,nudgeRetry:s}=this;if(r===null)return;let n=r.currentTime;if(this.nudgeRetry++,s<e.nudgeMaxRetry){let a=n+(s+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);k.warn(o.message),r.currentTime=a,t.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{let a=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);k.error(a.message),t.trigger(v.ERROR,{type:le.MEDIA_ERROR,details:C.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}},LL=100,km=class extends Na{constructor(e,t,r){super(e,t,r,"[stream-controller]",se.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(){let{hls:e}=this;e.on(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(v.MANIFEST_LOADING,this.onManifestLoading,this),e.on(v.MANIFEST_PARSED,this.onManifestParsed,this),e.on(v.LEVEL_LOADING,this.onLevelLoading,this),e.on(v.LEVEL_LOADED,this.onLevelLoaded,this),e.on(v.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(v.ERROR,this.onError,this),e.on(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(v.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(v.BUFFER_CREATED,this.onBufferCreated,this),e.on(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(v.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){let{hls:e}=this;e.off(v.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(v.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(v.MANIFEST_LOADING,this.onManifestLoading,this),e.off(v.MANIFEST_PARSED,this.onManifestParsed,this),e.off(v.LEVEL_LOADED,this.onLevelLoaded,this),e.off(v.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(v.ERROR,this.onError,this),e.off(v.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(v.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(v.BUFFER_CREATED,this.onBufferCreated,this),e.off(v.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(v.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(v.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){let{lastCurrentTime:t,hls:r}=this;if(this.stopLoad(),this.setInterval(LL),this.level=-1,!this.startFragRequested){let s=r.startLevel;s===-1&&(r.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=r.firstAutoLevel),r.nextLoadLevel=s,this.level=r.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=O.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=O.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case O.WAITING_LEVEL:{let{levels:t,level:r}=this,s=t==null?void 0:t[r],n=s==null?void 0:s.details;if(n&&(!n.live||this.levelLastLoaded===s)){if(this.waitForCdnTuneIn(n))break;this.state=O.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=O.IDLE;break}break}case O.FRAG_LOADING_WAITING_RETRY:{var e;let t=self.performance.now(),r=this.retryDate;if(!r||t>=r||(e=this.media)!=null&&e.seeking){let{levels:s,level:n}=this,a=s==null?void 0:s[n];this.resetStartWhenNotLoaded(a||null),this.state=O.IDLE}}break}this.state===O.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:r,media:s}=this;if(t===null||!s&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(r!=null&&r[n]))return;let a=r[n],o=this.getMainFwdBufferInfo();if(o===null)return;let l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){let p={};this.altAudio&&(p.type="video"),this.hls.trigger(v.BUFFER_EOS,p),this.state=O.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;let d=a.details;if(!d||this.state===O.WAITING_LEVEL||d.live&&this.levelLastLoaded!==a){this.level=n,this.state=O.WAITING_LEVEL;return}let u=o.len,c=this.getMaxBufferLength(a.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);let h=this.backtrackFragment?this.backtrackFragment.start:o.end,f=this.getNextFragment(h,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&f.sn!=="initSegment"&&this.fragmentTracker.getState(f)!==ft.OK){var m;let g=((m=this.backtrackFragment)!=null?m:f).sn-d.startSN,E=d.fragments[g-1];E&&f.cc===E.cc&&(f=E,this.fragmentTracker.removeFragment(E))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,h)){if(!f.gap){let g=this.audioOnly&&!this.altAudio?De.AUDIO:De.VIDEO,E=(g===De.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;E&&this.afterBufferFlushed(E,g,se.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,se.MAIN,c)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,h))}loadFragment(e,t,r){let s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===ft.NOT_LOADED||s===ft.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,r)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,se.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let r,s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);let n=this.getLevelDetails();if(n!=null&&n.live){let o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){let o=this.hls.nextLoadLevel,l=e[o],d=this.fragLastKbps;d&&this.fragCurrent?r=this.fragCurrent.duration*l.maxBitrate/(1e3*d)+1:r=0}else r=0;let a=this.getBufferedFrag(t.currentTime+r);if(a){let o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();let l=o.maxStartPTS?o.maxStartPTS:o.start,d=o.duration,u=Math.max(a.end,l+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case O.KEY_LOADING:case O.FRAG_LOADING:case O.FRAG_LOADING_WAITING_RETRY:case O.PARSING:case O.PARSED:this.state=O.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let r=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new Im(this.config,r,this.fragmentTracker,this.hls)}onMediaDetaching(){let{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(){let e=this.media,t=e?e.currentTime:null;z(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);let r=this.getMainFwdBufferInfo();if(r===null||r.len===0){this.warn(`Main forward buffer length on "seeked" event ${r?r.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(v.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 r=!1,s=!1;t.levels.forEach(n=>{let a=n.audioCodec;a&&(r=r||a.indexOf("mp4a.40.2")!==-1,s=s||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=r&&s&&!xL(),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){let{levels:r}=this;if(!r||this.state!==O.IDLE)return;let s=r[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=O.WAITING_LEVEL)}onLevelLoaded(e,t){var r;let{levels:s}=this,n=t.level,a=t.details,o=a.totalduration;if(!s){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);let l=s[n],d=this.fragCurrent;d&&(this.state===O.FRAG_LOADING||this.state===O.FRAG_LOADING_WAITING_RETRY)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let u=0;if(a.live||(r=l.details)!=null&&r.live){var c;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;u=this.alignPlaylists(a,l.details,(c=this.levelLastLoaded)==null?void 0:c.details)}if(l.details=a,this.levelLastLoaded=l,this.hls.trigger(v.LEVEL_UPDATED,{details:a,level:n}),this.state===O.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=O.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,u),this.tick()}_handleFragmentLoadProgress(e){var t;let{frag:r,part:s,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}let o=a[r.level],l=o.details;if(!l){this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),this.fragmentTracker.removeFragment(r);return}let d=o.videoCodec,u=l.PTSKnown||!l.live,c=(t=r.initSegment)==null?void 0:t.data,h=this._getAudioCodec(o),f=this.transmuxer=this.transmuxer||new $d(this.hls,se.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=s?s.index:-1,p=m!==-1,g=new Pa(r.level,r.sn,r.stats.chunkCount,n.byteLength,m,p),E=this.initPTS[r.cc];f.push(n,c,h,d,r,s,l.totalduration,u,g,E)}onAudioTrackSwitching(e,t){let r=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;let a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();let n=this.hls;r&&(n.trigger(v.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(v.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let r=t.id,s=!!this.hls.audioTracks[r].url;if(s){let n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=s,this.tick()}onBufferCreated(e,t){let r=t.tracks,s,n,a=!1;for(let o in r){let l=r[o];if(l.id==="main"){if(n=o,s=l,o==="video"){let d=r[o];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:r,part:s}=t;if(r&&r.type!==se.MAIN)return;if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),this.state===O.PARSED&&(this.state=O.IDLE);return}let n=s?s.stats:r.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,s)}onError(e,t){var r;if(t.fatal){this.state=O.ERROR;return}switch(t.details){case C.FRAG_GAP:case C.FRAG_PARSING_ERROR:case C.FRAG_DECRYPT_ERROR:case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(se.MAIN,t);break;case C.LEVEL_LOAD_ERROR:case C.LEVEL_LOAD_TIMEOUT:case C.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===O.WAITING_LEVEL&&((r=t.context)==null?void 0:r.type)===Ae.LEVEL&&(this.state=O.IDLE);break;case C.BUFFER_APPEND_ERROR:case C.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===C.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case C.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){let{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ge.getBuffered(e).length){let r=this.state!==O.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,r)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=O.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==De.AUDIO||this.audioOnly&&!this.altAudio){let r=(t===De.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,t,se.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(){let{media:e}=this;if(!e)return;let t=e.currentTime,r=this.startPosition;if(r>=0&&t<r){if(e.seeking){this.log(`could not seek to ${r}, already seeking at ${t}`);return}let s=Ge.getBuffered(e),a=(s.length?s.start(0):0)-r;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),r+=a,this.startPosition=r),this.log(`seek to target start position ${r} from current time ${t}`),e.currentTime=r}}_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(r=>{let{hls:s}=this;if(!r||this.fragContextChanged(e))return;t.fragmentError=0,this.state=O.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),s.trigger(v.FRAG_LOADED,r),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;let r="main",{hls:s}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}let{frag:l,part:d,level:u}=o,{video:c,text:h,id3:f,initSegment:m}=n,{details:p}=u,g=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=O.PARSING,m){if(m!=null&&m.tracks){let T=l.initSegment||l;this._bufferInitSegment(u,m.tracks,T,a),s.trigger(v.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:r,tracks:m.tracks})}let E=m.initPTS,b=m.timescale;z(E)&&(this.initPTS[l.cc]={baseTime:E,timescale:b},s.trigger(v.INIT_PTS_FOUND,{frag:l,id:r,initPTS:E,timescale:b}))}if(c&&p&&l.sn!=="initSegment"){let E=p.fragments[l.sn-1-p.startSN],b=l.sn===p.startSN,T=!E||l.cc>E.cc;if(n.independent!==!1){let{startPTS:_,endPTS:A,startDTS:R,endDTS:S}=c;if(d)d.elementaryStreams[c.type]={startPTS:_,endPTS:A,startDTS:R,endDTS:S};else if(c.firstKeyFrame&&c.independent&&a.id===1&&!T&&(this.couldBacktrack=!0),c.dropped&&c.independent){let D=this.getMainFwdBufferInfo(),M=(D?D.end:this.getLoadPosition())+this.config.maxBufferHole,L=c.firstKeyFramePTS?c.firstKeyFramePTS:_;if(!b&&M<L-this.config.maxBufferHole&&!T){this.backtrack(l);return}else T&&(l.gap=!0);l.setElementaryStreamInfo(c.type,l.start,A,l.start,S,!0)}else b&&_>yd&&(l.gap=!0);l.setElementaryStreamInfo(c.type,_,A,R,S),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(c,l,d,a,b||T)}else if(b||T)l.gap=!0;else{this.backtrack(l);return}}if(g){let{startPTS:E,endPTS:b,startDTS:T,endDTS:_}=g;d&&(d.elementaryStreams[De.AUDIO]={startPTS:E,endPTS:b,startDTS:T,endDTS:_}),l.setElementaryStreamInfo(De.AUDIO,E,b,T,_),this.bufferFragmentData(g,l,d,a)}if(p&&f!=null&&(t=f.samples)!=null&&t.length){let E={id:r,frag:l,details:p,samples:f.samples};s.trigger(v.FRAG_PARSING_METADATA,E)}if(p&&h){let E={id:r,frag:l,details:p,samples:h.samples};s.trigger(v.FRAG_PARSING_USERDATA,E)}}_bufferInitSegment(e,t,r,s){if(this.state!==O.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;let{audio:n,video:a,audiovideo:o}=t;if(n){let l=e.audioCodec,d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");let u=n.metadata;u&&"channelCount"in u&&(u.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),n.levelCodec=l,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${n.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(v.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{let u=t[l].initSegment;u!=null&&u.byteLength&&this.hls.trigger(v.BUFFER_APPENDING,{type:l,data:u,frag:r,part:null,chunkMeta:s,parent:r.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,se.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=O.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let r=e.currentTime;if(Ge.isBuffered(e,r)?t=this.getAppendedFrag(r):Ge.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){this.backtrackFragment=null;let s=this.fragPlaying,n=t.level;(!s||t.sn!==s.sn||s.level!==n)&&(this.fragPlaying=t,this.hls.trigger(v.FRAG_CHANGED,{frag:t}),(!s||s.level!==n)&&this.hls.trigger(v.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){let e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){let e=this.media;if(e){let t=e.currentTime,r=this.currentFrag;if(r&&z(t)&&z(r.programDateTime)){let s=r.programDateTime+(t-r.start)*1e3;return new Date(s)}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},$a=class i{static get version(){return"1.5.20"}static isMSESupported(){return Sy()}static isSupported(){return SL()}static getMediaSource(){return ls()}static get Events(){return v}static get ErrorTypes(){return le}static get ErrorDetails(){return C}static get DefaultConfig(){return i.defaultConfig?i.defaultConfig:_y}static set DefaultConfig(e){i.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 Um,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,dR(e.debug||!1,"Hls instance");let t=this.config=_L(i.DefaultConfig,e);this.userConfig=e,t.progressive&&AL(t);let{abrController:r,bufferController:s,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),d=this.abrController=new r(this),u=this.bufferController=new s(this),c=this.capLevelController=new n(this),h=new o(this),f=new xf(this),m=new kf(this),p=t.contentSteeringController,g=p?new p(this):null,E=this.levelController=new xm(this,g),b=new Uf(this),T=new Rm(this.config),_=this.streamController=new km(this,b,T);c.setStreamController(_),h.setStreamController(_);let A=[f,E,_];g&&A.splice(1,0,g),this.networkControllers=A;let R=[d,u,c,h,m,b];this.audioTrackController=this.createController(t.audioTrackController,A);let S=t.audioStreamController;S&&A.push(new S(this,b,T)),this.subtitleTrackController=this.createController(t.subtitleTrackController,A);let D=t.subtitleStreamController;D&&A.push(new D(this,b,T)),this.createController(t.timelineController,R),T.emeController=this.emeController=this.createController(t.emeController,R),this.cmcdController=this.createController(t.cmcdController,R),this.latencyController=this.createController(Lf,R),this.coreComponents=R,A.push(l);let M=l.onErrorOut;typeof M=="function"&&this.on(v.ERROR,M,l)}createController(e,t){if(e){let r=new e(this);return t&&t.push(r),r}return null}on(e,t,r=this){this._emitter.on(e,t,r)}once(e,t,r=this){this._emitter.once(e,t,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,r=this,s){this._emitter.off(e,t,r,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,r){return this._emitter.emit(e,t,r)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(r){if(k.error("An internal error happened while handling event "+e+'. Error message: "'+r.message+'". Here is a stacktrace:',r),!this.triggeringException){this.triggeringException=!0;let s=e===v.ERROR;this.trigger(v.ERROR,{type:le.OTHER_ERROR,details:C.INTERNAL_EXCEPTION,fatal:s,event:e,error:r}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){k.log("destroy"),this.trigger(v.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;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){k.log("attachMedia"),this._media=e,this.trigger(v.MEDIA_ATTACHING,{media:e})}detachMedia(){k.log("detachMedia"),this.trigger(v.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();let t=this.media,r=this.url,s=this.url=Lm.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,k.log(`loadSource:${s}`),t&&r&&(r!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(v.MANIFEST_LOADING,{url:e})}startLoad(e=-1){k.log(`startLoad(${e})`),this.started=!0,this.resumeBuffering();for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(e),!(!this.started||!this.networkControllers));t++);}stopLoad(){k.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}resumeBuffering(){k.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()})}pauseBuffering(){k.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()})}swapAudioCodec(){k.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){k.log("recoverMediaError");let e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){let e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){k.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){k.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){k.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){k.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){k.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){let 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(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(k.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){nI(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(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let r=e.length;for(let s=0;s<r;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){let{levels:e,autoLevelCapping:t,maxHdcpLevel:r}=this,s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,r)for(let n=s;n--;){let a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=r)return n}return s}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(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){let 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}};$a.defaultConfig=void 0;var Te=$a,Ue={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},te={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},Ga=i=>i===Ue.VIDEO?"playback":i,yr=class Ha extends Error{constructor(e,t=Ha.MEDIA_ERR_CUSTOM,r,s){var n;super(e),this.name="MediaError",this.code=t,this.context=s,this.fatal=r!=null?r:t>=Ha.MEDIA_ERR_NETWORK&&t<=Ha.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(n=Ha.defaultMessages[this.code])!=null?n:"")}};yr.MEDIA_ERR_ABORTED=1,yr.MEDIA_ERR_NETWORK=2,yr.MEDIA_ERR_DECODE=3,yr.MEDIA_ERR_SRC_NOT_SUPPORTED=4,yr.MEDIA_ERR_ENCRYPTED=5,yr.MEDIA_ERR_CUSTOM=100,yr.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var V=yr,wL=i=>i==null,zm=(i,e)=>wL(e)?!1:i in e,Km={ANY:"any",MUTED:"muted"},Re={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},jt={MSE:"mse",NATIVE:"native"},zd={HEADER:"header",QUERY:"query",NONE:"none"},In=Object.values(zd),tr={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Vm={HLS:tr.M3U8},WN=Object.keys(Vm),YN=[...Object.values(tr),"hls","HLS"];var DL="en",Wm={code:DL},tt=(i,e,t,r,s=i)=>{s.addEventListener(e,t,r),i.addEventListener("teardown",()=>{s.removeEventListener(e,t)},{once:!0})};function CL(i,e,t){e&&t>e&&(t=e);for(let r=0;r<i.length;r++)if(i.start(r)<=t&&i.end(r)>=t)return!0;return!1}var eu=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),r=i.slice(e);return[t,r]},tu=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return zm(t,Vm)?Vm[t]:e}return ML(i)},Py=i=>i==="VOD"?Re.ON_DEMAND:Re.LIVE,Oy=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,ML=i=>{let{src:e}=i;if(!e)return"";let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let r=t.lastIndexOf(".");if(r<0)return OL(i)?tr.M3U8:"";let s=t.slice(r+1).toUpperCase();return zm(s,tr)?tr[s]:""},PL="mux.com",OL=({src:i,customDomain:e=PL})=>{let t;try{t=new URL(`${i}`)}catch{return!1}let r=t.protocol==="https:",s=t.hostname===`stream.${e}`.toLowerCase(),n=t.pathname.split("/"),a=n.length===2,o=!(n!=null&&n[1].includes("."));return r&&s&&a&&o},_r=i=>{let e=(i!=null?i:"").split(".")[1];if(e)try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(s){return"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}catch{return}},NL=({exp:i},e=Date.now())=>!i||i*1e3<e,UL=({sub:i},e)=>i!==e,FL=({aud:i},e)=>!i,BL=({aud:i},e)=>i!==e,Ny="en";function X(i,e=!0){var t,r;let s=e&&(r=(t=Wm)==null?void 0:t[i])!=null?r:i,n=e?Wm.code:Ny;return new $L(s,n)}var $L=class{constructor(i,e=(t=>(t=Wm)!=null?t:Ny)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,t)=>{var r;return(r=i[t])!=null?r:""})}toString(){return this.message}},HL=Object.values(Km),xy=i=>typeof i=="boolean"||typeof i=="string"&&HL.includes(i),GL=(i,e,t)=>{let{autoplay:r}=i,s=!1,n=!1,a=xy(r)?r:!!r,o=()=>{s||tt(e,"playing",()=>{s=!0},{once:!0})};if(o(),tt(e,"loadstart",()=>{s=!1,o(),Hm(e,a)},{once:!0}),tt(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==Re.UNKNOWN?n=i.streamType===Re.LIVE:n=!Number.isFinite(e.duration)),Hm(e,a)},{once:!0}),t&&t.once(Te.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==Re.UNKNOWN?n=i.streamType===Re.LIVE:n=(u=d.details.live)!=null?u:!1}),!a){let l=()=>{!n||Number.isFinite(i.startTime)||(t!=null&&t.liveSyncPosition?e.currentTime=t.liveSyncPosition:Number.isFinite(e.seekable.end(0))&&(e.currentTime=e.seekable.end(0)))};t&&tt(e,"play",()=>{e.preload==="metadata"?t.once(Te.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{s||(a=xy(l)?l:!!l,Hm(e,a))}},Hm=(i,e)=>{if(!e)return;let t=i.muted,r=()=>i.muted=t;switch(e){case Km.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(r)});break;case Km.MUTED:i.muted=!0,i.play().catch(r);break;default:i.play().catch(()=>{});break}},KL=({preload:i,src:e},t,r)=>{let s=c=>{c!=null&&["","none","metadata","auto"].includes(c)?t.setAttribute("preload",c):t.removeAttribute("preload")};if(!r)return s(i),s;let n=!1,a=!1,o=r.config.maxBufferLength,l=r.config.maxBufferSize,d=c=>{s(c);let h=c!=null?c:t.preload;a||h==="none"||(h==="metadata"?(r.config.maxBufferLength=1,r.config.maxBufferSize=1):(r.config.maxBufferLength=o,r.config.maxBufferSize=l),u())},u=()=>{!n&&e&&(n=!0,r.loadSource(e))};return tt(t,"play",()=>{a=!0,r.config.maxBufferLength=o,r.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function VL(i,e){var t;if(!("videoTracks"in i))return;let r=new WeakMap;e.on(Te.Events.MANIFEST_PARSED,function(d,u){l();let c=i.addVideoTrack("main");c.selected=!0;for(let[h,f]of u.levels.entries()){let m=c.addRendition(f.url[0],f.width,f.height,f.videoCodec,f.bitrate);r.set(f,`${h}`),m.id=`${h}`}}),e.on(Te.Events.AUDIO_TRACKS_UPDATED,function(d,u){o();for(let c of u.audioTracks){let h=c.default?"main":"alternative",f=i.addAudioTrack(h,c.name,c.lang);f.id=`${c.id}`,c.default&&(f.enabled=!0)}}),i.audioTracks.addEventListener("change",()=>{var d;let u=+((d=[...i.audioTracks].find(h=>h.enabled))==null?void 0:d.id),c=e.audioTracks.map(h=>h.id);u!=e.audioTrack&&c.includes(u)&&(e.audioTrack=u)}),e.on(Te.Events.LEVELS_UPDATED,function(d,u){var c;let h=i.videoTracks[(c=i.videoTracks.selectedIndex)!=null?c:0];if(!h)return;let f=u.levels.map(m=>r.get(m));for(let m of i.videoRenditions)m.id&&!f.includes(m.id)&&h.removeRendition(m)});let s=d=>{let u=d.target.selectedIndex;u!=e.nextLevel&&n(u)},n=d=>{let u=i.currentTime,c=!1,h=(f,m)=>{c||(c=!Number.isFinite(m.endOffset))};e.on(Te.Events.BUFFER_FLUSHING,h),e.nextLevel=d,e.off(Te.Events.BUFFER_FLUSHING,h),c||e.trigger(Te.Events.BUFFER_FLUSHING,{startOffset:u+10,endOffset:1/0,type:"video"})};(t=i.videoRenditions)==null||t.addEventListener("change",s);let a=()=>{for(let d of i.videoTracks)i.removeVideoTrack(d)},o=()=>{for(let d of i.audioTracks)i.removeAudioTrack(d)},l=()=>{a(),o()};e.once(Te.Events.DESTROYING,l)}var Gm=i=>"time"in i?i.time:i.startTime;function WL(i,e){e.on(Te.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(s,{tracks:n})=>{n.forEach(a=>{var o,l;let d=(o=a.subtitleTrack)!=null?o:a.closedCaptions,u=e.subtitleTracks.findIndex(({lang:h,name:f,type:m})=>h==(d==null?void 0:d.lang)&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;iu(i,a.kind,a.label,d==null?void 0:d.lang,c,a.default)})});let t=()=>{if(!e.subtitleTracks.length)return;let s=Array.from(i.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind));if(!s)return;let n=e.subtitleTracks[e.subtitleTrack],a=n?n.default?"default":`${e.subtitleTracks[e.subtitleTrack].type.toLowerCase()}${e.subtitleTrack}`:void 0;if(e.subtitleTrack<0||(s==null?void 0:s.id)!==a){let o=e.subtitleTracks.findIndex(({lang:l,name:d,type:u,default:c})=>s.id==="default"&&c||l==s.language&&d===s.label&&u.toLowerCase()===s.kind);e.subtitleTrack=o}(s==null?void 0:s.id)===a&&s.cues&&Array.from(s.cues).forEach(o=>{s.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(Te.Events.CUES_PARSED,(s,{track:n,cues:a})=>{let o=i.textTracks.getTrackById(n);if(!o)return;let l=o.mode==="disabled";l&&(o.mode="hidden"),a.forEach(d=>{var u;(u=o.cues)!=null&&u.getCueById(d.id)||o.addCue(d)}),l&&(o.mode="disabled")}),e.once(Te.Events.DESTROYING,()=>{i.textTracks.removeEventListener("change",t),i.querySelectorAll("track[data-removeondestroy]").forEach(s=>{s.remove()})});let r=()=>{Array.from(i.textTracks).forEach(s=>{var n,a;if(!["subtitles","caption"].includes(s.kind)&&(s.label==="thumbnails"||s.kind==="chapters")){if(!((n=s.cues)!=null&&n.length)){let o="track";s.kind&&(o+=`[kind="${s.kind}"]`),s.label&&(o+=`[label="${s.label}"]`);let l=i.querySelector(o),d=(a=l==null?void 0:l.getAttribute("src"))!=null?a:"";l==null||l.removeAttribute("src"),setTimeout(()=>{l==null||l.setAttribute("src",d)},0)}s.mode!=="hidden"&&(s.mode="hidden")}})};e.once(Te.Events.MANIFEST_LOADED,r),e.once(Te.Events.MEDIA_ATTACHED,r)}function iu(i,e,t,r,s,n){let a=document.createElement("track");return a.kind=e,a.label=t,r&&(a.srclang=r),s&&(a.id=s),n&&(a.default=!0),a.track.mode=["subtitles","captions"].includes(e)?"disabled":"hidden",a.setAttribute("data-removeondestroy",""),i.append(a),a.track}function Uy(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),r=>r.track===e);t==null||t.remove()}function Ka(i,e,t){var r;return(r=Array.from(i.querySelectorAll("track")).find(s=>s.track.label===e&&s.track.kind===t))==null?void 0:r.track}async function Fy(i,e,t,r){let s=Ka(i,t,r);return s||(s=iu(i,r,t),s.mode="hidden",await new Promise(n=>setTimeout(()=>n(void 0),0))),s.mode!=="hidden"&&(s.mode="hidden"),[...e].sort((n,a)=>Gm(a)-Gm(n)).forEach(n=>{var a,o;let l=n.value,d=Gm(n);if("endTime"in n&&n.endTime!=null)s==null||s.addCue(new VTTCue(d,n.endTime,r==="chapters"?l:JSON.stringify(l!=null?l:null)));else{let u=Array.prototype.findIndex.call(s==null?void 0:s.cues,m=>m.startTime>=d),c=(a=s==null?void 0:s.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=s==null?void 0:s.cues)==null?void 0:o[u-1];f&&(f.endTime=d),s==null||s.addCue(new VTTCue(d,h,r==="chapters"?l:JSON.stringify(l!=null?l:null)))}}),i.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),s}var Xm="cuepoints",By=Object.freeze({label:Xm});async function Qm(i,e,t=By){return Fy(i,e,t.label,"metadata")}var Ym=i=>({time:i.startTime,value:JSON.parse(i.text)});function $y(i,e={label:Xm}){let t=Ka(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,r=>Ym(r)):[]}function Zm(i,e={label:Xm}){var t,r;let s=Ka(i,e.label,"metadata");if(!((t=s==null?void 0:s.activeCues)!=null&&t.length))return;if(s.activeCues.length===1)return Ym(s.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((r=s.activeCues)!=null?r:[],({startTime:o,endTime:l})=>o<=n&&l>n);return Ym(a||s.activeCues[0])}async function YL(i,e=By){return new Promise(t=>{tt(i,"loadstart",async()=>{let r=await Qm(i,[],e);tt(i,"cuechange",()=>{let s=Zm(i);if(s){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:s});i.dispatchEvent(n)}},{},r),t(r)})})}var Jm="chapters",Hy=Object.freeze({label:Jm}),qm=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function ep(i,e,t=Hy){return Fy(i,e,t.label,"chapters")}function Gy(i,e={label:Jm}){var t;let r=Ka(i,e.label,"chapters");return(t=r==null?void 0:r.cues)!=null&&t.length?Array.from(r.cues,s=>qm(s)):[]}function tp(i,e={label:Jm}){var t,r;let s=Ka(i,e.label,"chapters");if(!((t=s==null?void 0:s.activeCues)!=null&&t.length))return;if(s.activeCues.length===1)return qm(s.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((r=s.activeCues)!=null?r:[],({startTime:o,endTime:l})=>o<=n&&l>n);return qm(a||s.activeCues[0])}async function qL(i,e=Hy){return new Promise(t=>{tt(i,"loadstart",async()=>{let r=await ep(i,[],e);tt(i,"cuechange",()=>{let s=tp(i);if(s){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:s});i.dispatchEvent(n)}},{},r),t(r)})})}function Ky(i,e){if(e){let t=e.playingDate;if(t!=null)return new Date(t.getTime()-i.currentTime*1e3)}return typeof i.getStartDate=="function"?i.getStartDate():new Date(NaN)}function Vy(i,e){if(e&&e.playingDate)return e.playingDate;if(typeof i.getStartDate=="function"){let t=i.getStartDate();return new Date(t.getTime()+i.currentTime*1e3)}return new Date(NaN)}var Rn={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},jL=i=>{if(i===Ue.VIDEO)return Rn.VIDEO;if(i===Ue.DRM)return Rn.DRM},zL=(i,e)=>{var t,r;let s=Ga(i),n=`${s}Token`;return(t=e.tokens)!=null&&t[s]?(r=e.tokens)==null?void 0:r[s]:zm(n,e)?e[n]:void 0},Zd=(i,e,t,r=!1,s=!(n=>(n=globalThis.navigator)==null?void 0:n.onLine)())=>{var n,a;if(s){let g=X("Your device appears to be offline",r),E,b=V.MEDIA_ERR_NETWORK,T=new V(g,b,!0,E);return T.errorCategory=e,T.muxCode=te.NETWORK_OFFLINE,T.data=i,T}let o="status"in i?i.status:i.code,l=Date.now(),d=V.MEDIA_ERR_NETWORK;if(o===200)return;let u=Ga(e),c=zL(e,t),h=jL(e),[f]=eu((n=t.playbackId)!=null?n:"");if(!o||!f)return;let m=_r(c);if(c&&!m){let g=X("The {tokenNamePrefix}-token provided is invalid or malformed.",r).format({tokenNamePrefix:u}),E=X("Compact JWT string: {token}",r).format({token:c}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_MALFORMED,b.data=i,b}if(o>=500){let g=new V("",d,!0);return g.errorCategory=e,g.muxCode=te.NETWORK_UNKNOWN_ERROR,g}if(o===403)if(m){if(NL(m,l)){let g={timeStyle:"medium",dateStyle:"medium"},E=X("The video\u2019s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:u}),b=X("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat("en",g).format((a=m.exp)!=null?a:0*1e3),currentDate:new Intl.DateTimeFormat("en",g).format(l)}),T=new V(E,d,!0,b);return T.errorCategory=e,T.muxCode=te.NETWORK_TOKEN_EXPIRED,T.data=i,T}if(UL(m,f)){let g=X("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:u}),E=X("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",r).format({tokenNamePrefix:u,playbackId:f,tokenPlaybackId:m.sub}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_SUB_MISMATCH,b.data=i,b}if(FL(m,h)){let g=X("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:u}),E=X("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",r).format({tokenNamePrefix:u,expectedAud:h}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_AUD_MISSING,b.data=i,b}if(BL(m,h)){let g=X("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:u}),E=X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",r).format({tokenNamePrefix:u,expectedAud:h,aud:m.aud}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_AUD_MISMATCH,b.data=i,b}}else{let g=X("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",r).format({tokenNamePrefix:u,category:e}),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_TOKEN_MISSING,b.data=i,b}if(o===412){let g=X("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_NOT_READY,b.data=i,b}if(o===404){let g=X("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_NOT_FOUND,b.data=i,b}if(o===400){let g=X("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),E=X("Specified playback ID: {playbackId}",r).format({playbackId:f}),b=new V(g,d,!0,E);return b.errorCategory=e,b.muxCode=te.NETWORK_INVALID_URL,b.data=i,b}let p=new V("",d,!0);return p.errorCategory=e,p.muxCode=te.NETWORK_UNKNOWN_ERROR,p.data=i,p},Ry=Te.DefaultConfig.capLevelController,Wy=class Yy extends Ry{constructor(e){super(e)}get levels(){var e;return(e=this.hls.levels)!=null?e:[]}getValidLevels(e){return this.levels.filter((t,r)=>this.isLevelAllowed(t)&&r<=e)}getMaxLevel(e){let t=super.getMaxLevel(e),r=this.getValidLevels(e);if(!r[t])return t;let s=Math.min(r[t].width,r[t].height),n=Yy.minMaxResolution;return s>=n?t:Ry.getMaxLevelByMediaSize(r,n*(16/9),n)}};Wy.minMaxResolution=720;var XL=Wy,QL=XL,Xd={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},ZL=i=>{if(i.includes("fps"))return Xd.FAIRPLAY;if(i.includes("playready"))return Xd.PLAYREADY;if(i.includes("widevine"))return Xd.WIDEVINE},JL=async i=>fetch(i).then(e=>e.status!==200?Promise.reject(e):e.text()).then(e=>{let t=e.split(`
1281
1281
  `).find((r,s,n)=>s&&n[s-1].startsWith("#EXT-X-STREAM-INF"));return fetch(t).then(r=>r.status!==200?Promise.reject(r):r.text()).then(r=>r.split(`
1282
1282
  `))}),ew=i=>{var e,t,r;let s=(t=((e=i.find(l=>l.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?e:"").split(":")[1])==null?void 0:t.trim(),n=Py(s),a=Oy(s),o;if(n===Re.LIVE){let l=i.find(d=>d.startsWith("#EXT-X-PART-INF"));if(l)o=+l.split(":")[1].split("=")[1]*2;else{let d=i.find(c=>c.startsWith("#EXT-X-TARGETDURATION")),u=(r=d==null?void 0:d.split(":"))==null?void 0:r[1];o=+(u!=null?u:6)*3}}return{streamType:n,targetLiveWindow:a,liveEdgeStartOffset:o}},tw=async(i,e)=>{if(e===tr.MP4)return{streamType:Re.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0};if(e===tr.M3U8){let t=await JL(i);return ew(t)}return console.error(`Media type ${e} is an unrecognized or unsupported type for src ${i}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}},iw=async(i,e,t=tu({src:i}))=>{var r,s,n;let{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}=await tw(i,t);((r=pt.get(e))!=null?r:{}).liveEdgeStartOffset=l,((s=pt.get(e))!=null?s:{}).targetLiveWindow=o,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((n=pt.get(e))!=null?n:{}).streamType=a,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},rw=i=>{var e;let t=i.type,r=Py(t),s=Oy(t),n,a=!!((e=i.partList)!=null&&e.length);return r===Re.LIVE&&(n=a?i.partTarget*2:i.targetduration*3),{streamType:r,targetLiveWindow:s,liveEdgeStartOffset:n,lowLatency:a}},sw=(i,e,t)=>{var r,s,n,a,o,l,d,u;let{streamType:c,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:m}=rw(i);if(c===Re.LIVE){m?(t.config.backBufferLength=(r=t.userConfig.backBufferLength)!=null?r:4,t.config.maxFragLookUpTolerance=(s=t.userConfig.maxFragLookUpTolerance)!=null?s:.001,t.config.abrBandWidthUpFactor=(n=t.userConfig.abrBandWidthUpFactor)!=null?n:t.config.abrBandWidthFactor):t.config.backBufferLength=(a=t.userConfig.backBufferLength)!=null?a:8;let p=Object.freeze({get length(){return e.seekable.length},start(g){return e.seekable.start(g)},end(g){var E;return g>this.length||g<0||Number.isFinite(e.duration)?e.seekable.end(g):(E=t.liveSyncPosition)!=null?E:e.seekable.end(g)}});((o=pt.get(e))!=null?o:{}).seekable=p}((l=pt.get(e))!=null?l:{}).liveEdgeStartOffset=f,((d=pt.get(e))!=null?d:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((u=pt.get(e))!=null?u:{}).streamType=c,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Iy,ky,nw=(ky=(Iy=globalThis==null?void 0:globalThis.navigator)==null?void 0:Iy.userAgent)!=null?ky:"",Ly,wy,Dy,aw=(Dy=(wy=(Ly=globalThis==null?void 0:globalThis.navigator)==null?void 0:Ly.userAgentData)==null?void 0:wy.platform)!=null?Dy:"",ow=nw.toLowerCase().includes("android")||["x11","android"].some(i=>aw.toLowerCase().includes(i)),pt=new WeakMap,Tr="mux.com",Cy,My,qy=(My=(Cy=Te).isSupported)==null?void 0:My.call(Cy),lw=ow,ru=()=>td.utils.now(),dw=td.utils.generateUUID,Va=({playbackId:i,customDomain:e=Tr,maxResolution:t,minResolution:r,renditionOrder:s,programStartTime:n,programEndTime:a,assetStartTime:o,assetEndTime:l,playbackToken:d,tokens:{playback:u=d}={},extraSourceParams:c={}}={})=>{if(!i)return;let[h,f=""]=eu(i),m=new URL(`https://stream.${e}/${h}.m3u8${f}`);return u||m.searchParams.has("token")?(m.searchParams.forEach((p,g)=>{g!="token"&&m.searchParams.delete(g)}),u&&m.searchParams.set("token",u)):(t&&m.searchParams.set("max_resolution",t),r&&(m.searchParams.set("min_resolution",r),t&&+t.slice(0,-1)<+r.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",r,"maxResolution",t)),s&&m.searchParams.set("rendition_order",s),n&&m.searchParams.set("program_start_time",`${n}`),a&&m.searchParams.set("program_end_time",`${a}`),o&&m.searchParams.set("asset_start_time",`${o}`),l&&m.searchParams.set("asset_end_time",`${l}`),Object.entries(c).forEach(([p,g])=>{g!=null&&m.searchParams.set(p,g)})),m.toString()},su=i=>{if(!i)return;let[e]=i.split("?");return e||void 0},ip=i=>{if(!i||!i.startsWith("https://stream."))return;let[e]=new URL(i).pathname.slice(1).split(".m3u8");return e||void 0},uw=i=>{var e,t,r;return(e=i==null?void 0:i.metadata)!=null&&e.video_id?i.metadata.video_id:tT(i)&&(r=(t=su(i.playbackId))!=null?t:ip(i.src))!=null?r:i.src},rp=i=>{var e;return(e=pt.get(i))==null?void 0:e.error},Jd=i=>{var e,t;return(t=(e=pt.get(i))==null?void 0:e.streamType)!=null?t:Re.UNKNOWN},jy=i=>{var e,t;return(t=(e=pt.get(i))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},nu=i=>{var e,t;return(t=(e=pt.get(i))==null?void 0:e.seekable)!=null?t:i.seekable},zy=i=>{var e;let t=(e=pt.get(i))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let r=nu(i);return r.length?r.end(r.length-1)-t:Number.NaN},sp=.034,cw=(i,e,t=sp)=>Math.abs(i-e)<=t,Xy=(i,e,t=sp)=>i>e||cw(i,e,t),hw=(i,e=sp)=>i.paused&&Xy(i.currentTime,i.duration,e),Qy=(i,e)=>{var t,r,s;if(!e||!i.buffered.length)return;if(i.readyState>2)return!1;let n=e.currentLevel>=0?(r=(t=e.levels)==null?void 0:t[e.currentLevel])==null?void 0:r.details:(s=e.levels.find(c=>!!c.details))==null?void 0:s.details;if(!n||n.live)return;let{fragments:a}=n;if(!(a!=null&&a.length))return;if(i.currentTime<i.duration-(n.targetduration+.5))return!1;let o=a[a.length-1];if(i.currentTime<=o.start)return!1;let l=o.start+o.duration/2,d=i.buffered.start(i.buffered.length-1),u=i.buffered.end(i.buffered.length-1);return l>d&&l<u},np=(i,e)=>i.ended||i.loop?i.ended:e&&Qy(i,e)?!0:hw(i),Zy=(i,e,t)=>{ap(e,t);let{metadata:r={}}=i,{view_session_id:s=dw()}=r,n=uw(i);r.view_session_id=s,r.video_id=n,i.metadata=r;let a=u=>{var c;(c=e.mux)==null||c.emit("hb",{view_drm_type:u})};i.drmTypeCb=a,pt.set(e,{});let o=fw(i,e),l=KL(i,e,o);bw(i,e,o),yw(i,e,o),YL(e),qL(e);let d=GL(i,e,o);return{engine:o,setAutoplay:d,setPreload:l}},ap=(i,e)=>{let t=e==null?void 0:e.engine;t&&(t.detachMedia(),t.destroy()),i!=null&&i.mux&&!i.mux.deleted&&(i.mux.destroy(),delete i.mux),i&&(i.removeAttribute("src"),i.load(),i.removeEventListener("error",rT),i.removeEventListener("error",jm),i.removeEventListener("durationchange",iT),pt.delete(i),i.dispatchEvent(new Event("teardown")))};function Jy(i,e){var t;let r=tu(i);if(r!==tr.M3U8)return!0;let s=!r||((t=e.canPlayType(r))!=null?t:!0),{preferPlayback:n}=i,a=n===jt.MSE,o=n===jt.NATIVE;return s&&(o||!(qy&&(a||lw)))}var fw=(i,e)=>{let{debug:t,streamType:r,startTime:s=-1,metadata:n,preferCmcd:a,_hlsConfig:o={}}=i,l=tu(i)===tr.M3U8,d=Jy(i,e);if(l&&!d&&qy){let u={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},c=mw(r),h=pw(i),f=a!==zd.NONE?{useHeaders:a===zd.HEADER,sessionId:n==null?void 0:n.view_session_id,contentId:n==null?void 0:n.video_id}:void 0;return new Te({debug:t,startPosition:s,cmcd:f,xhrSetup:(m,p)=>{var g,E;if(a&&a!==zd.QUERY)return;let b=new URL(p);if(!b.searchParams.has("CMCD"))return;let T=((E=(g=b.searchParams.get("CMCD"))==null?void 0:g.split(","))!=null?E:[]).filter(_=>_.startsWith("sid")||_.startsWith("cid")).join(",");b.searchParams.set("CMCD",T),m.open("GET",b)},capLevelController:QL,...u,...c,...h,...o})}},mw=i=>i===Re.LIVE?{backBufferLength:8}:{},pw=i=>{let{tokens:{drm:e}={},playbackId:t,drmTypeCb:r}=i,s=su(t);return!e||!s?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:Qd(i,"fairplay"),serverCertificateUrl:eT(i,"fairplay")},"com.widevine.alpha":{licenseUrl:Qd(i,"widevine")},"com.microsoft.playready":{licenseUrl:Qd(i,"playready")}},requestMediaKeySystemAccessFunc:(n,a)=>(n==="com.widevine.alpha"&&(a=[...a.map(o=>{var l;let d=(l=o.videoCapabilities)==null?void 0:l.map(u=>({...u,robustness:"HW_SECURE_ALL"}));return{...o,videoCapabilities:d}}),...a]),navigator.requestMediaKeySystemAccess(n,a).then(o=>{let l=ZL(n);return r==null||r(l),o}))}},gw=async i=>{let e=await fetch(i);return e.status!==200?Promise.reject(e):await e.arrayBuffer()},vw=async(i,e)=>{let t=await fetch(e,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:i});if(t.status!==200)return Promise.reject(t);let r=await t.arrayBuffer();return new Uint8Array(r)},Ew=(i,e)=>{tt(e,"encrypted",async t=>{try{let r=t.initDataType;if(r!=="skd"){console.error(`Received unexpected initialization data type "${r}"`);return}if(!e.mediaKeys){let l=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[r],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(u=>{var c;return(c=i.drmTypeCb)==null||c.call(i,Xd.FAIRPLAY),u}).catch(()=>{let u=X("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),c=new V(u,V.MEDIA_ERR_ENCRYPTED,!0);c.errorCategory=Ue.DRM,c.muxCode=te.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,Mi(e,c)});if(!l)return;let d=await l.createMediaKeys();try{let u=await gw(eT(i,"fairplay")).catch(c=>{if(c instanceof Response){let h=Zd(c,Ue.DRM,i);return console.error("mediaError",h==null?void 0:h.message,h==null?void 0:h.context),h?Promise.reject(h):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(c)});await d.setServerCertificate(u).catch(()=>{let c=X("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),h=new V(c,V.MEDIA_ERR_ENCRYPTED,!0);return h.errorCategory=Ue.DRM,h.muxCode=te.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(h)})}catch(u){Mi(e,u);return}await e.setMediaKeys(d)}let s=t.initData;if(s==null){console.error(`Could not start encrypted playback due to missing initData in ${t.type} event`);return}let n=e.mediaKeys.createSession();n.addEventListener("keystatuseschange",()=>{n.keyStatuses.forEach(l=>{let d;if(l==="internal-error"){let u=X("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");d=new V(u,V.MEDIA_ERR_ENCRYPTED,!0),d.errorCategory=Ue.DRM,d.muxCode=te.ENCRYPTED_CDM_ERROR}else if(l==="output-restricted"||l==="output-downscaled"){let u=X("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");d=new V(u,V.MEDIA_ERR_ENCRYPTED,!1),d.errorCategory=Ue.DRM,d.muxCode=te.ENCRYPTED_OUTPUT_RESTRICTED}d&&Mi(e,d)})});let a=await Promise.all([n.generateRequest(r,s).catch(()=>{let l=X("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),d=new V(l,V.MEDIA_ERR_ENCRYPTED,!0);d.errorCategory=Ue.DRM,d.muxCode=te.ENCRYPTED_GENERATE_REQUEST_FAILED,Mi(e,d)}),new Promise(l=>{n.addEventListener("message",d=>{l(d.message)},{once:!0})})]).then(([,l])=>l),o=await vw(a,Qd(i,"fairplay")).catch(l=>{if(l instanceof Response){let d=Zd(l,Ue.DRM,i);return console.error("mediaError",d==null?void 0:d.message,d==null?void 0:d.context),d?Promise.reject(d):Promise.reject(new Error("Unexpected error in license key request"))}return Promise.reject(l)});await n.update(o).catch(()=>{let l=X("Failed to update DRM license. This may be an issue with the player or your protected content."),d=new V(l,V.MEDIA_ERR_ENCRYPTED,!0);return d.errorCategory=Ue.DRM,d.muxCode=te.ENCRYPTED_UPDATE_LICENSE_FAILED,Promise.reject(d)})}catch(r){Mi(e,r);return}})},Qd=({playbackId:i,tokens:{drm:e}={},customDomain:t=Tr},r)=>{let s=su(i);return`https://license.${t.toLocaleLowerCase().endsWith(Tr)?t:Tr}/license/${r}/${s}?token=${e}`},eT=({playbackId:i,tokens:{drm:e}={},customDomain:t=Tr},r)=>{let s=su(i);return`https://license.${t.toLocaleLowerCase().endsWith(Tr)?t:Tr}/appcert/${r}/${s}?token=${e}`},tT=({playbackId:i,src:e,customDomain:t})=>{if(i)return!0;if(typeof e!="string")return!1;let r=window==null?void 0:window.location.href,s=new URL(e,r).hostname.toLocaleLowerCase();return s.includes(Tr)||!!t&&s.includes(t.toLocaleLowerCase())},bw=(i,e,t)=>{var r;let{envKey:s,disableTracking:n}=i,a=tT(i);if(!n&&(s||a)){let{playerInitTime:o,playerSoftwareName:l,playerSoftwareVersion:d,beaconCollectionDomain:u,debug:c,disableCookies:h}=i,f={...i.metadata,video_title:((r=i==null?void 0:i.metadata)==null?void 0:r.video_title)||void 0},m=p=>typeof p.player_error_code=="string"?!1:typeof i.errorTranslator=="function"?i.errorTranslator(p):p;td.monitor(e,{debug:c,beaconCollectionDomain:u,hlsjs:t,Hls:t?Te:void 0,automaticErrorTracking:!1,errorTranslator:m,disableCookies:h,data:{...s?{env_key:s}:{},player_software_name:l,player_software:l,player_software_version:d,player_init_time:o,...f}})}},yw=(i,e,t)=>{var r,s;let n=Jy(i,e),{src:a}=i,o=()=>{e.ended||!np(e,t)||(Qy(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))},l,d,u=()=>{let c=nu(e),h,f;c.length>0&&(h=c.start(0),f=c.end(0)),(d!==f||l!==h)&&e.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),l=h,d=f};if(tt(e,"durationchange",u),e&&n){let c=tu(i);if(typeof a=="string"){let h=()=>{if(Jd(e)!==Re.LIVE||Number.isFinite(e.duration))return;let m=setInterval(u,1e3);e.addEventListener("teardown",()=>{clearInterval(m)},{once:!0}),tt(e,"durationchange",()=>{Number.isFinite(e.duration)&&clearInterval(m)})},f=async()=>iw(a,e,c).then(h).catch(m=>{if(m instanceof Response){let p=Zd(m,Ue.VIDEO,i);if(p){Mi(e,p);return}}else m instanceof Error});if(e.preload==="none"){let m=()=>{f(),e.removeEventListener("loadedmetadata",p)},p=()=>{f(),e.removeEventListener("play",m)};tt(e,"play",m,{once:!0}),tt(e,"loadedmetadata",p,{once:!0})}else f();(r=i.tokens)!=null&&r.drm?Ew(i,e):tt(e,"encrypted",()=>{let m=X("Attempting to play DRM-protected content without providing a DRM token."),p=new V(m,V.MEDIA_ERR_ENCRYPTED,!0);p.errorCategory=Ue.DRM,p.muxCode=te.ENCRYPTED_MISSING_TOKEN,Mi(e,p)},{once:!0}),e.setAttribute("src",a),i.startTime&&(((s=pt.get(e))!=null?s:{}).startTime=i.startTime,e.addEventListener("durationchange",iT,{once:!0}))}else e.removeAttribute("src");e.addEventListener("error",rT),e.addEventListener("error",jm),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(h=>{h.remove()})},{once:!0}),tt(e,"pause",o),tt(e,"seeked",o),tt(e,"play",()=>{e.ended||Xy(e.currentTime,e.duration)&&(e.currentTime=e.seekable.length?e.seekable.start(0):0)})}else t&&a?(t.once(Te.Events.LEVEL_LOADED,(c,h)=>{sw(h.details,e,t),u(),Jd(e)===Re.LIVE&&!Number.isFinite(e.duration)&&(t.on(Te.Events.LEVEL_UPDATED,u),tt(e,"durationchange",()=>{Number.isFinite(e.duration)&&t.off(Te.Events.LEVELS_UPDATED,u)}))}),t.on(Te.Events.ERROR,(c,h)=>{Mi(e,Tw(h,i))}),e.addEventListener("error",jm),tt(e,"waiting",o),VL(i,t),WL(e,t),t.attachMedia(e)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function iT(i){var e;let t=i.target,r=(e=pt.get(t))==null?void 0:e.startTime;if(r&&CL(t.seekable,t.duration,r)){let s=t.preload==="auto";s&&(t.preload="none"),t.currentTime=r,s&&(t.preload="auto")}}async function rT(i){if(!i.isTrusted)return;i.stopImmediatePropagation();let e=i.target;if(!(e!=null&&e.error))return;let{message:t,code:r}=e.error,s=new V(t,r);if(e.src&&r===V.MEDIA_ERR_SRC_NOT_SUPPORTED&&e.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var n;let a=(n=rp(e))!=null?n:e.error;(a==null?void 0:a.code)===V.MEDIA_ERR_SRC_NOT_SUPPORTED&&Mi(e,s)},500);return}if(e.src&&(r!==V.MEDIA_ERR_DECODE||r!==void 0))try{let{status:n}=await fetch(e.src);s.data={response:{code:n}}}catch{}Mi(e,s)}function Mi(i,e){var t;e.fatal&&(((t=pt.get(i))!=null?t:{}).error=e,i.dispatchEvent(new CustomEvent("error",{detail:e})))}function jm(i){var e,t;if(!(i instanceof CustomEvent)||!(i.detail instanceof V))return;let r=i.target,s=i.detail;!s||!s.fatal||(((e=pt.get(r))!=null?e:{}).error=s,(t=r.mux)==null||t.emit("error",{player_error_code:s.code,player_error_message:s.message,player_error_context:s.context}))}var Tw=(i,e)=>{var t,r,s;console.error("getErrorFromHlsErrorData()",i);let n={[Te.ErrorTypes.NETWORK_ERROR]:V.MEDIA_ERR_NETWORK,[Te.ErrorTypes.MEDIA_ERROR]:V.MEDIA_ERR_DECODE,[Te.ErrorTypes.KEY_SYSTEM_ERROR]:V.MEDIA_ERR_ENCRYPTED},a=u=>[Te.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,Te.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(u.details)?V.MEDIA_ERR_NETWORK:n[u.type],o=u=>{if(u.type===Te.ErrorTypes.KEY_SYSTEM_ERROR)return Ue.DRM;if(u.type===Te.ErrorTypes.NETWORK_ERROR)return Ue.VIDEO},l,d=a(i);if(d===V.MEDIA_ERR_NETWORK&&i.response){let u=(t=o(i))!=null?t:Ue.VIDEO;l=(r=Zd(i.response,u,e))!=null?r:new V("",d)}else if(d===V.MEDIA_ERR_ENCRYPTED)if(i.details===Te.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let u=X("Attempting to play DRM-protected content without providing a DRM token.");l=new V(u,V.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_MISSING_TOKEN}else if(i.details===Te.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let u=X("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");l=new V(u,V.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(i.details===Te.ErrorDetails.KEY_SYSTEM_NO_SESSION){let u=X("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");l=new V(u,V.MEDIA_ERR_ENCRYPTED,!0),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(i.details===Te.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let u=X("Failed to update DRM license. This may be an issue with the player or your protected content.");l=new V(u,V.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(i.details===Te.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let u=X("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");l=new V(u,V.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(i.details===Te.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let u=X("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");l=new V(u,V.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_CDM_ERROR}else if(i.details===Te.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let u=X("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");l=new V(u,V.MEDIA_ERR_ENCRYPTED,!1),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_OUTPUT_RESTRICTED}else l=new V(i.error.message,V.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Ue.DRM,l.muxCode=te.ENCRYPTED_ERROR;else l=new V("",d,i.fatal);return l.context||(l.context=`${i.url?`url: ${i.url}
1283
1283
  `:""}${i.response&&(i.response.code||i.response.text)?`response: ${i.response.code}, ${i.response.text}
@@ -1288,7 +1288,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1288
1288
  `:""}${i.error?`error: ${i.error}
1289
1289
  `:""}${i.event?`event: ${i.event}
1290
1290
  `:""}${i.err?`error message: ${(s=i.err)==null?void 0:s.message}
1291
- `:""}`),l.data=i,l};var _w=Object.defineProperty,Aw=Object.getPrototypeOf,Sw=Reflect.get,fT=i=>{throw TypeError(i)},xw=(i,e,t)=>e in i?_w(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Le=(i,e,t)=>xw(i,typeof e!="symbol"?e+"":e,t),xp=(i,e,t)=>e.has(i)||fT("Cannot "+t),I=(i,e,t)=>(xp(i,e,"read from private field"),t?t.call(i):e.get(i)),ne=(i,e,t)=>e.has(i)?fT("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),J=(i,e,t,r)=>(xp(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Fe=(i,e,t)=>(xp(i,e,"access private method"),t),op=(i,e,t)=>Sw(Aw(i),t,e),bu=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class i extends bu{}globalThis.DocumentFragment=i}var Rp=class extends bu{},Rw=class extends bu{},Iw={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(Rp)}},au,kw=class{constructor(i,e={}){ne(this,au),J(this,au,e==null?void 0:e.detail)}get detail(){return I(this,au)}initCustomEvent(){}};au=new WeakMap;function Lw(i,e){return new Rp}var mT={document:{createElement:Lw},DocumentFragment,customElements:Iw,CustomEvent:kw,EventTarget:bu,HTMLElement:Rp,HTMLVideoElement:Rw},pT=typeof window=="undefined"||typeof globalThis.customElements=="undefined",lp=pT?mT:globalThis,jN=pT?mT.document:globalThis.document,ww=()=>{try{return"0.24.5"}catch{}return"UNKNOWN"},Dw=ww(),Cw=()=>Dw,yu=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],gT=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function Mw(i){return`
1291
+ `:""}`),l.data=i,l};var _w=Object.defineProperty,Aw=Object.getPrototypeOf,Sw=Reflect.get,fT=i=>{throw TypeError(i)},xw=(i,e,t)=>e in i?_w(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Le=(i,e,t)=>xw(i,typeof e!="symbol"?e+"":e,t),xp=(i,e,t)=>e.has(i)||fT("Cannot "+t),I=(i,e,t)=>(xp(i,e,"read from private field"),t?t.call(i):e.get(i)),ne=(i,e,t)=>e.has(i)?fT("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),J=(i,e,t,r)=>(xp(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Fe=(i,e,t)=>(xp(i,e,"access private method"),t),op=(i,e,t)=>Sw(Aw(i),t,e),bu=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class i extends bu{}globalThis.DocumentFragment=i}var Rp=class extends bu{},Rw=class extends bu{},Iw={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(Rp)}},au,kw=class{constructor(i,e={}){ne(this,au),J(this,au,e==null?void 0:e.detail)}get detail(){return I(this,au)}initCustomEvent(){}};au=new WeakMap;function Lw(i,e){return new Rp}var mT={document:{createElement:Lw},DocumentFragment,customElements:Iw,CustomEvent:kw,EventTarget:bu,HTMLElement:Rp,HTMLVideoElement:Rw},pT=typeof window=="undefined"||typeof globalThis.customElements=="undefined",lp=pT?mT:globalThis,zN=pT?mT.document:globalThis.document,ww=()=>{try{return"0.25.0"}catch{}return"UNKNOWN"},Dw=ww(),Cw=()=>Dw,yu=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],gT=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function Mw(i){return`
1292
1292
  <style>
1293
1293
  :host {
1294
1294
  display: inline-flex;
@@ -1330,10 +1330,36 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1330
1330
  <video${ET(i)}></video>
1331
1331
  </slot>
1332
1332
  <slot></slot>
1333
- `}function vT(i,{tag:e,is:t}){var r,s,n,a,o,l,d,u,c,h,f,m,p,g,E,b,T;let _=(s=(r=globalThis.document)==null?void 0:r.createElement)==null?void 0:s.call(r,e,{is:t}),A=_?Ow(_):[];return n=class extends i{constructor(){super(...arguments),ne(this,f),ne(this,d,!1),ne(this,u,null),ne(this,c,new Map),ne(this,h),Le(this,"get"),Le(this,"set"),Le(this,"call")}static get observedAttributes(){var R,S,D;return Fe(R=n,o,l).call(R),[...(D=(S=_==null?void 0:_.constructor)==null?void 0:S.observedAttributes)!=null?D:[],...gT]}get nativeEl(){var R,S,D,M,L;return Fe(this,f,m).call(this),(L=(M=(S=(R=I(this,u))!=null?R:this.querySelector(":scope > [slot=media]"))!=null?S:this.querySelector(e))!=null?M:(D=this.shadowRoot)==null?void 0:D.querySelector(e))!=null?L:null}set nativeEl(R){J(this,u,R)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(R){this.toggleAttribute("muted",R)}get src(){return this.getAttribute("src")}set src(R){this.setAttribute("src",`${R}`)}get preload(){var R,S;return(S=this.getAttribute("preload"))!=null?S:(R=this.nativeEl)==null?void 0:R.preload}set preload(R){this.setAttribute("preload",`${R}`)}init(){var R;if(!this.shadowRoot){this.attachShadow({mode:"open"});let S=Nw(this.attributes);t&&(S.is=t),e&&(S.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(S)}this.nativeEl.muted=this.hasAttribute("muted");for(let S of A)Fe(this,f,b).call(this,S);J(this,h,new MutationObserver(Fe(this,f,g).bind(this))),this.shadowRoot.addEventListener("slotchange",this),Fe(this,f,p).call(this);for(let S of this.constructor.Events)(R=this.shadowRoot)==null||R.addEventListener(S,this,!0)}handleEvent(R){if(R.type==="slotchange"){Fe(this,f,p).call(this);return}R.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(R.type,{detail:R.detail}))}attributeChangedCallback(R,S,D){Fe(this,f,m).call(this),Fe(this,f,T).call(this,R,S,D)}connectedCallback(){Fe(this,f,m).call(this)}},a=new WeakMap,o=new WeakSet,l=function(){if(I(this,a))return;J(this,a,!0);let R=new Set(this.observedAttributes);R.delete("muted");for(let S of A)if(!(S in this.prototype))if(typeof _[S]=="function")this.prototype[S]=function(...D){return Fe(this,f,m).call(this),(()=>{var M;if(this.call)return this.call(S,...D);let L=(M=this.nativeEl)==null?void 0:M[S];return L==null?void 0:L.apply(this.nativeEl,D)})()};else{let D={get(){var M,L,P;Fe(this,f,m).call(this);let U=S.toLowerCase();if(R.has(U)){let B=this.getAttribute(U);return B===null?!1:B===""?!0:B}return(P=(M=this.get)==null?void 0:M.call(this,S))!=null?P:(L=this.nativeEl)==null?void 0:L[S]}};S!==S.toUpperCase()&&(D.set=function(M){Fe(this,f,m).call(this);let L=S.toLowerCase();if(R.has(L)){M===!0||M===!1||M==null?this.toggleAttribute(L,!!M):this.setAttribute(L,M);return}if(this.set){this.set(S,M);return}this.nativeEl&&(this.nativeEl[S]=M)}),Object.defineProperty(this.prototype,S,D)}},d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,f=new WeakSet,m=function(){I(this,d)||(J(this,d,!0),this.init())},p=function(){var R;let S=new Map(I(this,c)),D=(R=this.shadowRoot)==null?void 0:R.querySelector("slot:not([name])");(D==null?void 0:D.assignedElements({flatten:!0}).filter(M=>["track","source"].includes(M.localName))).forEach(M=>{var L,P;S.delete(M);let U=I(this,c).get(M);U||(U=M.cloneNode(),I(this,c).set(M,U),(L=I(this,h))==null||L.observe(M,{attributes:!0})),(P=this.nativeEl)==null||P.append(U),Fe(this,f,E).call(this,U)}),S.forEach((M,L)=>{M.remove(),I(this,c).delete(L)})},g=function(R){var S;for(let D of R)if(D.type==="attributes"){let{target:M,attributeName:L}=D,P=I(this,c).get(M);P&&L&&(P.setAttribute(L,(S=M.getAttribute(L))!=null?S:""),Fe(this,f,E).call(this,P))}},E=function(R){R&&R.localName==="track"&&R.default&&(R.kind==="chapters"||R.kind==="metadata")&&R.track.mode==="disabled"&&(R.track.mode="hidden")},b=function(R){if(Object.prototype.hasOwnProperty.call(this,R)){let S=this[R];delete this[R],this[R]=S}},T=function(R,S,D){var M,L,P;["id","class"].includes(R)||!n.observedAttributes.includes(R)&&this.constructor.observedAttributes.includes(R)||(D===null?(M=this.nativeEl)==null||M.removeAttribute(R):((L=this.nativeEl)==null?void 0:L.getAttribute(R))!==D&&((P=this.nativeEl)==null||P.setAttribute(R,D)))},ne(n,o),Le(n,"getTemplateHTML",e.endsWith("audio")?Mw:Pw),Le(n,"shadowRootOptions",{mode:"open"}),Le(n,"Events",yu),ne(n,a,!1),n}function Ow(i){let e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){let r=Object.getOwnPropertyNames(t);e.push(...r)}return e}function ET(i){let e="";for(let t in i){if(!gT.includes(t))continue;let r=i[t];r===""?e+=` ${t}`:e+=` ${t}="${r}"`}return e}function Nw(i){let e={};for(let t of i)e[t.name]=t.value;return e}var sT,dp=vT((sT=globalThis.HTMLElement)!=null?sT:class{},{tag:"video"}),nT,XN=vT((nT=globalThis.HTMLElement)!=null?nT:class{},{tag:"audio"}),As=new WeakMap,up=class extends Error{},Uw=class extends Error{},Fw=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],Bw=globalThis.WeakRef?class extends Set{add(i){super.add(new WeakRef(i))}forEach(i){super.forEach(e=>{let t=e.deref();t&&i(t)})}}:Set;function $w(i){var e,t,r;(t=(e=globalThis.chrome)==null?void 0:e.cast)!=null&&t.isAvailable?(r=globalThis.cast)!=null&&r.framework?i():customElements.whenDefined("google-cast-button").then(i):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(i)}}function Hw(){return globalThis.chrome}function Gw(){var i;let e="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if((i=globalThis.chrome)!=null&&i.cast||document.querySelector(`script[src="${e}"]`))return;let t=document.createElement("script");t.src=e,document.head.append(t)}function Ss(){var i,e;return(e=(i=globalThis.cast)==null?void 0:i.framework)==null?void 0:e.CastContext.getInstance()}function Ip(){var i;return(i=Ss())==null?void 0:i.getCurrentSession()}function kp(){var i;return(i=Ip())==null?void 0:i.getSessionObj().media[0]}function Kw(i){return new Promise((e,t)=>{kp().editTracksInfo(i,e,t)})}function Vw(i){return new Promise((e,t)=>{kp().getStatus(i,e,t)})}function bT(i){return Ss().setOptions({...yT(),...i})}function yT(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function Ww(i){if(!i)return;let e=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=i.match(e);return t?t[1]:null}function Yw(i){let e=i.split(`
1333
+ `}function vT(i,{tag:e,is:t}){var r,s,n,a,o,l,d,u,c,h,f,m,p,g,E,b,T;let _=(s=(r=globalThis.document)==null?void 0:r.createElement)==null?void 0:s.call(r,e,{is:t}),A=_?Ow(_):[];return n=class extends i{constructor(){super(...arguments),ne(this,f),ne(this,d,!1),ne(this,u,null),ne(this,c,new Map),ne(this,h),Le(this,"get"),Le(this,"set"),Le(this,"call")}static get observedAttributes(){var R,S,D;return Fe(R=n,o,l).call(R),[...(D=(S=_==null?void 0:_.constructor)==null?void 0:S.observedAttributes)!=null?D:[],...gT]}get nativeEl(){var R,S,D,M,L;return Fe(this,f,m).call(this),(L=(M=(S=(R=I(this,u))!=null?R:this.querySelector(":scope > [slot=media]"))!=null?S:this.querySelector(e))!=null?M:(D=this.shadowRoot)==null?void 0:D.querySelector(e))!=null?L:null}set nativeEl(R){J(this,u,R)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(R){this.toggleAttribute("muted",R)}get src(){return this.getAttribute("src")}set src(R){this.setAttribute("src",`${R}`)}get preload(){var R,S;return(S=this.getAttribute("preload"))!=null?S:(R=this.nativeEl)==null?void 0:R.preload}set preload(R){this.setAttribute("preload",`${R}`)}init(){var R;if(!this.shadowRoot){this.attachShadow({mode:"open"});let S=Nw(this.attributes);t&&(S.is=t),e&&(S.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(S)}this.nativeEl.muted=this.hasAttribute("muted");for(let S of A)Fe(this,f,b).call(this,S);J(this,h,new MutationObserver(Fe(this,f,g).bind(this))),this.shadowRoot.addEventListener("slotchange",this),Fe(this,f,p).call(this);for(let S of this.constructor.Events)(R=this.shadowRoot)==null||R.addEventListener(S,this,!0)}handleEvent(R){if(R.type==="slotchange"){Fe(this,f,p).call(this);return}R.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(R.type,{detail:R.detail}))}attributeChangedCallback(R,S,D){Fe(this,f,m).call(this),Fe(this,f,T).call(this,R,S,D)}connectedCallback(){Fe(this,f,m).call(this)}},a=new WeakMap,o=new WeakSet,l=function(){if(I(this,a))return;J(this,a,!0);let R=new Set(this.observedAttributes);R.delete("muted");for(let S of A)if(!(S in this.prototype))if(typeof _[S]=="function")this.prototype[S]=function(...D){return Fe(this,f,m).call(this),(()=>{var M;if(this.call)return this.call(S,...D);let L=(M=this.nativeEl)==null?void 0:M[S];return L==null?void 0:L.apply(this.nativeEl,D)})()};else{let D={get(){var M,L,P;Fe(this,f,m).call(this);let U=S.toLowerCase();if(R.has(U)){let B=this.getAttribute(U);return B===null?!1:B===""?!0:B}return(P=(M=this.get)==null?void 0:M.call(this,S))!=null?P:(L=this.nativeEl)==null?void 0:L[S]}};S!==S.toUpperCase()&&(D.set=function(M){Fe(this,f,m).call(this);let L=S.toLowerCase();if(R.has(L)){M===!0||M===!1||M==null?this.toggleAttribute(L,!!M):this.setAttribute(L,M);return}if(this.set){this.set(S,M);return}this.nativeEl&&(this.nativeEl[S]=M)}),Object.defineProperty(this.prototype,S,D)}},d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,f=new WeakSet,m=function(){I(this,d)||(J(this,d,!0),this.init())},p=function(){var R;let S=new Map(I(this,c)),D=(R=this.shadowRoot)==null?void 0:R.querySelector("slot:not([name])");(D==null?void 0:D.assignedElements({flatten:!0}).filter(M=>["track","source"].includes(M.localName))).forEach(M=>{var L,P;S.delete(M);let U=I(this,c).get(M);U||(U=M.cloneNode(),I(this,c).set(M,U),(L=I(this,h))==null||L.observe(M,{attributes:!0})),(P=this.nativeEl)==null||P.append(U),Fe(this,f,E).call(this,U)}),S.forEach((M,L)=>{M.remove(),I(this,c).delete(L)})},g=function(R){var S;for(let D of R)if(D.type==="attributes"){let{target:M,attributeName:L}=D,P=I(this,c).get(M);P&&L&&(P.setAttribute(L,(S=M.getAttribute(L))!=null?S:""),Fe(this,f,E).call(this,P))}},E=function(R){R&&R.localName==="track"&&R.default&&(R.kind==="chapters"||R.kind==="metadata")&&R.track.mode==="disabled"&&(R.track.mode="hidden")},b=function(R){if(Object.prototype.hasOwnProperty.call(this,R)){let S=this[R];delete this[R],this[R]=S}},T=function(R,S,D){var M,L,P;["id","class"].includes(R)||!n.observedAttributes.includes(R)&&this.constructor.observedAttributes.includes(R)||(D===null?(M=this.nativeEl)==null||M.removeAttribute(R):((L=this.nativeEl)==null?void 0:L.getAttribute(R))!==D&&((P=this.nativeEl)==null||P.setAttribute(R,D)))},ne(n,o),Le(n,"getTemplateHTML",e.endsWith("audio")?Mw:Pw),Le(n,"shadowRootOptions",{mode:"open"}),Le(n,"Events",yu),ne(n,a,!1),n}function Ow(i){let e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){let r=Object.getOwnPropertyNames(t);e.push(...r)}return e}function ET(i){let e="";for(let t in i){if(!gT.includes(t))continue;let r=i[t];r===""?e+=` ${t}`:e+=` ${t}="${r}"`}return e}function Nw(i){let e={};for(let t of i)e[t.name]=t.value;return e}var sT,dp=vT((sT=globalThis.HTMLElement)!=null?sT:class{},{tag:"video"}),nT,QN=vT((nT=globalThis.HTMLElement)!=null?nT:class{},{tag:"audio"}),As=new WeakMap,up=class extends Error{},Uw=class extends Error{},Fw=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],Bw=globalThis.WeakRef?class extends Set{add(i){super.add(new WeakRef(i))}forEach(i){super.forEach(e=>{let t=e.deref();t&&i(t)})}}:Set;function $w(i){var e,t,r;(t=(e=globalThis.chrome)==null?void 0:e.cast)!=null&&t.isAvailable?(r=globalThis.cast)!=null&&r.framework?i():customElements.whenDefined("google-cast-button").then(i):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(i)}}function Hw(){return globalThis.chrome}function Gw(){var i;let e="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if((i=globalThis.chrome)!=null&&i.cast||document.querySelector(`script[src="${e}"]`))return;let t=document.createElement("script");t.src=e,document.head.append(t)}function Ss(){var i,e;return(e=(i=globalThis.cast)==null?void 0:i.framework)==null?void 0:e.CastContext.getInstance()}function Ip(){var i;return(i=Ss())==null?void 0:i.getCurrentSession()}function kp(){var i;return(i=Ip())==null?void 0:i.getSessionObj().media[0]}function Kw(i){return new Promise((e,t)=>{kp().editTracksInfo(i,e,t)})}function Vw(i){return new Promise((e,t)=>{kp().getStatus(i,e,t)})}function bT(i){return Ss().setOptions({...yT(),...i})}function yT(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function Ww(i){if(!i)return;let e=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=i.match(e);return t?t[1]:null}function Yw(i){let e=i.split(`
1334
1334
  `),t=[];for(let r=0;r<e.length;r++)if(e[r].trim().startsWith("#EXT-X-STREAM-INF")){let s=e[r+1]?e[r+1].trim():"";s&&!s.startsWith("#")&&t.push(s)}return t}function qw(i){return i.split(`
1335
- `).find(e=>!e.trim().startsWith("#")&&e.trim()!=="")}async function jw(i){try{let e=(await fetch(i,{method:"HEAD"})).headers.get("Content-Type");return Fw.some(t=>e===t)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function zw(i){try{let e=await(await fetch(i)).text(),t=e,r=Yw(e);if(r.length>0){let n=new URL(r[0],i).toString();t=await(await fetch(n)).text()}let s=qw(t);return Ww(s)}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}var ou=new Bw,Sr=new WeakSet,nt;$w(()=>{var i,e,t,r;if(!((e=(i=globalThis.chrome)==null?void 0:i.cast)!=null&&e.isAvailable)){console.debug("chrome.cast.isAvailable",(r=(t=globalThis.chrome)==null?void 0:t.cast)==null?void 0:r.isAvailable);return}nt||(nt=cast.framework,Ss().addEventListener(nt.CastContextEventType.CAST_STATE_CHANGED,s=>{ou.forEach(n=>{var a,o;return(o=(a=As.get(n)).onCastStateChanged)==null?void 0:o.call(a,s)})}),Ss().addEventListener(nt.CastContextEventType.SESSION_STATE_CHANGED,s=>{ou.forEach(n=>{var a,o;return(o=(a=As.get(n)).onSessionStateChanged)==null?void 0:o.call(a,s)})}),ou.forEach(s=>{var n,a;return(a=(n=As.get(s)).init)==null?void 0:a.call(n)}))});var aT=0,ke,lu,zt,Ar,Cn,kn,_s,hp,vt,ds,oT,fp,TT,mp,lT,cp,Xw=class extends EventTarget{constructor(i){super(),ne(this,vt),ne(this,ke),ne(this,lu),ne(this,zt),ne(this,Ar),ne(this,Cn,"disconnected"),ne(this,kn,!1),ne(this,_s,new Set),ne(this,hp,new WeakMap),J(this,ke,i),ou.add(this),As.set(this,{init:()=>Fe(this,vt,mp).call(this),onCastStateChanged:()=>Fe(this,vt,fp).call(this),onSessionStateChanged:()=>Fe(this,vt,TT).call(this),getCastPlayer:()=>I(this,vt,ds)}),Fe(this,vt,mp).call(this)}get state(){return I(this,Cn)}async watchAvailability(i){if(I(this,ke).disableRemotePlayback)throw new up("disableRemotePlayback attribute is present.");return I(this,hp).set(i,++aT),I(this,_s).add(i),aT}async cancelWatchAvailability(i){if(I(this,ke).disableRemotePlayback)throw new up("disableRemotePlayback attribute is present.");i?I(this,_s).delete(i):I(this,_s).clear()}async prompt(){var i,e,t,r;if(I(this,ke).disableRemotePlayback)throw new up("disableRemotePlayback attribute is present.");if(!((e=(i=globalThis.chrome)==null?void 0:i.cast)!=null&&e.isAvailable))throw new Uw("The RemotePlayback API is disabled on this platform.");let s=Sr.has(I(this,ke));Sr.add(I(this,ke)),bT(I(this,ke).castOptions),Object.entries(I(this,Ar)).forEach(([n,a])=>{I(this,zt).controller.addEventListener(n,a)});try{await Ss().requestSession()}catch(n){if(n==="cancel"){s||Sr.delete(I(this,ke));return}throw new Error(n)}(r=(t=As.get(I(this,ke)))==null?void 0:t.loadOnPrompt)==null||r.call(t)}};ke=new WeakMap,lu=new WeakMap,zt=new WeakMap,Ar=new WeakMap,Cn=new WeakMap,kn=new WeakMap,_s=new WeakMap,hp=new WeakMap,vt=new WeakSet,ds=function(){if(Sr.has(I(this,ke)))return I(this,zt)},oT=function(){Sr.has(I(this,ke))&&(Object.entries(I(this,Ar)).forEach(([i,e])=>{I(this,zt).controller.removeEventListener(i,e)}),Sr.delete(I(this,ke)),I(this,ke).muted=I(this,zt).isMuted,I(this,ke).currentTime=I(this,zt).savedPlayerState.currentTime,I(this,zt).savedPlayerState.isPaused===!1&&I(this,ke).play())},fp=function(){let i=Ss().getCastState();if(Sr.has(I(this,ke))&&i==="CONNECTING"&&(J(this,Cn,"connecting"),this.dispatchEvent(new Event("connecting"))),!I(this,kn)&&i!=null&&i.includes("CONNECT")){J(this,kn,!0);for(let e of I(this,_s))e(!0)}else if(I(this,kn)&&(!i||i==="NO_DEVICES_AVAILABLE")){J(this,kn,!1);for(let e of I(this,_s))e(!1)}},TT=async function(){var i;let{SESSION_RESUMED:e}=nt.SessionState;if(Ss().getSessionState()===e&&I(this,ke).castSrc===((i=kp())==null?void 0:i.media.contentId)){Sr.add(I(this,ke)),Object.entries(I(this,Ar)).forEach(([t,r])=>{I(this,zt).controller.addEventListener(t,r)});try{await Vw(new chrome.cast.media.GetStatusRequest)}catch(t){console.error(t)}I(this,Ar)[nt.RemotePlayerEventType.IS_PAUSED_CHANGED](),I(this,Ar)[nt.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},mp=function(){!nt||I(this,lu)||(J(this,lu,!0),bT(I(this,ke).castOptions),I(this,ke).textTracks.addEventListener("change",()=>Fe(this,vt,cp).call(this)),Fe(this,vt,fp).call(this),J(this,zt,new nt.RemotePlayer),new nt.RemotePlayerController(I(this,zt)),J(this,Ar,{[nt.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:i})=>{i===!0?(J(this,Cn,"connected"),this.dispatchEvent(new Event("connect"))):(Fe(this,vt,oT).call(this),J(this,Cn,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[nt.RemotePlayerEventType.DURATION_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("durationchange"))},[nt.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("volumechange"))},[nt.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("volumechange"))},[nt.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var i;(i=I(this,vt,ds))!=null&&i.isMediaLoaded&&I(this,ke).dispatchEvent(new Event("timeupdate"))},[nt.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("resize"))},[nt.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event(this.paused?"pause":"play"))},[nt.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var i,e;((i=I(this,vt,ds))==null?void 0:i.playerState)!==chrome.cast.media.PlayerState.PAUSED&&I(this,ke).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(e=I(this,vt,ds))==null?void 0:e.playerState]))},[nt.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var i;(i=I(this,vt,ds))!=null&&i.isMediaLoaded&&(await Promise.resolve(),Fe(this,vt,lT).call(this))}}))},lT=function(){Fe(this,vt,cp).call(this)},cp=async function(){var i,e,t,r,s;if(!I(this,vt,ds))return;let n=((e=(i=I(this,zt).mediaInfo)==null?void 0:i.tracks)!=null?e:[]).filter(({type:h})=>h===chrome.cast.media.TrackType.TEXT),a=[...I(this,ke).textTracks].filter(({kind:h})=>h==="subtitles"||h==="captions"),o=n.map(({language:h,name:f,trackId:m})=>{var p;let{mode:g}=(p=a.find(E=>E.language===h&&E.label===f))!=null?p:{};return g?{mode:g,trackId:m}:!1}).filter(Boolean),l=o.filter(({mode:h})=>h!=="showing").map(({trackId:h})=>h),d=o.find(({mode:h})=>h==="showing"),u=(s=(r=(t=Ip())==null?void 0:t.getSessionObj().media[0])==null?void 0:r.activeTrackIds)!=null?s:[],c=u;if(u.length&&(c=c.filter(h=>!l.includes(h))),d!=null&&d.trackId&&(c=[...c,d.trackId]),c=[...new Set(c)],!((h,f)=>h.length===f.length&&h.every(m=>f.includes(m)))(u,c))try{let h=new chrome.cast.media.EditTracksInfoRequest(c);await Kw(h)}catch(h){console.error(h)}};var Qw=i=>{var e,t,r,s,n,a,o,l,d;return t=class extends i{constructor(){super(...arguments),ne(this,o),ne(this,r,{paused:!1}),ne(this,s,yT()),ne(this,n),ne(this,a)}get remote(){return I(this,a)?I(this,a):Hw()?(this.disableRemotePlayback||Gw(),As.set(this,{loadOnPrompt:()=>Fe(this,o,d).call(this)}),J(this,a,new Xw(this))):super.remote}attributeChangedCallback(u,c,h){if(super.attributeChangedCallback(u,c,h),u==="cast-receiver"&&h){I(this,s).receiverApplicationId=h;return}if(I(this,o,l))switch(u){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var u,c;if(!I(this,o,l))return super.load();let h=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);h.customData=this.castCustomData;let f=[...this.querySelectorAll("track")].filter(({kind:E,src:b})=>b&&(E==="subtitles"||E==="captions")),m=[],p=0;if(f.length&&(h.tracks=f.map(E=>{let b=++p;m.length===0&&E.track.mode==="showing"&&m.push(b);let T=new chrome.cast.media.Track(b,chrome.cast.media.TrackType.TEXT);return T.trackContentId=E.src,T.trackContentType="text/vtt",T.subtype=E.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,T.name=E.label,T.language=E.srclang,T})),this.castStreamType==="live"?h.streamType=chrome.cast.media.StreamType.LIVE:h.streamType=chrome.cast.media.StreamType.BUFFERED,h.metadata=new chrome.cast.media.GenericMediaMetadata,h.metadata.title=this.title,h.metadata.images=[{url:this.poster}],jw(this.castSrc)){let E=await zw(this.castSrc);(E!=null&&E.includes("m4s")||E!=null&&E.includes("mp4"))&&(h.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,h.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4)}let g=new chrome.cast.media.LoadRequest(h);g.currentTime=(u=super.currentTime)!=null?u:0,g.autoplay=!I(this,r).paused,g.activeTrackIds=m,await((c=Ip())==null?void 0:c.loadMedia(g)),this.dispatchEvent(new Event("volumechange"))}play(){var u;if(I(this,o,l)){I(this,o,l).isPaused&&((u=I(this,o,l).controller)==null||u.playOrPause());return}return super.play()}pause(){var u;if(I(this,o,l)){I(this,o,l).isPaused||(u=I(this,o,l).controller)==null||u.playOrPause();return}super.pause()}get castOptions(){return I(this,s)}get castReceiver(){var u;return(u=this.getAttribute("cast-receiver"))!=null?u:void 0}set castReceiver(u){this.castReceiver!=u&&this.setAttribute("cast-receiver",`${u}`)}get castSrc(){var u,c,h;return(h=(c=this.getAttribute("cast-src"))!=null?c:(u=this.querySelector("source"))==null?void 0:u.src)!=null?h:this.currentSrc}set castSrc(u){this.castSrc!=u&&this.setAttribute("cast-src",`${u}`)}get castContentType(){var u;return(u=this.getAttribute("cast-content-type"))!=null?u:void 0}set castContentType(u){this.setAttribute("cast-content-type",`${u}`)}get castStreamType(){var u,c;return(c=(u=this.getAttribute("cast-stream-type"))!=null?u:this.streamType)!=null?c:void 0}set castStreamType(u){this.setAttribute("cast-stream-type",`${u}`)}get castCustomData(){return I(this,n)}set castCustomData(u){let c=typeof u;if(!["object","undefined"].includes(c)){console.error(`castCustomData must be nullish or an object but value was of type ${c}`);return}J(this,n,u)}get readyState(){if(I(this,o,l))switch(I(this,o,l).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return I(this,o,l)?I(this,o,l).isPaused:super.paused}get muted(){var u;return I(this,o,l)?(u=I(this,o,l))==null?void 0:u.isMuted:super.muted}set muted(u){var c;if(I(this,o,l)){(u&&!I(this,o,l).isMuted||!u&&I(this,o,l).isMuted)&&((c=I(this,o,l).controller)==null||c.muteOrUnmute());return}super.muted=u}get volume(){var u,c;return I(this,o,l)?(c=(u=I(this,o,l))==null?void 0:u.volumeLevel)!=null?c:1:super.volume}set volume(u){var c;if(I(this,o,l)){I(this,o,l).volumeLevel=+u,(c=I(this,o,l).controller)==null||c.setVolumeLevel();return}super.volume=u}get duration(){var u,c,h;return I(this,o,l)&&(u=I(this,o,l))!=null&&u.isMediaLoaded?(h=(c=I(this,o,l))==null?void 0:c.duration)!=null?h:NaN:super.duration}get currentTime(){var u,c,h;return I(this,o,l)&&(u=I(this,o,l))!=null&&u.isMediaLoaded?(h=(c=I(this,o,l))==null?void 0:c.currentTime)!=null?h:0:super.currentTime}set currentTime(u){var c;if(I(this,o,l)){I(this,o,l).currentTime=u,(c=I(this,o,l).controller)==null||c.seek();return}super.currentTime=u}},r=new WeakMap,s=new WeakMap,n=new WeakMap,a=new WeakMap,o=new WeakSet,l=function(){var u,c;return(c=(u=As.get(this.remote))==null?void 0:u.getCastPlayer)==null?void 0:c.call(u)},d=async function(){I(this,r).paused=op(t.prototype,this,"paused"),op(t.prototype,this,"pause").call(this),this.muted=op(t.prototype,this,"muted");try{await this.load()}catch(u){console.error(u)}},Le(t,"observedAttributes",[...(e=i.observedAttributes)!=null?e:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),t},Tu=class extends Event{constructor(i,e){super(i),Le(this,"track"),this.track=e.track}},pp=new WeakMap;function j(i){var e;return(e=pp.get(i))!=null?e:Zw(i,{})}function Zw(i,e){let t=pp.get(i);return t||pp.set(i,t={}),Object.assign(t,e)}function gp(i,e){let t=i.videoTracks;j(e).media=i,j(e).renditionSet||(j(e).renditionSet=new Set);let r=j(t).trackSet;r.add(e);let s=r.size-1;s in Ep.prototype||Object.defineProperty(Ep.prototype,s,{get(){return[...j(this).trackSet][s]}}),queueMicrotask(()=>{t.dispatchEvent(new Tu("addtrack",{track:e}))})}function vp(i){var e;let t=(e=j(i).media)==null?void 0:e.videoTracks;t&&(j(t).trackSet.delete(i),queueMicrotask(()=>{t.dispatchEvent(new Tu("removetrack",{track:i}))}))}function Jw(i){var e;let t=(e=j(i).media.videoTracks)!=null?e:[],r=!1;for(let s of t)s!==i&&(s.selected=!1,r=!0);if(r){if(j(t).changeRequested)return;j(t).changeRequested=!0,queueMicrotask(()=>{delete j(t).changeRequested,t.dispatchEvent(new Event("change"))})}}var us,cs,hs,Ln,Wa,Ep=class extends EventTarget{constructor(){super(),ne(this,Ln),ne(this,us),ne(this,cs),ne(this,hs),j(this).trackSet=new Set}[Symbol.iterator](){return I(this,Ln,Wa).values()}get length(){return I(this,Ln,Wa).size}getTrackById(i){var e;return(e=[...I(this,Ln,Wa)].find(t=>t.id===i))!=null?e:null}get selectedIndex(){return[...I(this,Ln,Wa)].findIndex(i=>i.selected)}get onaddtrack(){return I(this,us)}set onaddtrack(i){I(this,us)&&(this.removeEventListener("addtrack",I(this,us)),J(this,us,void 0)),typeof i=="function"&&(J(this,us,i),this.addEventListener("addtrack",i))}get onremovetrack(){return I(this,cs)}set onremovetrack(i){I(this,cs)&&(this.removeEventListener("removetrack",I(this,cs)),J(this,cs,void 0)),typeof i=="function"&&(J(this,cs,i),this.addEventListener("removetrack",i))}get onchange(){return I(this,hs)}set onchange(i){I(this,hs)&&(this.removeEventListener("change",I(this,hs)),J(this,hs,void 0)),typeof i=="function"&&(J(this,hs,i),this.addEventListener("change",i))}};us=new WeakMap,cs=new WeakMap,hs=new WeakMap,Ln=new WeakSet,Wa=function(){return j(this).trackSet};var _u=class extends Event{constructor(i,e){super(i),Le(this,"rendition"),this.rendition=e.rendition}};function eD(i,e){let t=j(i).media.videoRenditions;j(e).media=j(i).media,j(e).track=i;let r=j(i).renditionSet;r.add(e);let s=r.size-1;s in bp.prototype||Object.defineProperty(bp.prototype,s,{get(){return wn(this)[s]}}),queueMicrotask(()=>{i.selected&&t.dispatchEvent(new _u("addrendition",{rendition:e}))})}function tD(i){let e=j(i).media.videoRenditions,t=j(i).track;j(t).renditionSet.delete(i),queueMicrotask(()=>{j(i).track.selected&&e.dispatchEvent(new _u("removerendition",{rendition:i}))})}function iD(i){let e=j(i).media.videoRenditions;!e||j(e).changeRequested||(j(e).changeRequested=!0,queueMicrotask(()=>{delete j(e).changeRequested,j(i).track.selected&&e.dispatchEvent(new Event("change"))}))}function wn(i){return[...j(i).media.videoTracks].filter(e=>e.selected).flatMap(e=>[...j(e).renditionSet])}var fs,ms,ps,bp=class extends EventTarget{constructor(){super(...arguments),ne(this,fs),ne(this,ms),ne(this,ps)}[Symbol.iterator](){return wn(this).values()}get length(){return wn(this).length}getRenditionById(i){var e;return(e=wn(this).find(t=>`${t.id}`==`${i}`))!=null?e:null}get selectedIndex(){return wn(this).findIndex(i=>i.selected)}set selectedIndex(i){for(let[e,t]of wn(this).entries())t.selected=e===i}get onaddrendition(){return I(this,fs)}set onaddrendition(i){I(this,fs)&&(this.removeEventListener("addrendition",I(this,fs)),J(this,fs,void 0)),typeof i=="function"&&(J(this,fs,i),this.addEventListener("addrendition",i))}get onremoverendition(){return I(this,ms)}set onremoverendition(i){I(this,ms)&&(this.removeEventListener("removerendition",I(this,ms)),J(this,ms,void 0)),typeof i=="function"&&(J(this,ms,i),this.addEventListener("removerendition",i))}get onchange(){return I(this,ps)}set onchange(i){I(this,ps)&&(this.removeEventListener("change",I(this,ps)),J(this,ps,void 0)),typeof i=="function"&&(J(this,ps,i),this.addEventListener("change",i))}};fs=new WeakMap,ms=new WeakMap,ps=new WeakMap;var Ya,rD=class{constructor(){Le(this,"src"),Le(this,"id"),Le(this,"width"),Le(this,"height"),Le(this,"bitrate"),Le(this,"frameRate"),Le(this,"codec"),ne(this,Ya,!1)}get selected(){return I(this,Ya)}set selected(i){I(this,Ya)!==i&&(J(this,Ya,i),iD(this))}};Ya=new WeakMap;var qa,_T=class{constructor(){Le(this,"id"),Le(this,"kind"),Le(this,"label",""),Le(this,"language",""),Le(this,"sourceBuffer"),ne(this,qa,!1)}addRendition(i,e,t,r,s,n){let a=new rD;return a.src=i,a.width=e,a.height=t,a.frameRate=n,a.bitrate=s,a.codec=r,eD(this,a),a}removeRendition(i){tD(i)}get selected(){return I(this,qa)}set selected(i){I(this,qa)!==i&&(J(this,qa,i),i===!0&&Jw(this))}};qa=new WeakMap;function sD(i,e){let t=j(i).media.audioRenditions;j(e).media=j(i).media,j(e).track=i;let r=j(i).renditionSet;r.add(e);let s=r.size-1;s in yp.prototype||Object.defineProperty(yp.prototype,s,{get(){return Dn(this)[s]}}),queueMicrotask(()=>{i.enabled&&t.dispatchEvent(new _u("addrendition",{rendition:e}))})}function nD(i){let e=j(i).media.audioRenditions,t=j(i).track;j(t).renditionSet.delete(i),queueMicrotask(()=>{j(i).track.enabled&&e.dispatchEvent(new _u("removerendition",{rendition:i}))})}function aD(i){let e=j(i).media.audioRenditions;!e||j(e).changeRequested||(j(e).changeRequested=!0,queueMicrotask(()=>{delete j(e).changeRequested,j(i).track.enabled&&e.dispatchEvent(new Event("change"))}))}function Dn(i){return[...j(i).media.audioTracks].filter(e=>e.enabled).flatMap(e=>[...j(e).renditionSet])}var gs,vs,Es,yp=class extends EventTarget{constructor(){super(...arguments),ne(this,gs),ne(this,vs),ne(this,Es)}[Symbol.iterator](){return Dn(this).values()}get length(){return Dn(this).length}getRenditionById(i){var e;return(e=Dn(this).find(t=>`${t.id}`==`${i}`))!=null?e:null}get selectedIndex(){return Dn(this).findIndex(i=>i.selected)}set selectedIndex(i){for(let[e,t]of Dn(this).entries())t.selected=e===i}get onaddrendition(){return I(this,gs)}set onaddrendition(i){I(this,gs)&&(this.removeEventListener("addrendition",I(this,gs)),J(this,gs,void 0)),typeof i=="function"&&(J(this,gs,i),this.addEventListener("addrendition",i))}get onremoverendition(){return I(this,vs)}set onremoverendition(i){I(this,vs)&&(this.removeEventListener("removerendition",I(this,vs)),J(this,vs,void 0)),typeof i=="function"&&(J(this,vs,i),this.addEventListener("removerendition",i))}get onchange(){return I(this,Es)}set onchange(i){I(this,Es)&&(this.removeEventListener("change",I(this,Es)),J(this,Es,void 0)),typeof i=="function"&&(J(this,Es,i),this.addEventListener("change",i))}};gs=new WeakMap,vs=new WeakMap,Es=new WeakMap;var ja,oD=class{constructor(){Le(this,"src"),Le(this,"id"),Le(this,"bitrate"),Le(this,"codec"),ne(this,ja,!1)}get selected(){return I(this,ja)}set selected(i){I(this,ja)!==i&&(J(this,ja,i),aD(this))}};ja=new WeakMap;function Tp(i,e){let t=i.audioTracks;j(e).media=i,j(e).renditionSet||(j(e).renditionSet=new Set);let r=j(t).trackSet;r.add(e);let s=r.size-1;s in Ap.prototype||Object.defineProperty(Ap.prototype,s,{get(){return[...j(this).trackSet][s]}}),queueMicrotask(()=>{t.dispatchEvent(new Tu("addtrack",{track:e}))})}function _p(i){var e;let t=(e=j(i).media)==null?void 0:e.audioTracks;t&&(j(t).trackSet.delete(i),queueMicrotask(()=>{t.dispatchEvent(new Tu("removetrack",{track:i}))}))}function lD(i){let e=j(i).media.audioTracks;!e||j(e).changeRequested||(j(e).changeRequested=!0,queueMicrotask(()=>{delete j(e).changeRequested,e.dispatchEvent(new Event("change"))}))}var bs,ys,Ts,za,du,Ap=class extends EventTarget{constructor(){super(),ne(this,za),ne(this,bs),ne(this,ys),ne(this,Ts),j(this).trackSet=new Set}[Symbol.iterator](){return I(this,za,du).values()}get length(){return I(this,za,du).size}getTrackById(i){var e;return(e=[...I(this,za,du)].find(t=>t.id===i))!=null?e:null}get onaddtrack(){return I(this,bs)}set onaddtrack(i){I(this,bs)&&(this.removeEventListener("addtrack",I(this,bs)),J(this,bs,void 0)),typeof i=="function"&&(J(this,bs,i),this.addEventListener("addtrack",i))}get onremovetrack(){return I(this,ys)}set onremovetrack(i){I(this,ys)&&(this.removeEventListener("removetrack",I(this,ys)),J(this,ys,void 0)),typeof i=="function"&&(J(this,ys,i),this.addEventListener("removetrack",i))}get onchange(){return I(this,Ts)}set onchange(i){I(this,Ts)&&(this.removeEventListener("change",I(this,Ts)),J(this,Ts,void 0)),typeof i=="function"&&(J(this,Ts,i),this.addEventListener("change",i))}};bs=new WeakMap,ys=new WeakMap,Ts=new WeakMap,za=new WeakSet,du=function(){return j(this).trackSet};var Xa,AT=class{constructor(){Le(this,"id"),Le(this,"kind"),Le(this,"label",""),Le(this,"language",""),Le(this,"sourceBuffer"),ne(this,Xa,!1)}addRendition(i,e,t){let r=new oD;return r.src=i,r.codec=e,r.bitrate=t,sD(this,r),r}removeRendition(i){nD(i)}get enabled(){return I(this,Xa)}set enabled(i){I(this,Xa)!==i&&(J(this,Xa,i),lD(this))}};Xa=new WeakMap;var dT=Eu(globalThis.HTMLMediaElement,"video"),uT=Eu(globalThis.HTMLMediaElement,"audio");function dD(i){if(!(i!=null&&i.prototype))return i;let e=Eu(i,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"videoTracks",{get(){return uD(this)}});let t=Eu(i,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"audioTracks",{get(){return cD(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(n,a="",o=""){let l=new _T;return l.kind=n,l.label=a,l.language=o,gp(this,l),l}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=vp),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(n,a="",o=""){let l=new AT;return l.kind=n,l.label=a,l.language=o,Tp(this,l),l}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=_p),"videoRenditions"in i.prototype||Object.defineProperty(i.prototype,"videoRenditions",{get(){return r(this)}});let r=n=>{let a=j(n).videoRenditions;return a||(a=new bp,j(a).media=n,j(n).videoRenditions=a),a};"audioRenditions"in i.prototype||Object.defineProperty(i.prototype,"audioRenditions",{get(){return s(this)}});let s=n=>{let a=j(n).audioRenditions;return a||(a=new yp,j(a).media=n,j(n).audioRenditions=a),a};return i}function Eu(i,e){var t;if(i!=null&&i.prototype)return(t=Object.getOwnPropertyDescriptor(i.prototype,`${e}Tracks`))==null?void 0:t.get}function uD(i){var e;let t=j(i).videoTracks;if(!t&&(t=new Ep,j(i).videoTracks=t,dT)){let r=dT.call((e=i.nativeEl)!=null?e:i);for(let s of r)gp(i,s);r.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",s=>{if([...t].some(n=>n instanceof _T)){for(let n of r)vp(n);return}gp(i,s.track)}),r.addEventListener("removetrack",s=>{vp(s.track)})}return t}function cD(i){var e;let t=j(i).audioTracks;if(!t&&(t=new Ap,j(i).audioTracks=t,uT)){let r=uT.call((e=i.nativeEl)!=null?e:i);for(let s of r)Tp(i,s);r.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",s=>{if([...t].some(n=>n instanceof AT)){for(let n of r)_p(n);return}Tp(i,s.track)}),r.addEventListener("removetrack",s=>{_p(s.track)})}return t}yu.push("castchange","entercast","leavecast");var w={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},hD=Object.values(w),cT=Cw(),hT="mux-video",Pi,Qa,uu,Za,cu,hu,fu,mu,pu,Ja,gu,fD=class extends dp{constructor(){super(),ne(this,Ja),ne(this,Pi),ne(this,Qa),ne(this,uu),ne(this,Za,{}),ne(this,cu,{}),ne(this,hu),ne(this,fu),ne(this,mu),ne(this,pu),J(this,uu,ru())}static get NAME(){return hT}static get VERSION(){return cT}static get observedAttributes(){var i;return[...hD,...(i=dp.observedAttributes)!=null?i:[]]}get preferCmcd(){var i;return(i=this.getAttribute(w.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?In.includes(i)?this.setAttribute(w.PREFER_CMCD,i):console.warn(`Invalid value for preferCmcd. Must be one of ${In.join()}`):this.removeAttribute(w.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(w.PLAYER_INIT_TIME)?+this.getAttribute(w.PLAYER_INIT_TIME):I(this,uu)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(w.PLAYER_INIT_TIME):this.setAttribute(w.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=I(this,mu))!=null?i:hT}set playerSoftwareName(i){J(this,mu,i)}get playerSoftwareVersion(){var i;return(i=I(this,fu))!=null?i:cT}set playerSoftwareVersion(i){J(this,fu,i)}get _hls(){var i;return(i=I(this,Pi))==null?void 0:i.engine}get mux(){var i;return(i=this.nativeEl)==null?void 0:i.mux}get error(){var i;return(i=rp(this.nativeEl))!=null?i:null}get errorTranslator(){return I(this,pu)}set errorTranslator(i){J(this,pu,i)}get src(){return this.getAttribute("src")}set src(i){i!==this.src&&(i==null?this.removeAttribute("src"):this.setAttribute("src",i))}get type(){var i;return(i=this.getAttribute(w.TYPE))!=null?i:void 0}set type(i){i!==this.type&&(i?this.setAttribute(w.TYPE,i):this.removeAttribute(w.TYPE))}get autoplay(){let i=this.getAttribute("autoplay");return i===null?!1:i===""?!0:i}set autoplay(i){let e=this.autoplay;i!==e&&(i?this.setAttribute("autoplay",typeof i=="string"?i:""):this.removeAttribute("autoplay"))}get preload(){let i=this.getAttribute("preload");return i===""?"auto":["none","metadata","auto"].includes(i)?i:super.preload}set preload(i){i!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(i)?this.setAttribute("preload",i):this.removeAttribute("preload"))}get debug(){return this.getAttribute(w.DEBUG)!=null}set debug(i){i!==this.debug&&(i?this.setAttribute(w.DEBUG,""):this.removeAttribute(w.DEBUG))}get disableTracking(){return this.hasAttribute(w.DISABLE_TRACKING)}set disableTracking(i){i!==this.disableTracking&&this.toggleAttribute(w.DISABLE_TRACKING,!!i)}get disableCookies(){return this.hasAttribute(w.DISABLE_COOKIES)}set disableCookies(i){i!==this.disableCookies&&(i?this.setAttribute(w.DISABLE_COOKIES,""):this.removeAttribute(w.DISABLE_COOKIES))}get startTime(){let i=this.getAttribute(w.START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set startTime(i){i!==this.startTime&&(i==null?this.removeAttribute(w.START_TIME):this.setAttribute(w.START_TIME,`${i}`))}get playbackId(){var i;return this.hasAttribute(w.PLAYBACK_ID)?this.getAttribute(w.PLAYBACK_ID):(i=ip(this.src))!=null?i:void 0}set playbackId(i){i!==this.playbackId&&(i?this.setAttribute(w.PLAYBACK_ID,i):this.removeAttribute(w.PLAYBACK_ID))}get maxResolution(){var i;return(i=this.getAttribute(w.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(w.MAX_RESOLUTION,i):this.removeAttribute(w.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(w.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(w.MIN_RESOLUTION,i):this.removeAttribute(w.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(w.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(w.RENDITION_ORDER,i):this.removeAttribute(w.RENDITION_ORDER))}get programStartTime(){let i=this.getAttribute(w.PROGRAM_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programStartTime(i){i==null?this.removeAttribute(w.PROGRAM_START_TIME):this.setAttribute(w.PROGRAM_START_TIME,`${i}`)}get programEndTime(){let i=this.getAttribute(w.PROGRAM_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programEndTime(i){i==null?this.removeAttribute(w.PROGRAM_END_TIME):this.setAttribute(w.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){let i=this.getAttribute(w.ASSET_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetStartTime(i){i==null?this.removeAttribute(w.ASSET_START_TIME):this.setAttribute(w.ASSET_START_TIME,`${i}`)}get assetEndTime(){let i=this.getAttribute(w.ASSET_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetEndTime(i){i==null?this.removeAttribute(w.ASSET_END_TIME):this.setAttribute(w.ASSET_END_TIME,`${i}`)}get customDomain(){var i;return(i=this.getAttribute(w.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(w.CUSTOM_DOMAIN,i):this.removeAttribute(w.CUSTOM_DOMAIN))}get drmToken(){var i;return(i=this.getAttribute(w.DRM_TOKEN))!=null?i:void 0}set drmToken(i){i!==this.drmToken&&(i?this.setAttribute(w.DRM_TOKEN,i):this.removeAttribute(w.DRM_TOKEN))}get playbackToken(){var i,e,t,r;if(this.hasAttribute(w.PLAYBACK_TOKEN))return(i=this.getAttribute(w.PLAYBACK_TOKEN))!=null?i:void 0;if(this.hasAttribute(w.PLAYBACK_ID)){let[,s]=eu((e=this.playbackId)!=null?e:"");return(t=new URLSearchParams(s).get("token"))!=null?t:void 0}if(this.src)return(r=new URLSearchParams(this.src).get("token"))!=null?r:void 0}set playbackToken(i){i!==this.playbackToken&&(i?this.setAttribute(w.PLAYBACK_TOKEN,i):this.removeAttribute(w.PLAYBACK_TOKEN))}get tokens(){let i=this.getAttribute(w.PLAYBACK_TOKEN),e=this.getAttribute(w.DRM_TOKEN);return{...I(this,cu),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{}}}set tokens(i){J(this,cu,i!=null?i:{})}get ended(){return np(this.nativeEl,this._hls)}get envKey(){var i;return(i=this.getAttribute(w.ENV_KEY))!=null?i:void 0}set envKey(i){i!==this.envKey&&(i?this.setAttribute(w.ENV_KEY,i):this.removeAttribute(w.ENV_KEY))}get beaconCollectionDomain(){var i;return(i=this.getAttribute(w.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(w.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(w.BEACON_COLLECTION_DOMAIN))}get streamType(){var i;return(i=this.getAttribute(w.STREAM_TYPE))!=null?i:Jd(this.nativeEl)}set streamType(i){i!==this.streamType&&(i?this.setAttribute(w.STREAM_TYPE,i):this.removeAttribute(w.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(w.TARGET_LIVE_WINDOW)?+this.getAttribute(w.TARGET_LIVE_WINDOW):jy(this.nativeEl)}set targetLiveWindow(i){i!=this.targetLiveWindow&&(i==null?this.removeAttribute(w.TARGET_LIVE_WINDOW):this.setAttribute(w.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i,e;if(this.hasAttribute(w.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:t}=this,r=(i=this.nativeEl.seekable.end(0))!=null?i:0,s=(e=this.nativeEl.seekable.start(0))!=null?e:0;return Math.max(s,r-t)}return zy(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(w.LIVE_EDGE_OFFSET))return+this.getAttribute(w.LIVE_EDGE_OFFSET)}set liveEdgeOffset(i){i!=this.liveEdgeOffset&&(i==null?this.removeAttribute(w.LIVE_EDGE_OFFSET):this.setAttribute(w.LIVE_EDGE_OFFSET,`${+i}`))}get seekable(){return nu(this.nativeEl)}async addCuePoints(i){return Qm(this.nativeEl,i)}get activeCuePoint(){return Zm(this.nativeEl)}get cuePoints(){return $y(this.nativeEl)}async addChapters(i){return ep(this.nativeEl,i)}get activeChapter(){return tp(this.nativeEl)}get chapters(){return Gy(this.nativeEl)}getStartDate(){return Ky(this.nativeEl,this._hls)}get currentPdt(){return Vy(this.nativeEl,this._hls)}get preferPlayback(){let i=this.getAttribute(w.PREFER_PLAYBACK);if(i===jt.MSE||i===jt.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===jt.MSE||i===jt.NATIVE?this.setAttribute(w.PREFER_PLAYBACK,i):this.removeAttribute(w.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(i=>i.startsWith("metadata-")&&![w.METADATA_URL].includes(i)).reduce((i,e)=>{let t=this.getAttribute(e);return t!=null&&(i[e.replace(/^metadata-/,"").replace(/-/g,"_")]=t),i},{}),...I(this,Za)}}set metadata(i){J(this,Za,i!=null?i:{}),this.mux&&this.mux.emit("hb",I(this,Za))}get _hlsConfig(){return I(this,hu)}set _hlsConfig(i){J(this,hu,i)}load(){J(this,Pi,Zy(this,this.nativeEl,I(this,Pi)))}unload(){ap(this.nativeEl,I(this,Pi)),J(this,Pi,void 0)}attributeChangedCallback(i,e,t){var r,s;switch(dp.observedAttributes.includes(i)&&!["src","autoplay","preload"].includes(i)&&super.attributeChangedCallback(i,e,t),i){case w.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=t!=null?t:void 0;break;case w.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=t!=null?t:void 0;break;case"src":{let n=!!e,a=!!t;!n&&a?Fe(this,Ja,gu).call(this):n&&!a?this.unload():n&&a&&(this.unload(),Fe(this,Ja,gu).call(this));break}case"autoplay":if(t===e)break;(r=I(this,Pi))==null||r.setAutoplay(this.autoplay);break;case"preload":if(t===e)break;(s=I(this,Pi))==null||s.setPreload(t);break;case w.PLAYBACK_ID:this.src=Va(this);break;case w.DEBUG:{let n=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=n);break}case w.METADATA_URL:t&&fetch(t).then(n=>n.json()).then(n=>this.metadata=n).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${t}!`));break;case w.STREAM_TYPE:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case w.TARGET_LIVE_WINDOW:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}connectedCallback(){var i;(i=super.connectedCallback)==null||i.call(this),this.nativeEl&&this.src&&!I(this,Pi)&&Fe(this,Ja,gu).call(this)}disconnectedCallback(){this.unload()}};Pi=new WeakMap,Qa=new WeakMap,uu=new WeakMap,Za=new WeakMap,cu=new WeakMap,hu=new WeakMap,fu=new WeakMap,mu=new WeakMap,pu=new WeakMap,Ja=new WeakSet,gu=async function(){I(this,Qa)||(await J(this,Qa,Promise.resolve()),J(this,Qa,null),this.load())};var vu,Sp=class extends Qw(dD(fD)){constructor(){super(...arguments),ne(this,vu)}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var i;return(i=I(this,vu))!=null?i:this.muxCastCustomData}set castCustomData(i){J(this,vu,i)}};vu=new WeakMap;lp.customElements.get("mux-video")||(lp.customElements.define("mux-video",Sp),lp.MuxVideoElement=Sp);var ST=Sp;function xT(i){let e="";return Object.entries(i).forEach(([t,r])=>{r!=null&&(e+=`${Au(t)}: ${r}; `)}),e?e.trim():void 0}function Au(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Su(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function St(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function Lp(i){let e=mD(i).toString();return e?"?"+e:""}function mD(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}var wp=(i,e)=>!i||!e?!1:i.contains(e)?!0:wp(i,e.getRootNode().host);var RT="mux.com",pD=()=>{try{return"3.3.2"}catch{}return"UNKNOWN"},gD=pD(),Ru=()=>gD,IT=(i,{token:e,customDomain:t=RT,thumbnailTime:r,programTime:s}={})=>{var o;let n=e==null?r:void 0,{aud:a}=(o=_r(e))!=null?o:{};if(!(e&&a!=="t"))return`https://image.${t}/${i}/thumbnail.webp${Lp({token:e,time:n,program_time:s})}`},kT=(i,{token:e,customDomain:t=RT,programStartTime:r,programEndTime:s}={})=>{var a;let{aud:n}=(a=_r(e))!=null?a:{};if(!(e&&n!=="s"))return`https://image.${t}/${i}/storyboard.vtt${Lp({token:e,format:"webp",program_start_time:r,program_end_time:s})}`},eo=i=>{if(i){if([Re.LIVE,Re.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return Re.LIVE}};var vD={crossorigin:"crossOrigin",playsinline:"playsInline"};function LT(i){var e;return(e=vD[i])!=null?e:Su(i)}var xs,Rs,xt,xu=class{constructor(e,t){It(this,xs);It(this,Rs);It(this,xt,[]);Bt(this,xs,e),Bt(this,Rs,t)}[Symbol.iterator](){return Se(this,xt).values()}get length(){return Se(this,xt).length}get value(){var e;return(e=Se(this,xt).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Bt(this,xt,[]),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return Se(this,xt)[e]}values(){return Se(this,xt).values()}keys(){return Se(this,xt).keys()}forEach(e){Se(this,xt).forEach(e)}add(...e){var t,r;e.forEach(s=>{this.contains(s)||Se(this,xt).push(s)}),!(this.value===""&&!((t=Se(this,xs))!=null&&t.hasAttribute(`${Se(this,Rs)}`)))&&((r=Se(this,xs))==null||r.setAttribute(`${Se(this,Rs)}`,`${this.value}`))}remove(...e){var t;e.forEach(r=>{Se(this,xt).splice(Se(this,xt).indexOf(r),1)}),(t=Se(this,xs))==null||t.setAttribute(`${Se(this,Rs)}`,`${this.value}`)}contains(e){return Se(this,xt).includes(e)}toggle(e,t){return typeof t!="undefined"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};xs=new WeakMap,Rs=new WeakMap,xt=new WeakMap;var wT=`[mux-player ${Ru()}]`;function Oi(...i){console.warn(wT,...i)}function Ot(...i){console.error(wT,...i)}function Dp(i){var t;let e=(t=i.message)!=null?t:"";i.context&&(e+=` ${i.context}`),i.file&&(e+=` ${X("Read more: ")}
1336
- https://github.com/muxinc/elements/blob/main/errors/${i.file}`),Oi(e)}var Tt={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Is={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},CT=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),ED=yu.filter(i=>i!=="error"),bD=Object.values(Tt).filter(i=>![Tt.PLAYSINLINE].includes(i)),yD=Object.values(Is),Cp=class extends kt.HTMLElement{static get observedAttributes(){return[...bD,...yD]}constructor(){super()}init(){ED.forEach(e=>{var t;(t=this.media)==null||t.addEventListener(e,r=>{this.dispatchEvent(new Event(r.type))})})}attributeChangedCallback(e,t,r){var s,n;switch(e){case Is.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case Is.VOLUME:{let a=(s=St(r))!=null?s:1;this.media&&(this.media.volume=a);return}case Is.PLAYBACKRATE:{let a=(n=St(r))!=null?n:1;this.media&&(this.media.playbackRate=a,this.media.defaultPlaybackRate=a);return}}}play(){var e,t;return(t=(e=this.media)==null?void 0:e.play())!=null?t:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}load(){var e;(e=this.media)==null||e.load()}requestCast(e){var t;return(t=this.media)==null?void 0:t.requestCast(e)}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var e,t;return(t=(e=this.media)==null?void 0:e.paused)!=null?t:!0}get duration(){var e,t;return(t=(e=this.media)==null?void 0:e.duration)!=null?t:NaN}get ended(){var e,t;return(t=(e=this.media)==null?void 0:e.ended)!=null?t:!1}get buffered(){var e,t;return(t=(e=this.media)==null?void 0:e.buffered)!=null?t:CT}get seekable(){var e,t;return(t=(e=this.media)==null?void 0:e.seekable)!=null?t:CT}get readyState(){var e,t;return(t=(e=this.media)==null?void 0:e.readyState)!=null?t:0}get videoWidth(){var e,t;return(t=(e=this.media)==null?void 0:e.videoWidth)!=null?t:0}get videoHeight(){var e,t;return(t=(e=this.media)==null?void 0:e.videoHeight)!=null?t:0}get currentSrc(){var e,t;return(t=(e=this.media)==null?void 0:e.currentSrc)!=null?t:""}get currentTime(){var e,t;return(t=(e=this.media)==null?void 0:e.currentTime)!=null?t:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,t;return(t=(e=this.media)==null?void 0:e.volume)!=null?t:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,t;return(t=(e=this.media)==null?void 0:e.playbackRate)!=null?t:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=St(this.getAttribute(Is.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(Is.PLAYBACKRATE,`${e}`):this.removeAttribute(Is.PLAYBACKRATE)}get crossOrigin(){return to(this,Tt.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(Tt.CROSSORIGIN,`${e}`)}get autoplay(){return to(this,Tt.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(Tt.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(Tt.AUTOPLAY)}get loop(){return to(this,Tt.LOOP)!=null}set loop(e){e?this.setAttribute(Tt.LOOP,""):this.removeAttribute(Tt.LOOP)}get muted(){var e,t;return(t=(e=this.media)==null?void 0:e.muted)!=null?t:!1}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return to(this,Tt.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(Tt.MUTED,""):this.removeAttribute(Tt.MUTED)}get playsInline(){return to(this,Tt.PLAYSINLINE)!=null}set playsInline(e){Ot("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(e){["","none","metadata","auto"].includes(e)?this.setAttribute(Tt.PRELOAD,e):this.removeAttribute(Tt.PRELOAD)}};function to(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var Mp=Cp;var UT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ee=(i,e,t)=>(UT(i,e,"read from private field"),t?t.call(i):e.get(i)),Ni=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ir=(i,e,t,r)=>(UT(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Mn,Iu,ks,io,xr,Rr,Ir,Ls,Pn,ku,ci,MT=1,PT=0,TD=1,_D={processCallback(i,e,t){if(t){for(let[r,s]of e)if(r in t){let n=t[r];typeof n=="boolean"&&s instanceof Rt&&typeof s.element[s.attributeName]=="boolean"?s.booleanValue=n:typeof n=="function"&&s instanceof Rt?s.element[s.attributeName]=n:s.value=n}}}},rr=class extends x.DocumentFragment{constructor(e,t,r=_D){var s;super(),Ni(this,Mn,void 0),Ni(this,Iu,void 0),this.append(e.content.cloneNode(!0)),ir(this,Mn,FT(this)),ir(this,Iu,r),(s=r.createCallback)==null||s.call(r,this,Ee(this,Mn),t),r.processCallback(this,Ee(this,Mn),t)}update(e){Ee(this,Iu).processCallback(this,Ee(this,Mn),e)}};Mn=new WeakMap;Iu=new WeakMap;var FT=(i,e=[])=>{let t,r;for(let s of i.attributes||[])if(s.value.includes("{{")){let n=new Pp;for([t,r]of NT(s.value))if(!t)n.append(r);else{let a=new Rt(i,s.name,s.namespaceURI);n.append(a),e.push([r,a])}s.value=n.toString()}for(let s of i.childNodes)if(s.nodeType===MT&&!(s instanceof HTMLTemplateElement))FT(s,e);else{let n=s.data;if(s.nodeType===MT||n.includes("{{")){let a=[];if(n)for([t,r]of NT(n))if(!t)a.push(new Text(r));else{let o=new sr(i);a.push(o),e.push([r,o])}else if(s instanceof HTMLTemplateElement){let o=new ro(i,s);a.push(o),e.push([o.expression,o])}s.replaceWith(...a.flatMap(o=>o.replacementNodes||[o]))}}return e},OT={},NT=i=>{let e="",t=0,r=OT[i],s=0,n;if(r)return r;for(r=[];n=i[s];s++)n==="{"&&i[s+1]==="{"&&i[s-1]!=="\\"&&i[s+2]&&++t==1?(e&&r.push([PT,e]),e="",s++):n==="}"&&i[s+1]==="}"&&i[s-1]!=="\\"&&!--t?(r.push([TD,e.trim()]),e="",s++):e+=n||"";return e&&r.push([PT,(t>0?"{{":"")+e]),OT[i]=r},AD=11,Lu=class{get value(){return""}set value(e){}toString(){return this.value}},BT=new WeakMap,Pp=class{constructor(){Ni(this,ks,[])}[Symbol.iterator](){return Ee(this,ks).values()}get length(){return Ee(this,ks).length}item(e){return Ee(this,ks)[e]}append(...e){for(let t of e)t instanceof Rt&&BT.set(t,this),Ee(this,ks).push(t)}toString(){return Ee(this,ks).join("")}};ks=new WeakMap;var Rt=class extends Lu{constructor(e,t,r){super(),Ni(this,Ls),Ni(this,io,""),Ni(this,xr,void 0),Ni(this,Rr,void 0),Ni(this,Ir,void 0),ir(this,xr,e),ir(this,Rr,t),ir(this,Ir,r)}get attributeName(){return Ee(this,Rr)}get attributeNamespace(){return Ee(this,Ir)}get element(){return Ee(this,xr)}get value(){return Ee(this,io)}set value(e){Ee(this,io)!==e&&(ir(this,io,e),!Ee(this,Ls,Pn)||Ee(this,Ls,Pn).length===1?e==null?Ee(this,xr).removeAttributeNS(Ee(this,Ir),Ee(this,Rr)):Ee(this,xr).setAttributeNS(Ee(this,Ir),Ee(this,Rr),e):Ee(this,xr).setAttributeNS(Ee(this,Ir),Ee(this,Rr),Ee(this,Ls,Pn).toString()))}get booleanValue(){return Ee(this,xr).hasAttributeNS(Ee(this,Ir),Ee(this,Rr))}set booleanValue(e){if(!Ee(this,Ls,Pn)||Ee(this,Ls,Pn).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};io=new WeakMap;xr=new WeakMap;Rr=new WeakMap;Ir=new WeakMap;Ls=new WeakSet;Pn=function(){return BT.get(this)};var sr=class extends Lu{constructor(e,t){super(),Ni(this,ku,void 0),Ni(this,ci,void 0),ir(this,ku,e),ir(this,ci,t?[...t]:[new Text])}get replacementNodes(){return Ee(this,ci)}get parentNode(){return Ee(this,ku)}get nextSibling(){return Ee(this,ci)[Ee(this,ci).length-1].nextSibling}get previousSibling(){return Ee(this,ci)[0].previousSibling}get value(){return Ee(this,ci).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let t=e.flat().flatMap(r=>r==null?[new Text]:r.forEach?[...r]:r.nodeType===AD?[...r.childNodes]:r.nodeType?[r]:[new Text(r)]);t.length||t.push(new Text),ir(this,ci,SD(Ee(this,ci)[0].parentNode,Ee(this,ci),t,this.nextSibling))}};ku=new WeakMap;ci=new WeakMap;var ro=class extends sr{constructor(e,t){let r=t.getAttribute("directive")||t.getAttribute("type"),s=t.getAttribute("expression")||t.getAttribute(r)||"";s.startsWith("{{")&&(s=s.trim().slice(2,-2).trim()),super(e),this.expression=s,this.template=t,this.directive=r}};function SD(i,e,t,r=null){let s=0,n,a,o,l=t.length,d=e.length;for(;s<l&&s<d&&e[s]==t[s];)s++;for(;s<l&&s<d&&t[l-1]==e[d-1];)r=t[--d,--l];if(s==d)for(;s<l;)i.insertBefore(t[s++],r);if(s==l)for(;s<d;)i.removeChild(e[s++]);else{for(n=e[s];s<l;)o=t[s++],a=n?n.nextSibling:r,n==o?n=a:s<l&&t[s]==a?(i.replaceChild(o,n),n=a):i.insertBefore(o,n);for(;n!=r;)a=n.nextSibling,i.removeChild(n),n=a}return t}var $T={string:i=>String(i)},Du=class{constructor(e){this.template=e,this.state=void 0}},ws=new WeakMap,Ds=new WeakMap,Op={partial:(i,e)=>{e[i.expression]=new Du(i.template)},if:(i,e)=>{var t;if(GT(i.expression,e))if(ws.get(i)!==i.template){ws.set(i,i.template);let r=new rr(i.template,e,Cu);i.replace(r),Ds.set(i,r)}else(t=Ds.get(i))==null||t.update(e);else i.replace(""),ws.delete(i),Ds.delete(i)}},xD=Object.keys(Op),Cu={processCallback(i,e,t){var r,s;if(t)for(let[n,a]of e){if(a instanceof ro){if(!a.directive){let l=xD.find(d=>a.template.hasAttribute(d));l&&(a.directive=l,a.expression=a.template.getAttribute(l))}(r=Op[a.directive])==null||r.call(Op,a,t);continue}let o=GT(n,t);if(o instanceof Du){ws.get(a)!==o.template?(ws.set(a,o.template),o=new rr(o.template,o.state,Cu),a.value=o,Ds.set(a,o)):(s=Ds.get(a))==null||s.update(o.state);continue}o?(a instanceof Rt&&a.attributeName.startsWith("aria-")&&(o=String(o)),a instanceof Rt?typeof o=="boolean"?a.booleanValue=o:typeof o=="function"?a.element[a.attributeName]=o:a.value=o:(a.value=o,ws.delete(a),Ds.delete(a))):a instanceof Rt?a.value=void 0:(a.value=void 0,ws.delete(a),Ds.delete(a))}}},HT={"!":i=>!i,"!!":i=>!!i,"==":(i,e)=>i==e,"!=":(i,e)=>i!=e,">":(i,e)=>i>e,">=":(i,e)=>i>=e,"<":(i,e)=>i<e,"<=":(i,e)=>i<=e,"??":(i,e)=>i!=null?i:e,"|":(i,e)=>{var t;return(t=$T[e])==null?void 0:t.call($T,i)}};function RD(i){return ID(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function GT(i,e={}){var t,r,s,n,a,o,l;let d=RD(i);if(d.length===0||d.some(({type:u})=>!u))return so(i);if(((t=d[0])==null?void 0:t.token)===">"){let u=e[(r=d[1])==null?void 0:r.token];if(!u)return so(i);let c={...e};u.state=c;let h=d.slice(2);for(let f=0;f<h.length;f+=3){let m=(s=h[f])==null?void 0:s.token,p=(n=h[f+1])==null?void 0:n.token,g=(a=h[f+2])==null?void 0:a.token;m&&p==="="&&(c[m]=no(g,e))}return u}if(d.length===1)return wu(d[0])?no(d[0].token,e):so(i);if(d.length===2){let u=(o=d[0])==null?void 0:o.token,c=HT[u];if(!c||!wu(d[1]))return so(i);let h=no(d[1].token,e);return c(h)}if(d.length===3){let u=(l=d[1])==null?void 0:l.token,c=HT[u];if(!c||!wu(d[0])||!wu(d[2]))return so(i);let h=no(d[0].token,e);if(u==="|")return c(h,d[2].token);let f=no(d[2].token,e);return c(h,f)}}function so(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function wu({type:i}){return["number","boolean","string","param"].includes(i)}function no(i,e){let t=i[0],r=i.slice(-1);return i==="true"||i==="false"?i==="true":t===r&&["'",'"'].includes(t)?i.slice(1,-1):Co(i)?parseFloat(i):e[i]}function ID(i,e){let t,r,s,n=[];for(;i;){s=null,t=i.length;for(let a in e)r=e[a].exec(i),r&&r.index<t&&(s={token:r[0],type:a,matches:r.slice(1)},t=r.index);t&&n.push({token:i.substr(0,t),type:void 0}),s&&n.push(s),i=i.substr(t+(s?s.token.length:0))}return n}var Hp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Fp=(i,e,t)=>(Hp(i,e,"read from private field"),t?t.call(i):e.get(i)),ao=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Cs=(i,e,t,r)=>(Hp(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Np=(i,e,t)=>(Hp(i,e,"access private method"),t),On,Mu,Nn,Bp,KT,Pu,$p,Up={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},VT=F.createElement("template");VT.innerHTML=`
1335
+ `).find(e=>!e.trim().startsWith("#")&&e.trim()!=="")}async function jw(i){try{let e=(await fetch(i,{method:"HEAD"})).headers.get("Content-Type");return Fw.some(t=>e===t)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function zw(i){try{let e=await(await fetch(i)).text(),t=e,r=Yw(e);if(r.length>0){let n=new URL(r[0],i).toString();t=await(await fetch(n)).text()}let s=qw(t);return Ww(s)}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}var ou=new Bw,Sr=new WeakSet,nt;$w(()=>{var i,e,t,r;if(!((e=(i=globalThis.chrome)==null?void 0:i.cast)!=null&&e.isAvailable)){console.debug("chrome.cast.isAvailable",(r=(t=globalThis.chrome)==null?void 0:t.cast)==null?void 0:r.isAvailable);return}nt||(nt=cast.framework,Ss().addEventListener(nt.CastContextEventType.CAST_STATE_CHANGED,s=>{ou.forEach(n=>{var a,o;return(o=(a=As.get(n)).onCastStateChanged)==null?void 0:o.call(a,s)})}),Ss().addEventListener(nt.CastContextEventType.SESSION_STATE_CHANGED,s=>{ou.forEach(n=>{var a,o;return(o=(a=As.get(n)).onSessionStateChanged)==null?void 0:o.call(a,s)})}),ou.forEach(s=>{var n,a;return(a=(n=As.get(s)).init)==null?void 0:a.call(n)}))});var aT=0,ke,lu,zt,Ar,Cn,kn,_s,hp,vt,ds,oT,fp,TT,mp,lT,cp,Xw=class extends EventTarget{constructor(i){super(),ne(this,vt),ne(this,ke),ne(this,lu),ne(this,zt),ne(this,Ar),ne(this,Cn,"disconnected"),ne(this,kn,!1),ne(this,_s,new Set),ne(this,hp,new WeakMap),J(this,ke,i),ou.add(this),As.set(this,{init:()=>Fe(this,vt,mp).call(this),onCastStateChanged:()=>Fe(this,vt,fp).call(this),onSessionStateChanged:()=>Fe(this,vt,TT).call(this),getCastPlayer:()=>I(this,vt,ds)}),Fe(this,vt,mp).call(this)}get state(){return I(this,Cn)}async watchAvailability(i){if(I(this,ke).disableRemotePlayback)throw new up("disableRemotePlayback attribute is present.");return I(this,hp).set(i,++aT),I(this,_s).add(i),aT}async cancelWatchAvailability(i){if(I(this,ke).disableRemotePlayback)throw new up("disableRemotePlayback attribute is present.");i?I(this,_s).delete(i):I(this,_s).clear()}async prompt(){var i,e,t,r;if(I(this,ke).disableRemotePlayback)throw new up("disableRemotePlayback attribute is present.");if(!((e=(i=globalThis.chrome)==null?void 0:i.cast)!=null&&e.isAvailable))throw new Uw("The RemotePlayback API is disabled on this platform.");let s=Sr.has(I(this,ke));Sr.add(I(this,ke)),bT(I(this,ke).castOptions),Object.entries(I(this,Ar)).forEach(([n,a])=>{I(this,zt).controller.addEventListener(n,a)});try{await Ss().requestSession()}catch(n){if(n==="cancel"){s||Sr.delete(I(this,ke));return}throw new Error(n)}(r=(t=As.get(I(this,ke)))==null?void 0:t.loadOnPrompt)==null||r.call(t)}};ke=new WeakMap,lu=new WeakMap,zt=new WeakMap,Ar=new WeakMap,Cn=new WeakMap,kn=new WeakMap,_s=new WeakMap,hp=new WeakMap,vt=new WeakSet,ds=function(){if(Sr.has(I(this,ke)))return I(this,zt)},oT=function(){Sr.has(I(this,ke))&&(Object.entries(I(this,Ar)).forEach(([i,e])=>{I(this,zt).controller.removeEventListener(i,e)}),Sr.delete(I(this,ke)),I(this,ke).muted=I(this,zt).isMuted,I(this,ke).currentTime=I(this,zt).savedPlayerState.currentTime,I(this,zt).savedPlayerState.isPaused===!1&&I(this,ke).play())},fp=function(){let i=Ss().getCastState();if(Sr.has(I(this,ke))&&i==="CONNECTING"&&(J(this,Cn,"connecting"),this.dispatchEvent(new Event("connecting"))),!I(this,kn)&&i!=null&&i.includes("CONNECT")){J(this,kn,!0);for(let e of I(this,_s))e(!0)}else if(I(this,kn)&&(!i||i==="NO_DEVICES_AVAILABLE")){J(this,kn,!1);for(let e of I(this,_s))e(!1)}},TT=async function(){var i;let{SESSION_RESUMED:e}=nt.SessionState;if(Ss().getSessionState()===e&&I(this,ke).castSrc===((i=kp())==null?void 0:i.media.contentId)){Sr.add(I(this,ke)),Object.entries(I(this,Ar)).forEach(([t,r])=>{I(this,zt).controller.addEventListener(t,r)});try{await Vw(new chrome.cast.media.GetStatusRequest)}catch(t){console.error(t)}I(this,Ar)[nt.RemotePlayerEventType.IS_PAUSED_CHANGED](),I(this,Ar)[nt.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},mp=function(){!nt||I(this,lu)||(J(this,lu,!0),bT(I(this,ke).castOptions),I(this,ke).textTracks.addEventListener("change",()=>Fe(this,vt,cp).call(this)),Fe(this,vt,fp).call(this),J(this,zt,new nt.RemotePlayer),new nt.RemotePlayerController(I(this,zt)),J(this,Ar,{[nt.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:i})=>{i===!0?(J(this,Cn,"connected"),this.dispatchEvent(new Event("connect"))):(Fe(this,vt,oT).call(this),J(this,Cn,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[nt.RemotePlayerEventType.DURATION_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("durationchange"))},[nt.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("volumechange"))},[nt.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("volumechange"))},[nt.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var i;(i=I(this,vt,ds))!=null&&i.isMediaLoaded&&I(this,ke).dispatchEvent(new Event("timeupdate"))},[nt.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event("resize"))},[nt.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{I(this,ke).dispatchEvent(new Event(this.paused?"pause":"play"))},[nt.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var i,e;((i=I(this,vt,ds))==null?void 0:i.playerState)!==chrome.cast.media.PlayerState.PAUSED&&I(this,ke).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(e=I(this,vt,ds))==null?void 0:e.playerState]))},[nt.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var i;(i=I(this,vt,ds))!=null&&i.isMediaLoaded&&(await Promise.resolve(),Fe(this,vt,lT).call(this))}}))},lT=function(){Fe(this,vt,cp).call(this)},cp=async function(){var i,e,t,r,s;if(!I(this,vt,ds))return;let n=((e=(i=I(this,zt).mediaInfo)==null?void 0:i.tracks)!=null?e:[]).filter(({type:h})=>h===chrome.cast.media.TrackType.TEXT),a=[...I(this,ke).textTracks].filter(({kind:h})=>h==="subtitles"||h==="captions"),o=n.map(({language:h,name:f,trackId:m})=>{var p;let{mode:g}=(p=a.find(E=>E.language===h&&E.label===f))!=null?p:{};return g?{mode:g,trackId:m}:!1}).filter(Boolean),l=o.filter(({mode:h})=>h!=="showing").map(({trackId:h})=>h),d=o.find(({mode:h})=>h==="showing"),u=(s=(r=(t=Ip())==null?void 0:t.getSessionObj().media[0])==null?void 0:r.activeTrackIds)!=null?s:[],c=u;if(u.length&&(c=c.filter(h=>!l.includes(h))),d!=null&&d.trackId&&(c=[...c,d.trackId]),c=[...new Set(c)],!((h,f)=>h.length===f.length&&h.every(m=>f.includes(m)))(u,c))try{let h=new chrome.cast.media.EditTracksInfoRequest(c);await Kw(h)}catch(h){console.error(h)}};var Qw=i=>{var e,t,r,s,n,a,o,l,d;return t=class extends i{constructor(){super(...arguments),ne(this,o),ne(this,r,{paused:!1}),ne(this,s,yT()),ne(this,n),ne(this,a)}get remote(){return I(this,a)?I(this,a):Hw()?(this.disableRemotePlayback||Gw(),As.set(this,{loadOnPrompt:()=>Fe(this,o,d).call(this)}),J(this,a,new Xw(this))):super.remote}attributeChangedCallback(u,c,h){if(super.attributeChangedCallback(u,c,h),u==="cast-receiver"&&h){I(this,s).receiverApplicationId=h;return}if(I(this,o,l))switch(u){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var u,c;if(!I(this,o,l))return super.load();let h=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);h.customData=this.castCustomData;let f=[...this.querySelectorAll("track")].filter(({kind:E,src:b})=>b&&(E==="subtitles"||E==="captions")),m=[],p=0;if(f.length&&(h.tracks=f.map(E=>{let b=++p;m.length===0&&E.track.mode==="showing"&&m.push(b);let T=new chrome.cast.media.Track(b,chrome.cast.media.TrackType.TEXT);return T.trackContentId=E.src,T.trackContentType="text/vtt",T.subtype=E.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,T.name=E.label,T.language=E.srclang,T})),this.castStreamType==="live"?h.streamType=chrome.cast.media.StreamType.LIVE:h.streamType=chrome.cast.media.StreamType.BUFFERED,h.metadata=new chrome.cast.media.GenericMediaMetadata,h.metadata.title=this.title,h.metadata.images=[{url:this.poster}],jw(this.castSrc)){let E=await zw(this.castSrc);(E!=null&&E.includes("m4s")||E!=null&&E.includes("mp4"))&&(h.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,h.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4)}let g=new chrome.cast.media.LoadRequest(h);g.currentTime=(u=super.currentTime)!=null?u:0,g.autoplay=!I(this,r).paused,g.activeTrackIds=m,await((c=Ip())==null?void 0:c.loadMedia(g)),this.dispatchEvent(new Event("volumechange"))}play(){var u;if(I(this,o,l)){I(this,o,l).isPaused&&((u=I(this,o,l).controller)==null||u.playOrPause());return}return super.play()}pause(){var u;if(I(this,o,l)){I(this,o,l).isPaused||(u=I(this,o,l).controller)==null||u.playOrPause();return}super.pause()}get castOptions(){return I(this,s)}get castReceiver(){var u;return(u=this.getAttribute("cast-receiver"))!=null?u:void 0}set castReceiver(u){this.castReceiver!=u&&this.setAttribute("cast-receiver",`${u}`)}get castSrc(){var u,c,h;return(h=(c=this.getAttribute("cast-src"))!=null?c:(u=this.querySelector("source"))==null?void 0:u.src)!=null?h:this.currentSrc}set castSrc(u){this.castSrc!=u&&this.setAttribute("cast-src",`${u}`)}get castContentType(){var u;return(u=this.getAttribute("cast-content-type"))!=null?u:void 0}set castContentType(u){this.setAttribute("cast-content-type",`${u}`)}get castStreamType(){var u,c;return(c=(u=this.getAttribute("cast-stream-type"))!=null?u:this.streamType)!=null?c:void 0}set castStreamType(u){this.setAttribute("cast-stream-type",`${u}`)}get castCustomData(){return I(this,n)}set castCustomData(u){let c=typeof u;if(!["object","undefined"].includes(c)){console.error(`castCustomData must be nullish or an object but value was of type ${c}`);return}J(this,n,u)}get readyState(){if(I(this,o,l))switch(I(this,o,l).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return I(this,o,l)?I(this,o,l).isPaused:super.paused}get muted(){var u;return I(this,o,l)?(u=I(this,o,l))==null?void 0:u.isMuted:super.muted}set muted(u){var c;if(I(this,o,l)){(u&&!I(this,o,l).isMuted||!u&&I(this,o,l).isMuted)&&((c=I(this,o,l).controller)==null||c.muteOrUnmute());return}super.muted=u}get volume(){var u,c;return I(this,o,l)?(c=(u=I(this,o,l))==null?void 0:u.volumeLevel)!=null?c:1:super.volume}set volume(u){var c;if(I(this,o,l)){I(this,o,l).volumeLevel=+u,(c=I(this,o,l).controller)==null||c.setVolumeLevel();return}super.volume=u}get duration(){var u,c,h;return I(this,o,l)&&(u=I(this,o,l))!=null&&u.isMediaLoaded?(h=(c=I(this,o,l))==null?void 0:c.duration)!=null?h:NaN:super.duration}get currentTime(){var u,c,h;return I(this,o,l)&&(u=I(this,o,l))!=null&&u.isMediaLoaded?(h=(c=I(this,o,l))==null?void 0:c.currentTime)!=null?h:0:super.currentTime}set currentTime(u){var c;if(I(this,o,l)){I(this,o,l).currentTime=u,(c=I(this,o,l).controller)==null||c.seek();return}super.currentTime=u}},r=new WeakMap,s=new WeakMap,n=new WeakMap,a=new WeakMap,o=new WeakSet,l=function(){var u,c;return(c=(u=As.get(this.remote))==null?void 0:u.getCastPlayer)==null?void 0:c.call(u)},d=async function(){I(this,r).paused=op(t.prototype,this,"paused"),op(t.prototype,this,"pause").call(this),this.muted=op(t.prototype,this,"muted");try{await this.load()}catch(u){console.error(u)}},Le(t,"observedAttributes",[...(e=i.observedAttributes)!=null?e:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),t},Tu=class extends Event{constructor(i,e){super(i),Le(this,"track"),this.track=e.track}},pp=new WeakMap;function j(i){var e;return(e=pp.get(i))!=null?e:Zw(i,{})}function Zw(i,e){let t=pp.get(i);return t||pp.set(i,t={}),Object.assign(t,e)}function gp(i,e){let t=i.videoTracks;j(e).media=i,j(e).renditionSet||(j(e).renditionSet=new Set);let r=j(t).trackSet;r.add(e);let s=r.size-1;s in Ep.prototype||Object.defineProperty(Ep.prototype,s,{get(){return[...j(this).trackSet][s]}}),queueMicrotask(()=>{t.dispatchEvent(new Tu("addtrack",{track:e}))})}function vp(i){var e;let t=(e=j(i).media)==null?void 0:e.videoTracks;t&&(j(t).trackSet.delete(i),queueMicrotask(()=>{t.dispatchEvent(new Tu("removetrack",{track:i}))}))}function Jw(i){var e;let t=(e=j(i).media.videoTracks)!=null?e:[],r=!1;for(let s of t)s!==i&&(s.selected=!1,r=!0);if(r){if(j(t).changeRequested)return;j(t).changeRequested=!0,queueMicrotask(()=>{delete j(t).changeRequested,t.dispatchEvent(new Event("change"))})}}var us,cs,hs,Ln,Wa,Ep=class extends EventTarget{constructor(){super(),ne(this,Ln),ne(this,us),ne(this,cs),ne(this,hs),j(this).trackSet=new Set}[Symbol.iterator](){return I(this,Ln,Wa).values()}get length(){return I(this,Ln,Wa).size}getTrackById(i){var e;return(e=[...I(this,Ln,Wa)].find(t=>t.id===i))!=null?e:null}get selectedIndex(){return[...I(this,Ln,Wa)].findIndex(i=>i.selected)}get onaddtrack(){return I(this,us)}set onaddtrack(i){I(this,us)&&(this.removeEventListener("addtrack",I(this,us)),J(this,us,void 0)),typeof i=="function"&&(J(this,us,i),this.addEventListener("addtrack",i))}get onremovetrack(){return I(this,cs)}set onremovetrack(i){I(this,cs)&&(this.removeEventListener("removetrack",I(this,cs)),J(this,cs,void 0)),typeof i=="function"&&(J(this,cs,i),this.addEventListener("removetrack",i))}get onchange(){return I(this,hs)}set onchange(i){I(this,hs)&&(this.removeEventListener("change",I(this,hs)),J(this,hs,void 0)),typeof i=="function"&&(J(this,hs,i),this.addEventListener("change",i))}};us=new WeakMap,cs=new WeakMap,hs=new WeakMap,Ln=new WeakSet,Wa=function(){return j(this).trackSet};var _u=class extends Event{constructor(i,e){super(i),Le(this,"rendition"),this.rendition=e.rendition}};function eD(i,e){let t=j(i).media.videoRenditions;j(e).media=j(i).media,j(e).track=i;let r=j(i).renditionSet;r.add(e);let s=r.size-1;s in bp.prototype||Object.defineProperty(bp.prototype,s,{get(){return wn(this)[s]}}),queueMicrotask(()=>{i.selected&&t.dispatchEvent(new _u("addrendition",{rendition:e}))})}function tD(i){let e=j(i).media.videoRenditions,t=j(i).track;j(t).renditionSet.delete(i),queueMicrotask(()=>{j(i).track.selected&&e.dispatchEvent(new _u("removerendition",{rendition:i}))})}function iD(i){let e=j(i).media.videoRenditions;!e||j(e).changeRequested||(j(e).changeRequested=!0,queueMicrotask(()=>{delete j(e).changeRequested,j(i).track.selected&&e.dispatchEvent(new Event("change"))}))}function wn(i){return[...j(i).media.videoTracks].filter(e=>e.selected).flatMap(e=>[...j(e).renditionSet])}var fs,ms,ps,bp=class extends EventTarget{constructor(){super(...arguments),ne(this,fs),ne(this,ms),ne(this,ps)}[Symbol.iterator](){return wn(this).values()}get length(){return wn(this).length}getRenditionById(i){var e;return(e=wn(this).find(t=>`${t.id}`==`${i}`))!=null?e:null}get selectedIndex(){return wn(this).findIndex(i=>i.selected)}set selectedIndex(i){for(let[e,t]of wn(this).entries())t.selected=e===i}get onaddrendition(){return I(this,fs)}set onaddrendition(i){I(this,fs)&&(this.removeEventListener("addrendition",I(this,fs)),J(this,fs,void 0)),typeof i=="function"&&(J(this,fs,i),this.addEventListener("addrendition",i))}get onremoverendition(){return I(this,ms)}set onremoverendition(i){I(this,ms)&&(this.removeEventListener("removerendition",I(this,ms)),J(this,ms,void 0)),typeof i=="function"&&(J(this,ms,i),this.addEventListener("removerendition",i))}get onchange(){return I(this,ps)}set onchange(i){I(this,ps)&&(this.removeEventListener("change",I(this,ps)),J(this,ps,void 0)),typeof i=="function"&&(J(this,ps,i),this.addEventListener("change",i))}};fs=new WeakMap,ms=new WeakMap,ps=new WeakMap;var Ya,rD=class{constructor(){Le(this,"src"),Le(this,"id"),Le(this,"width"),Le(this,"height"),Le(this,"bitrate"),Le(this,"frameRate"),Le(this,"codec"),ne(this,Ya,!1)}get selected(){return I(this,Ya)}set selected(i){I(this,Ya)!==i&&(J(this,Ya,i),iD(this))}};Ya=new WeakMap;var qa,_T=class{constructor(){Le(this,"id"),Le(this,"kind"),Le(this,"label",""),Le(this,"language",""),Le(this,"sourceBuffer"),ne(this,qa,!1)}addRendition(i,e,t,r,s,n){let a=new rD;return a.src=i,a.width=e,a.height=t,a.frameRate=n,a.bitrate=s,a.codec=r,eD(this,a),a}removeRendition(i){tD(i)}get selected(){return I(this,qa)}set selected(i){I(this,qa)!==i&&(J(this,qa,i),i===!0&&Jw(this))}};qa=new WeakMap;function sD(i,e){let t=j(i).media.audioRenditions;j(e).media=j(i).media,j(e).track=i;let r=j(i).renditionSet;r.add(e);let s=r.size-1;s in yp.prototype||Object.defineProperty(yp.prototype,s,{get(){return Dn(this)[s]}}),queueMicrotask(()=>{i.enabled&&t.dispatchEvent(new _u("addrendition",{rendition:e}))})}function nD(i){let e=j(i).media.audioRenditions,t=j(i).track;j(t).renditionSet.delete(i),queueMicrotask(()=>{j(i).track.enabled&&e.dispatchEvent(new _u("removerendition",{rendition:i}))})}function aD(i){let e=j(i).media.audioRenditions;!e||j(e).changeRequested||(j(e).changeRequested=!0,queueMicrotask(()=>{delete j(e).changeRequested,j(i).track.enabled&&e.dispatchEvent(new Event("change"))}))}function Dn(i){return[...j(i).media.audioTracks].filter(e=>e.enabled).flatMap(e=>[...j(e).renditionSet])}var gs,vs,Es,yp=class extends EventTarget{constructor(){super(...arguments),ne(this,gs),ne(this,vs),ne(this,Es)}[Symbol.iterator](){return Dn(this).values()}get length(){return Dn(this).length}getRenditionById(i){var e;return(e=Dn(this).find(t=>`${t.id}`==`${i}`))!=null?e:null}get selectedIndex(){return Dn(this).findIndex(i=>i.selected)}set selectedIndex(i){for(let[e,t]of Dn(this).entries())t.selected=e===i}get onaddrendition(){return I(this,gs)}set onaddrendition(i){I(this,gs)&&(this.removeEventListener("addrendition",I(this,gs)),J(this,gs,void 0)),typeof i=="function"&&(J(this,gs,i),this.addEventListener("addrendition",i))}get onremoverendition(){return I(this,vs)}set onremoverendition(i){I(this,vs)&&(this.removeEventListener("removerendition",I(this,vs)),J(this,vs,void 0)),typeof i=="function"&&(J(this,vs,i),this.addEventListener("removerendition",i))}get onchange(){return I(this,Es)}set onchange(i){I(this,Es)&&(this.removeEventListener("change",I(this,Es)),J(this,Es,void 0)),typeof i=="function"&&(J(this,Es,i),this.addEventListener("change",i))}};gs=new WeakMap,vs=new WeakMap,Es=new WeakMap;var ja,oD=class{constructor(){Le(this,"src"),Le(this,"id"),Le(this,"bitrate"),Le(this,"codec"),ne(this,ja,!1)}get selected(){return I(this,ja)}set selected(i){I(this,ja)!==i&&(J(this,ja,i),aD(this))}};ja=new WeakMap;function Tp(i,e){let t=i.audioTracks;j(e).media=i,j(e).renditionSet||(j(e).renditionSet=new Set);let r=j(t).trackSet;r.add(e);let s=r.size-1;s in Ap.prototype||Object.defineProperty(Ap.prototype,s,{get(){return[...j(this).trackSet][s]}}),queueMicrotask(()=>{t.dispatchEvent(new Tu("addtrack",{track:e}))})}function _p(i){var e;let t=(e=j(i).media)==null?void 0:e.audioTracks;t&&(j(t).trackSet.delete(i),queueMicrotask(()=>{t.dispatchEvent(new Tu("removetrack",{track:i}))}))}function lD(i){let e=j(i).media.audioTracks;!e||j(e).changeRequested||(j(e).changeRequested=!0,queueMicrotask(()=>{delete j(e).changeRequested,e.dispatchEvent(new Event("change"))}))}var bs,ys,Ts,za,du,Ap=class extends EventTarget{constructor(){super(),ne(this,za),ne(this,bs),ne(this,ys),ne(this,Ts),j(this).trackSet=new Set}[Symbol.iterator](){return I(this,za,du).values()}get length(){return I(this,za,du).size}getTrackById(i){var e;return(e=[...I(this,za,du)].find(t=>t.id===i))!=null?e:null}get onaddtrack(){return I(this,bs)}set onaddtrack(i){I(this,bs)&&(this.removeEventListener("addtrack",I(this,bs)),J(this,bs,void 0)),typeof i=="function"&&(J(this,bs,i),this.addEventListener("addtrack",i))}get onremovetrack(){return I(this,ys)}set onremovetrack(i){I(this,ys)&&(this.removeEventListener("removetrack",I(this,ys)),J(this,ys,void 0)),typeof i=="function"&&(J(this,ys,i),this.addEventListener("removetrack",i))}get onchange(){return I(this,Ts)}set onchange(i){I(this,Ts)&&(this.removeEventListener("change",I(this,Ts)),J(this,Ts,void 0)),typeof i=="function"&&(J(this,Ts,i),this.addEventListener("change",i))}};bs=new WeakMap,ys=new WeakMap,Ts=new WeakMap,za=new WeakSet,du=function(){return j(this).trackSet};var Xa,AT=class{constructor(){Le(this,"id"),Le(this,"kind"),Le(this,"label",""),Le(this,"language",""),Le(this,"sourceBuffer"),ne(this,Xa,!1)}addRendition(i,e,t){let r=new oD;return r.src=i,r.codec=e,r.bitrate=t,sD(this,r),r}removeRendition(i){nD(i)}get enabled(){return I(this,Xa)}set enabled(i){I(this,Xa)!==i&&(J(this,Xa,i),lD(this))}};Xa=new WeakMap;var dT=Eu(globalThis.HTMLMediaElement,"video"),uT=Eu(globalThis.HTMLMediaElement,"audio");function dD(i){if(!(i!=null&&i.prototype))return i;let e=Eu(i,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"videoTracks",{get(){return uD(this)}});let t=Eu(i,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"audioTracks",{get(){return cD(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(n,a="",o=""){let l=new _T;return l.kind=n,l.label=a,l.language=o,gp(this,l),l}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=vp),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(n,a="",o=""){let l=new AT;return l.kind=n,l.label=a,l.language=o,Tp(this,l),l}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=_p),"videoRenditions"in i.prototype||Object.defineProperty(i.prototype,"videoRenditions",{get(){return r(this)}});let r=n=>{let a=j(n).videoRenditions;return a||(a=new bp,j(a).media=n,j(n).videoRenditions=a),a};"audioRenditions"in i.prototype||Object.defineProperty(i.prototype,"audioRenditions",{get(){return s(this)}});let s=n=>{let a=j(n).audioRenditions;return a||(a=new yp,j(a).media=n,j(n).audioRenditions=a),a};return i}function Eu(i,e){var t;if(i!=null&&i.prototype)return(t=Object.getOwnPropertyDescriptor(i.prototype,`${e}Tracks`))==null?void 0:t.get}function uD(i){var e;let t=j(i).videoTracks;if(!t&&(t=new Ep,j(i).videoTracks=t,dT)){let r=dT.call((e=i.nativeEl)!=null?e:i);for(let s of r)gp(i,s);r.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",s=>{if([...t].some(n=>n instanceof _T)){for(let n of r)vp(n);return}gp(i,s.track)}),r.addEventListener("removetrack",s=>{vp(s.track)})}return t}function cD(i){var e;let t=j(i).audioTracks;if(!t&&(t=new Ap,j(i).audioTracks=t,uT)){let r=uT.call((e=i.nativeEl)!=null?e:i);for(let s of r)Tp(i,s);r.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",s=>{if([...t].some(n=>n instanceof AT)){for(let n of r)_p(n);return}Tp(i,s.track)}),r.addEventListener("removetrack",s=>{_p(s.track)})}return t}var hD=`
1336
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" class="logo" part="logo" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 1600 500"><g fill="#fff"><path d="M994.287 93.486c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m0-93.486c-34.509 0-62.484 27.976-62.484 62.486v187.511c0 68.943-56.09 125.033-125.032 125.033s-125.03-56.09-125.03-125.033V62.486C681.741 27.976 653.765 0 619.256 0s-62.484 27.976-62.484 62.486v187.511C556.772 387.85 668.921 500 806.771 500c137.851 0 250.001-112.15 250.001-250.003V62.486c0-34.51-27.976-62.486-62.485-62.486M1537.51 468.511c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m-275.883-218.509-143.33 143.329c-24.402 24.402-24.402 63.966 0 88.368 24.402 24.402 63.967 24.402 88.369 0l143.33-143.329 143.328 143.329c24.402 24.4 63.967 24.402 88.369 0 24.403-24.402 24.403-63.966.001-88.368l-143.33-143.329.001-.004 143.329-143.329c24.402-24.402 24.402-63.965 0-88.367s-63.967-24.402-88.369 0L1349.996 161.63 1206.667 18.302c-24.402-24.401-63.967-24.402-88.369 0s-24.402 63.965 0 88.367l143.329 143.329v.004ZM437.511 468.521c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31M461.426 4.759C438.078-4.913 411.2.432 393.33 18.303L249.999 161.632 106.669 18.303C88.798.432 61.922-4.913 38.573 4.759 15.224 14.43-.001 37.214-.001 62.488v375.026c0 34.51 27.977 62.486 62.487 62.486 34.51 0 62.486-27.976 62.486-62.486V213.341l80.843 80.844c24.404 24.402 63.965 24.402 88.369 0l80.843-80.844v224.173c0 34.51 27.976 62.486 62.486 62.486s62.486-27.976 62.486-62.486V62.488c0-25.274-15.224-48.058-38.573-57.729" style="fill-rule:nonzero"/></g></svg>`;yu.push("castchange","entercast","leavecast");var w={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type",LOGO:"logo"},fD=Object.values(w),cT=Cw(),hT="mux-video",Pi,Qa,uu,Za,cu,hu,fu,mu,pu,Ja,gu,mD=class extends dp{constructor(){super(),ne(this,Ja),ne(this,Pi),ne(this,Qa),ne(this,uu),ne(this,Za,{}),ne(this,cu,{}),ne(this,hu),ne(this,fu),ne(this,mu),ne(this,pu),J(this,uu,ru())}static get NAME(){return hT}static get VERSION(){return cT}static get observedAttributes(){var i;return[...fD,...(i=dp.observedAttributes)!=null?i:[]]}static getTemplateHTML(i={}){let e=super.getTemplateHTML(i),t=i.logo!=="false"&&i.logo!==void 0,r=i.logo&&i.logo!=="",s=i.logo,n=t?`
1337
+ <style>
1338
+ :host {
1339
+ position: relative;
1340
+ }
1341
+ :host slot[name="logo"] {
1342
+ display: flex;
1343
+ justify-content: end;
1344
+ position: absolute;
1345
+ top: 1rem;
1346
+ right: 1rem;
1347
+
1348
+ }
1349
+ :host slot[name="logo"] .logo{
1350
+ width: 5rem;
1351
+ pointer-events: none;
1352
+ user-select: none;
1353
+ }
1354
+ </style>
1355
+ <slot name="logo">
1356
+ ${r?`<img class="logo" part="logo" src="${s}" />`:hD}
1357
+ </slot>
1358
+ `:"";return`
1359
+ ${e}
1360
+ ${n}
1361
+ `}get preferCmcd(){var i;return(i=this.getAttribute(w.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?In.includes(i)?this.setAttribute(w.PREFER_CMCD,i):console.warn(`Invalid value for preferCmcd. Must be one of ${In.join()}`):this.removeAttribute(w.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(w.PLAYER_INIT_TIME)?+this.getAttribute(w.PLAYER_INIT_TIME):I(this,uu)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(w.PLAYER_INIT_TIME):this.setAttribute(w.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=I(this,mu))!=null?i:hT}set playerSoftwareName(i){J(this,mu,i)}get playerSoftwareVersion(){var i;return(i=I(this,fu))!=null?i:cT}set playerSoftwareVersion(i){J(this,fu,i)}get _hls(){var i;return(i=I(this,Pi))==null?void 0:i.engine}get mux(){var i;return(i=this.nativeEl)==null?void 0:i.mux}get error(){var i;return(i=rp(this.nativeEl))!=null?i:null}get errorTranslator(){return I(this,pu)}set errorTranslator(i){J(this,pu,i)}get src(){return this.getAttribute("src")}set src(i){i!==this.src&&(i==null?this.removeAttribute("src"):this.setAttribute("src",i))}get type(){var i;return(i=this.getAttribute(w.TYPE))!=null?i:void 0}set type(i){i!==this.type&&(i?this.setAttribute(w.TYPE,i):this.removeAttribute(w.TYPE))}get autoplay(){let i=this.getAttribute("autoplay");return i===null?!1:i===""?!0:i}set autoplay(i){let e=this.autoplay;i!==e&&(i?this.setAttribute("autoplay",typeof i=="string"?i:""):this.removeAttribute("autoplay"))}get preload(){let i=this.getAttribute("preload");return i===""?"auto":["none","metadata","auto"].includes(i)?i:super.preload}set preload(i){i!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(i)?this.setAttribute("preload",i):this.removeAttribute("preload"))}get debug(){return this.getAttribute(w.DEBUG)!=null}set debug(i){i!==this.debug&&(i?this.setAttribute(w.DEBUG,""):this.removeAttribute(w.DEBUG))}get disableTracking(){return this.hasAttribute(w.DISABLE_TRACKING)}set disableTracking(i){i!==this.disableTracking&&this.toggleAttribute(w.DISABLE_TRACKING,!!i)}get disableCookies(){return this.hasAttribute(w.DISABLE_COOKIES)}set disableCookies(i){i!==this.disableCookies&&(i?this.setAttribute(w.DISABLE_COOKIES,""):this.removeAttribute(w.DISABLE_COOKIES))}get startTime(){let i=this.getAttribute(w.START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set startTime(i){i!==this.startTime&&(i==null?this.removeAttribute(w.START_TIME):this.setAttribute(w.START_TIME,`${i}`))}get playbackId(){var i;return this.hasAttribute(w.PLAYBACK_ID)?this.getAttribute(w.PLAYBACK_ID):(i=ip(this.src))!=null?i:void 0}set playbackId(i){i!==this.playbackId&&(i?this.setAttribute(w.PLAYBACK_ID,i):this.removeAttribute(w.PLAYBACK_ID))}get maxResolution(){var i;return(i=this.getAttribute(w.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(w.MAX_RESOLUTION,i):this.removeAttribute(w.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(w.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(w.MIN_RESOLUTION,i):this.removeAttribute(w.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(w.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(w.RENDITION_ORDER,i):this.removeAttribute(w.RENDITION_ORDER))}get programStartTime(){let i=this.getAttribute(w.PROGRAM_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programStartTime(i){i==null?this.removeAttribute(w.PROGRAM_START_TIME):this.setAttribute(w.PROGRAM_START_TIME,`${i}`)}get programEndTime(){let i=this.getAttribute(w.PROGRAM_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programEndTime(i){i==null?this.removeAttribute(w.PROGRAM_END_TIME):this.setAttribute(w.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){let i=this.getAttribute(w.ASSET_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetStartTime(i){i==null?this.removeAttribute(w.ASSET_START_TIME):this.setAttribute(w.ASSET_START_TIME,`${i}`)}get assetEndTime(){let i=this.getAttribute(w.ASSET_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetEndTime(i){i==null?this.removeAttribute(w.ASSET_END_TIME):this.setAttribute(w.ASSET_END_TIME,`${i}`)}get customDomain(){var i;return(i=this.getAttribute(w.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(w.CUSTOM_DOMAIN,i):this.removeAttribute(w.CUSTOM_DOMAIN))}get drmToken(){var i;return(i=this.getAttribute(w.DRM_TOKEN))!=null?i:void 0}set drmToken(i){i!==this.drmToken&&(i?this.setAttribute(w.DRM_TOKEN,i):this.removeAttribute(w.DRM_TOKEN))}get playbackToken(){var i,e,t,r;if(this.hasAttribute(w.PLAYBACK_TOKEN))return(i=this.getAttribute(w.PLAYBACK_TOKEN))!=null?i:void 0;if(this.hasAttribute(w.PLAYBACK_ID)){let[,s]=eu((e=this.playbackId)!=null?e:"");return(t=new URLSearchParams(s).get("token"))!=null?t:void 0}if(this.src)return(r=new URLSearchParams(this.src).get("token"))!=null?r:void 0}set playbackToken(i){i!==this.playbackToken&&(i?this.setAttribute(w.PLAYBACK_TOKEN,i):this.removeAttribute(w.PLAYBACK_TOKEN))}get tokens(){let i=this.getAttribute(w.PLAYBACK_TOKEN),e=this.getAttribute(w.DRM_TOKEN);return{...I(this,cu),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{}}}set tokens(i){J(this,cu,i!=null?i:{})}get ended(){return np(this.nativeEl,this._hls)}get envKey(){var i;return(i=this.getAttribute(w.ENV_KEY))!=null?i:void 0}set envKey(i){i!==this.envKey&&(i?this.setAttribute(w.ENV_KEY,i):this.removeAttribute(w.ENV_KEY))}get beaconCollectionDomain(){var i;return(i=this.getAttribute(w.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(w.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(w.BEACON_COLLECTION_DOMAIN))}get streamType(){var i;return(i=this.getAttribute(w.STREAM_TYPE))!=null?i:Jd(this.nativeEl)}set streamType(i){i!==this.streamType&&(i?this.setAttribute(w.STREAM_TYPE,i):this.removeAttribute(w.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(w.TARGET_LIVE_WINDOW)?+this.getAttribute(w.TARGET_LIVE_WINDOW):jy(this.nativeEl)}set targetLiveWindow(i){i!=this.targetLiveWindow&&(i==null?this.removeAttribute(w.TARGET_LIVE_WINDOW):this.setAttribute(w.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i,e;if(this.hasAttribute(w.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:t}=this,r=(i=this.nativeEl.seekable.end(0))!=null?i:0,s=(e=this.nativeEl.seekable.start(0))!=null?e:0;return Math.max(s,r-t)}return zy(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(w.LIVE_EDGE_OFFSET))return+this.getAttribute(w.LIVE_EDGE_OFFSET)}set liveEdgeOffset(i){i!=this.liveEdgeOffset&&(i==null?this.removeAttribute(w.LIVE_EDGE_OFFSET):this.setAttribute(w.LIVE_EDGE_OFFSET,`${+i}`))}get seekable(){return nu(this.nativeEl)}async addCuePoints(i){return Qm(this.nativeEl,i)}get activeCuePoint(){return Zm(this.nativeEl)}get cuePoints(){return $y(this.nativeEl)}async addChapters(i){return ep(this.nativeEl,i)}get activeChapter(){return tp(this.nativeEl)}get chapters(){return Gy(this.nativeEl)}getStartDate(){return Ky(this.nativeEl,this._hls)}get currentPdt(){return Vy(this.nativeEl,this._hls)}get preferPlayback(){let i=this.getAttribute(w.PREFER_PLAYBACK);if(i===jt.MSE||i===jt.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===jt.MSE||i===jt.NATIVE?this.setAttribute(w.PREFER_PLAYBACK,i):this.removeAttribute(w.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(i=>i.startsWith("metadata-")&&![w.METADATA_URL].includes(i)).reduce((i,e)=>{let t=this.getAttribute(e);return t!=null&&(i[e.replace(/^metadata-/,"").replace(/-/g,"_")]=t),i},{}),...I(this,Za)}}set metadata(i){J(this,Za,i!=null?i:{}),this.mux&&this.mux.emit("hb",I(this,Za))}get _hlsConfig(){return I(this,hu)}set _hlsConfig(i){J(this,hu,i)}get logo(){return this.getAttribute(w.LOGO)}set logo(i){i?this.setAttribute(w.LOGO,i):this.removeAttribute(w.LOGO)}load(){J(this,Pi,Zy(this,this.nativeEl,I(this,Pi)))}unload(){ap(this.nativeEl,I(this,Pi)),J(this,Pi,void 0)}attributeChangedCallback(i,e,t){var r,s;switch(dp.observedAttributes.includes(i)&&!["src","autoplay","preload"].includes(i)&&super.attributeChangedCallback(i,e,t),i){case w.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=t!=null?t:void 0;break;case w.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=t!=null?t:void 0;break;case"src":{let n=!!e,a=!!t;!n&&a?Fe(this,Ja,gu).call(this):n&&!a?this.unload():n&&a&&(this.unload(),Fe(this,Ja,gu).call(this));break}case"autoplay":if(t===e)break;(r=I(this,Pi))==null||r.setAutoplay(this.autoplay);break;case"preload":if(t===e)break;(s=I(this,Pi))==null||s.setPreload(t);break;case w.PLAYBACK_ID:this.src=Va(this);break;case w.DEBUG:{let n=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=n);break}case w.METADATA_URL:t&&fetch(t).then(n=>n.json()).then(n=>this.metadata=n).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${t}!`));break;case w.STREAM_TYPE:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case w.TARGET_LIVE_WINDOW:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}connectedCallback(){var i;(i=super.connectedCallback)==null||i.call(this),this.nativeEl&&this.src&&!I(this,Pi)&&Fe(this,Ja,gu).call(this)}disconnectedCallback(){this.unload()}};Pi=new WeakMap,Qa=new WeakMap,uu=new WeakMap,Za=new WeakMap,cu=new WeakMap,hu=new WeakMap,fu=new WeakMap,mu=new WeakMap,pu=new WeakMap,Ja=new WeakSet,gu=async function(){I(this,Qa)||(await J(this,Qa,Promise.resolve()),J(this,Qa,null),this.load())};var vu,Sp=class extends Qw(dD(mD)){constructor(){super(...arguments),ne(this,vu)}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var i;return(i=I(this,vu))!=null?i:this.muxCastCustomData}set castCustomData(i){J(this,vu,i)}};vu=new WeakMap;lp.customElements.get("mux-video")||(lp.customElements.define("mux-video",Sp),lp.MuxVideoElement=Sp);var ST=Sp;function xT(i){let e="";return Object.entries(i).forEach(([t,r])=>{r!=null&&(e+=`${Au(t)}: ${r}; `)}),e?e.trim():void 0}function Au(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Su(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function St(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function Lp(i){let e=pD(i).toString();return e?"?"+e:""}function pD(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}var wp=(i,e)=>!i||!e?!1:i.contains(e)?!0:wp(i,e.getRootNode().host);var RT="mux.com",gD=()=>{try{return"3.3.3"}catch{}return"UNKNOWN"},vD=gD(),Ru=()=>vD,IT=(i,{token:e,customDomain:t=RT,thumbnailTime:r,programTime:s}={})=>{var o;let n=e==null?r:void 0,{aud:a}=(o=_r(e))!=null?o:{};if(!(e&&a!=="t"))return`https://image.${t}/${i}/thumbnail.webp${Lp({token:e,time:n,program_time:s})}`},kT=(i,{token:e,customDomain:t=RT,programStartTime:r,programEndTime:s}={})=>{var a;let{aud:n}=(a=_r(e))!=null?a:{};if(!(e&&n!=="s"))return`https://image.${t}/${i}/storyboard.vtt${Lp({token:e,format:"webp",program_start_time:r,program_end_time:s})}`},eo=i=>{if(i){if([Re.LIVE,Re.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return Re.LIVE}};var ED={crossorigin:"crossOrigin",playsinline:"playsInline"};function LT(i){var e;return(e=ED[i])!=null?e:Su(i)}var xs,Rs,xt,xu=class{constructor(e,t){It(this,xs);It(this,Rs);It(this,xt,[]);Bt(this,xs,e),Bt(this,Rs,t)}[Symbol.iterator](){return Se(this,xt).values()}get length(){return Se(this,xt).length}get value(){var e;return(e=Se(this,xt).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Bt(this,xt,[]),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return Se(this,xt)[e]}values(){return Se(this,xt).values()}keys(){return Se(this,xt).keys()}forEach(e){Se(this,xt).forEach(e)}add(...e){var t,r;e.forEach(s=>{this.contains(s)||Se(this,xt).push(s)}),!(this.value===""&&!((t=Se(this,xs))!=null&&t.hasAttribute(`${Se(this,Rs)}`)))&&((r=Se(this,xs))==null||r.setAttribute(`${Se(this,Rs)}`,`${this.value}`))}remove(...e){var t;e.forEach(r=>{Se(this,xt).splice(Se(this,xt).indexOf(r),1)}),(t=Se(this,xs))==null||t.setAttribute(`${Se(this,Rs)}`,`${this.value}`)}contains(e){return Se(this,xt).includes(e)}toggle(e,t){return typeof t!="undefined"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};xs=new WeakMap,Rs=new WeakMap,xt=new WeakMap;var wT=`[mux-player ${Ru()}]`;function Oi(...i){console.warn(wT,...i)}function Ot(...i){console.error(wT,...i)}function Dp(i){var t;let e=(t=i.message)!=null?t:"";i.context&&(e+=` ${i.context}`),i.file&&(e+=` ${X("Read more: ")}
1362
+ https://github.com/muxinc/elements/blob/main/errors/${i.file}`),Oi(e)}var Tt={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Is={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},CT=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),bD=yu.filter(i=>i!=="error"),yD=Object.values(Tt).filter(i=>![Tt.PLAYSINLINE].includes(i)),TD=Object.values(Is),Cp=class extends kt.HTMLElement{static get observedAttributes(){return[...yD,...TD]}constructor(){super()}init(){bD.forEach(e=>{var t;(t=this.media)==null||t.addEventListener(e,r=>{this.dispatchEvent(new Event(r.type))})})}attributeChangedCallback(e,t,r){var s,n;switch(e){case Is.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case Is.VOLUME:{let a=(s=St(r))!=null?s:1;this.media&&(this.media.volume=a);return}case Is.PLAYBACKRATE:{let a=(n=St(r))!=null?n:1;this.media&&(this.media.playbackRate=a,this.media.defaultPlaybackRate=a);return}}}play(){var e,t;return(t=(e=this.media)==null?void 0:e.play())!=null?t:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}load(){var e;(e=this.media)==null||e.load()}requestCast(e){var t;return(t=this.media)==null?void 0:t.requestCast(e)}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var e,t;return(t=(e=this.media)==null?void 0:e.paused)!=null?t:!0}get duration(){var e,t;return(t=(e=this.media)==null?void 0:e.duration)!=null?t:NaN}get ended(){var e,t;return(t=(e=this.media)==null?void 0:e.ended)!=null?t:!1}get buffered(){var e,t;return(t=(e=this.media)==null?void 0:e.buffered)!=null?t:CT}get seekable(){var e,t;return(t=(e=this.media)==null?void 0:e.seekable)!=null?t:CT}get readyState(){var e,t;return(t=(e=this.media)==null?void 0:e.readyState)!=null?t:0}get videoWidth(){var e,t;return(t=(e=this.media)==null?void 0:e.videoWidth)!=null?t:0}get videoHeight(){var e,t;return(t=(e=this.media)==null?void 0:e.videoHeight)!=null?t:0}get currentSrc(){var e,t;return(t=(e=this.media)==null?void 0:e.currentSrc)!=null?t:""}get currentTime(){var e,t;return(t=(e=this.media)==null?void 0:e.currentTime)!=null?t:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,t;return(t=(e=this.media)==null?void 0:e.volume)!=null?t:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,t;return(t=(e=this.media)==null?void 0:e.playbackRate)!=null?t:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=St(this.getAttribute(Is.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(Is.PLAYBACKRATE,`${e}`):this.removeAttribute(Is.PLAYBACKRATE)}get crossOrigin(){return to(this,Tt.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(Tt.CROSSORIGIN,`${e}`)}get autoplay(){return to(this,Tt.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(Tt.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(Tt.AUTOPLAY)}get loop(){return to(this,Tt.LOOP)!=null}set loop(e){e?this.setAttribute(Tt.LOOP,""):this.removeAttribute(Tt.LOOP)}get muted(){var e,t;return(t=(e=this.media)==null?void 0:e.muted)!=null?t:!1}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return to(this,Tt.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(Tt.MUTED,""):this.removeAttribute(Tt.MUTED)}get playsInline(){return to(this,Tt.PLAYSINLINE)!=null}set playsInline(e){Ot("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(e){["","none","metadata","auto"].includes(e)?this.setAttribute(Tt.PRELOAD,e):this.removeAttribute(Tt.PRELOAD)}};function to(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var Mp=Cp;var UT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ee=(i,e,t)=>(UT(i,e,"read from private field"),t?t.call(i):e.get(i)),Ni=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ir=(i,e,t,r)=>(UT(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Mn,Iu,ks,io,xr,Rr,Ir,Ls,Pn,ku,ci,MT=1,PT=0,_D=1,AD={processCallback(i,e,t){if(t){for(let[r,s]of e)if(r in t){let n=t[r];typeof n=="boolean"&&s instanceof Rt&&typeof s.element[s.attributeName]=="boolean"?s.booleanValue=n:typeof n=="function"&&s instanceof Rt?s.element[s.attributeName]=n:s.value=n}}}},rr=class extends x.DocumentFragment{constructor(e,t,r=AD){var s;super(),Ni(this,Mn,void 0),Ni(this,Iu,void 0),this.append(e.content.cloneNode(!0)),ir(this,Mn,FT(this)),ir(this,Iu,r),(s=r.createCallback)==null||s.call(r,this,Ee(this,Mn),t),r.processCallback(this,Ee(this,Mn),t)}update(e){Ee(this,Iu).processCallback(this,Ee(this,Mn),e)}};Mn=new WeakMap;Iu=new WeakMap;var FT=(i,e=[])=>{let t,r;for(let s of i.attributes||[])if(s.value.includes("{{")){let n=new Pp;for([t,r]of NT(s.value))if(!t)n.append(r);else{let a=new Rt(i,s.name,s.namespaceURI);n.append(a),e.push([r,a])}s.value=n.toString()}for(let s of i.childNodes)if(s.nodeType===MT&&!(s instanceof HTMLTemplateElement))FT(s,e);else{let n=s.data;if(s.nodeType===MT||n.includes("{{")){let a=[];if(n)for([t,r]of NT(n))if(!t)a.push(new Text(r));else{let o=new sr(i);a.push(o),e.push([r,o])}else if(s instanceof HTMLTemplateElement){let o=new ro(i,s);a.push(o),e.push([o.expression,o])}s.replaceWith(...a.flatMap(o=>o.replacementNodes||[o]))}}return e},OT={},NT=i=>{let e="",t=0,r=OT[i],s=0,n;if(r)return r;for(r=[];n=i[s];s++)n==="{"&&i[s+1]==="{"&&i[s-1]!=="\\"&&i[s+2]&&++t==1?(e&&r.push([PT,e]),e="",s++):n==="}"&&i[s+1]==="}"&&i[s-1]!=="\\"&&!--t?(r.push([_D,e.trim()]),e="",s++):e+=n||"";return e&&r.push([PT,(t>0?"{{":"")+e]),OT[i]=r},SD=11,Lu=class{get value(){return""}set value(e){}toString(){return this.value}},BT=new WeakMap,Pp=class{constructor(){Ni(this,ks,[])}[Symbol.iterator](){return Ee(this,ks).values()}get length(){return Ee(this,ks).length}item(e){return Ee(this,ks)[e]}append(...e){for(let t of e)t instanceof Rt&&BT.set(t,this),Ee(this,ks).push(t)}toString(){return Ee(this,ks).join("")}};ks=new WeakMap;var Rt=class extends Lu{constructor(e,t,r){super(),Ni(this,Ls),Ni(this,io,""),Ni(this,xr,void 0),Ni(this,Rr,void 0),Ni(this,Ir,void 0),ir(this,xr,e),ir(this,Rr,t),ir(this,Ir,r)}get attributeName(){return Ee(this,Rr)}get attributeNamespace(){return Ee(this,Ir)}get element(){return Ee(this,xr)}get value(){return Ee(this,io)}set value(e){Ee(this,io)!==e&&(ir(this,io,e),!Ee(this,Ls,Pn)||Ee(this,Ls,Pn).length===1?e==null?Ee(this,xr).removeAttributeNS(Ee(this,Ir),Ee(this,Rr)):Ee(this,xr).setAttributeNS(Ee(this,Ir),Ee(this,Rr),e):Ee(this,xr).setAttributeNS(Ee(this,Ir),Ee(this,Rr),Ee(this,Ls,Pn).toString()))}get booleanValue(){return Ee(this,xr).hasAttributeNS(Ee(this,Ir),Ee(this,Rr))}set booleanValue(e){if(!Ee(this,Ls,Pn)||Ee(this,Ls,Pn).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};io=new WeakMap;xr=new WeakMap;Rr=new WeakMap;Ir=new WeakMap;Ls=new WeakSet;Pn=function(){return BT.get(this)};var sr=class extends Lu{constructor(e,t){super(),Ni(this,ku,void 0),Ni(this,ci,void 0),ir(this,ku,e),ir(this,ci,t?[...t]:[new Text])}get replacementNodes(){return Ee(this,ci)}get parentNode(){return Ee(this,ku)}get nextSibling(){return Ee(this,ci)[Ee(this,ci).length-1].nextSibling}get previousSibling(){return Ee(this,ci)[0].previousSibling}get value(){return Ee(this,ci).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let t=e.flat().flatMap(r=>r==null?[new Text]:r.forEach?[...r]:r.nodeType===SD?[...r.childNodes]:r.nodeType?[r]:[new Text(r)]);t.length||t.push(new Text),ir(this,ci,xD(Ee(this,ci)[0].parentNode,Ee(this,ci),t,this.nextSibling))}};ku=new WeakMap;ci=new WeakMap;var ro=class extends sr{constructor(e,t){let r=t.getAttribute("directive")||t.getAttribute("type"),s=t.getAttribute("expression")||t.getAttribute(r)||"";s.startsWith("{{")&&(s=s.trim().slice(2,-2).trim()),super(e),this.expression=s,this.template=t,this.directive=r}};function xD(i,e,t,r=null){let s=0,n,a,o,l=t.length,d=e.length;for(;s<l&&s<d&&e[s]==t[s];)s++;for(;s<l&&s<d&&t[l-1]==e[d-1];)r=t[--d,--l];if(s==d)for(;s<l;)i.insertBefore(t[s++],r);if(s==l)for(;s<d;)i.removeChild(e[s++]);else{for(n=e[s];s<l;)o=t[s++],a=n?n.nextSibling:r,n==o?n=a:s<l&&t[s]==a?(i.replaceChild(o,n),n=a):i.insertBefore(o,n);for(;n!=r;)a=n.nextSibling,i.removeChild(n),n=a}return t}var $T={string:i=>String(i)},Du=class{constructor(e){this.template=e,this.state=void 0}},ws=new WeakMap,Ds=new WeakMap,Op={partial:(i,e)=>{e[i.expression]=new Du(i.template)},if:(i,e)=>{var t;if(GT(i.expression,e))if(ws.get(i)!==i.template){ws.set(i,i.template);let r=new rr(i.template,e,Cu);i.replace(r),Ds.set(i,r)}else(t=Ds.get(i))==null||t.update(e);else i.replace(""),ws.delete(i),Ds.delete(i)}},RD=Object.keys(Op),Cu={processCallback(i,e,t){var r,s;if(t)for(let[n,a]of e){if(a instanceof ro){if(!a.directive){let l=RD.find(d=>a.template.hasAttribute(d));l&&(a.directive=l,a.expression=a.template.getAttribute(l))}(r=Op[a.directive])==null||r.call(Op,a,t);continue}let o=GT(n,t);if(o instanceof Du){ws.get(a)!==o.template?(ws.set(a,o.template),o=new rr(o.template,o.state,Cu),a.value=o,Ds.set(a,o)):(s=Ds.get(a))==null||s.update(o.state);continue}o?(a instanceof Rt&&a.attributeName.startsWith("aria-")&&(o=String(o)),a instanceof Rt?typeof o=="boolean"?a.booleanValue=o:typeof o=="function"?a.element[a.attributeName]=o:a.value=o:(a.value=o,ws.delete(a),Ds.delete(a))):a instanceof Rt?a.value=void 0:(a.value=void 0,ws.delete(a),Ds.delete(a))}}},HT={"!":i=>!i,"!!":i=>!!i,"==":(i,e)=>i==e,"!=":(i,e)=>i!=e,">":(i,e)=>i>e,">=":(i,e)=>i>=e,"<":(i,e)=>i<e,"<=":(i,e)=>i<=e,"??":(i,e)=>i!=null?i:e,"|":(i,e)=>{var t;return(t=$T[e])==null?void 0:t.call($T,i)}};function ID(i){return kD(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function GT(i,e={}){var t,r,s,n,a,o,l;let d=ID(i);if(d.length===0||d.some(({type:u})=>!u))return so(i);if(((t=d[0])==null?void 0:t.token)===">"){let u=e[(r=d[1])==null?void 0:r.token];if(!u)return so(i);let c={...e};u.state=c;let h=d.slice(2);for(let f=0;f<h.length;f+=3){let m=(s=h[f])==null?void 0:s.token,p=(n=h[f+1])==null?void 0:n.token,g=(a=h[f+2])==null?void 0:a.token;m&&p==="="&&(c[m]=no(g,e))}return u}if(d.length===1)return wu(d[0])?no(d[0].token,e):so(i);if(d.length===2){let u=(o=d[0])==null?void 0:o.token,c=HT[u];if(!c||!wu(d[1]))return so(i);let h=no(d[1].token,e);return c(h)}if(d.length===3){let u=(l=d[1])==null?void 0:l.token,c=HT[u];if(!c||!wu(d[0])||!wu(d[2]))return so(i);let h=no(d[0].token,e);if(u==="|")return c(h,d[2].token);let f=no(d[2].token,e);return c(h,f)}}function so(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function wu({type:i}){return["number","boolean","string","param"].includes(i)}function no(i,e){let t=i[0],r=i.slice(-1);return i==="true"||i==="false"?i==="true":t===r&&["'",'"'].includes(t)?i.slice(1,-1):Co(i)?parseFloat(i):e[i]}function kD(i,e){let t,r,s,n=[];for(;i;){s=null,t=i.length;for(let a in e)r=e[a].exec(i),r&&r.index<t&&(s={token:r[0],type:a,matches:r.slice(1)},t=r.index);t&&n.push({token:i.substr(0,t),type:void 0}),s&&n.push(s),i=i.substr(t+(s?s.token.length:0))}return n}var Hp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Fp=(i,e,t)=>(Hp(i,e,"read from private field"),t?t.call(i):e.get(i)),ao=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Cs=(i,e,t,r)=>(Hp(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Np=(i,e,t)=>(Hp(i,e,"access private method"),t),On,Mu,Nn,Bp,KT,Pu,$p,Up={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},VT=F.createElement("template");VT.innerHTML=`
1337
1363
  <style>
1338
1364
  :host {
1339
1365
  display: inline-block;
@@ -1360,7 +1386,7 @@ https://github.com/muxinc/elements/blob/main/errors/${i.file}`),Oi(e)}var Tt={AU
1360
1386
  display: none;
1361
1387
  }
1362
1388
  </style>
1363
- `;var Ms=class extends x.HTMLElement{constructor(){super(),ao(this,Bp),ao(this,Pu),ao(this,On,void 0),ao(this,Mu,void 0),ao(this,Nn,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());let e=new MutationObserver(t=>{var r;this.mediaController&&!((r=this.mediaController)!=null&&r.breakpointsComputed)||t.some(s=>{let n=s.target;return n===this?!0:n.localName!=="media-controller"?!1:!!(Up[s.attributeName]||s.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(Ki.BREAKPOINTS_COMPUTED,this.render),Np(this,Bp,KT).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=Fp(this,On))!=null?e:this.constructor.template}set template(e){Cs(this,Nn,null),Cs(this,On,e),this.createRenderer()}get props(){var e,t,r;let s=[...Array.from((t=(e=this.mediaController)==null?void 0:e.attributes)!=null?t:[]).filter(({name:a})=>Up[a]||a.startsWith("breakpoint")),...Array.from(this.attributes)],n={};for(let a of s){let o=(r=Up[a.name])!=null?r:e0(a.name),{value:l}=a;l!=null?(Co(l)&&(l=parseFloat(l)),n[o]=l===""?!0:l):n[o]=!1}return n}attributeChangedCallback(e,t,r){e==="template"&&t!=r&&Np(this,Pu,$p).call(this)}connectedCallback(){Np(this,Pu,$p).call(this)}createRenderer(){this.template&&this.template!==Fp(this,Mu)&&(Cs(this,Mu,this.template),this.renderer=new rr(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(VT.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}};On=new WeakMap;Mu=new WeakMap;Nn=new WeakMap;Bp=new WeakSet;KT=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){let e=this[i];delete this[i],this[i]=e}};Pu=new WeakSet;$p=function(){var i;let e=this.getAttribute("template");if(!e||e===Fp(this,Nn))return;let t=this.getRootNode(),r=(i=t==null?void 0:t.getElementById)==null?void 0:i.call(t,e);if(r){Cs(this,Nn,e),Cs(this,On,r),this.createRenderer();return}kD(e)&&(Cs(this,Nn,e),LD(e).then(s=>{let n=F.createElement("template");n.innerHTML=s,Cs(this,On,n),this.createRenderer()}).catch(console.error))};Ms.observedAttributes=["template"];Ms.processor=Cu;function kD(i){if(!/^(\/|\.\/|https?:\/\/)/.test(i))return!1;let e=/^https?:\/\//.test(i)?void 0:location.origin;try{new URL(i,e)}catch{return!1}return!0}async function LD(i){let e=await fetch(i);if(e.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${e.status}`);return e.text()}x.customElements.get("media-theme")||x.customElements.define("media-theme",Ms);var WT=`:host {
1389
+ `;var Ms=class extends x.HTMLElement{constructor(){super(),ao(this,Bp),ao(this,Pu),ao(this,On,void 0),ao(this,Mu,void 0),ao(this,Nn,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());let e=new MutationObserver(t=>{var r;this.mediaController&&!((r=this.mediaController)!=null&&r.breakpointsComputed)||t.some(s=>{let n=s.target;return n===this?!0:n.localName!=="media-controller"?!1:!!(Up[s.attributeName]||s.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(Ki.BREAKPOINTS_COMPUTED,this.render),Np(this,Bp,KT).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=Fp(this,On))!=null?e:this.constructor.template}set template(e){Cs(this,Nn,null),Cs(this,On,e),this.createRenderer()}get props(){var e,t,r;let s=[...Array.from((t=(e=this.mediaController)==null?void 0:e.attributes)!=null?t:[]).filter(({name:a})=>Up[a]||a.startsWith("breakpoint")),...Array.from(this.attributes)],n={};for(let a of s){let o=(r=Up[a.name])!=null?r:e0(a.name),{value:l}=a;l!=null?(Co(l)&&(l=parseFloat(l)),n[o]=l===""?!0:l):n[o]=!1}return n}attributeChangedCallback(e,t,r){e==="template"&&t!=r&&Np(this,Pu,$p).call(this)}connectedCallback(){Np(this,Pu,$p).call(this)}createRenderer(){this.template&&this.template!==Fp(this,Mu)&&(Cs(this,Mu,this.template),this.renderer=new rr(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(VT.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}};On=new WeakMap;Mu=new WeakMap;Nn=new WeakMap;Bp=new WeakSet;KT=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){let e=this[i];delete this[i],this[i]=e}};Pu=new WeakSet;$p=function(){var i;let e=this.getAttribute("template");if(!e||e===Fp(this,Nn))return;let t=this.getRootNode(),r=(i=t==null?void 0:t.getElementById)==null?void 0:i.call(t,e);if(r){Cs(this,Nn,e),Cs(this,On,r),this.createRenderer();return}LD(e)&&(Cs(this,Nn,e),wD(e).then(s=>{let n=F.createElement("template");n.innerHTML=s,Cs(this,On,n),this.createRenderer()}).catch(console.error))};Ms.observedAttributes=["template"];Ms.processor=Cu;function LD(i){if(!/^(\/|\.\/|https?:\/\/)/.test(i))return!1;let e=/^https?:\/\//.test(i)?void 0:location.origin;try{new URL(i,e)}catch{return!1}return!0}async function wD(i){let e=await fetch(i);if(e.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${e.status}`);return e.text()}x.customElements.get("media-theme")||x.customElements.define("media-theme",Ms);var WT=`:host {
1364
1390
  --media-control-display: var(--controls);
1365
1391
  --media-loading-indicator-display: var(--loading-indicator);
1366
1392
  --media-dialog-display: var(--dialog);
@@ -1510,17 +1536,17 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1510
1536
  :host([no-tooltips]) {
1511
1537
  --media-tooltip-display: none;
1512
1538
  }
1513
- `;var oo=new WeakMap,Kp=class i{constructor(e,t){this.element=e;this.type=t;this.element.addEventListener(this.type,this);let r=oo.get(this.element);r&&r.set(this.type,this)}set(e){if(typeof e=="function")this.handleEvent=e.bind(this.element);else if(typeof e=="object"&&typeof e.handleEvent=="function")this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let t=oo.get(this.element);t&&t.delete(this.type)}}static for(e){oo.has(e.element)||oo.set(e.element,new Map);let t=e.attributeName.slice(2),r=oo.get(e.element);return r&&r.has(t)?r.get(t):new i(e.element,t)}};function DD(i,e){return i instanceof Rt&&i.attributeName.startsWith("on")?(Kp.for(i).set(e),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function CD(i,e){return e instanceof Ou&&i instanceof sr?(e.renderInto(i),!0):!1}function MD(i,e){return e instanceof DocumentFragment&&i instanceof sr?(e.childNodes.length&&i.replace(...e.childNodes),!0):!1}function PD(i,e){if(i instanceof Rt){let t=i.attributeNamespace,r=i.element.getAttributeNS(t,i.attributeName);return String(e)!==r&&(i.value=String(e)),!0}return i.value=String(e),!0}function OD(i,e){if(i instanceof Rt&&e instanceof Element){let t=i.element;return t[i.attributeName]!==e&&(i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),t[i.attributeName]=e),!0}return!1}function ND(i,e){if(typeof e=="boolean"&&i instanceof Rt){let t=i.attributeNamespace,r=i.element.hasAttributeNS(t,i.attributeName);return e!==r&&(i.booleanValue=e),!0}return!1}function UD(i,e){return e===!1&&i instanceof sr?(i.replace(""),!0):!1}function FD(i,e){OD(i,e)||ND(i,e)||DD(i,e)||UD(i,e)||CD(i,e)||MD(i,e)||PD(i,e)}var Gp=new Map,YT=new WeakMap,qT=new WeakMap,Ou=class{constructor(e,t,r){this.strings=e;this.values=t;this.processor=r;this.stringsKey=this.strings.join("")}get template(){if(Gp.has(this.stringsKey))return Gp.get(this.stringsKey);{let e=Ks.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((r,s,n)=>r+s+(n<t?`{{ ${n} }}`:""),""),Gp.set(this.stringsKey,e),e}}renderInto(e){var s;let t=this.template;if(YT.get(e)!==t){YT.set(e,t);let n=new rr(t,this.values,this.processor);qT.set(e,n),e instanceof sr?e.replace(...n.children):e.appendChild(n);return}let r=qT.get(e);(s=r==null?void 0:r.update)==null||s.call(r,this.values)}},BD={processCallback(i,e,t){var r;if(t){for(let[s,n]of e)if(s in t){let a=(r=t[s])!=null?r:"";FD(n,a)}}}};function lo(i,...e){return new Ou(i,e,BD)}function jT(i,e){i.renderInto(e)}var $D=i=>{let{tokens:e}=i;return e.drm?":host { --_cast-button-drm-display: none; }":""},zT=i=>lo`
1539
+ `;var oo=new WeakMap,Kp=class i{constructor(e,t){this.element=e;this.type=t;this.element.addEventListener(this.type,this);let r=oo.get(this.element);r&&r.set(this.type,this)}set(e){if(typeof e=="function")this.handleEvent=e.bind(this.element);else if(typeof e=="object"&&typeof e.handleEvent=="function")this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let t=oo.get(this.element);t&&t.delete(this.type)}}static for(e){oo.has(e.element)||oo.set(e.element,new Map);let t=e.attributeName.slice(2),r=oo.get(e.element);return r&&r.has(t)?r.get(t):new i(e.element,t)}};function CD(i,e){return i instanceof Rt&&i.attributeName.startsWith("on")?(Kp.for(i).set(e),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function MD(i,e){return e instanceof Ou&&i instanceof sr?(e.renderInto(i),!0):!1}function PD(i,e){return e instanceof DocumentFragment&&i instanceof sr?(e.childNodes.length&&i.replace(...e.childNodes),!0):!1}function OD(i,e){if(i instanceof Rt){let t=i.attributeNamespace,r=i.element.getAttributeNS(t,i.attributeName);return String(e)!==r&&(i.value=String(e)),!0}return i.value=String(e),!0}function ND(i,e){if(i instanceof Rt&&e instanceof Element){let t=i.element;return t[i.attributeName]!==e&&(i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),t[i.attributeName]=e),!0}return!1}function UD(i,e){if(typeof e=="boolean"&&i instanceof Rt){let t=i.attributeNamespace,r=i.element.hasAttributeNS(t,i.attributeName);return e!==r&&(i.booleanValue=e),!0}return!1}function FD(i,e){return e===!1&&i instanceof sr?(i.replace(""),!0):!1}function BD(i,e){ND(i,e)||UD(i,e)||CD(i,e)||FD(i,e)||MD(i,e)||PD(i,e)||OD(i,e)}var Gp=new Map,YT=new WeakMap,qT=new WeakMap,Ou=class{constructor(e,t,r){this.strings=e;this.values=t;this.processor=r;this.stringsKey=this.strings.join("")}get template(){if(Gp.has(this.stringsKey))return Gp.get(this.stringsKey);{let e=Ks.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((r,s,n)=>r+s+(n<t?`{{ ${n} }}`:""),""),Gp.set(this.stringsKey,e),e}}renderInto(e){var s;let t=this.template;if(YT.get(e)!==t){YT.set(e,t);let n=new rr(t,this.values,this.processor);qT.set(e,n),e instanceof sr?e.replace(...n.children):e.appendChild(n);return}let r=qT.get(e);(s=r==null?void 0:r.update)==null||s.call(r,this.values)}},$D={processCallback(i,e,t){var r;if(t){for(let[s,n]of e)if(s in t){let a=(r=t[s])!=null?r:"";BD(n,a)}}}};function lo(i,...e){return new Ou(i,e,$D)}function jT(i,e){i.renderInto(e)}var HD=i=>{let{tokens:e}=i;return e.drm?":host { --_cast-button-drm-display: none; }":""},zT=i=>lo`
1514
1540
  <style>
1515
- ${$D(i)}
1541
+ ${HD(i)}
1516
1542
  ${WT}
1517
1543
  </style>
1518
- ${VD(i)}
1519
- `,HD=i=>{let e=i.hotKeys?`${i.hotKeys}`:"";return eo(i.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},GD={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},KD=Object.values(GD).join(", "),VD=i=>{var e,t,r,s,n,a,o,l,d,u,c,h,f,m,p,g,E,b,T,_,A,R,S,D,M,L,P,U,B,Z,Q,Y,he,me;return lo`
1544
+ ${WD(i)}
1545
+ `,GD=i=>{let e=i.hotKeys?`${i.hotKeys}`:"";return eo(i.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},KD={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},VD=Object.values(KD).join(", "),WD=i=>{var e,t,r,s,n,a,o,l,d,u,c,h,f,m,p,g,E,b,T,_,A,R,S,D,M,L,P,U,B,Z,Q,Y,he,me;return lo`
1520
1546
  <media-theme
1521
1547
  template="${i.themeTemplate||!1}"
1522
1548
  defaultstreamtype="${(e=i.defaultStreamType)!=null?e:!1}"
1523
- hotkeys="${HD(i)||!1}"
1549
+ hotkeys="${GD(i)||!1}"
1524
1550
  nohotkeys="${i.noHotKeys||!i.hasSrc||!1}"
1525
1551
  noautoseektolive="${!!((t=i.streamType)!=null&&t.includes(Re.LIVE))&&i.targetLiveWindow!==0}"
1526
1552
  novolumepref="${i.novolumepref||!1}"
@@ -1536,7 +1562,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1536
1562
  hideduration="${(u=i.hideDuration)!=null?u:!1}"
1537
1563
  title="${(c=i.title)!=null?c:!1}"
1538
1564
  proudlydisplaymuxbadge="${(h=i.proudlyDisplayMuxBadge)!=null?h:!1}"
1539
- exportparts="${KD}"
1565
+ exportparts="${VD}"
1540
1566
  onclose="${i.onCloseErrorDialog}"
1541
1567
  onfocusin="${i.onFocusInErrorDialog}"
1542
1568
  >
@@ -1580,7 +1606,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1580
1606
  ></media-poster-image>
1581
1607
  </slot>
1582
1608
  </media-theme>
1583
- `};var XT=i=>i.charAt(0).toUpperCase()+i.slice(1),WD=(i,e=!1)=>{var t,r;if(i.muxCode){let s=XT((t=i.errorCategory)!=null?t:"video"),n=Ga((r=i.errorCategory)!=null?r:Ue.VIDEO);if(i.muxCode===te.NETWORK_OFFLINE)return X("Your device appears to be offline",e);if(i.muxCode===te.NETWORK_TOKEN_EXPIRED)return X("{category} URL has expired",e).format({category:s});if([te.NETWORK_TOKEN_SUB_MISMATCH,te.NETWORK_TOKEN_AUD_MISMATCH,te.NETWORK_TOKEN_AUD_MISSING,te.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return X("{category} URL is formatted incorrectly",e).format({category:s});if(i.muxCode===te.NETWORK_TOKEN_MISSING)return X("Invalid {categoryName} URL",e).format({categoryName:n});if(i.muxCode===te.NETWORK_NOT_FOUND)return X("{category} does not exist",e).format({category:s});if(i.muxCode===te.NETWORK_NOT_READY)return X("{category} is not currently available",e).format({category:s})}if(i.code){if(i.code===V.MEDIA_ERR_NETWORK)return X("Network Error",e);if(i.code===V.MEDIA_ERR_DECODE)return X("Media Error",e);if(i.code===V.MEDIA_ERR_SRC_NOT_SUPPORTED)return X("Source Not Supported",e)}return X("Error",e)},YD=(i,e=!1)=>{var t,r;if(i.muxCode){let s=XT((t=i.errorCategory)!=null?t:"video"),n=Ga((r=i.errorCategory)!=null?r:Ue.VIDEO);return i.muxCode===te.NETWORK_OFFLINE?X("Check your internet connection and try reloading this video.",e):i.muxCode===te.NETWORK_TOKEN_EXPIRED?X("The video\u2019s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:n}):i.muxCode===te.NETWORK_TOKEN_SUB_MISMATCH?X("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:n}):i.muxCode===te.NETWORK_TOKEN_MALFORMED?X("{category} URL is formatted incorrectly",e).format({category:s}):[te.NETWORK_TOKEN_AUD_MISMATCH,te.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?X("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:n}):[te.NETWORK_TOKEN_MISSING,te.NETWORK_INVALID_URL].includes(i.muxCode)?X("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:n}):i.muxCode===te.NETWORK_NOT_FOUND?"":i.muxCode===te.NETWORK_NOT_READY?X("The live stream or video file are not yet ready.",e):i.message}return i.code&&(i.code===V.MEDIA_ERR_NETWORK||i.code===V.MEDIA_ERR_DECODE||i.code===V.MEDIA_ERR_SRC_NOT_SUPPORTED),i.message},QT=(i,e=!1)=>{let t=WD(i,e),r=YD(i,e);return{title:t,message:r}},qD=i=>{if(i.muxCode){if(i.muxCode===te.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===te.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([te.NETWORK_TOKEN_AUD_MISMATCH,te.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===te.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===te.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===te.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===te.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===V.MEDIA_ERR_NETWORK)return"";if(i.code===V.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===V.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},Vp=(i,e)=>{let t=qD(i);return{message:i.message,context:i.context,file:t}};var ZT=`<template id="media-theme-gerwig">
1609
+ `};var XT=i=>i.charAt(0).toUpperCase()+i.slice(1),YD=(i,e=!1)=>{var t,r;if(i.muxCode){let s=XT((t=i.errorCategory)!=null?t:"video"),n=Ga((r=i.errorCategory)!=null?r:Ue.VIDEO);if(i.muxCode===te.NETWORK_OFFLINE)return X("Your device appears to be offline",e);if(i.muxCode===te.NETWORK_TOKEN_EXPIRED)return X("{category} URL has expired",e).format({category:s});if([te.NETWORK_TOKEN_SUB_MISMATCH,te.NETWORK_TOKEN_AUD_MISMATCH,te.NETWORK_TOKEN_AUD_MISSING,te.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return X("{category} URL is formatted incorrectly",e).format({category:s});if(i.muxCode===te.NETWORK_TOKEN_MISSING)return X("Invalid {categoryName} URL",e).format({categoryName:n});if(i.muxCode===te.NETWORK_NOT_FOUND)return X("{category} does not exist",e).format({category:s});if(i.muxCode===te.NETWORK_NOT_READY)return X("{category} is not currently available",e).format({category:s})}if(i.code){if(i.code===V.MEDIA_ERR_NETWORK)return X("Network Error",e);if(i.code===V.MEDIA_ERR_DECODE)return X("Media Error",e);if(i.code===V.MEDIA_ERR_SRC_NOT_SUPPORTED)return X("Source Not Supported",e)}return X("Error",e)},qD=(i,e=!1)=>{var t,r;if(i.muxCode){let s=XT((t=i.errorCategory)!=null?t:"video"),n=Ga((r=i.errorCategory)!=null?r:Ue.VIDEO);return i.muxCode===te.NETWORK_OFFLINE?X("Check your internet connection and try reloading this video.",e):i.muxCode===te.NETWORK_TOKEN_EXPIRED?X("The video\u2019s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:n}):i.muxCode===te.NETWORK_TOKEN_SUB_MISMATCH?X("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:n}):i.muxCode===te.NETWORK_TOKEN_MALFORMED?X("{category} URL is formatted incorrectly",e).format({category:s}):[te.NETWORK_TOKEN_AUD_MISMATCH,te.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?X("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:n}):[te.NETWORK_TOKEN_MISSING,te.NETWORK_INVALID_URL].includes(i.muxCode)?X("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:n}):i.muxCode===te.NETWORK_NOT_FOUND?"":i.muxCode===te.NETWORK_NOT_READY?X("The live stream or video file are not yet ready.",e):i.message}return i.code&&(i.code===V.MEDIA_ERR_NETWORK||i.code===V.MEDIA_ERR_DECODE||i.code===V.MEDIA_ERR_SRC_NOT_SUPPORTED),i.message},QT=(i,e=!1)=>{let t=YD(i,e),r=qD(i,e);return{title:t,message:r}},jD=i=>{if(i.muxCode){if(i.muxCode===te.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===te.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([te.NETWORK_TOKEN_AUD_MISMATCH,te.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===te.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===te.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===te.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===te.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===V.MEDIA_ERR_NETWORK)return"";if(i.code===V.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===V.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},Vp=(i,e)=>{let t=jD(i);return{message:i.message,context:i.context,file:t}};var ZT=`<template id="media-theme-gerwig">
1584
1610
  <style>
1585
1611
  @keyframes pre-play-hide {
1586
1612
  0% {
@@ -2697,7 +2723,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
2697
2723
  <slot></slot>
2698
2724
  </media-controller>
2699
2725
  </template>
2700
- `;function JT({anchor:i,floating:e,placement:t}){let r=zD({anchor:i,floating:e}),{x:s,y:n}=QD(r,t);return{x:s,y:n}}function zD({anchor:i,floating:e}){return{anchor:XD(i,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function XD(i,e){var t;let r=i.getBoundingClientRect(),s=(t=e==null?void 0:e.getBoundingClientRect())!=null?t:{x:0,y:0};return{x:r.x-s.x,y:r.y-s.y,width:r.width,height:r.height}}function QD({anchor:i,floating:e},t){let r=ZD(t)==="x"?"y":"x",s=r==="y"?"height":"width",n=e_(t),a=i.x+i.width/2-e.width/2,o=i.y+i.height/2-e.height/2,l=i[s]/2-e[s]/2,d;switch(n){case"top":d={x:a,y:i.y-e.height};break;case"bottom":d={x:a,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:o};break;case"left":d={x:i.x-e.width,y:o};break;default:d={x:i.x,y:i.y}}switch(t.split("-")[1]){case"start":d[r]-=l;break;case"end":d[r]+=l;break}return d}function e_(i){return i.split("-")[0]}function ZD(i){return["top","bottom"].includes(e_(i))?"y":"x"}var kr=class extends Event{constructor({action:e="auto",relatedTarget:t,...r}){super("invoke",r),this.action=e,this.relatedTarget=t}},Nu=class extends Event{constructor({newState:e,oldState:t,...r}){super("toggle",r),this.newState=e,this.oldState=t}};var ig=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},xe=(i,e,t)=>(ig(i,e,"read from private field"),t?t.call(i):e.get(i)),Be=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ui=(i,e,t,r)=>(ig(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),$e=(i,e,t)=>(ig(i,e,"access private method"),t),Fi,Os,Lr,Uu,Fu,Ns,ho,Wp,t_,Hu,Bu,Yp,qp,i_,jp,r_,zp,s_,Un,Fn,Bn,fo,Gu,rg,Xp,n_,sg,a_,Qp,o_,ng,l_,Zp,d_,Jp,u_,uo,Ku,eg,c_,co,Vu,$u,tg;function Bi({type:i,text:e,value:t,checked:r}){let s=F.createElement("media-chrome-menu-item");s.type=i!=null?i:"",s.part.add("menu-item"),i&&s.part.add(i),s.value=t,s.checked=r;let n=F.createElement("span");return n.textContent=e,s.append(n),s}function hi(i,e){let t=i.querySelector(`:scope > [slot="${e}"]`);if((t==null?void 0:t.nodeName)=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t)return t=t.cloneNode(!0),t;let r=i.shadowRoot.querySelector(`[name="${e}"] > svg`);return r?r.cloneNode(!0):""}var h_=F.createElement("template");h_.innerHTML=`
2726
+ `;function JT({anchor:i,floating:e,placement:t}){let r=XD({anchor:i,floating:e}),{x:s,y:n}=ZD(r,t);return{x:s,y:n}}function XD({anchor:i,floating:e}){return{anchor:QD(i,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function QD(i,e){var t;let r=i.getBoundingClientRect(),s=(t=e==null?void 0:e.getBoundingClientRect())!=null?t:{x:0,y:0};return{x:r.x-s.x,y:r.y-s.y,width:r.width,height:r.height}}function ZD({anchor:i,floating:e},t){let r=JD(t)==="x"?"y":"x",s=r==="y"?"height":"width",n=e_(t),a=i.x+i.width/2-e.width/2,o=i.y+i.height/2-e.height/2,l=i[s]/2-e[s]/2,d;switch(n){case"top":d={x:a,y:i.y-e.height};break;case"bottom":d={x:a,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:o};break;case"left":d={x:i.x-e.width,y:o};break;default:d={x:i.x,y:i.y}}switch(t.split("-")[1]){case"start":d[r]-=l;break;case"end":d[r]+=l;break}return d}function e_(i){return i.split("-")[0]}function JD(i){return["top","bottom"].includes(e_(i))?"y":"x"}var kr=class extends Event{constructor({action:e="auto",relatedTarget:t,...r}){super("invoke",r),this.action=e,this.relatedTarget=t}},Nu=class extends Event{constructor({newState:e,oldState:t,...r}){super("toggle",r),this.newState=e,this.oldState=t}};var ig=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},xe=(i,e,t)=>(ig(i,e,"read from private field"),t?t.call(i):e.get(i)),Be=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ui=(i,e,t,r)=>(ig(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),$e=(i,e,t)=>(ig(i,e,"access private method"),t),Fi,Os,Lr,Uu,Fu,Ns,ho,Wp,t_,Hu,Bu,Yp,qp,i_,jp,r_,zp,s_,Un,Fn,Bn,fo,Gu,rg,Xp,n_,sg,a_,Qp,o_,ng,l_,Zp,d_,Jp,u_,uo,Ku,eg,c_,co,Vu,$u,tg;function Bi({type:i,text:e,value:t,checked:r}){let s=F.createElement("media-chrome-menu-item");s.type=i!=null?i:"",s.part.add("menu-item"),i&&s.part.add(i),s.value=t,s.checked=r;let n=F.createElement("span");return n.textContent=e,s.append(n),s}function hi(i,e){let t=i.querySelector(`:scope > [slot="${e}"]`);if((t==null?void 0:t.nodeName)=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t)return t=t.cloneNode(!0),t;let r=i.shadowRoot.querySelector(`[name="${e}"] > svg`);return r?r.cloneNode(!0):""}var h_=F.createElement("template");h_.innerHTML=`
2701
2727
  <style>
2702
2728
  :host {
2703
2729
  font: var(--media-font,
@@ -2871,7 +2897,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
2871
2897
  <slot></slot>
2872
2898
  </div>
2873
2899
  <slot name="checked-indicator" hidden></slot>
2874
- `;var Ps={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},Et=class extends x.HTMLElement{constructor(){super(),Be(this,Wp),Be(this,Bu),Be(this,qp),Be(this,jp),Be(this,zp),Be(this,Bn),Be(this,Gu),Be(this,Xp),Be(this,sg),Be(this,Qp),Be(this,ng),Be(this,Zp),Be(this,Jp),Be(this,uo),Be(this,eg),Be(this,co),Be(this,$u),Be(this,Fi,null),Be(this,Os,null),Be(this,Lr,null),Be(this,Uu,new Set),Be(this,Fu,void 0),Be(this,Ns,!1),Be(this,ho,null),Be(this,Hu,()=>{let e=xe(this,Uu),t=new Set(this.items);for(let r of e)t.has(r)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:r}));for(let r of t)e.has(r)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:r}));Ui(this,Uu,t)}),Be(this,Un,()=>{$e(this,Bn,fo).call(this),$e(this,Gu,rg).call(this,!1)}),Be(this,Fn,()=>{$e(this,Bn,fo).call(this)}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.nativeEl=this.constructor.template.content.cloneNode(!0),this.shadowRoot.append(this.nativeEl)),this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),Ui(this,Fu,new MutationObserver(xe(this,Hu))),xe(this,Fu).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[Ps.DISABLED,Ps.HIDDEN,Ps.STYLE,Ps.ANCHOR,pe.MEDIA_CONTROLLER]}static formatMenuItemText(e,t){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this)}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this)}handleEvent(e){switch(e.type){case"slotchange":$e(this,Wp,t_).call(this,e);break;case"invoke":$e(this,qp,i_).call(this,e);break;case"click":$e(this,Xp,n_).call(this,e);break;case"toggle":$e(this,Qp,o_).call(this,e);break;case"focusout":$e(this,Zp,d_).call(this,e);break;case"keydown":$e(this,Jp,u_).call(this,e);break}}connectedCallback(){var e,t;Ui(this,ho,Sc(this.shadowRoot,":host")),$e(this,Bu,Yp).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Ui(this,Fi,Uo(this)),(t=(e=xe(this,Fi))==null?void 0:e.associateElement)==null||t.call(e,this),this.hidden||(Vi(mo(this),xe(this,Un)),Vi(this,xe(this,Fn)))}disconnectedCallback(){var e,t;Wi(mo(this),xe(this,Un)),Wi(this,xe(this,Fn)),this.disable(),(t=(e=xe(this,Fi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ui(this,Fi,null)}attributeChangedCallback(e,t,r){var s,n,a,o;e===Ps.HIDDEN&&r!==t?(xe(this,Ns)||Ui(this,Ns,!0),this.hidden?$e(this,zp,s_).call(this):$e(this,jp,r_).call(this),this.dispatchEvent(new Nu({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===pe.MEDIA_CONTROLLER?(t&&((n=(s=xe(this,Fi))==null?void 0:s.unassociateElement)==null||n.call(s,this),Ui(this,Fi,null)),r&&this.isConnected&&(Ui(this,Fi,Uo(this)),(o=(a=xe(this,Fi))==null?void 0:a.associateElement)==null||o.call(a,this))):e===Ps.DISABLED&&r!==t?r==null?this.enable():this.disable():e===Ps.STYLE&&r!==t&&$e(this,Bu,Yp).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=Pr(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(JD)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return(t=(e=this.checkedItems[0])==null?void 0:e.value)!=null?t:""}set value(e){let t=this.items.find(r=>r.value===e);t&&$e(this,$u,tg).call(this,t)}focus(){if(Ui(this,Os,Xn()),this.items.length){$e(this,co,Vu).call(this,this.items[0]),this.items[0].focus();return}let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e==null||e.focus()}handleSelect(e){var t;let r=$e(this,uo,Ku).call(this,e);r&&($e(this,$u,tg).call(this,r,r.type==="checkbox"),xe(this,Lr)&&!this.hidden&&((t=xe(this,Os))==null||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,r;let{key:s}=e,n=this.items,a=(r=(t=$e(this,uo,Ku).call(this,e))!=null?t:$e(this,eg,c_).call(this))!=null?r:n[0],o=n.indexOf(a),l=Math.max(0,o);s==="ArrowDown"?l++:s==="ArrowUp"?l--:e.key==="Home"?l=0:e.key==="End"&&(l=n.length-1),l<0&&(l=n.length-1),l>n.length-1&&(l=0),$e(this,co,Vu).call(this,n[l]),n[l].focus()}};Fi=new WeakMap;Os=new WeakMap;Lr=new WeakMap;Uu=new WeakMap;Fu=new WeakMap;Ns=new WeakMap;ho=new WeakMap;Wp=new WeakSet;t_=function(i){let e=i.target;for(let t of e.assignedNodes({flatten:!0}))t.nodeType===3&&t.textContent.trim()===""&&t.remove();if(["header","title"].includes(e.name)){let t=this.shadowRoot.querySelector('slot[name="header"]');t.hidden=e.assignedNodes().length===0}e.name||xe(this,Hu).call(this)};Hu=new WeakMap;Bu=new WeakSet;Yp=function(){var i;let e=this.shadowRoot.querySelector("#layout-row"),t=(i=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:i.trim();e.setAttribute("media",t==="row"?"":"width:0")};qp=new WeakSet;i_=function(i){Ui(this,Lr,i.relatedTarget),At(this,i.relatedTarget)||(this.hidden=!this.hidden)};jp=new WeakSet;r_=function(){var i;(i=xe(this,Lr))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),Vi(mo(this),xe(this,Un)),Vi(this,xe(this,Fn))};zp=new WeakSet;s_=function(){var i;(i=xe(this,Lr))==null||i.setAttribute("aria-expanded","false"),Wi(mo(this),xe(this,Un)),Wi(this,xe(this,Fn))};Un=new WeakMap;Fn=new WeakMap;Bn=new WeakSet;fo=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:e,y:t}=JT({anchor:this.anchorElement,floating:this,placement:"top-start"});i!=null||(i=this.offsetWidth);let s=mo(this).getBoundingClientRect(),n=s.width-e-i,a=s.height-t-this.offsetHeight,{style:o}=xe(this,ho);o.setProperty("position","absolute"),o.setProperty("right",`${Math.max(0,n)}px`),o.setProperty("--_menu-bottom",`${a}px`);let l=getComputedStyle(this),u=o.getPropertyValue("--_menu-bottom")===l.bottom?a:parseFloat(l.bottom),c=s.height-u-parseFloat(l.marginBottom);this.style.setProperty("--_menu-max-height",`${c}px`)};Gu=new WeakSet;rg=function(i){let e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),t=e==null?void 0:e.querySelector('[role="menu"]'),{style:r}=xe(this,ho);if(i||r.setProperty("--media-menu-transition-in","none"),t){let s=t.offsetHeight,n=Math.max(t.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${n}px`),this.style.setProperty("min-height",`${s}px`),$e(this,Bn,fo).call(this,n)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),$e(this,Bn,fo).call(this);r.removeProperty("--media-menu-transition-in")};Xp=new WeakSet;n_=function(i){var e;if(i.stopPropagation(),i.composedPath().includes(xe(this,sg,a_))){(e=xe(this,Os))==null||e.focus(),this.hidden=!0;return}let t=$e(this,uo,Ku).call(this,i);!t||t.hasAttribute("disabled")||($e(this,co,Vu).call(this,t),this.handleSelect(i))};sg=new WeakSet;a_=function(){var i;return(i=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:i.find(t=>t.matches('button[part~="back"]'))};Qp=new WeakSet;o_=function(i){if(i.target===this)return;$e(this,ng,l_).call(this);let e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let t of e)t.invokeTargetElement!=i.target&&i.newState=="open"&&t.getAttribute("aria-expanded")=="true"&&!t.invokeTargetElement.hidden&&t.invokeTargetElement.dispatchEvent(new kr({relatedTarget:t}));for(let t of e)t.setAttribute("aria-expanded",`${!t.submenuElement.hidden}`);$e(this,Gu,rg).call(this,!0)};ng=new WeakSet;l_=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};Zp=new WeakSet;d_=function(i){var e;At(this,i.relatedTarget)||(xe(this,Ns)&&((e=xe(this,Os))==null||e.focus()),xe(this,Lr)&&xe(this,Lr)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))};Jp=new WeakSet;u_=function(i){var e,t,r,s,n;let{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;if(!(o||l||d)&&this.keysUsed.includes(a))if(i.preventDefault(),i.stopPropagation(),a==="Tab"){if(xe(this,Ns)){this.hidden=!0;return}i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(s=(r=this.nextElementSibling)==null?void 0:r.focus)==null||s.call(r),this.blur()}else a==="Escape"?((n=xe(this,Os))==null||n.focus(),xe(this,Ns)&&(this.hidden=!0)):a==="Enter"||a===" "?this.handleSelect(i):this.handleMove(i)};uo=new WeakSet;Ku=function(i){return i.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};eg=new WeakSet;c_=function(){return this.items.find(i=>i.tabIndex===0)};co=new WeakSet;Vu=function(i){for(let e of this.items)e.tabIndex=e===i?0:-1};$u=new WeakSet;tg=function(i,e){let t=[...this.checkedItems];i.type==="radio"&&this.radioGroupItems.forEach(r=>r.checked=!1),e?i.checked=!i.checked:i.checked=!0,this.checkedItems.some((r,s)=>r!=t[s])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};Et.template=h_;function JD(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i==null?void 0:i.role)}function mo(i){var e;return(e=i.getAttribute("bounds")?mi(i,`#${i.getAttribute("bounds")}`):Ke(i)||i.parentElement)!=null?e:i}x.customElements.get("media-chrome-menu")||x.customElements.define("media-chrome-menu",Et);var cg=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Hi=(i,e,t)=>(cg(i,e,"read from private field"),t?t.call(i):e.get(i)),nr=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ag=(i,e,t,r)=>(cg(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),$i=(i,e,t)=>(cg(i,e,"access private method"),t),Wu,go,og,f_,hg,m_,fg,p_,Gi,$n,vo,lg,g_,Yu,dg,v_=F.createElement("template");v_.innerHTML=`
2900
+ `;var Ps={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},Et=class extends x.HTMLElement{constructor(){super(),Be(this,Wp),Be(this,Bu),Be(this,qp),Be(this,jp),Be(this,zp),Be(this,Bn),Be(this,Gu),Be(this,Xp),Be(this,sg),Be(this,Qp),Be(this,ng),Be(this,Zp),Be(this,Jp),Be(this,uo),Be(this,eg),Be(this,co),Be(this,$u),Be(this,Fi,null),Be(this,Os,null),Be(this,Lr,null),Be(this,Uu,new Set),Be(this,Fu,void 0),Be(this,Ns,!1),Be(this,ho,null),Be(this,Hu,()=>{let e=xe(this,Uu),t=new Set(this.items);for(let r of e)t.has(r)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:r}));for(let r of t)e.has(r)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:r}));Ui(this,Uu,t)}),Be(this,Un,()=>{$e(this,Bn,fo).call(this),$e(this,Gu,rg).call(this,!1)}),Be(this,Fn,()=>{$e(this,Bn,fo).call(this)}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.nativeEl=this.constructor.template.content.cloneNode(!0),this.shadowRoot.append(this.nativeEl)),this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),Ui(this,Fu,new MutationObserver(xe(this,Hu))),xe(this,Fu).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[Ps.DISABLED,Ps.HIDDEN,Ps.STYLE,Ps.ANCHOR,pe.MEDIA_CONTROLLER]}static formatMenuItemText(e,t){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this)}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this)}handleEvent(e){switch(e.type){case"slotchange":$e(this,Wp,t_).call(this,e);break;case"invoke":$e(this,qp,i_).call(this,e);break;case"click":$e(this,Xp,n_).call(this,e);break;case"toggle":$e(this,Qp,o_).call(this,e);break;case"focusout":$e(this,Zp,d_).call(this,e);break;case"keydown":$e(this,Jp,u_).call(this,e);break}}connectedCallback(){var e,t;Ui(this,ho,Sc(this.shadowRoot,":host")),$e(this,Bu,Yp).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Ui(this,Fi,Uo(this)),(t=(e=xe(this,Fi))==null?void 0:e.associateElement)==null||t.call(e,this),this.hidden||(Vi(mo(this),xe(this,Un)),Vi(this,xe(this,Fn)))}disconnectedCallback(){var e,t;Wi(mo(this),xe(this,Un)),Wi(this,xe(this,Fn)),this.disable(),(t=(e=xe(this,Fi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ui(this,Fi,null)}attributeChangedCallback(e,t,r){var s,n,a,o;e===Ps.HIDDEN&&r!==t?(xe(this,Ns)||Ui(this,Ns,!0),this.hidden?$e(this,zp,s_).call(this):$e(this,jp,r_).call(this),this.dispatchEvent(new Nu({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===pe.MEDIA_CONTROLLER?(t&&((n=(s=xe(this,Fi))==null?void 0:s.unassociateElement)==null||n.call(s,this),Ui(this,Fi,null)),r&&this.isConnected&&(Ui(this,Fi,Uo(this)),(o=(a=xe(this,Fi))==null?void 0:a.associateElement)==null||o.call(a,this))):e===Ps.DISABLED&&r!==t?r==null?this.enable():this.disable():e===Ps.STYLE&&r!==t&&$e(this,Bu,Yp).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=Pr(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(eC)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return(t=(e=this.checkedItems[0])==null?void 0:e.value)!=null?t:""}set value(e){let t=this.items.find(r=>r.value===e);t&&$e(this,$u,tg).call(this,t)}focus(){if(Ui(this,Os,Xn()),this.items.length){$e(this,co,Vu).call(this,this.items[0]),this.items[0].focus();return}let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e==null||e.focus()}handleSelect(e){var t;let r=$e(this,uo,Ku).call(this,e);r&&($e(this,$u,tg).call(this,r,r.type==="checkbox"),xe(this,Lr)&&!this.hidden&&((t=xe(this,Os))==null||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,r;let{key:s}=e,n=this.items,a=(r=(t=$e(this,uo,Ku).call(this,e))!=null?t:$e(this,eg,c_).call(this))!=null?r:n[0],o=n.indexOf(a),l=Math.max(0,o);s==="ArrowDown"?l++:s==="ArrowUp"?l--:e.key==="Home"?l=0:e.key==="End"&&(l=n.length-1),l<0&&(l=n.length-1),l>n.length-1&&(l=0),$e(this,co,Vu).call(this,n[l]),n[l].focus()}};Fi=new WeakMap;Os=new WeakMap;Lr=new WeakMap;Uu=new WeakMap;Fu=new WeakMap;Ns=new WeakMap;ho=new WeakMap;Wp=new WeakSet;t_=function(i){let e=i.target;for(let t of e.assignedNodes({flatten:!0}))t.nodeType===3&&t.textContent.trim()===""&&t.remove();if(["header","title"].includes(e.name)){let t=this.shadowRoot.querySelector('slot[name="header"]');t.hidden=e.assignedNodes().length===0}e.name||xe(this,Hu).call(this)};Hu=new WeakMap;Bu=new WeakSet;Yp=function(){var i;let e=this.shadowRoot.querySelector("#layout-row"),t=(i=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:i.trim();e.setAttribute("media",t==="row"?"":"width:0")};qp=new WeakSet;i_=function(i){Ui(this,Lr,i.relatedTarget),At(this,i.relatedTarget)||(this.hidden=!this.hidden)};jp=new WeakSet;r_=function(){var i;(i=xe(this,Lr))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),Vi(mo(this),xe(this,Un)),Vi(this,xe(this,Fn))};zp=new WeakSet;s_=function(){var i;(i=xe(this,Lr))==null||i.setAttribute("aria-expanded","false"),Wi(mo(this),xe(this,Un)),Wi(this,xe(this,Fn))};Un=new WeakMap;Fn=new WeakMap;Bn=new WeakSet;fo=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:e,y:t}=JT({anchor:this.anchorElement,floating:this,placement:"top-start"});i!=null||(i=this.offsetWidth);let s=mo(this).getBoundingClientRect(),n=s.width-e-i,a=s.height-t-this.offsetHeight,{style:o}=xe(this,ho);o.setProperty("position","absolute"),o.setProperty("right",`${Math.max(0,n)}px`),o.setProperty("--_menu-bottom",`${a}px`);let l=getComputedStyle(this),u=o.getPropertyValue("--_menu-bottom")===l.bottom?a:parseFloat(l.bottom),c=s.height-u-parseFloat(l.marginBottom);this.style.setProperty("--_menu-max-height",`${c}px`)};Gu=new WeakSet;rg=function(i){let e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),t=e==null?void 0:e.querySelector('[role="menu"]'),{style:r}=xe(this,ho);if(i||r.setProperty("--media-menu-transition-in","none"),t){let s=t.offsetHeight,n=Math.max(t.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${n}px`),this.style.setProperty("min-height",`${s}px`),$e(this,Bn,fo).call(this,n)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),$e(this,Bn,fo).call(this);r.removeProperty("--media-menu-transition-in")};Xp=new WeakSet;n_=function(i){var e;if(i.stopPropagation(),i.composedPath().includes(xe(this,sg,a_))){(e=xe(this,Os))==null||e.focus(),this.hidden=!0;return}let t=$e(this,uo,Ku).call(this,i);!t||t.hasAttribute("disabled")||($e(this,co,Vu).call(this,t),this.handleSelect(i))};sg=new WeakSet;a_=function(){var i;return(i=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:i.find(t=>t.matches('button[part~="back"]'))};Qp=new WeakSet;o_=function(i){if(i.target===this)return;$e(this,ng,l_).call(this);let e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let t of e)t.invokeTargetElement!=i.target&&i.newState=="open"&&t.getAttribute("aria-expanded")=="true"&&!t.invokeTargetElement.hidden&&t.invokeTargetElement.dispatchEvent(new kr({relatedTarget:t}));for(let t of e)t.setAttribute("aria-expanded",`${!t.submenuElement.hidden}`);$e(this,Gu,rg).call(this,!0)};ng=new WeakSet;l_=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};Zp=new WeakSet;d_=function(i){var e;At(this,i.relatedTarget)||(xe(this,Ns)&&((e=xe(this,Os))==null||e.focus()),xe(this,Lr)&&xe(this,Lr)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))};Jp=new WeakSet;u_=function(i){var e,t,r,s,n;let{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;if(!(o||l||d)&&this.keysUsed.includes(a))if(i.preventDefault(),i.stopPropagation(),a==="Tab"){if(xe(this,Ns)){this.hidden=!0;return}i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(s=(r=this.nextElementSibling)==null?void 0:r.focus)==null||s.call(r),this.blur()}else a==="Escape"?((n=xe(this,Os))==null||n.focus(),xe(this,Ns)&&(this.hidden=!0)):a==="Enter"||a===" "?this.handleSelect(i):this.handleMove(i)};uo=new WeakSet;Ku=function(i){return i.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};eg=new WeakSet;c_=function(){return this.items.find(i=>i.tabIndex===0)};co=new WeakSet;Vu=function(i){for(let e of this.items)e.tabIndex=e===i?0:-1};$u=new WeakSet;tg=function(i,e){let t=[...this.checkedItems];i.type==="radio"&&this.radioGroupItems.forEach(r=>r.checked=!1),e?i.checked=!i.checked:i.checked=!0,this.checkedItems.some((r,s)=>r!=t[s])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};Et.template=h_;function eC(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i==null?void 0:i.role)}function mo(i){var e;return(e=i.getAttribute("bounds")?mi(i,`#${i.getAttribute("bounds")}`):Ke(i)||i.parentElement)!=null?e:i}x.customElements.get("media-chrome-menu")||x.customElements.define("media-chrome-menu",Et);var cg=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Hi=(i,e,t)=>(cg(i,e,"read from private field"),t?t.call(i):e.get(i)),nr=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ag=(i,e,t,r)=>(cg(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),$i=(i,e,t)=>(cg(i,e,"access private method"),t),Wu,go,og,f_,hg,m_,fg,p_,Gi,$n,vo,lg,g_,Yu,dg,v_=F.createElement("template");v_.innerHTML=`
2875
2901
  <style>
2876
2902
  :host {
2877
2903
  transition: var(--media-menu-item-transition,
@@ -3046,7 +3072,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3046
3072
  <path d="M4.5 14.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"/>
3047
3073
  </svg>
3048
3074
  </slot>
3049
- `;var ju=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,"target"]}constructor(){super({slotTemplate:y_,tooltipContent:H("Settings")})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Ke(this).querySelector("media-settings-menu")}};x.customElements.get("media-settings-menu-button")||x.customElements.define("media-settings-menu-button",ju);var vg=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},T_=(i,e,t)=>(vg(i,e,"read from private field"),t?t.call(i):e.get(i)),zu=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},mg=(i,e,t,r)=>(vg(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Xu=(i,e,t)=>(vg(i,e,"access private method"),t),yo,Ju,Qu,pg,Zu,gg,ec=class extends Et{constructor(){super(...arguments),zu(this,Qu),zu(this,Zu),zu(this,yo,[]),zu(this,Ju,void 0)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_AUDIO_TRACK_LIST,y.MEDIA_AUDIO_TRACK_ENABLED,y.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_AUDIO_TRACK_ENABLED&&t!==r?this.value=r:e===y.MEDIA_AUDIO_TRACK_LIST&&t!==r&&(mg(this,yo,Jg(r!=null?r:"")),Xu(this,Qu,pg).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Xu(this,Zu,gg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Xu(this,Zu,gg))}get anchorElement(){var e;return this.anchor!=="auto"?super.anchorElement:(e=Ke(this))==null?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return T_(this,yo)}set mediaAudioTrackList(e){mg(this,yo,e),Xu(this,Qu,pg).call(this)}get mediaAudioTrackEnabled(){var e;return(e=ue(this,y.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){ce(this,y.MEDIA_AUDIO_TRACK_ENABLED,e)}};yo=new WeakMap;Ju=new WeakMap;Qu=new WeakSet;pg=function(){if(T_(this,Ju)===JSON.stringify(this.mediaAudioTrackList))return;mg(this,Ju,JSON.stringify(this.mediaAudioTrackList));let i=this.mediaAudioTrackList;this.defaultSlot.textContent="";for(let e of i){let t=this.formatMenuItemText(e.label,e),r=Bi({type:"radio",text:t,value:`${e.id}`,checked:e.enabled});r.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(r)}};Zu=new WeakSet;gg=function(){if(this.value==null)return;let i=new x.CustomEvent($.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};x.customElements.get("media-audio-track-menu")||x.customElements.define("media-audio-track-menu",ec);var eC=`<svg aria-hidden="true" viewBox="0 0 24 24">
3075
+ `;var ju=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,"target"]}constructor(){super({slotTemplate:y_,tooltipContent:H("Settings")})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Ke(this).querySelector("media-settings-menu")}};x.customElements.get("media-settings-menu-button")||x.customElements.define("media-settings-menu-button",ju);var vg=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},T_=(i,e,t)=>(vg(i,e,"read from private field"),t?t.call(i):e.get(i)),zu=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},mg=(i,e,t,r)=>(vg(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Xu=(i,e,t)=>(vg(i,e,"access private method"),t),yo,Ju,Qu,pg,Zu,gg,ec=class extends Et{constructor(){super(...arguments),zu(this,Qu),zu(this,Zu),zu(this,yo,[]),zu(this,Ju,void 0)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_AUDIO_TRACK_LIST,y.MEDIA_AUDIO_TRACK_ENABLED,y.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_AUDIO_TRACK_ENABLED&&t!==r?this.value=r:e===y.MEDIA_AUDIO_TRACK_LIST&&t!==r&&(mg(this,yo,Jg(r!=null?r:"")),Xu(this,Qu,pg).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Xu(this,Zu,gg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Xu(this,Zu,gg))}get anchorElement(){var e;return this.anchor!=="auto"?super.anchorElement:(e=Ke(this))==null?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return T_(this,yo)}set mediaAudioTrackList(e){mg(this,yo,e),Xu(this,Qu,pg).call(this)}get mediaAudioTrackEnabled(){var e;return(e=ue(this,y.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){ce(this,y.MEDIA_AUDIO_TRACK_ENABLED,e)}};yo=new WeakMap;Ju=new WeakMap;Qu=new WeakSet;pg=function(){if(T_(this,Ju)===JSON.stringify(this.mediaAudioTrackList))return;mg(this,Ju,JSON.stringify(this.mediaAudioTrackList));let i=this.mediaAudioTrackList;this.defaultSlot.textContent="";for(let e of i){let t=this.formatMenuItemText(e.label,e),r=Bi({type:"radio",text:t,value:`${e.id}`,checked:e.enabled});r.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(r)}};Zu=new WeakSet;gg=function(){if(this.value==null)return;let i=new x.CustomEvent($.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};x.customElements.get("media-audio-track-menu")||x.customElements.define("media-audio-track-menu",ec);var tC=`<svg aria-hidden="true" viewBox="0 0 24 24">
3050
3076
  <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>
3051
3077
  <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/>
3052
3078
  </svg>`,__=F.createElement("template");__.innerHTML=`
@@ -3055,14 +3081,14 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3055
3081
  display: none;
3056
3082
  }
3057
3083
  </style>
3058
- <slot name="icon">${eC}</slot>
3059
- `;var tc=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_AUDIO_TRACK_ENABLED,y.MEDIA_AUDIO_TRACK_UNAVAILABLE]}constructor(){super({slotTemplate:__,tooltipContent:H("Audio")})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("Audio"))}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=Ke(this))==null?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return(e=ue(this,y.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){ce(this,y.MEDIA_AUDIO_TRACK_ENABLED,e)}};x.customElements.get("media-audio-track-menu-button")||x.customElements.define("media-audio-track-menu-button",tc);var _g=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},tC=(i,e,t)=>(_g(i,e,"read from private field"),t?t.call(i):e.get(i)),Eg=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},iC=(i,e,t,r)=>(_g(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),bg=(i,e,t)=>(_g(i,e,"access private method"),t),rc,yg,x_,ic,Tg,rC=`
3084
+ <slot name="icon">${tC}</slot>
3085
+ `;var tc=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_AUDIO_TRACK_ENABLED,y.MEDIA_AUDIO_TRACK_UNAVAILABLE]}constructor(){super({slotTemplate:__,tooltipContent:H("Audio")})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("Audio"))}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=Ke(this))==null?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return(e=ue(this,y.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){ce(this,y.MEDIA_AUDIO_TRACK_ENABLED,e)}};x.customElements.get("media-audio-track-menu-button")||x.customElements.define("media-audio-track-menu-button",tc);var _g=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},iC=(i,e,t)=>(_g(i,e,"read from private field"),t?t.call(i):e.get(i)),Eg=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},rC=(i,e,t,r)=>(_g(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),bg=(i,e,t)=>(_g(i,e,"access private method"),t),rc,yg,x_,ic,Tg,sC=`
3060
3086
  <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator">
3061
3087
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
3062
3088
  </svg>`,R_=F.createElement("template");R_.innerHTML=Et.template.innerHTML+`
3063
- <slot name="captions-indicator" hidden>${rC}</slot>`;var To=class extends Et{constructor(){super(...arguments),Eg(this,yg),Eg(this,ic),Eg(this,rc,void 0)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_SUBTITLES_LIST,y.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_SUBTITLES_LIST&&t!==r?bg(this,yg,x_).call(this):e===y.MEDIA_SUBTITLES_SHOWING&&t!==r&&(this.value=r)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",bg(this,ic,Tg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",bg(this,ic,Tg))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Ke(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return A_(this,y.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){S_(this,y.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return A_(this,y.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){S_(this,y.MEDIA_SUBTITLES_SHOWING,e)}};rc=new WeakMap;yg=new WeakSet;x_=function(){var i;if(tC(this,rc)===JSON.stringify(this.mediaSubtitlesList))return;iC(this,rc,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";let e=!this.value,t=Bi({type:"radio",text:this.formatMenuItemText("Off"),value:"off",checked:e});t.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(t);let r=this.mediaSubtitlesList;for(let s of r){let n=Bi({type:"radio",text:this.formatMenuItemText(s.label,s),value:zo(s),checked:this.value==zo(s)});n.prepend(hi(this,"checked-indicator")),((i=s.kind)!=null?i:"subs")==="captions"&&n.append(hi(this,"captions-indicator")),this.defaultSlot.append(n)}};ic=new WeakSet;Tg=function(){let i=this.mediaSubtitlesShowing,e=this.getAttribute(y.MEDIA_SUBTITLES_SHOWING),t=this.value!==e;if(i!=null&&i.length&&t&&this.dispatchEvent(new x.CustomEvent($.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!t)return;let r=new x.CustomEvent($.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(r)};To.template=R_;var A_=(i,e)=>{let t=i.getAttribute(e);return t?Ur(t):[]},S_=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}let r=qi(t);i.getAttribute(e)!==r&&i.setAttribute(e,r)};x.customElements.get("media-captions-menu")||x.customElements.define("media-captions-menu",To);var sC=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},nC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},aC=(i,e,t,r)=>(sC(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Ag,oC=`<svg aria-hidden="true" viewBox="0 0 26 24">
3089
+ <slot name="captions-indicator" hidden>${sC}</slot>`;var To=class extends Et{constructor(){super(...arguments),Eg(this,yg),Eg(this,ic),Eg(this,rc,void 0)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_SUBTITLES_LIST,y.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_SUBTITLES_LIST&&t!==r?bg(this,yg,x_).call(this):e===y.MEDIA_SUBTITLES_SHOWING&&t!==r&&(this.value=r)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",bg(this,ic,Tg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",bg(this,ic,Tg))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Ke(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return A_(this,y.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){S_(this,y.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return A_(this,y.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){S_(this,y.MEDIA_SUBTITLES_SHOWING,e)}};rc=new WeakMap;yg=new WeakSet;x_=function(){var i;if(iC(this,rc)===JSON.stringify(this.mediaSubtitlesList))return;rC(this,rc,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";let e=!this.value,t=Bi({type:"radio",text:this.formatMenuItemText("Off"),value:"off",checked:e});t.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(t);let r=this.mediaSubtitlesList;for(let s of r){let n=Bi({type:"radio",text:this.formatMenuItemText(s.label,s),value:zo(s),checked:this.value==zo(s)});n.prepend(hi(this,"checked-indicator")),((i=s.kind)!=null?i:"subs")==="captions"&&n.append(hi(this,"captions-indicator")),this.defaultSlot.append(n)}};ic=new WeakSet;Tg=function(){let i=this.mediaSubtitlesShowing,e=this.getAttribute(y.MEDIA_SUBTITLES_SHOWING),t=this.value!==e;if(i!=null&&i.length&&t&&this.dispatchEvent(new x.CustomEvent($.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!t)return;let r=new x.CustomEvent($.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(r)};To.template=R_;var A_=(i,e)=>{let t=i.getAttribute(e);return t?Ur(t):[]},S_=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}let r=qi(t);i.getAttribute(e)!==r&&i.setAttribute(e,r)};x.customElements.get("media-captions-menu")||x.customElements.define("media-captions-menu",To);var nC=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},aC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},oC=(i,e,t,r)=>(nC(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Ag,lC=`<svg aria-hidden="true" viewBox="0 0 26 24">
3064
3090
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
3065
- </svg>`,lC=`<svg aria-hidden="true" viewBox="0 0 26 24">
3091
+ </svg>`,dC=`<svg aria-hidden="true" viewBox="0 0 26 24">
3066
3092
  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
3067
3093
  </svg>`,w_=F.createElement("template");w_.innerHTML=`
3068
3094
  <style>
@@ -3081,10 +3107,10 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3081
3107
  </style>
3082
3108
 
3083
3109
  <slot name="icon">
3084
- <slot name="on">${oC}</slot>
3085
- <slot name="off">${lC}</slot>
3110
+ <slot name="on">${lC}</slot>
3111
+ <slot name="off">${dC}</slot>
3086
3112
  </slot>
3087
- `;var I_=i=>{i.setAttribute("aria-checked",Xo(i).toString())},sc=class extends Nt{constructor(e={}){super({slotTemplate:w_,tooltipContent:H("Captions"),...e}),nC(this,Ag,void 0),aC(this,Ag,!1)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_SUBTITLES_LIST,y.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("closed captions")),I_(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_SUBTITLES_SHOWING&&I_(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=Ke(this))==null?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return k_(this,y.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){L_(this,y.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return k_(this,y.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){L_(this,y.MEDIA_SUBTITLES_SHOWING,e)}};Ag=new WeakMap;var k_=(i,e)=>{let t=i.getAttribute(e);return t?Ur(t):[]},L_=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}let r=qi(t);i.getAttribute(e)!==r&&i.setAttribute(e,r)};x.customElements.get("media-captions-menu-button")||x.customElements.define("media-captions-menu-button",sc);var D_=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},nc=(i,e,t)=>(D_(i,e,"read from private field"),t?t.call(i):e.get(i)),Sg=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},_o=(i,e,t)=>(D_(i,e,"access private method"),t),Hn,Ao,ac,oc,Rg,xg={RATES:"rates"},lc=class extends Et{constructor(){super(),Sg(this,Ao),Sg(this,oc),Sg(this,Hn,new pi(this,xg.RATES,{defaultValue:bh})),_o(this,Ao,ac).call(this)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_PLAYBACK_RATE,xg.RATES]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_PLAYBACK_RATE&&t!=r?this.value=r:e===xg.RATES&&t!=r&&(nc(this,Hn).value=r,_o(this,Ao,ac).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",_o(this,oc,Rg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",_o(this,oc,Rg))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Ke(this).querySelector("media-playback-rate-menu-button")}get rates(){return nc(this,Hn)}set rates(e){e?Array.isArray(e)&&(nc(this,Hn).value=e.join(" ")):nc(this,Hn).value="",_o(this,Ao,ac).call(this)}get mediaPlaybackRate(){return ve(this,y.MEDIA_PLAYBACK_RATE,nn)}set mediaPlaybackRate(e){ye(this,y.MEDIA_PLAYBACK_RATE,e)}};Hn=new WeakMap;Ao=new WeakSet;ac=function(){this.defaultSlot.textContent="";for(let i of this.rates){let e=Bi({type:"radio",text:this.formatMenuItemText(`${i}x`,i),value:i,checked:this.mediaPlaybackRate==i});e.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(e)}};oc=new WeakSet;Rg=function(){if(!this.value)return;let i=new x.CustomEvent($.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};x.customElements.get("media-playback-rate-menu")||x.customElements.define("media-playback-rate-menu",lc);var dC=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},dc=(i,e,t)=>(dC(i,e,"read from private field"),t?t.call(i):e.get(i)),uC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Gn,Ig={RATES:"rates"},cC=[1,1.2,1.5,1.7,2],kg=1,C_=F.createElement("template");C_.innerHTML=`
3113
+ `;var I_=i=>{i.setAttribute("aria-checked",Xo(i).toString())},sc=class extends Nt{constructor(e={}){super({slotTemplate:w_,tooltipContent:H("Captions"),...e}),aC(this,Ag,void 0),oC(this,Ag,!1)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_SUBTITLES_LIST,y.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("closed captions")),I_(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_SUBTITLES_SHOWING&&I_(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=Ke(this))==null?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return k_(this,y.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){L_(this,y.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return k_(this,y.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){L_(this,y.MEDIA_SUBTITLES_SHOWING,e)}};Ag=new WeakMap;var k_=(i,e)=>{let t=i.getAttribute(e);return t?Ur(t):[]},L_=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}let r=qi(t);i.getAttribute(e)!==r&&i.setAttribute(e,r)};x.customElements.get("media-captions-menu-button")||x.customElements.define("media-captions-menu-button",sc);var D_=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},nc=(i,e,t)=>(D_(i,e,"read from private field"),t?t.call(i):e.get(i)),Sg=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},_o=(i,e,t)=>(D_(i,e,"access private method"),t),Hn,Ao,ac,oc,Rg,xg={RATES:"rates"},lc=class extends Et{constructor(){super(),Sg(this,Ao),Sg(this,oc),Sg(this,Hn,new pi(this,xg.RATES,{defaultValue:bh})),_o(this,Ao,ac).call(this)}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_PLAYBACK_RATE,xg.RATES]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_PLAYBACK_RATE&&t!=r?this.value=r:e===xg.RATES&&t!=r&&(nc(this,Hn).value=r,_o(this,Ao,ac).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",_o(this,oc,Rg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",_o(this,oc,Rg))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Ke(this).querySelector("media-playback-rate-menu-button")}get rates(){return nc(this,Hn)}set rates(e){e?Array.isArray(e)&&(nc(this,Hn).value=e.join(" ")):nc(this,Hn).value="",_o(this,Ao,ac).call(this)}get mediaPlaybackRate(){return ve(this,y.MEDIA_PLAYBACK_RATE,nn)}set mediaPlaybackRate(e){ye(this,y.MEDIA_PLAYBACK_RATE,e)}};Hn=new WeakMap;Ao=new WeakSet;ac=function(){this.defaultSlot.textContent="";for(let i of this.rates){let e=Bi({type:"radio",text:this.formatMenuItemText(`${i}x`,i),value:i,checked:this.mediaPlaybackRate==i});e.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(e)}};oc=new WeakSet;Rg=function(){if(!this.value)return;let i=new x.CustomEvent($.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};x.customElements.get("media-playback-rate-menu")||x.customElements.define("media-playback-rate-menu",lc);var uC=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},dc=(i,e,t)=>(uC(i,e,"read from private field"),t?t.call(i):e.get(i)),cC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Gn,Ig={RATES:"rates"},hC=[1,1.2,1.5,1.7,2],kg=1,C_=F.createElement("template");C_.innerHTML=`
3088
3114
  <style>
3089
3115
  :host {
3090
3116
  min-width: 5ch;
@@ -3096,7 +3122,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3096
3122
  }
3097
3123
  </style>
3098
3124
  <slot name="icon"></slot>
3099
- `;var uc=class extends Nt{constructor(e={}){super({slotTemplate:C_,tooltipContent:H("Playback rate"),...e}),uC(this,Gn,new pi(this,Ig.RATES,{defaultValue:cC})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${kg}x`}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_PLAYBACK_RATE,Ig.RATES]}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),e===Ig.RATES&&(dc(this,Gn).value=r),e===y.MEDIA_PLAYBACK_RATE){let s=r?+r:Number.NaN,n=Number.isNaN(s)?kg:s;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",H("Playback rate {playbackRate}",{playbackRate:n}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Ke(this).querySelector("media-playback-rate-menu")}get rates(){return dc(this,Gn)}set rates(e){e?Array.isArray(e)&&(dc(this,Gn).value=e.join(" ")):dc(this,Gn).value=""}get mediaPlaybackRate(){return ve(this,y.MEDIA_PLAYBACK_RATE,kg)}set mediaPlaybackRate(e){ye(this,y.MEDIA_PLAYBACK_RATE,e)}};Gn=new WeakMap;x.customElements.get("media-playback-rate-menu-button")||x.customElements.define("media-playback-rate-menu-button",uc);var wg=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},So=(i,e,t)=>(wg(i,e,"read from private field"),t?t.call(i):e.get(i)),cc=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},M_=(i,e,t,r)=>(wg(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Kn=(i,e,t)=>(wg(i,e,"access private method"),t),xo,Wn,Vn,Ro,hc,Lg,fc=class extends Et{constructor(){super(...arguments),cc(this,Vn),cc(this,hc),cc(this,xo,[]),cc(this,Wn,{})}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_RENDITION_LIST,y.MEDIA_RENDITION_SELECTED,y.MEDIA_RENDITION_UNAVAILABLE,y.MEDIA_HEIGHT]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_RENDITION_SELECTED&&t!==r?(this.value=r!=null?r:"auto",Kn(this,Vn,Ro).call(this)):e===y.MEDIA_RENDITION_LIST&&t!==r?(M_(this,xo,Qg(r)),Kn(this,Vn,Ro).call(this)):e===y.MEDIA_HEIGHT&&t!==r&&Kn(this,Vn,Ro).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Kn(this,hc,Lg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Kn(this,hc,Lg))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Ke(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return So(this,xo)}set mediaRenditionList(e){M_(this,xo,e),Kn(this,Vn,Ro).call(this)}get mediaRenditionSelected(){return ue(this,y.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){ce(this,y.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return ve(this,y.MEDIA_HEIGHT)}set mediaHeight(e){ye(this,y.MEDIA_HEIGHT,e)}};xo=new WeakMap;Wn=new WeakMap;Vn=new WeakSet;Ro=function(){if(So(this,Wn).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&So(this,Wn).mediaHeight===this.mediaHeight)return;So(this,Wn).mediaRenditionList=JSON.stringify(this.mediaRenditionList),So(this,Wn).mediaHeight=this.mediaHeight;let i=this.mediaRenditionList.sort((n,a)=>a.height-n.height);for(let n of i)n.selected=n.id===this.mediaRenditionSelected;this.defaultSlot.textContent="";let e=!this.mediaRenditionSelected;for(let n of i){let a=this.formatMenuItemText(`${Math.min(n.width,n.height)}p`,n),o=Bi({type:"radio",text:a,value:`${n.id}`,checked:n.selected&&!e});o.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(o)}let t=e?this.formatMenuItemText(`Auto (${this.mediaHeight}p)`):this.formatMenuItemText("Auto"),r=Bi({type:"radio",text:t,value:"auto",checked:e}),s=this.mediaHeight>0?`Auto (${this.mediaHeight}p)`:"Auto";r.dataset.description=s,r.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(r)};hc=new WeakSet;Lg=function(){if(this.value==null)return;let i=new x.CustomEvent($.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};x.customElements.get("media-rendition-menu")||x.customElements.define("media-rendition-menu",fc);var hC=`<svg aria-hidden="true" viewBox="0 0 24 24">
3125
+ `;var uc=class extends Nt{constructor(e={}){super({slotTemplate:C_,tooltipContent:H("Playback rate"),...e}),cC(this,Gn,new pi(this,Ig.RATES,{defaultValue:hC})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${kg}x`}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_PLAYBACK_RATE,Ig.RATES]}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),e===Ig.RATES&&(dc(this,Gn).value=r),e===y.MEDIA_PLAYBACK_RATE){let s=r?+r:Number.NaN,n=Number.isNaN(s)?kg:s;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",H("Playback rate {playbackRate}",{playbackRate:n}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Ke(this).querySelector("media-playback-rate-menu")}get rates(){return dc(this,Gn)}set rates(e){e?Array.isArray(e)&&(dc(this,Gn).value=e.join(" ")):dc(this,Gn).value=""}get mediaPlaybackRate(){return ve(this,y.MEDIA_PLAYBACK_RATE,kg)}set mediaPlaybackRate(e){ye(this,y.MEDIA_PLAYBACK_RATE,e)}};Gn=new WeakMap;x.customElements.get("media-playback-rate-menu-button")||x.customElements.define("media-playback-rate-menu-button",uc);var wg=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},So=(i,e,t)=>(wg(i,e,"read from private field"),t?t.call(i):e.get(i)),cc=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},M_=(i,e,t,r)=>(wg(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Kn=(i,e,t)=>(wg(i,e,"access private method"),t),xo,Wn,Vn,Ro,hc,Lg,fc=class extends Et{constructor(){super(...arguments),cc(this,Vn),cc(this,hc),cc(this,xo,[]),cc(this,Wn,{})}static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_RENDITION_LIST,y.MEDIA_RENDITION_SELECTED,y.MEDIA_RENDITION_UNAVAILABLE,y.MEDIA_HEIGHT]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===y.MEDIA_RENDITION_SELECTED&&t!==r?(this.value=r!=null?r:"auto",Kn(this,Vn,Ro).call(this)):e===y.MEDIA_RENDITION_LIST&&t!==r?(M_(this,xo,Qg(r)),Kn(this,Vn,Ro).call(this)):e===y.MEDIA_HEIGHT&&t!==r&&Kn(this,Vn,Ro).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Kn(this,hc,Lg))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Kn(this,hc,Lg))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Ke(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return So(this,xo)}set mediaRenditionList(e){M_(this,xo,e),Kn(this,Vn,Ro).call(this)}get mediaRenditionSelected(){return ue(this,y.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){ce(this,y.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return ve(this,y.MEDIA_HEIGHT)}set mediaHeight(e){ye(this,y.MEDIA_HEIGHT,e)}};xo=new WeakMap;Wn=new WeakMap;Vn=new WeakSet;Ro=function(){if(So(this,Wn).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&So(this,Wn).mediaHeight===this.mediaHeight)return;So(this,Wn).mediaRenditionList=JSON.stringify(this.mediaRenditionList),So(this,Wn).mediaHeight=this.mediaHeight;let i=this.mediaRenditionList.sort((n,a)=>a.height-n.height);for(let n of i)n.selected=n.id===this.mediaRenditionSelected;this.defaultSlot.textContent="";let e=!this.mediaRenditionSelected;for(let n of i){let a=this.formatMenuItemText(`${Math.min(n.width,n.height)}p`,n),o=Bi({type:"radio",text:a,value:`${n.id}`,checked:n.selected&&!e});o.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(o)}let t=e?this.formatMenuItemText(`Auto (${this.mediaHeight}p)`):this.formatMenuItemText("Auto"),r=Bi({type:"radio",text:t,value:"auto",checked:e}),s=this.mediaHeight>0?`Auto (${this.mediaHeight}p)`:"Auto";r.dataset.description=s,r.prepend(hi(this,"checked-indicator")),this.defaultSlot.append(r)};hc=new WeakSet;Lg=function(){if(this.value==null)return;let i=new x.CustomEvent($.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};x.customElements.get("media-rendition-menu")||x.customElements.define("media-rendition-menu",fc);var fC=`<svg aria-hidden="true" viewBox="0 0 24 24">
3100
3126
  <path d="M13.5 2.5h2v6h-2v-2h-11v-2h11v-2Zm4 2h4v2h-4v-2Zm-12 4h2v6h-2v-2h-3v-2h3v-2Zm4 2h12v2h-12v-2Zm1 4h2v6h-2v-2h-8v-2h8v-2Zm4 2h7v2h-7v-2Z" />
3101
3127
  </svg>`,P_=F.createElement("template");P_.innerHTML=`
3102
3128
  <style>
@@ -3104,8 +3130,8 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3104
3130
  display: none;
3105
3131
  }
3106
3132
  </style>
3107
- <slot name="icon">${hC}</slot>
3108
- `;var mc=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_RENDITION_SELECTED,y.MEDIA_RENDITION_UNAVAILABLE,y.MEDIA_HEIGHT]}constructor(){super({slotTemplate:P_,tooltipContent:H("Quality")})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Ke(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return ue(this,y.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){ce(this,y.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return ve(this,y.MEDIA_HEIGHT)}set mediaHeight(e){ye(this,y.MEDIA_HEIGHT,e)}};x.customElements.get("media-rendition-menu-button")||x.customElements.define("media-rendition-menu-button",mc);var Dg=Ks.createElement("template");"innerHTML"in Dg&&(Dg.innerHTML=ZT);var O_,N_,pc=class extends Ms{};pc.template=(N_=(O_=Dg.content)==null?void 0:O_.children)==null?void 0:N_[0];kt.customElements.get("media-theme-gerwig")||kt.customElements.define("media-theme-gerwig",pc);var fC="gerwig";var ar={SRC:"src",POSTER:"poster"},N={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge"},Cg=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref","proudlydisplaymuxbadge"];function mC(i,e){var r;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src||!!i.currentSrc,poster:i.poster,storyboard:i.storyboard,storyboardSrc:i.getAttribute(N.STORYBOARD_SRC),placeholder:i.getAttribute("placeholder"),themeTemplate:gC(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(N.NOHOTKEYS),hotKeys:i.getAttribute(N.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,assetStartTime:i.assetStartTime,assetEndTime:i.assetEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerInitTime:i.playerInitTime,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(w.TARGET_LIVE_WINDOW),streamType:eo(i.getAttribute(w.STREAM_TYPE)),primaryColor:i.getAttribute(N.PRIMARY_COLOR),secondaryColor:i.getAttribute(N.SECONDARY_COLOR),accentColor:i.getAttribute(N.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:vC(i),playbackRates:i.getAttribute(N.PLAYBACK_RATES),customDomain:(r=i.getAttribute(w.CUSTOM_DOMAIN))!=null?r:void 0,title:i.getAttribute(N.TITLE),novolumepref:i.hasAttribute(N.NO_VOLUME_PREF),castReceiver:i.castReceiver,proudlyDisplayMuxBadge:i.hasAttribute(N.PROUDLY_DISPLAY_MUX_BADGE),...e,extraSourceParams:i.extraSourceParams}}var pC=Sl.formatErrorMessage;Sl.formatErrorMessage=i=>{var e,t;if(i instanceof V){let r=QT(i,!1);return`
3133
+ <slot name="icon">${fC}</slot>
3134
+ `;var mc=class extends Nt{static get observedAttributes(){return[...super.observedAttributes,y.MEDIA_RENDITION_SELECTED,y.MEDIA_RENDITION_UNAVAILABLE,y.MEDIA_HEIGHT]}constructor(){super({slotTemplate:P_,tooltipContent:H("Quality")})}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",H("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Ke(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return ue(this,y.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){ce(this,y.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return ve(this,y.MEDIA_HEIGHT)}set mediaHeight(e){ye(this,y.MEDIA_HEIGHT,e)}};x.customElements.get("media-rendition-menu-button")||x.customElements.define("media-rendition-menu-button",mc);var Dg=Ks.createElement("template");"innerHTML"in Dg&&(Dg.innerHTML=ZT);var O_,N_,pc=class extends Ms{};pc.template=(N_=(O_=Dg.content)==null?void 0:O_.children)==null?void 0:N_[0];kt.customElements.get("media-theme-gerwig")||kt.customElements.define("media-theme-gerwig",pc);var mC="gerwig";var ar={SRC:"src",POSTER:"poster"},N={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge"},Cg=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref","proudlydisplaymuxbadge"];function pC(i,e){var r;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src||!!i.currentSrc,poster:i.poster,storyboard:i.storyboard,storyboardSrc:i.getAttribute(N.STORYBOARD_SRC),placeholder:i.getAttribute("placeholder"),themeTemplate:vC(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(N.NOHOTKEYS),hotKeys:i.getAttribute(N.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,assetStartTime:i.assetStartTime,assetEndTime:i.assetEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerInitTime:i.playerInitTime,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(w.TARGET_LIVE_WINDOW),streamType:eo(i.getAttribute(w.STREAM_TYPE)),primaryColor:i.getAttribute(N.PRIMARY_COLOR),secondaryColor:i.getAttribute(N.SECONDARY_COLOR),accentColor:i.getAttribute(N.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:EC(i),playbackRates:i.getAttribute(N.PLAYBACK_RATES),customDomain:(r=i.getAttribute(w.CUSTOM_DOMAIN))!=null?r:void 0,title:i.getAttribute(N.TITLE),novolumepref:i.hasAttribute(N.NO_VOLUME_PREF),castReceiver:i.castReceiver,proudlyDisplayMuxBadge:i.hasAttribute(N.PROUDLY_DISPLAY_MUX_BADGE),...e,extraSourceParams:i.extraSourceParams}}var gC=Sl.formatErrorMessage;Sl.formatErrorMessage=i=>{var e,t;if(i instanceof V){let r=QT(i,!1);return`
3109
3135
  ${r!=null&&r.title?`<h3>${r.title}</h3>`:""}
3110
3136
  ${r!=null&&r.message||r!=null&&r.linkUrl?`<p>
3111
3137
  ${r==null?void 0:r.message}
@@ -3117,8 +3143,8 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3117
3143
  >${(t=r.linkText)!=null?t:r.linkUrl}</a
3118
3144
  >`:""}
3119
3145
  </p>`:""}
3120
- `}return pC(i)};function gC(i){var t,r;let e=i.theme;if(e){let s=(r=(t=i.getRootNode())==null?void 0:t.getElementById)==null?void 0:r.call(t,e);if(s&&s instanceof HTMLTemplateElement)return s;e.startsWith("media-theme-")||(e=`media-theme-${e}`);let n=kt.customElements.get(e);if(n!=null&&n.template)return n.template}}function vC(i){var t;let e=(t=i.mediaController)==null?void 0:t.querySelector("media-time-display");return e&&getComputedStyle(e).getPropertyValue("--media-duration-display-display").trim()==="none"}function U_(i){let e=i.hasAttribute(N.TITLE)?{video_title:i.getAttribute(N.TITLE)}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,r)=>{let s=i.getAttribute(r);return s!==null&&(t[r.replace(/^metadata-/,"").replace(/-/g,"_")]=s),t},e)}var EC=Object.values(w),bC=Object.values(ar),yC=Object.values(N),F_=Ru(),B_="mux-player",$_={isDialogOpen:!1},TC={redundant_streams:!0},ko,Lo,wo,Cr,Do,Bs,we,Dr,H_,Mg,Fs,G_,K_,V_,W_,Io=class extends Mp{constructor(){super();It(this,we);It(this,ko);It(this,Lo,!1);It(this,wo,{});It(this,Cr,!0);It(this,Do,new xu(this,"hotkeys"));It(this,Bs,{...$_,onCloseErrorDialog:t=>{var s;((s=t.composedPath()[0])==null?void 0:s.localName)==="media-error-dialog"&&ze(this,we,Mg).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:t=>{var n;if(((n=t.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;wp(this,Ks.activeElement)||t.preventDefault()}});Bt(this,ko,ru()),this.attachShadow({mode:"open"}),ze(this,we,H_).call(this),this.isConnected&&ze(this,we,Dr).call(this)}static get NAME(){return B_}static get VERSION(){return F_}static get observedAttributes(){var t;return[...(t=Mp.observedAttributes)!=null?t:[],...bC,...EC,...yC]}get mediaTheme(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("media-theme")}get mediaController(){var t,r;return(r=(t=this.mediaTheme)==null?void 0:t.shadowRoot)==null?void 0:r.querySelector("media-controller")}connectedCallback(){var r;let t=(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video");t&&(t.metadata=U_(this))}attributeChangedCallback(t,r,s){switch(ze(this,we,Dr).call(this),super.attributeChangedCallback(t,r,s),t){case N.HOTKEYS:Se(this,Do).value=s;break;case N.THUMBNAIL_TIME:{s!=null&&this.tokens.thumbnail&&Oi(X("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case N.THUMBNAIL_TOKEN:{if(s){let a=_r(s);if(a){let{aud:o}=a,l=Rn.THUMBNAIL;o!==l&&Oi(X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:o,expectedAud:l,tokenNamePrefix:"thumbnail"}))}}break}case N.STORYBOARD_TOKEN:{if(s){let a=_r(s);if(a){let{aud:o}=a,l=Rn.STORYBOARD;o!==l&&Oi(X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:o,expectedAud:l,tokenNamePrefix:"storyboard"}))}}break}case N.DRM_TOKEN:{if(s){let a=_r(s);if(a){let{aud:o}=a,l=Rn.DRM;o!==l&&Oi(X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:o,expectedAud:l,tokenNamePrefix:"drm"}))}}break}case w.PLAYBACK_ID:{s!=null&&s.includes("?token")&&Ot(X("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:s}));break}case w.STREAM_TYPE:s&&![Re.LIVE,Re.ON_DEMAND,Re.UNKNOWN].includes(s)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=s.includes("dvr")?Number.POSITIVE_INFINITY:0:Dp({file:"invalid-stream-type.md",message:X("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):s===Re.LIVE?this.getAttribute(N.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[w.PLAYBACK_ID,ar.SRC,N.PLAYBACK_TOKEN].includes(t)&&r!==s&&Bt(this,Bs,{...Se(this,Bs),...$_}),ze(this,we,Fs).call(this,{[LT(t)]:s})}get preferCmcd(){var t;return(t=this.getAttribute(w.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?In.includes(t)?this.setAttribute(w.PREFER_CMCD,t):Oi(`Invalid value for preferCmcd. Must be one of ${In.join()}`):this.removeAttribute(w.PREFER_CMCD))}get hasPlayed(){var t,r;return(r=(t=this.mediaController)==null?void 0:t.hasAttribute(y.MEDIA_HAS_PLAYED))!=null?r:!1}get inLiveWindow(){var t;return(t=this.mediaController)==null?void 0:t.hasAttribute(y.MEDIA_TIME_IS_LIVE)}get _hls(){var t;return(t=this.media)==null?void 0:t._hls}get mux(){var t;return(t=this.media)==null?void 0:t.mux}get theme(){var t;return(t=this.getAttribute(N.THEME))!=null?t:fC}set theme(t){this.setAttribute(N.THEME,`${t}`)}get themeProps(){let t=this.mediaTheme;if(!t)return;let r={};for(let s of t.getAttributeNames()){if(Cg.includes(s))continue;let n=t.getAttribute(s);r[Su(s)]=n===""?!0:n}return r}set themeProps(t){var s,n;ze(this,we,Dr).call(this);let r={...this.themeProps,...t};for(let a in r){if(Cg.includes(a))continue;let o=t==null?void 0:t[a];typeof o=="boolean"||o==null?(s=this.mediaTheme)==null||s.toggleAttribute(Au(a),!!o):(n=this.mediaTheme)==null||n.setAttribute(Au(a),o)}}get playbackId(){var t;return(t=this.getAttribute(w.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t?this.setAttribute(w.PLAYBACK_ID,t):this.removeAttribute(w.PLAYBACK_ID)}get src(){var t,r;return this.playbackId?(t=Us(this,ar.SRC))!=null?t:void 0:(r=this.getAttribute(ar.SRC))!=null?r:void 0}set src(t){t?this.setAttribute(ar.SRC,t):this.removeAttribute(ar.SRC)}get poster(){var s;let t=this.getAttribute(ar.POSTER);if(t!=null)return t;let{tokens:r}=this;if(r.playback&&!r.thumbnail){Oi("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return IT(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(s=this.thumbnailTime)!=null?s:this.startTime,programTime:this.programStartTime,token:r.thumbnail})}set poster(t){t||t===""?this.setAttribute(ar.POSTER,t):this.removeAttribute(ar.POSTER)}get storyboardSrc(){var t;return(t=this.getAttribute(N.STORYBOARD_SRC))!=null?t:void 0}set storyboardSrc(t){t?this.setAttribute(N.STORYBOARD_SRC,t):this.removeAttribute(N.STORYBOARD_SRC)}get storyboard(){let{tokens:t}=this;if(this.storyboardSrc&&!t.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[Re.LIVE,Re.UNKNOWN].includes(this.streamType)||t.playback&&!t.storyboard))return kT(this.playbackId,{customDomain:this.customDomain,token:t.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(N.AUDIO)}set audio(t){if(!t){this.removeAttribute(N.AUDIO);return}this.setAttribute(N.AUDIO,"")}get hotkeys(){return Se(this,Do)}get nohotkeys(){return this.hasAttribute(N.NOHOTKEYS)}set nohotkeys(t){if(!t){this.removeAttribute(N.NOHOTKEYS);return}this.setAttribute(N.NOHOTKEYS,"")}get thumbnailTime(){return St(this.getAttribute(N.THUMBNAIL_TIME))}set thumbnailTime(t){this.setAttribute(N.THUMBNAIL_TIME,`${t}`)}get title(){var t;return(t=this.getAttribute(N.TITLE))!=null?t:""}set title(t){t!==this.title&&(t?this.setAttribute(N.TITLE,t):this.removeAttribute("title"),super.title=t)}get placeholder(){var t;return(t=Us(this,N.PLACEHOLDER))!=null?t:""}set placeholder(t){this.setAttribute(N.PLACEHOLDER,`${t}`)}get primaryColor(){var r,s;let t=this.getAttribute(N.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(s=(r=kt.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_primary-color"))==null?void 0:s.trim(),t))return t}set primaryColor(t){this.setAttribute(N.PRIMARY_COLOR,`${t}`)}get secondaryColor(){var r,s;let t=this.getAttribute(N.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(s=(r=kt.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_secondary-color"))==null?void 0:s.trim(),t))return t}set secondaryColor(t){this.setAttribute(N.SECONDARY_COLOR,`${t}`)}get accentColor(){var r,s;let t=this.getAttribute(N.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(s=(r=kt.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_accent-color"))==null?void 0:s.trim(),t))return t}set accentColor(t){this.setAttribute(N.ACCENT_COLOR,`${t}`)}get defaultShowRemainingTime(){return this.hasAttribute(N.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(t){t?this.setAttribute(N.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(N.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(N.PLAYBACK_RATES))return this.getAttribute(N.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,r)=>t-r)}set playbackRates(t){if(!t){this.removeAttribute(N.PLAYBACK_RATES);return}this.setAttribute(N.PLAYBACK_RATES,t.join(" "))}get forwardSeekOffset(){var t;return(t=St(this.getAttribute(N.FORWARD_SEEK_OFFSET)))!=null?t:10}set forwardSeekOffset(t){this.setAttribute(N.FORWARD_SEEK_OFFSET,`${t}`)}get backwardSeekOffset(){var t;return(t=St(this.getAttribute(N.BACKWARD_SEEK_OFFSET)))!=null?t:10}set backwardSeekOffset(t){this.setAttribute(N.BACKWARD_SEEK_OFFSET,`${t}`)}get defaultHiddenCaptions(){return this.hasAttribute(N.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(t){t?this.setAttribute(N.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(N.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return St(this.getAttribute(N.DEFAULT_DURATION))}set defaultDuration(t){t==null?this.removeAttribute(N.DEFAULT_DURATION):this.setAttribute(N.DEFAULT_DURATION,`${t}`)}get playerInitTime(){return this.hasAttribute(w.PLAYER_INIT_TIME)?St(this.getAttribute(w.PLAYER_INIT_TIME)):Se(this,ko)}set playerInitTime(t){t!=this.playerInitTime&&(t==null?this.removeAttribute(w.PLAYER_INIT_TIME):this.setAttribute(w.PLAYER_INIT_TIME,`${+t}`))}get playerSoftwareName(){var t;return(t=this.getAttribute(w.PLAYER_SOFTWARE_NAME))!=null?t:B_}get playerSoftwareVersion(){var t;return(t=this.getAttribute(w.PLAYER_SOFTWARE_VERSION))!=null?t:F_}get beaconCollectionDomain(){var t;return(t=this.getAttribute(w.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(w.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(w.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var t;return(t=this.getAttribute(w.MAX_RESOLUTION))!=null?t:void 0}set maxResolution(t){t!==this.maxResolution&&(t?this.setAttribute(w.MAX_RESOLUTION,t):this.removeAttribute(w.MAX_RESOLUTION))}get minResolution(){var t;return(t=this.getAttribute(w.MIN_RESOLUTION))!=null?t:void 0}set minResolution(t){t!==this.minResolution&&(t?this.setAttribute(w.MIN_RESOLUTION,t):this.removeAttribute(w.MIN_RESOLUTION))}get renditionOrder(){var t;return(t=this.getAttribute(w.RENDITION_ORDER))!=null?t:void 0}set renditionOrder(t){t!==this.renditionOrder&&(t?this.setAttribute(w.RENDITION_ORDER,t):this.removeAttribute(w.RENDITION_ORDER))}get programStartTime(){return St(this.getAttribute(w.PROGRAM_START_TIME))}set programStartTime(t){t==null?this.removeAttribute(w.PROGRAM_START_TIME):this.setAttribute(w.PROGRAM_START_TIME,`${t}`)}get programEndTime(){return St(this.getAttribute(w.PROGRAM_END_TIME))}set programEndTime(t){t==null?this.removeAttribute(w.PROGRAM_END_TIME):this.setAttribute(w.PROGRAM_END_TIME,`${t}`)}get assetStartTime(){return St(this.getAttribute(w.ASSET_START_TIME))}set assetStartTime(t){t==null?this.removeAttribute(w.ASSET_START_TIME):this.setAttribute(w.ASSET_START_TIME,`${t}`)}get assetEndTime(){return St(this.getAttribute(w.ASSET_END_TIME))}set assetEndTime(t){t==null?this.removeAttribute(w.ASSET_END_TIME):this.setAttribute(w.ASSET_END_TIME,`${t}`)}get extraSourceParams(){return this.hasAttribute(N.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(N.EXTRA_SOURCE_PARAMS)).entries()].reduce((t,[r,s])=>(t[r]=s,t),{}):TC}set extraSourceParams(t){t==null?this.removeAttribute(N.EXTRA_SOURCE_PARAMS):this.setAttribute(N.EXTRA_SOURCE_PARAMS,new URLSearchParams(t).toString())}get customDomain(){var t;return(t=this.getAttribute(w.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(w.CUSTOM_DOMAIN,t):this.removeAttribute(w.CUSTOM_DOMAIN))}get envKey(){var t;return(t=Us(this,w.ENV_KEY))!=null?t:void 0}set envKey(t){this.setAttribute(w.ENV_KEY,`${t}`)}get noVolumePref(){return this.hasAttribute(N.NO_VOLUME_PREF)}set noVolumePref(t){t?this.setAttribute(N.NO_VOLUME_PREF,""):this.removeAttribute(N.NO_VOLUME_PREF)}get debug(){return Us(this,w.DEBUG)!=null}set debug(t){t?this.setAttribute(w.DEBUG,""):this.removeAttribute(w.DEBUG)}get disableTracking(){return Us(this,w.DISABLE_TRACKING)!=null}set disableTracking(t){this.toggleAttribute(w.DISABLE_TRACKING,!!t)}get disableCookies(){return Us(this,w.DISABLE_COOKIES)!=null}set disableCookies(t){t?this.setAttribute(w.DISABLE_COOKIES,""):this.removeAttribute(w.DISABLE_COOKIES)}get streamType(){var t,r,s;return(s=(r=this.getAttribute(w.STREAM_TYPE))!=null?r:(t=this.media)==null?void 0:t.streamType)!=null?s:Re.UNKNOWN}set streamType(t){this.setAttribute(w.STREAM_TYPE,`${t}`)}get defaultStreamType(){var t,r,s;return(s=(r=this.getAttribute(N.DEFAULT_STREAM_TYPE))!=null?r:(t=this.mediaController)==null?void 0:t.getAttribute(N.DEFAULT_STREAM_TYPE))!=null?s:Re.ON_DEMAND}set defaultStreamType(t){t?this.setAttribute(N.DEFAULT_STREAM_TYPE,t):this.removeAttribute(N.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var t,r;return this.hasAttribute(N.TARGET_LIVE_WINDOW)?+this.getAttribute(N.TARGET_LIVE_WINDOW):(r=(t=this.media)==null?void 0:t.targetLiveWindow)!=null?r:Number.NaN}set targetLiveWindow(t){t==this.targetLiveWindow||Number.isNaN(t)&&Number.isNaN(this.targetLiveWindow)||(t==null?this.removeAttribute(N.TARGET_LIVE_WINDOW):this.setAttribute(N.TARGET_LIVE_WINDOW,`${+t}`))}get liveEdgeStart(){var t;return(t=this.media)==null?void 0:t.liveEdgeStart}get startTime(){return St(Us(this,w.START_TIME))}set startTime(t){this.setAttribute(w.START_TIME,`${t}`)}get preferPlayback(){let t=this.getAttribute(w.PREFER_PLAYBACK);if(t===jt.MSE||t===jt.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===jt.MSE||t===jt.NATIVE?this.setAttribute(w.PREFER_PLAYBACK,t):this.removeAttribute(w.PREFER_PLAYBACK))}get metadata(){var t;return(t=this.media)==null?void 0:t.metadata}set metadata(t){if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...U_(this),...t}}get _hlsConfig(){var t;return(t=this.media)==null?void 0:t._hlsConfig}set _hlsConfig(t){if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=t}async addCuePoints(t){var r;if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(r=this.media)==null?void 0:r.addCuePoints(t)}get activeCuePoint(){var t;return(t=this.media)==null?void 0:t.activeCuePoint}get cuePoints(){var t,r;return(r=(t=this.media)==null?void 0:t.cuePoints)!=null?r:[]}addChapters(t){var r;if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(r=this.media)==null?void 0:r.addChapters(t)}get activeChapter(){var t;return(t=this.media)==null?void 0:t.activeChapter}get chapters(){var t,r;return(r=(t=this.media)==null?void 0:t.chapters)!=null?r:[]}getStartDate(){var t;return(t=this.media)==null?void 0:t.getStartDate()}get currentPdt(){var t;return(t=this.media)==null?void 0:t.currentPdt}get tokens(){let t=this.getAttribute(N.PLAYBACK_TOKEN),r=this.getAttribute(N.DRM_TOKEN),s=this.getAttribute(N.THUMBNAIL_TOKEN),n=this.getAttribute(N.STORYBOARD_TOKEN);return{...Se(this,wo),...t!=null?{playback:t}:{},...r!=null?{drm:r}:{},...s!=null?{thumbnail:s}:{},...n!=null?{storyboard:n}:{}}}set tokens(t){Bt(this,wo,t!=null?t:{})}get playbackToken(){var t;return(t=this.getAttribute(N.PLAYBACK_TOKEN))!=null?t:void 0}set playbackToken(t){this.setAttribute(N.PLAYBACK_TOKEN,`${t}`)}get drmToken(){var t;return(t=this.getAttribute(N.DRM_TOKEN))!=null?t:void 0}set drmToken(t){this.setAttribute(N.DRM_TOKEN,`${t}`)}get thumbnailToken(){var t;return(t=this.getAttribute(N.THUMBNAIL_TOKEN))!=null?t:void 0}set thumbnailToken(t){this.setAttribute(N.THUMBNAIL_TOKEN,`${t}`)}get storyboardToken(){var t;return(t=this.getAttribute(N.STORYBOARD_TOKEN))!=null?t:void 0}set storyboardToken(t){this.setAttribute(N.STORYBOARD_TOKEN,`${t}`)}addTextTrack(t,r,s,n){var o;let a=(o=this.media)==null?void 0:o.nativeEl;if(a)return iu(a,t,r,s,n)}removeTextTrack(t){var s;let r=(s=this.media)==null?void 0:s.nativeEl;if(r)return Uy(r,t)}get textTracks(){var t;return(t=this.media)==null?void 0:t.textTracks}get castReceiver(){var t;return(t=this.getAttribute(N.CAST_RECEIVER))!=null?t:void 0}set castReceiver(t){t!==this.castReceiver&&(t?this.setAttribute(N.CAST_RECEIVER,t):this.removeAttribute(N.CAST_RECEIVER))}get castCustomData(){var t;return(t=this.media)==null?void 0:t.castCustomData}set castCustomData(t){if(!this.media){Ot("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=t}get noTooltips(){return this.hasAttribute(N.NO_TOOLTIPS)}set noTooltips(t){if(!t){this.removeAttribute(N.NO_TOOLTIPS);return}this.setAttribute(N.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(N.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(t){t?this.setAttribute(N.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(N.PROUDLY_DISPLAY_MUX_BADGE)}};ko=new WeakMap,Lo=new WeakMap,wo=new WeakMap,Cr=new WeakMap,Do=new WeakMap,Bs=new WeakMap,we=new WeakSet,Dr=function(){var t,r,s,n;if(!Se(this,Lo)){Bt(this,Lo,!0),ze(this,we,Fs).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof kt.HTMLElement))throw""}catch{Ot("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ST))throw""}catch{Ot("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof $c))throw""}catch{Ot("<media-controller> failed to upgrade!")}this.init(),ze(this,we,G_).call(this),ze(this,we,K_).call(this),ze(this,we,V_).call(this),Bt(this,Cr,(r=(t=this.mediaController)==null?void 0:t.hasAttribute(ee.USER_INACTIVE))!=null?r:!0),ze(this,we,W_).call(this),(s=this.media)==null||s.addEventListener("streamtypechange",()=>ze(this,we,Fs).call(this)),(n=this.media)==null||n.addEventListener("loadstart",()=>ze(this,we,Fs).call(this))}},H_=function(){var t,r;try{(t=window==null?void 0:window.CSS)==null||t.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(r=window==null?void 0:window.CSS)==null||r.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Mg=function(t){Object.assign(Se(this,Bs),t),ze(this,we,Fs).call(this)},Fs=function(t={}){jT(zT(mC(this,{...Se(this,Bs),...t})),this.shadowRoot)},G_=function(){let t=s=>{var o,l;if(!(s!=null&&s.startsWith("theme-")))return;let n=s.replace(/^theme-/,"");if(Cg.includes(n))return;let a=this.getAttribute(s);a!=null?(o=this.mediaTheme)==null||o.setAttribute(n,a):(l=this.mediaTheme)==null||l.removeAttribute(n)};new MutationObserver(s=>{for(let{attributeName:n}of s)t(n)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(t)},K_=function(){var r;let t=s=>{let{detail:n}=s;if(n instanceof V||(n=new V(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){Oi(n),n.data&&Oi(`${n.name} data:`,n.data);return}let a=Vp(n,!1);a.message&&Dp(a),Ot(n),n.data&&Ot(`${n.name} data:`,n.data),ze(this,we,Mg).call(this,{isDialogOpen:!0})};this.addEventListener("error",t),this.media&&(this.media.errorTranslator=(s={})=>{var a,o,l;if(!(((a=this.media)==null?void 0:a.error)instanceof V))return s;let n=Vp((o=this.media)==null?void 0:o.error,!1);return{player_error_code:(l=this.media)==null?void 0:l.error.code,player_error_message:n.message?String(n.message):s.player_error_message,player_error_context:n.context?String(n.context):s.player_error_context}}),(r=this.media)==null||r.addEventListener("error",s=>{var a,o;let{detail:n}=s;if(!n){let{message:l,code:d}=(o=(a=this.media)==null?void 0:a.error)!=null?o:{};n=new V(l,d)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},V_=function(){var r,s,n,a;let t=()=>ze(this,we,Fs).call(this);(s=(r=this.media)==null?void 0:r.textTracks)==null||s.addEventListener("addtrack",t),(a=(n=this.media)==null?void 0:n.textTracks)==null||a.addEventListener("removetrack",t)},W_=function(){var d,u;if(!/Firefox/i.test(navigator.userAgent))return;let r,s=new WeakMap,n=()=>this.streamType===Re.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,a=(c,h,f=!1)=>{if(n())return;Array.from(c&&c.activeCues||[]).forEach(p=>{if(!(!p.snapToLines||p.line<-5||p.line>=0&&p.line<10))if(!h||this.paused){let g=p.text.split(`
3121
- `).length,E=-3;this.streamType===Re.LIVE&&(E=-2);let b=E-g;if(p.line===b&&!f)return;s.has(p)||s.set(p,p.line),p.line=b}else setTimeout(()=>{p.line=s.get(p)||"auto"},500)})},o=()=>{var c,h;a(r,(h=(c=this.mediaController)==null?void 0:c.hasAttribute(ee.USER_INACTIVE))!=null?h:!1)},l=()=>{var f,m;let h=Array.from(((m=(f=this.mediaController)==null?void 0:f.media)==null?void 0:m.textTracks)||[]).filter(p=>["subtitles","captions"].includes(p.kind)&&p.mode==="showing")[0];h!==r&&(r==null||r.removeEventListener("cuechange",o)),r=h,r==null||r.addEventListener("cuechange",o),a(r,Se(this,Cr))};l(),(d=this.textTracks)==null||d.addEventListener("change",l),(u=this.textTracks)==null||u.addEventListener("addtrack",l),this.addEventListener("userinactivechange",()=>{var h,f;let c=(f=(h=this.mediaController)==null?void 0:h.hasAttribute(ee.USER_INACTIVE))!=null?f:!0;Se(this,Cr)!==c&&(Bt(this,Cr,c),a(r,Se(this,Cr)))})};function Us(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}kt.customElements.get("mux-player")||(kt.customElements.define("mux-player",Io),kt.MuxPlayerElement=Io);var fF=Io;export{V as MediaError,fF as default,ru as generatePlayerInitTime,Us as getVideoAttribute,B_ as playerSoftwareName,F_ as playerSoftwareVersion};
3146
+ `}return gC(i)};function vC(i){var t,r;let e=i.theme;if(e){let s=(r=(t=i.getRootNode())==null?void 0:t.getElementById)==null?void 0:r.call(t,e);if(s&&s instanceof HTMLTemplateElement)return s;e.startsWith("media-theme-")||(e=`media-theme-${e}`);let n=kt.customElements.get(e);if(n!=null&&n.template)return n.template}}function EC(i){var t;let e=(t=i.mediaController)==null?void 0:t.querySelector("media-time-display");return e&&getComputedStyle(e).getPropertyValue("--media-duration-display-display").trim()==="none"}function U_(i){let e=i.hasAttribute(N.TITLE)?{video_title:i.getAttribute(N.TITLE)}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,r)=>{let s=i.getAttribute(r);return s!==null&&(t[r.replace(/^metadata-/,"").replace(/-/g,"_")]=s),t},e)}var bC=Object.values(w),yC=Object.values(ar),TC=Object.values(N),F_=Ru(),B_="mux-player",$_={isDialogOpen:!1},_C={redundant_streams:!0},ko,Lo,wo,Cr,Do,Bs,we,Dr,H_,Mg,Fs,G_,K_,V_,W_,Io=class extends Mp{constructor(){super();It(this,we);It(this,ko);It(this,Lo,!1);It(this,wo,{});It(this,Cr,!0);It(this,Do,new xu(this,"hotkeys"));It(this,Bs,{...$_,onCloseErrorDialog:t=>{var s;((s=t.composedPath()[0])==null?void 0:s.localName)==="media-error-dialog"&&ze(this,we,Mg).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:t=>{var n;if(((n=t.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;wp(this,Ks.activeElement)||t.preventDefault()}});Bt(this,ko,ru()),this.attachShadow({mode:"open"}),ze(this,we,H_).call(this),this.isConnected&&ze(this,we,Dr).call(this)}static get NAME(){return B_}static get VERSION(){return F_}static get observedAttributes(){var t;return[...(t=Mp.observedAttributes)!=null?t:[],...yC,...bC,...TC]}get mediaTheme(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("media-theme")}get mediaController(){var t,r;return(r=(t=this.mediaTheme)==null?void 0:t.shadowRoot)==null?void 0:r.querySelector("media-controller")}connectedCallback(){var r;let t=(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video");t&&(t.metadata=U_(this))}attributeChangedCallback(t,r,s){switch(ze(this,we,Dr).call(this),super.attributeChangedCallback(t,r,s),t){case N.HOTKEYS:Se(this,Do).value=s;break;case N.THUMBNAIL_TIME:{s!=null&&this.tokens.thumbnail&&Oi(X("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case N.THUMBNAIL_TOKEN:{if(s){let a=_r(s);if(a){let{aud:o}=a,l=Rn.THUMBNAIL;o!==l&&Oi(X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:o,expectedAud:l,tokenNamePrefix:"thumbnail"}))}}break}case N.STORYBOARD_TOKEN:{if(s){let a=_r(s);if(a){let{aud:o}=a,l=Rn.STORYBOARD;o!==l&&Oi(X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:o,expectedAud:l,tokenNamePrefix:"storyboard"}))}}break}case N.DRM_TOKEN:{if(s){let a=_r(s);if(a){let{aud:o}=a,l=Rn.DRM;o!==l&&Oi(X("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:o,expectedAud:l,tokenNamePrefix:"drm"}))}}break}case w.PLAYBACK_ID:{s!=null&&s.includes("?token")&&Ot(X("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:s}));break}case w.STREAM_TYPE:s&&![Re.LIVE,Re.ON_DEMAND,Re.UNKNOWN].includes(s)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=s.includes("dvr")?Number.POSITIVE_INFINITY:0:Dp({file:"invalid-stream-type.md",message:X("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):s===Re.LIVE?this.getAttribute(N.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[w.PLAYBACK_ID,ar.SRC,N.PLAYBACK_TOKEN].includes(t)&&r!==s&&Bt(this,Bs,{...Se(this,Bs),...$_}),ze(this,we,Fs).call(this,{[LT(t)]:s})}get preferCmcd(){var t;return(t=this.getAttribute(w.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?In.includes(t)?this.setAttribute(w.PREFER_CMCD,t):Oi(`Invalid value for preferCmcd. Must be one of ${In.join()}`):this.removeAttribute(w.PREFER_CMCD))}get hasPlayed(){var t,r;return(r=(t=this.mediaController)==null?void 0:t.hasAttribute(y.MEDIA_HAS_PLAYED))!=null?r:!1}get inLiveWindow(){var t;return(t=this.mediaController)==null?void 0:t.hasAttribute(y.MEDIA_TIME_IS_LIVE)}get _hls(){var t;return(t=this.media)==null?void 0:t._hls}get mux(){var t;return(t=this.media)==null?void 0:t.mux}get theme(){var t;return(t=this.getAttribute(N.THEME))!=null?t:mC}set theme(t){this.setAttribute(N.THEME,`${t}`)}get themeProps(){let t=this.mediaTheme;if(!t)return;let r={};for(let s of t.getAttributeNames()){if(Cg.includes(s))continue;let n=t.getAttribute(s);r[Su(s)]=n===""?!0:n}return r}set themeProps(t){var s,n;ze(this,we,Dr).call(this);let r={...this.themeProps,...t};for(let a in r){if(Cg.includes(a))continue;let o=t==null?void 0:t[a];typeof o=="boolean"||o==null?(s=this.mediaTheme)==null||s.toggleAttribute(Au(a),!!o):(n=this.mediaTheme)==null||n.setAttribute(Au(a),o)}}get playbackId(){var t;return(t=this.getAttribute(w.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t?this.setAttribute(w.PLAYBACK_ID,t):this.removeAttribute(w.PLAYBACK_ID)}get src(){var t,r;return this.playbackId?(t=Us(this,ar.SRC))!=null?t:void 0:(r=this.getAttribute(ar.SRC))!=null?r:void 0}set src(t){t?this.setAttribute(ar.SRC,t):this.removeAttribute(ar.SRC)}get poster(){var s;let t=this.getAttribute(ar.POSTER);if(t!=null)return t;let{tokens:r}=this;if(r.playback&&!r.thumbnail){Oi("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return IT(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(s=this.thumbnailTime)!=null?s:this.startTime,programTime:this.programStartTime,token:r.thumbnail})}set poster(t){t||t===""?this.setAttribute(ar.POSTER,t):this.removeAttribute(ar.POSTER)}get storyboardSrc(){var t;return(t=this.getAttribute(N.STORYBOARD_SRC))!=null?t:void 0}set storyboardSrc(t){t?this.setAttribute(N.STORYBOARD_SRC,t):this.removeAttribute(N.STORYBOARD_SRC)}get storyboard(){let{tokens:t}=this;if(this.storyboardSrc&&!t.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[Re.LIVE,Re.UNKNOWN].includes(this.streamType)||t.playback&&!t.storyboard))return kT(this.playbackId,{customDomain:this.customDomain,token:t.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(N.AUDIO)}set audio(t){if(!t){this.removeAttribute(N.AUDIO);return}this.setAttribute(N.AUDIO,"")}get hotkeys(){return Se(this,Do)}get nohotkeys(){return this.hasAttribute(N.NOHOTKEYS)}set nohotkeys(t){if(!t){this.removeAttribute(N.NOHOTKEYS);return}this.setAttribute(N.NOHOTKEYS,"")}get thumbnailTime(){return St(this.getAttribute(N.THUMBNAIL_TIME))}set thumbnailTime(t){this.setAttribute(N.THUMBNAIL_TIME,`${t}`)}get title(){var t;return(t=this.getAttribute(N.TITLE))!=null?t:""}set title(t){t!==this.title&&(t?this.setAttribute(N.TITLE,t):this.removeAttribute("title"),super.title=t)}get placeholder(){var t;return(t=Us(this,N.PLACEHOLDER))!=null?t:""}set placeholder(t){this.setAttribute(N.PLACEHOLDER,`${t}`)}get primaryColor(){var r,s;let t=this.getAttribute(N.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(s=(r=kt.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_primary-color"))==null?void 0:s.trim(),t))return t}set primaryColor(t){this.setAttribute(N.PRIMARY_COLOR,`${t}`)}get secondaryColor(){var r,s;let t=this.getAttribute(N.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(s=(r=kt.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_secondary-color"))==null?void 0:s.trim(),t))return t}set secondaryColor(t){this.setAttribute(N.SECONDARY_COLOR,`${t}`)}get accentColor(){var r,s;let t=this.getAttribute(N.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(s=(r=kt.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_accent-color"))==null?void 0:s.trim(),t))return t}set accentColor(t){this.setAttribute(N.ACCENT_COLOR,`${t}`)}get defaultShowRemainingTime(){return this.hasAttribute(N.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(t){t?this.setAttribute(N.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(N.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(N.PLAYBACK_RATES))return this.getAttribute(N.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,r)=>t-r)}set playbackRates(t){if(!t){this.removeAttribute(N.PLAYBACK_RATES);return}this.setAttribute(N.PLAYBACK_RATES,t.join(" "))}get forwardSeekOffset(){var t;return(t=St(this.getAttribute(N.FORWARD_SEEK_OFFSET)))!=null?t:10}set forwardSeekOffset(t){this.setAttribute(N.FORWARD_SEEK_OFFSET,`${t}`)}get backwardSeekOffset(){var t;return(t=St(this.getAttribute(N.BACKWARD_SEEK_OFFSET)))!=null?t:10}set backwardSeekOffset(t){this.setAttribute(N.BACKWARD_SEEK_OFFSET,`${t}`)}get defaultHiddenCaptions(){return this.hasAttribute(N.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(t){t?this.setAttribute(N.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(N.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return St(this.getAttribute(N.DEFAULT_DURATION))}set defaultDuration(t){t==null?this.removeAttribute(N.DEFAULT_DURATION):this.setAttribute(N.DEFAULT_DURATION,`${t}`)}get playerInitTime(){return this.hasAttribute(w.PLAYER_INIT_TIME)?St(this.getAttribute(w.PLAYER_INIT_TIME)):Se(this,ko)}set playerInitTime(t){t!=this.playerInitTime&&(t==null?this.removeAttribute(w.PLAYER_INIT_TIME):this.setAttribute(w.PLAYER_INIT_TIME,`${+t}`))}get playerSoftwareName(){var t;return(t=this.getAttribute(w.PLAYER_SOFTWARE_NAME))!=null?t:B_}get playerSoftwareVersion(){var t;return(t=this.getAttribute(w.PLAYER_SOFTWARE_VERSION))!=null?t:F_}get beaconCollectionDomain(){var t;return(t=this.getAttribute(w.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(w.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(w.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var t;return(t=this.getAttribute(w.MAX_RESOLUTION))!=null?t:void 0}set maxResolution(t){t!==this.maxResolution&&(t?this.setAttribute(w.MAX_RESOLUTION,t):this.removeAttribute(w.MAX_RESOLUTION))}get minResolution(){var t;return(t=this.getAttribute(w.MIN_RESOLUTION))!=null?t:void 0}set minResolution(t){t!==this.minResolution&&(t?this.setAttribute(w.MIN_RESOLUTION,t):this.removeAttribute(w.MIN_RESOLUTION))}get renditionOrder(){var t;return(t=this.getAttribute(w.RENDITION_ORDER))!=null?t:void 0}set renditionOrder(t){t!==this.renditionOrder&&(t?this.setAttribute(w.RENDITION_ORDER,t):this.removeAttribute(w.RENDITION_ORDER))}get programStartTime(){return St(this.getAttribute(w.PROGRAM_START_TIME))}set programStartTime(t){t==null?this.removeAttribute(w.PROGRAM_START_TIME):this.setAttribute(w.PROGRAM_START_TIME,`${t}`)}get programEndTime(){return St(this.getAttribute(w.PROGRAM_END_TIME))}set programEndTime(t){t==null?this.removeAttribute(w.PROGRAM_END_TIME):this.setAttribute(w.PROGRAM_END_TIME,`${t}`)}get assetStartTime(){return St(this.getAttribute(w.ASSET_START_TIME))}set assetStartTime(t){t==null?this.removeAttribute(w.ASSET_START_TIME):this.setAttribute(w.ASSET_START_TIME,`${t}`)}get assetEndTime(){return St(this.getAttribute(w.ASSET_END_TIME))}set assetEndTime(t){t==null?this.removeAttribute(w.ASSET_END_TIME):this.setAttribute(w.ASSET_END_TIME,`${t}`)}get extraSourceParams(){return this.hasAttribute(N.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(N.EXTRA_SOURCE_PARAMS)).entries()].reduce((t,[r,s])=>(t[r]=s,t),{}):_C}set extraSourceParams(t){t==null?this.removeAttribute(N.EXTRA_SOURCE_PARAMS):this.setAttribute(N.EXTRA_SOURCE_PARAMS,new URLSearchParams(t).toString())}get customDomain(){var t;return(t=this.getAttribute(w.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(w.CUSTOM_DOMAIN,t):this.removeAttribute(w.CUSTOM_DOMAIN))}get envKey(){var t;return(t=Us(this,w.ENV_KEY))!=null?t:void 0}set envKey(t){this.setAttribute(w.ENV_KEY,`${t}`)}get noVolumePref(){return this.hasAttribute(N.NO_VOLUME_PREF)}set noVolumePref(t){t?this.setAttribute(N.NO_VOLUME_PREF,""):this.removeAttribute(N.NO_VOLUME_PREF)}get debug(){return Us(this,w.DEBUG)!=null}set debug(t){t?this.setAttribute(w.DEBUG,""):this.removeAttribute(w.DEBUG)}get disableTracking(){return Us(this,w.DISABLE_TRACKING)!=null}set disableTracking(t){this.toggleAttribute(w.DISABLE_TRACKING,!!t)}get disableCookies(){return Us(this,w.DISABLE_COOKIES)!=null}set disableCookies(t){t?this.setAttribute(w.DISABLE_COOKIES,""):this.removeAttribute(w.DISABLE_COOKIES)}get streamType(){var t,r,s;return(s=(r=this.getAttribute(w.STREAM_TYPE))!=null?r:(t=this.media)==null?void 0:t.streamType)!=null?s:Re.UNKNOWN}set streamType(t){this.setAttribute(w.STREAM_TYPE,`${t}`)}get defaultStreamType(){var t,r,s;return(s=(r=this.getAttribute(N.DEFAULT_STREAM_TYPE))!=null?r:(t=this.mediaController)==null?void 0:t.getAttribute(N.DEFAULT_STREAM_TYPE))!=null?s:Re.ON_DEMAND}set defaultStreamType(t){t?this.setAttribute(N.DEFAULT_STREAM_TYPE,t):this.removeAttribute(N.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var t,r;return this.hasAttribute(N.TARGET_LIVE_WINDOW)?+this.getAttribute(N.TARGET_LIVE_WINDOW):(r=(t=this.media)==null?void 0:t.targetLiveWindow)!=null?r:Number.NaN}set targetLiveWindow(t){t==this.targetLiveWindow||Number.isNaN(t)&&Number.isNaN(this.targetLiveWindow)||(t==null?this.removeAttribute(N.TARGET_LIVE_WINDOW):this.setAttribute(N.TARGET_LIVE_WINDOW,`${+t}`))}get liveEdgeStart(){var t;return(t=this.media)==null?void 0:t.liveEdgeStart}get startTime(){return St(Us(this,w.START_TIME))}set startTime(t){this.setAttribute(w.START_TIME,`${t}`)}get preferPlayback(){let t=this.getAttribute(w.PREFER_PLAYBACK);if(t===jt.MSE||t===jt.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===jt.MSE||t===jt.NATIVE?this.setAttribute(w.PREFER_PLAYBACK,t):this.removeAttribute(w.PREFER_PLAYBACK))}get metadata(){var t;return(t=this.media)==null?void 0:t.metadata}set metadata(t){if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...U_(this),...t}}get _hlsConfig(){var t;return(t=this.media)==null?void 0:t._hlsConfig}set _hlsConfig(t){if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=t}async addCuePoints(t){var r;if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(r=this.media)==null?void 0:r.addCuePoints(t)}get activeCuePoint(){var t;return(t=this.media)==null?void 0:t.activeCuePoint}get cuePoints(){var t,r;return(r=(t=this.media)==null?void 0:t.cuePoints)!=null?r:[]}addChapters(t){var r;if(ze(this,we,Dr).call(this),!this.media){Ot("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(r=this.media)==null?void 0:r.addChapters(t)}get activeChapter(){var t;return(t=this.media)==null?void 0:t.activeChapter}get chapters(){var t,r;return(r=(t=this.media)==null?void 0:t.chapters)!=null?r:[]}getStartDate(){var t;return(t=this.media)==null?void 0:t.getStartDate()}get currentPdt(){var t;return(t=this.media)==null?void 0:t.currentPdt}get tokens(){let t=this.getAttribute(N.PLAYBACK_TOKEN),r=this.getAttribute(N.DRM_TOKEN),s=this.getAttribute(N.THUMBNAIL_TOKEN),n=this.getAttribute(N.STORYBOARD_TOKEN);return{...Se(this,wo),...t!=null?{playback:t}:{},...r!=null?{drm:r}:{},...s!=null?{thumbnail:s}:{},...n!=null?{storyboard:n}:{}}}set tokens(t){Bt(this,wo,t!=null?t:{})}get playbackToken(){var t;return(t=this.getAttribute(N.PLAYBACK_TOKEN))!=null?t:void 0}set playbackToken(t){this.setAttribute(N.PLAYBACK_TOKEN,`${t}`)}get drmToken(){var t;return(t=this.getAttribute(N.DRM_TOKEN))!=null?t:void 0}set drmToken(t){this.setAttribute(N.DRM_TOKEN,`${t}`)}get thumbnailToken(){var t;return(t=this.getAttribute(N.THUMBNAIL_TOKEN))!=null?t:void 0}set thumbnailToken(t){this.setAttribute(N.THUMBNAIL_TOKEN,`${t}`)}get storyboardToken(){var t;return(t=this.getAttribute(N.STORYBOARD_TOKEN))!=null?t:void 0}set storyboardToken(t){this.setAttribute(N.STORYBOARD_TOKEN,`${t}`)}addTextTrack(t,r,s,n){var o;let a=(o=this.media)==null?void 0:o.nativeEl;if(a)return iu(a,t,r,s,n)}removeTextTrack(t){var s;let r=(s=this.media)==null?void 0:s.nativeEl;if(r)return Uy(r,t)}get textTracks(){var t;return(t=this.media)==null?void 0:t.textTracks}get castReceiver(){var t;return(t=this.getAttribute(N.CAST_RECEIVER))!=null?t:void 0}set castReceiver(t){t!==this.castReceiver&&(t?this.setAttribute(N.CAST_RECEIVER,t):this.removeAttribute(N.CAST_RECEIVER))}get castCustomData(){var t;return(t=this.media)==null?void 0:t.castCustomData}set castCustomData(t){if(!this.media){Ot("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=t}get noTooltips(){return this.hasAttribute(N.NO_TOOLTIPS)}set noTooltips(t){if(!t){this.removeAttribute(N.NO_TOOLTIPS);return}this.setAttribute(N.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(N.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(t){t?this.setAttribute(N.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(N.PROUDLY_DISPLAY_MUX_BADGE)}};ko=new WeakMap,Lo=new WeakMap,wo=new WeakMap,Cr=new WeakMap,Do=new WeakMap,Bs=new WeakMap,we=new WeakSet,Dr=function(){var t,r,s,n;if(!Se(this,Lo)){Bt(this,Lo,!0),ze(this,we,Fs).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof kt.HTMLElement))throw""}catch{Ot("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ST))throw""}catch{Ot("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof $c))throw""}catch{Ot("<media-controller> failed to upgrade!")}this.init(),ze(this,we,G_).call(this),ze(this,we,K_).call(this),ze(this,we,V_).call(this),Bt(this,Cr,(r=(t=this.mediaController)==null?void 0:t.hasAttribute(ee.USER_INACTIVE))!=null?r:!0),ze(this,we,W_).call(this),(s=this.media)==null||s.addEventListener("streamtypechange",()=>ze(this,we,Fs).call(this)),(n=this.media)==null||n.addEventListener("loadstart",()=>ze(this,we,Fs).call(this))}},H_=function(){var t,r;try{(t=window==null?void 0:window.CSS)==null||t.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(r=window==null?void 0:window.CSS)==null||r.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Mg=function(t){Object.assign(Se(this,Bs),t),ze(this,we,Fs).call(this)},Fs=function(t={}){jT(zT(pC(this,{...Se(this,Bs),...t})),this.shadowRoot)},G_=function(){let t=s=>{var o,l;if(!(s!=null&&s.startsWith("theme-")))return;let n=s.replace(/^theme-/,"");if(Cg.includes(n))return;let a=this.getAttribute(s);a!=null?(o=this.mediaTheme)==null||o.setAttribute(n,a):(l=this.mediaTheme)==null||l.removeAttribute(n)};new MutationObserver(s=>{for(let{attributeName:n}of s)t(n)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(t)},K_=function(){var r;let t=s=>{let{detail:n}=s;if(n instanceof V||(n=new V(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){Oi(n),n.data&&Oi(`${n.name} data:`,n.data);return}let a=Vp(n,!1);a.message&&Dp(a),Ot(n),n.data&&Ot(`${n.name} data:`,n.data),ze(this,we,Mg).call(this,{isDialogOpen:!0})};this.addEventListener("error",t),this.media&&(this.media.errorTranslator=(s={})=>{var a,o,l;if(!(((a=this.media)==null?void 0:a.error)instanceof V))return s;let n=Vp((o=this.media)==null?void 0:o.error,!1);return{player_error_code:(l=this.media)==null?void 0:l.error.code,player_error_message:n.message?String(n.message):s.player_error_message,player_error_context:n.context?String(n.context):s.player_error_context}}),(r=this.media)==null||r.addEventListener("error",s=>{var a,o;let{detail:n}=s;if(!n){let{message:l,code:d}=(o=(a=this.media)==null?void 0:a.error)!=null?o:{};n=new V(l,d)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},V_=function(){var r,s,n,a;let t=()=>ze(this,we,Fs).call(this);(s=(r=this.media)==null?void 0:r.textTracks)==null||s.addEventListener("addtrack",t),(a=(n=this.media)==null?void 0:n.textTracks)==null||a.addEventListener("removetrack",t)},W_=function(){var d,u;if(!/Firefox/i.test(navigator.userAgent))return;let r,s=new WeakMap,n=()=>this.streamType===Re.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,a=(c,h,f=!1)=>{if(n())return;Array.from(c&&c.activeCues||[]).forEach(p=>{if(!(!p.snapToLines||p.line<-5||p.line>=0&&p.line<10))if(!h||this.paused){let g=p.text.split(`
3147
+ `).length,E=-3;this.streamType===Re.LIVE&&(E=-2);let b=E-g;if(p.line===b&&!f)return;s.has(p)||s.set(p,p.line),p.line=b}else setTimeout(()=>{p.line=s.get(p)||"auto"},500)})},o=()=>{var c,h;a(r,(h=(c=this.mediaController)==null?void 0:c.hasAttribute(ee.USER_INACTIVE))!=null?h:!1)},l=()=>{var f,m;let h=Array.from(((m=(f=this.mediaController)==null?void 0:f.media)==null?void 0:m.textTracks)||[]).filter(p=>["subtitles","captions"].includes(p.kind)&&p.mode==="showing")[0];h!==r&&(r==null||r.removeEventListener("cuechange",o)),r=h,r==null||r.addEventListener("cuechange",o),a(r,Se(this,Cr))};l(),(d=this.textTracks)==null||d.addEventListener("change",l),(u=this.textTracks)==null||u.addEventListener("addtrack",l),this.addEventListener("userinactivechange",()=>{var h,f;let c=(f=(h=this.mediaController)==null?void 0:h.hasAttribute(ee.USER_INACTIVE))!=null?f:!0;Se(this,Cr)!==c&&(Bt(this,Cr,c),a(r,Se(this,Cr)))})};function Us(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}kt.customElements.get("mux-player")||(kt.customElements.define("mux-player",Io),kt.MuxPlayerElement=Io);var mF=Io;export{V as MediaError,mF as default,ru as generatePlayerInitTime,Us as getVideoAttribute,B_ as playerSoftwareName,F_ as playerSoftwareVersion};
3122
3148
  /*! Bundled license information:
3123
3149
 
3124
3150
  mux-embed/dist/mux.mjs: