@mux/mux-player 2.7.0 → 2.8.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- var Ce=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var u=(t,a,e)=>(Ce(t,a,"read from private field"),e?e.call(t):a.get(t)),h=(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)},x=(t,a,e,i)=>(Ce(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var g=(t,a,e)=>(Ce(t,a,"access private method"),e);var Z=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends Z{}globalThis.DocumentFragment=t}var z=class extends Z{},xe=class extends Z{},Ut={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(z)}},X,Le=class{constructor(a,e={}){h(this,X,void 0);x(this,X,e==null?void 0:e.detail)}get detail(){return u(this,X)}initCustomEvent(){}};X=new WeakMap;function $t(t,a){return new z}var ot={document:{createElement:$t},DocumentFragment,customElements:Ut,CustomEvent:Le,EventTarget:Z,HTMLElement:z,HTMLVideoElement:xe},nt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",c=nt?ot:globalThis,T=nt?ot.document:globalThis.document;import{MediaController as ga}from"media-chrome";import{Attributes as He}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Mt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import fa,{MediaError as fe,Attributes as d}from"@mux/mux-video";import{StreamTypes as w,PlaybackTypes as ye,addTextTrack as ya,removeTextTrack as va,CmcdTypeValues as _t}from"@mux/playback-core";import{VideoEvents as Gt}from"@mux/mux-video";var Kt="en",U={code:Kt};var st="en";function l(t,a=!0){var r,o;let e=a&&(o=(r=U)==null?void 0:r[t])!=null?o:t,i=a?U.code:st;return new Re(e,i)}var Re=class{constructor(a,e=(i=>(i=U.code)!=null?i:st)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function dt(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${se(e)}: ${i}; `)}),a?a.trim():void 0}function se(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function de(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function L(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function we(t){let a=Ft(t).toString();return a?"?"+a:""}function Ft(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function P(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var Oe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Oe(t,a.getRootNode().host);import{StreamTypes as Se}from"@mux/playback-core";var lt="mux.com",Yt=()=>{try{return"2.7.0"}catch{}return"UNKNOWN"},Wt=Yt(),me=()=>Wt,mt=(t,{token:a,customDomain:e=lt,thumbnailTime:i,programTime:r}={})=>{let o=a==null?i:void 0,{aud:s}=P(a);if(!(a&&s!=="t"))return`https://image.${e}/${t}/thumbnail.webp${we({token:a,time:o,program_time:r})}`},ut=(t,{token:a,customDomain:e=lt,programStartTime:i,programEndTime:r}={})=>{let{aud:o}=P(a);if(!(a&&o!=="s"))return`https://image.${e}/${t}/storyboard.vtt${we({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},J=t=>{if(t){if([Se.LIVE,Se.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Se.LIVE}};var Zt={crossorigin:"crossOrigin",playsinline:"playsInline"};function ct(t){var a;return(a=Zt[t])!=null?a:de(t)}var $,K,E,le=class{constructor(a,e){h(this,$,void 0);h(this,K,void 0);h(this,E,[]);x(this,$,a),x(this,K,e)}[Symbol.iterator](){return u(this,E).values()}get length(){return u(this,E).length}get value(){var a;return(a=u(this,E).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(x(this,E,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,E)[a]}values(){return u(this,E).values()}keys(){return u(this,E).keys()}forEach(a){u(this,E).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,E).push(r)}),!(this.value===""&&!((e=u(this,$))!=null&&e.hasAttribute(`${u(this,K)}`)))&&((i=u(this,$))==null||i.setAttribute(`${u(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,E).splice(u(this,E).indexOf(i),1)}),(e=u(this,$))==null||e.setAttribute(`${u(this,K)}`,`${this.value}`)}contains(a){return u(this,E).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)}};$=new WeakMap,K=new WeakMap,E=new WeakMap;var pt=`[mux-player ${me()}]`;function N(...t){console.warn(pt,...t)}function A(...t){console.error(pt,...t)}function Me(t){var e;let a=(e=t.message)!=null?e:"";if(t.context&&(a+=` ${t.context}`),t.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${l("Read more: ")}
2
- ${i}${t.file}`}N(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},F={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ht=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}}),jt=Gt.filter(t=>t!=="error"),qt=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),zt=Object.values(F);function gt(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),jt.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,i=>{t.dispatchEvent(new Event(i.type))})})}var _e=class extends c.HTMLElement{static get observedAttributes(){return[...qt,...zt]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(i=>{var r;(r=this.media)==null||r.append(i.cloneNode())});let a=i=>{for(let r of i)r.type==="childList"&&(r.removedNodes.forEach(o=>{var m,p;let s=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);s&&((p=this.media)==null||p.removeChild(s))}),r.addedNodes.forEach(o=>{var s;(s=this.media)==null||s.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,i){var r,o;switch(a){case F.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case F.VOLUME:{let s=(r=L(i))!=null?r:1;this.media&&(this.media.volume=s);return}case F.PLAYBACKRATE:{let s=(o=L(i))!=null?o:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);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()}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:ht}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:ht}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 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=L(this.getAttribute(F.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(F.PLAYBACKRATE,`${a}`):this.removeAttribute(F.PLAYBACKRATE)}get crossOrigin(){return Q(this,y.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(y.CROSSORIGIN,`${a}`)}get autoplay(){return Q(this,y.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(y.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return Q(this,y.LOOP)!=null}set loop(a){a?this.setAttribute(y.LOOP,""):this.removeAttribute(y.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 Q(this,y.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return Q(this,y.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(y.PRELOAD,a):this.removeAttribute(y.PRELOAD)}};function Q(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Pe=_e;import"media-chrome/dist/media-theme-element.js";var ft=`:host {
1
+ var Ce=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var u=(t,a,e)=>(Ce(t,a,"read from private field"),e?e.call(t):a.get(t)),h=(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)},x=(t,a,e,i)=>(Ce(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var g=(t,a,e)=>(Ce(t,a,"access private method"),e);var Z=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends Z{}globalThis.DocumentFragment=t}var z=class extends Z{},xe=class extends Z{},Kt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(z)}},X,Le=class{constructor(a,e={}){h(this,X,void 0);x(this,X,e==null?void 0:e.detail)}get detail(){return u(this,X)}initCustomEvent(){}};X=new WeakMap;function Ft(t,a){return new z}var st={document:{createElement:Ft},DocumentFragment,customElements:Kt,CustomEvent:Le,EventTarget:Z,HTMLElement:z,HTMLVideoElement:xe},dt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",c=dt?st:globalThis,T=dt?st.document:globalThis.document;import{MediaController as va}from"media-chrome";import{Attributes as He}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Pt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import Ea,{MediaError as fe,Attributes as d}from"@mux/mux-video";import{StreamTypes as w,PlaybackTypes as ye,addTextTrack as ka,removeTextTrack as Ta,CmcdTypeValues as Nt}from"@mux/playback-core";import{VideoEvents as qt}from"@mux/mux-video";var Yt="en",U={code:Yt};var lt="en";function l(t,a=!0){var r,o;let e=a&&(o=(r=U)==null?void 0:r[t])!=null?o:t,i=a?U.code:lt;return new Re(e,i)}var Re=class{constructor(a,e=(i=>(i=U.code)!=null?i:lt)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function mt(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${se(e)}: ${i}; `)}),a?a.trim():void 0}function se(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function de(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function L(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function we(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)}function P(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var Oe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Oe(t,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var ut="mux.com",Zt=()=>{try{return"2.8.0"}catch{}return"UNKNOWN"},Gt=Zt(),me=()=>Gt,ct=(t,{token:a,customDomain:e=ut,thumbnailTime:i,programTime:r}={})=>{let o=a==null?i:void 0,{aud:s}=P(a);if(!(a&&s!=="t"))return`https://image.${e}/${t}/thumbnail.webp${we({token:a,time:o,program_time:r})}`},pt=(t,{token:a,customDomain:e=ut,programStartTime:i,programEndTime:r}={})=>{let{aud:o}=P(a);if(!(a&&o!=="s"))return`https://image.${e}/${t}/storyboard.vtt${we({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},J=t=>{if(t){if([Me.LIVE,Me.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Me.LIVE}};var jt={crossorigin:"crossOrigin",playsinline:"playsInline"};function bt(t){var a;return(a=jt[t])!=null?a:de(t)}var $,K,E,le=class{constructor(a,e){h(this,$,void 0);h(this,K,void 0);h(this,E,[]);x(this,$,a),x(this,K,e)}[Symbol.iterator](){return u(this,E).values()}get length(){return u(this,E).length}get value(){var a;return(a=u(this,E).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(x(this,E,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,E)[a]}values(){return u(this,E).values()}keys(){return u(this,E).keys()}forEach(a){u(this,E).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,E).push(r)}),!(this.value===""&&!((e=u(this,$))!=null&&e.hasAttribute(`${u(this,K)}`)))&&((i=u(this,$))==null||i.setAttribute(`${u(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,E).splice(u(this,E).indexOf(i),1)}),(e=u(this,$))==null||e.setAttribute(`${u(this,K)}`,`${this.value}`)}contains(a){return u(this,E).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)}};$=new WeakMap,K=new WeakMap,E=new WeakMap;var ht=`[mux-player ${me()}]`;function N(...t){console.warn(ht,...t)}function A(...t){console.error(ht,...t)}function _e(t){var e;let a=(e=t.message)!=null?e:"";if(t.context&&(a+=` ${t.context}`),t.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${l("Read more: ")}
2
+ ${i}${t.file}`}N(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},F={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ft=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}}),zt=qt.filter(t=>t!=="error"),Xt=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),Jt=Object.values(F);function yt(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),zt.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,i=>{t.dispatchEvent(new Event(i.type))})})}var Se=class extends c.HTMLElement{static get observedAttributes(){return[...Xt,...Jt]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(i=>{var r;(r=this.media)==null||r.append(i.cloneNode())});let a=i=>{for(let r of i)r.type==="childList"&&(r.removedNodes.forEach(o=>{var m,p;let s=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);s&&((p=this.media)==null||p.removeChild(s))}),r.addedNodes.forEach(o=>{var s;(s=this.media)==null||s.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,i){var r,o;switch(a){case F.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case F.VOLUME:{let s=(r=L(i))!=null?r:1;this.media&&(this.media.volume=s);return}case F.PLAYBACKRATE:{let s=(o=L(i))!=null?o:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);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()}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:ft}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:ft}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 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=L(this.getAttribute(F.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(F.PLAYBACKRATE,`${a}`):this.removeAttribute(F.PLAYBACKRATE)}get crossOrigin(){return Q(this,y.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(y.CROSSORIGIN,`${a}`)}get autoplay(){return Q(this,y.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(y.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return Q(this,y.LOOP)!=null}set loop(a){a?this.setAttribute(y.LOOP,""):this.removeAttribute(y.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 Q(this,y.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return Q(this,y.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(y.PRELOAD,a):this.removeAttribute(y.PRELOAD)}};function Q(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Pe=Se;import"media-chrome/dist/media-theme-element.js";var vt=`:host {
3
3
  --media-control-display: var(--controls);
4
4
  --media-loading-indicator-display: var(--loading-indicator);
5
5
  --media-dialog-display: var(--dialog);
@@ -15,7 +15,7 @@ ${i}${t.file}`}N(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"l
15
15
  --media-airplay-button-display: var(--airplay-button);
16
16
  --media-pip-button-display: var(--pip-button);
17
17
  --media-fullscreen-button-display: var(--fullscreen-button);
18
- --media-cast-button-display: var(--cast-button);
18
+ --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display));
19
19
  --media-playback-rate-button-display: var(--playback-rate-button);
20
20
  --media-playback-rate-selectmenu-display: var(--playback-rate-selectmenu);
21
21
  --media-volume-range-display: var(--volume-range);
@@ -73,7 +73,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
73
73
  --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button));
74
74
  --media-pip-button-display: var(--pip-button, var(--top-pip-button));
75
75
  --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button));
76
- --media-cast-button-display: var(--cast-button, var(--top-cast-button));
76
+ --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display)));
77
77
  --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button));
78
78
  --media-playback-rate-selectmenu-display: var(
79
79
  --captions-selectmenu,
@@ -104,7 +104,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
104
104
  --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button));
105
105
  --media-pip-button-display: var(--pip-button, var(--center-pip-button));
106
106
  --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button));
107
- --media-cast-button-display: var(--cast-button, var(--center-cast-button));
107
+ --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display)));
108
108
  --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button));
109
109
  --media-playback-rate-selectmenu-display: var(
110
110
  --playback-rate-selectmenu,
@@ -134,7 +134,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
134
134
  --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button));
135
135
  --media-pip-button-display: var(--pip-button, var(--bottom-pip-button));
136
136
  --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button));
137
- --media-cast-button-display: var(--cast-button, var(--bottom-cast-button));
137
+ --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display)));
138
138
  --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button));
139
139
  --media-playback-rate-selectmenu-display: var(
140
140
  --playback-rate-selectmenu,
@@ -146,7 +146,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
146
146
  --media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
147
147
  --media-title-display-display: var(--title-display, var(--bottom-title-display));
148
148
  }
149
- `;var vt=`
149
+ `;var kt=`
150
150
  :host {
151
151
  z-index: 100;
152
152
  display: var(--media-dialog-display, flex);
@@ -198,15 +198,15 @@ media-poster-image:not([src]):not([placeholdersrc]) {
198
198
  text-align: center;
199
199
  line-height: 1.4;
200
200
  }
201
- `,Et=T.createElement("template");Et.innerHTML=`
201
+ `,Tt=T.createElement("template");Tt.innerHTML=`
202
202
  <style>
203
- ${vt}
203
+ ${kt}
204
204
  </style>
205
205
 
206
206
  <div class="dialog">
207
207
  <slot></slot>
208
208
  </div>
209
- `;var I=class extends c.HTMLElement{constructor(){var e;super();this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),yt(this)}close(){this.hasAttribute("open")&&(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),Jt(this))}attributeChangedCallback(e,i,r){e==="open"&&i!==r&&(r!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&yt(this)}};I.styles=vt,I.template=Et,I.observedAttributes=["open"];function yt(t){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(t.dispatchEvent(a),a.defaultPrevented)return;let e=t.querySelector("[autofocus]:not([disabled])");!e&&t.tabIndex>=0&&(e=t),e||(e=kt(t.shadowRoot)),t._previouslyFocusedElement=T.activeElement,T.activeElement instanceof HTMLElement&&T.activeElement.blur(),t.addEventListener("transitionend",()=>{e instanceof HTMLElement&&e.focus({preventScroll:!0})},{once:!0})}function kt(t){let e=["button","input","keygen","select","textarea"].map(function(r){return r+":not([disabled])"});e.push('[tabindex]:not([disabled]):not([tabindex=""])');let i=t==null?void 0:t.querySelector(e.join(", "));if(!i&&"attachShadow"in Element.prototype){let r=(t==null?void 0:t.querySelectorAll("*"))||[];for(let o=0;o<r.length&&!(r[o].tagName&&r[o].shadowRoot&&(i=kt(r[o].shadowRoot),i));o++);}return i}function Jt(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}c.customElements.get("media-dialog")||(c.customElements.define("media-dialog",I),c.MediaDialog=I);var Ne=I;var Tt=T.createElement("template");Tt.innerHTML=`
209
+ `;var I=class extends c.HTMLElement{constructor(){var e;super();this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),Et(this)}close(){this.hasAttribute("open")&&(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),ea(this))}attributeChangedCallback(e,i,r){e==="open"&&i!==r&&(r!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&Et(this)}};I.styles=kt,I.template=Tt,I.observedAttributes=["open"];function Et(t){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(t.dispatchEvent(a),a.defaultPrevented)return;let e=t.querySelector("[autofocus]:not([disabled])");!e&&t.tabIndex>=0&&(e=t),e||(e=At(t.shadowRoot)),t._previouslyFocusedElement=T.activeElement,T.activeElement instanceof HTMLElement&&T.activeElement.blur(),t.addEventListener("transitionend",()=>{e instanceof HTMLElement&&e.focus({preventScroll:!0})},{once:!0})}function At(t){let e=["button","input","keygen","select","textarea"].map(function(r){return r+":not([disabled])"});e.push('[tabindex]:not([disabled]):not([tabindex=""])');let i=t==null?void 0:t.querySelector(e.join(", "));if(!i&&"attachShadow"in Element.prototype){let r=(t==null?void 0:t.querySelectorAll("*"))||[];for(let o=0;o<r.length&&!(r[o].tagName&&r[o].shadowRoot&&(i=At(r[o].shadowRoot),i));o++);}return i}function ea(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}c.customElements.get("media-dialog")||(c.customElements.define("media-dialog",I),c.MediaDialog=I);var Ne=I;var Ct=T.createElement("template");Ct.innerHTML=`
210
210
  <style>
211
211
  ${Ne.styles}
212
212
 
@@ -237,22 +237,23 @@ media-poster-image:not([src]):not([placeholdersrc]) {
237
237
  </svg>
238
238
  </button>
239
239
  </slot>
240
- `;var ee=class extends Ne{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ee.template=Tt;c.customElements.get("mxp-dialog")||(c.customElements.define("mxp-dialog",ee),c.MxpDialog=ee);import{TemplateInstance as Qt,ChildNodePart as ce,AttrPart as pe}from"media-chrome/dist/media-theme-element.js";var te=new WeakMap,De=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=te.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=te.get(this.element);e&&e.delete(this.type)}}static for(a){te.has(a.element)||te.set(a.element,new Map);let e=a.attributeName.slice(2),i=te.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function ea(t,a){return t instanceof pe&&t.attributeName.startsWith("on")?(De.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function ta(t,a){return a instanceof ue&&t instanceof ce?(a.renderInto(t),!0):!1}function aa(t,a){return a instanceof DocumentFragment&&t instanceof ce?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function ia(t,a){if(t instanceof pe){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 ra(t,a){if(t instanceof pe&&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 oa(t,a){if(typeof a=="boolean"&&t instanceof pe){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function na(t,a){return a===!1&&t instanceof ce?(t.replace(""),!0):!1}function sa(t,a){ra(t,a)||oa(t,a)||ea(t,a)||na(t,a)||ta(t,a)||aa(t,a)||ia(t,a)}var Ie=new Map,At=new WeakMap,Ct=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(Ie.has(this.stringsKey))return Ie.get(this.stringsKey);{let a=T.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,o)=>i+r+(o<e?`{{ ${o} }}`:""),""),Ie.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(At.get(a)!==e){At.set(a,e);let o=new Qt(e,this.values,this.processor);Ct.set(a,o),a instanceof ce?a.replace(...o.children):a.appendChild(o);return}let i=Ct.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},da={processCallback(t,a,e){var i;if(e){for(let[r,o]of a)if(r in e){let s=(i=e[r])!=null?i:"";sa(o,s)}}}};function S(t,...a){return new ue(t,a,da)}function xt(t,a){t.renderInto(a)}import{StreamTypes as la,toMuxVideoURL as Lt}from"@mux/playback-core";var Rt=t=>S`
240
+ `;var ee=class extends Ne{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ee.template=Ct;c.customElements.get("mxp-dialog")||(c.customElements.define("mxp-dialog",ee),c.MxpDialog=ee);import{TemplateInstance as ta,ChildNodePart as ce,AttrPart as pe}from"media-chrome/dist/media-theme-element.js";var te=new WeakMap,De=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=te.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=te.get(this.element);e&&e.delete(this.type)}}static for(a){te.has(a.element)||te.set(a.element,new Map);let e=a.attributeName.slice(2),i=te.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function aa(t,a){return t instanceof pe&&t.attributeName.startsWith("on")?(De.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function ia(t,a){return a instanceof ue&&t instanceof ce?(a.renderInto(t),!0):!1}function ra(t,a){return a instanceof DocumentFragment&&t instanceof ce?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function oa(t,a){if(t instanceof pe){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 na(t,a){if(t instanceof pe&&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 sa(t,a){if(typeof a=="boolean"&&t instanceof pe){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function da(t,a){return a===!1&&t instanceof ce?(t.replace(""),!0):!1}function la(t,a){na(t,a)||sa(t,a)||aa(t,a)||da(t,a)||ia(t,a)||ra(t,a)||oa(t,a)}var Ie=new Map,xt=new WeakMap,Lt=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(Ie.has(this.stringsKey))return Ie.get(this.stringsKey);{let a=T.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,o)=>i+r+(o<e?`{{ ${o} }}`:""),""),Ie.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(xt.get(a)!==e){xt.set(a,e);let o=new ta(e,this.values,this.processor);Lt.set(a,o),a instanceof ce?a.replace(...o.children):a.appendChild(o);return}let i=Lt.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},ma={processCallback(t,a,e){var i;if(e){for(let[r,o]of a)if(r in e){let s=(i=e[r])!=null?i:"";la(o,s)}}}};function M(t,...a){return new ue(t,a,ma)}function Rt(t,a){t.renderInto(a)}import{StreamTypes as ua,toMuxVideoURL as wt}from"@mux/playback-core";var ca=t=>{let{tokens:a}=t;return a.drm?":host { --_cast-button-drm-display: none; }":""},Ot=t=>M`
241
241
  <style>
242
- ${ft}
242
+ ${ca(t)}
243
+ ${vt}
243
244
  </style>
244
- ${pa(t)}
245
- `,ma=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return J(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},ua={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",SELECTMENU:"selectmenu",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"},ca=Object.values(ua).join(", "),pa=t=>{var a,e,i,r,o,s,m,p,R,k,v,f,C,_,b,B,j,q,$e,Ke,Fe,Ye,We,Ze,Ge,je,qe,ze,Xe,Je,Qe,et,tt,at,it,rt;return S`
245
+ ${ga(t)}
246
+ `,pa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return J(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},ba={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",SELECTMENU:"selectmenu",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"},ha=Object.values(ba).join(", "),ga=t=>{var a,e,i,r,o,s,m,p,R,k,v,f,C,S,b,B,j,q,$e,Ke,Fe,Ye,We,Ze,Ge,je,qe,ze,Xe,Je,Qe,et,tt,at,it,rt,ot,nt;return M`
246
247
  <media-theme
247
248
  template="${t.themeTemplate||!1}"
248
249
  defaultstreamtype="${(a=t.defaultStreamType)!=null?a:!1}"
249
- hotkeys="${ma(t)||!1}"
250
+ hotkeys="${pa(t)||!1}"
250
251
  nohotkeys="${t.noHotKeys||!t.hasSrc||t.isDialogOpen||!1}"
251
- noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(la.LIVE))&&t.targetLiveWindow!==0}"
252
+ noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(ua.LIVE))&&t.targetLiveWindow!==0}"
252
253
  novolumepref="${t.novolumepref||!1}"
253
254
  disabled="${!t.hasSrc||t.isDialogOpen}"
254
255
  audio="${(i=t.audio)!=null?i:!1}"
255
- style="${(r=dt({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
256
+ style="${(r=mt({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
256
257
  defaultsubtitles="${!t.defaultHiddenCaptions}"
257
258
  forwardseekoffset="${(o=t.forwardSeekOffset)!=null?o:!1}"
258
259
  backwardseekoffset="${(s=t.backwardSeekOffset)!=null?s:!1}"
@@ -261,13 +262,13 @@ media-poster-image:not([src]):not([placeholdersrc]) {
261
262
  defaultduration="${(R=t.defaultDuration)!=null?R:!1}"
262
263
  hideduration="${(k=t.hideDuration)!=null?k:!1}"
263
264
  title="${(v=t.title)!=null?v:!1}"
264
- exportparts="${ca}"
265
+ exportparts="${ha}"
265
266
  >
266
267
  <mux-video
267
268
  slot="media"
268
269
  target-live-window="${(f=t.targetLiveWindow)!=null?f:!1}"
269
270
  stream-type="${(C=J(t.streamType))!=null?C:!1}"
270
- crossorigin="${(_=t.crossOrigin)!=null?_:""}"
271
+ crossorigin="${(S=t.crossOrigin)!=null?S:""}"
271
272
  playsinline
272
273
  autoplay="${(b=t.autoplay)!=null?b:!1}"
273
274
  muted="${(B=t.muted)!=null?B:!1}"
@@ -284,40 +285,41 @@ media-poster-image:not([src]):not([placeholdersrc]) {
284
285
  player-software-version="${(je=t.playerSoftwareVersion)!=null?je:!1}"
285
286
  env-key="${(qe=t.envKey)!=null?qe:!1}"
286
287
  custom-domain="${(ze=t.customDomain)!=null?ze:!1}"
287
- src="${t.src?t.src:t.playbackId?Lt(t):!1}"
288
- cast-src="${t.src?t.src:t.playbackId?Lt(t):!1}"
288
+ src="${t.src?t.src:t.playbackId?wt(t):!1}"
289
+ cast-src="${t.src?t.src:t.playbackId?wt(t):!1}"
290
+ drm-token="${(Je=(Xe=t.tokens)==null?void 0:Xe.drm)!=null?Je:!1}"
289
291
  exportparts="video"
290
292
  >
291
- ${t.storyboard?S`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:S``}
293
+ ${t.storyboard?M`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:M``}
292
294
  </mux-video>
293
295
  <slot name="poster" slot="poster">
294
296
  <media-poster-image
295
297
  part="poster"
296
298
  exportparts="poster, img"
297
- src="${t.poster===""?!1:(Xe=t.poster)!=null?Xe:!1}"
298
- placeholdersrc="${(Je=t.placeholder)!=null?Je:!1}"
299
+ src="${t.poster===""?!1:(Qe=t.poster)!=null?Qe:!1}"
300
+ placeholdersrc="${(et=t.placeholder)!=null?et:!1}"
299
301
  ></media-poster-image>
300
302
  </slot>
301
303
  <mxp-dialog
302
304
  no-auto-hide
303
- open="${(Qe=t.isDialogOpen)!=null?Qe:!1}"
305
+ open="${(tt=t.isDialogOpen)!=null?tt:!1}"
304
306
  onclose="${t.onCloseErrorDialog}"
305
307
  oninitfocus="${t.onInitFocusDialog}"
306
308
  >
307
- ${(et=t.dialog)!=null&&et.title?S`<h3>${t.dialog.title}</h3>`:S``}
309
+ ${(at=t.dialog)!=null&&at.title?M`<h3>${t.dialog.title}</h3>`:M``}
308
310
  <p>
309
- ${(tt=t.dialog)==null?void 0:tt.message}
310
- ${(at=t.dialog)!=null&&at.linkUrl?S`<a
311
+ ${(it=t.dialog)==null?void 0:it.message}
312
+ ${(rt=t.dialog)!=null&&rt.linkUrl?M`<a
311
313
  href="${t.dialog.linkUrl}"
312
314
  target="_blank"
313
315
  rel="external noopener"
314
- aria-label="${(it=t.dialog.linkText)!=null?it:""} ${l("(opens in a new window)")}"
315
- >${(rt=t.dialog.linkText)!=null?rt:t.dialog.linkUrl}</a
316
- >`:S``}
316
+ aria-label="${(ot=t.dialog.linkText)!=null?ot:""} ${l("(opens in a new window)")}"
317
+ >${(nt=t.dialog.linkText)!=null?nt:t.dialog.linkUrl}</a
318
+ >`:M``}
317
319
  </p>
318
320
  </mxp-dialog>
319
321
  </media-theme>
320
- `};import{MediaError as be}from"@mux/mux-video";function he(t,a,e,i,r){var m,p,R;let o={},s={};switch(t.code){case be.MEDIA_ERR_NETWORK:{switch(o.title=l("Network Error",r),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=l("Video is not currently available",r),o.message=l("The live stream or video file are not yet ready.",r),s.message=l("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),s.file="412-not-playable.md";break}case 404:{o.title=l("Video does not exist",r),o.message="",s.message=l("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),s.file="404-not-found.md";break}case 403:{if(o.title=l("Invalid playback URL",r),o.message=l("The video URL or playback-token are formatted with incorrect or incomplete information.",r),s.message=l("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),s.file="missing-signed-tokens.md",!i)break;let{exp:k,aud:v,sub:f}=P(i),C=Date.now()>k*1e3,_=f!==e,b=v!=="v",B={timeStyle:"medium",dateStyle:"medium"};if(C){o.title=l("Video URL has expired",r),o.message=l("The video\u2019s secured playback-token has expired.",r),s.message=l("The video\u2019s secured playback-token has expired.",r),s.context=l("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(U.code,B).format(k*1e3),currentDate:new Intl.DateTimeFormat(U.code,B).format(Date.now())}),s.file="403-expired-token.md";break}if(_){o.title=l("Video URL is formatted incorrectly",r),o.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.context=l("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",r).format({playbackId:e,tokenPlaybackId:f}),s.file="403-playback-id-mismatch.md";break}if(b){o.title=l("Video URL is formatted incorrectly",r),o.message=l("The playback-token is formatted with incorrect information.",r),s.message=l("The playback-token is formatted with incorrect information.",r),s.context=l("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:v}),s.file="403-incorrect-aud-value.md";break}s.message=l("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),s.file="403-malformatted-token.md";break}}break}case be.MEDIA_ERR_DECODE:{let{message:k}=t;o={title:l("Media Error",r),message:k},s.file="media-decode-error.md";break}case be.MEDIA_ERR_SRC_NOT_SUPPORTED:{let k=(R=(p=t.data)==null?void 0:p.response)==null?void 0:R.code;if(k>=400&&k<500){t.code=be.MEDIA_ERR_NETWORK,t.data={response:{code:k}},{dialog:o,devlog:s}=he(t,a,e,i);break}o={title:l("Source Not Supported",r),message:t.message},s.file="media-src-not-supported.md";break}default:o={title:l("Error",r),message:t.message};break}return a&&(o={title:l("Your device appears to be offline",r),message:l("Check your internet connection and try reloading this video.",r)}),{dialog:o,devlog:s}}var wt=`<template id="media-theme-gerwig">
322
+ `};import{MediaError as be}from"@mux/mux-video";function he(t,a,e,i,r){var m,p,R;let o={},s={};switch(t.code){case be.MEDIA_ERR_NETWORK:{switch(o.title=l("Network Error",r),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=l("Video is not currently available",r),o.message=l("The live stream or video file are not yet ready.",r),s.message=l("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),s.file="412-not-playable.md";break}case 404:{o.title=l("Video does not exist",r),o.message="",s.message=l("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),s.file="404-not-found.md";break}case 403:{if(o.title=l("Invalid playback URL",r),o.message=l("The video URL or playback-token are formatted with incorrect or incomplete information.",r),s.message=l("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),s.file="missing-signed-tokens.md",!i)break;let{exp:k,aud:v,sub:f}=P(i),C=Date.now()>k*1e3,S=f!==e,b=v!=="v",B={timeStyle:"medium",dateStyle:"medium"};if(C){o.title=l("Video URL has expired",r),o.message=l("The video\u2019s secured playback-token has expired.",r),s.message=l("The video\u2019s secured playback-token has expired.",r),s.context=l("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(U.code,B).format(k*1e3),currentDate:new Intl.DateTimeFormat(U.code,B).format(Date.now())}),s.file="403-expired-token.md";break}if(S){o.title=l("Video URL is formatted incorrectly",r),o.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.context=l("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",r).format({playbackId:e,tokenPlaybackId:f}),s.file="403-playback-id-mismatch.md";break}if(b){o.title=l("Video URL is formatted incorrectly",r),o.message=l("The playback-token is formatted with incorrect information.",r),s.message=l("The playback-token is formatted with incorrect information.",r),s.context=l("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:v}),s.file="403-incorrect-aud-value.md";break}s.message=l("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),s.file="403-malformatted-token.md";break}}break}case be.MEDIA_ERR_DECODE:{let{message:k}=t;o={title:l("Media Error",r),message:k},s.file="media-decode-error.md";break}case be.MEDIA_ERR_SRC_NOT_SUPPORTED:{let k=(R=(p=t.data)==null?void 0:p.response)==null?void 0:R.code;if(k>=400&&k<500){t.code=be.MEDIA_ERR_NETWORK,t.data={response:{code:k}},{dialog:o,devlog:s}=he(t,a,e,i);break}o={title:l("Source Not Supported",r),message:t.message},s.file="media-src-not-supported.md";break}default:o={title:l("Error",r),message:t.message};break}return a&&(o={title:l("Your device appears to be offline",r),message:l("Check your internet connection and try reloading this video.",r)}),{dialog:o,devlog:s}}var Mt=`<template id="media-theme-gerwig">
321
323
  <style>
322
324
  @keyframes pre-play-hide {
323
325
  0% {
@@ -1311,5 +1313,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1311
1313
  <slot></slot>
1312
1314
  </media-controller>
1313
1315
  </template>
1314
- `;import{MediaThemeElement as ha}from"media-chrome/dist/media-theme-element.js";var Ve=T.createElement("template");"innerHTML"in Ve&&(Ve.innerHTML=wt);var Ot,St,ge=class extends ha{};ge.template=(St=(Ot=Ve.content)==null?void 0:Ot.children)==null?void 0:St[0];c.customElements.get("media-theme-gerwig")||c.customElements.define("media-theme-gerwig",ge);var Ea="gerwig";var M={SRC:"src",POSTER:"poster"},n={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",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"},Be=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function ka(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(n.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:Ta(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(n.NOHOTKEYS),hotKeys:t.getAttribute(n.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,renditionOrder:t.renditionOrder,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(d.TARGET_LIVE_WINDOW),streamType:J(t.getAttribute(d.STREAM_TYPE)),primaryColor:t.getAttribute(n.PRIMARY_COLOR),secondaryColor:t.getAttribute(n.SECONDARY_COLOR),accentColor:t.getAttribute(n.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:Aa(t),playbackRates:t.getAttribute(n.PLAYBACK_RATES),customDomain:(i=t.getAttribute(d.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(n.TITLE),novolumepref:t.hasAttribute(n.NO_VOLUME_PREF),...a,extraSourceParams:t.extraSourceParams}}function Ta(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 o=c.customElements.get(a);if(o!=null&&o.template)return o.template}}function Aa(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 Pt(t){let a=t.hasAttribute(n.TITLE)?{video_title:t.getAttribute(n.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 Ca=Object.values(d),xa=Object.values(M),La=Object.values(n),Ra=me(),wa="mux-player",Nt={dialog:void 0,isDialogOpen:!1},Oa={redundant_streams:!0},ie,re,V,oe,W,O,D,ve,It,ne,Ue,H,G,Ee,Dt,ke,Vt,Te,Ht,Ae,Bt,ae=class extends Pe{constructor(){super();h(this,O);h(this,ve);h(this,ne);h(this,H);h(this,Ee);h(this,ke);h(this,Te);h(this,Ae);h(this,ie,!1);h(this,re,{});h(this,V,!0);h(this,oe,new le(this,"hotkeys"));h(this,W,{...Nt,onCloseErrorDialog:()=>g(this,ne,Ue).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Oe(this,T.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),g(this,ve,It).call(this),this.isConnected&&g(this,O,D).call(this)}static get observedAttributes(){var e;return[...(e=Pe.observedAttributes)!=null?e:[],...xa,...Ca,...La]}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=Pt(this))}attributeChangedCallback(e,i,r){switch(g(this,O,D).call(this),super.attributeChangedCallback(e,i,r),e){case n.HOTKEYS:u(this,oe).value=r;break;case n.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&N(l("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case n.THUMBNAIL_TOKEN:{let{aud:s}=P(r);r&&s!=="t"&&N(l("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:s}));break}case n.STORYBOARD_TOKEN:{let{aud:s}=P(r);r&&s!=="s"&&N(l("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:s}));break}case d.PLAYBACK_ID:{r!=null&&r.includes("?token")&&A(l("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case d.STREAM_TYPE:r&&![w.LIVE,w.ON_DEMAND,w.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:Me({file:"invalid-stream-type.md",message:l("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===w.LIVE?this.getAttribute(n.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[d.PLAYBACK_ID,M.SRC,n.PLAYBACK_TOKEN].includes(e)&&i!==r&&x(this,W,{...u(this,W),...Nt}),g(this,H,G).call(this,{[ct(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(d.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?_t.includes(e)?this.setAttribute(d.PREFER_CMCD,e):N(`Invalid value for preferCmcd. Must be one of ${_t.join()}`):this.removeAttribute(d.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Mt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Mt.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(n.THEME))!=null?e:Ea}set theme(e){this.setAttribute(n.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Be.includes(r))continue;let o=e.getAttribute(r);i[de(r)]=o===""?!0:o}return i}set themeProps(e){var r,o;g(this,O,D).call(this);let i={...this.themeProps,...e};for(let s in i){if(Be.includes(s))continue;let m=e==null?void 0:e[s];typeof m=="boolean"||m==null?(r=this.mediaTheme)==null||r.toggleAttribute(se(s),!!m):(o=this.mediaTheme)==null||o.setAttribute(se(s),m)}}get playbackId(){var e;return(e=this.getAttribute(d.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(d.PLAYBACK_ID,e):this.removeAttribute(d.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=Y(this,M.SRC))!=null?e:void 0:(i=this.getAttribute(M.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(M.SRC,e):this.removeAttribute(M.SRC)}get poster(){var i;let e=this.getAttribute(M.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return mt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,programTime:this.programStartTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(M.POSTER,e):this.removeAttribute(M.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(n.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(n.STORYBOARD_SRC,e):this.removeAttribute(n.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[w.LIVE,w.UNKNOWN].includes(this.streamType)))return ut(this.playbackId,{customDomain:this.customDomain,token:this.tokens.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(n.AUDIO)}set audio(e){if(!e){this.removeAttribute(n.AUDIO);return}this.setAttribute(n.AUDIO,"")}get hotkeys(){return u(this,oe)}get nohotkeys(){return this.hasAttribute(n.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(n.NOHOTKEYS);return}this.setAttribute(n.NOHOTKEYS,"")}get thumbnailTime(){return L(this.getAttribute(n.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(n.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(n.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(n.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Y(this,n.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(n.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(n.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(n.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(n.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(n.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(n.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(n.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(n.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(n.PLAYBACK_RATES))return this.getAttribute(n.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(n.PLAYBACK_RATES);return}this.setAttribute(n.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=L(this.getAttribute(n.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(n.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=L(this.getAttribute(n.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(n.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(n.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return L(this.getAttribute(n.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(n.DEFAULT_DURATION):this.setAttribute(n.DEFAULT_DURATION,`${e}`)}get playerSoftwareName(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_NAME))!=null?e:wa}get playerSoftwareVersion(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_VERSION))!=null?e:Ra}get beaconCollectionDomain(){var e;return(e=this.getAttribute(d.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(d.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(d.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(d.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(d.MAX_RESOLUTION,e):this.removeAttribute(d.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(d.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(d.MIN_RESOLUTION,e):this.removeAttribute(d.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(d.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(d.RENDITION_ORDER,e):this.removeAttribute(d.RENDITION_ORDER))}get programStartTime(){return L(this.getAttribute(d.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(d.PROGRAM_START_TIME):this.setAttribute(d.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return L(this.getAttribute(d.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(d.PROGRAM_END_TIME):this.setAttribute(d.PROGRAM_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(n.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(n.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Oa}set extraSourceParams(e){e==null?this.removeAttribute(n.EXTRA_SOURCE_PARAMS):this.setAttribute(n.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(d.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(d.CUSTOM_DOMAIN,e):this.removeAttribute(d.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Y(this,d.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(d.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(n.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(n.NO_VOLUME_PREF,""):this.removeAttribute(n.NO_VOLUME_PREF)}get debug(){return Y(this,d.DEBUG)!=null}set debug(e){e?this.setAttribute(d.DEBUG,""):this.removeAttribute(d.DEBUG)}get disableTracking(){return Y(this,d.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(d.DISABLE_TRACKING,!!e)}get disableCookies(){return Y(this,d.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(d.DISABLE_COOKIES,""):this.removeAttribute(d.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(d.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:w.UNKNOWN}set streamType(e){this.setAttribute(d.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?r:w.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(n.DEFAULT_STREAM_TYPE,e):this.removeAttribute(n.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(n.TARGET_LIVE_WINDOW)?+this.getAttribute(n.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(n.TARGET_LIVE_WINDOW):this.setAttribute(n.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return L(Y(this,d.START_TIME))}set startTime(e){this.setAttribute(d.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(d.PREFER_PLAYBACK);if(e===ye.MSE||e===ye.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===ye.MSE||e===ye.NATIVE?this.setAttribute(d.PREFER_PLAYBACK,e):this.removeAttribute(d.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(g(this,O,D).call(this),!this.media){A("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Pt(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(g(this,O,D).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(g(this,O,D).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(g(this,O,D).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(n.PLAYBACK_TOKEN),i=this.getAttribute(n.THUMBNAIL_TOKEN),r=this.getAttribute(n.STORYBOARD_TOKEN);return{...u(this,re),...e!=null?{playback:e}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(e){x(this,re,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(n.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(n.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(n.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(n.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(n.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(n.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,o){var m;let s=(m=this.media)==null?void 0:m.nativeEl;if(s)return ya(s,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return va(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};ie=new WeakMap,re=new WeakMap,V=new WeakMap,oe=new WeakMap,W=new WeakMap,O=new WeakSet,D=function(){var e,i,r;if(!u(this,ie)){x(this,ie,!0),g(this,H,G).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof c.HTMLElement))throw""}catch{A("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof fa))throw""}catch{A("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ga))throw""}catch{A("<media-controller> failed to upgrade!")}gt(this),g(this,Ee,Dt).call(this),g(this,ke,Vt).call(this),g(this,Te,Ht).call(this),x(this,V,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(He.USER_INACTIVE))!=null?i:!0),g(this,Ae,Bt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>{g(this,H,G).call(this)})}},ve=new WeakSet,It=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,Ue=function(e){Object.assign(u(this,W),e),g(this,H,G).call(this)},H=new WeakSet,G=function(e={}){xt(Rt(ka(this,{...u(this,W),...e})),this.shadowRoot)},Ee=new WeakSet,Dt=function(){let e=r=>{var m,p;if(!(r!=null&&r.startsWith("theme-")))return;let o=r.replace(/^theme-/,"");if(Be.includes(o))return;let s=this.getAttribute(r);s!=null?(m=this.mediaTheme)==null||m.setAttribute(o,s):(p=this.mediaTheme)==null||p.removeAttribute(o)};new MutationObserver(r=>{for(let{attributeName:o}of r)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},ke=new WeakSet,Vt=function(){var i;let e=r=>{let{detail:o}=r;if(o instanceof fe||(o=new fe(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){N(o),o.data&&N(`${o.name} data:`,o.data);return}let{dialog:s,devlog:m}=he(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&Me(m),A(o),o.data&&A(`${o.name} data:`,o.data),g(this,ne,Ue).call(this,{isDialogOpen:!0,dialog:s})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var s,m,p;if(!(((s=this.media)==null?void 0:s.error)instanceof fe))return r;let{devlog:o}=he((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(p=this.media)==null?void 0:p.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}}),(i=this.media)==null||i.addEventListener("error",r=>{var s,m;let{detail:o}=r;if(!o){let{message:p,code:R}=(m=(s=this.media)==null?void 0:s.error)!=null?m:{};o=new fe(p,R)}o!=null&&o.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:o}))})},Te=new WeakSet,Ht=function(){var i,r,o,s;let e=()=>g(this,H,G).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(s=(o=this.media)==null?void 0:o.textTracks)==null||s.addEventListener("removetrack",e)},Ae=new WeakSet,Bt=function(){var R,k;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,o=()=>this.streamType===w.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,s=(v,f,C=!1)=>{if(o())return;Array.from(v&&v.activeCues||[]).forEach(b=>{if(!(!b.snapToLines||b.line<-5||b.line>=0&&b.line<10))if(!f||this.paused){let B=b.text.split(`
1315
- `).length,j=-3;this.streamType===w.LIVE&&(j=-2);let q=j-B;if(b.line===q&&!C)return;r.has(b)||r.set(b,b.line),b.line=q}else setTimeout(()=>{b.line=r.get(b)||"auto"},500)})},m=()=>{var v,f;s(i,(f=(v=this.mediaController)==null?void 0:v.hasAttribute(He.USER_INACTIVE))!=null?f:!1)},p=()=>{var C,_;let f=Array.from(((_=(C=this.mediaController)==null?void 0:C.media)==null?void 0:_.textTracks)||[]).filter(b=>["subtitles","captions"].includes(b.kind)&&b.mode==="showing")[0];f!==i&&(i==null||i.removeEventListener("cuechange",m)),i=f,i==null||i.addEventListener("cuechange",m),s(i,u(this,V))};p(),(R=this.textTracks)==null||R.addEventListener("change",p),(k=this.textTracks)==null||k.addEventListener("addtrack",p),this.addEventListener("userinactivechange",()=>{var f,C;let v=(C=(f=this.mediaController)==null?void 0:f.hasAttribute(He.USER_INACTIVE))!=null?C:!0;u(this,V)!==v&&(x(this,V,v),s(i,u(this,V)))})};function Y(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}c.customElements.get("mux-player")||(c.customElements.define("mux-player",ae),c.MuxPlayerElement=ae);var Ni=ae;export{fe as MediaError,Ni as default,Y as getVideoAttribute};
1316
+ `;import{MediaThemeElement as ya}from"media-chrome/dist/media-theme-element.js";var Ve=T.createElement("template");"innerHTML"in Ve&&(Ve.innerHTML=Mt);var _t,St,ge=class extends ya{};ge.template=(St=(_t=Ve.content)==null?void 0:_t.children)==null?void 0:St[0];c.customElements.get("media-theme-gerwig")||c.customElements.define("media-theme-gerwig",ge);var Aa="gerwig";var _={SRC:"src",POSTER:"poster"},n={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref"},Be=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function Ca(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(n.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:xa(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(n.NOHOTKEYS),hotKeys:t.getAttribute(n.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,renditionOrder:t.renditionOrder,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(d.TARGET_LIVE_WINDOW),streamType:J(t.getAttribute(d.STREAM_TYPE)),primaryColor:t.getAttribute(n.PRIMARY_COLOR),secondaryColor:t.getAttribute(n.SECONDARY_COLOR),accentColor:t.getAttribute(n.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:La(t),playbackRates:t.getAttribute(n.PLAYBACK_RATES),customDomain:(i=t.getAttribute(d.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(n.TITLE),novolumepref:t.hasAttribute(n.NO_VOLUME_PREF),...a,extraSourceParams:t.extraSourceParams}}function xa(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 o=c.customElements.get(a);if(o!=null&&o.template)return o.template}}function La(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 It(t){let a=t.hasAttribute(n.TITLE)?{video_title:t.getAttribute(n.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 Ra=Object.values(d),wa=Object.values(_),Oa=Object.values(n),Ma=me(),_a="mux-player",Dt={dialog:void 0,isDialogOpen:!1},Sa={redundant_streams:!0},ie,re,V,oe,W,O,D,ve,Vt,ne,Ue,H,G,Ee,Ht,ke,Bt,Te,Ut,Ae,$t,ae=class extends Pe{constructor(){super();h(this,O);h(this,ve);h(this,ne);h(this,H);h(this,Ee);h(this,ke);h(this,Te);h(this,Ae);h(this,ie,!1);h(this,re,{});h(this,V,!0);h(this,oe,new le(this,"hotkeys"));h(this,W,{...Dt,onCloseErrorDialog:()=>g(this,ne,Ue).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Oe(this,T.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),g(this,ve,Vt).call(this),this.isConnected&&g(this,O,D).call(this)}static get observedAttributes(){var e;return[...(e=Pe.observedAttributes)!=null?e:[],...wa,...Ra,...Oa]}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=It(this))}attributeChangedCallback(e,i,r){switch(g(this,O,D).call(this),super.attributeChangedCallback(e,i,r),e){case n.HOTKEYS:u(this,oe).value=r;break;case n.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&N(l("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case n.THUMBNAIL_TOKEN:{let{aud:s}=P(r);r&&s!=="t"&&N(l("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:s}));break}case n.STORYBOARD_TOKEN:{let{aud:s}=P(r);r&&s!=="s"&&N(l("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:s}));break}case d.PLAYBACK_ID:{r!=null&&r.includes("?token")&&A(l("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case d.STREAM_TYPE:r&&![w.LIVE,w.ON_DEMAND,w.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:_e({file:"invalid-stream-type.md",message:l("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===w.LIVE?this.getAttribute(n.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[d.PLAYBACK_ID,_.SRC,n.PLAYBACK_TOKEN].includes(e)&&i!==r&&x(this,W,{...u(this,W),...Dt}),g(this,H,G).call(this,{[bt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(d.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Nt.includes(e)?this.setAttribute(d.PREFER_CMCD,e):N(`Invalid value for preferCmcd. Must be one of ${Nt.join()}`):this.removeAttribute(d.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Pt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Pt.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(n.THEME))!=null?e:Aa}set theme(e){this.setAttribute(n.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Be.includes(r))continue;let o=e.getAttribute(r);i[de(r)]=o===""?!0:o}return i}set themeProps(e){var r,o;g(this,O,D).call(this);let i={...this.themeProps,...e};for(let s in i){if(Be.includes(s))continue;let m=e==null?void 0:e[s];typeof m=="boolean"||m==null?(r=this.mediaTheme)==null||r.toggleAttribute(se(s),!!m):(o=this.mediaTheme)==null||o.setAttribute(se(s),m)}}get playbackId(){var e;return(e=this.getAttribute(d.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(d.PLAYBACK_ID,e):this.removeAttribute(d.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=Y(this,_.SRC))!=null?e:void 0:(i=this.getAttribute(_.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(_.SRC,e):this.removeAttribute(_.SRC)}get poster(){var i;let e=this.getAttribute(_.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return ct(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,programTime:this.programStartTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(_.POSTER,e):this.removeAttribute(_.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(n.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(n.STORYBOARD_SRC,e):this.removeAttribute(n.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[w.LIVE,w.UNKNOWN].includes(this.streamType)))return pt(this.playbackId,{customDomain:this.customDomain,token:this.tokens.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(n.AUDIO)}set audio(e){if(!e){this.removeAttribute(n.AUDIO);return}this.setAttribute(n.AUDIO,"")}get hotkeys(){return u(this,oe)}get nohotkeys(){return this.hasAttribute(n.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(n.NOHOTKEYS);return}this.setAttribute(n.NOHOTKEYS,"")}get thumbnailTime(){return L(this.getAttribute(n.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(n.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(n.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(n.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Y(this,n.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(n.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(n.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(n.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(n.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(n.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(n.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(n.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(n.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(n.PLAYBACK_RATES))return this.getAttribute(n.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(n.PLAYBACK_RATES);return}this.setAttribute(n.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=L(this.getAttribute(n.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(n.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=L(this.getAttribute(n.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(n.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(n.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return L(this.getAttribute(n.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(n.DEFAULT_DURATION):this.setAttribute(n.DEFAULT_DURATION,`${e}`)}get playerSoftwareName(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_NAME))!=null?e:_a}get playerSoftwareVersion(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_VERSION))!=null?e:Ma}get beaconCollectionDomain(){var e;return(e=this.getAttribute(d.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(d.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(d.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(d.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(d.MAX_RESOLUTION,e):this.removeAttribute(d.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(d.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(d.MIN_RESOLUTION,e):this.removeAttribute(d.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(d.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(d.RENDITION_ORDER,e):this.removeAttribute(d.RENDITION_ORDER))}get programStartTime(){return L(this.getAttribute(d.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(d.PROGRAM_START_TIME):this.setAttribute(d.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return L(this.getAttribute(d.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(d.PROGRAM_END_TIME):this.setAttribute(d.PROGRAM_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(n.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(n.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Sa}set extraSourceParams(e){e==null?this.removeAttribute(n.EXTRA_SOURCE_PARAMS):this.setAttribute(n.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(d.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(d.CUSTOM_DOMAIN,e):this.removeAttribute(d.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Y(this,d.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(d.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(n.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(n.NO_VOLUME_PREF,""):this.removeAttribute(n.NO_VOLUME_PREF)}get debug(){return Y(this,d.DEBUG)!=null}set debug(e){e?this.setAttribute(d.DEBUG,""):this.removeAttribute(d.DEBUG)}get disableTracking(){return Y(this,d.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(d.DISABLE_TRACKING,!!e)}get disableCookies(){return Y(this,d.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(d.DISABLE_COOKIES,""):this.removeAttribute(d.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(d.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:w.UNKNOWN}set streamType(e){this.setAttribute(d.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?r:w.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(n.DEFAULT_STREAM_TYPE,e):this.removeAttribute(n.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(n.TARGET_LIVE_WINDOW)?+this.getAttribute(n.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(n.TARGET_LIVE_WINDOW):this.setAttribute(n.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return L(Y(this,d.START_TIME))}set startTime(e){this.setAttribute(d.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(d.PREFER_PLAYBACK);if(e===ye.MSE||e===ye.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===ye.MSE||e===ye.NATIVE?this.setAttribute(d.PREFER_PLAYBACK,e):this.removeAttribute(d.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(g(this,O,D).call(this),!this.media){A("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...It(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(g(this,O,D).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(g(this,O,D).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(g(this,O,D).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(n.PLAYBACK_TOKEN),i=this.getAttribute(n.DRM_TOKEN),r=this.getAttribute(n.THUMBNAIL_TOKEN),o=this.getAttribute(n.STORYBOARD_TOKEN);return{...u(this,re),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...o!=null?{storyboard:o}:{}}}set tokens(e){x(this,re,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(n.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(n.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(n.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(n.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(n.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(n.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(n.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(n.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,o){var m;let s=(m=this.media)==null?void 0:m.nativeEl;if(s)return ka(s,e,i,r,o)}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}};ie=new WeakMap,re=new WeakMap,V=new WeakMap,oe=new WeakMap,W=new WeakMap,O=new WeakSet,D=function(){var e,i,r;if(!u(this,ie)){x(this,ie,!0),g(this,H,G).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof c.HTMLElement))throw""}catch{A("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Ea))throw""}catch{A("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof va))throw""}catch{A("<media-controller> failed to upgrade!")}yt(this),g(this,Ee,Ht).call(this),g(this,ke,Bt).call(this),g(this,Te,Ut).call(this),x(this,V,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(He.USER_INACTIVE))!=null?i:!0),g(this,Ae,$t).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>{g(this,H,G).call(this)})}},ve=new WeakSet,Vt=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,Ue=function(e){Object.assign(u(this,W),e),g(this,H,G).call(this)},H=new WeakSet,G=function(e={}){Rt(Ot(Ca(this,{...u(this,W),...e})),this.shadowRoot)},Ee=new WeakSet,Ht=function(){let e=r=>{var m,p;if(!(r!=null&&r.startsWith("theme-")))return;let o=r.replace(/^theme-/,"");if(Be.includes(o))return;let s=this.getAttribute(r);s!=null?(m=this.mediaTheme)==null||m.setAttribute(o,s):(p=this.mediaTheme)==null||p.removeAttribute(o)};new MutationObserver(r=>{for(let{attributeName:o}of r)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},ke=new WeakSet,Bt=function(){var i;let e=r=>{let{detail:o}=r;if(o instanceof fe||(o=new fe(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){N(o),o.data&&N(`${o.name} data:`,o.data);return}let{dialog:s,devlog:m}=he(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&_e(m),A(o),o.data&&A(`${o.name} data:`,o.data),g(this,ne,Ue).call(this,{isDialogOpen:!0,dialog:s})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var s,m,p;if(!(((s=this.media)==null?void 0:s.error)instanceof fe))return r;let{devlog:o}=he((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(p=this.media)==null?void 0:p.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}}),(i=this.media)==null||i.addEventListener("error",r=>{var s,m;let{detail:o}=r;if(!o){let{message:p,code:R}=(m=(s=this.media)==null?void 0:s.error)!=null?m:{};o=new fe(p,R)}o!=null&&o.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:o}))})},Te=new WeakSet,Ut=function(){var i,r,o,s;let e=()=>g(this,H,G).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(s=(o=this.media)==null?void 0:o.textTracks)==null||s.addEventListener("removetrack",e)},Ae=new WeakSet,$t=function(){var R,k;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,o=()=>this.streamType===w.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,s=(v,f,C=!1)=>{if(o())return;Array.from(v&&v.activeCues||[]).forEach(b=>{if(!(!b.snapToLines||b.line<-5||b.line>=0&&b.line<10))if(!f||this.paused){let B=b.text.split(`
1317
+ `).length,j=-3;this.streamType===w.LIVE&&(j=-2);let q=j-B;if(b.line===q&&!C)return;r.has(b)||r.set(b,b.line),b.line=q}else setTimeout(()=>{b.line=r.get(b)||"auto"},500)})},m=()=>{var v,f;s(i,(f=(v=this.mediaController)==null?void 0:v.hasAttribute(He.USER_INACTIVE))!=null?f:!1)},p=()=>{var C,S;let f=Array.from(((S=(C=this.mediaController)==null?void 0:C.media)==null?void 0:S.textTracks)||[]).filter(b=>["subtitles","captions"].includes(b.kind)&&b.mode==="showing")[0];f!==i&&(i==null||i.removeEventListener("cuechange",m)),i=f,i==null||i.addEventListener("cuechange",m),s(i,u(this,V))};p(),(R=this.textTracks)==null||R.addEventListener("change",p),(k=this.textTracks)==null||k.addEventListener("addtrack",p),this.addEventListener("userinactivechange",()=>{var f,C;let v=(C=(f=this.mediaController)==null?void 0:f.hasAttribute(He.USER_INACTIVE))!=null?C:!0;u(this,V)!==v&&(x(this,V,v),s(i,u(this,V)))})};function Y(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}c.customElements.get("mux-player")||(c.customElements.define("mux-player",ae),c.MuxPlayerElement=ae);var Vi=ae;export{fe as MediaError,Vi as default,Y as getVideoAttribute};