@mux/mux-player 3.4.1 → 3.4.2-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -5,7 +5,7 @@
5
5
  box-sizing: border-box;
6
6
  }
7
7
  </style>
8
- `}var Ti=class extends d.HTMLElement{constructor(){if(super(),eh(this,ve,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[L.MEDIA_CONTROLLER,n.MEDIA_PAUSED]}attributeChangedCallback(e,i,a){var r,o,s,l,u;e===L.MEDIA_CONTROLLER&&(i&&((o=(r=_t(this,ve))==null?void 0:r.unassociateElement)==null||o.call(r,this),Jr(this,ve,null)),a&&this.isConnected&&(Jr(this,ve,(s=this.getRootNode())==null?void 0:s.getElementById(a)),(u=(l=_t(this,ve))==null?void 0:l.associateElement)==null||u.call(l,this)))}connectedCallback(){var e,i,a,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Jr(this,ve,ih(this)),this.getAttribute(L.MEDIA_CONTROLLER)&&((i=(e=_t(this,ve))==null?void 0:e.associateElement)==null||i.call(e,this)),(a=_t(this,ve))==null||a.addEventListener("pointerdown",this),(r=_t(this,ve))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,i,a,r;this.getAttribute(L.MEDIA_CONTROLLER)&&((i=(e=_t(this,ve))==null?void 0:e.unassociateElement)==null||i.call(e,this)),(a=_t(this,ve))==null||a.removeEventListener("pointerdown",this),(r=_t(this,ve))==null||r.removeEventListener("click",this),Jr(this,ve,null)}handleEvent(e){var i;let a=(i=e.composedPath())==null?void 0:i[0];if(["video","media-controller"].includes(a==null?void 0:a.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){let{clientX:o,clientY:s}=e,{left:l,top:u,width:m,height:A}=this.getBoundingClientRect(),g=o-l,f=s-u;if(g<0||f<0||g>m||f>A||m===0&&A===0)return;let{pointerType:v=this._pointerType}=e;if(this._pointerType=void 0,v===es.TOUCH){this.handleTap(e);return}else if(v===es.MOUSE){this.handleMouseClick(e);return}}}}get mediaPaused(){return k(this,n.MEDIA_PAUSED)}set mediaPaused(e){S(this,n.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){let i=this.mediaPaused?p.MEDIA_PLAY_REQUEST:p.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new d.CustomEvent(i,{composed:!0,bubbles:!0}))}};ve=new WeakMap;Ti.shadowRootOptions={mode:"open"};Ti.getTemplateHTML=th;function ih(t){var e;let i=t.getAttribute(L.MEDIA_CONTROLLER);return i?(e=t.getRootNode())==null?void 0:e.getElementById(i):He(t,"media-controller")}d.customElements.get("media-gesture-receiver")||d.customElements.define("media-gesture-receiver",Ti);var jr=Ti;var ds=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},Ie=(t,e,i)=>(ds(t,e,"read from private field"),i?i.call(t):e.get(t)),Se=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Wt=(t,e,i,a)=>(ds(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Le=(t,e,i)=>(ds(t,e,"access private method"),i),io,yi,La,ki,eo,ns,Xd,Ca,to,ss,Jd,ls,jd,wa,ao,ro,us,Si,Ra,y={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function ah(t){return`
8
+ `}var Ti=class extends d.HTMLElement{constructor(){if(super(),eh(this,ve,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[L.MEDIA_CONTROLLER,n.MEDIA_PAUSED]}attributeChangedCallback(e,i,a){var r,o,s,l,u;e===L.MEDIA_CONTROLLER&&(i&&((o=(r=_t(this,ve))==null?void 0:r.unassociateElement)==null||o.call(r,this),Jr(this,ve,null)),a&&this.isConnected&&(Jr(this,ve,(s=this.getRootNode())==null?void 0:s.getElementById(a)),(u=(l=_t(this,ve))==null?void 0:l.associateElement)==null||u.call(l,this)))}connectedCallback(){var e,i,a,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Jr(this,ve,ih(this)),this.getAttribute(L.MEDIA_CONTROLLER)&&((i=(e=_t(this,ve))==null?void 0:e.associateElement)==null||i.call(e,this)),(a=_t(this,ve))==null||a.addEventListener("pointerdown",this),(r=_t(this,ve))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,i,a,r;this.getAttribute(L.MEDIA_CONTROLLER)&&((i=(e=_t(this,ve))==null?void 0:e.unassociateElement)==null||i.call(e,this)),(a=_t(this,ve))==null||a.removeEventListener("pointerdown",this),(r=_t(this,ve))==null||r.removeEventListener("click",this),Jr(this,ve,null)}handleEvent(e){var i;let a=(i=e.composedPath())==null?void 0:i[0];if(["video","media-controller"].includes(a==null?void 0:a.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){let{clientX:o,clientY:s}=e,{left:l,top:u,width:m,height:_}=this.getBoundingClientRect(),g=o-l,f=s-u;if(g<0||f<0||g>m||f>_||m===0&&_===0)return;let{pointerType:v=this._pointerType}=e;if(this._pointerType=void 0,v===es.TOUCH){this.handleTap(e);return}else if(v===es.MOUSE){this.handleMouseClick(e);return}}}}get mediaPaused(){return k(this,n.MEDIA_PAUSED)}set mediaPaused(e){S(this,n.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){let i=this.mediaPaused?p.MEDIA_PLAY_REQUEST:p.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new d.CustomEvent(i,{composed:!0,bubbles:!0}))}};ve=new WeakMap;Ti.shadowRootOptions={mode:"open"};Ti.getTemplateHTML=th;function ih(t){var e;let i=t.getAttribute(L.MEDIA_CONTROLLER);return i?(e=t.getRootNode())==null?void 0:e.getElementById(i):He(t,"media-controller")}d.customElements.get("media-gesture-receiver")||d.customElements.define("media-gesture-receiver",Ti);var jr=Ti;var ds=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},Ie=(t,e,i)=>(ds(t,e,"read from private field"),i?i.call(t):e.get(t)),Se=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Wt=(t,e,i,a)=>(ds(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Le=(t,e,i)=>(ds(t,e,"access private method"),i),io,yi,La,ki,eo,ns,Xd,Ca,to,ss,Jd,ls,jd,wa,ao,ro,us,Si,Ra,y={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function ah(t){return`
9
9
  <style>
10
10
 
11
11
  :host([${n.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) {
@@ -155,7 +155,7 @@
155
155
  <slot part="bottom chrome"></slot>
156
156
  </span>
157
157
  <slot name="dialog" part="layer dialog-layer"></slot>
158
- `}var rh=Object.values(n),oh="sm:384 md:576 lg:768 xl:960";function nh(t){eu(t.target,t.contentRect.width)}function eu(t,e){var i;if(!t.isConnected)return;let a=(i=t.getAttribute(y.BREAKPOINTS))!=null?i:oh,r=sh(a),o=lh(r,e),s=!1;if(Object.keys(r).forEach(l=>{if(o.includes(l)){t.hasAttribute(`breakpoint${l}`)||(t.setAttribute(`breakpoint${l}`,""),s=!0);return}t.hasAttribute(`breakpoint${l}`)&&(t.removeAttribute(`breakpoint${l}`),s=!0)}),s){let l=new CustomEvent(Ce.BREAKPOINTS_CHANGE,{detail:o});t.dispatchEvent(l)}t.breakpointsComputed||(t.breakpointsComputed=!0,t.dispatchEvent(new CustomEvent(Ce.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function sh(t){let e=t.split(/\s+/);return Object.fromEntries(e.map(i=>i.split(":")))}function lh(t,e){return Object.keys(t).filter(i=>e>=parseInt(t[i]))}var Ft=class extends d.HTMLElement{constructor(){if(super(),Se(this,ns),Se(this,ss),Se(this,ls),Se(this,wa),Se(this,ro),Se(this,Si),Se(this,io,0),Se(this,yi,null),Se(this,La,null),Se(this,ki,void 0),this.breakpointsComputed=!1,Se(this,eo,new MutationObserver(Le(this,ns,Xd).bind(this))),Se(this,Ca,!1),Se(this,to,i=>{Ie(this,Ca)||(setTimeout(()=>{nh(i),Wt(this,Ca,!1)},0),Wt(this,Ca,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Y(this.attributes),a=this.constructor.getTemplateHTML(i);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(a):this.shadowRoot.innerHTML=a}let e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){Ie(this,yi)&&this.mediaUnsetCallback(Ie(this,yi));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[y.AUTOHIDE,y.GESTURES_DISABLED].concat(rh).filter(e=>![n.MEDIA_RENDITION_LIST,n.MEDIA_AUDIO_TRACK_LIST,n.MEDIA_CHAPTERS_CUES,n.MEDIA_WIDTH,n.MEDIA_HEIGHT,n.MEDIA_ERROR,n.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,i,a){e.toLowerCase()==y.AUTOHIDE&&(this.autohide=a)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(Wt(this,yi,e),e.localName.includes("-")&&await d.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Ie(this,eo).observe(this,{childList:!0,subtree:!0}),st(this,Ie(this,to));let a=this.getAttribute(y.AUDIO)!=null?h("audio player"):h("video player");this.setAttribute("role","region"),this.setAttribute("aria-label",a),this.handleMediaUpdated(this.media),this.setAttribute(y.USER_INACTIVE,""),eu(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=d.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Ie(this,eo).disconnect(),lt(this,Ie(this,to)),this.media&&this.mediaUnsetCallback(this.media),(e=d.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){Wt(this,yi,null)}handleEvent(e){switch(e.type){case"pointerdown":Wt(this,io,e.timeStamp);break;case"pointermove":Le(this,ss,Jd).call(this,e);break;case"pointerup":Le(this,ls,jd).call(this,e);break;case"mouseleave":Le(this,wa,ao).call(this);break;case"mouseup":this.removeAttribute(y.KEYBOARD_CONTROL);break;case"keyup":Le(this,Si,Ra).call(this),this.setAttribute(y.KEYBOARD_CONTROL,"");break}}set autohide(e){let i=Number(e);Wt(this,ki,isNaN(i)?0:i)}get autohide(){return(Ie(this,ki)===void 0?2:Ie(this,ki)).toString()}get breakpoints(){return I(this,y.BREAKPOINTS)}set breakpoints(e){M(this,y.BREAKPOINTS,e)}get audio(){return k(this,y.AUDIO)}set audio(e){S(this,y.AUDIO,e)}get gesturesDisabled(){return k(this,y.GESTURES_DISABLED)}set gesturesDisabled(e){S(this,y.GESTURES_DISABLED,e)}get keyboardControl(){return k(this,y.KEYBOARD_CONTROL)}set keyboardControl(e){S(this,y.KEYBOARD_CONTROL,e)}get noAutohide(){return k(this,y.NO_AUTOHIDE)}set noAutohide(e){S(this,y.NO_AUTOHIDE,e)}get autohideOverControls(){return k(this,y.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){S(this,y.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return k(this,y.USER_INACTIVE)}set userInteractive(e){S(this,y.USER_INACTIVE,e)}};io=new WeakMap;yi=new WeakMap;La=new WeakMap;ki=new WeakMap;eo=new WeakMap;ns=new WeakSet;Xd=function(t){let e=this.media;for(let i of t){if(i.type!=="childList")continue;let a=i.removedNodes;for(let r of a){if(r.slot!="media"||i.target!=this)continue;let o=i.previousSibling&&i.previousSibling.previousElementSibling;if(!o||!e)this.mediaUnsetCallback(r);else{let s=o.slot!=="media";for(;(o=o.previousSibling)!==null;)o.slot=="media"&&(s=!1);s&&this.mediaUnsetCallback(r)}}if(e)for(let r of i.addedNodes)r===e&&this.handleMediaUpdated(e)}};Ca=new WeakMap;to=new WeakMap;ss=new WeakSet;Jd=function(t){if(t.pointerType!=="mouse"&&t.timeStamp-Ie(this,io)<250)return;Le(this,ro,us).call(this),clearTimeout(Ie(this,La));let e=this.hasAttribute(y.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(t.target)||e)&&Le(this,Si,Ra).call(this)};ls=new WeakSet;jd=function(t){if(t.pointerType==="touch"){let e=!this.hasAttribute(y.USER_INACTIVE);[this,this.media].includes(t.target)&&e?Le(this,wa,ao).call(this):Le(this,Si,Ra).call(this)}else t.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e==null?void 0:e.localName))&&Le(this,Si,Ra).call(this)};wa=new WeakSet;ao=function(){if(Ie(this,ki)<0||this.hasAttribute(y.USER_INACTIVE))return;this.setAttribute(y.USER_INACTIVE,"");let t=new d.CustomEvent(Ce.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(t)};ro=new WeakSet;us=function(){if(!this.hasAttribute(y.USER_INACTIVE))return;this.removeAttribute(y.USER_INACTIVE);let t=new d.CustomEvent(Ce.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(t)};Si=new WeakSet;Ra=function(){Le(this,ro,us).call(this),clearTimeout(Ie(this,La));let t=parseInt(this.autohide);t<0||Wt(this,La,setTimeout(()=>{Le(this,wa,ao).call(this)},t*1e3))};Ft.shadowRootOptions={mode:"open"};Ft.getTemplateHTML=ah;d.customElements.get("media-container")||d.customElements.define("media-container",Ft);var tu=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},ie=(t,e,i)=>(tu(t,e,"read from private field"),i?i.call(t):e.get(t)),xa=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},oo=(t,e,i,a)=>(tu(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Ii,Mi,no,Vt,dt,At,Tt=class{constructor(e,i,{defaultValue:a}={defaultValue:void 0}){xa(this,dt),xa(this,Ii,void 0),xa(this,Mi,void 0),xa(this,no,void 0),xa(this,Vt,new Set),oo(this,Ii,e),oo(this,Mi,i),oo(this,no,new Set(a))}[Symbol.iterator](){return ie(this,dt,At).values()}get length(){return ie(this,dt,At).size}get value(){var e;return(e=[...ie(this,dt,At)].join(" "))!=null?e:""}set value(e){var i;e!==this.value&&(oo(this,Vt,new Set),this.add(...(i=e==null?void 0:e.split(" "))!=null?i:[]))}toString(){return this.value}item(e){return[...ie(this,dt,At)][e]}values(){return ie(this,dt,At).values()}forEach(e,i){ie(this,dt,At).forEach(e,i)}add(...e){var i,a;e.forEach(r=>ie(this,Vt).add(r)),!(this.value===""&&!((i=ie(this,Ii))!=null&&i.hasAttribute(`${ie(this,Mi)}`)))&&((a=ie(this,Ii))==null||a.setAttribute(`${ie(this,Mi)}`,`${this.value}`))}remove(...e){var i;e.forEach(a=>ie(this,Vt).delete(a)),(i=ie(this,Ii))==null||i.setAttribute(`${ie(this,Mi)}`,`${this.value}`)}contains(e){return ie(this,dt,At).has(e)}toggle(e,i){return typeof i!="undefined"?i?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,i){return this.remove(e),this.add(i),e===i}};Ii=new WeakMap;Mi=new WeakMap;no=new WeakMap;Vt=new WeakMap;dt=new WeakSet;At=function(){return ie(this,Vt).size?ie(this,Vt):ie(this,no)};var dh=(t="")=>t.split(/\s+/),iu=(t="")=>{let[e,i,a]=t.split(":"),r=a?decodeURIComponent(a):void 0;return{kind:e==="cc"?fe.CAPTIONS:fe.SUBTITLES,language:i,label:r}},Kt=(t="",e={})=>dh(t).map(i=>{let a=iu(i);return{...e,...a}}),cs=t=>t?Array.isArray(t)?t.map(e=>typeof e=="string"?iu(e):e):typeof t=="string"?Kt(t):[t]:[],so=({kind:t,label:e,language:i}={kind:"subtitles"})=>e?`${t==="captions"?"cc":"sb"}:${i}:${encodeURIComponent(e)}`:i,ut=(t=[])=>Array.prototype.map.call(t,so).join(" "),uh=(t,e)=>i=>i[t]===e,au=t=>{let e=Object.entries(t).map(([i,a])=>uh(i,a));return i=>e.every(a=>a(i))},Gt=(t,e=[],i=[])=>{let a=cs(i).map(au),r=o=>a.some(s=>s(o));Array.from(e).filter(r).forEach(o=>{o.mode=t})},Yt=(t,e=()=>!0)=>{if(!(t!=null&&t.textTracks))return[];let i=typeof e=="function"?e:au(e);return Array.from(t.textTracks).filter(i)},lo=t=>{var e;return!!((e=t.mediaSubtitlesShowing)!=null&&e.length)||t.hasAttribute(n.MEDIA_SUBTITLES_SHOWING)};var ou=t=>{var e;let{media:i,fullscreenElement:a}=t;try{let r=a&&"requestFullscreen"in a?"requestFullscreen":a&&"webkitRequestFullScreen"in a?"webkitRequestFullScreen":void 0;if(r){let o=(e=a[r])==null?void 0:e.call(a);if(o instanceof Promise)return o.catch(()=>{})}else i!=null&&i.webkitEnterFullscreen?i.webkitEnterFullscreen():i!=null&&i.requestFullscreen&&i.requestFullscreen()}catch(r){console.error(r)}},ru="exitFullscreen"in V?"exitFullscreen":"webkitExitFullscreen"in V?"webkitExitFullscreen":"webkitCancelFullScreen"in V?"webkitCancelFullScreen":void 0,nu=t=>{var e;let{documentElement:i}=t;if(ru){let a=(e=i==null?void 0:i[ru])==null?void 0:e.call(i);if(a instanceof Promise)return a.catch(()=>{})}},Da="fullscreenElement"in V?"fullscreenElement":"webkitFullscreenElement"in V?"webkitFullscreenElement":void 0,ch=t=>{let{documentElement:e,media:i}=t,a=e==null?void 0:e[Da];return!a&&"webkitDisplayingFullscreen"in i&&"webkitPresentationMode"in i&&i.webkitDisplayingFullscreen&&i.webkitPresentationMode===Od.FULLSCREEN?i:a},su=t=>{var e;let{media:i,documentElement:a,fullscreenElement:r=i}=t;if(!i||!a)return!1;let o=ch(t);if(!o)return!1;if(o===r||o===i)return!0;if(o.localName.includes("-")){let s=o.shadowRoot;if(!(Da in s))return ue(o,r);for(;s!=null&&s[Da];){if(s[Da]===r)return!0;s=(e=s[Da])==null?void 0:e.shadowRoot}}return!1},mh="fullscreenEnabled"in V?"fullscreenEnabled":"webkitFullscreenEnabled"in V?"webkitFullscreenEnabled":void 0,lu=t=>{let{documentElement:e,media:i}=t;return!!(e!=null&&e[mh])||i&&"webkitSupportsFullscreen"in i};var uo,ms=()=>{var t,e;return uo||(uo=(e=(t=V)==null?void 0:t.createElement)==null?void 0:e.call(t,"video"),uo)},du=async(t=ms())=>{if(!t)return!1;let e=t.volume;t.volume=e/2+.1;let i=new AbortController,a=await Promise.race([hh(t,i.signal),ph(t,e)]);return i.abort(),a},hh=(t,e)=>new Promise(i=>{t.addEventListener("volumechange",()=>i(!0),{signal:e})}),ph=async(t,e)=>{for(let i=0;i<10;i++){if(t.volume===e)return!1;await Kr(10)}return t.volume!==e},fh=/.*Version\/.*Safari\/.*/.test(d.navigator.userAgent),hs=(t=ms())=>d.matchMedia("(display-mode: standalone)").matches&&fh?!1:typeof(t==null?void 0:t.requestPictureInPicture)=="function",ps=(t=ms())=>lu({documentElement:V,media:t}),uu=ps(),cu=hs(),mu=!!d.WebKitPlaybackTargetAvailabilityEvent,hu=!!d.chrome;var Ci=t=>Yt(t.media,e=>[fe.SUBTITLES,fe.CAPTIONS].includes(e.kind)).sort((e,i)=>e.kind>=i.kind?1:-1),fs=t=>Yt(t.media,e=>e.mode===gt.SHOWING&&[fe.SUBTITLES,fe.CAPTIONS].includes(e.kind)),co=(t,e)=>{let i=Ci(t),a=fs(t),r=!!a.length;if(i.length){if(e===!1||r&&e!==!0)Gt(gt.DISABLED,i,a);else if(e===!0||!r&&e!==!1){let o=i[0],{options:s}=t;if(!(s!=null&&s.noSubtitlesLangPref)){let A=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),g=A?[A,...globalThis.navigator.languages]:globalThis.navigator.languages,f=i.filter(v=>g.some(N=>v.language.toLowerCase().startsWith(N.split("-")[0]))).sort((v,N)=>{let T=g.findIndex(P=>v.language.toLowerCase().startsWith(P.split("-")[0])),C=g.findIndex(P=>N.language.toLowerCase().startsWith(P.split("-")[0]));return T-C});f[0]&&(o=f[0])}let{language:l,label:u,kind:m}=o;Gt(gt.DISABLED,i,a),Gt(gt.SHOWING,i,[{language:l,label:u,kind:m}])}}},mo=(t,e)=>t===e?!0:t==null||e==null||typeof t!=typeof e?!1:typeof t=="number"&&Number.isNaN(t)&&Number.isNaN(e)?!0:typeof t!="object"?!1:Array.isArray(t)?vh(t,e):Object.entries(t).every(([i,a])=>i in e&&mo(a,e[i])),vh=(t,e)=>{let i=Array.isArray(t),a=Array.isArray(e);return i!==a?!1:i||a?t.length!==e.length?!1:t.every((r,o)=>mo(r,e[o])):!0};var Eh=Object.values(xe),ho,bh=du().then(t=>(ho=t,ho)),pu=async(...t)=>{await Promise.all(t.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof d.HTMLElement))return;let i=e.localName;if(!i.includes("-"))return;let a=d.customElements.get(i);a&&e instanceof a||(await d.customElements.whenDefined(i),d.customElements.upgrade(e))}))},gh=new d.DOMParser,_h=t=>t&&(gh.parseFromString(t,"text/html").body.textContent||t),Li={mediaError:{get(t,e){let{media:i}=t;if((e==null?void 0:e.type)!=="playing")return i==null?void 0:i.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(t,e){var i;let{media:a}=t;if((e==null?void 0:e.type)!=="playing")return(i=a==null?void 0:a.error)==null?void 0:i.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(t,e){var i,a;let{media:r}=t;if((e==null?void 0:e.type)!=="playing")return(a=(i=r==null?void 0:r.error)==null?void 0:i.message)!=null?a:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.paused)!=null?e:!0},set(t,e){var i;let{media:a}=e;a&&(t?a.pause():(i=a.play())==null||i.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(t,e){let{media:i}=t;return i?e?e.type==="playing":!i.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.playbackRate)!=null?e:1},set(t,e){let{media:i}=e;i&&Number.isFinite(+t)&&(i.playbackRate=+t)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.muted)!=null?e:!1},set(t,e){let{media:i}=e;if(i){try{d.localStorage.setItem("media-chrome-pref-muted",t?"true":"false")}catch(a){console.debug("Error setting muted pref",a)}i.muted=t}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(t,e)=>{let{options:{noMutedPref:i}}=e,{media:a}=e;if(!(!a||a.muted||i))try{let r=d.localStorage.getItem("media-chrome-pref-muted")==="true";Li.mediaMuted.set(r,e),t(r)}catch(r){console.debug("Error getting muted pref",r)}}]},mediaVolume:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.volume)!=null?e:1},set(t,e){let{media:i}=e;if(i){try{t==null?d.localStorage.removeItem("media-chrome-pref-volume"):d.localStorage.setItem("media-chrome-pref-volume",t.toString())}catch(a){console.debug("Error setting volume pref",a)}Number.isFinite(+t)&&(i.volume=+t)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(t,e)=>{let{options:{noVolumePref:i}}=e;if(!i)try{let{media:a}=e;if(!a)return;let r=d.localStorage.getItem("media-chrome-pref-volume");if(r==null)return;Li.mediaVolume.set(+r,e),t(+r)}catch(a){console.debug("Error getting volume pref",a)}}]},mediaVolumeLevel:{get(t){let{media:e}=t;return typeof(e==null?void 0:e.volume)=="undefined"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.currentTime)!=null?e:0},set(t,e){let{media:i}=e;!i||!Ai(t)||(i.currentTime=t)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(t){let{media:e,options:{defaultDuration:i}={}}=t;return i&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?i:Number.isFinite(e==null?void 0:e.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(t){let{media:e}=t;return(e==null?void 0:e.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(t){var e;let{media:i}=t;if(!((e=i==null?void 0:i.seekable)!=null&&e.length))return;let a=i.seekable.start(0),r=i.seekable.end(i.seekable.length-1);if(!(!a&&!r))return[Number(a.toFixed(3)),Number(r.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(t){var e;let{media:i}=t,a=(e=i==null?void 0:i.buffered)!=null?e:[];return Array.from(a).map((r,o)=>[Number(a.start(o).toFixed(3)),Number(a.end(o).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(t){let{media:e,options:{defaultStreamType:i}={}}=t,a=[xe.LIVE,xe.ON_DEMAND].includes(i)?i:void 0;if(!e)return a;let{streamType:r}=e;if(Eh.includes(r))return r===xe.UNKNOWN?a:r;let o=e.duration;return o===1/0?xe.LIVE:Number.isFinite(o)?xe.ON_DEMAND:a},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(t){let{media:e}=t;if(!e)return Number.NaN;let{targetLiveWindow:i}=e,a=Li.mediaStreamType.get(t);return(i==null||Number.isNaN(i))&&a===xe.LIVE?0:i},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(t){let{media:e,options:{liveEdgeOffset:i=10}={}}=t;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(Li.mediaStreamType.get(t)===xe.LIVE))return!1;let r=e.seekable;if(!r)return!0;if(!r.length)return!1;let o=r.end(r.length-1)-i;return e.currentTime>=o},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(t){return Ci(t).map(({kind:e,label:i,language:a})=>({kind:e,label:i,language:a}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(t){return fs(t).map(({kind:e,label:i,language:a})=>({kind:e,label:i,language:a}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(t,e)=>{var i,a;let{media:r,options:o}=e;if(!r)return;let s=l=>{var u;!o.defaultSubtitles||l&&![fe.CAPTIONS,fe.SUBTITLES].includes((u=l==null?void 0:l.track)==null?void 0:u.kind)||co(e,!0)};return r.addEventListener("loadstart",s),(i=r.textTracks)==null||i.addEventListener("addtrack",s),(a=r.textTracks)==null||a.addEventListener("removetrack",s),()=>{var l,u;r.removeEventListener("loadstart",s),(l=r.textTracks)==null||l.removeEventListener("addtrack",s),(u=r.textTracks)==null||u.removeEventListener("removetrack",s)}}]},mediaChaptersCues:{get(t){var e;let{media:i}=t;if(!i)return[];let[a]=Yt(i,{kind:fe.CHAPTERS});return Array.from((e=a==null?void 0:a.cues)!=null?e:[]).map(({text:r,startTime:o,endTime:s})=>({text:_h(r),startTime:o,endTime:s}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(t,e)=>{var i;let{media:a}=e;if(!a)return;let r=a.querySelector('track[kind="chapters"][default][src]'),o=(i=a.shadowRoot)==null?void 0:i.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return r==null||r.addEventListener("load",t),o==null||o.addEventListener("load",t),()=>{r==null||r.removeEventListener("load",t),o==null||o.removeEventListener("load",t)}}]},mediaIsPip:{get(t){var e,i;let{media:a,documentElement:r}=t;if(!a||!r||!r.pictureInPictureElement)return!1;if(r.pictureInPictureElement===a)return!0;if(r.pictureInPictureElement instanceof HTMLMediaElement)return(e=a.localName)!=null&&e.includes("-")?ue(a,r.pictureInPictureElement):!1;if(r.pictureInPictureElement.localName.includes("-")){let o=r.pictureInPictureElement.shadowRoot;for(;o!=null&&o.pictureInPictureElement;){if(o.pictureInPictureElement===a)return!0;o=(i=o.pictureInPictureElement)==null?void 0:i.shadowRoot}}return!1},set(t,e){let{media:i}=e;if(i)if(t){if(!V.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!i.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}let a=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};i.requestPictureInPicture().catch(r=>{if(r.code===11){if(!i.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(i.readyState===0&&i.preload==="none"){let o=()=>{i.removeEventListener("loadedmetadata",s),i.preload="none"},s=()=>{i.requestPictureInPicture().catch(a),o()};i.addEventListener("loadedmetadata",s),i.preload="metadata",setTimeout(()=>{i.readyState===0&&a(),o()},1e3)}else throw r}else throw r})}else V.pictureInPictureElement&&V.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(t){var e;let{media:i}=t;return[...(e=i==null?void 0:i.videoRenditions)!=null?e:[]].map(a=>({...a}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(t){var e,i,a;let{media:r}=t;return(a=(i=r==null?void 0:r.videoRenditions)==null?void 0:i[(e=r.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:a.id},set(t,e){let{media:i}=e;if(!(i!=null&&i.videoRenditions)){console.warn("MediaController: Rendition selection not supported by this media.");return}let a=t,r=Array.prototype.findIndex.call(i.videoRenditions,o=>o.id==a);i.videoRenditions.selectedIndex!=r&&(i.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(t){var e;let{media:i}=t;return[...(e=i==null?void 0:i.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(t){var e,i;let{media:a}=t;return(i=[...(e=a==null?void 0:a.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:i.id},set(t,e){let{media:i}=e;if(!(i!=null&&i.audioTracks)){console.warn("MediaChrome: Audio track selection not supported by this media.");return}let a=t;for(let r of i.audioTracks)r.enabled=a==r.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(t){return su(t)},set(t,e){t?ou(e):nu(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(t){var e;let{media:i}=t;return!(i!=null&&i.remote)||((e=i.remote)==null?void 0:e.state)==="disconnected"?!1:!!i.remote.state},set(t,e){var i,a;let{media:r}=e;if(r&&!(t&&((i=r.remote)==null?void 0:i.state)!=="disconnected")&&!(!t&&((a=r.remote)==null?void 0:a.state)!=="connected")){if(typeof r.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}r.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(t,e){let{media:i}=e;if(i){if(!(i.webkitShowPlaybackTargetPicker&&d.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}i.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(t){let{media:e}=t;if(!uu||!ps(e))return ke.UNSUPPORTED}},mediaPipUnavailable:{get(t){let{media:e}=t;if(!cu||!hs(e))return ke.UNSUPPORTED}},mediaVolumeUnavailable:{get(t){let{media:e}=t;if(ho===!1||(e==null?void 0:e.volume)==null)return ke.UNSUPPORTED},stateOwnersUpdateHandlers:[t=>{ho==null&&bh.then(e=>t(e?void 0:ke.UNSUPPORTED))}]},mediaCastUnavailable:{get(t,{availability:e="not-available"}={}){var i;let{media:a}=t;if(!hu||!((i=a==null?void 0:a.remote)!=null&&i.state))return ke.UNSUPPORTED;if(!(e==null||e==="available"))return ke.UNAVAILABLE},stateOwnersUpdateHandlers:[(t,e)=>{var i;let{media:a}=e;return a?(a.disableRemotePlayback||a.hasAttribute("disableremoteplayback")||(i=a==null?void 0:a.remote)==null||i.watchAvailability(o=>{t({availability:o?"available":"not-available"})}).catch(o=>{o.name==="NotSupportedError"?t({availability:null}):t({availability:"not-available"})}),()=>{var o;(o=a==null?void 0:a.remote)==null||o.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(t,e){if(!mu)return ke.UNSUPPORTED;if((e==null?void 0:e.availability)==="not-available")return ke.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(t,e)=>{var i;let{media:a}=e;return a?(a.disableRemotePlayback||a.hasAttribute("disableremoteplayback")||(i=a==null?void 0:a.remote)==null||i.watchAvailability(o=>{t({availability:o?"available":"not-available"})}).catch(o=>{o.name==="NotSupportedError"?t({availability:null}):t({availability:"not-available"})}),()=>{var o;(o=a==null?void 0:a.remote)==null||o.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(t){var e;let{media:i}=t;if(!(i!=null&&i.videoRenditions))return ke.UNSUPPORTED;if(!((e=i.videoRenditions)!=null&&e.length))return ke.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(t){var e,i;let{media:a}=t;if(!(a!=null&&a.audioTracks))return ke.UNSUPPORTED;if(((i=(e=a.audioTracks)==null?void 0:e.length)!=null?i:0)<=1)return ke.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]}};var fu={[p.MEDIA_PREVIEW_REQUEST](t,e,{detail:i}){var a,r,o;let{media:s}=e,l=i!=null?i:void 0,u,m;if(s&&l!=null){let[v]=Yt(s,{kind:fe.METADATA,label:"thumbnails"}),N=Array.prototype.find.call((a=v==null?void 0:v.cues)!=null?a:[],(T,C,P)=>C===0?T.endTime>l:C===P.length-1?T.startTime<=l:T.startTime<=l&&T.endTime>l);if(N){let T=/'^(?:[a-z]+:)?\/\//i.test(N.text)||(r=s==null?void 0:s.querySelector('track[label="thumbnails"]'))==null?void 0:r.src,C=new URL(N.text,T);m=new URLSearchParams(C.hash).get("#xywh").split(",").map(j=>+j),u=C.href}}let A=t.mediaDuration.get(e),f=(o=t.mediaChaptersCues.get(e).find((v,N,T)=>N===T.length-1&&A===v.endTime?v.startTime<=l&&v.endTime>=l:v.startTime<=l&&v.endTime>l))==null?void 0:o.text;return i!=null&&f==null&&(f=""),{mediaPreviewTime:l,mediaPreviewImage:u,mediaPreviewCoords:m,mediaPreviewChapter:f}},[p.MEDIA_PAUSE_REQUEST](t,e){t["mediaPaused"].set(!0,e)},[p.MEDIA_PLAY_REQUEST](t,e){var i,a,r,o;let s="mediaPaused",u=t.mediaStreamType.get(e)===xe.LIVE,m=!((i=e.options)!=null&&i.noAutoSeekToLive),A=t.mediaTargetLiveWindow.get(e)>0;if(u&&m&&!A){let g=(a=t.mediaSeekable.get(e))==null?void 0:a[1];if(g){let f=(o=(r=e.options)==null?void 0:r.seekToLiveOffset)!=null?o:0,v=g-f;t.mediaCurrentTime.set(v,e)}}t[s].set(!1,e)},[p.MEDIA_PLAYBACK_RATE_REQUEST](t,e,{detail:i}){let a="mediaPlaybackRate",r=i;t[a].set(r,e)},[p.MEDIA_MUTE_REQUEST](t,e){t["mediaMuted"].set(!0,e)},[p.MEDIA_UNMUTE_REQUEST](t,e){let i="mediaMuted";t.mediaVolume.get(e)||t.mediaVolume.set(.25,e),t[i].set(!1,e)},[p.MEDIA_VOLUME_REQUEST](t,e,{detail:i}){let a="mediaVolume",r=i;r&&t.mediaMuted.get(e)&&t.mediaMuted.set(!1,e),t[a].set(r,e)},[p.MEDIA_SEEK_REQUEST](t,e,{detail:i}){let a="mediaCurrentTime",r=i;t[a].set(r,e)},[p.MEDIA_SEEK_TO_LIVE_REQUEST](t,e){var i,a,r;let o="mediaCurrentTime",s=(i=t.mediaSeekable.get(e))==null?void 0:i[1];if(Number.isNaN(Number(s)))return;let l=(r=(a=e.options)==null?void 0:a.seekToLiveOffset)!=null?r:0,u=s-l;t[o].set(u,e)},[p.MEDIA_SHOW_SUBTITLES_REQUEST](t,e,{detail:i}){var a;let{options:r}=e,o=Ci(e),s=cs(i),l=(a=s[0])==null?void 0:a.language;l&&!r.noSubtitlesLangPref&&d.localStorage.setItem("media-chrome-pref-subtitles-lang",l),Gt(gt.SHOWING,o,s)},[p.MEDIA_DISABLE_SUBTITLES_REQUEST](t,e,{detail:i}){let a=Ci(e),r=i!=null?i:[];Gt(gt.DISABLED,a,r)},[p.MEDIA_TOGGLE_SUBTITLES_REQUEST](t,e,{detail:i}){co(e,i)},[p.MEDIA_RENDITION_REQUEST](t,e,{detail:i}){let a="mediaRenditionSelected",r=i;t[a].set(r,e)},[p.MEDIA_AUDIO_TRACK_REQUEST](t,e,{detail:i}){let a="mediaAudioTrackEnabled",r=i;t[a].set(r,e)},[p.MEDIA_ENTER_PIP_REQUEST](t,e){let i="mediaIsPip";t.mediaIsFullscreen.get(e)&&t.mediaIsFullscreen.set(!1,e),t[i].set(!0,e)},[p.MEDIA_EXIT_PIP_REQUEST](t,e){t["mediaIsPip"].set(!1,e)},[p.MEDIA_ENTER_FULLSCREEN_REQUEST](t,e){let i="mediaIsFullscreen";t.mediaIsPip.get(e)&&t.mediaIsPip.set(!1,e),t[i].set(!0,e)},[p.MEDIA_EXIT_FULLSCREEN_REQUEST](t,e){t["mediaIsFullscreen"].set(!1,e)},[p.MEDIA_ENTER_CAST_REQUEST](t,e){let i="mediaIsCasting";t.mediaIsFullscreen.get(e)&&t.mediaIsFullscreen.set(!1,e),t[i].set(!0,e)},[p.MEDIA_EXIT_CAST_REQUEST](t,e){t["mediaIsCasting"].set(!1,e)},[p.MEDIA_AIRPLAY_REQUEST](t,e){t["mediaIsAirplaying"].set(!0,e)}};var vu=({media:t,fullscreenElement:e,documentElement:i,stateMediator:a=Li,requestMap:r=fu,options:o={},monitorStateOwnersOnlyWithSubscriptions:s=!0})=>{let l=[],u={options:{...o}},m=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0}),A=T=>{T!=null&&(mo(T,m)||(m=Object.freeze({...m,...T}),l.forEach(C=>C(m))))},g=()=>{let T=Object.entries(a).reduce((C,[P,{get:j}])=>(C[P]=j(u),C),{});A(T)},f={},v,N=async(T,C)=>{var P,j,_e,bt,ot,ca,ma,ha,pa,fa,va,Ea,ba,ga,_a,Aa;let Wr=!!v;if(v={...u,...v!=null?v:{},...T},Wr)return;await pu(...Object.values(T));let nt=l.length>0&&C===0&&s,Ta=u.media!==v.media,ld=((P=u.media)==null?void 0:P.textTracks)!==((j=v.media)==null?void 0:j.textTracks),dd=((_e=u.media)==null?void 0:_e.videoRenditions)!==((bt=v.media)==null?void 0:bt.videoRenditions),ud=((ot=u.media)==null?void 0:ot.audioTracks)!==((ca=v.media)==null?void 0:ca.audioTracks),cd=((ma=u.media)==null?void 0:ma.remote)!==((ha=v.media)==null?void 0:ha.remote),md=u.documentElement!==v.documentElement,hd=!!u.media&&(Ta||nt),pd=!!((pa=u.media)!=null&&pa.textTracks)&&(ld||nt),fd=!!((fa=u.media)!=null&&fa.videoRenditions)&&(dd||nt),vd=!!((va=u.media)!=null&&va.audioTracks)&&(ud||nt),Ed=!!((Ea=u.media)!=null&&Ea.remote)&&(cd||nt),bd=!!u.documentElement&&(md||nt),gd=hd||pd||fd||vd||Ed||bd,bi=l.length===0&&C===1&&s,_d=!!v.media&&(Ta||bi),Ad=!!((ba=v.media)!=null&&ba.textTracks)&&(ld||bi),Td=!!((ga=v.media)!=null&&ga.videoRenditions)&&(dd||bi),yd=!!((_a=v.media)!=null&&_a.audioTracks)&&(ud||bi),kd=!!((Aa=v.media)!=null&&Aa.remote)&&(cd||bi),Sd=!!v.documentElement&&(md||bi),Id=_d||Ad||Td||yd||kd||Sd;if(!(gd||Id)){Object.entries(v).forEach(([F,ya])=>{u[F]=ya}),g(),v=void 0;return}Object.entries(a).forEach(([F,{get:ya,mediaEvents:Im=[],textTracksEvents:Mm=[],videoRenditionsEvents:Cm=[],audioTracksEvents:Lm=[],remoteEvents:wm=[],rootEvents:Rm=[],stateOwnersUpdateHandlers:xm=[]}])=>{f[F]||(f[F]={});let Ae=Q=>{let Te=ya(u,Q);A({[F]:Te})},te;te=f[F].mediaEvents,Im.forEach(Q=>{te&&hd&&(u.media.removeEventListener(Q,te),f[F].mediaEvents=void 0),_d&&(v.media.addEventListener(Q,Ae),f[F].mediaEvents=Ae)}),te=f[F].textTracksEvents,Mm.forEach(Q=>{var Te,Re;te&&pd&&((Te=u.media.textTracks)==null||Te.removeEventListener(Q,te),f[F].textTracksEvents=void 0),Ad&&((Re=v.media.textTracks)==null||Re.addEventListener(Q,Ae),f[F].textTracksEvents=Ae)}),te=f[F].videoRenditionsEvents,Cm.forEach(Q=>{var Te,Re;te&&fd&&((Te=u.media.videoRenditions)==null||Te.removeEventListener(Q,te),f[F].videoRenditionsEvents=void 0),Td&&((Re=v.media.videoRenditions)==null||Re.addEventListener(Q,Ae),f[F].videoRenditionsEvents=Ae)}),te=f[F].audioTracksEvents,Lm.forEach(Q=>{var Te,Re;te&&vd&&((Te=u.media.audioTracks)==null||Te.removeEventListener(Q,te),f[F].audioTracksEvents=void 0),yd&&((Re=v.media.audioTracks)==null||Re.addEventListener(Q,Ae),f[F].audioTracksEvents=Ae)}),te=f[F].remoteEvents,wm.forEach(Q=>{var Te,Re;te&&Ed&&((Te=u.media.remote)==null||Te.removeEventListener(Q,te),f[F].remoteEvents=void 0),kd&&((Re=v.media.remote)==null||Re.addEventListener(Q,Ae),f[F].remoteEvents=Ae)}),te=f[F].rootEvents,Rm.forEach(Q=>{te&&bd&&(u.documentElement.removeEventListener(Q,te),f[F].rootEvents=void 0),Sd&&(v.documentElement.addEventListener(Q,Ae),f[F].rootEvents=Ae)});let Md=f[F].stateOwnersUpdateHandlers;xm.forEach(Q=>{Md&&gd&&Md(),Id&&(f[F].stateOwnersUpdateHandlers=Q(Ae,v))})}),Object.entries(v).forEach(([F,ya])=>{u[F]=ya}),g(),v=void 0};return N({media:t,fullscreenElement:e,documentElement:i,options:o}),{dispatch(T){let{type:C,detail:P}=T;if(r[C]&&m.mediaErrorCode==null){A(r[C](a,u,T));return}C==="mediaelementchangerequest"?N({media:P}):C==="fullscreenelementchangerequest"?N({fullscreenElement:P}):C==="documentelementchangerequest"?N({documentElement:P}):C==="optionschangerequest"&&Object.entries(P!=null?P:{}).forEach(([j,_e])=>{u.options[j]=_e})},getState(){return m},subscribe(T){return N({},l.length+1),l.push(T),T(m),()=>{let C=l.indexOf(T);C>=0&&(N({},l.length-1),l.splice(C,1))}}}};var gs=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},D=(t,e,i)=>(gs(t,e,"read from private field"),i?i.call(t):e.get(t)),ct=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},yt=(t,e,i,a)=>(gs(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),kt=(t,e,i)=>(gs(t,e,"access private method"),i),Zt,Oa,K,Na,Be,po,fo,vs,wi,Pa,vo,Es,Au=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],Eu=10,b={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",SEEK_TO_LIVE_OFFSET:"seektoliveoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys",NO_VOLUME_PREF:"novolumepref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_DEFAULT_STORE:"nodefaultstore",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",LANG:"lang"},Eo=class extends Ft{constructor(){super(),ct(this,fo),ct(this,wi),ct(this,vo),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,ct(this,Zt,new Tt(this,b.HOTKEYS)),ct(this,Oa,void 0),ct(this,K,void 0),ct(this,Na,void 0),ct(this,Be,void 0),ct(this,po,i=>{var a;(a=D(this,K))==null||a.dispatch(i)}),this.associateElement(this);let e={};yt(this,Na,i=>{Object.entries(i).forEach(([a,r])=>{if(a in e&&e[a]===r)return;this.propagateMediaState(a,r);let o=a.toLowerCase(),s=new d.CustomEvent(Dd[o],{composed:!0,detail:r});this.dispatchEvent(s)}),e=i}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(b.NO_HOTKEYS,b.HOTKEYS,b.DEFAULT_STREAM_TYPE,b.DEFAULT_SUBTITLES,b.DEFAULT_DURATION,b.LANG)}get mediaStore(){return D(this,K)}set mediaStore(e){var i,a;if(D(this,K)&&((i=D(this,Be))==null||i.call(this),yt(this,Be,void 0)),yt(this,K,e),!D(this,K)&&!this.hasAttribute(b.NO_DEFAULT_STORE)){kt(this,fo,vs).call(this);return}yt(this,Be,(a=D(this,K))==null?void 0:a.subscribe(D(this,Na)))}get fullscreenElement(){var e;return(e=D(this,Oa))!=null?e:this}set fullscreenElement(e){var i;this.hasAttribute(b.FULLSCREEN_ELEMENT)&&this.removeAttribute(b.FULLSCREEN_ELEMENT),yt(this,Oa,e),(i=D(this,K))==null||i.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return k(this,b.DEFAULT_SUBTITLES)}set defaultSubtitles(e){S(this,b.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return I(this,b.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){M(this,b.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return R(this,b.DEFAULT_DURATION)}set defaultDuration(e){O(this,b.DEFAULT_DURATION,e)}get noHotkeys(){return k(this,b.NO_HOTKEYS)}set noHotkeys(e){S(this,b.NO_HOTKEYS,e)}get keysUsed(){return I(this,b.KEYS_USED)}set keysUsed(e){M(this,b.KEYS_USED,e)}get liveEdgeOffset(){return R(this,b.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){O(this,b.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return k(this,b.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){S(this,b.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return k(this,b.NO_VOLUME_PREF)}set noVolumePref(e){S(this,b.NO_VOLUME_PREF,e)}get noSubtitlesLangPref(){return k(this,b.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){S(this,b.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return k(this,b.NO_DEFAULT_STORE)}set noDefaultStore(e){S(this,b.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,i,a){var r,o,s,l,u,m,A,g;if(super.attributeChangedCallback(e,i,a),e===b.NO_HOTKEYS)a!==i&&a===""?(this.hasAttribute(b.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):a!==i&&a===null&&this.enableHotkeys();else if(e===b.HOTKEYS)D(this,Zt).value=a;else if(e===b.DEFAULT_SUBTITLES&&a!==i)(r=D(this,K))==null||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(b.DEFAULT_SUBTITLES)}});else if(e===b.DEFAULT_STREAM_TYPE)(s=D(this,K))==null||s.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(o=this.getAttribute(b.DEFAULT_STREAM_TYPE))!=null?o:void 0}});else if(e===b.LIVE_EDGE_OFFSET)(l=D(this,K))==null||l.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(b.LIVE_EDGE_OFFSET)?+this.getAttribute(b.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(b.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(b.LIVE_EDGE_OFFSET)}});else if(e===b.SEEK_TO_LIVE_OFFSET)(u=D(this,K))==null||u.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(b.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(b.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===b.NO_AUTO_SEEK_TO_LIVE)(m=D(this,K))==null||m.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(b.NO_AUTO_SEEK_TO_LIVE)}});else if(e===b.FULLSCREEN_ELEMENT){let f=a?(A=this.getRootNode())==null?void 0:A.getElementById(a):void 0;yt(this,Oa,f),(g=D(this,K))==null||g.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===b.LANG&&a!==i&&Vd(a)}connectedCallback(){var e,i;!D(this,K)&&!this.hasAttribute(b.NO_DEFAULT_STORE)&&kt(this,fo,vs).call(this),(e=D(this,K))==null||e.dispatch({type:"documentelementchangerequest",detail:V}),super.connectedCallback(),D(this,K)&&!D(this,Be)&&yt(this,Be,(i=D(this,K))==null?void 0:i.subscribe(D(this,Na))),this.enableHotkeys()}disconnectedCallback(){var e,i,a,r;(e=super.disconnectedCallback)==null||e.call(this),D(this,K)&&((i=D(this,K))==null||i.dispatch({type:"documentelementchangerequest",detail:void 0}),(a=D(this,K))==null||a.dispatch({type:p.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),D(this,Be)&&((r=D(this,Be))==null||r.call(this),yt(this,Be,void 0))}mediaSetCallback(e){var i;super.mediaSetCallback(e),(i=D(this,K))==null||i.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var i;super.mediaUnsetCallback(e),(i=D(this,K))==null||i.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,i){_u(this.mediaStateReceivers,e,i)}associateElement(e){if(!e)return;let{associatedElementSubscriptions:i}=this;if(i.has(e))return;let a=this.registerMediaStateReceiver.bind(this),r=this.unregisterMediaStateReceiver.bind(this),o=Ih(e,a,r);Object.values(p).forEach(s=>{e.addEventListener(s,D(this,po))}),i.set(e,o)}unassociateElement(e){if(!e)return;let{associatedElementSubscriptions:i}=this;if(!i.has(e))return;i.get(e)(),i.delete(e),Object.values(p).forEach(r=>{e.removeEventListener(r,D(this,po))})}registerMediaStateReceiver(e){if(!e)return;let i=this.mediaStateReceivers;i.indexOf(e)>-1||(i.push(e),D(this,K)&&Object.entries(D(this,K).getState()).forEach(([r,o])=>{_u([e],r,o)}))}unregisterMediaStateReceiver(e){let i=this.mediaStateReceivers,a=i.indexOf(e);a<0||i.splice(a,1)}enableHotkeys(){this.addEventListener("keydown",kt(this,vo,Es))}disableHotkeys(){this.removeEventListener("keydown",kt(this,vo,Es)),this.removeEventListener("keyup",kt(this,wi,Pa))}get hotkeys(){return I(this,b.HOTKEYS)}set hotkeys(e){M(this,b.HOTKEYS,e)}keyboardShortcutHandler(e){var i,a,r,o,s;let l=e.target;if(((r=(a=(i=l.getAttribute(b.KEYS_USED))==null?void 0:i.split(" "))!=null?a:l==null?void 0:l.keysUsed)!=null?r:[]).map(f=>f==="Space"?" ":f).filter(Boolean).includes(e.key))return;let m,A,g;if(!D(this,Zt).contains(`no${e.key.toLowerCase()}`)&&!(e.key===" "&&D(this,Zt).contains("nospace")))switch(e.key){case" ":case"k":m=D(this,K).getState().mediaPaused?p.MEDIA_PLAY_REQUEST:p.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new d.CustomEvent(m,{composed:!0,bubbles:!0}));break;case"m":m=this.mediaStore.getState().mediaVolumeLevel==="off"?p.MEDIA_UNMUTE_REQUEST:p.MEDIA_MUTE_REQUEST,this.dispatchEvent(new d.CustomEvent(m,{composed:!0,bubbles:!0}));break;case"f":m=this.mediaStore.getState().mediaIsFullscreen?p.MEDIA_EXIT_FULLSCREEN_REQUEST:p.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new d.CustomEvent(m,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new d.CustomEvent(p.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{let f=this.hasAttribute(b.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(b.KEYBOARD_BACKWARD_SEEK_OFFSET):Eu;A=Math.max(((o=this.mediaStore.getState().mediaCurrentTime)!=null?o:0)-f,0),g=new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:A}),this.dispatchEvent(g);break}case"ArrowRight":{let f=this.hasAttribute(b.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(b.KEYBOARD_FORWARD_SEEK_OFFSET):Eu;A=Math.max(((s=this.mediaStore.getState().mediaCurrentTime)!=null?s:0)+f,0),g=new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:A}),this.dispatchEvent(g);break}default:break}}};Zt=new WeakMap;Oa=new WeakMap;K=new WeakMap;Na=new WeakMap;Be=new WeakMap;po=new WeakMap;fo=new WeakSet;vs=function(){var t;this.mediaStore=vu({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(b.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(b.DEFAULT_DURATION)?+this.getAttribute(b.DEFAULT_DURATION):void 0,defaultStreamType:(t=this.getAttribute(b.DEFAULT_STREAM_TYPE))!=null?t:void 0,liveEdgeOffset:this.hasAttribute(b.LIVE_EDGE_OFFSET)?+this.getAttribute(b.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(b.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(b.SEEK_TO_LIVE_OFFSET):this.hasAttribute(b.LIVE_EDGE_OFFSET)?+this.getAttribute(b.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(b.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(b.NO_VOLUME_PREF),noSubtitlesLangPref:this.hasAttribute(b.NO_SUBTITLES_LANG_PREF)}})};wi=new WeakSet;Pa=function(t){let{key:e}=t;if(!Au.includes(e)){this.removeEventListener("keyup",kt(this,wi,Pa));return}this.keyboardShortcutHandler(t)};vo=new WeakSet;Es=function(t){let{metaKey:e,altKey:i,key:a}=t;if(e||i||!Au.includes(a)){this.removeEventListener("keyup",kt(this,wi,Pa));return}[" ","ArrowLeft","ArrowRight"].includes(a)&&!(D(this,Zt).contains(`no${a.toLowerCase()}`)||a===" "&&D(this,Zt).contains("nospace"))&&t.preventDefault(),this.addEventListener("keyup",kt(this,wi,Pa),{once:!0})};var Ah=Object.values(n),Th=Object.values(jn),Tu=t=>{var e,i,a,r;let{observedAttributes:o}=t.constructor;!o&&((e=t.nodeName)!=null&&e.includes("-"))&&(d.customElements.upgrade(t),{observedAttributes:o}=t.constructor);let s=(r=(a=(i=t==null?void 0:t.getAttribute)==null?void 0:i.call(t,L.MEDIA_CHROME_ATTRIBUTES))==null?void 0:a.split)==null?void 0:r.call(a,/\s+/);return Array.isArray(o||s)?(o||s).filter(l=>Ah.includes(l)):[]},yh=t=>{var e,i;return(e=t.nodeName)!=null&&e.includes("-")&&d.customElements.get((i=t.nodeName)==null?void 0:i.toLowerCase())&&!(t instanceof d.customElements.get(t.nodeName.toLowerCase()))&&d.customElements.upgrade(t),Th.some(a=>a in t)},bs=t=>yh(t)||!!Tu(t).length,bu=t=>{var e;return(e=t==null?void 0:t.join)==null?void 0:e.call(t,":")},gu={[n.MEDIA_SUBTITLES_LIST]:ut,[n.MEDIA_SUBTITLES_SHOWING]:ut,[n.MEDIA_SEEKABLE]:bu,[n.MEDIA_BUFFERED]:t=>t==null?void 0:t.map(bu).join(" "),[n.MEDIA_PREVIEW_COORDS]:t=>t==null?void 0:t.join(" "),[n.MEDIA_RENDITION_LIST]:Nd,[n.MEDIA_AUDIO_TRACK_LIST]:Ud},kh=async(t,e,i)=>{var a,r;if(t.isConnected||await Kr(0),typeof i=="boolean"||i==null)return S(t,e,i);if(typeof i=="number")return O(t,e,i);if(typeof i=="string")return M(t,e,i);if(Array.isArray(i)&&!i.length)return t.removeAttribute(e);let o=(r=(a=gu[e])==null?void 0:a.call(gu,i))!=null?r:i;return t.setAttribute(e,o)},Sh=t=>{var e;return!!((e=t.closest)!=null&&e.call(t,'*[slot="media"]'))},qt=(t,e)=>{if(Sh(t))return;let i=(r,o)=>{var s,l;bs(r)&&o(r);let{children:u=[]}=r!=null?r:{},m=(l=(s=r==null?void 0:r.shadowRoot)==null?void 0:s.children)!=null?l:[];[...u,...m].forEach(g=>qt(g,o))},a=t==null?void 0:t.nodeName.toLowerCase();if(a.includes("-")&&!bs(t)){d.customElements.whenDefined(a).then(()=>{i(t,e)});return}i(t,e)},_u=(t,e,i)=>{t.forEach(a=>{if(e in a){a[e]=i;return}let r=Tu(a),o=e.toLowerCase();r.includes(o)&&kh(a,o,i)})},Ih=(t,e,i)=>{qt(t,e);let a=A=>{var g;let f=(g=A==null?void 0:A.composedPath()[0])!=null?g:A.target;e(f)},r=A=>{var g;let f=(g=A==null?void 0:A.composedPath()[0])!=null?g:A.target;i(f)};t.addEventListener(p.REGISTER_MEDIA_STATE_RECEIVER,a),t.addEventListener(p.UNREGISTER_MEDIA_STATE_RECEIVER,r);let o=A=>{A.forEach(g=>{let{addedNodes:f=[],removedNodes:v=[],type:N,target:T,attributeName:C}=g;N==="childList"?(Array.prototype.forEach.call(f,P=>qt(P,e)),Array.prototype.forEach.call(v,P=>qt(P,i))):N==="attributes"&&C===L.MEDIA_CHROME_ATTRIBUTES&&(bs(T)?e(T):i(T))})},s=[],l=A=>{let g=A.target;g.name!=="media"&&(s.forEach(f=>qt(f,i)),s=[...g.assignedElements({flatten:!0})],s.forEach(f=>qt(f,e)))};t.addEventListener("slotchange",l);let u=new MutationObserver(o);return u.observe(t,{childList:!0,attributes:!0,subtree:!0}),()=>{qt(t,i),t.removeEventListener("slotchange",l),u.disconnect(),t.removeEventListener(p.REGISTER_MEDIA_STATE_RECEIVER,a),t.removeEventListener(p.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};d.customElements.get("media-controller")||d.customElements.define("media-controller",Eo);var _s=Eo;var Ri={PLACEMENT:"placement",BOUNDS:"bounds"};function Mh(t){return`
158
+ `}var rh=Object.values(n),oh="sm:384 md:576 lg:768 xl:960";function nh(t){eu(t.target,t.contentRect.width)}function eu(t,e){var i;if(!t.isConnected)return;let a=(i=t.getAttribute(y.BREAKPOINTS))!=null?i:oh,r=sh(a),o=lh(r,e),s=!1;if(Object.keys(r).forEach(l=>{if(o.includes(l)){t.hasAttribute(`breakpoint${l}`)||(t.setAttribute(`breakpoint${l}`,""),s=!0);return}t.hasAttribute(`breakpoint${l}`)&&(t.removeAttribute(`breakpoint${l}`),s=!0)}),s){let l=new CustomEvent(Ce.BREAKPOINTS_CHANGE,{detail:o});t.dispatchEvent(l)}t.breakpointsComputed||(t.breakpointsComputed=!0,t.dispatchEvent(new CustomEvent(Ce.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function sh(t){let e=t.split(/\s+/);return Object.fromEntries(e.map(i=>i.split(":")))}function lh(t,e){return Object.keys(t).filter(i=>e>=parseInt(t[i]))}var Ft=class extends d.HTMLElement{constructor(){if(super(),Se(this,ns),Se(this,ss),Se(this,ls),Se(this,wa),Se(this,ro),Se(this,Si),Se(this,io,0),Se(this,yi,null),Se(this,La,null),Se(this,ki,void 0),this.breakpointsComputed=!1,Se(this,eo,new MutationObserver(Le(this,ns,Xd).bind(this))),Se(this,Ca,!1),Se(this,to,i=>{Ie(this,Ca)||(setTimeout(()=>{nh(i),Wt(this,Ca,!1)},0),Wt(this,Ca,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let i=Y(this.attributes),a=this.constructor.getTemplateHTML(i);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(a):this.shadowRoot.innerHTML=a}let e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){Ie(this,yi)&&this.mediaUnsetCallback(Ie(this,yi));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[y.AUTOHIDE,y.GESTURES_DISABLED].concat(rh).filter(e=>![n.MEDIA_RENDITION_LIST,n.MEDIA_AUDIO_TRACK_LIST,n.MEDIA_CHAPTERS_CUES,n.MEDIA_WIDTH,n.MEDIA_HEIGHT,n.MEDIA_ERROR,n.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,i,a){e.toLowerCase()==y.AUTOHIDE&&(this.autohide=a)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(Wt(this,yi,e),e.localName.includes("-")&&await d.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Ie(this,eo).observe(this,{childList:!0,subtree:!0}),st(this,Ie(this,to));let a=this.getAttribute(y.AUDIO)!=null?h("audio player"):h("video player");this.setAttribute("role","region"),this.setAttribute("aria-label",a),this.handleMediaUpdated(this.media),this.setAttribute(y.USER_INACTIVE,""),eu(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=d.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Ie(this,eo).disconnect(),lt(this,Ie(this,to)),this.media&&this.mediaUnsetCallback(this.media),(e=d.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){Wt(this,yi,null)}handleEvent(e){switch(e.type){case"pointerdown":Wt(this,io,e.timeStamp);break;case"pointermove":Le(this,ss,Jd).call(this,e);break;case"pointerup":Le(this,ls,jd).call(this,e);break;case"mouseleave":Le(this,wa,ao).call(this);break;case"mouseup":this.removeAttribute(y.KEYBOARD_CONTROL);break;case"keyup":Le(this,Si,Ra).call(this),this.setAttribute(y.KEYBOARD_CONTROL,"");break}}set autohide(e){let i=Number(e);Wt(this,ki,isNaN(i)?0:i)}get autohide(){return(Ie(this,ki)===void 0?2:Ie(this,ki)).toString()}get breakpoints(){return I(this,y.BREAKPOINTS)}set breakpoints(e){M(this,y.BREAKPOINTS,e)}get audio(){return k(this,y.AUDIO)}set audio(e){S(this,y.AUDIO,e)}get gesturesDisabled(){return k(this,y.GESTURES_DISABLED)}set gesturesDisabled(e){S(this,y.GESTURES_DISABLED,e)}get keyboardControl(){return k(this,y.KEYBOARD_CONTROL)}set keyboardControl(e){S(this,y.KEYBOARD_CONTROL,e)}get noAutohide(){return k(this,y.NO_AUTOHIDE)}set noAutohide(e){S(this,y.NO_AUTOHIDE,e)}get autohideOverControls(){return k(this,y.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){S(this,y.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return k(this,y.USER_INACTIVE)}set userInteractive(e){S(this,y.USER_INACTIVE,e)}};io=new WeakMap;yi=new WeakMap;La=new WeakMap;ki=new WeakMap;eo=new WeakMap;ns=new WeakSet;Xd=function(t){let e=this.media;for(let i of t){if(i.type!=="childList")continue;let a=i.removedNodes;for(let r of a){if(r.slot!="media"||i.target!=this)continue;let o=i.previousSibling&&i.previousSibling.previousElementSibling;if(!o||!e)this.mediaUnsetCallback(r);else{let s=o.slot!=="media";for(;(o=o.previousSibling)!==null;)o.slot=="media"&&(s=!1);s&&this.mediaUnsetCallback(r)}}if(e)for(let r of i.addedNodes)r===e&&this.handleMediaUpdated(e)}};Ca=new WeakMap;to=new WeakMap;ss=new WeakSet;Jd=function(t){if(t.pointerType!=="mouse"&&t.timeStamp-Ie(this,io)<250)return;Le(this,ro,us).call(this),clearTimeout(Ie(this,La));let e=this.hasAttribute(y.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(t.target)||e)&&Le(this,Si,Ra).call(this)};ls=new WeakSet;jd=function(t){if(t.pointerType==="touch"){let e=!this.hasAttribute(y.USER_INACTIVE);[this,this.media].includes(t.target)&&e?Le(this,wa,ao).call(this):Le(this,Si,Ra).call(this)}else t.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e==null?void 0:e.localName))&&Le(this,Si,Ra).call(this)};wa=new WeakSet;ao=function(){if(Ie(this,ki)<0||this.hasAttribute(y.USER_INACTIVE))return;this.setAttribute(y.USER_INACTIVE,"");let t=new d.CustomEvent(Ce.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(t)};ro=new WeakSet;us=function(){if(!this.hasAttribute(y.USER_INACTIVE))return;this.removeAttribute(y.USER_INACTIVE);let t=new d.CustomEvent(Ce.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(t)};Si=new WeakSet;Ra=function(){Le(this,ro,us).call(this),clearTimeout(Ie(this,La));let t=parseInt(this.autohide);t<0||Wt(this,La,setTimeout(()=>{Le(this,wa,ao).call(this)},t*1e3))};Ft.shadowRootOptions={mode:"open"};Ft.getTemplateHTML=ah;d.customElements.get("media-container")||d.customElements.define("media-container",Ft);var tu=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},ie=(t,e,i)=>(tu(t,e,"read from private field"),i?i.call(t):e.get(t)),xa=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},oo=(t,e,i,a)=>(tu(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Ii,Mi,no,Vt,dt,At,Tt=class{constructor(e,i,{defaultValue:a}={defaultValue:void 0}){xa(this,dt),xa(this,Ii,void 0),xa(this,Mi,void 0),xa(this,no,void 0),xa(this,Vt,new Set),oo(this,Ii,e),oo(this,Mi,i),oo(this,no,new Set(a))}[Symbol.iterator](){return ie(this,dt,At).values()}get length(){return ie(this,dt,At).size}get value(){var e;return(e=[...ie(this,dt,At)].join(" "))!=null?e:""}set value(e){var i;e!==this.value&&(oo(this,Vt,new Set),this.add(...(i=e==null?void 0:e.split(" "))!=null?i:[]))}toString(){return this.value}item(e){return[...ie(this,dt,At)][e]}values(){return ie(this,dt,At).values()}forEach(e,i){ie(this,dt,At).forEach(e,i)}add(...e){var i,a;e.forEach(r=>ie(this,Vt).add(r)),!(this.value===""&&!((i=ie(this,Ii))!=null&&i.hasAttribute(`${ie(this,Mi)}`)))&&((a=ie(this,Ii))==null||a.setAttribute(`${ie(this,Mi)}`,`${this.value}`))}remove(...e){var i;e.forEach(a=>ie(this,Vt).delete(a)),(i=ie(this,Ii))==null||i.setAttribute(`${ie(this,Mi)}`,`${this.value}`)}contains(e){return ie(this,dt,At).has(e)}toggle(e,i){return typeof i!="undefined"?i?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,i){return this.remove(e),this.add(i),e===i}};Ii=new WeakMap;Mi=new WeakMap;no=new WeakMap;Vt=new WeakMap;dt=new WeakSet;At=function(){return ie(this,Vt).size?ie(this,Vt):ie(this,no)};var dh=(t="")=>t.split(/\s+/),iu=(t="")=>{let[e,i,a]=t.split(":"),r=a?decodeURIComponent(a):void 0;return{kind:e==="cc"?fe.CAPTIONS:fe.SUBTITLES,language:i,label:r}},Kt=(t="",e={})=>dh(t).map(i=>{let a=iu(i);return{...e,...a}}),cs=t=>t?Array.isArray(t)?t.map(e=>typeof e=="string"?iu(e):e):typeof t=="string"?Kt(t):[t]:[],so=({kind:t,label:e,language:i}={kind:"subtitles"})=>e?`${t==="captions"?"cc":"sb"}:${i}:${encodeURIComponent(e)}`:i,ut=(t=[])=>Array.prototype.map.call(t,so).join(" "),uh=(t,e)=>i=>i[t]===e,au=t=>{let e=Object.entries(t).map(([i,a])=>uh(i,a));return i=>e.every(a=>a(i))},Gt=(t,e=[],i=[])=>{let a=cs(i).map(au),r=o=>a.some(s=>s(o));Array.from(e).filter(r).forEach(o=>{o.mode=t})},Yt=(t,e=()=>!0)=>{if(!(t!=null&&t.textTracks))return[];let i=typeof e=="function"?e:au(e);return Array.from(t.textTracks).filter(i)},lo=t=>{var e;return!!((e=t.mediaSubtitlesShowing)!=null&&e.length)||t.hasAttribute(n.MEDIA_SUBTITLES_SHOWING)};var ou=t=>{var e;let{media:i,fullscreenElement:a}=t;try{let r=a&&"requestFullscreen"in a?"requestFullscreen":a&&"webkitRequestFullScreen"in a?"webkitRequestFullScreen":void 0;if(r){let o=(e=a[r])==null?void 0:e.call(a);if(o instanceof Promise)return o.catch(()=>{})}else i!=null&&i.webkitEnterFullscreen?i.webkitEnterFullscreen():i!=null&&i.requestFullscreen&&i.requestFullscreen()}catch(r){console.error(r)}},ru="exitFullscreen"in V?"exitFullscreen":"webkitExitFullscreen"in V?"webkitExitFullscreen":"webkitCancelFullScreen"in V?"webkitCancelFullScreen":void 0,nu=t=>{var e;let{documentElement:i}=t;if(ru){let a=(e=i==null?void 0:i[ru])==null?void 0:e.call(i);if(a instanceof Promise)return a.catch(()=>{})}},Da="fullscreenElement"in V?"fullscreenElement":"webkitFullscreenElement"in V?"webkitFullscreenElement":void 0,ch=t=>{let{documentElement:e,media:i}=t,a=e==null?void 0:e[Da];return!a&&"webkitDisplayingFullscreen"in i&&"webkitPresentationMode"in i&&i.webkitDisplayingFullscreen&&i.webkitPresentationMode===Od.FULLSCREEN?i:a},su=t=>{var e;let{media:i,documentElement:a,fullscreenElement:r=i}=t;if(!i||!a)return!1;let o=ch(t);if(!o)return!1;if(o===r||o===i)return!0;if(o.localName.includes("-")){let s=o.shadowRoot;if(!(Da in s))return ue(o,r);for(;s!=null&&s[Da];){if(s[Da]===r)return!0;s=(e=s[Da])==null?void 0:e.shadowRoot}}return!1},mh="fullscreenEnabled"in V?"fullscreenEnabled":"webkitFullscreenEnabled"in V?"webkitFullscreenEnabled":void 0,lu=t=>{let{documentElement:e,media:i}=t;return!!(e!=null&&e[mh])||i&&"webkitSupportsFullscreen"in i};var uo,ms=()=>{var t,e;return uo||(uo=(e=(t=V)==null?void 0:t.createElement)==null?void 0:e.call(t,"video"),uo)},du=async(t=ms())=>{if(!t)return!1;let e=t.volume;t.volume=e/2+.1;let i=new AbortController,a=await Promise.race([hh(t,i.signal),ph(t,e)]);return i.abort(),a},hh=(t,e)=>new Promise(i=>{t.addEventListener("volumechange",()=>i(!0),{signal:e})}),ph=async(t,e)=>{for(let i=0;i<10;i++){if(t.volume===e)return!1;await Kr(10)}return t.volume!==e},fh=/.*Version\/.*Safari\/.*/.test(d.navigator.userAgent),hs=(t=ms())=>d.matchMedia("(display-mode: standalone)").matches&&fh?!1:typeof(t==null?void 0:t.requestPictureInPicture)=="function",ps=(t=ms())=>lu({documentElement:V,media:t}),uu=ps(),cu=hs(),mu=!!d.WebKitPlaybackTargetAvailabilityEvent,hu=!!d.chrome;var Ci=t=>Yt(t.media,e=>[fe.SUBTITLES,fe.CAPTIONS].includes(e.kind)).sort((e,i)=>e.kind>=i.kind?1:-1),fs=t=>Yt(t.media,e=>e.mode===gt.SHOWING&&[fe.SUBTITLES,fe.CAPTIONS].includes(e.kind)),co=(t,e)=>{let i=Ci(t),a=fs(t),r=!!a.length;if(i.length){if(e===!1||r&&e!==!0)Gt(gt.DISABLED,i,a);else if(e===!0||!r&&e!==!1){let o=i[0],{options:s}=t;if(!(s!=null&&s.noSubtitlesLangPref)){let _=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),g=_?[_,...globalThis.navigator.languages]:globalThis.navigator.languages,f=i.filter(v=>g.some(N=>v.language.toLowerCase().startsWith(N.split("-")[0]))).sort((v,N)=>{let T=g.findIndex(P=>v.language.toLowerCase().startsWith(P.split("-")[0])),C=g.findIndex(P=>N.language.toLowerCase().startsWith(P.split("-")[0]));return T-C});f[0]&&(o=f[0])}let{language:l,label:u,kind:m}=o;Gt(gt.DISABLED,i,a),Gt(gt.SHOWING,i,[{language:l,label:u,kind:m}])}}},mo=(t,e)=>t===e?!0:t==null||e==null||typeof t!=typeof e?!1:typeof t=="number"&&Number.isNaN(t)&&Number.isNaN(e)?!0:typeof t!="object"?!1:Array.isArray(t)?vh(t,e):Object.entries(t).every(([i,a])=>i in e&&mo(a,e[i])),vh=(t,e)=>{let i=Array.isArray(t),a=Array.isArray(e);return i!==a?!1:i||a?t.length!==e.length?!1:t.every((r,o)=>mo(r,e[o])):!0};var Eh=Object.values(xe),ho,bh=du().then(t=>(ho=t,ho)),pu=async(...t)=>{await Promise.all(t.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof d.HTMLElement))return;let i=e.localName;if(!i.includes("-"))return;let a=d.customElements.get(i);a&&e instanceof a||(await d.customElements.whenDefined(i),d.customElements.upgrade(e))}))},gh=new d.DOMParser,_h=t=>t&&(gh.parseFromString(t,"text/html").body.textContent||t),Li={mediaError:{get(t,e){let{media:i}=t;if((e==null?void 0:e.type)!=="playing")return i==null?void 0:i.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(t,e){var i;let{media:a}=t;if((e==null?void 0:e.type)!=="playing")return(i=a==null?void 0:a.error)==null?void 0:i.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(t,e){var i,a;let{media:r}=t;if((e==null?void 0:e.type)!=="playing")return(a=(i=r==null?void 0:r.error)==null?void 0:i.message)!=null?a:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.paused)!=null?e:!0},set(t,e){var i;let{media:a}=e;a&&(t?a.pause():(i=a.play())==null||i.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(t,e){let{media:i}=t;return i?e?e.type==="playing":!i.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.playbackRate)!=null?e:1},set(t,e){let{media:i}=e;i&&Number.isFinite(+t)&&(i.playbackRate=+t)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.muted)!=null?e:!1},set(t,e){let{media:i}=e;if(i){try{d.localStorage.setItem("media-chrome-pref-muted",t?"true":"false")}catch(a){console.debug("Error setting muted pref",a)}i.muted=t}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(t,e)=>{let{options:{noMutedPref:i}}=e,{media:a}=e;if(!(!a||a.muted||i))try{let r=d.localStorage.getItem("media-chrome-pref-muted")==="true";Li.mediaMuted.set(r,e),t(r)}catch(r){console.debug("Error getting muted pref",r)}}]},mediaVolume:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.volume)!=null?e:1},set(t,e){let{media:i}=e;if(i){try{t==null?d.localStorage.removeItem("media-chrome-pref-volume"):d.localStorage.setItem("media-chrome-pref-volume",t.toString())}catch(a){console.debug("Error setting volume pref",a)}Number.isFinite(+t)&&(i.volume=+t)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(t,e)=>{let{options:{noVolumePref:i}}=e;if(!i)try{let{media:a}=e;if(!a)return;let r=d.localStorage.getItem("media-chrome-pref-volume");if(r==null)return;Li.mediaVolume.set(+r,e),t(+r)}catch(a){console.debug("Error getting volume pref",a)}}]},mediaVolumeLevel:{get(t){let{media:e}=t;return typeof(e==null?void 0:e.volume)=="undefined"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(t){var e;let{media:i}=t;return(e=i==null?void 0:i.currentTime)!=null?e:0},set(t,e){let{media:i}=e;!i||!Ai(t)||(i.currentTime=t)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(t){let{media:e,options:{defaultDuration:i}={}}=t;return i&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?i:Number.isFinite(e==null?void 0:e.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(t){let{media:e}=t;return(e==null?void 0:e.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(t){var e;let{media:i}=t;if(!((e=i==null?void 0:i.seekable)!=null&&e.length))return;let a=i.seekable.start(0),r=i.seekable.end(i.seekable.length-1);if(!(!a&&!r))return[Number(a.toFixed(3)),Number(r.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(t){var e;let{media:i}=t,a=(e=i==null?void 0:i.buffered)!=null?e:[];return Array.from(a).map((r,o)=>[Number(a.start(o).toFixed(3)),Number(a.end(o).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(t){let{media:e,options:{defaultStreamType:i}={}}=t,a=[xe.LIVE,xe.ON_DEMAND].includes(i)?i:void 0;if(!e)return a;let{streamType:r}=e;if(Eh.includes(r))return r===xe.UNKNOWN?a:r;let o=e.duration;return o===1/0?xe.LIVE:Number.isFinite(o)?xe.ON_DEMAND:a},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(t){let{media:e}=t;if(!e)return Number.NaN;let{targetLiveWindow:i}=e,a=Li.mediaStreamType.get(t);return(i==null||Number.isNaN(i))&&a===xe.LIVE?0:i},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(t){let{media:e,options:{liveEdgeOffset:i=10}={}}=t;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(Li.mediaStreamType.get(t)===xe.LIVE))return!1;let r=e.seekable;if(!r)return!0;if(!r.length)return!1;let o=r.end(r.length-1)-i;return e.currentTime>=o},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(t){return Ci(t).map(({kind:e,label:i,language:a})=>({kind:e,label:i,language:a}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(t){return fs(t).map(({kind:e,label:i,language:a})=>({kind:e,label:i,language:a}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(t,e)=>{var i,a;let{media:r,options:o}=e;if(!r)return;let s=l=>{var u;!o.defaultSubtitles||l&&![fe.CAPTIONS,fe.SUBTITLES].includes((u=l==null?void 0:l.track)==null?void 0:u.kind)||co(e,!0)};return r.addEventListener("loadstart",s),(i=r.textTracks)==null||i.addEventListener("addtrack",s),(a=r.textTracks)==null||a.addEventListener("removetrack",s),()=>{var l,u;r.removeEventListener("loadstart",s),(l=r.textTracks)==null||l.removeEventListener("addtrack",s),(u=r.textTracks)==null||u.removeEventListener("removetrack",s)}}]},mediaChaptersCues:{get(t){var e;let{media:i}=t;if(!i)return[];let[a]=Yt(i,{kind:fe.CHAPTERS});return Array.from((e=a==null?void 0:a.cues)!=null?e:[]).map(({text:r,startTime:o,endTime:s})=>({text:_h(r),startTime:o,endTime:s}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(t,e)=>{var i;let{media:a}=e;if(!a)return;let r=a.querySelector('track[kind="chapters"][default][src]'),o=(i=a.shadowRoot)==null?void 0:i.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return r==null||r.addEventListener("load",t),o==null||o.addEventListener("load",t),()=>{r==null||r.removeEventListener("load",t),o==null||o.removeEventListener("load",t)}}]},mediaIsPip:{get(t){var e,i;let{media:a,documentElement:r}=t;if(!a||!r||!r.pictureInPictureElement)return!1;if(r.pictureInPictureElement===a)return!0;if(r.pictureInPictureElement instanceof HTMLMediaElement)return(e=a.localName)!=null&&e.includes("-")?ue(a,r.pictureInPictureElement):!1;if(r.pictureInPictureElement.localName.includes("-")){let o=r.pictureInPictureElement.shadowRoot;for(;o!=null&&o.pictureInPictureElement;){if(o.pictureInPictureElement===a)return!0;o=(i=o.pictureInPictureElement)==null?void 0:i.shadowRoot}}return!1},set(t,e){let{media:i}=e;if(i)if(t){if(!V.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!i.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}let a=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};i.requestPictureInPicture().catch(r=>{if(r.code===11){if(!i.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(i.readyState===0&&i.preload==="none"){let o=()=>{i.removeEventListener("loadedmetadata",s),i.preload="none"},s=()=>{i.requestPictureInPicture().catch(a),o()};i.addEventListener("loadedmetadata",s),i.preload="metadata",setTimeout(()=>{i.readyState===0&&a(),o()},1e3)}else throw r}else throw r})}else V.pictureInPictureElement&&V.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(t){var e;let{media:i}=t;return[...(e=i==null?void 0:i.videoRenditions)!=null?e:[]].map(a=>({...a}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(t){var e,i,a;let{media:r}=t;return(a=(i=r==null?void 0:r.videoRenditions)==null?void 0:i[(e=r.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:a.id},set(t,e){let{media:i}=e;if(!(i!=null&&i.videoRenditions)){console.warn("MediaController: Rendition selection not supported by this media.");return}let a=t,r=Array.prototype.findIndex.call(i.videoRenditions,o=>o.id==a);i.videoRenditions.selectedIndex!=r&&(i.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(t){var e;let{media:i}=t;return[...(e=i==null?void 0:i.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(t){var e,i;let{media:a}=t;return(i=[...(e=a==null?void 0:a.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:i.id},set(t,e){let{media:i}=e;if(!(i!=null&&i.audioTracks)){console.warn("MediaChrome: Audio track selection not supported by this media.");return}let a=t;for(let r of i.audioTracks)r.enabled=a==r.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(t){return su(t)},set(t,e){t?ou(e):nu(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(t){var e;let{media:i}=t;return!(i!=null&&i.remote)||((e=i.remote)==null?void 0:e.state)==="disconnected"?!1:!!i.remote.state},set(t,e){var i,a;let{media:r}=e;if(r&&!(t&&((i=r.remote)==null?void 0:i.state)!=="disconnected")&&!(!t&&((a=r.remote)==null?void 0:a.state)!=="connected")){if(typeof r.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}r.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(t,e){let{media:i}=e;if(i){if(!(i.webkitShowPlaybackTargetPicker&&d.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}i.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(t){let{media:e}=t;if(!uu||!ps(e))return ke.UNSUPPORTED}},mediaPipUnavailable:{get(t){let{media:e}=t;if(!cu||!hs(e))return ke.UNSUPPORTED}},mediaVolumeUnavailable:{get(t){let{media:e}=t;if(ho===!1||(e==null?void 0:e.volume)==null)return ke.UNSUPPORTED},stateOwnersUpdateHandlers:[t=>{ho==null&&bh.then(e=>t(e?void 0:ke.UNSUPPORTED))}]},mediaCastUnavailable:{get(t,{availability:e="not-available"}={}){var i;let{media:a}=t;if(!hu||!((i=a==null?void 0:a.remote)!=null&&i.state))return ke.UNSUPPORTED;if(!(e==null||e==="available"))return ke.UNAVAILABLE},stateOwnersUpdateHandlers:[(t,e)=>{var i;let{media:a}=e;return a?(a.disableRemotePlayback||a.hasAttribute("disableremoteplayback")||(i=a==null?void 0:a.remote)==null||i.watchAvailability(o=>{t({availability:o?"available":"not-available"})}).catch(o=>{o.name==="NotSupportedError"?t({availability:null}):t({availability:"not-available"})}),()=>{var o;(o=a==null?void 0:a.remote)==null||o.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(t,e){if(!mu)return ke.UNSUPPORTED;if((e==null?void 0:e.availability)==="not-available")return ke.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(t,e)=>{var i;let{media:a}=e;return a?(a.disableRemotePlayback||a.hasAttribute("disableremoteplayback")||(i=a==null?void 0:a.remote)==null||i.watchAvailability(o=>{t({availability:o?"available":"not-available"})}).catch(o=>{o.name==="NotSupportedError"?t({availability:null}):t({availability:"not-available"})}),()=>{var o;(o=a==null?void 0:a.remote)==null||o.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(t){var e;let{media:i}=t;if(!(i!=null&&i.videoRenditions))return ke.UNSUPPORTED;if(!((e=i.videoRenditions)!=null&&e.length))return ke.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(t){var e,i;let{media:a}=t;if(!(a!=null&&a.audioTracks))return ke.UNSUPPORTED;if(((i=(e=a.audioTracks)==null?void 0:e.length)!=null?i:0)<=1)return ke.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]}};var fu={[p.MEDIA_PREVIEW_REQUEST](t,e,{detail:i}){var a,r,o;let{media:s}=e,l=i!=null?i:void 0,u,m;if(s&&l!=null){let[v]=Yt(s,{kind:fe.METADATA,label:"thumbnails"}),N=Array.prototype.find.call((a=v==null?void 0:v.cues)!=null?a:[],(T,C,P)=>C===0?T.endTime>l:C===P.length-1?T.startTime<=l:T.startTime<=l&&T.endTime>l);if(N){let T=/'^(?:[a-z]+:)?\/\//i.test(N.text)||(r=s==null?void 0:s.querySelector('track[label="thumbnails"]'))==null?void 0:r.src,C=new URL(N.text,T);m=new URLSearchParams(C.hash).get("#xywh").split(",").map(j=>+j),u=C.href}}let _=t.mediaDuration.get(e),f=(o=t.mediaChaptersCues.get(e).find((v,N,T)=>N===T.length-1&&_===v.endTime?v.startTime<=l&&v.endTime>=l:v.startTime<=l&&v.endTime>l))==null?void 0:o.text;return i!=null&&f==null&&(f=""),{mediaPreviewTime:l,mediaPreviewImage:u,mediaPreviewCoords:m,mediaPreviewChapter:f}},[p.MEDIA_PAUSE_REQUEST](t,e){t["mediaPaused"].set(!0,e)},[p.MEDIA_PLAY_REQUEST](t,e){var i,a,r,o;let s="mediaPaused",u=t.mediaStreamType.get(e)===xe.LIVE,m=!((i=e.options)!=null&&i.noAutoSeekToLive),_=t.mediaTargetLiveWindow.get(e)>0;if(u&&m&&!_){let g=(a=t.mediaSeekable.get(e))==null?void 0:a[1];if(g){let f=(o=(r=e.options)==null?void 0:r.seekToLiveOffset)!=null?o:0,v=g-f;t.mediaCurrentTime.set(v,e)}}t[s].set(!1,e)},[p.MEDIA_PLAYBACK_RATE_REQUEST](t,e,{detail:i}){let a="mediaPlaybackRate",r=i;t[a].set(r,e)},[p.MEDIA_MUTE_REQUEST](t,e){t["mediaMuted"].set(!0,e)},[p.MEDIA_UNMUTE_REQUEST](t,e){let i="mediaMuted";t.mediaVolume.get(e)||t.mediaVolume.set(.25,e),t[i].set(!1,e)},[p.MEDIA_VOLUME_REQUEST](t,e,{detail:i}){let a="mediaVolume",r=i;r&&t.mediaMuted.get(e)&&t.mediaMuted.set(!1,e),t[a].set(r,e)},[p.MEDIA_SEEK_REQUEST](t,e,{detail:i}){let a="mediaCurrentTime",r=i;t[a].set(r,e)},[p.MEDIA_SEEK_TO_LIVE_REQUEST](t,e){var i,a,r;let o="mediaCurrentTime",s=(i=t.mediaSeekable.get(e))==null?void 0:i[1];if(Number.isNaN(Number(s)))return;let l=(r=(a=e.options)==null?void 0:a.seekToLiveOffset)!=null?r:0,u=s-l;t[o].set(u,e)},[p.MEDIA_SHOW_SUBTITLES_REQUEST](t,e,{detail:i}){var a;let{options:r}=e,o=Ci(e),s=cs(i),l=(a=s[0])==null?void 0:a.language;l&&!r.noSubtitlesLangPref&&d.localStorage.setItem("media-chrome-pref-subtitles-lang",l),Gt(gt.SHOWING,o,s)},[p.MEDIA_DISABLE_SUBTITLES_REQUEST](t,e,{detail:i}){let a=Ci(e),r=i!=null?i:[];Gt(gt.DISABLED,a,r)},[p.MEDIA_TOGGLE_SUBTITLES_REQUEST](t,e,{detail:i}){co(e,i)},[p.MEDIA_RENDITION_REQUEST](t,e,{detail:i}){let a="mediaRenditionSelected",r=i;t[a].set(r,e)},[p.MEDIA_AUDIO_TRACK_REQUEST](t,e,{detail:i}){let a="mediaAudioTrackEnabled",r=i;t[a].set(r,e)},[p.MEDIA_ENTER_PIP_REQUEST](t,e){let i="mediaIsPip";t.mediaIsFullscreen.get(e)&&t.mediaIsFullscreen.set(!1,e),t[i].set(!0,e)},[p.MEDIA_EXIT_PIP_REQUEST](t,e){t["mediaIsPip"].set(!1,e)},[p.MEDIA_ENTER_FULLSCREEN_REQUEST](t,e){let i="mediaIsFullscreen";t.mediaIsPip.get(e)&&t.mediaIsPip.set(!1,e),t[i].set(!0,e)},[p.MEDIA_EXIT_FULLSCREEN_REQUEST](t,e){t["mediaIsFullscreen"].set(!1,e)},[p.MEDIA_ENTER_CAST_REQUEST](t,e){let i="mediaIsCasting";t.mediaIsFullscreen.get(e)&&t.mediaIsFullscreen.set(!1,e),t[i].set(!0,e)},[p.MEDIA_EXIT_CAST_REQUEST](t,e){t["mediaIsCasting"].set(!1,e)},[p.MEDIA_AIRPLAY_REQUEST](t,e){t["mediaIsAirplaying"].set(!0,e)}};var vu=({media:t,fullscreenElement:e,documentElement:i,stateMediator:a=Li,requestMap:r=fu,options:o={},monitorStateOwnersOnlyWithSubscriptions:s=!0})=>{let l=[],u={options:{...o}},m=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0}),_=T=>{T!=null&&(mo(T,m)||(m=Object.freeze({...m,...T}),l.forEach(C=>C(m))))},g=()=>{let T=Object.entries(a).reduce((C,[P,{get:j}])=>(C[P]=j(u),C),{});_(T)},f={},v,N=async(T,C)=>{var P,j,_e,bt,ot,ca,ma,ha,pa,fa,va,Ea,ba,ga,_a,Aa;let Wr=!!v;if(v={...u,...v!=null?v:{},...T},Wr)return;await pu(...Object.values(T));let nt=l.length>0&&C===0&&s,Ta=u.media!==v.media,ld=((P=u.media)==null?void 0:P.textTracks)!==((j=v.media)==null?void 0:j.textTracks),dd=((_e=u.media)==null?void 0:_e.videoRenditions)!==((bt=v.media)==null?void 0:bt.videoRenditions),ud=((ot=u.media)==null?void 0:ot.audioTracks)!==((ca=v.media)==null?void 0:ca.audioTracks),cd=((ma=u.media)==null?void 0:ma.remote)!==((ha=v.media)==null?void 0:ha.remote),md=u.documentElement!==v.documentElement,hd=!!u.media&&(Ta||nt),pd=!!((pa=u.media)!=null&&pa.textTracks)&&(ld||nt),fd=!!((fa=u.media)!=null&&fa.videoRenditions)&&(dd||nt),vd=!!((va=u.media)!=null&&va.audioTracks)&&(ud||nt),Ed=!!((Ea=u.media)!=null&&Ea.remote)&&(cd||nt),bd=!!u.documentElement&&(md||nt),gd=hd||pd||fd||vd||Ed||bd,bi=l.length===0&&C===1&&s,_d=!!v.media&&(Ta||bi),Ad=!!((ba=v.media)!=null&&ba.textTracks)&&(ld||bi),Td=!!((ga=v.media)!=null&&ga.videoRenditions)&&(dd||bi),yd=!!((_a=v.media)!=null&&_a.audioTracks)&&(ud||bi),kd=!!((Aa=v.media)!=null&&Aa.remote)&&(cd||bi),Sd=!!v.documentElement&&(md||bi),Id=_d||Ad||Td||yd||kd||Sd;if(!(gd||Id)){Object.entries(v).forEach(([F,ya])=>{u[F]=ya}),g(),v=void 0;return}Object.entries(a).forEach(([F,{get:ya,mediaEvents:Im=[],textTracksEvents:Mm=[],videoRenditionsEvents:Cm=[],audioTracksEvents:Lm=[],remoteEvents:wm=[],rootEvents:Rm=[],stateOwnersUpdateHandlers:xm=[]}])=>{f[F]||(f[F]={});let Ae=Q=>{let Te=ya(u,Q);_({[F]:Te})},te;te=f[F].mediaEvents,Im.forEach(Q=>{te&&hd&&(u.media.removeEventListener(Q,te),f[F].mediaEvents=void 0),_d&&(v.media.addEventListener(Q,Ae),f[F].mediaEvents=Ae)}),te=f[F].textTracksEvents,Mm.forEach(Q=>{var Te,Re;te&&pd&&((Te=u.media.textTracks)==null||Te.removeEventListener(Q,te),f[F].textTracksEvents=void 0),Ad&&((Re=v.media.textTracks)==null||Re.addEventListener(Q,Ae),f[F].textTracksEvents=Ae)}),te=f[F].videoRenditionsEvents,Cm.forEach(Q=>{var Te,Re;te&&fd&&((Te=u.media.videoRenditions)==null||Te.removeEventListener(Q,te),f[F].videoRenditionsEvents=void 0),Td&&((Re=v.media.videoRenditions)==null||Re.addEventListener(Q,Ae),f[F].videoRenditionsEvents=Ae)}),te=f[F].audioTracksEvents,Lm.forEach(Q=>{var Te,Re;te&&vd&&((Te=u.media.audioTracks)==null||Te.removeEventListener(Q,te),f[F].audioTracksEvents=void 0),yd&&((Re=v.media.audioTracks)==null||Re.addEventListener(Q,Ae),f[F].audioTracksEvents=Ae)}),te=f[F].remoteEvents,wm.forEach(Q=>{var Te,Re;te&&Ed&&((Te=u.media.remote)==null||Te.removeEventListener(Q,te),f[F].remoteEvents=void 0),kd&&((Re=v.media.remote)==null||Re.addEventListener(Q,Ae),f[F].remoteEvents=Ae)}),te=f[F].rootEvents,Rm.forEach(Q=>{te&&bd&&(u.documentElement.removeEventListener(Q,te),f[F].rootEvents=void 0),Sd&&(v.documentElement.addEventListener(Q,Ae),f[F].rootEvents=Ae)});let Md=f[F].stateOwnersUpdateHandlers;xm.forEach(Q=>{Md&&gd&&Md(),Id&&(f[F].stateOwnersUpdateHandlers=Q(Ae,v))})}),Object.entries(v).forEach(([F,ya])=>{u[F]=ya}),g(),v=void 0};return N({media:t,fullscreenElement:e,documentElement:i,options:o}),{dispatch(T){let{type:C,detail:P}=T;if(r[C]&&m.mediaErrorCode==null){_(r[C](a,u,T));return}C==="mediaelementchangerequest"?N({media:P}):C==="fullscreenelementchangerequest"?N({fullscreenElement:P}):C==="documentelementchangerequest"?N({documentElement:P}):C==="optionschangerequest"&&Object.entries(P!=null?P:{}).forEach(([j,_e])=>{u.options[j]=_e})},getState(){return m},subscribe(T){return N({},l.length+1),l.push(T),T(m),()=>{let C=l.indexOf(T);C>=0&&(N({},l.length-1),l.splice(C,1))}}}};var gs=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},D=(t,e,i)=>(gs(t,e,"read from private field"),i?i.call(t):e.get(t)),ct=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},yt=(t,e,i,a)=>(gs(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),kt=(t,e,i)=>(gs(t,e,"access private method"),i),Zt,Oa,K,Na,Be,po,fo,vs,wi,Pa,vo,Es,Au=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],Eu=10,b={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",SEEK_TO_LIVE_OFFSET:"seektoliveoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys",NO_VOLUME_PREF:"novolumepref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_DEFAULT_STORE:"nodefaultstore",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",LANG:"lang"},Eo=class extends Ft{constructor(){super(),ct(this,fo),ct(this,wi),ct(this,vo),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,ct(this,Zt,new Tt(this,b.HOTKEYS)),ct(this,Oa,void 0),ct(this,K,void 0),ct(this,Na,void 0),ct(this,Be,void 0),ct(this,po,i=>{var a;(a=D(this,K))==null||a.dispatch(i)}),this.associateElement(this);let e={};yt(this,Na,i=>{Object.entries(i).forEach(([a,r])=>{if(a in e&&e[a]===r)return;this.propagateMediaState(a,r);let o=a.toLowerCase(),s=new d.CustomEvent(Dd[o],{composed:!0,detail:r});this.dispatchEvent(s)}),e=i}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(b.NO_HOTKEYS,b.HOTKEYS,b.DEFAULT_STREAM_TYPE,b.DEFAULT_SUBTITLES,b.DEFAULT_DURATION,b.LANG)}get mediaStore(){return D(this,K)}set mediaStore(e){var i,a;if(D(this,K)&&((i=D(this,Be))==null||i.call(this),yt(this,Be,void 0)),yt(this,K,e),!D(this,K)&&!this.hasAttribute(b.NO_DEFAULT_STORE)){kt(this,fo,vs).call(this);return}yt(this,Be,(a=D(this,K))==null?void 0:a.subscribe(D(this,Na)))}get fullscreenElement(){var e;return(e=D(this,Oa))!=null?e:this}set fullscreenElement(e){var i;this.hasAttribute(b.FULLSCREEN_ELEMENT)&&this.removeAttribute(b.FULLSCREEN_ELEMENT),yt(this,Oa,e),(i=D(this,K))==null||i.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return k(this,b.DEFAULT_SUBTITLES)}set defaultSubtitles(e){S(this,b.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return I(this,b.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){M(this,b.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return R(this,b.DEFAULT_DURATION)}set defaultDuration(e){O(this,b.DEFAULT_DURATION,e)}get noHotkeys(){return k(this,b.NO_HOTKEYS)}set noHotkeys(e){S(this,b.NO_HOTKEYS,e)}get keysUsed(){return I(this,b.KEYS_USED)}set keysUsed(e){M(this,b.KEYS_USED,e)}get liveEdgeOffset(){return R(this,b.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){O(this,b.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return k(this,b.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){S(this,b.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return k(this,b.NO_VOLUME_PREF)}set noVolumePref(e){S(this,b.NO_VOLUME_PREF,e)}get noSubtitlesLangPref(){return k(this,b.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){S(this,b.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return k(this,b.NO_DEFAULT_STORE)}set noDefaultStore(e){S(this,b.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,i,a){var r,o,s,l,u,m,_,g;if(super.attributeChangedCallback(e,i,a),e===b.NO_HOTKEYS)a!==i&&a===""?(this.hasAttribute(b.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):a!==i&&a===null&&this.enableHotkeys();else if(e===b.HOTKEYS)D(this,Zt).value=a;else if(e===b.DEFAULT_SUBTITLES&&a!==i)(r=D(this,K))==null||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(b.DEFAULT_SUBTITLES)}});else if(e===b.DEFAULT_STREAM_TYPE)(s=D(this,K))==null||s.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(o=this.getAttribute(b.DEFAULT_STREAM_TYPE))!=null?o:void 0}});else if(e===b.LIVE_EDGE_OFFSET)(l=D(this,K))==null||l.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(b.LIVE_EDGE_OFFSET)?+this.getAttribute(b.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(b.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(b.LIVE_EDGE_OFFSET)}});else if(e===b.SEEK_TO_LIVE_OFFSET)(u=D(this,K))==null||u.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(b.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(b.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===b.NO_AUTO_SEEK_TO_LIVE)(m=D(this,K))==null||m.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(b.NO_AUTO_SEEK_TO_LIVE)}});else if(e===b.FULLSCREEN_ELEMENT){let f=a?(_=this.getRootNode())==null?void 0:_.getElementById(a):void 0;yt(this,Oa,f),(g=D(this,K))==null||g.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===b.LANG&&a!==i&&Vd(a)}connectedCallback(){var e,i;!D(this,K)&&!this.hasAttribute(b.NO_DEFAULT_STORE)&&kt(this,fo,vs).call(this),(e=D(this,K))==null||e.dispatch({type:"documentelementchangerequest",detail:V}),super.connectedCallback(),D(this,K)&&!D(this,Be)&&yt(this,Be,(i=D(this,K))==null?void 0:i.subscribe(D(this,Na))),this.enableHotkeys()}disconnectedCallback(){var e,i,a,r;(e=super.disconnectedCallback)==null||e.call(this),D(this,K)&&((i=D(this,K))==null||i.dispatch({type:"documentelementchangerequest",detail:void 0}),(a=D(this,K))==null||a.dispatch({type:p.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),D(this,Be)&&((r=D(this,Be))==null||r.call(this),yt(this,Be,void 0))}mediaSetCallback(e){var i;super.mediaSetCallback(e),(i=D(this,K))==null||i.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var i;super.mediaUnsetCallback(e),(i=D(this,K))==null||i.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,i){_u(this.mediaStateReceivers,e,i)}associateElement(e){if(!e)return;let{associatedElementSubscriptions:i}=this;if(i.has(e))return;let a=this.registerMediaStateReceiver.bind(this),r=this.unregisterMediaStateReceiver.bind(this),o=Ih(e,a,r);Object.values(p).forEach(s=>{e.addEventListener(s,D(this,po))}),i.set(e,o)}unassociateElement(e){if(!e)return;let{associatedElementSubscriptions:i}=this;if(!i.has(e))return;i.get(e)(),i.delete(e),Object.values(p).forEach(r=>{e.removeEventListener(r,D(this,po))})}registerMediaStateReceiver(e){if(!e)return;let i=this.mediaStateReceivers;i.indexOf(e)>-1||(i.push(e),D(this,K)&&Object.entries(D(this,K).getState()).forEach(([r,o])=>{_u([e],r,o)}))}unregisterMediaStateReceiver(e){let i=this.mediaStateReceivers,a=i.indexOf(e);a<0||i.splice(a,1)}enableHotkeys(){this.addEventListener("keydown",kt(this,vo,Es))}disableHotkeys(){this.removeEventListener("keydown",kt(this,vo,Es)),this.removeEventListener("keyup",kt(this,wi,Pa))}get hotkeys(){return I(this,b.HOTKEYS)}set hotkeys(e){M(this,b.HOTKEYS,e)}keyboardShortcutHandler(e){var i,a,r,o,s;let l=e.target;if(((r=(a=(i=l.getAttribute(b.KEYS_USED))==null?void 0:i.split(" "))!=null?a:l==null?void 0:l.keysUsed)!=null?r:[]).map(f=>f==="Space"?" ":f).filter(Boolean).includes(e.key))return;let m,_,g;if(!D(this,Zt).contains(`no${e.key.toLowerCase()}`)&&!(e.key===" "&&D(this,Zt).contains("nospace")))switch(e.key){case" ":case"k":m=D(this,K).getState().mediaPaused?p.MEDIA_PLAY_REQUEST:p.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new d.CustomEvent(m,{composed:!0,bubbles:!0}));break;case"m":m=this.mediaStore.getState().mediaVolumeLevel==="off"?p.MEDIA_UNMUTE_REQUEST:p.MEDIA_MUTE_REQUEST,this.dispatchEvent(new d.CustomEvent(m,{composed:!0,bubbles:!0}));break;case"f":m=this.mediaStore.getState().mediaIsFullscreen?p.MEDIA_EXIT_FULLSCREEN_REQUEST:p.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new d.CustomEvent(m,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new d.CustomEvent(p.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{let f=this.hasAttribute(b.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(b.KEYBOARD_BACKWARD_SEEK_OFFSET):Eu;_=Math.max(((o=this.mediaStore.getState().mediaCurrentTime)!=null?o:0)-f,0),g=new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:_}),this.dispatchEvent(g);break}case"ArrowRight":{let f=this.hasAttribute(b.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(b.KEYBOARD_FORWARD_SEEK_OFFSET):Eu;_=Math.max(((s=this.mediaStore.getState().mediaCurrentTime)!=null?s:0)+f,0),g=new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:_}),this.dispatchEvent(g);break}default:break}}};Zt=new WeakMap;Oa=new WeakMap;K=new WeakMap;Na=new WeakMap;Be=new WeakMap;po=new WeakMap;fo=new WeakSet;vs=function(){var t;this.mediaStore=vu({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(b.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(b.DEFAULT_DURATION)?+this.getAttribute(b.DEFAULT_DURATION):void 0,defaultStreamType:(t=this.getAttribute(b.DEFAULT_STREAM_TYPE))!=null?t:void 0,liveEdgeOffset:this.hasAttribute(b.LIVE_EDGE_OFFSET)?+this.getAttribute(b.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(b.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(b.SEEK_TO_LIVE_OFFSET):this.hasAttribute(b.LIVE_EDGE_OFFSET)?+this.getAttribute(b.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(b.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(b.NO_VOLUME_PREF),noSubtitlesLangPref:this.hasAttribute(b.NO_SUBTITLES_LANG_PREF)}})};wi=new WeakSet;Pa=function(t){let{key:e}=t;if(!Au.includes(e)){this.removeEventListener("keyup",kt(this,wi,Pa));return}this.keyboardShortcutHandler(t)};vo=new WeakSet;Es=function(t){let{metaKey:e,altKey:i,key:a}=t;if(e||i||!Au.includes(a)){this.removeEventListener("keyup",kt(this,wi,Pa));return}[" ","ArrowLeft","ArrowRight"].includes(a)&&!(D(this,Zt).contains(`no${a.toLowerCase()}`)||a===" "&&D(this,Zt).contains("nospace"))&&t.preventDefault(),this.addEventListener("keyup",kt(this,wi,Pa),{once:!0})};var Ah=Object.values(n),Th=Object.values(jn),Tu=t=>{var e,i,a,r;let{observedAttributes:o}=t.constructor;!o&&((e=t.nodeName)!=null&&e.includes("-"))&&(d.customElements.upgrade(t),{observedAttributes:o}=t.constructor);let s=(r=(a=(i=t==null?void 0:t.getAttribute)==null?void 0:i.call(t,L.MEDIA_CHROME_ATTRIBUTES))==null?void 0:a.split)==null?void 0:r.call(a,/\s+/);return Array.isArray(o||s)?(o||s).filter(l=>Ah.includes(l)):[]},yh=t=>{var e,i;return(e=t.nodeName)!=null&&e.includes("-")&&d.customElements.get((i=t.nodeName)==null?void 0:i.toLowerCase())&&!(t instanceof d.customElements.get(t.nodeName.toLowerCase()))&&d.customElements.upgrade(t),Th.some(a=>a in t)},bs=t=>yh(t)||!!Tu(t).length,bu=t=>{var e;return(e=t==null?void 0:t.join)==null?void 0:e.call(t,":")},gu={[n.MEDIA_SUBTITLES_LIST]:ut,[n.MEDIA_SUBTITLES_SHOWING]:ut,[n.MEDIA_SEEKABLE]:bu,[n.MEDIA_BUFFERED]:t=>t==null?void 0:t.map(bu).join(" "),[n.MEDIA_PREVIEW_COORDS]:t=>t==null?void 0:t.join(" "),[n.MEDIA_RENDITION_LIST]:Nd,[n.MEDIA_AUDIO_TRACK_LIST]:Ud},kh=async(t,e,i)=>{var a,r;if(t.isConnected||await Kr(0),typeof i=="boolean"||i==null)return S(t,e,i);if(typeof i=="number")return O(t,e,i);if(typeof i=="string")return M(t,e,i);if(Array.isArray(i)&&!i.length)return t.removeAttribute(e);let o=(r=(a=gu[e])==null?void 0:a.call(gu,i))!=null?r:i;return t.setAttribute(e,o)},Sh=t=>{var e;return!!((e=t.closest)!=null&&e.call(t,'*[slot="media"]'))},qt=(t,e)=>{if(Sh(t))return;let i=(r,o)=>{var s,l;bs(r)&&o(r);let{children:u=[]}=r!=null?r:{},m=(l=(s=r==null?void 0:r.shadowRoot)==null?void 0:s.children)!=null?l:[];[...u,...m].forEach(g=>qt(g,o))},a=t==null?void 0:t.nodeName.toLowerCase();if(a.includes("-")&&!bs(t)){d.customElements.whenDefined(a).then(()=>{i(t,e)});return}i(t,e)},_u=(t,e,i)=>{t.forEach(a=>{if(e in a){a[e]=i;return}let r=Tu(a),o=e.toLowerCase();r.includes(o)&&kh(a,o,i)})},Ih=(t,e,i)=>{qt(t,e);let a=_=>{var g;let f=(g=_==null?void 0:_.composedPath()[0])!=null?g:_.target;e(f)},r=_=>{var g;let f=(g=_==null?void 0:_.composedPath()[0])!=null?g:_.target;i(f)};t.addEventListener(p.REGISTER_MEDIA_STATE_RECEIVER,a),t.addEventListener(p.UNREGISTER_MEDIA_STATE_RECEIVER,r);let o=_=>{_.forEach(g=>{let{addedNodes:f=[],removedNodes:v=[],type:N,target:T,attributeName:C}=g;N==="childList"?(Array.prototype.forEach.call(f,P=>qt(P,e)),Array.prototype.forEach.call(v,P=>qt(P,i))):N==="attributes"&&C===L.MEDIA_CHROME_ATTRIBUTES&&(bs(T)?e(T):i(T))})},s=[],l=_=>{let g=_.target;g.name!=="media"&&(s.forEach(f=>qt(f,i)),s=[...g.assignedElements({flatten:!0})],s.forEach(f=>qt(f,e)))};t.addEventListener("slotchange",l);let u=new MutationObserver(o);return u.observe(t,{childList:!0,attributes:!0,subtree:!0}),()=>{qt(t,i),t.removeEventListener("slotchange",l),u.disconnect(),t.removeEventListener(p.REGISTER_MEDIA_STATE_RECEIVER,a),t.removeEventListener(p.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};d.customElements.get("media-controller")||d.customElements.define("media-controller",Eo);var _s=Eo;var Ri={PLACEMENT:"placement",BOUNDS:"bounds"};function Mh(t){return`
159
159
  <style>
160
160
  :host {
161
161
  --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));
@@ -264,7 +264,7 @@
264
264
  </style>
265
265
  <slot></slot>
266
266
  <div id="arrow"></div>
267
- `}var xi=class extends d.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!Xr(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;let i=this.placement;if(i==="left"||i==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}let a=getComputedStyle(this),r=(e=He(this,"#"+this.bounds))!=null?e:Z(this);if(!r)return;let{x:o,width:s}=r.getBoundingClientRect(),{x:l,width:u}=this.getBoundingClientRect(),m=l+u,A=o+s,g=a.getPropertyValue("--media-tooltip-offset-x"),f=g?parseFloat(g.replace("px","")):0,v=a.getPropertyValue("--media-tooltip-container-margin"),N=v?parseFloat(v.replace("px","")):0,T=l-o+f-N,C=m-A+f+N;if(T<0){this.style.setProperty("--media-tooltip-offset-x",`${T}px`);return}if(C>0){this.style.setProperty("--media-tooltip-offset-x",`${C}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){let e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[Ri.PLACEMENT,Ri.BOUNDS]}get placement(){return I(this,Ri.PLACEMENT)}set placement(e){M(this,Ri.PLACEMENT,e)}get bounds(){return I(this,Ri.BOUNDS)}set bounds(e){M(this,Ri.BOUNDS,e)}};xi.shadowRootOptions={mode:"open"};xi.getTemplateHTML=Mh;d.customElements.get("media-tooltip")||d.customElements.define("media-tooltip",xi);var bo=xi;var Ts=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},J=(t,e,i)=>(Ts(t,e,"read from private field"),i?i.call(t):e.get(t)),Di=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},go=(t,e,i,a)=>(Ts(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Ch=(t,e,i)=>(Ts(t,e,"access private method"),i),$e,Ni,It,Oi,_o,As,yu,St={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function Lh(t,e={}){return`
267
+ `}var xi=class extends d.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!Xr(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;let i=this.placement;if(i==="left"||i==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}let a=getComputedStyle(this),r=(e=He(this,"#"+this.bounds))!=null?e:Z(this);if(!r)return;let{x:o,width:s}=r.getBoundingClientRect(),{x:l,width:u}=this.getBoundingClientRect(),m=l+u,_=o+s,g=a.getPropertyValue("--media-tooltip-offset-x"),f=g?parseFloat(g.replace("px","")):0,v=a.getPropertyValue("--media-tooltip-container-margin"),N=v?parseFloat(v.replace("px","")):0,T=l-o+f-N,C=m-_+f+N;if(T<0){this.style.setProperty("--media-tooltip-offset-x",`${T}px`);return}if(C>0){this.style.setProperty("--media-tooltip-offset-x",`${C}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){let e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[Ri.PLACEMENT,Ri.BOUNDS]}get placement(){return I(this,Ri.PLACEMENT)}set placement(e){M(this,Ri.PLACEMENT,e)}get bounds(){return I(this,Ri.BOUNDS)}set bounds(e){M(this,Ri.BOUNDS,e)}};xi.shadowRootOptions={mode:"open"};xi.getTemplateHTML=Mh;d.customElements.get("media-tooltip")||d.customElements.define("media-tooltip",xi);var bo=xi;var Ts=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},J=(t,e,i)=>(Ts(t,e,"read from private field"),i?i.call(t):e.get(t)),Di=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},go=(t,e,i,a)=>(Ts(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Ch=(t,e,i)=>(Ts(t,e,"access private method"),i),$e,Ni,It,Oi,_o,As,yu,St={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function Lh(t,e={}){return`
268
268
  <style>
269
269
  :host {
270
270
  position: relative;
@@ -1033,7 +1033,7 @@
1033
1033
  }
1034
1034
  </style>
1035
1035
  <img crossorigin loading="eager" decoding="async">
1036
- `}var Hi=class extends d.HTMLElement{constructor(){if(super(),Pp(this,qe,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[L.MEDIA_CONTROLLER,n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,i,a;let r=this.getAttribute(L.MEDIA_CONTROLLER);r&&(Yo(this,qe,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(a=(i=Go(this,qe))==null?void 0:i.associateElement)==null||a.call(i,this))}disconnectedCallback(){var e,i;(i=(e=Go(this,qe))==null?void 0:e.unassociateElement)==null||i.call(e,this),Yo(this,qe,null)}attributeChangedCallback(e,i,a){var r,o,s,l,u;[n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===L.MEDIA_CONTROLLER&&(i&&((o=(r=Go(this,qe))==null?void 0:r.unassociateElement)==null||o.call(r,this),Yo(this,qe,null)),a&&this.isConnected&&(Yo(this,qe,(s=this.getRootNode())==null?void 0:s.getElementById(a)),(u=(l=Go(this,qe))==null?void 0:l.associateElement)==null||u.call(l,this)))}get mediaPreviewImage(){return I(this,n.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){M(this,n.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){let e=this.getAttribute(n.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(i=>+i)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(n.MEDIA_PREVIEW_COORDS);return}this.setAttribute(n.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){let e=this.mediaPreviewCoords,i=this.mediaPreviewImage;if(!(e&&i))return;let[a,r,o,s]=e,l=i.split("#")[0],u=getComputedStyle(this),{maxWidth:m,maxHeight:A,minWidth:g,minHeight:f}=u,v=Math.min(parseInt(m)/o,parseInt(A)/s),N=Math.max(parseInt(g)/o,parseInt(f)/s),T=v<1,C=T?v:N>1?N:1,{style:P}=W(this.shadowRoot,":host"),j=W(this.shadowRoot,"img").style,_e=this.shadowRoot.querySelector("img"),bt=T?"min":"max";P.setProperty(`${bt}-width`,"initial","important"),P.setProperty(`${bt}-height`,"initial","important"),P.width=`${o*C}px`,P.height=`${s*C}px`;let ot=()=>{j.width=`${this.imgWidth*C}px`,j.height=`${this.imgHeight*C}px`,j.display="block"};_e.src!==l&&(_e.onload=()=>{this.imgWidth=_e.naturalWidth,this.imgHeight=_e.naturalHeight,ot()},_e.src=l,ot()),ot(),j.transform=`translate(-${a*C}px, -${r*C}px)`}};qe=new WeakMap;Hi.shadowRootOptions={mode:"open"};Hi.getTemplateHTML=Up;d.customElements.get("media-preview-thumbnail")||d.customElements.define("media-preview-thumbnail",Hi);var qo=Hi;var nc=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},oc=(t,e,i)=>(nc(t,e,"read from private field"),i?i.call(t):e.get(t)),Hp=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Bp=(t,e,i,a)=>(nc(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),er,Ks=class extends Ee{constructor(){super(),Hp(this,er,void 0),Bp(this,er,this.shadowRoot.querySelector("slot")),oc(this,er).textContent=De(0)}static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),e===n.MEDIA_PREVIEW_TIME&&a!=null&&(oc(this,er).textContent=De(parseFloat(a)))}get mediaPreviewTime(){return R(this,n.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){O(this,n.MEDIA_PREVIEW_TIME,e)}};er=new WeakMap;d.customElements.get("media-preview-time-display")||d.customElements.define("media-preview-time-display",Ks);var Bi={SEEK_OFFSET:"seekoffset"},Gs=30,$p=t=>`
1036
+ `}var Hi=class extends d.HTMLElement{constructor(){if(super(),Pp(this,qe,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[L.MEDIA_CONTROLLER,n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,i,a;let r=this.getAttribute(L.MEDIA_CONTROLLER);r&&(Yo(this,qe,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(a=(i=Go(this,qe))==null?void 0:i.associateElement)==null||a.call(i,this))}disconnectedCallback(){var e,i;(i=(e=Go(this,qe))==null?void 0:e.unassociateElement)==null||i.call(e,this),Yo(this,qe,null)}attributeChangedCallback(e,i,a){var r,o,s,l,u;[n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===L.MEDIA_CONTROLLER&&(i&&((o=(r=Go(this,qe))==null?void 0:r.unassociateElement)==null||o.call(r,this),Yo(this,qe,null)),a&&this.isConnected&&(Yo(this,qe,(s=this.getRootNode())==null?void 0:s.getElementById(a)),(u=(l=Go(this,qe))==null?void 0:l.associateElement)==null||u.call(l,this)))}get mediaPreviewImage(){return I(this,n.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){M(this,n.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){let e=this.getAttribute(n.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(i=>+i)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(n.MEDIA_PREVIEW_COORDS);return}this.setAttribute(n.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){let e=this.mediaPreviewCoords,i=this.mediaPreviewImage;if(!(e&&i))return;let[a,r,o,s]=e,l=i.split("#")[0],u=getComputedStyle(this),{maxWidth:m,maxHeight:_,minWidth:g,minHeight:f}=u,v=Math.min(parseInt(m)/o,parseInt(_)/s),N=Math.max(parseInt(g)/o,parseInt(f)/s),T=v<1,C=T?v:N>1?N:1,{style:P}=W(this.shadowRoot,":host"),j=W(this.shadowRoot,"img").style,_e=this.shadowRoot.querySelector("img"),bt=T?"min":"max";P.setProperty(`${bt}-width`,"initial","important"),P.setProperty(`${bt}-height`,"initial","important"),P.width=`${o*C}px`,P.height=`${s*C}px`;let ot=()=>{j.width=`${this.imgWidth*C}px`,j.height=`${this.imgHeight*C}px`,j.display="block"};_e.src!==l&&(_e.onload=()=>{this.imgWidth=_e.naturalWidth,this.imgHeight=_e.naturalHeight,ot()},_e.src=l,ot()),ot(),j.transform=`translate(-${a*C}px, -${r*C}px)`}};qe=new WeakMap;Hi.shadowRootOptions={mode:"open"};Hi.getTemplateHTML=Up;d.customElements.get("media-preview-thumbnail")||d.customElements.define("media-preview-thumbnail",Hi);var qo=Hi;var nc=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},oc=(t,e,i)=>(nc(t,e,"read from private field"),i?i.call(t):e.get(t)),Hp=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Bp=(t,e,i,a)=>(nc(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),er,Ks=class extends Ee{constructor(){super(),Hp(this,er,void 0),Bp(this,er,this.shadowRoot.querySelector("slot")),oc(this,er).textContent=De(0)}static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),e===n.MEDIA_PREVIEW_TIME&&a!=null&&(oc(this,er).textContent=De(parseFloat(a)))}get mediaPreviewTime(){return R(this,n.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){O(this,n.MEDIA_PREVIEW_TIME,e)}};er=new WeakMap;d.customElements.get("media-preview-time-display")||d.customElements.define("media-preview-time-display",Ks);var Bi={SEEK_OFFSET:"seekoffset"},Gs=30,$p=t=>`
1037
1037
  <svg aria-hidden="true" viewBox="0 0 20 24">
1038
1038
  <defs>
1039
1039
  <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
@@ -1271,8 +1271,8 @@
1271
1271
 
1272
1272
  </slot>
1273
1273
  </div>
1274
- `}var tn=(t,e=t.mediaCurrentTime)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;if(Number.isNaN(a))return 0;let r=(e-i)/(a-i);return Math.max(0,Math.min(r,1))},pc=(t,e=t.range.valueAsNumber)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;return Number.isNaN(a)?0:e*(a-i)+i},dr=class extends Fe{constructor(){super(),re(this,qi),re(this,js),re(this,nn),re(this,sn),re(this,ln),re(this,Qs),re(this,lr),re(this,Xs),re(this,Gi,void 0),re(this,ti,void 0),re(this,rn,void 0),re(this,or,void 0),re(this,on,void 0),re(this,an,void 0),re(this,nr,void 0),re(this,sr,void 0),re(this,Yi,void 0),re(this,zs,a=>{this.dragging||(Ai(a)&&(this.range.valueAsNumber=a),this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),ze(this,rn,this.shadowRoot.querySelectorAll('[part~="box"]')),ze(this,on,this.shadowRoot.querySelector('[part~="preview-box"]')),ze(this,an,this.shadowRoot.querySelector('[part~="current-box"]'));let i=getComputedStyle(this);ze(this,nr,parseInt(i.getPropertyValue("--media-box-padding-left"))),ze(this,sr,parseInt(i.getPropertyValue("--media-box-padding-right"))),ze(this,ti,new en(this.range,ee(this,zs),60))}static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_PAUSED,n.MEDIA_DURATION,n.MEDIA_SEEKABLE,n.MEDIA_CURRENT_TIME,n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_TIME,n.MEDIA_PREVIEW_CHAPTER,n.MEDIA_BUFFERED,n.MEDIA_PLAYBACK_RATE,n.MEDIA_LOADING,n.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",h("seek")),le(this,qi,rr).call(this),ze(this,Gi,this.getRootNode()),(e=ee(this,Gi))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),le(this,qi,rr).call(this),(e=ee(this,Gi))==null||e.removeEventListener("transitionstart",this),ze(this,Gi,null)}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),i!=a&&(e===n.MEDIA_CURRENT_TIME||e===n.MEDIA_PAUSED||e===n.MEDIA_ENDED||e===n.MEDIA_LOADING||e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE?(ee(this,ti).update({start:tn(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),le(this,qi,rr).call(this),af(this)):e===n.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=ee(this,Yi),this.updateBar()))}get mediaChaptersCues(){return ee(this,Yi)}set mediaChaptersCues(e){var i;ze(this,Yi,e),this.updateSegments((i=ee(this,Yi))==null?void 0:i.map(a=>({start:tn(this,a.startTime),end:tn(this,a.endTime)})))}get mediaPaused(){return k(this,n.MEDIA_PAUSED)}set mediaPaused(e){S(this,n.MEDIA_PAUSED,e)}get mediaLoading(){return k(this,n.MEDIA_LOADING)}set mediaLoading(e){S(this,n.MEDIA_LOADING,e)}get mediaDuration(){return R(this,n.MEDIA_DURATION)}set mediaDuration(e){O(this,n.MEDIA_DURATION,e)}get mediaCurrentTime(){return R(this,n.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){O(this,n.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return R(this,n.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){O(this,n.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){let e=this.getAttribute(n.MEDIA_BUFFERED);return e?e.split(" ").map(i=>i.split(":").map(a=>+a)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(n.MEDIA_BUFFERED);return}let i=e.map(a=>a.join(":")).join(" ");this.setAttribute(n.MEDIA_BUFFERED,i)}get mediaSeekable(){let e=this.getAttribute(n.MEDIA_SEEKABLE);if(e)return e.split(":").map(i=>+i)}set mediaSeekable(e){if(e==null){this.removeAttribute(n.MEDIA_SEEKABLE);return}this.setAttribute(n.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;let[,i=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaSeekableStart(){var e;let[i=0]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaPreviewImage(){return I(this,n.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){M(this,n.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return R(this,n.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){O(this,n.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return k(this,n.MEDIA_ENDED)}set mediaEnded(e){S(this,n.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;let i=this.mediaBuffered;if(!i.length)return;let a;if(this.mediaEnded)a=1;else{let o=this.mediaCurrentTime,[,s=this.mediaSeekableStart]=(e=i.find(([l,u])=>l<=o&&o<=u))!=null?e:[];a=tn(this,s)}let{style:r}=W(this.shadowRoot,"#buffered");r.setProperty("width",`${a*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let i=W(this.shadowRoot,"#current-rail"),a=W(this.shadowRoot,'[part~="current-box"]'),r=le(this,nn,el).call(this,ee(this,an)),o=le(this,sn,tl).call(this,r,this.range.valueAsNumber),s=le(this,ln,il).call(this,r,this.range.valueAsNumber);i.style.transform=`translateX(${o})`,i.style.setProperty("--_range-width",`${r.range.width}`),a.style.setProperty("--_box-shift",`${s}`),a.style.setProperty("--_box-width",`${r.box.width}px`),a.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":le(this,Xs,hc).call(this);break;case"pointermove":le(this,Qs,mc).call(this,e);break;case"pointerup":case"pointerleave":le(this,lr,dn).call(this,null);break;case"transitionstart":ue(e.target,this)&&setTimeout(()=>le(this,qi,rr).call(this),0);break}}};Gi=new WeakMap;ti=new WeakMap;rn=new WeakMap;or=new WeakMap;on=new WeakMap;an=new WeakMap;nr=new WeakMap;sr=new WeakMap;Yi=new WeakMap;qi=new WeakSet;rr=function(){le(this,js,cc).call(this)?ee(this,ti).start():ee(this,ti).stop()};js=new WeakSet;cc=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&Xr(this)};zs=new WeakMap;nn=new WeakSet;el=function(t){var e;let a=((e=this.getAttribute("bounds")?He(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),o=t.offsetWidth,s=-(r.left-a.left-o/2),l=a.right-r.left-o/2;return{box:{width:o,min:s,max:l},bounds:a,range:r}};sn=new WeakSet;tl=function(t,e){let i=`${e*100}%`,{width:a,min:r,max:o}=t.box;if(!a)return i;if(Number.isNaN(r)||(i=`max(${`calc(1 / var(--_range-width) * 100 * ${r}% + var(--media-box-padding-left))`}, ${i})`),!Number.isNaN(o)){let l=`calc(1 / var(--_range-width) * 100 * ${o}% - var(--media-box-padding-right))`;i=`min(${i}, ${l})`}return i};ln=new WeakSet;il=function(t,e){let{width:i,min:a,max:r}=t.box,o=e*t.range.width;if(o<a+ee(this,nr)){let s=t.range.left-t.bounds.left-ee(this,nr);return`${o-i/2+s}px`}if(o>r-ee(this,sr)){let s=t.bounds.right-t.range.right-ee(this,sr);return`${o+i/2-s-t.range.width}px`}return 0};Qs=new WeakSet;mc=function(t){let e=[...ee(this,rn)].some(A=>t.composedPath().includes(A));if(!this.dragging&&(e||!t.composedPath().includes(this))){le(this,lr,dn).call(this,null);return}let i=this.mediaSeekableEnd;if(!i)return;let a=W(this.shadowRoot,"#preview-rail"),r=W(this.shadowRoot,'[part~="preview-box"]'),o=le(this,nn,el).call(this,ee(this,on)),s=(t.clientX-o.range.left)/o.range.width;s=Math.max(0,Math.min(1,s));let l=le(this,sn,tl).call(this,o,s),u=le(this,ln,il).call(this,o,s);a.style.transform=`translateX(${l})`,a.style.setProperty("--_range-width",`${o.range.width}`),r.style.setProperty("--_box-shift",`${u}`),r.style.setProperty("--_box-width",`${o.box.width}px`);let m=Math.round(ee(this,or))-Math.round(s*i);Math.abs(m)<1&&s>.01&&s<.99||(ze(this,or,s*i),le(this,lr,dn).call(this,ee(this,or)))};lr=new WeakSet;dn=function(t){this.dispatchEvent(new d.CustomEvent(p.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:t}))};Xs=new WeakSet;hc=function(){ee(this,ti).stop();let t=pc(this);this.dispatchEvent(new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t}))};dr.shadowRootOptions={mode:"open"};dr.getTemplateHTML=rf;d.customElements.get("media-time-range")||d.customElements.define("media-time-range",dr);var of=1,nf=t=>t.mediaMuted?0:t.mediaVolume,sf=t=>`${Math.round(t*100)}%`,al=class extends Fe{static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_VOLUME,n.MEDIA_MUTED,n.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{let e=this.range.value,i=new d.CustomEvent(p.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(i)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",h("volume"))}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),(e===n.MEDIA_VOLUME||e===n.MEDIA_MUTED)&&(this.range.valueAsNumber=nf(this),this.range.setAttribute("aria-valuetext",sf(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return R(this,n.MEDIA_VOLUME,of)}set mediaVolume(e){O(this,n.MEDIA_VOLUME,e)}get mediaMuted(){return k(this,n.MEDIA_MUTED)}set mediaMuted(e){S(this,n.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return I(this,n.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){M(this,n.MEDIA_VOLUME_UNAVAILABLE,e)}};d.customElements.get("media-volume-range")||d.customElements.define("media-volume-range",al);var E=Bm(require("@mux/mux-video")),w=require("@mux/playback-core");var kc=require("@mux/mux-video");var _c=require("@mux/playback-core");var ri=require("@mux/playback-core");function fc(t){let e="";return Object.entries(t).forEach(([i,a])=>{a!=null&&(e+=`${un(i)}: ${a}; `)}),e?e.trim():void 0}function un(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function cn(t){return t.replace(/[-_]([a-z])/g,(e,i)=>i.toUpperCase())}function ce(t){if(t==null)return;let e=+t;return Number.isNaN(e)?void 0:e}function rl(t){let e=lf(t).toString();return e?"?"+e:""}function lf(t){let e={};for(let i in t)t[i]!=null&&(e[i]=t[i]);return new URLSearchParams(e)}var ol=(t,e)=>!t||!e?!1:t.contains(e)?!0:ol(t,e.getRootNode().host);var vc="mux.com",df=()=>{try{return"3.4.1"}catch{}return"UNKNOWN"},uf=df(),hn=()=>uf,Ec=(t,{token:e,customDomain:i=vc,thumbnailTime:a,programTime:r}={})=>{var l;let o=e==null?a:void 0,{aud:s}=(l=(0,ri.parseJwt)(e))!=null?l:{};if(!(e&&s!=="t"))return`https://image.${i}/${t}/thumbnail.webp${rl({token:e,time:o,program_time:r})}`},bc=(t,{token:e,customDomain:i=vc,programStartTime:a,programEndTime:r}={})=>{var s;let{aud:o}=(s=(0,ri.parseJwt)(e))!=null?s:{};if(!(e&&o!=="s"))return`https://image.${i}/${t}/storyboard.vtt${rl({token:e,format:"webp",program_start_time:a,program_end_time:r})}`},ur=t=>{if(t){if([ri.StreamTypes.LIVE,ri.StreamTypes.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return ri.StreamTypes.LIVE}};var cf={crossorigin:"crossOrigin",playsinline:"playsInline"};function gc(t){var e;return(e=cf[t])!=null?e:cn(t)}var ii,ai,me,mn=class{constructor(e,i){pe(this,ii);pe(this,ai);pe(this,me,[]);ye(this,ii,e),ye(this,ai,i)}[Symbol.iterator](){return U(this,me).values()}get length(){return U(this,me).length}get value(){var e;return(e=U(this,me).join(" "))!=null?e:""}set value(e){var i;e!==this.value&&(ye(this,me,[]),this.add(...(i=e==null?void 0:e.split(" "))!=null?i:[]))}toString(){return this.value}item(e){return U(this,me)[e]}values(){return U(this,me).values()}keys(){return U(this,me).keys()}forEach(e){U(this,me).forEach(e)}add(...e){var i,a;e.forEach(r=>{this.contains(r)||U(this,me).push(r)}),!(this.value===""&&!((i=U(this,ii))!=null&&i.hasAttribute(`${U(this,ai)}`)))&&((a=U(this,ii))==null||a.setAttribute(`${U(this,ai)}`,`${this.value}`))}remove(...e){var i;e.forEach(a=>{U(this,me).splice(U(this,me).indexOf(a),1)}),(i=U(this,ii))==null||i.setAttribute(`${U(this,ai)}`,`${this.value}`)}contains(e){return U(this,me).includes(e)}toggle(e,i){return typeof i!="undefined"?i?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,i){this.remove(e),this.add(i)}};ii=new WeakMap,ai=new WeakMap,me=new WeakMap;var Ac=`[mux-player ${hn()}]`;function Qe(...t){console.warn(Ac,...t)}function be(...t){console.error(Ac,...t)}function nl(t){var i;let e=(i=t.message)!=null?i:"";t.context&&(e+=` ${t.context}`),t.file&&(e+=` ${(0,_c.i18n)("Read more: ")}
1275
- https://github.com/muxinc/elements/blob/main/errors/${t.file}`),Qe(e)}var de={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},oi={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},yc=Object.freeze({length:0,start(t){let e=t>>>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(t){let e=t>>>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}}),mf=kc.VideoEvents.filter(t=>t!=="error"),hf=Object.values(de).filter(t=>![de.PLAYSINLINE].includes(t)),pf=Object.values(oi),sl=class extends se.HTMLElement{static get observedAttributes(){return[...hf,...pf]}constructor(){super()}init(){mf.forEach(e=>{var i;(i=this.media)==null||i.addEventListener(e,a=>{this.dispatchEvent(new Event(a.type))})})}attributeChangedCallback(e,i,a){var r,o;switch(e){case oi.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case oi.VOLUME:{let s=(r=ce(a))!=null?r:1;this.media&&(this.media.volume=s);return}case oi.PLAYBACKRATE:{let s=(o=ce(a))!=null?o:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);return}}}play(){var e,i;return(i=(e=this.media)==null?void 0:e.play())!=null?i:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}load(){var e;(e=this.media)==null||e.load()}requestCast(e){var i;return(i=this.media)==null?void 0:i.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,i;return(i=(e=this.media)==null?void 0:e.paused)!=null?i:!0}get duration(){var e,i;return(i=(e=this.media)==null?void 0:e.duration)!=null?i:NaN}get ended(){var e,i;return(i=(e=this.media)==null?void 0:e.ended)!=null?i:!1}get buffered(){var e,i;return(i=(e=this.media)==null?void 0:e.buffered)!=null?i:yc}get seekable(){var e,i;return(i=(e=this.media)==null?void 0:e.seekable)!=null?i:yc}get readyState(){var e,i;return(i=(e=this.media)==null?void 0:e.readyState)!=null?i:0}get videoWidth(){var e,i;return(i=(e=this.media)==null?void 0:e.videoWidth)!=null?i:0}get videoHeight(){var e,i;return(i=(e=this.media)==null?void 0:e.videoHeight)!=null?i:0}get currentSrc(){var e,i;return(i=(e=this.media)==null?void 0:e.currentSrc)!=null?i:""}get currentTime(){var e,i;return(i=(e=this.media)==null?void 0:e.currentTime)!=null?i:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,i;return(i=(e=this.media)==null?void 0:e.volume)!=null?i:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,i;return(i=(e=this.media)==null?void 0:e.playbackRate)!=null?i:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=ce(this.getAttribute(oi.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(oi.PLAYBACKRATE,`${e}`):this.removeAttribute(oi.PLAYBACKRATE)}get crossOrigin(){return cr(this,de.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(de.CROSSORIGIN,`${e}`)}get autoplay(){return cr(this,de.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(de.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(de.AUTOPLAY)}get loop(){return cr(this,de.LOOP)!=null}set loop(e){e?this.setAttribute(de.LOOP,""):this.removeAttribute(de.LOOP)}get muted(){var e,i;return(i=(e=this.media)==null?void 0:e.muted)!=null?i:!1}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return cr(this,de.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(de.MUTED,""):this.removeAttribute(de.MUTED)}get playsInline(){return cr(this,de.PLAYSINLINE)!=null}set playsInline(e){be("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(de.PRELOAD,e):this.removeAttribute(de.PRELOAD)}};function cr(t,e){return t.media?t.media.getAttribute(e):t.getAttribute(e)}var ll=sl;var Lc=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},x=(t,e,i)=>(Lc(t,e,"read from private field"),i?i.call(t):e.get(t)),Xe=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},ht=(t,e,i,a)=>(Lc(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Zi,pn,ni,mr,wt,Rt,xt,si,zi,fn,Pe,Sc=1,Ic=0,ff=1,vf={processCallback(t,e,i){if(i){for(let[a,r]of e)if(a in i){let o=i[a];typeof o=="boolean"&&r instanceof he&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=o:typeof o=="function"&&r instanceof he?r.element[r.attributeName]=o:r.value=o}}}},pt=class extends d.DocumentFragment{constructor(e,i,a=vf){var r;super(),Xe(this,Zi,void 0),Xe(this,pn,void 0),this.append(e.content.cloneNode(!0)),ht(this,Zi,wc(this)),ht(this,pn,a),(r=a.createCallback)==null||r.call(a,this,x(this,Zi),i),a.processCallback(this,x(this,Zi),i)}update(e){x(this,pn).processCallback(this,x(this,Zi),e)}};Zi=new WeakMap;pn=new WeakMap;var wc=(t,e=[])=>{let i,a;for(let r of t.attributes||[])if(r.value.includes("{{")){let o=new dl;for([i,a]of Cc(r.value))if(!i)o.append(a);else{let s=new he(t,r.name,r.namespaceURI);o.append(s),e.push([a,s])}r.value=o.toString()}for(let r of t.childNodes)if(r.nodeType===Sc&&!(r instanceof HTMLTemplateElement))wc(r,e);else{let o=r.data;if(r.nodeType===Sc||o.includes("{{")){let s=[];if(o)for([i,a]of Cc(o))if(!i)s.push(new Text(a));else{let l=new ft(t);s.push(l),e.push([a,l])}else if(r instanceof HTMLTemplateElement){let l=new hr(t,r);s.push(l),e.push([l.expression,l])}r.replaceWith(...s.flatMap(l=>l.replacementNodes||[l]))}}return e},Mc={},Cc=t=>{let e="",i=0,a=Mc[t],r=0,o;if(a)return a;for(a=[];o=t[r];r++)o==="{"&&t[r+1]==="{"&&t[r-1]!=="\\"&&t[r+2]&&++i==1?(e&&a.push([Ic,e]),e="",r++):o==="}"&&t[r+1]==="}"&&t[r-1]!=="\\"&&!--i?(a.push([ff,e.trim()]),e="",r++):e+=o||"";return e&&a.push([Ic,(i>0?"{{":"")+e]),Mc[t]=a},Ef=11,vn=class{get value(){return""}set value(e){}toString(){return this.value}},Rc=new WeakMap,dl=class{constructor(){Xe(this,ni,[])}[Symbol.iterator](){return x(this,ni).values()}get length(){return x(this,ni).length}item(e){return x(this,ni)[e]}append(...e){for(let i of e)i instanceof he&&Rc.set(i,this),x(this,ni).push(i)}toString(){return x(this,ni).join("")}};ni=new WeakMap;var he=class extends vn{constructor(e,i,a){super(),Xe(this,si),Xe(this,mr,""),Xe(this,wt,void 0),Xe(this,Rt,void 0),Xe(this,xt,void 0),ht(this,wt,e),ht(this,Rt,i),ht(this,xt,a)}get attributeName(){return x(this,Rt)}get attributeNamespace(){return x(this,xt)}get element(){return x(this,wt)}get value(){return x(this,mr)}set value(e){x(this,mr)!==e&&(ht(this,mr,e),!x(this,si,zi)||x(this,si,zi).length===1?e==null?x(this,wt).removeAttributeNS(x(this,xt),x(this,Rt)):x(this,wt).setAttributeNS(x(this,xt),x(this,Rt),e):x(this,wt).setAttributeNS(x(this,xt),x(this,Rt),x(this,si,zi).toString()))}get booleanValue(){return x(this,wt).hasAttributeNS(x(this,xt),x(this,Rt))}set booleanValue(e){if(!x(this,si,zi)||x(this,si,zi).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};mr=new WeakMap;wt=new WeakMap;Rt=new WeakMap;xt=new WeakMap;si=new WeakSet;zi=function(){return Rc.get(this)};var ft=class extends vn{constructor(e,i){super(),Xe(this,fn,void 0),Xe(this,Pe,void 0),ht(this,fn,e),ht(this,Pe,i?[...i]:[new Text])}get replacementNodes(){return x(this,Pe)}get parentNode(){return x(this,fn)}get nextSibling(){return x(this,Pe)[x(this,Pe).length-1].nextSibling}get previousSibling(){return x(this,Pe)[0].previousSibling}get value(){return x(this,Pe).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let i=e.flat().flatMap(a=>a==null?[new Text]:a.forEach?[...a]:a.nodeType===Ef?[...a.childNodes]:a.nodeType?[a]:[new Text(a)]);i.length||i.push(new Text),ht(this,Pe,bf(x(this,Pe)[0].parentNode,x(this,Pe),i,this.nextSibling))}};fn=new WeakMap;Pe=new WeakMap;var hr=class extends ft{constructor(e,i){let a=i.getAttribute("directive")||i.getAttribute("type"),r=i.getAttribute("expression")||i.getAttribute(a)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),this.expression=r,this.template=i,this.directive=a}};function bf(t,e,i,a=null){let r=0,o,s,l,u=i.length,m=e.length;for(;r<u&&r<m&&e[r]==i[r];)r++;for(;r<u&&r<m&&i[u-1]==e[m-1];)a=i[--m,--u];if(r==m)for(;r<u;)t.insertBefore(i[r++],a);if(r==u)for(;r<m;)t.removeChild(e[r++]);else{for(o=e[r];r<u;)l=i[r++],s=o?o.nextSibling:a,o==l?o=s:r<u&&i[r]==s?(t.replaceChild(l,o),o=s):t.insertBefore(l,o);for(;o!=a;)s=o.nextSibling,t.removeChild(o),o=s}return i}var xc={string:t=>String(t)},bn=class{constructor(e){this.template=e,this.state=void 0}},li=new WeakMap,di=new WeakMap,ul={partial:(t,e)=>{e[t.expression]=new bn(t.template)},if:(t,e)=>{var i;if(Oc(t.expression,e))if(li.get(t)!==t.template){li.set(t,t.template);let a=new pt(t.template,e,gn);t.replace(a),di.set(t,a)}else(i=di.get(t))==null||i.update(e);else t.replace(""),li.delete(t),di.delete(t)}},gf=Object.keys(ul),gn={processCallback(t,e,i){var a,r;if(i)for(let[o,s]of e){if(s instanceof hr){if(!s.directive){let u=gf.find(m=>s.template.hasAttribute(m));u&&(s.directive=u,s.expression=s.template.getAttribute(u))}(a=ul[s.directive])==null||a.call(ul,s,i);continue}let l=Oc(o,i);if(l instanceof bn){li.get(s)!==l.template?(li.set(s,l.template),l=new pt(l.template,l.state,gn),s.value=l,di.set(s,l)):(r=di.get(s))==null||r.update(l.state);continue}l?(s instanceof he&&s.attributeName.startsWith("aria-")&&(l=String(l)),s instanceof he?typeof l=="boolean"?s.booleanValue=l:typeof l=="function"?s.element[s.attributeName]=l:s.value=l:(s.value=l,li.delete(s),di.delete(s))):s instanceof he?s.value=void 0:(s.value=void 0,li.delete(s),di.delete(s))}}},Dc={"!":t=>!t,"!!":t=>!!t,"==":(t,e)=>t==e,"!=":(t,e)=>t!=e,">":(t,e)=>t>e,">=":(t,e)=>t>=e,"<":(t,e)=>t<e,"<=":(t,e)=>t<=e,"??":(t,e)=>t!=null?t:e,"|":(t,e)=>{var i;return(i=xc[e])==null?void 0:i.call(xc,t)}};function _f(t){return Af(t,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function Oc(t,e={}){var i,a,r,o,s,l,u;let m=_f(t);if(m.length===0||m.some(({type:A})=>!A))return pr(t);if(((i=m[0])==null?void 0:i.token)===">"){let A=e[(a=m[1])==null?void 0:a.token];if(!A)return pr(t);let g={...e};A.state=g;let f=m.slice(2);for(let v=0;v<f.length;v+=3){let N=(r=f[v])==null?void 0:r.token,T=(o=f[v+1])==null?void 0:o.token,C=(s=f[v+2])==null?void 0:s.token;N&&T==="="&&(g[N]=fr(C,e))}return A}if(m.length===1)return En(m[0])?fr(m[0].token,e):pr(t);if(m.length===2){let A=(l=m[0])==null?void 0:l.token,g=Dc[A];if(!g||!En(m[1]))return pr(t);let f=fr(m[1].token,e);return g(f)}if(m.length===3){let A=(u=m[1])==null?void 0:u.token,g=Dc[A];if(!g||!En(m[0])||!En(m[2]))return pr(t);let f=fr(m[0].token,e);if(A==="|")return g(f,m[2].token);let v=fr(m[2].token,e);return g(f,v)}}function pr(t){return console.warn(`Warning: invalid expression \`${t}\``),!1}function En({type:t}){return["number","boolean","string","param"].includes(t)}function fr(t,e){let i=t[0],a=t.slice(-1);return t==="true"||t==="false"?t==="true":i===a&&["'",'"'].includes(i)?t.slice(1,-1):Vr(t)?parseFloat(t):e[t]}function Af(t,e){let i,a,r,o=[];for(;t;){r=null,i=t.length;for(let s in e)a=e[s].exec(t),a&&a.index<i&&(r={token:a[0],type:s,matches:a.slice(1)},i=a.index);i&&o.push({token:t.substr(0,i),type:void 0}),r&&o.push(r),t=t.substr(i+(r?r.token.length:0))}return o}var vl=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},hl=(t,e,i)=>(vl(t,e,"read from private field"),i?i.call(t):e.get(t)),vr=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},ui=(t,e,i,a)=>(vl(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),cl=(t,e,i)=>(vl(t,e,"access private method"),i),Qi,_n,Xi,pl,Nc,An,fl,ml={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Pc=V.createElement("template");Pc.innerHTML=`
1274
+ `}var tn=(t,e=t.mediaCurrentTime)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;if(Number.isNaN(a))return 0;let r=(e-i)/(a-i);return Math.max(0,Math.min(r,1))},pc=(t,e=t.range.valueAsNumber)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;return Number.isNaN(a)?0:e*(a-i)+i},dr=class extends Fe{constructor(){super(),re(this,qi),re(this,js),re(this,nn),re(this,sn),re(this,ln),re(this,Qs),re(this,lr),re(this,Xs),re(this,Gi,void 0),re(this,ti,void 0),re(this,rn,void 0),re(this,or,void 0),re(this,on,void 0),re(this,an,void 0),re(this,nr,void 0),re(this,sr,void 0),re(this,Yi,void 0),re(this,zs,a=>{this.dragging||(Ai(a)&&(this.range.valueAsNumber=a),this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),ze(this,rn,this.shadowRoot.querySelectorAll('[part~="box"]')),ze(this,on,this.shadowRoot.querySelector('[part~="preview-box"]')),ze(this,an,this.shadowRoot.querySelector('[part~="current-box"]'));let i=getComputedStyle(this);ze(this,nr,parseInt(i.getPropertyValue("--media-box-padding-left"))),ze(this,sr,parseInt(i.getPropertyValue("--media-box-padding-right"))),ze(this,ti,new en(this.range,ee(this,zs),60))}static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_PAUSED,n.MEDIA_DURATION,n.MEDIA_SEEKABLE,n.MEDIA_CURRENT_TIME,n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_TIME,n.MEDIA_PREVIEW_CHAPTER,n.MEDIA_BUFFERED,n.MEDIA_PLAYBACK_RATE,n.MEDIA_LOADING,n.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",h("seek")),le(this,qi,rr).call(this),ze(this,Gi,this.getRootNode()),(e=ee(this,Gi))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),le(this,qi,rr).call(this),(e=ee(this,Gi))==null||e.removeEventListener("transitionstart",this),ze(this,Gi,null)}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),i!=a&&(e===n.MEDIA_CURRENT_TIME||e===n.MEDIA_PAUSED||e===n.MEDIA_ENDED||e===n.MEDIA_LOADING||e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE?(ee(this,ti).update({start:tn(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),le(this,qi,rr).call(this),af(this)):e===n.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=ee(this,Yi),this.updateBar()))}get mediaChaptersCues(){return ee(this,Yi)}set mediaChaptersCues(e){var i;ze(this,Yi,e),this.updateSegments((i=ee(this,Yi))==null?void 0:i.map(a=>({start:tn(this,a.startTime),end:tn(this,a.endTime)})))}get mediaPaused(){return k(this,n.MEDIA_PAUSED)}set mediaPaused(e){S(this,n.MEDIA_PAUSED,e)}get mediaLoading(){return k(this,n.MEDIA_LOADING)}set mediaLoading(e){S(this,n.MEDIA_LOADING,e)}get mediaDuration(){return R(this,n.MEDIA_DURATION)}set mediaDuration(e){O(this,n.MEDIA_DURATION,e)}get mediaCurrentTime(){return R(this,n.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){O(this,n.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return R(this,n.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){O(this,n.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){let e=this.getAttribute(n.MEDIA_BUFFERED);return e?e.split(" ").map(i=>i.split(":").map(a=>+a)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(n.MEDIA_BUFFERED);return}let i=e.map(a=>a.join(":")).join(" ");this.setAttribute(n.MEDIA_BUFFERED,i)}get mediaSeekable(){let e=this.getAttribute(n.MEDIA_SEEKABLE);if(e)return e.split(":").map(i=>+i)}set mediaSeekable(e){if(e==null){this.removeAttribute(n.MEDIA_SEEKABLE);return}this.setAttribute(n.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;let[,i=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaSeekableStart(){var e;let[i=0]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaPreviewImage(){return I(this,n.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){M(this,n.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return R(this,n.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){O(this,n.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return k(this,n.MEDIA_ENDED)}set mediaEnded(e){S(this,n.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;let i=this.mediaBuffered;if(!i.length)return;let a;if(this.mediaEnded)a=1;else{let o=this.mediaCurrentTime,[,s=this.mediaSeekableStart]=(e=i.find(([l,u])=>l<=o&&o<=u))!=null?e:[];a=tn(this,s)}let{style:r}=W(this.shadowRoot,"#buffered");r.setProperty("width",`${a*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let i=W(this.shadowRoot,"#current-rail"),a=W(this.shadowRoot,'[part~="current-box"]'),r=le(this,nn,el).call(this,ee(this,an)),o=le(this,sn,tl).call(this,r,this.range.valueAsNumber),s=le(this,ln,il).call(this,r,this.range.valueAsNumber);i.style.transform=`translateX(${o})`,i.style.setProperty("--_range-width",`${r.range.width}`),a.style.setProperty("--_box-shift",`${s}`),a.style.setProperty("--_box-width",`${r.box.width}px`),a.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":le(this,Xs,hc).call(this);break;case"pointermove":le(this,Qs,mc).call(this,e);break;case"pointerup":case"pointerleave":le(this,lr,dn).call(this,null);break;case"transitionstart":ue(e.target,this)&&setTimeout(()=>le(this,qi,rr).call(this),0);break}}};Gi=new WeakMap;ti=new WeakMap;rn=new WeakMap;or=new WeakMap;on=new WeakMap;an=new WeakMap;nr=new WeakMap;sr=new WeakMap;Yi=new WeakMap;qi=new WeakSet;rr=function(){le(this,js,cc).call(this)?ee(this,ti).start():ee(this,ti).stop()};js=new WeakSet;cc=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&Xr(this)};zs=new WeakMap;nn=new WeakSet;el=function(t){var e;let a=((e=this.getAttribute("bounds")?He(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),o=t.offsetWidth,s=-(r.left-a.left-o/2),l=a.right-r.left-o/2;return{box:{width:o,min:s,max:l},bounds:a,range:r}};sn=new WeakSet;tl=function(t,e){let i=`${e*100}%`,{width:a,min:r,max:o}=t.box;if(!a)return i;if(Number.isNaN(r)||(i=`max(${`calc(1 / var(--_range-width) * 100 * ${r}% + var(--media-box-padding-left))`}, ${i})`),!Number.isNaN(o)){let l=`calc(1 / var(--_range-width) * 100 * ${o}% - var(--media-box-padding-right))`;i=`min(${i}, ${l})`}return i};ln=new WeakSet;il=function(t,e){let{width:i,min:a,max:r}=t.box,o=e*t.range.width;if(o<a+ee(this,nr)){let s=t.range.left-t.bounds.left-ee(this,nr);return`${o-i/2+s}px`}if(o>r-ee(this,sr)){let s=t.bounds.right-t.range.right-ee(this,sr);return`${o+i/2-s-t.range.width}px`}return 0};Qs=new WeakSet;mc=function(t){let e=[...ee(this,rn)].some(_=>t.composedPath().includes(_));if(!this.dragging&&(e||!t.composedPath().includes(this))){le(this,lr,dn).call(this,null);return}let i=this.mediaSeekableEnd;if(!i)return;let a=W(this.shadowRoot,"#preview-rail"),r=W(this.shadowRoot,'[part~="preview-box"]'),o=le(this,nn,el).call(this,ee(this,on)),s=(t.clientX-o.range.left)/o.range.width;s=Math.max(0,Math.min(1,s));let l=le(this,sn,tl).call(this,o,s),u=le(this,ln,il).call(this,o,s);a.style.transform=`translateX(${l})`,a.style.setProperty("--_range-width",`${o.range.width}`),r.style.setProperty("--_box-shift",`${u}`),r.style.setProperty("--_box-width",`${o.box.width}px`);let m=Math.round(ee(this,or))-Math.round(s*i);Math.abs(m)<1&&s>.01&&s<.99||(ze(this,or,s*i),le(this,lr,dn).call(this,ee(this,or)))};lr=new WeakSet;dn=function(t){this.dispatchEvent(new d.CustomEvent(p.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:t}))};Xs=new WeakSet;hc=function(){ee(this,ti).stop();let t=pc(this);this.dispatchEvent(new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t}))};dr.shadowRootOptions={mode:"open"};dr.getTemplateHTML=rf;d.customElements.get("media-time-range")||d.customElements.define("media-time-range",dr);var of=1,nf=t=>t.mediaMuted?0:t.mediaVolume,sf=t=>`${Math.round(t*100)}%`,al=class extends Fe{static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_VOLUME,n.MEDIA_MUTED,n.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{let e=this.range.value,i=new d.CustomEvent(p.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(i)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",h("volume"))}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),(e===n.MEDIA_VOLUME||e===n.MEDIA_MUTED)&&(this.range.valueAsNumber=nf(this),this.range.setAttribute("aria-valuetext",sf(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return R(this,n.MEDIA_VOLUME,of)}set mediaVolume(e){O(this,n.MEDIA_VOLUME,e)}get mediaMuted(){return k(this,n.MEDIA_MUTED)}set mediaMuted(e){S(this,n.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return I(this,n.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){M(this,n.MEDIA_VOLUME_UNAVAILABLE,e)}};d.customElements.get("media-volume-range")||d.customElements.define("media-volume-range",al);var E=Bm(require("@mux/mux-video")),w=require("@mux/playback-core");var kc=require("@mux/mux-video");var _c=require("@mux/playback-core");var ri=require("@mux/playback-core");function fc(t){let e="";return Object.entries(t).forEach(([i,a])=>{a!=null&&(e+=`${un(i)}: ${a}; `)}),e?e.trim():void 0}function un(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function cn(t){return t.replace(/[-_]([a-z])/g,(e,i)=>i.toUpperCase())}function ce(t){if(t==null)return;let e=+t;return Number.isNaN(e)?void 0:e}function rl(t){let e=lf(t).toString();return e?"?"+e:""}function lf(t){let e={};for(let i in t)t[i]!=null&&(e[i]=t[i]);return new URLSearchParams(e)}var ol=(t,e)=>!t||!e?!1:t.contains(e)?!0:ol(t,e.getRootNode().host);var vc="mux.com",df=()=>{try{return"3.4.1"}catch{}return"UNKNOWN"},uf=df(),hn=()=>uf,Ec=(t,{token:e,customDomain:i=vc,thumbnailTime:a,programTime:r}={})=>{var l;let o=e==null?a:void 0,{aud:s}=(l=(0,ri.parseJwt)(e))!=null?l:{};if(!(e&&s!=="t"))return`https://image.${i}/${t}/thumbnail.webp${rl({token:e,time:o,program_time:r})}`},bc=(t,{token:e,customDomain:i=vc,programStartTime:a,programEndTime:r}={})=>{var s;let{aud:o}=(s=(0,ri.parseJwt)(e))!=null?s:{};if(!(e&&o!=="s"))return`https://image.${i}/${t}/storyboard.vtt${rl({token:e,format:"webp",program_start_time:a,program_end_time:r})}`},ur=t=>{if(t){if([ri.StreamTypes.LIVE,ri.StreamTypes.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return ri.StreamTypes.LIVE}};var cf={crossorigin:"crossOrigin",playsinline:"playsInline"};function gc(t){var e;return(e=cf[t])!=null?e:cn(t)}var ii,ai,me,mn=class{constructor(e,i){pe(this,ii);pe(this,ai);pe(this,me,[]);ye(this,ii,e),ye(this,ai,i)}[Symbol.iterator](){return U(this,me).values()}get length(){return U(this,me).length}get value(){var e;return(e=U(this,me).join(" "))!=null?e:""}set value(e){var i;e!==this.value&&(ye(this,me,[]),this.add(...(i=e==null?void 0:e.split(" "))!=null?i:[]))}toString(){return this.value}item(e){return U(this,me)[e]}values(){return U(this,me).values()}keys(){return U(this,me).keys()}forEach(e){U(this,me).forEach(e)}add(...e){var i,a;e.forEach(r=>{this.contains(r)||U(this,me).push(r)}),!(this.value===""&&!((i=U(this,ii))!=null&&i.hasAttribute(`${U(this,ai)}`)))&&((a=U(this,ii))==null||a.setAttribute(`${U(this,ai)}`,`${this.value}`))}remove(...e){var i;e.forEach(a=>{U(this,me).splice(U(this,me).indexOf(a),1)}),(i=U(this,ii))==null||i.setAttribute(`${U(this,ai)}`,`${this.value}`)}contains(e){return U(this,me).includes(e)}toggle(e,i){return typeof i!="undefined"?i?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,i){this.remove(e),this.add(i)}};ii=new WeakMap,ai=new WeakMap,me=new WeakMap;var Ac=`[mux-player ${hn()}]`;function Qe(...t){console.warn(Ac,...t)}function be(...t){console.error(Ac,...t)}function nl(t){var i;let e=(i=t.message)!=null?i:"";t.context&&(e+=` ${t.context}`),t.file&&(e+=` ${(0,_c.i18n)("Read more: ")}
1275
+ https://github.com/muxinc/elements/blob/main/errors/${t.file}`),Qe(e)}var de={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},oi={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},yc=Object.freeze({length:0,start(t){let e=t>>>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(t){let e=t>>>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}}),mf=kc.VideoEvents.filter(t=>t!=="error"),hf=Object.values(de).filter(t=>![de.PLAYSINLINE].includes(t)),pf=Object.values(oi),sl=class extends se.HTMLElement{static get observedAttributes(){return[...hf,...pf]}constructor(){super()}init(){mf.forEach(e=>{var i;(i=this.media)==null||i.addEventListener(e,a=>{this.dispatchEvent(new Event(a.type))})})}attributeChangedCallback(e,i,a){var r,o;switch(e){case oi.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case oi.VOLUME:{let s=(r=ce(a))!=null?r:1;this.media&&(this.media.volume=s);return}case oi.PLAYBACKRATE:{let s=(o=ce(a))!=null?o:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);return}}}play(){var e,i;return(i=(e=this.media)==null?void 0:e.play())!=null?i:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}load(){var e;(e=this.media)==null||e.load()}requestCast(e){var i;return(i=this.media)==null?void 0:i.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,i;return(i=(e=this.media)==null?void 0:e.paused)!=null?i:!0}get duration(){var e,i;return(i=(e=this.media)==null?void 0:e.duration)!=null?i:NaN}get ended(){var e,i;return(i=(e=this.media)==null?void 0:e.ended)!=null?i:!1}get buffered(){var e,i;return(i=(e=this.media)==null?void 0:e.buffered)!=null?i:yc}get seekable(){var e,i;return(i=(e=this.media)==null?void 0:e.seekable)!=null?i:yc}get readyState(){var e,i;return(i=(e=this.media)==null?void 0:e.readyState)!=null?i:0}get videoWidth(){var e,i;return(i=(e=this.media)==null?void 0:e.videoWidth)!=null?i:0}get videoHeight(){var e,i;return(i=(e=this.media)==null?void 0:e.videoHeight)!=null?i:0}get currentSrc(){var e,i;return(i=(e=this.media)==null?void 0:e.currentSrc)!=null?i:""}get currentTime(){var e,i;return(i=(e=this.media)==null?void 0:e.currentTime)!=null?i:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,i;return(i=(e=this.media)==null?void 0:e.volume)!=null?i:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,i;return(i=(e=this.media)==null?void 0:e.playbackRate)!=null?i:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=ce(this.getAttribute(oi.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(oi.PLAYBACKRATE,`${e}`):this.removeAttribute(oi.PLAYBACKRATE)}get crossOrigin(){return cr(this,de.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(de.CROSSORIGIN,`${e}`)}get autoplay(){return cr(this,de.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(de.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(de.AUTOPLAY)}get loop(){return cr(this,de.LOOP)!=null}set loop(e){e?this.setAttribute(de.LOOP,""):this.removeAttribute(de.LOOP)}get muted(){var e,i;return(i=(e=this.media)==null?void 0:e.muted)!=null?i:!1}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return cr(this,de.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(de.MUTED,""):this.removeAttribute(de.MUTED)}get playsInline(){return cr(this,de.PLAYSINLINE)!=null}set playsInline(e){be("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(de.PRELOAD,e):this.removeAttribute(de.PRELOAD)}};function cr(t,e){return t.media?t.media.getAttribute(e):t.getAttribute(e)}var ll=sl;var Lc=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},x=(t,e,i)=>(Lc(t,e,"read from private field"),i?i.call(t):e.get(t)),Xe=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},ht=(t,e,i,a)=>(Lc(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),Zi,pn,ni,mr,wt,Rt,xt,si,zi,fn,Pe,Sc=1,Ic=0,ff=1,vf={processCallback(t,e,i){if(i){for(let[a,r]of e)if(a in i){let o=i[a];typeof o=="boolean"&&r instanceof he&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=o:typeof o=="function"&&r instanceof he?r.element[r.attributeName]=o:r.value=o}}}},pt=class extends d.DocumentFragment{constructor(e,i,a=vf){var r;super(),Xe(this,Zi,void 0),Xe(this,pn,void 0),this.append(e.content.cloneNode(!0)),ht(this,Zi,wc(this)),ht(this,pn,a),(r=a.createCallback)==null||r.call(a,this,x(this,Zi),i),a.processCallback(this,x(this,Zi),i)}update(e){x(this,pn).processCallback(this,x(this,Zi),e)}};Zi=new WeakMap;pn=new WeakMap;var wc=(t,e=[])=>{let i,a;for(let r of t.attributes||[])if(r.value.includes("{{")){let o=new dl;for([i,a]of Cc(r.value))if(!i)o.append(a);else{let s=new he(t,r.name,r.namespaceURI);o.append(s),e.push([a,s])}r.value=o.toString()}for(let r of t.childNodes)if(r.nodeType===Sc&&!(r instanceof HTMLTemplateElement))wc(r,e);else{let o=r.data;if(r.nodeType===Sc||o.includes("{{")){let s=[];if(o)for([i,a]of Cc(o))if(!i)s.push(new Text(a));else{let l=new ft(t);s.push(l),e.push([a,l])}else if(r instanceof HTMLTemplateElement){let l=new hr(t,r);s.push(l),e.push([l.expression,l])}r.replaceWith(...s.flatMap(l=>l.replacementNodes||[l]))}}return e},Mc={},Cc=t=>{let e="",i=0,a=Mc[t],r=0,o;if(a)return a;for(a=[];o=t[r];r++)o==="{"&&t[r+1]==="{"&&t[r-1]!=="\\"&&t[r+2]&&++i==1?(e&&a.push([Ic,e]),e="",r++):o==="}"&&t[r+1]==="}"&&t[r-1]!=="\\"&&!--i?(a.push([ff,e.trim()]),e="",r++):e+=o||"";return e&&a.push([Ic,(i>0?"{{":"")+e]),Mc[t]=a},Ef=11,vn=class{get value(){return""}set value(e){}toString(){return this.value}},Rc=new WeakMap,dl=class{constructor(){Xe(this,ni,[])}[Symbol.iterator](){return x(this,ni).values()}get length(){return x(this,ni).length}item(e){return x(this,ni)[e]}append(...e){for(let i of e)i instanceof he&&Rc.set(i,this),x(this,ni).push(i)}toString(){return x(this,ni).join("")}};ni=new WeakMap;var he=class extends vn{constructor(e,i,a){super(),Xe(this,si),Xe(this,mr,""),Xe(this,wt,void 0),Xe(this,Rt,void 0),Xe(this,xt,void 0),ht(this,wt,e),ht(this,Rt,i),ht(this,xt,a)}get attributeName(){return x(this,Rt)}get attributeNamespace(){return x(this,xt)}get element(){return x(this,wt)}get value(){return x(this,mr)}set value(e){x(this,mr)!==e&&(ht(this,mr,e),!x(this,si,zi)||x(this,si,zi).length===1?e==null?x(this,wt).removeAttributeNS(x(this,xt),x(this,Rt)):x(this,wt).setAttributeNS(x(this,xt),x(this,Rt),e):x(this,wt).setAttributeNS(x(this,xt),x(this,Rt),x(this,si,zi).toString()))}get booleanValue(){return x(this,wt).hasAttributeNS(x(this,xt),x(this,Rt))}set booleanValue(e){if(!x(this,si,zi)||x(this,si,zi).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};mr=new WeakMap;wt=new WeakMap;Rt=new WeakMap;xt=new WeakMap;si=new WeakSet;zi=function(){return Rc.get(this)};var ft=class extends vn{constructor(e,i){super(),Xe(this,fn,void 0),Xe(this,Pe,void 0),ht(this,fn,e),ht(this,Pe,i?[...i]:[new Text])}get replacementNodes(){return x(this,Pe)}get parentNode(){return x(this,fn)}get nextSibling(){return x(this,Pe)[x(this,Pe).length-1].nextSibling}get previousSibling(){return x(this,Pe)[0].previousSibling}get value(){return x(this,Pe).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let i=e.flat().flatMap(a=>a==null?[new Text]:a.forEach?[...a]:a.nodeType===Ef?[...a.childNodes]:a.nodeType?[a]:[new Text(a)]);i.length||i.push(new Text),ht(this,Pe,bf(x(this,Pe)[0].parentNode,x(this,Pe),i,this.nextSibling))}};fn=new WeakMap;Pe=new WeakMap;var hr=class extends ft{constructor(e,i){let a=i.getAttribute("directive")||i.getAttribute("type"),r=i.getAttribute("expression")||i.getAttribute(a)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),this.expression=r,this.template=i,this.directive=a}};function bf(t,e,i,a=null){let r=0,o,s,l,u=i.length,m=e.length;for(;r<u&&r<m&&e[r]==i[r];)r++;for(;r<u&&r<m&&i[u-1]==e[m-1];)a=i[--m,--u];if(r==m)for(;r<u;)t.insertBefore(i[r++],a);if(r==u)for(;r<m;)t.removeChild(e[r++]);else{for(o=e[r];r<u;)l=i[r++],s=o?o.nextSibling:a,o==l?o=s:r<u&&i[r]==s?(t.replaceChild(l,o),o=s):t.insertBefore(l,o);for(;o!=a;)s=o.nextSibling,t.removeChild(o),o=s}return i}var xc={string:t=>String(t)},bn=class{constructor(e){this.template=e,this.state=void 0}},li=new WeakMap,di=new WeakMap,ul={partial:(t,e)=>{e[t.expression]=new bn(t.template)},if:(t,e)=>{var i;if(Oc(t.expression,e))if(li.get(t)!==t.template){li.set(t,t.template);let a=new pt(t.template,e,gn);t.replace(a),di.set(t,a)}else(i=di.get(t))==null||i.update(e);else t.replace(""),li.delete(t),di.delete(t)}},gf=Object.keys(ul),gn={processCallback(t,e,i){var a,r;if(i)for(let[o,s]of e){if(s instanceof hr){if(!s.directive){let u=gf.find(m=>s.template.hasAttribute(m));u&&(s.directive=u,s.expression=s.template.getAttribute(u))}(a=ul[s.directive])==null||a.call(ul,s,i);continue}let l=Oc(o,i);if(l instanceof bn){li.get(s)!==l.template?(li.set(s,l.template),l=new pt(l.template,l.state,gn),s.value=l,di.set(s,l)):(r=di.get(s))==null||r.update(l.state);continue}l?(s instanceof he&&s.attributeName.startsWith("aria-")&&(l=String(l)),s instanceof he?typeof l=="boolean"?s.booleanValue=l:typeof l=="function"?s.element[s.attributeName]=l:s.value=l:(s.value=l,li.delete(s),di.delete(s))):s instanceof he?s.value=void 0:(s.value=void 0,li.delete(s),di.delete(s))}}},Dc={"!":t=>!t,"!!":t=>!!t,"==":(t,e)=>t==e,"!=":(t,e)=>t!=e,">":(t,e)=>t>e,">=":(t,e)=>t>=e,"<":(t,e)=>t<e,"<=":(t,e)=>t<=e,"??":(t,e)=>t!=null?t:e,"|":(t,e)=>{var i;return(i=xc[e])==null?void 0:i.call(xc,t)}};function _f(t){return Af(t,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function Oc(t,e={}){var i,a,r,o,s,l,u;let m=_f(t);if(m.length===0||m.some(({type:_})=>!_))return pr(t);if(((i=m[0])==null?void 0:i.token)===">"){let _=e[(a=m[1])==null?void 0:a.token];if(!_)return pr(t);let g={...e};_.state=g;let f=m.slice(2);for(let v=0;v<f.length;v+=3){let N=(r=f[v])==null?void 0:r.token,T=(o=f[v+1])==null?void 0:o.token,C=(s=f[v+2])==null?void 0:s.token;N&&T==="="&&(g[N]=fr(C,e))}return _}if(m.length===1)return En(m[0])?fr(m[0].token,e):pr(t);if(m.length===2){let _=(l=m[0])==null?void 0:l.token,g=Dc[_];if(!g||!En(m[1]))return pr(t);let f=fr(m[1].token,e);return g(f)}if(m.length===3){let _=(u=m[1])==null?void 0:u.token,g=Dc[_];if(!g||!En(m[0])||!En(m[2]))return pr(t);let f=fr(m[0].token,e);if(_==="|")return g(f,m[2].token);let v=fr(m[2].token,e);return g(f,v)}}function pr(t){return console.warn(`Warning: invalid expression \`${t}\``),!1}function En({type:t}){return["number","boolean","string","param"].includes(t)}function fr(t,e){let i=t[0],a=t.slice(-1);return t==="true"||t==="false"?t==="true":i===a&&["'",'"'].includes(i)?t.slice(1,-1):Vr(t)?parseFloat(t):e[t]}function Af(t,e){let i,a,r,o=[];for(;t;){r=null,i=t.length;for(let s in e)a=e[s].exec(t),a&&a.index<i&&(r={token:a[0],type:s,matches:a.slice(1)},i=a.index);i&&o.push({token:t.substr(0,i),type:void 0}),r&&o.push(r),t=t.substr(i+(r?r.token.length:0))}return o}var vl=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},hl=(t,e,i)=>(vl(t,e,"read from private field"),i?i.call(t):e.get(t)),vr=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},ui=(t,e,i,a)=>(vl(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),cl=(t,e,i)=>(vl(t,e,"access private method"),i),Qi,_n,Xi,pl,Nc,An,fl,ml={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Pc=V.createElement("template");Pc.innerHTML=`
1276
1276
  <style>
1277
1277
  :host {
1278
1278
  display: inline-block;
@@ -1455,7 +1455,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1455
1455
  ${Uc}
1456
1456
  </style>
1457
1457
  ${Hf(t)}
1458
- `,Nf=t=>{let e=t.hotKeys?`${t.hotKeys}`:"";return ur(t.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},Pf={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"},Uf=Object.values(Pf).join(", "),Hf=t=>{var e,i,a,r,o,s,l,u,m,A,g,f,v,N,T,C,P,j,_e,bt,ot,ca,ma,ha,pa,fa,va,Ea,ba,ga,_a,Aa,Wr,nt,Ta;return br`
1458
+ `,Nf=t=>{let e=t.hotKeys?`${t.hotKeys}`:"";return ur(t.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},Pf={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"},Uf=Object.values(Pf).join(", "),Hf=t=>{var e,i,a,r,o,s,l,u,m,_,g,f,v,N,T,C,P,j,_e,bt,ot,ca,ma,ha,pa,fa,va,Ea,ba,ga,_a,Aa,Wr,nt,Ta;return br`
1459
1459
  <media-theme
1460
1460
  template="${t.themeTemplate||!1}"
1461
1461
  defaultstreamtype="${(e=t.defaultStreamType)!=null?e:!1}"
@@ -1472,7 +1472,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1472
1472
  playbackrates="${(l=t.playbackRates)!=null?l:!1}"
1473
1473
  defaultshowremainingtime="${(u=t.defaultShowRemainingTime)!=null?u:!1}"
1474
1474
  defaultduration="${(m=t.defaultDuration)!=null?m:!1}"
1475
- hideduration="${(A=t.hideDuration)!=null?A:!1}"
1475
+ hideduration="${(_=t.hideDuration)!=null?_:!1}"
1476
1476
  title="${(g=t.title)!=null?g:!1}"
1477
1477
  videotitle="${(f=t.videoTitle)!=null?f:!1}"
1478
1478
  proudlydisplaymuxbadge="${(v=t.proudlyDisplayMuxBadge)!=null?v:!1}"
@@ -1520,7 +1520,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1520
1520
  ></media-poster-image>
1521
1521
  </slot>
1522
1522
  </media-theme>
1523
- `};var _=require("@mux/playback-core"),Fc=t=>t.charAt(0).toUpperCase()+t.slice(1),Bf=(t,e=!1)=>{var i,a;if(t.muxCode){let r=Fc((i=t.errorCategory)!=null?i:"video"),o=(0,_.errorCategoryToTokenNameOrPrefix)((a=t.errorCategory)!=null?a:_.MuxErrorCategory.VIDEO);if(t.muxCode===_.MuxErrorCode.NETWORK_OFFLINE)return(0,_.i18n)("Your device appears to be offline",e);if(t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_EXPIRED)return(0,_.i18n)("{category} URL has expired",e).format({category:r});if([_.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH,_.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,_.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING,_.MuxErrorCode.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return(0,_.i18n)("{category} URL is formatted incorrectly",e).format({category:r});if(t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_MISSING)return(0,_.i18n)("Invalid {categoryName} URL",e).format({categoryName:o});if(t.muxCode===_.MuxErrorCode.NETWORK_NOT_FOUND)return(0,_.i18n)("{category} does not exist",e).format({category:r});if(t.muxCode===_.MuxErrorCode.NETWORK_NOT_READY)return(0,_.i18n)("{category} is not currently available",e).format({category:r})}if(t.code){if(t.code===_.MediaError.MEDIA_ERR_NETWORK)return(0,_.i18n)("Network Error",e);if(t.code===_.MediaError.MEDIA_ERR_DECODE)return(0,_.i18n)("Media Error",e);if(t.code===_.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)return(0,_.i18n)("Source Not Supported",e)}return(0,_.i18n)("Error",e)},$f=(t,e=!1)=>{var i,a;if(t.muxCode){let r=Fc((i=t.errorCategory)!=null?i:"video"),o=(0,_.errorCategoryToTokenNameOrPrefix)((a=t.errorCategory)!=null?a:_.MuxErrorCategory.VIDEO);return t.muxCode===_.MuxErrorCode.NETWORK_OFFLINE?(0,_.i18n)("Check your internet connection and try reloading this video.",e):t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_EXPIRED?(0,_.i18n)("The video\u2019s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:o}):t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH?(0,_.i18n)("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:o}):t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_MALFORMED?(0,_.i18n)("{category} URL is formatted incorrectly",e).format({category:r}):[_.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,_.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?(0,_.i18n)("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:o}):[_.MuxErrorCode.NETWORK_TOKEN_MISSING,_.MuxErrorCode.NETWORK_INVALID_URL].includes(t.muxCode)?(0,_.i18n)("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:o}):t.muxCode===_.MuxErrorCode.NETWORK_NOT_FOUND?"":t.muxCode===_.MuxErrorCode.NETWORK_NOT_READY?(0,_.i18n)("The live stream or video file are not yet ready.",e):t.message}return t.code&&(t.code===_.MediaError.MEDIA_ERR_NETWORK||t.code===_.MediaError.MEDIA_ERR_DECODE||t.code===_.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},Vc=(t,e=!1)=>{let i=Bf(t,e).toString(),a=$f(t,e).toString();return{title:i,message:a}},Wf=t=>{if(t.muxCode){if(t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([_.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,_.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===_.MuxErrorCode.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===_.MuxErrorCode.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===_.MuxErrorCode.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===_.MediaError.MEDIA_ERR_NETWORK)return"";if(t.code===_.MediaError.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===_.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},gl=(t,e)=>{let i=Wf(t);return{message:t.message,context:t.context,file:i}};var Kc=`<template id="media-theme-gerwig">
1523
+ `};var A=require("@mux/playback-core"),Fc=t=>t.charAt(0).toUpperCase()+t.slice(1),Bf=(t,e=!1)=>{var i,a;if(t.muxCode){let r=Fc((i=t.errorCategory)!=null?i:"video"),o=(0,A.errorCategoryToTokenNameOrPrefix)((a=t.errorCategory)!=null?a:A.MuxErrorCategory.VIDEO);if(t.muxCode===A.MuxErrorCode.NETWORK_OFFLINE)return(0,A.i18n)("Your device appears to be offline",e);if(t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_EXPIRED)return(0,A.i18n)("{category} URL has expired",e).format({category:r});if([A.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH,A.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,A.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING,A.MuxErrorCode.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return(0,A.i18n)("{category} URL is formatted incorrectly",e).format({category:r});if(t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_MISSING)return(0,A.i18n)("Invalid {categoryName} URL",e).format({categoryName:o});if(t.muxCode===A.MuxErrorCode.NETWORK_NOT_FOUND)return(0,A.i18n)("{category} does not exist",e).format({category:r});if(t.muxCode===A.MuxErrorCode.NETWORK_NOT_READY){let s=t.streamType==="live"?"Live stream":"Video";return(0,A.i18n)("{mediaType} is not currently available",e).format({mediaType:s})}}if(t.code){if(t.code===A.MediaError.MEDIA_ERR_NETWORK)return(0,A.i18n)("Network Error",e);if(t.code===A.MediaError.MEDIA_ERR_DECODE)return(0,A.i18n)("Media Error",e);if(t.code===A.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)return(0,A.i18n)("Source Not Supported",e)}return(0,A.i18n)("Error",e)},$f=(t,e=!1)=>{var i,a;if(t.muxCode){let r=Fc((i=t.errorCategory)!=null?i:"video"),o=(0,A.errorCategoryToTokenNameOrPrefix)((a=t.errorCategory)!=null?a:A.MuxErrorCategory.VIDEO);return t.muxCode===A.MuxErrorCode.NETWORK_OFFLINE?(0,A.i18n)("Check your internet connection and try reloading this video.",e):t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_EXPIRED?(0,A.i18n)("The video\u2019s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:o}):t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH?(0,A.i18n)("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:o}):t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_MALFORMED?(0,A.i18n)("{category} URL is formatted incorrectly",e).format({category:r}):[A.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,A.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?(0,A.i18n)("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:o}):[A.MuxErrorCode.NETWORK_TOKEN_MISSING,A.MuxErrorCode.NETWORK_INVALID_URL].includes(t.muxCode)?(0,A.i18n)("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:o}):t.muxCode===A.MuxErrorCode.NETWORK_NOT_FOUND?"":t.message}return t.code&&(t.code===A.MediaError.MEDIA_ERR_NETWORK||t.code===A.MediaError.MEDIA_ERR_DECODE||t.code===A.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},Vc=(t,e=!1)=>{let i=Bf(t,e).toString(),a=$f(t,e).toString();return{title:i,message:a}},Wf=t=>{if(t.muxCode){if(t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([A.MuxErrorCode.NETWORK_TOKEN_AUD_MISMATCH,A.MuxErrorCode.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===A.MuxErrorCode.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===A.MuxErrorCode.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===A.MuxErrorCode.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===A.MediaError.MEDIA_ERR_NETWORK)return"";if(t.code===A.MediaError.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===A.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},gl=(t,e)=>{let i=Wf(t);return{message:t.message,context:t.context,file:i}};var Kc=`<template id="media-theme-gerwig">
1524
1524
  <style>
1525
1525
  @keyframes pre-play-hide {
1526
1526
  0% {
@@ -2822,7 +2822,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
2822
2822
  <slot></slot>
2823
2823
  </div>
2824
2824
  <slot name="checked-indicator" hidden></slot>
2825
- `}var mi={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},oe=class extends d.HTMLElement{constructor(){if(super(),G(this,_l),G(this,In),G(this,Tl),G(this,yl),G(this,kl),G(this,ea),G(this,Ln),G(this,Sl),G(this,Dl),G(this,Il),G(this,Ol),G(this,Ml),G(this,Cl),G(this,_r),G(this,Ll),G(this,Ar),G(this,Mn),G(this,je,null),G(this,hi,null),G(this,Ot,null),G(this,kn,new Set),G(this,Sn,void 0),G(this,pi,!1),G(this,Tr,null),G(this,Cn,()=>{let e=H(this,kn),i=new Set(this.items);for(let a of e)i.has(a)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:a}));for(let a of i)e.has(a)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:a}));Je(this,kn,i)}),G(this,Ji,()=>{q(this,ea,yr).call(this),q(this,Ln,xl).call(this,!1)}),G(this,ji,()=>{q(this,ea,yr).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),Je(this,Sn,new MutationObserver(H(this,Cn))),H(this,Sn).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[mi.DISABLED,mi.HIDDEN,mi.STYLE,mi.ANCHOR,L.MEDIA_CONTROLLER]}static formatMenuItemText(e,i){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":q(this,_l,qc).call(this,e);break;case"invoke":q(this,Tl,Zc).call(this,e);break;case"click":q(this,Sl,Xc).call(this,e);break;case"toggle":q(this,Il,jc).call(this,e);break;case"focusout":q(this,Ml,tm).call(this,e);break;case"keydown":q(this,Cl,im).call(this,e);break}}connectedCallback(){var e,i;Je(this,Tr,os(this.shadowRoot,":host")),q(this,In,Al).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Je(this,je,Zr(this)),(i=(e=H(this,je))==null?void 0:e.associateElement)==null||i.call(e,this),this.hidden||(st(kr(this),H(this,Ji)),st(this,H(this,ji)))}disconnectedCallback(){var e,i;lt(kr(this),H(this,Ji)),lt(this,H(this,ji)),this.disable(),(i=(e=H(this,je))==null?void 0:e.unassociateElement)==null||i.call(e,this),Je(this,je,null)}attributeChangedCallback(e,i,a){var r,o,s,l;e===mi.HIDDEN&&a!==i?(H(this,pi)||Je(this,pi,!0),this.hidden?q(this,kl,Qc).call(this):q(this,yl,zc).call(this),this.dispatchEvent(new yn({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===L.MEDIA_CONTROLLER?(i&&((o=(r=H(this,je))==null?void 0:r.unassociateElement)==null||o.call(r,this),Je(this,je,null)),a&&this.isConnected&&(Je(this,je,Zr(this)),(l=(s=H(this,je))==null?void 0:s.associateElement)==null||l.call(s,this))):e===mi.DISABLED&&a!==i?a==null?this.enable():this.disable():e===mi.STYLE&&a!==i&&q(this,In,Al).call(this)}formatMenuItemText(e,i){return this.constructor.formatMenuItemText(e,i)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=$t(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(Zf)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,i;return(i=(e=this.checkedItems[0])==null?void 0:e.value)!=null?i:""}set value(e){let i=this.items.find(a=>a.value===e);i&&q(this,Mn,wl).call(this,i)}focus(){if(Je(this,hi,Ma()),this.items.length){q(this,Ar,Rn).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 i;let a=q(this,_r,wn).call(this,e);a&&(q(this,Mn,wl).call(this,a,a.type==="checkbox"),H(this,Ot)&&!this.hidden&&((i=H(this,hi))==null||i.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var i,a;let{key:r}=e,o=this.items,s=(a=(i=q(this,_r,wn).call(this,e))!=null?i:q(this,Ll,am).call(this))!=null?a:o[0],l=o.indexOf(s),u=Math.max(0,l);r==="ArrowDown"?u++:r==="ArrowUp"?u--:e.key==="Home"?u=0:e.key==="End"&&(u=o.length-1),u<0&&(u=o.length-1),u>o.length-1&&(u=0),q(this,Ar,Rn).call(this,o[u]),o[u].focus()}};je=new WeakMap;hi=new WeakMap;Ot=new WeakMap;kn=new WeakMap;Sn=new WeakMap;pi=new WeakMap;Tr=new WeakMap;_l=new WeakSet;qc=function(t){let e=t.target;for(let i of e.assignedNodes({flatten:!0}))i.nodeType===3&&i.textContent.trim()===""&&i.remove();if(["header","title"].includes(e.name)){let i=this.shadowRoot.querySelector('slot[name="header"]');i.hidden=e.assignedNodes().length===0}e.name||H(this,Cn).call(this)};Cn=new WeakMap;In=new WeakSet;Al=function(){var t;let e=this.shadowRoot.querySelector("#layout-row"),i=(t=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:t.trim();e.setAttribute("media",i==="row"?"":"width:0")};Tl=new WeakSet;Zc=function(t){Je(this,Ot,t.relatedTarget),ue(this,t.relatedTarget)||(this.hidden=!this.hidden)};yl=new WeakSet;zc=function(){var t;(t=H(this,Ot))==null||t.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),st(kr(this),H(this,Ji)),st(this,H(this,ji))};kl=new WeakSet;Qc=function(){var t;(t=H(this,Ot))==null||t.setAttribute("aria-expanded","false"),lt(kr(this),H(this,Ji)),lt(this,H(this,ji))};Ji=new WeakMap;ji=new WeakMap;ea=new WeakSet;yr=function(t){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:e,y:i}=Gc({anchor:this.anchorElement,floating:this,placement:"top-start"});t!=null||(t=this.offsetWidth);let r=kr(this).getBoundingClientRect(),o=r.width-e-t,s=r.height-i-this.offsetHeight,{style:l}=H(this,Tr);l.setProperty("position","absolute"),l.setProperty("right",`${Math.max(0,o)}px`),l.setProperty("--_menu-bottom",`${s}px`);let u=getComputedStyle(this),A=l.getPropertyValue("--_menu-bottom")===u.bottom?s:parseFloat(u.bottom),g=r.height-A-parseFloat(u.marginBottom);this.style.setProperty("--_menu-max-height",`${g}px`)};Ln=new WeakSet;xl=function(t){let e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=e==null?void 0:e.querySelector('[role="menu"]'),{style:a}=H(this,Tr);if(t||a.setProperty("--media-menu-transition-in","none"),i){let r=i.offsetHeight,o=Math.max(i.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${o}px`),this.style.setProperty("min-height",`${r}px`),q(this,ea,yr).call(this,o)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),q(this,ea,yr).call(this);a.removeProperty("--media-menu-transition-in")};Sl=new WeakSet;Xc=function(t){var e;if(t.stopPropagation(),t.composedPath().includes(H(this,Dl,Jc))){(e=H(this,hi))==null||e.focus(),this.hidden=!0;return}let i=q(this,_r,wn).call(this,t);!i||i.hasAttribute("disabled")||(q(this,Ar,Rn).call(this,i),this.handleSelect(t))};Dl=new WeakSet;Jc=function(){var t;return(t=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:t.find(i=>i.matches('button[part~="back"]'))};Il=new WeakSet;jc=function(t){if(t.target===this)return;q(this,Ol,em).call(this);let e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of e)i.invokeTargetElement!=t.target&&t.newState=="open"&&i.getAttribute("aria-expanded")=="true"&&!i.invokeTargetElement.hidden&&i.invokeTargetElement.dispatchEvent(new Dt({relatedTarget:i}));for(let i of e)i.setAttribute("aria-expanded",`${!i.submenuElement.hidden}`);q(this,Ln,xl).call(this,!0)};Ol=new WeakSet;em=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};Ml=new WeakSet;tm=function(t){var e;ue(this,t.relatedTarget)||(H(this,pi)&&((e=H(this,hi))==null||e.focus()),H(this,Ot)&&H(this,Ot)!==t.relatedTarget&&!this.hidden&&(this.hidden=!0))};Cl=new WeakSet;im=function(t){var e,i,a,r,o;let{key:s,ctrlKey:l,altKey:u,metaKey:m}=t;if(!(l||u||m)&&this.keysUsed.includes(s))if(t.preventDefault(),t.stopPropagation(),s==="Tab"){if(H(this,pi)){this.hidden=!0;return}t.shiftKey?(i=(e=this.previousElementSibling)==null?void 0:e.focus)==null||i.call(e):(r=(a=this.nextElementSibling)==null?void 0:a.focus)==null||r.call(a),this.blur()}else s==="Escape"?((o=H(this,hi))==null||o.focus(),H(this,pi)&&(this.hidden=!0)):s==="Enter"||s===" "?this.handleSelect(t):this.handleMove(t)};_r=new WeakSet;wn=function(t){return t.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};Ll=new WeakSet;am=function(){return this.items.find(t=>t.tabIndex===0)};Ar=new WeakSet;Rn=function(t){for(let e of this.items)e.tabIndex=e===t?0:-1};Mn=new WeakSet;wl=function(t,e){let i=[...this.checkedItems];t.type==="radio"&&this.radioGroupItems.forEach(a=>a.checked=!1),e?t.checked=!t.checked:t.checked=!0,this.checkedItems.some((a,r)=>a!=i[r])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};oe.shadowRootOptions={mode:"open"};oe.getTemplateHTML=qf;function Zf(t){return["menuitem","menuitemradio","menuitemcheckbox"].includes(t==null?void 0:t.role)}function kr(t){var e;return(e=t.getAttribute("bounds")?He(t,`#${t.getAttribute("bounds")}`):Z(t)||t.parentElement)!=null?e:t}d.customElements.get("media-chrome-menu")||d.customElements.define("media-chrome-menu",oe);var $l=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},it=(t,e,i)=>($l(t,e,"read from private field"),i?i.call(t):e.get(t)),vt=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Nl=(t,e,i,a)=>($l(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),tt=(t,e,i)=>($l(t,e,"access private method"),i),xn,Ir,Pl,rm,Wl,om,Fl,nm,at,ta,Mr,Ul,sm,Dn,Hl;function zf(t){return`
2825
+ `}var mi={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},oe=class extends d.HTMLElement{constructor(){if(super(),G(this,_l),G(this,In),G(this,Tl),G(this,yl),G(this,kl),G(this,ea),G(this,Ln),G(this,Sl),G(this,Dl),G(this,Il),G(this,Ol),G(this,Ml),G(this,Cl),G(this,_r),G(this,Ll),G(this,Ar),G(this,Mn),G(this,je,null),G(this,hi,null),G(this,Ot,null),G(this,kn,new Set),G(this,Sn,void 0),G(this,pi,!1),G(this,Tr,null),G(this,Cn,()=>{let e=H(this,kn),i=new Set(this.items);for(let a of e)i.has(a)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:a}));for(let a of i)e.has(a)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:a}));Je(this,kn,i)}),G(this,Ji,()=>{q(this,ea,yr).call(this),q(this,Ln,xl).call(this,!1)}),G(this,ji,()=>{q(this,ea,yr).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=Y(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),Je(this,Sn,new MutationObserver(H(this,Cn))),H(this,Sn).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[mi.DISABLED,mi.HIDDEN,mi.STYLE,mi.ANCHOR,L.MEDIA_CONTROLLER]}static formatMenuItemText(e,i){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":q(this,_l,qc).call(this,e);break;case"invoke":q(this,Tl,Zc).call(this,e);break;case"click":q(this,Sl,Xc).call(this,e);break;case"toggle":q(this,Il,jc).call(this,e);break;case"focusout":q(this,Ml,tm).call(this,e);break;case"keydown":q(this,Cl,im).call(this,e);break}}connectedCallback(){var e,i;Je(this,Tr,os(this.shadowRoot,":host")),q(this,In,Al).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Je(this,je,Zr(this)),(i=(e=H(this,je))==null?void 0:e.associateElement)==null||i.call(e,this),this.hidden||(st(kr(this),H(this,Ji)),st(this,H(this,ji)))}disconnectedCallback(){var e,i;lt(kr(this),H(this,Ji)),lt(this,H(this,ji)),this.disable(),(i=(e=H(this,je))==null?void 0:e.unassociateElement)==null||i.call(e,this),Je(this,je,null)}attributeChangedCallback(e,i,a){var r,o,s,l;e===mi.HIDDEN&&a!==i?(H(this,pi)||Je(this,pi,!0),this.hidden?q(this,kl,Qc).call(this):q(this,yl,zc).call(this),this.dispatchEvent(new yn({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===L.MEDIA_CONTROLLER?(i&&((o=(r=H(this,je))==null?void 0:r.unassociateElement)==null||o.call(r,this),Je(this,je,null)),a&&this.isConnected&&(Je(this,je,Zr(this)),(l=(s=H(this,je))==null?void 0:s.associateElement)==null||l.call(s,this))):e===mi.DISABLED&&a!==i?a==null?this.enable():this.disable():e===mi.STYLE&&a!==i&&q(this,In,Al).call(this)}formatMenuItemText(e,i){return this.constructor.formatMenuItemText(e,i)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=$t(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(Zf)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,i;return(i=(e=this.checkedItems[0])==null?void 0:e.value)!=null?i:""}set value(e){let i=this.items.find(a=>a.value===e);i&&q(this,Mn,wl).call(this,i)}focus(){if(Je(this,hi,Ma()),this.items.length){q(this,Ar,Rn).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 i;let a=q(this,_r,wn).call(this,e);a&&(q(this,Mn,wl).call(this,a,a.type==="checkbox"),H(this,Ot)&&!this.hidden&&((i=H(this,hi))==null||i.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var i,a;let{key:r}=e,o=this.items,s=(a=(i=q(this,_r,wn).call(this,e))!=null?i:q(this,Ll,am).call(this))!=null?a:o[0],l=o.indexOf(s),u=Math.max(0,l);r==="ArrowDown"?u++:r==="ArrowUp"?u--:e.key==="Home"?u=0:e.key==="End"&&(u=o.length-1),u<0&&(u=o.length-1),u>o.length-1&&(u=0),q(this,Ar,Rn).call(this,o[u]),o[u].focus()}};je=new WeakMap;hi=new WeakMap;Ot=new WeakMap;kn=new WeakMap;Sn=new WeakMap;pi=new WeakMap;Tr=new WeakMap;_l=new WeakSet;qc=function(t){let e=t.target;for(let i of e.assignedNodes({flatten:!0}))i.nodeType===3&&i.textContent.trim()===""&&i.remove();if(["header","title"].includes(e.name)){let i=this.shadowRoot.querySelector('slot[name="header"]');i.hidden=e.assignedNodes().length===0}e.name||H(this,Cn).call(this)};Cn=new WeakMap;In=new WeakSet;Al=function(){var t;let e=this.shadowRoot.querySelector("#layout-row"),i=(t=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:t.trim();e.setAttribute("media",i==="row"?"":"width:0")};Tl=new WeakSet;Zc=function(t){Je(this,Ot,t.relatedTarget),ue(this,t.relatedTarget)||(this.hidden=!this.hidden)};yl=new WeakSet;zc=function(){var t;(t=H(this,Ot))==null||t.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),st(kr(this),H(this,Ji)),st(this,H(this,ji))};kl=new WeakSet;Qc=function(){var t;(t=H(this,Ot))==null||t.setAttribute("aria-expanded","false"),lt(kr(this),H(this,Ji)),lt(this,H(this,ji))};Ji=new WeakMap;ji=new WeakMap;ea=new WeakSet;yr=function(t){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:e,y:i}=Gc({anchor:this.anchorElement,floating:this,placement:"top-start"});t!=null||(t=this.offsetWidth);let r=kr(this).getBoundingClientRect(),o=r.width-e-t,s=r.height-i-this.offsetHeight,{style:l}=H(this,Tr);l.setProperty("position","absolute"),l.setProperty("right",`${Math.max(0,o)}px`),l.setProperty("--_menu-bottom",`${s}px`);let u=getComputedStyle(this),_=l.getPropertyValue("--_menu-bottom")===u.bottom?s:parseFloat(u.bottom),g=r.height-_-parseFloat(u.marginBottom);this.style.setProperty("--_menu-max-height",`${g}px`)};Ln=new WeakSet;xl=function(t){let e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=e==null?void 0:e.querySelector('[role="menu"]'),{style:a}=H(this,Tr);if(t||a.setProperty("--media-menu-transition-in","none"),i){let r=i.offsetHeight,o=Math.max(i.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${o}px`),this.style.setProperty("min-height",`${r}px`),q(this,ea,yr).call(this,o)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),q(this,ea,yr).call(this);a.removeProperty("--media-menu-transition-in")};Sl=new WeakSet;Xc=function(t){var e;if(t.stopPropagation(),t.composedPath().includes(H(this,Dl,Jc))){(e=H(this,hi))==null||e.focus(),this.hidden=!0;return}let i=q(this,_r,wn).call(this,t);!i||i.hasAttribute("disabled")||(q(this,Ar,Rn).call(this,i),this.handleSelect(t))};Dl=new WeakSet;Jc=function(){var t;return(t=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:t.find(i=>i.matches('button[part~="back"]'))};Il=new WeakSet;jc=function(t){if(t.target===this)return;q(this,Ol,em).call(this);let e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of e)i.invokeTargetElement!=t.target&&t.newState=="open"&&i.getAttribute("aria-expanded")=="true"&&!i.invokeTargetElement.hidden&&i.invokeTargetElement.dispatchEvent(new Dt({relatedTarget:i}));for(let i of e)i.setAttribute("aria-expanded",`${!i.submenuElement.hidden}`);q(this,Ln,xl).call(this,!0)};Ol=new WeakSet;em=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};Ml=new WeakSet;tm=function(t){var e;ue(this,t.relatedTarget)||(H(this,pi)&&((e=H(this,hi))==null||e.focus()),H(this,Ot)&&H(this,Ot)!==t.relatedTarget&&!this.hidden&&(this.hidden=!0))};Cl=new WeakSet;im=function(t){var e,i,a,r,o;let{key:s,ctrlKey:l,altKey:u,metaKey:m}=t;if(!(l||u||m)&&this.keysUsed.includes(s))if(t.preventDefault(),t.stopPropagation(),s==="Tab"){if(H(this,pi)){this.hidden=!0;return}t.shiftKey?(i=(e=this.previousElementSibling)==null?void 0:e.focus)==null||i.call(e):(r=(a=this.nextElementSibling)==null?void 0:a.focus)==null||r.call(a),this.blur()}else s==="Escape"?((o=H(this,hi))==null||o.focus(),H(this,pi)&&(this.hidden=!0)):s==="Enter"||s===" "?this.handleSelect(t):this.handleMove(t)};_r=new WeakSet;wn=function(t){return t.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};Ll=new WeakSet;am=function(){return this.items.find(t=>t.tabIndex===0)};Ar=new WeakSet;Rn=function(t){for(let e of this.items)e.tabIndex=e===t?0:-1};Mn=new WeakSet;wl=function(t,e){let i=[...this.checkedItems];t.type==="radio"&&this.radioGroupItems.forEach(a=>a.checked=!1),e?t.checked=!t.checked:t.checked=!0,this.checkedItems.some((a,r)=>a!=i[r])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};oe.shadowRootOptions={mode:"open"};oe.getTemplateHTML=qf;function Zf(t){return["menuitem","menuitemradio","menuitemcheckbox"].includes(t==null?void 0:t.role)}function kr(t){var e;return(e=t.getAttribute("bounds")?He(t,`#${t.getAttribute("bounds")}`):Z(t)||t.parentElement)!=null?e:t}d.customElements.get("media-chrome-menu")||d.customElements.define("media-chrome-menu",oe);var $l=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},it=(t,e,i)=>($l(t,e,"read from private field"),i?i.call(t):e.get(t)),vt=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Nl=(t,e,i,a)=>($l(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),tt=(t,e,i)=>($l(t,e,"access private method"),i),xn,Ir,Pl,rm,Wl,om,Fl,nm,at,ta,Mr,Ul,sm,Dn,Hl;function zf(t){return`
2826
2826
  <style>
2827
2827
  :host {
2828
2828
  transition: var(--media-menu-item-transition,
@@ -3074,5 +3074,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3074
3074
  >${(i=a.linkText)!=null?i:a.linkUrl}</a
3075
3075
  >`:""}
3076
3076
  </p>`:""}
3077
- `}return _v(t)};function Av(t){var i,a;let e=t.theme;if(e){let r=(a=(i=t.getRootNode())==null?void 0:i.getElementById)==null?void 0:a.call(i,e);if(r&&r instanceof HTMLTemplateElement)return r;e.startsWith("media-theme-")||(e=`media-theme-${e}`);let o=se.customElements.get(e);if(o!=null&&o.template)return o.template}}function Tv(t){var i;let e=(i=t.mediaController)==null?void 0:i.querySelector("media-time-display");return e&&getComputedStyle(e).getPropertyValue("--media-duration-display-display").trim()==="none"}function gm(t){let e=t.videoTitle?{video_title:t.videoTitle}:{};return t.getAttributeNames().filter(i=>i.startsWith("metadata-")).reduce((i,a)=>{let r=t.getAttribute(a);return r!==null&&(i[a.replace(/^metadata-/,"").replace(/-/g,"_")]=r),i},e)}var yv=Object.values(E.Attributes),kv=Object.values(Et),Sv=Object.values(c),od=hn(),nd="mux-player",_m={isDialogOpen:!1},Iv={redundant_streams:!0},Ur,Hr,Br,Ht,$r,Ei,$,Pt,Am,sd,vi,Tm,ym,km,Sm,Pr=class extends ll{constructor(){super();pe(this,$);pe(this,Ur);pe(this,Hr,!1);pe(this,Br,{});pe(this,Ht,!0);pe(this,$r,new mn(this,"hotkeys"));pe(this,Ei,{..._m,onCloseErrorDialog:i=>{var r;((r=i.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&X(this,$,sd).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var o;if(((o=i.composedPath()[0])==null?void 0:o.localName)!=="media-error-dialog")return;ol(this,_i.activeElement)||i.preventDefault()}});ye(this,Ur,(0,w.generatePlayerInitTime)()),this.attachShadow({mode:"open"}),X(this,$,Am).call(this),this.isConnected&&X(this,$,Pt).call(this)}static get NAME(){return nd}static get VERSION(){return od}static get observedAttributes(){var i;return[...(i=ll.observedAttributes)!=null?i:[],...kv,...yv,...Sv]}get mediaTheme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,a;return(a=(i=this.mediaTheme)==null?void 0:i.shadowRoot)==null?void 0:a.querySelector("media-controller")}connectedCallback(){var a;let i=(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video");i&&(i.metadata=gm(this))}attributeChangedCallback(i,a,r){switch(X(this,$,Pt).call(this),super.attributeChangedCallback(i,a,r),i){case c.HOTKEYS:U(this,$r).value=r;break;case c.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&Qe((0,w.i18n)("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case c.THUMBNAIL_TOKEN:{if(r){let s=(0,w.parseJwt)(r);if(s){let{aud:l}=s,u=w.MuxJWTAud.THUMBNAIL;l!==u&&Qe((0,w.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:u,tokenNamePrefix:"thumbnail"}))}}break}case c.STORYBOARD_TOKEN:{if(r){let s=(0,w.parseJwt)(r);if(s){let{aud:l}=s,u=w.MuxJWTAud.STORYBOARD;l!==u&&Qe((0,w.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:u,tokenNamePrefix:"storyboard"}))}}break}case c.DRM_TOKEN:{if(r){let s=(0,w.parseJwt)(r);if(s){let{aud:l}=s,u=w.MuxJWTAud.DRM;l!==u&&Qe((0,w.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:u,tokenNamePrefix:"drm"}))}}break}case E.Attributes.PLAYBACK_ID:{r!=null&&r.includes("?token")&&be((0,w.i18n)("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case E.Attributes.STREAM_TYPE:r&&![w.StreamTypes.LIVE,w.StreamTypes.ON_DEMAND,w.StreamTypes.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:nl({file:"invalid-stream-type.md",message:(0,w.i18n)("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===w.StreamTypes.LIVE?this.getAttribute(c.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[E.Attributes.PLAYBACK_ID,Et.SRC,c.PLAYBACK_TOKEN].includes(i)&&a!==r&&ye(this,Ei,{...U(this,Ei),..._m}),X(this,$,vi).call(this,{[gc(i)]:r})}async requestFullscreen(i){var a;if(!(!this.mediaController||this.mediaController.hasAttribute(n.MEDIA_IS_FULLSCREEN)))return(a=this.mediaController)==null||a.dispatchEvent(new se.CustomEvent(p.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((r,o)=>{var s;(s=this.mediaController)==null||s.addEventListener(Ce.MEDIA_IS_FULLSCREEN,()=>r(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(n.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new se.CustomEvent(p.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((a,r)=>{var o;(o=this.mediaController)==null||o.addEventListener(Ce.MEDIA_IS_FULLSCREEN,()=>a(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(E.Attributes.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?w.CmcdTypeValues.includes(i)?this.setAttribute(E.Attributes.PREFER_CMCD,i):Qe(`Invalid value for preferCmcd. Must be one of ${w.CmcdTypeValues.join()}`):this.removeAttribute(E.Attributes.PREFER_CMCD))}get hasPlayed(){var i,a;return(a=(i=this.mediaController)==null?void 0:i.hasAttribute(n.MEDIA_HAS_PLAYED))!=null?a:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(n.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(c.THEME))!=null?i:bv}set theme(i){this.setAttribute(c.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let a={};for(let r of i.getAttributeNames()){if(rd.includes(r))continue;let o=i.getAttribute(r);a[cn(r)]=o===""?!0:o}return a}set themeProps(i){var r,o;X(this,$,Pt).call(this);let a={...this.themeProps,...i};for(let s in a){if(rd.includes(s))continue;let l=i==null?void 0:i[s];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(un(s),!!l):(o=this.mediaTheme)==null||o.setAttribute(un(s),l)}}get playbackId(){var i;return(i=this.getAttribute(E.Attributes.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(E.Attributes.PLAYBACK_ID,i):this.removeAttribute(E.Attributes.PLAYBACK_ID)}get src(){var i,a;return this.playbackId?(i=Ut(this,Et.SRC))!=null?i:void 0:(a=this.getAttribute(Et.SRC))!=null?a:void 0}set src(i){i?this.setAttribute(Et.SRC,i):this.removeAttribute(Et.SRC)}get poster(){var r;let i=this.getAttribute(Et.POSTER);if(i!=null)return i;let{tokens:a}=this;if(a.playback&&!a.thumbnail){Qe("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return Ec(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:a.thumbnail})}set poster(i){i||i===""?this.setAttribute(Et.POSTER,i):this.removeAttribute(Et.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(c.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(c.STORYBOARD_SRC,i):this.removeAttribute(c.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[w.StreamTypes.LIVE,w.StreamTypes.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return bc(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(c.AUDIO)}set audio(i){if(!i){this.removeAttribute(c.AUDIO);return}this.setAttribute(c.AUDIO,"")}get hotkeys(){return U(this,$r)}get nohotkeys(){return this.hasAttribute(c.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(c.NOHOTKEYS);return}this.setAttribute(c.NOHOTKEYS,"")}get thumbnailTime(){return ce(this.getAttribute(c.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(c.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,a;return(a=(i=this.getAttribute(c.VIDEO_TITLE))!=null?i:this.getAttribute(c.TITLE))!=null?a:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(c.VIDEO_TITLE,i):this.removeAttribute(c.VIDEO_TITLE))}get placeholder(){var i;return(i=Ut(this,c.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(c.PLACEHOLDER,`${i}`)}get primaryColor(){var a,r;let i=this.getAttribute(c.PRIMARY_COLOR);if(i!=null||this.mediaTheme&&(i=(r=(a=se.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),i))return i}set primaryColor(i){this.setAttribute(c.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var a,r;let i=this.getAttribute(c.SECONDARY_COLOR);if(i!=null||this.mediaTheme&&(i=(r=(a=se.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),i))return i}set secondaryColor(i){this.setAttribute(c.SECONDARY_COLOR,`${i}`)}get accentColor(){var a,r;let i=this.getAttribute(c.ACCENT_COLOR);if(i!=null||this.mediaTheme&&(i=(r=(a=se.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),i))return i}set accentColor(i){this.setAttribute(c.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(c.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(c.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(c.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(c.PLAYBACK_RATES))return this.getAttribute(c.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,a)=>i-a)}set playbackRates(i){if(!i){this.removeAttribute(c.PLAYBACK_RATES);return}this.setAttribute(c.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=ce(this.getAttribute(c.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(c.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=ce(this.getAttribute(c.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(c.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(c.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(c.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(c.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return ce(this.getAttribute(c.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(c.DEFAULT_DURATION):this.setAttribute(c.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(E.Attributes.PLAYER_INIT_TIME)?ce(this.getAttribute(E.Attributes.PLAYER_INIT_TIME)):U(this,Ur)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(E.Attributes.PLAYER_INIT_TIME):this.setAttribute(E.Attributes.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(E.Attributes.PLAYER_SOFTWARE_NAME))!=null?i:nd}get playerSoftwareVersion(){var i;return(i=this.getAttribute(E.Attributes.PLAYER_SOFTWARE_VERSION))!=null?i:od}get beaconCollectionDomain(){var i;return(i=this.getAttribute(E.Attributes.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(E.Attributes.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(E.Attributes.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(E.Attributes.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(E.Attributes.MAX_RESOLUTION,i):this.removeAttribute(E.Attributes.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(E.Attributes.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(E.Attributes.MIN_RESOLUTION,i):this.removeAttribute(E.Attributes.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(E.Attributes.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(E.Attributes.RENDITION_ORDER,i):this.removeAttribute(E.Attributes.RENDITION_ORDER))}get programStartTime(){return ce(this.getAttribute(E.Attributes.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(E.Attributes.PROGRAM_START_TIME):this.setAttribute(E.Attributes.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return ce(this.getAttribute(E.Attributes.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(E.Attributes.PROGRAM_END_TIME):this.setAttribute(E.Attributes.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return ce(this.getAttribute(E.Attributes.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(E.Attributes.ASSET_START_TIME):this.setAttribute(E.Attributes.ASSET_START_TIME,`${i}`)}get assetEndTime(){return ce(this.getAttribute(E.Attributes.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(E.Attributes.ASSET_END_TIME):this.setAttribute(E.Attributes.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(c.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(c.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[a,r])=>(i[a]=r,i),{}):Iv}set extraSourceParams(i){i==null?this.removeAttribute(c.EXTRA_SOURCE_PARAMS):this.setAttribute(c.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(E.Attributes.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(E.Attributes.CUSTOM_DOMAIN,i):this.removeAttribute(E.Attributes.CUSTOM_DOMAIN))}get envKey(){var i;return(i=Ut(this,E.Attributes.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(E.Attributes.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(c.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(c.NO_VOLUME_PREF,""):this.removeAttribute(c.NO_VOLUME_PREF)}get debug(){return Ut(this,E.Attributes.DEBUG)!=null}set debug(i){i?this.setAttribute(E.Attributes.DEBUG,""):this.removeAttribute(E.Attributes.DEBUG)}get disableTracking(){return Ut(this,E.Attributes.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(E.Attributes.DISABLE_TRACKING,!!i)}get disableCookies(){return Ut(this,E.Attributes.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(E.Attributes.DISABLE_COOKIES,""):this.removeAttribute(E.Attributes.DISABLE_COOKIES)}get streamType(){var i,a,r;return(r=(a=this.getAttribute(E.Attributes.STREAM_TYPE))!=null?a:(i=this.media)==null?void 0:i.streamType)!=null?r:w.StreamTypes.UNKNOWN}set streamType(i){this.setAttribute(E.Attributes.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,a,r;return(r=(a=this.getAttribute(c.DEFAULT_STREAM_TYPE))!=null?a:(i=this.mediaController)==null?void 0:i.getAttribute(c.DEFAULT_STREAM_TYPE))!=null?r:w.StreamTypes.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(c.DEFAULT_STREAM_TYPE,i):this.removeAttribute(c.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,a;return this.hasAttribute(c.TARGET_LIVE_WINDOW)?+this.getAttribute(c.TARGET_LIVE_WINDOW):(a=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?a:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(c.TARGET_LIVE_WINDOW):this.setAttribute(c.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return ce(Ut(this,E.Attributes.START_TIME))}set startTime(i){this.setAttribute(E.Attributes.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(E.Attributes.PREFER_PLAYBACK);if(i===w.PlaybackTypes.MSE||i===w.PlaybackTypes.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===w.PlaybackTypes.MSE||i===w.PlaybackTypes.NATIVE?this.setAttribute(E.Attributes.PREFER_PLAYBACK,i):this.removeAttribute(E.Attributes.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...gm(this),...i}}get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=i}async addCuePoints(i){var a;if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(a=this.media)==null?void 0:a.addCuePoints(i)}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,a;return(a=(i=this.media)==null?void 0:i.cuePoints)!=null?a:[]}addChapters(i){var a;if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(a=this.media)==null?void 0:a.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,a;return(a=(i=this.media)==null?void 0:i.chapters)!=null?a:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(c.PLAYBACK_TOKEN),a=this.getAttribute(c.DRM_TOKEN),r=this.getAttribute(c.THUMBNAIL_TOKEN),o=this.getAttribute(c.STORYBOARD_TOKEN);return{...U(this,Br),...i!=null?{playback:i}:{},...a!=null?{drm:a}:{},...r!=null?{thumbnail:r}:{},...o!=null?{storyboard:o}:{}}}set tokens(i){ye(this,Br,i!=null?i:{})}get playbackToken(){var i;return(i=this.getAttribute(c.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(c.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(c.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(c.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(c.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(c.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(c.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(c.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,a,r,o){var l;let s=(l=this.media)==null?void 0:l.nativeEl;if(s)return(0,w.addTextTrack)(s,i,a,r,o)}removeTextTrack(i){var r;let a=(r=this.media)==null?void 0:r.nativeEl;if(a)return(0,w.removeTextTrack)(a,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(c.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(c.CAST_RECEIVER,i):this.removeAttribute(c.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){be("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(c.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(c.NO_TOOLTIPS);return}this.setAttribute(c.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(c.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(c.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(c.PROUDLY_DISPLAY_MUX_BADGE)}};Ur=new WeakMap,Hr=new WeakMap,Br=new WeakMap,Ht=new WeakMap,$r=new WeakMap,Ei=new WeakMap,$=new WeakSet,Pt=function(){var i,a,r,o;if(!U(this,Hr)){ye(this,Hr,!0),X(this,$,vi).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof se.HTMLElement))throw""}catch{be("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof E.default))throw""}catch{be("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof _s))throw""}catch{be("<media-controller> failed to upgrade!")}this.init(),X(this,$,Tm).call(this),X(this,$,ym).call(this),X(this,$,km).call(this),ye(this,Ht,(a=(i=this.mediaController)==null?void 0:i.hasAttribute(y.USER_INACTIVE))!=null?a:!0),X(this,$,Sm).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>X(this,$,vi).call(this)),(o=this.media)==null||o.addEventListener("loadstart",()=>X(this,$,vi).call(this))}},Am=function(){var i,a;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(a=window==null?void 0:window.CSS)==null||a.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},sd=function(i){Object.assign(U(this,Ei),i),X(this,$,vi).call(this)},vi=function(i={}){$c(Wc(gv(this,{...U(this,Ei),...i})),this.shadowRoot)},Tm=function(){let i=r=>{var l,u;if(!(r!=null&&r.startsWith("theme-")))return;let o=r.replace(/^theme-/,"");if(rd.includes(o))return;let s=this.getAttribute(r);s!=null?(l=this.mediaTheme)==null||l.setAttribute(o,s):(u=this.mediaTheme)==null||u.removeAttribute(o)};new MutationObserver(r=>{for(let{attributeName:o}of r)i(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(i)},ym=function(){var a;let i=r=>{let{detail:o}=r;if(o instanceof E.MediaError||(o=new E.MediaError(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){Qe(o),o.data&&Qe(`${o.name} data:`,o.data);return}let s=gl(o,!1);s.message&&nl(s),be(o),o.data&&be(`${o.name} data:`,o.data),X(this,$,sd).call(this,{isDialogOpen:!0})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(r={})=>{var s,l,u;if(!(((s=this.media)==null?void 0:s.error)instanceof E.MediaError))return r;let o=gl((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(u=this.media)==null?void 0:u.error.code,player_error_message:o.message?String(o.message):r.player_error_message,player_error_context:o.context?String(o.context):r.player_error_context}}),(a=this.media)==null||a.addEventListener("error",r=>{var s,l;let{detail:o}=r;if(!o){let{message:u,code:m}=(l=(s=this.media)==null?void 0:s.error)!=null?l:{};o=new E.MediaError(u,m)}o!=null&&o.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:o}))})},km=function(){var a,r,o,s;let i=()=>X(this,$,vi).call(this);(r=(a=this.media)==null?void 0:a.textTracks)==null||r.addEventListener("addtrack",i),(s=(o=this.media)==null?void 0:o.textTracks)==null||s.addEventListener("removetrack",i)},Sm=function(){var m,A;if(!/Firefox/i.test(navigator.userAgent))return;let a,r=new WeakMap,o=()=>this.streamType===w.StreamTypes.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,s=(g,f,v=!1)=>{if(o())return;Array.from(g&&g.activeCues||[]).forEach(T=>{if(!(!T.snapToLines||T.line<-5||T.line>=0&&T.line<10))if(!f||this.paused){let C=T.text.split(`
3078
- `).length,P=-3;this.streamType===w.StreamTypes.LIVE&&(P=-2);let j=P-C;if(T.line===j&&!v)return;r.has(T)||r.set(T,T.line),T.line=j}else setTimeout(()=>{T.line=r.get(T)||"auto"},500)})},l=()=>{var g,f;s(a,(f=(g=this.mediaController)==null?void 0:g.hasAttribute(y.USER_INACTIVE))!=null?f:!1)},u=()=>{var v,N;let f=Array.from(((N=(v=this.mediaController)==null?void 0:v.media)==null?void 0:N.textTracks)||[]).filter(T=>["subtitles","captions"].includes(T.kind)&&T.mode==="showing")[0];f!==a&&(a==null||a.removeEventListener("cuechange",l)),a=f,a==null||a.addEventListener("cuechange",l),s(a,U(this,Ht))};u(),(m=this.textTracks)==null||m.addEventListener("change",u),(A=this.textTracks)==null||A.addEventListener("addtrack",u),this.addEventListener("userinactivechange",()=>{var f,v;let g=(v=(f=this.mediaController)==null?void 0:f.hasAttribute(y.USER_INACTIVE))!=null?v:!0;U(this,Ht)!==g&&(ye(this,Ht,g),s(a,U(this,Ht)))})};function Ut(t,e){return t.media?t.media.getAttribute(e):t.getAttribute(e)}se.customElements.get("mux-player")||(se.customElements.define("mux-player",Pr),se.MuxPlayerElement=Pr);var Mv=Pr;
3077
+ `}return _v(t)};function Av(t){var i,a;let e=t.theme;if(e){let r=(a=(i=t.getRootNode())==null?void 0:i.getElementById)==null?void 0:a.call(i,e);if(r&&r instanceof HTMLTemplateElement)return r;e.startsWith("media-theme-")||(e=`media-theme-${e}`);let o=se.customElements.get(e);if(o!=null&&o.template)return o.template}}function Tv(t){var i;let e=(i=t.mediaController)==null?void 0:i.querySelector("media-time-display");return e&&getComputedStyle(e).getPropertyValue("--media-duration-display-display").trim()==="none"}function gm(t){let e=t.videoTitle?{video_title:t.videoTitle}:{};return t.getAttributeNames().filter(i=>i.startsWith("metadata-")).reduce((i,a)=>{let r=t.getAttribute(a);return r!==null&&(i[a.replace(/^metadata-/,"").replace(/-/g,"_")]=r),i},e)}var yv=Object.values(E.Attributes),kv=Object.values(Et),Sv=Object.values(c),od=hn(),nd="mux-player",_m={isDialogOpen:!1},Iv={redundant_streams:!0},Ur,Hr,Br,Ht,$r,Ei,$,Pt,Am,sd,vi,Tm,ym,km,Sm,Pr=class extends ll{constructor(){super();pe(this,$);pe(this,Ur);pe(this,Hr,!1);pe(this,Br,{});pe(this,Ht,!0);pe(this,$r,new mn(this,"hotkeys"));pe(this,Ei,{..._m,onCloseErrorDialog:i=>{var r;((r=i.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&X(this,$,sd).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var o;if(((o=i.composedPath()[0])==null?void 0:o.localName)!=="media-error-dialog")return;ol(this,_i.activeElement)||i.preventDefault()}});ye(this,Ur,(0,w.generatePlayerInitTime)()),this.attachShadow({mode:"open"}),X(this,$,Am).call(this),this.isConnected&&X(this,$,Pt).call(this)}static get NAME(){return nd}static get VERSION(){return od}static get observedAttributes(){var i;return[...(i=ll.observedAttributes)!=null?i:[],...kv,...yv,...Sv]}get mediaTheme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,a;return(a=(i=this.mediaTheme)==null?void 0:i.shadowRoot)==null?void 0:a.querySelector("media-controller")}connectedCallback(){var a;let i=(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video");i&&(i.metadata=gm(this))}attributeChangedCallback(i,a,r){switch(X(this,$,Pt).call(this),super.attributeChangedCallback(i,a,r),i){case c.HOTKEYS:U(this,$r).value=r;break;case c.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&Qe((0,w.i18n)("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case c.THUMBNAIL_TOKEN:{if(r){let s=(0,w.parseJwt)(r);if(s){let{aud:l}=s,u=w.MuxJWTAud.THUMBNAIL;l!==u&&Qe((0,w.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:u,tokenNamePrefix:"thumbnail"}))}}break}case c.STORYBOARD_TOKEN:{if(r){let s=(0,w.parseJwt)(r);if(s){let{aud:l}=s,u=w.MuxJWTAud.STORYBOARD;l!==u&&Qe((0,w.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:u,tokenNamePrefix:"storyboard"}))}}break}case c.DRM_TOKEN:{if(r){let s=(0,w.parseJwt)(r);if(s){let{aud:l}=s,u=w.MuxJWTAud.DRM;l!==u&&Qe((0,w.i18n)("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:u,tokenNamePrefix:"drm"}))}}break}case E.Attributes.PLAYBACK_ID:{r!=null&&r.includes("?token")&&be((0,w.i18n)("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case E.Attributes.STREAM_TYPE:r&&![w.StreamTypes.LIVE,w.StreamTypes.ON_DEMAND,w.StreamTypes.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:nl({file:"invalid-stream-type.md",message:(0,w.i18n)("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===w.StreamTypes.LIVE?this.getAttribute(c.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[E.Attributes.PLAYBACK_ID,Et.SRC,c.PLAYBACK_TOKEN].includes(i)&&a!==r&&ye(this,Ei,{...U(this,Ei),..._m}),X(this,$,vi).call(this,{[gc(i)]:r})}async requestFullscreen(i){var a;if(!(!this.mediaController||this.mediaController.hasAttribute(n.MEDIA_IS_FULLSCREEN)))return(a=this.mediaController)==null||a.dispatchEvent(new se.CustomEvent(p.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((r,o)=>{var s;(s=this.mediaController)==null||s.addEventListener(Ce.MEDIA_IS_FULLSCREEN,()=>r(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(n.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new se.CustomEvent(p.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((a,r)=>{var o;(o=this.mediaController)==null||o.addEventListener(Ce.MEDIA_IS_FULLSCREEN,()=>a(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(E.Attributes.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?w.CmcdTypeValues.includes(i)?this.setAttribute(E.Attributes.PREFER_CMCD,i):Qe(`Invalid value for preferCmcd. Must be one of ${w.CmcdTypeValues.join()}`):this.removeAttribute(E.Attributes.PREFER_CMCD))}get hasPlayed(){var i,a;return(a=(i=this.mediaController)==null?void 0:i.hasAttribute(n.MEDIA_HAS_PLAYED))!=null?a:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(n.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(c.THEME))!=null?i:bv}set theme(i){this.setAttribute(c.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let a={};for(let r of i.getAttributeNames()){if(rd.includes(r))continue;let o=i.getAttribute(r);a[cn(r)]=o===""?!0:o}return a}set themeProps(i){var r,o;X(this,$,Pt).call(this);let a={...this.themeProps,...i};for(let s in a){if(rd.includes(s))continue;let l=i==null?void 0:i[s];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(un(s),!!l):(o=this.mediaTheme)==null||o.setAttribute(un(s),l)}}get playbackId(){var i;return(i=this.getAttribute(E.Attributes.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(E.Attributes.PLAYBACK_ID,i):this.removeAttribute(E.Attributes.PLAYBACK_ID)}get src(){var i,a;return this.playbackId?(i=Ut(this,Et.SRC))!=null?i:void 0:(a=this.getAttribute(Et.SRC))!=null?a:void 0}set src(i){i?this.setAttribute(Et.SRC,i):this.removeAttribute(Et.SRC)}get poster(){var r;let i=this.getAttribute(Et.POSTER);if(i!=null)return i;let{tokens:a}=this;if(a.playback&&!a.thumbnail){Qe("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return Ec(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:a.thumbnail})}set poster(i){i||i===""?this.setAttribute(Et.POSTER,i):this.removeAttribute(Et.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(c.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(c.STORYBOARD_SRC,i):this.removeAttribute(c.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[w.StreamTypes.LIVE,w.StreamTypes.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return bc(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(c.AUDIO)}set audio(i){if(!i){this.removeAttribute(c.AUDIO);return}this.setAttribute(c.AUDIO,"")}get hotkeys(){return U(this,$r)}get nohotkeys(){return this.hasAttribute(c.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(c.NOHOTKEYS);return}this.setAttribute(c.NOHOTKEYS,"")}get thumbnailTime(){return ce(this.getAttribute(c.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(c.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,a;return(a=(i=this.getAttribute(c.VIDEO_TITLE))!=null?i:this.getAttribute(c.TITLE))!=null?a:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(c.VIDEO_TITLE,i):this.removeAttribute(c.VIDEO_TITLE))}get placeholder(){var i;return(i=Ut(this,c.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(c.PLACEHOLDER,`${i}`)}get primaryColor(){var a,r;let i=this.getAttribute(c.PRIMARY_COLOR);if(i!=null||this.mediaTheme&&(i=(r=(a=se.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),i))return i}set primaryColor(i){this.setAttribute(c.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var a,r;let i=this.getAttribute(c.SECONDARY_COLOR);if(i!=null||this.mediaTheme&&(i=(r=(a=se.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),i))return i}set secondaryColor(i){this.setAttribute(c.SECONDARY_COLOR,`${i}`)}get accentColor(){var a,r;let i=this.getAttribute(c.ACCENT_COLOR);if(i!=null||this.mediaTheme&&(i=(r=(a=se.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),i))return i}set accentColor(i){this.setAttribute(c.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(c.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(c.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(c.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(c.PLAYBACK_RATES))return this.getAttribute(c.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,a)=>i-a)}set playbackRates(i){if(!i){this.removeAttribute(c.PLAYBACK_RATES);return}this.setAttribute(c.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=ce(this.getAttribute(c.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(c.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=ce(this.getAttribute(c.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(c.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(c.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(c.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(c.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return ce(this.getAttribute(c.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(c.DEFAULT_DURATION):this.setAttribute(c.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(E.Attributes.PLAYER_INIT_TIME)?ce(this.getAttribute(E.Attributes.PLAYER_INIT_TIME)):U(this,Ur)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(E.Attributes.PLAYER_INIT_TIME):this.setAttribute(E.Attributes.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(E.Attributes.PLAYER_SOFTWARE_NAME))!=null?i:nd}get playerSoftwareVersion(){var i;return(i=this.getAttribute(E.Attributes.PLAYER_SOFTWARE_VERSION))!=null?i:od}get beaconCollectionDomain(){var i;return(i=this.getAttribute(E.Attributes.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(E.Attributes.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(E.Attributes.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(E.Attributes.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(E.Attributes.MAX_RESOLUTION,i):this.removeAttribute(E.Attributes.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(E.Attributes.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(E.Attributes.MIN_RESOLUTION,i):this.removeAttribute(E.Attributes.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(E.Attributes.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(E.Attributes.RENDITION_ORDER,i):this.removeAttribute(E.Attributes.RENDITION_ORDER))}get programStartTime(){return ce(this.getAttribute(E.Attributes.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(E.Attributes.PROGRAM_START_TIME):this.setAttribute(E.Attributes.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return ce(this.getAttribute(E.Attributes.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(E.Attributes.PROGRAM_END_TIME):this.setAttribute(E.Attributes.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return ce(this.getAttribute(E.Attributes.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(E.Attributes.ASSET_START_TIME):this.setAttribute(E.Attributes.ASSET_START_TIME,`${i}`)}get assetEndTime(){return ce(this.getAttribute(E.Attributes.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(E.Attributes.ASSET_END_TIME):this.setAttribute(E.Attributes.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(c.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(c.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[a,r])=>(i[a]=r,i),{}):Iv}set extraSourceParams(i){i==null?this.removeAttribute(c.EXTRA_SOURCE_PARAMS):this.setAttribute(c.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(E.Attributes.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(E.Attributes.CUSTOM_DOMAIN,i):this.removeAttribute(E.Attributes.CUSTOM_DOMAIN))}get envKey(){var i;return(i=Ut(this,E.Attributes.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(E.Attributes.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(c.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(c.NO_VOLUME_PREF,""):this.removeAttribute(c.NO_VOLUME_PREF)}get debug(){return Ut(this,E.Attributes.DEBUG)!=null}set debug(i){i?this.setAttribute(E.Attributes.DEBUG,""):this.removeAttribute(E.Attributes.DEBUG)}get disableTracking(){return Ut(this,E.Attributes.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(E.Attributes.DISABLE_TRACKING,!!i)}get disableCookies(){return Ut(this,E.Attributes.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(E.Attributes.DISABLE_COOKIES,""):this.removeAttribute(E.Attributes.DISABLE_COOKIES)}get streamType(){var i,a,r;return(r=(a=this.getAttribute(E.Attributes.STREAM_TYPE))!=null?a:(i=this.media)==null?void 0:i.streamType)!=null?r:w.StreamTypes.UNKNOWN}set streamType(i){this.setAttribute(E.Attributes.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,a,r;return(r=(a=this.getAttribute(c.DEFAULT_STREAM_TYPE))!=null?a:(i=this.mediaController)==null?void 0:i.getAttribute(c.DEFAULT_STREAM_TYPE))!=null?r:w.StreamTypes.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(c.DEFAULT_STREAM_TYPE,i):this.removeAttribute(c.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,a;return this.hasAttribute(c.TARGET_LIVE_WINDOW)?+this.getAttribute(c.TARGET_LIVE_WINDOW):(a=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?a:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(c.TARGET_LIVE_WINDOW):this.setAttribute(c.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return ce(Ut(this,E.Attributes.START_TIME))}set startTime(i){this.setAttribute(E.Attributes.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(E.Attributes.PREFER_PLAYBACK);if(i===w.PlaybackTypes.MSE||i===w.PlaybackTypes.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===w.PlaybackTypes.MSE||i===w.PlaybackTypes.NATIVE?this.setAttribute(E.Attributes.PREFER_PLAYBACK,i):this.removeAttribute(E.Attributes.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...gm(this),...i}}get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=i}async addCuePoints(i){var a;if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(a=this.media)==null?void 0:a.addCuePoints(i)}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,a;return(a=(i=this.media)==null?void 0:i.cuePoints)!=null?a:[]}addChapters(i){var a;if(X(this,$,Pt).call(this),!this.media){be("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(a=this.media)==null?void 0:a.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,a;return(a=(i=this.media)==null?void 0:i.chapters)!=null?a:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(c.PLAYBACK_TOKEN),a=this.getAttribute(c.DRM_TOKEN),r=this.getAttribute(c.THUMBNAIL_TOKEN),o=this.getAttribute(c.STORYBOARD_TOKEN);return{...U(this,Br),...i!=null?{playback:i}:{},...a!=null?{drm:a}:{},...r!=null?{thumbnail:r}:{},...o!=null?{storyboard:o}:{}}}set tokens(i){ye(this,Br,i!=null?i:{})}get playbackToken(){var i;return(i=this.getAttribute(c.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(c.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(c.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(c.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(c.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(c.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(c.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(c.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,a,r,o){var l;let s=(l=this.media)==null?void 0:l.nativeEl;if(s)return(0,w.addTextTrack)(s,i,a,r,o)}removeTextTrack(i){var r;let a=(r=this.media)==null?void 0:r.nativeEl;if(a)return(0,w.removeTextTrack)(a,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(c.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(c.CAST_RECEIVER,i):this.removeAttribute(c.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){be("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(c.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(c.NO_TOOLTIPS);return}this.setAttribute(c.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(c.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(c.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(c.PROUDLY_DISPLAY_MUX_BADGE)}};Ur=new WeakMap,Hr=new WeakMap,Br=new WeakMap,Ht=new WeakMap,$r=new WeakMap,Ei=new WeakMap,$=new WeakSet,Pt=function(){var i,a,r,o;if(!U(this,Hr)){ye(this,Hr,!0),X(this,$,vi).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof se.HTMLElement))throw""}catch{be("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof E.default))throw""}catch{be("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof _s))throw""}catch{be("<media-controller> failed to upgrade!")}this.init(),X(this,$,Tm).call(this),X(this,$,ym).call(this),X(this,$,km).call(this),ye(this,Ht,(a=(i=this.mediaController)==null?void 0:i.hasAttribute(y.USER_INACTIVE))!=null?a:!0),X(this,$,Sm).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>X(this,$,vi).call(this)),(o=this.media)==null||o.addEventListener("loadstart",()=>X(this,$,vi).call(this))}},Am=function(){var i,a;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(a=window==null?void 0:window.CSS)==null||a.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},sd=function(i){Object.assign(U(this,Ei),i),X(this,$,vi).call(this)},vi=function(i={}){$c(Wc(gv(this,{...U(this,Ei),...i})),this.shadowRoot)},Tm=function(){let i=r=>{var l,u;if(!(r!=null&&r.startsWith("theme-")))return;let o=r.replace(/^theme-/,"");if(rd.includes(o))return;let s=this.getAttribute(r);s!=null?(l=this.mediaTheme)==null||l.setAttribute(o,s):(u=this.mediaTheme)==null||u.removeAttribute(o)};new MutationObserver(r=>{for(let{attributeName:o}of r)i(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(i)},ym=function(){var a;let i=r=>{let{detail:o}=r;if(o instanceof E.MediaError||(o=new E.MediaError(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){Qe(o),o.data&&Qe(`${o.name} data:`,o.data);return}let s=gl(o,!1);s.message&&nl(s),be(o),o.data&&be(`${o.name} data:`,o.data),X(this,$,sd).call(this,{isDialogOpen:!0})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(r={})=>{var s,l,u;if(!(((s=this.media)==null?void 0:s.error)instanceof E.MediaError))return r;let o=gl((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(u=this.media)==null?void 0:u.error.code,player_error_message:o.message?String(o.message):r.player_error_message,player_error_context:o.context?String(o.context):r.player_error_context}}),(a=this.media)==null||a.addEventListener("error",r=>{var s,l;let{detail:o}=r;if(!o){let{message:u,code:m}=(l=(s=this.media)==null?void 0:s.error)!=null?l:{};o=new E.MediaError(u,m)}o!=null&&o.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:o}))})},km=function(){var a,r,o,s;let i=()=>X(this,$,vi).call(this);(r=(a=this.media)==null?void 0:a.textTracks)==null||r.addEventListener("addtrack",i),(s=(o=this.media)==null?void 0:o.textTracks)==null||s.addEventListener("removetrack",i)},Sm=function(){var m,_;if(!/Firefox/i.test(navigator.userAgent))return;let a,r=new WeakMap,o=()=>this.streamType===w.StreamTypes.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,s=(g,f,v=!1)=>{if(o())return;Array.from(g&&g.activeCues||[]).forEach(T=>{if(!(!T.snapToLines||T.line<-5||T.line>=0&&T.line<10))if(!f||this.paused){let C=T.text.split(`
3078
+ `).length,P=-3;this.streamType===w.StreamTypes.LIVE&&(P=-2);let j=P-C;if(T.line===j&&!v)return;r.has(T)||r.set(T,T.line),T.line=j}else setTimeout(()=>{T.line=r.get(T)||"auto"},500)})},l=()=>{var g,f;s(a,(f=(g=this.mediaController)==null?void 0:g.hasAttribute(y.USER_INACTIVE))!=null?f:!1)},u=()=>{var v,N;let f=Array.from(((N=(v=this.mediaController)==null?void 0:v.media)==null?void 0:N.textTracks)||[]).filter(T=>["subtitles","captions"].includes(T.kind)&&T.mode==="showing")[0];f!==a&&(a==null||a.removeEventListener("cuechange",l)),a=f,a==null||a.addEventListener("cuechange",l),s(a,U(this,Ht))};u(),(m=this.textTracks)==null||m.addEventListener("change",u),(_=this.textTracks)==null||_.addEventListener("addtrack",u),this.addEventListener("userinactivechange",()=>{var f,v;let g=(v=(f=this.mediaController)==null?void 0:f.hasAttribute(y.USER_INACTIVE))!=null?v:!0;U(this,Ht)!==g&&(ye(this,Ht,g),s(a,U(this,Ht)))})};function Ut(t,e){return t.media?t.media.getAttribute(e):t.getAttribute(e)}se.customElements.get("mux-player")||(se.customElements.define("mux-player",Pr),se.MuxPlayerElement=Pr);var Mv=Pr;