@mux/mux-player 3.2.3 → 3.2.4-canary.1

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- var Ae=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var u=(t,a,e)=>(Ae(t,a,"read from private field"),e?e.call(t):a.get(t)),p=(t,a,e)=>{if(a.has(t))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(t):a.set(t,e)},C=(t,a,e,i)=>(Ae(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var b=(t,a,e)=>(Ae(t,a,"access private method"),e);var Y=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends Y{}globalThis.DocumentFragment=t}var j=class extends Y{},Ce=class extends Y{},Vt={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(j)}},q,ke=class{constructor(a,e={}){p(this,q,void 0);C(this,q,e==null?void 0:e.detail)}get detail(){return u(this,q)}initCustomEvent(){}};q=new WeakMap;function Kt(t,a){return new j}var tt={document:{createElement:Kt},DocumentFragment,customElements:Vt,CustomEvent:ke,EventTarget:Y,HTMLElement:j,HTMLVideoElement:Ce},at=typeof window=="undefined"||typeof globalThis.customElements=="undefined",v=at?tt:globalThis,F=at?tt.document:globalThis.document;import{MediaController as fa,MediaErrorDialog as Nt}from"media-chrome";import{Attributes as Ie}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Rt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ga,{MediaError as ee,Attributes as s}from"@mux/mux-video";import{StreamTypes as x,PlaybackTypes as fe,addTextTrack as ya,removeTextTrack as Ta,CmcdTypeValues as Ot,i18n as H,parseJwt as De,MuxJWTAud as Ve,generatePlayerInitTime as va}from"@mux/playback-core";import{VideoEvents as Ft}from"@mux/mux-video";import{i18n as Yt}from"@mux/playback-core";import{StreamTypes as _e,parseJwt as rt}from"@mux/playback-core";function it(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${de(e)}: ${i}; `)}),a?a.trim():void 0}function de(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function le(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function Re(t){let a=Ht(t).toString();return a?"?"+a:""}function Ht(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var Oe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Oe(t,a.getRootNode().host);var ot="mux.com",Ut=()=>{try{return"3.2.3"}catch{}return"UNKNOWN"},Bt=Ut(),me=()=>Bt,nt=(t,{token:a,customDomain:e=ot,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=rt(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${Re({token:a,time:n,program_time:r})}`},st=(t,{token:a,customDomain:e=ot,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=rt(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${Re({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},z=t=>{if(t){if([_e.LIVE,_e.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return _e.LIVE}};var $t={crossorigin:"crossOrigin",playsinline:"playsInline"};function dt(t){var a;return(a=$t[t])!=null?a:le(t)}var I,D,T,ue=class{constructor(a,e){p(this,I,void 0);p(this,D,void 0);p(this,T,[]);C(this,I,a),C(this,D,e)}[Symbol.iterator](){return u(this,T).values()}get length(){return u(this,T).length}get value(){var a;return(a=u(this,T).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(C(this,T,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,T)[a]}values(){return u(this,T).values()}keys(){return u(this,T).keys()}forEach(a){u(this,T).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,T).push(r)}),!(this.value===""&&!((e=u(this,I))!=null&&e.hasAttribute(`${u(this,D)}`)))&&((i=u(this,I))==null||i.setAttribute(`${u(this,D)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,T).splice(u(this,T).indexOf(i),1)}),(e=u(this,I))==null||e.setAttribute(`${u(this,D)}`,`${this.value}`)}contains(a){return u(this,T).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};I=new WeakMap,D=new WeakMap,T=new WeakMap;var lt=`[mux-player ${me()}]`;function _(...t){console.warn(lt,...t)}function E(...t){console.error(lt,...t)}function xe(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Yt("Read more: ")}
2
- https://github.com/muxinc/elements/blob/main/errors/${t.file}`),_(a)}var g={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},V={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},mt=Object.freeze({length:0,start(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Wt=Ft.filter(t=>t!=="error"),Zt=Object.values(g).filter(t=>![g.PLAYSINLINE].includes(t)),Gt=Object.values(V),Me=class extends v.HTMLElement{static get observedAttributes(){return[...Zt,...Gt]}constructor(){super()}init(){Wt.forEach(a=>{var e;(e=this.media)==null||e.addEventListener(a,i=>{this.dispatchEvent(new Event(i.type))})})}attributeChangedCallback(a,e,i){var r,n;switch(a){case V.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case V.VOLUME:{let d=(r=y(i))!=null?r:1;this.media&&(this.media.volume=d);return}case V.PLAYBACKRATE:{let d=(n=y(i))!=null?n:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}load(){var a;(a=this.media)==null||a.load()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.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 a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:mt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:mt}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentSrc(){var a,e;return(e=(a=this.media)==null?void 0:a.currentSrc)!=null?e:""}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=y(this.getAttribute(V.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(V.PLAYBACKRATE,`${a}`):this.removeAttribute(V.PLAYBACKRATE)}get crossOrigin(){return X(this,g.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(g.CROSSORIGIN,`${a}`)}get autoplay(){return X(this,g.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(g.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(g.AUTOPLAY)}get loop(){return X(this,g.LOOP)!=null}set loop(a){a?this.setAttribute(g.LOOP,""):this.removeAttribute(g.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return X(this,g.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(g.MUTED,""):this.removeAttribute(g.MUTED)}get playsInline(){return X(this,g.PLAYSINLINE)!=null}set playsInline(a){E("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(a){["","none","metadata","auto"].includes(a)?this.setAttribute(g.PRELOAD,a):this.removeAttribute(g.PRELOAD)}};function X(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Le=Me;import"media-chrome/dist/media-theme-element.js";var ct=`:host {
1
+ var je=t=>{throw TypeError(t)};var he=(t,a,e)=>a.has(t)||je("Cannot "+e);var u=(t,a,e)=>(he(t,a,"read from private field"),e?e.call(t):a.get(t)),v=(t,a,e)=>a.has(t)?je("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),k=(t,a,e,i)=>(he(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e),b=(t,a,e)=>(he(t,a,"access private method"),e);var $=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends ${}globalThis.DocumentFragment=t}var G=class extends ${},fe=class extends ${},Nt={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(G)}},j,ge=class{constructor(a,e={}){v(this,j);k(this,j,e==null?void 0:e.detail)}get detail(){return u(this,j)}initCustomEvent(){}};j=new WeakMap;function St(t,a){return new G}var qe={document:{createElement:St},DocumentFragment,customElements:Nt,CustomEvent:ge,EventTarget:$,HTMLElement:G,HTMLVideoElement:fe},ze=typeof window=="undefined"||typeof globalThis.customElements=="undefined",E=ze?qe:globalThis,Y=ze?qe.document:globalThis.document;import{MediaController as ua,MediaErrorDialog as Rt}from"media-chrome";import{Attributes as xe}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Tt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ma,{MediaError as Q,Attributes as s}from"@mux/mux-video";import{StreamTypes as M,PlaybackTypes as be,addTextTrack as ca,removeTextTrack as pa,CmcdTypeValues as vt,i18n as K,parseJwt as Me,MuxJWTAud as Le,generatePlayerInitTime as ba}from"@mux/playback-core";import{VideoEvents as Kt}from"@mux/mux-video";import{i18n as Vt}from"@mux/playback-core";import{StreamTypes as ve,parseJwt as Je}from"@mux/playback-core";function Xe(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${ne(e)}: ${i}; `)}),a?a.trim():void 0}function ne(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function se(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ye(t){let a=wt(t).toString();return a?"?"+a:""}function wt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var Te=(t,a)=>!t||!a?!1:t.contains(a)?!0:Te(t,a.getRootNode().host);var Qe="mux.com",Pt=()=>{try{return"3.2.3"}catch{}return"UNKNOWN"},It=Pt(),le=()=>It,et=(t,{token:a,customDomain:e=Qe,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=Je(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${ye({token:a,time:n,program_time:r})}`},tt=(t,{token:a,customDomain:e=Qe,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=Je(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ye({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},q=t=>{if(t){if([ve.LIVE,ve.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return ve.LIVE}};var Dt={crossorigin:"crossOrigin",playsinline:"playsInline"};function at(t){var a;return(a=Dt[t])!=null?a:se(t)}var P,I,T,de=class{constructor(a,e){v(this,P);v(this,I);v(this,T,[]);k(this,P,a),k(this,I,e)}[Symbol.iterator](){return u(this,T).values()}get length(){return u(this,T).length}get value(){var a;return(a=u(this,T).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(k(this,T,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,T)[a]}values(){return u(this,T).values()}keys(){return u(this,T).keys()}forEach(a){u(this,T).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,T).push(r)}),!(this.value===""&&!((e=u(this,P))!=null&&e.hasAttribute(`${u(this,I)}`)))&&((i=u(this,P))==null||i.setAttribute(`${u(this,I)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,T).splice(u(this,T).indexOf(i),1)}),(e=u(this,P))==null||e.setAttribute(`${u(this,I)}`,`${this.value}`)}contains(a){return u(this,T).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};P=new WeakMap,I=new WeakMap,T=new WeakMap;var it=`[mux-player ${le()}]`;function x(...t){console.warn(it,...t)}function A(...t){console.error(it,...t)}function Ee(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Vt("Read more: ")}
2
+ https://github.com/muxinc/elements/blob/main/errors/${t.file}`),x(a)}var g={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},D={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ot=Object.freeze({length:0,start(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Ht=Kt.filter(t=>t!=="error"),Ut=Object.values(g).filter(t=>![g.PLAYSINLINE].includes(t)),Bt=Object.values(D),Ae=class extends E.HTMLElement{static get observedAttributes(){return[...Ut,...Bt]}constructor(){super()}init(){Ht.forEach(a=>{var e;(e=this.media)==null||e.addEventListener(a,i=>{this.dispatchEvent(new Event(i.type))})})}attributeChangedCallback(a,e,i){var r,n;switch(a){case D.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case D.VOLUME:{let d=(r=y(i))!=null?r:1;this.media&&(this.media.volume=d);return}case D.PLAYBACKRATE:{let d=(n=y(i))!=null?n:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}load(){var a;(a=this.media)==null||a.load()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.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 a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:ot}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:ot}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentSrc(){var a,e;return(e=(a=this.media)==null?void 0:a.currentSrc)!=null?e:""}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=y(this.getAttribute(D.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(D.PLAYBACKRATE,`${a}`):this.removeAttribute(D.PLAYBACKRATE)}get crossOrigin(){return z(this,g.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(g.CROSSORIGIN,`${a}`)}get autoplay(){return z(this,g.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(g.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(g.AUTOPLAY)}get loop(){return z(this,g.LOOP)!=null}set loop(a){a?this.setAttribute(g.LOOP,""):this.removeAttribute(g.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return z(this,g.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(g.MUTED,""):this.removeAttribute(g.MUTED)}get playsInline(){return z(this,g.PLAYSINLINE)!=null}set playsInline(a){A("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(a){["","none","metadata","auto"].includes(a)?this.setAttribute(g.PRELOAD,a):this.removeAttribute(g.PRELOAD)}};function z(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ce=Ae;import"media-chrome/dist/media-theme-element.js";var nt=`:host {
3
3
  --media-control-display: var(--controls);
4
4
  --media-loading-indicator-display: var(--loading-indicator);
5
5
  --media-dialog-display: var(--dialog);
@@ -150,64 +150,64 @@ media-poster-image:not([src]):not([placeholdersrc]) {
150
150
  :host([no-tooltips]) {
151
151
  --media-tooltip-display: none;
152
152
  }
153
- `;import{TemplateInstance as qt,ChildNodePart as pe,AttrPart as be}from"media-chrome/dist/media-theme-element.js";var J=new WeakMap,Se=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=J.get(this.element);i&&i.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let e=J.get(this.element);e&&e.delete(this.type)}}static for(a){J.has(a.element)||J.set(a.element,new Map);let e=a.attributeName.slice(2),i=J.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function zt(t,a){return t instanceof be&&t.attributeName.startsWith("on")?(Se.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function Xt(t,a){return a instanceof ce&&t instanceof pe?(a.renderInto(t),!0):!1}function Jt(t,a){return a instanceof DocumentFragment&&t instanceof pe?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Qt(t,a){if(t instanceof be){let e=t.attributeNamespace,i=t.element.getAttributeNS(e,t.attributeName);return String(a)!==i&&(t.value=String(a)),!0}return t.value=String(a),!0}function ea(t,a){if(t instanceof be&&a instanceof Element){let e=t.element;return e[t.attributeName]!==a&&(t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),e[t.attributeName]=a),!0}return!1}function ta(t,a){if(typeof a=="boolean"&&t instanceof be){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function aa(t,a){return a===!1&&t instanceof pe?(t.replace(""),!0):!1}function ia(t,a){ea(t,a)||ta(t,a)||zt(t,a)||aa(t,a)||Xt(t,a)||Jt(t,a)||Qt(t,a)}var Ne=new Map,pt=new WeakMap,bt=new WeakMap,ce=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(Ne.has(this.stringsKey))return Ne.get(this.stringsKey);{let a=F.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<e?`{{ ${n} }}`:""),""),Ne.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(pt.get(a)!==e){pt.set(a,e);let n=new qt(e,this.values,this.processor);bt.set(a,n),a instanceof pe?a.replace(...n.children):a.appendChild(n);return}let i=bt.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},ra={processCallback(t,a,e){var i;if(e){for(let[r,n]of a)if(r in e){let d=(i=e[r])!=null?i:"";ia(n,d)}}}};function Q(t,...a){return new ce(t,a,ra)}function ht(t,a){t.renderInto(a)}import{StreamTypes as oa,toMuxVideoURL as ft}from"@mux/playback-core";var na=t=>{let{tokens:a}=t;return a.drm?":host { --_cast-button-drm-display: none; }":""},gt=t=>Q`
153
+ `;import{TemplateInstance as Yt,ChildNodePart as me,AttrPart as ce}from"media-chrome/dist/media-theme-element.js";var X=new WeakMap,Re=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=X.get(this.element);i&&i.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let e=X.get(this.element);e&&e.delete(this.type)}}static for(a){X.has(a.element)||X.set(a.element,new Map);let e=a.attributeName.slice(2),i=X.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function Ft(t,a){return t instanceof ce&&t.attributeName.startsWith("on")?(Re.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function Wt(t,a){return a instanceof ue&&t instanceof me?(a.renderInto(t),!0):!1}function Zt(t,a){return a instanceof DocumentFragment&&t instanceof me?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Gt(t,a){if(t instanceof ce){let e=t.attributeNamespace,i=t.element.getAttributeNS(e,t.attributeName);return String(a)!==i&&(t.value=String(a)),!0}return t.value=String(a),!0}function jt(t,a){if(t instanceof ce&&a instanceof Element){let e=t.element;return e[t.attributeName]!==a&&(t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),e[t.attributeName]=a),!0}return!1}function qt(t,a){if(typeof a=="boolean"&&t instanceof ce){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function zt(t,a){return a===!1&&t instanceof me?(t.replace(""),!0):!1}function Xt(t,a){jt(t,a)||qt(t,a)||Ft(t,a)||zt(t,a)||Wt(t,a)||Zt(t,a)||Gt(t,a)}var ke=new Map,st=new WeakMap,dt=new WeakMap,ue=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(ke.has(this.stringsKey))return ke.get(this.stringsKey);{let a=Y.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<e?`{{ ${n} }}`:""),""),ke.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(st.get(a)!==e){st.set(a,e);let n=new Yt(e,this.values,this.processor);dt.set(a,n),a instanceof me?a.replace(...n.children):a.appendChild(n);return}let i=dt.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},Jt={processCallback(t,a,e){var i;if(e){for(let[r,n]of a)if(r in e){let d=(i=e[r])!=null?i:"";Xt(n,d)}}}};function J(t,...a){return new ue(t,a,Jt)}function lt(t,a){t.renderInto(a)}import{StreamTypes as Qt,toMuxVideoURL as ut}from"@mux/playback-core";var ea=t=>{let{tokens:a}=t;return a.drm?":host { --_cast-button-drm-display: none; }":""},mt=t=>J`
154
154
  <style>
155
- ${na(t)}
156
- ${ct}
155
+ ${ea(t)}
156
+ ${nt}
157
157
  </style>
158
- ${ua(t)}
159
- `,sa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return z(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},da={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",LISTBOX:"listbox",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"},la=Object.values(da).join(", "),ua=t=>{var a,e,i,r,n,d,l,c,R,W,k,A,O,$,h,se,Z,G,Ue,Be,$e,Ye,Fe,We,Ze,Ge,je,qe,ze,Xe,Je,Qe,et;return Q`
158
+ ${ra(t)}
159
+ `,ta=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return q(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},aa={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",LISTBOX:"listbox",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"},ia=Object.values(aa).join(", "),ra=t=>{var a,e,i,r,n,d,l,p,O,F,R,C,_,B,h,oe,W,Z,we,Pe,Ie,De,Ve,Ke,He,Ue,Be,$e,Ye,Fe,We,Ze,Ge;return J`
160
160
  <media-theme
161
161
  template="${t.themeTemplate||!1}"
162
162
  defaultstreamtype="${(a=t.defaultStreamType)!=null?a:!1}"
163
- hotkeys="${sa(t)||!1}"
163
+ hotkeys="${ta(t)||!1}"
164
164
  nohotkeys="${t.noHotKeys||!t.hasSrc||!1}"
165
- noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(oa.LIVE))&&t.targetLiveWindow!==0}"
165
+ noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(Qt.LIVE))&&t.targetLiveWindow!==0}"
166
166
  novolumepref="${t.novolumepref||!1}"
167
167
  disabled="${!t.hasSrc||t.isDialogOpen}"
168
168
  audio="${(i=t.audio)!=null?i:!1}"
169
- style="${(r=it({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
169
+ style="${(r=Xe({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
170
170
  defaultsubtitles="${!t.defaultHiddenCaptions}"
171
171
  forwardseekoffset="${(n=t.forwardSeekOffset)!=null?n:!1}"
172
172
  backwardseekoffset="${(d=t.backwardSeekOffset)!=null?d:!1}"
173
173
  playbackrates="${(l=t.playbackRates)!=null?l:!1}"
174
- defaultshowremainingtime="${(c=t.defaultShowRemainingTime)!=null?c:!1}"
175
- defaultduration="${(R=t.defaultDuration)!=null?R:!1}"
176
- hideduration="${(W=t.hideDuration)!=null?W:!1}"
177
- title="${(k=t.title)!=null?k:!1}"
178
- exportparts="${la}"
174
+ defaultshowremainingtime="${(p=t.defaultShowRemainingTime)!=null?p:!1}"
175
+ defaultduration="${(O=t.defaultDuration)!=null?O:!1}"
176
+ hideduration="${(F=t.hideDuration)!=null?F:!1}"
177
+ title="${(R=t.title)!=null?R:!1}"
178
+ exportparts="${ia}"
179
179
  onclose="${t.onCloseErrorDialog}"
180
180
  onfocusin="${t.onFocusInErrorDialog}"
181
181
  >
182
182
  <mux-video
183
183
  slot="media"
184
- target-live-window="${(A=t.targetLiveWindow)!=null?A:!1}"
185
- stream-type="${(O=z(t.streamType))!=null?O:!1}"
186
- crossorigin="${($=t.crossOrigin)!=null?$:""}"
184
+ target-live-window="${(C=t.targetLiveWindow)!=null?C:!1}"
185
+ stream-type="${(_=q(t.streamType))!=null?_:!1}"
186
+ crossorigin="${(B=t.crossOrigin)!=null?B:""}"
187
187
  playsinline
188
188
  autoplay="${(h=t.autoplay)!=null?h:!1}"
189
- muted="${(se=t.muted)!=null?se:!1}"
190
- loop="${(Z=t.loop)!=null?Z:!1}"
191
- preload="${(G=t.preload)!=null?G:!1}"
192
- debug="${(Ue=t.debug)!=null?Ue:!1}"
193
- prefer-cmcd="${(Be=t.preferCmcd)!=null?Be:!1}"
194
- disable-tracking="${($e=t.disableTracking)!=null?$e:!1}"
195
- disable-cookies="${(Ye=t.disableCookies)!=null?Ye:!1}"
196
- prefer-playback="${(Fe=t.preferPlayback)!=null?Fe:!1}"
189
+ muted="${(oe=t.muted)!=null?oe:!1}"
190
+ loop="${(W=t.loop)!=null?W:!1}"
191
+ preload="${(Z=t.preload)!=null?Z:!1}"
192
+ debug="${(we=t.debug)!=null?we:!1}"
193
+ prefer-cmcd="${(Pe=t.preferCmcd)!=null?Pe:!1}"
194
+ disable-tracking="${(Ie=t.disableTracking)!=null?Ie:!1}"
195
+ disable-cookies="${(De=t.disableCookies)!=null?De:!1}"
196
+ prefer-playback="${(Ve=t.preferPlayback)!=null?Ve:!1}"
197
197
  start-time="${t.startTime!=null?t.startTime:!1}"
198
- beacon-collection-domain="${(We=t.beaconCollectionDomain)!=null?We:!1}"
199
- player-init-time="${(Ze=t.playerInitTime)!=null?Ze:!1}"
200
- player-software-name="${(Ge=t.playerSoftwareName)!=null?Ge:!1}"
201
- player-software-version="${(je=t.playerSoftwareVersion)!=null?je:!1}"
202
- env-key="${(qe=t.envKey)!=null?qe:!1}"
203
- custom-domain="${(ze=t.customDomain)!=null?ze:!1}"
204
- src="${t.src?t.src:t.playbackId?ft(t):!1}"
205
- cast-src="${t.src?t.src:t.playbackId?ft(t):!1}"
206
- cast-receiver="${(Xe=t.castReceiver)!=null?Xe:!1}"
207
- drm-token="${(Qe=(Je=t.tokens)==null?void 0:Je.drm)!=null?Qe:!1}"
198
+ beacon-collection-domain="${(Ke=t.beaconCollectionDomain)!=null?Ke:!1}"
199
+ player-init-time="${(He=t.playerInitTime)!=null?He:!1}"
200
+ player-software-name="${(Ue=t.playerSoftwareName)!=null?Ue:!1}"
201
+ player-software-version="${(Be=t.playerSoftwareVersion)!=null?Be:!1}"
202
+ env-key="${($e=t.envKey)!=null?$e:!1}"
203
+ custom-domain="${(Ye=t.customDomain)!=null?Ye:!1}"
204
+ src="${t.src?t.src:t.playbackId?ut(t):!1}"
205
+ cast-src="${t.src?t.src:t.playbackId?ut(t):!1}"
206
+ cast-receiver="${(Fe=t.castReceiver)!=null?Fe:!1}"
207
+ drm-token="${(Ze=(We=t.tokens)==null?void 0:We.drm)!=null?Ze:!1}"
208
208
  exportparts="video"
209
209
  >
210
- ${t.storyboard?Q`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:Q``}
210
+ ${t.storyboard?J`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:J``}
211
211
  <slot></slot>
212
212
  </mux-video>
213
213
  <slot name="poster" slot="poster">
@@ -215,11 +215,11 @@ media-poster-image:not([src]):not([placeholdersrc]) {
215
215
  part="poster"
216
216
  exportparts="poster, img"
217
217
  src="${t.poster?t.poster:!1}"
218
- placeholdersrc="${(et=t.placeholder)!=null?et:!1}"
218
+ placeholdersrc="${(Ge=t.placeholder)!=null?Ge:!1}"
219
219
  ></media-poster-image>
220
220
  </slot>
221
221
  </media-theme>
222
- `};import{errorCategoryToTokenNameOrPrefix as yt,i18n as f,MediaError as L,MuxErrorCategory as Tt,MuxErrorCode as m}from"@mux/playback-core";var vt=t=>t.charAt(0).toUpperCase()+t.slice(1),ma=(t,a=!1)=>{var e,i;if(t.muxCode){let r=vt((e=t.errorCategory)!=null?e:"video"),n=yt((i=t.errorCategory)!=null?i:Tt.VIDEO);if(t.muxCode===m.NETWORK_OFFLINE)return f("Your device appears to be offline",a);if(t.muxCode===m.NETWORK_TOKEN_EXPIRED)return f("{category} URL has expired",a).format({category:r});if([m.NETWORK_TOKEN_SUB_MISMATCH,m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING,m.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return f("{category} URL is formatted incorrectly",a).format({category:r});if(t.muxCode===m.NETWORK_TOKEN_MISSING)return f("Invalid {categoryName} URL",a).format({categoryName:n});if(t.muxCode===m.NETWORK_NOT_FOUND)return f("{category} does not exist",a).format({category:r});if(t.muxCode===m.NETWORK_NOT_READY)return f("{category} is not currently available",a).format({category:r})}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return f("Network Error",a);if(t.code===L.MEDIA_ERR_DECODE)return f("Media Error",a);if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return f("Source Not Supported",a)}return f("Error",a)},ca=(t,a=!1)=>{var e,i;if(t.muxCode){let r=vt((e=t.errorCategory)!=null?e:"video"),n=yt((i=t.errorCategory)!=null?i:Tt.VIDEO);return t.muxCode===m.NETWORK_OFFLINE?f("Check your internet connection and try reloading this video.",a):t.muxCode===m.NETWORK_TOKEN_EXPIRED?f("The video\u2019s secured {tokenNamePrefix}-token has expired.",a).format({tokenNamePrefix:n}):t.muxCode===m.NETWORK_TOKEN_SUB_MISMATCH?f("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",a).format({tokenNamePrefix:n}):t.muxCode===m.NETWORK_TOKEN_MALFORMED?f("{category} URL is formatted incorrectly",a).format({category:r}):[m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?f("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:n}):[m.NETWORK_TOKEN_MISSING,m.NETWORK_INVALID_URL].includes(t.muxCode)?f("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",a).format({tokenNamePrefix:n}):t.muxCode===m.NETWORK_NOT_FOUND?"":t.muxCode===m.NETWORK_NOT_READY?f("The live stream or video file are not yet ready.",a):t.message}return t.code&&(t.code===L.MEDIA_ERR_NETWORK||t.code===L.MEDIA_ERR_DECODE||t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},Et=(t,a=!1)=>{let e=ma(t,a),i=ca(t,a);return{title:e,message:i}},pa=t=>{if(t.muxCode){if(t.muxCode===m.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===m.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===m.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===m.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===m.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===m.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return"";if(t.code===L.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},we=(t,a)=>{let e=pa(t);return{message:t.message,context:t.context,file:e}};var At=`<template id="media-theme-gerwig">
222
+ `};import{errorCategoryToTokenNameOrPrefix as ct,i18n as f,MediaError as L,MuxErrorCategory as pt,MuxErrorCode as c}from"@mux/playback-core";var bt=t=>t.charAt(0).toUpperCase()+t.slice(1),oa=(t,a=!1)=>{var e,i;if(t.muxCode){let r=bt((e=t.errorCategory)!=null?e:"video"),n=ct((i=t.errorCategory)!=null?i:pt.VIDEO);if(t.muxCode===c.NETWORK_OFFLINE)return f("Your device appears to be offline",a);if(t.muxCode===c.NETWORK_TOKEN_EXPIRED)return f("{category} URL has expired",a).format({category:r});if([c.NETWORK_TOKEN_SUB_MISMATCH,c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING,c.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return f("{category} URL is formatted incorrectly",a).format({category:r});if(t.muxCode===c.NETWORK_TOKEN_MISSING)return f("Invalid {categoryName} URL",a).format({categoryName:n});if(t.muxCode===c.NETWORK_NOT_FOUND)return f("{category} does not exist",a).format({category:r});if(t.muxCode===c.NETWORK_NOT_READY)return f("{category} is not currently available",a).format({category:r})}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return f("Network Error",a);if(t.code===L.MEDIA_ERR_DECODE)return f("Media Error",a);if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return f("Source Not Supported",a)}return f("Error",a)},na=(t,a=!1)=>{var e,i;if(t.muxCode){let r=bt((e=t.errorCategory)!=null?e:"video"),n=ct((i=t.errorCategory)!=null?i:pt.VIDEO);return t.muxCode===c.NETWORK_OFFLINE?f("Check your internet connection and try reloading this video.",a):t.muxCode===c.NETWORK_TOKEN_EXPIRED?f("The video\u2019s secured {tokenNamePrefix}-token has expired.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_TOKEN_SUB_MISMATCH?f("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_TOKEN_MALFORMED?f("{category} URL is formatted incorrectly",a).format({category:r}):[c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?f("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:n}):[c.NETWORK_TOKEN_MISSING,c.NETWORK_INVALID_URL].includes(t.muxCode)?f("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_NOT_FOUND?"":t.muxCode===c.NETWORK_NOT_READY?f("The live stream or video file are not yet ready.",a):t.message}return t.code&&(t.code===L.MEDIA_ERR_NETWORK||t.code===L.MEDIA_ERR_DECODE||t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},ht=(t,a=!1)=>{let e=oa(t,a),i=na(t,a);return{title:e,message:i}},sa=t=>{if(t.muxCode){if(t.muxCode===c.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===c.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===c.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===c.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===c.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===c.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return"";if(t.code===L.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},Oe=(t,a)=>{let e=sa(t);return{message:t.message,context:t.context,file:e}};var ft=`<template id="media-theme-gerwig">
223
223
  <style>
224
224
  @keyframes pre-play-hide {
225
225
  0% {
@@ -1226,7 +1226,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1226
1226
  <slot></slot>
1227
1227
  </media-controller>
1228
1228
  </template>
1229
- `;import{MediaThemeElement as ha}from"media-chrome/dist/media-theme-element.js";import"media-chrome/menu";var Pe=F.createElement("template");"innerHTML"in Pe&&(Pe.innerHTML=At);var Ct,kt,he=class extends ha{};he.template=(kt=(Ct=Pe.content)==null?void 0:Ct.children)==null?void 0:kt[0];v.customElements.get("media-theme-gerwig")||v.customElements.define("media-theme-gerwig",he);var Ea="gerwig";var N={SRC:"src",POSTER:"poster"},o={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips"},Ke=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function Aa(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src||!!t.currentSrc,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(o.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:ka(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(o.NOHOTKEYS),hotKeys:t.getAttribute(o.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableTracking:t.disableTracking,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,minResolution:t.minResolution,programStartTime:t.programStartTime,programEndTime:t.programEndTime,assetStartTime:t.assetStartTime,assetEndTime:t.assetEndTime,renditionOrder:t.renditionOrder,metadata:t.metadata,playerInitTime:t.playerInitTime,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(s.TARGET_LIVE_WINDOW),streamType:z(t.getAttribute(s.STREAM_TYPE)),primaryColor:t.getAttribute(o.PRIMARY_COLOR),secondaryColor:t.getAttribute(o.SECONDARY_COLOR),accentColor:t.getAttribute(o.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:Ra(t),playbackRates:t.getAttribute(o.PLAYBACK_RATES),customDomain:(i=t.getAttribute(s.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(o.TITLE),novolumepref:t.hasAttribute(o.NO_VOLUME_PREF),castReceiver:t.castReceiver,...a,extraSourceParams:t.extraSourceParams}}var Ca=Nt.formatErrorMessage;Nt.formatErrorMessage=t=>{var a,e;if(t instanceof ee){let i=Et(t,!1);return`
1229
+ `;import{MediaThemeElement as la}from"media-chrome/dist/media-theme-element.js";import"media-chrome/menu";var _e=Y.createElement("template");"innerHTML"in _e&&(_e.innerHTML=ft);var gt,yt,pe=class extends la{};pe.template=(yt=(gt=_e.content)==null?void 0:gt.children)==null?void 0:yt[0];E.customElements.get("media-theme-gerwig")||E.customElements.define("media-theme-gerwig",pe);var ha="gerwig";var N={SRC:"src",POSTER:"poster"},o={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips"},Ne=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function fa(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src||!!t.currentSrc,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(o.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:ya(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(o.NOHOTKEYS),hotKeys:t.getAttribute(o.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableTracking:t.disableTracking,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,minResolution:t.minResolution,programStartTime:t.programStartTime,programEndTime:t.programEndTime,assetStartTime:t.assetStartTime,assetEndTime:t.assetEndTime,renditionOrder:t.renditionOrder,metadata:t.metadata,playerInitTime:t.playerInitTime,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(s.TARGET_LIVE_WINDOW),streamType:q(t.getAttribute(s.STREAM_TYPE)),primaryColor:t.getAttribute(o.PRIMARY_COLOR),secondaryColor:t.getAttribute(o.SECONDARY_COLOR),accentColor:t.getAttribute(o.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:Ta(t),playbackRates:t.getAttribute(o.PLAYBACK_RATES),customDomain:(i=t.getAttribute(s.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(o.TITLE),novolumepref:t.hasAttribute(o.NO_VOLUME_PREF),castReceiver:t.castReceiver,...a,extraSourceParams:t.extraSourceParams}}var ga=Rt.formatErrorMessage;Rt.formatErrorMessage=t=>{var a,e;if(t instanceof Q){let i=ht(t,!1);return`
1230
1230
  ${i!=null&&i.title?`<h3>${i.title}</h3>`:""}
1231
1231
  ${i!=null&&i.message||i!=null&&i.linkUrl?`<p>
1232
1232
  ${i==null?void 0:i.message}
@@ -1234,9 +1234,9 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1234
1234
  href="${i.linkUrl}"
1235
1235
  target="_blank"
1236
1236
  rel="external noopener"
1237
- aria-label="${(a=i.linkText)!=null?a:""} ${H("(opens in a new window)")}"
1237
+ aria-label="${(a=i.linkText)!=null?a:""} ${K("(opens in a new window)")}"
1238
1238
  >${(e=i.linkText)!=null?e:i.linkUrl}</a
1239
1239
  >`:""}
1240
1240
  </p>`:""}
1241
- `}return Ca(t)};function ka(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let n=v.customElements.get(a);if(n!=null&&n.template)return n.template}}function Ra(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function _t(t){let a=t.hasAttribute(o.TITLE)?{video_title:t.getAttribute(o.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var Oa=Object.values(s),_a=Object.values(N),xa=Object.values(o),xt=me(),Mt="mux-player",Lt={isDialogOpen:!1},Ma={redundant_streams:!0},ae,ie,re,P,oe,B,M,w,ge,St,ne,He,S,U,ye,wt,Te,Pt,ve,It,Ee,Dt,te=class extends Le{constructor(){super();p(this,M);p(this,ge);p(this,ne);p(this,S);p(this,ye);p(this,Te);p(this,ve);p(this,Ee);p(this,ae,void 0);p(this,ie,!1);p(this,re,{});p(this,P,!0);p(this,oe,new ue(this,"hotkeys"));p(this,B,{...Lt,onCloseErrorDialog:e=>{var r;((r=e.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&b(this,ne,He).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var n;if(((n=e.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;Oe(this,F.activeElement)||e.preventDefault()}});C(this,ae,va()),this.attachShadow({mode:"open"}),b(this,ge,St).call(this),this.isConnected&&b(this,M,w).call(this)}static get NAME(){return Mt}static get VERSION(){return xt}static get observedAttributes(){var e;return[...(e=Le.observedAttributes)!=null?e:[],..._a,...Oa,...xa]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){var i;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=_t(this))}attributeChangedCallback(e,i,r){switch(b(this,M,w).call(this),super.attributeChangedCallback(e,i,r),e){case o.HOTKEYS:u(this,oe).value=r;break;case o.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&_(H("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case o.THUMBNAIL_TOKEN:{if(r){let d=De(r);if(d){let{aud:l}=d,c=Ve.THUMBNAIL;l!==c&&_(H("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"thumbnail"}))}}break}case o.STORYBOARD_TOKEN:{if(r){let d=De(r);if(d){let{aud:l}=d,c=Ve.STORYBOARD;l!==c&&_(H("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"storyboard"}))}}break}case o.DRM_TOKEN:{if(r){let d=De(r);if(d){let{aud:l}=d,c=Ve.DRM;l!==c&&_(H("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&E(H("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:r&&![x.LIVE,x.ON_DEMAND,x.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:xe({file:"invalid-stream-type.md",message:H("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===x.LIVE?this.getAttribute(o.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[s.PLAYBACK_ID,N.SRC,o.PLAYBACK_TOKEN].includes(e)&&i!==r&&C(this,B,{...u(this,B),...Lt}),b(this,S,U).call(this,{[dt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ot.includes(e)?this.setAttribute(s.PREFER_CMCD,e):_(`Invalid value for preferCmcd. Must be one of ${Ot.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Rt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Rt.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(o.THEME))!=null?e:Ea}set theme(e){this.setAttribute(o.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Ke.includes(r))continue;let n=e.getAttribute(r);i[le(r)]=n===""?!0:n}return i}set themeProps(e){var r,n;b(this,M,w).call(this);let i={...this.themeProps,...e};for(let d in i){if(Ke.includes(d))continue;let l=e==null?void 0:e[d];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(de(d),!!l):(n=this.mediaTheme)==null||n.setAttribute(de(d),l)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=K(this,N.SRC))!=null?e:void 0:(i=this.getAttribute(N.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(N.SRC,e):this.removeAttribute(N.SRC)}get poster(){var r;let e=this.getAttribute(N.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){_("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return nt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(N.POSTER,e):this.removeAttribute(N.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(o.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(o.STORYBOARD_SRC,e):this.removeAttribute(o.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[x.LIVE,x.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return st(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(o.AUDIO)}set audio(e){if(!e){this.removeAttribute(o.AUDIO);return}this.setAttribute(o.AUDIO,"")}get hotkeys(){return u(this,oe)}get nohotkeys(){return this.hasAttribute(o.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(o.NOHOTKEYS);return}this.setAttribute(o.NOHOTKEYS,"")}get thumbnailTime(){return y(this.getAttribute(o.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(o.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(o.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(o.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=K(this,o.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(o.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(o.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=v.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(o.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(o.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=v.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(o.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(o.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=v.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(o.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(o.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(o.PLAYBACK_RATES))return this.getAttribute(o.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(o.PLAYBACK_RATES);return}this.setAttribute(o.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=y(this.getAttribute(o.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(o.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=y(this.getAttribute(o.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(o.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(o.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return y(this.getAttribute(o.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(o.DEFAULT_DURATION):this.setAttribute(o.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(s.PLAYER_INIT_TIME)?y(this.getAttribute(s.PLAYER_INIT_TIME)):u(this,ae)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(s.PLAYER_INIT_TIME):this.setAttribute(s.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_NAME))!=null?e:Mt}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:xt}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return y(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return y(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return y(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return y(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(o.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(o.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Ma}set extraSourceParams(e){e==null?this.removeAttribute(o.EXTRA_SOURCE_PARAMS):this.setAttribute(o.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=K(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(o.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(o.NO_VOLUME_PREF,""):this.removeAttribute(o.NO_VOLUME_PREF)}get debug(){return K(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return K(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return K(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:x.UNKNOWN}set streamType(e){this.setAttribute(s.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?r:x.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(o.DEFAULT_STREAM_TYPE,e):this.removeAttribute(o.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return y(K(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.PREFER_PLAYBACK);if(e===fe.MSE||e===fe.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===fe.MSE||e===fe.NATIVE?this.setAttribute(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={..._t(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(i=this.media)==null?void 0:i.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,i;return(i=(e=this.media)==null?void 0:e.cuePoints)!=null?i:[]}addChapters(e){var i;if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(o.PLAYBACK_TOKEN),i=this.getAttribute(o.DRM_TOKEN),r=this.getAttribute(o.THUMBNAIL_TOKEN),n=this.getAttribute(o.STORYBOARD_TOKEN);return{...u(this,re),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...n!=null?{storyboard:n}:{}}}set tokens(e){C(this,re,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(o.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(o.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(o.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(o.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(o.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(o.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(o.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(o.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,n){var l;let d=(l=this.media)==null?void 0:l.nativeEl;if(d)return ya(d,e,i,r,n)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return Ta(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(o.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(o.CAST_RECEIVER,e):this.removeAttribute(o.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){E("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(o.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(o.NO_TOOLTIPS);return}this.setAttribute(o.NO_TOOLTIPS,"")}};ae=new WeakMap,ie=new WeakMap,re=new WeakMap,P=new WeakMap,oe=new WeakMap,B=new WeakMap,M=new WeakSet,w=function(){var e,i,r,n;if(!u(this,ie)){C(this,ie,!0),b(this,S,U).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof v.HTMLElement))throw""}catch{E("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ga))throw""}catch{E("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof fa))throw""}catch{E("<media-controller> failed to upgrade!")}this.init(),b(this,ye,wt).call(this),b(this,Te,Pt).call(this),b(this,ve,It).call(this),C(this,P,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Ie.USER_INACTIVE))!=null?i:!0),b(this,Ee,Dt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>b(this,S,U).call(this)),(n=this.media)==null||n.addEventListener("loadstart",()=>b(this,S,U).call(this))}},ge=new WeakSet,St=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},ne=new WeakSet,He=function(e){Object.assign(u(this,B),e),b(this,S,U).call(this)},S=new WeakSet,U=function(e={}){ht(gt(Aa(this,{...u(this,B),...e})),this.shadowRoot)},ye=new WeakSet,wt=function(){let e=r=>{var l,c;if(!(r!=null&&r.startsWith("theme-")))return;let n=r.replace(/^theme-/,"");if(Ke.includes(n))return;let d=this.getAttribute(r);d!=null?(l=this.mediaTheme)==null||l.setAttribute(n,d):(c=this.mediaTheme)==null||c.removeAttribute(n)};new MutationObserver(r=>{for(let{attributeName:n}of r)e(n)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Te=new WeakSet,Pt=function(){var i;let e=r=>{let{detail:n}=r;if(n instanceof ee||(n=new ee(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){_(n),n.data&&_(`${n.name} data:`,n.data);return}let d=we(n,!1);d.message&&xe(d),E(n),n.data&&E(`${n.name} data:`,n.data),b(this,ne,He).call(this,{isDialogOpen:!0})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var d,l,c;if(!(((d=this.media)==null?void 0:d.error)instanceof ee))return r;let n=we((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(c=this.media)==null?void 0:c.error.code,player_error_message:n.message?String(n.message):r.player_error_message,player_error_context:n.context?String(n.context):r.player_error_context}}),(i=this.media)==null||i.addEventListener("error",r=>{var d,l;let{detail:n}=r;if(!n){let{message:c,code:R}=(l=(d=this.media)==null?void 0:d.error)!=null?l:{};n=new ee(c,R)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},ve=new WeakSet,It=function(){var i,r,n,d;let e=()=>b(this,S,U).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(d=(n=this.media)==null?void 0:n.textTracks)==null||d.addEventListener("removetrack",e)},Ee=new WeakSet,Dt=function(){var R,W;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,n=()=>this.streamType===x.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(k,A,O=!1)=>{if(n())return;Array.from(k&&k.activeCues||[]).forEach(h=>{if(!(!h.snapToLines||h.line<-5||h.line>=0&&h.line<10))if(!A||this.paused){let se=h.text.split(`
1242
- `).length,Z=-3;this.streamType===x.LIVE&&(Z=-2);let G=Z-se;if(h.line===G&&!O)return;r.has(h)||r.set(h,h.line),h.line=G}else setTimeout(()=>{h.line=r.get(h)||"auto"},500)})},l=()=>{var k,A;d(i,(A=(k=this.mediaController)==null?void 0:k.hasAttribute(Ie.USER_INACTIVE))!=null?A:!1)},c=()=>{var O,$;let A=Array.from((($=(O=this.mediaController)==null?void 0:O.media)==null?void 0:$.textTracks)||[]).filter(h=>["subtitles","captions"].includes(h.kind)&&h.mode==="showing")[0];A!==i&&(i==null||i.removeEventListener("cuechange",l)),i=A,i==null||i.addEventListener("cuechange",l),d(i,u(this,P))};c(),(R=this.textTracks)==null||R.addEventListener("change",c),(W=this.textTracks)==null||W.addEventListener("addtrack",c),this.addEventListener("userinactivechange",()=>{var A,O;let k=(O=(A=this.mediaController)==null?void 0:A.hasAttribute(Ie.USER_INACTIVE))!=null?O:!0;u(this,P)!==k&&(C(this,P,k),d(i,u(this,P)))})};function K(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}v.customElements.get("mux-player")||(v.customElements.define("mux-player",te),v.MuxPlayerElement=te);var Ri=te;export{ee as MediaError,Ri as default,va as generatePlayerInitTime,K as getVideoAttribute,Mt as playerSoftwareName,xt as playerSoftwareVersion};
1241
+ `}return ga(t)};function ya(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let n=E.customElements.get(a);if(n!=null&&n.template)return n.template}}function Ta(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function Et(t){let a=t.hasAttribute(o.TITLE)?{video_title:t.getAttribute(o.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var va=Object.values(s),Ea=Object.values(N),Aa=Object.values(o),At=le(),Ct="mux-player",kt={isDialogOpen:!1},Ca={redundant_streams:!0},te,ae,ie,w,re,U,m,S,Ot,Se,H,_t,xt,Mt,Lt,ee=class extends Ce{constructor(){super();v(this,m);v(this,te);v(this,ae,!1);v(this,ie,{});v(this,w,!0);v(this,re,new de(this,"hotkeys"));v(this,U,{...kt,onCloseErrorDialog:e=>{var r;((r=e.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&b(this,m,Se).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var n;if(((n=e.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;Te(this,Y.activeElement)||e.preventDefault()}});k(this,te,ba()),this.attachShadow({mode:"open"}),b(this,m,Ot).call(this),this.isConnected&&b(this,m,S).call(this)}static get NAME(){return Ct}static get VERSION(){return At}static get observedAttributes(){var e;return[...(e=Ce.observedAttributes)!=null?e:[],...Ea,...va,...Aa]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){var i;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=Et(this))}attributeChangedCallback(e,i,r){switch(b(this,m,S).call(this),super.attributeChangedCallback(e,i,r),e){case o.HOTKEYS:u(this,re).value=r;break;case o.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&x(K("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case o.THUMBNAIL_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.THUMBNAIL;l!==p&&x(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"thumbnail"}))}}break}case o.STORYBOARD_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.STORYBOARD;l!==p&&x(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"storyboard"}))}}break}case o.DRM_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.DRM;l!==p&&x(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&A(K("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:r&&![M.LIVE,M.ON_DEMAND,M.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:Ee({file:"invalid-stream-type.md",message:K("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===M.LIVE?this.getAttribute(o.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[s.PLAYBACK_ID,N.SRC,o.PLAYBACK_TOKEN].includes(e)&&i!==r&&k(this,U,{...u(this,U),...kt}),b(this,m,H).call(this,{[at(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?vt.includes(e)?this.setAttribute(s.PREFER_CMCD,e):x(`Invalid value for preferCmcd. Must be one of ${vt.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Tt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Tt.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(o.THEME))!=null?e:ha}set theme(e){this.setAttribute(o.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Ne.includes(r))continue;let n=e.getAttribute(r);i[se(r)]=n===""?!0:n}return i}set themeProps(e){var r,n;b(this,m,S).call(this);let i={...this.themeProps,...e};for(let d in i){if(Ne.includes(d))continue;let l=e==null?void 0:e[d];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(ne(d),!!l):(n=this.mediaTheme)==null||n.setAttribute(ne(d),l)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=V(this,N.SRC))!=null?e:void 0:(i=this.getAttribute(N.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(N.SRC,e):this.removeAttribute(N.SRC)}get poster(){var r;let e=this.getAttribute(N.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){x("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return et(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(N.POSTER,e):this.removeAttribute(N.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(o.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(o.STORYBOARD_SRC,e):this.removeAttribute(o.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[M.LIVE,M.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return tt(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(o.AUDIO)}set audio(e){if(!e){this.removeAttribute(o.AUDIO);return}this.setAttribute(o.AUDIO,"")}get hotkeys(){return u(this,re)}get nohotkeys(){return this.hasAttribute(o.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(o.NOHOTKEYS);return}this.setAttribute(o.NOHOTKEYS,"")}get thumbnailTime(){return y(this.getAttribute(o.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(o.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(o.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(o.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=V(this,o.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(o.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(o.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(o.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(o.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(o.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(o.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(o.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(o.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(o.PLAYBACK_RATES))return this.getAttribute(o.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(o.PLAYBACK_RATES);return}this.setAttribute(o.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=y(this.getAttribute(o.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(o.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=y(this.getAttribute(o.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(o.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(o.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return y(this.getAttribute(o.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(o.DEFAULT_DURATION):this.setAttribute(o.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(s.PLAYER_INIT_TIME)?y(this.getAttribute(s.PLAYER_INIT_TIME)):u(this,te)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(s.PLAYER_INIT_TIME):this.setAttribute(s.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_NAME))!=null?e:Ct}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:At}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return y(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return y(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return y(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return y(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(o.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(o.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Ca}set extraSourceParams(e){e==null?this.removeAttribute(o.EXTRA_SOURCE_PARAMS):this.setAttribute(o.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=V(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(o.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(o.NO_VOLUME_PREF,""):this.removeAttribute(o.NO_VOLUME_PREF)}get debug(){return V(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return V(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return V(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:M.UNKNOWN}set streamType(e){this.setAttribute(s.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?r:M.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(o.DEFAULT_STREAM_TYPE,e):this.removeAttribute(o.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return y(V(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.PREFER_PLAYBACK);if(e===be.MSE||e===be.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===be.MSE||e===be.NATIVE?this.setAttribute(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Et(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(i=this.media)==null?void 0:i.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,i;return(i=(e=this.media)==null?void 0:e.cuePoints)!=null?i:[]}addChapters(e){var i;if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(o.PLAYBACK_TOKEN),i=this.getAttribute(o.DRM_TOKEN),r=this.getAttribute(o.THUMBNAIL_TOKEN),n=this.getAttribute(o.STORYBOARD_TOKEN);return{...u(this,ie),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...n!=null?{storyboard:n}:{}}}set tokens(e){k(this,ie,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(o.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(o.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(o.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(o.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(o.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(o.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(o.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(o.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,n){var l;let d=(l=this.media)==null?void 0:l.nativeEl;if(d)return ca(d,e,i,r,n)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return pa(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(o.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(o.CAST_RECEIVER,e):this.removeAttribute(o.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){A("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(o.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(o.NO_TOOLTIPS);return}this.setAttribute(o.NO_TOOLTIPS,"")}};te=new WeakMap,ae=new WeakMap,ie=new WeakMap,w=new WeakMap,re=new WeakMap,U=new WeakMap,m=new WeakSet,S=function(){var e,i,r,n;if(!u(this,ae)){k(this,ae,!0),b(this,m,H).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof E.HTMLElement))throw""}catch{A("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ma))throw""}catch{A("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ua))throw""}catch{A("<media-controller> failed to upgrade!")}this.init(),b(this,m,_t).call(this),b(this,m,xt).call(this),b(this,m,Mt).call(this),k(this,w,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(xe.USER_INACTIVE))!=null?i:!0),b(this,m,Lt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>b(this,m,H).call(this)),(n=this.media)==null||n.addEventListener("loadstart",()=>b(this,m,H).call(this))}},Ot=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Se=function(e){Object.assign(u(this,U),e),b(this,m,H).call(this)},H=function(e={}){lt(mt(fa(this,{...u(this,U),...e})),this.shadowRoot)},_t=function(){let e=r=>{var l,p;if(!(r!=null&&r.startsWith("theme-")))return;let n=r.replace(/^theme-/,"");if(Ne.includes(n))return;let d=this.getAttribute(r);d!=null?(l=this.mediaTheme)==null||l.setAttribute(n,d):(p=this.mediaTheme)==null||p.removeAttribute(n)};new MutationObserver(r=>{for(let{attributeName:n}of r)e(n)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},xt=function(){var i;let e=r=>{let{detail:n}=r;if(n instanceof Q||(n=new Q(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){x(n),n.data&&x(`${n.name} data:`,n.data);return}let d=Oe(n,!1);d.message&&Ee(d),A(n),n.data&&A(`${n.name} data:`,n.data),b(this,m,Se).call(this,{isDialogOpen:!0})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var d,l,p;if(!(((d=this.media)==null?void 0:d.error)instanceof Q))return r;let n=Oe((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(p=this.media)==null?void 0:p.error.code,player_error_message:n.message?String(n.message):r.player_error_message,player_error_context:n.context?String(n.context):r.player_error_context}}),(i=this.media)==null||i.addEventListener("error",r=>{var d,l;let{detail:n}=r;if(!n){let{message:p,code:O}=(l=(d=this.media)==null?void 0:d.error)!=null?l:{};n=new Q(p,O)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Mt=function(){var i,r,n,d;let e=()=>b(this,m,H).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(d=(n=this.media)==null?void 0:n.textTracks)==null||d.addEventListener("removetrack",e)},Lt=function(){var O,F;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,n=()=>this.streamType===M.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(R,C,_=!1)=>{if(n())return;Array.from(R&&R.activeCues||[]).forEach(h=>{if(!(!h.snapToLines||h.line<-5||h.line>=0&&h.line<10))if(!C||this.paused){let oe=h.text.split(`
1242
+ `).length,W=-3;this.streamType===M.LIVE&&(W=-2);let Z=W-oe;if(h.line===Z&&!_)return;r.has(h)||r.set(h,h.line),h.line=Z}else setTimeout(()=>{h.line=r.get(h)||"auto"},500)})},l=()=>{var R,C;d(i,(C=(R=this.mediaController)==null?void 0:R.hasAttribute(xe.USER_INACTIVE))!=null?C:!1)},p=()=>{var _,B;let C=Array.from(((B=(_=this.mediaController)==null?void 0:_.media)==null?void 0:B.textTracks)||[]).filter(h=>["subtitles","captions"].includes(h.kind)&&h.mode==="showing")[0];C!==i&&(i==null||i.removeEventListener("cuechange",l)),i=C,i==null||i.addEventListener("cuechange",l),d(i,u(this,w))};p(),(O=this.textTracks)==null||O.addEventListener("change",p),(F=this.textTracks)==null||F.addEventListener("addtrack",p),this.addEventListener("userinactivechange",()=>{var C,_;let R=(_=(C=this.mediaController)==null?void 0:C.hasAttribute(xe.USER_INACTIVE))!=null?_:!0;u(this,w)!==R&&(k(this,w,R),d(i,u(this,w)))})};function V(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}E.customElements.get("mux-player")||(E.customElements.define("mux-player",ee),E.MuxPlayerElement=ee);var Ti=ee;export{Q as MediaError,Ti as default,ba as generatePlayerInitTime,V as getVideoAttribute,Ct as playerSoftwareName,At as playerSoftwareVersion};