@mux/mux-player 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- var Oe=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var m=(t,a,e)=>(Oe(t,a,"read from private field"),e?e.call(t):a.get(t)),p=(t,a,e)=>{if(a.has(t))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(t):a.set(t,e)},x=(t,a,e,r)=>(Oe(t,a,"write to private field"),r?r.call(t,e):a.set(t,e),e);var f=(t,a,e)=>(Oe(t,a,"access private method"),e);var W=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends W{}globalThis.DocumentFragment=t}var z=class extends W{},Se=class extends W{},Nt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(z)}},J,Le=class{constructor(a,e={}){p(this,J,void 0);x(this,J,e==null?void 0:e.detail)}get detail(){return m(this,J)}initCustomEvent(){}};J=new WeakMap;function Bt(t,a){return new z}var rt={document:{createElement:Bt},DocumentFragment,customElements:Nt,CustomEvent:Le,EventTarget:W,HTMLElement:z,HTMLVideoElement:Se},ot=typeof window=="undefined"||typeof globalThis.customElements=="undefined",h=ot?rt:globalThis,T=ot?rt.document:globalThis.document;import{MediaController as sa}from"media-chrome";import"media-chrome/dist/experimental/media-captions-selectmenu.js";import la,{MediaError as ve,Attributes as l}from"@mux/mux-video";import{StreamTypes as S,PlaybackTypes as Ee,addTextTrack as da,removeTextTrack as ua,CmcdTypeValues as Ot}from"@mux/playback-core";import{VideoEvents as Kt}from"@mux/mux-video";var It="en",H={code:It};var nt="en";function d(t,a=!0){var i,o;let e=a&&(o=(i=H)==null?void 0:i[t])!=null?o:t,r=a?H.code:nt;return new Re(e,r)}var Re=class{constructor(a,e=(r=>(r=H.code)!=null?r:nt)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,r)=>{var i;return(i=a[r])!=null?i:""})}toString(){return this.message}};function st(t){let a="";return Object.entries(t).forEach(([e,r])=>{r!=null&&(a+=`${de(e)}: ${r}; `)}),a?a.trim():void 0}function de(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ue(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 me(t){let a=Dt(t).toString();return a?"?"+a:""}function Dt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function N(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(e).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}var Me=(t,a)=>!t||!a?!1:t.contains(a)?!0:Me(t,a.getRootNode().host);import{StreamTypes as Ce}from"@mux/playback-core";var Pe="mux.com",Vt=()=>{try{return"1.11.0"}catch{}return"UNKNOWN"},Ht=Vt(),pe=()=>Ht,_e=(t,{maxResolution:a,token:e,domain:r=Pe}={})=>{let n=!!e?{token:e}:{redundant_streams:!0,...a?{max_resolution:a}:{}};return`https://stream.${r}/${t}.m3u8${me(n)}`},lt=(t,{token:a,thumbnailTime:e,domain:r=Pe}={})=>{let i=a==null?e:void 0,{aud:o}=N(a);if(!(a&&o!=="t"))return`https://image.${r}/${t}/thumbnail.webp${me({token:a,time:i})}`},dt=(t,{token:a,domain:e=Pe}={})=>{let{aud:r}=N(a);if(!(a&&r!=="s"))return`https://image.${e}/${t}/storyboard.vtt${me({token:a,format:"webp"})}`},X=t=>{if(!!t){if([Ce.LIVE,Ce.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Ce.LIVE}};var $t={crossorigin:"crossOrigin",playsinline:"playsInline"};function ut(t){var a;return(a=$t[t])!=null?a:ue(t)}var $,K,E,ce=class{constructor(a,e){p(this,$,void 0);p(this,K,void 0);p(this,E,[]);x(this,$,a),x(this,K,e)}[Symbol.iterator](){return m(this,E).values()}get length(){return m(this,E).length}get value(){var a;return(a=m(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 m(this,E)[a]}values(){return m(this,E).values()}keys(){return m(this,E).keys()}forEach(a){m(this,E).forEach(a)}add(...a){var e,r;a.forEach(i=>{this.contains(i)||m(this,E).push(i)}),!(this.value===""&&!((e=m(this,$))!=null&&e.hasAttribute(`${m(this,K)}`)))&&((r=m(this,$))==null||r.setAttribute(`${m(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(r=>{m(this,E).splice(m(this,E).indexOf(r),1)}),(e=m(this,$))==null||e.setAttribute(`${m(this,K)}`,`${this.value}`)}contains(a){return m(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 mt=`[mux-player ${pe()}]`;function B(...t){console.warn(mt,...t)}function O(...t){console.error(mt,...t)}function Ne(t){var e;let a=(e=t.message)!=null?e:"";if(t.context&&(a+=` ${t.context}`),t.file){let r="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${d("Read more: ")}
2
- ${r}${t.file}`}B(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},F={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},pt=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}}),Ft=Kt.filter(t=>t!=="error"),Ut=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),Yt=Object.values(F);function bt(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),Ft.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,r=>{t.dispatchEvent(new Event(r.type))})})}var Be=class extends h.HTMLElement{static get observedAttributes(){return[...Ut,...Yt]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(r=>{var i;(i=this.media)==null||i.append(r.cloneNode())});let a=r=>{for(let i of r)i.type==="childList"&&(i.removedNodes.forEach(o=>{var u,b;let n=(u=this.media)==null?void 0:u.querySelector(`track[src="${o.src}"]`);n&&((b=this.media)==null||b.removeChild(n))}),i.addedNodes.forEach(o=>{var n;(n=this.media)==null||n.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,r){var i,o;switch(a){case F.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case F.VOLUME:{let n=(i=L(r))!=null?i:1;this.media&&(this.media.volume=n);return}case F.PLAYBACKRATE:{let n=(o=L(r))!=null?o:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);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 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:pt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:pt}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=Boolean(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){O("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 Ie=Be;import"media-chrome/dist/media-theme-element.js";var ht=`:host {
1
+ var Oe=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var m=(t,a,e)=>(Oe(t,a,"read from private field"),e?e.call(t):a.get(t)),p=(t,a,e)=>{if(a.has(t))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(t):a.set(t,e)},x=(t,a,e,r)=>(Oe(t,a,"write to private field"),r?r.call(t,e):a.set(t,e),e);var f=(t,a,e)=>(Oe(t,a,"access private method"),e);var W=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends W{}globalThis.DocumentFragment=t}var z=class extends W{},Le=class extends W{},Nt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(z)}},J,Re=class{constructor(a,e={}){p(this,J,void 0);x(this,J,e==null?void 0:e.detail)}get detail(){return m(this,J)}initCustomEvent(){}};J=new WeakMap;function Bt(t,a){return new z}var rt={document:{createElement:Bt},DocumentFragment,customElements:Nt,CustomEvent:Re,EventTarget:W,HTMLElement:z,HTMLVideoElement:Le},ot=typeof window=="undefined"||typeof globalThis.customElements=="undefined",h=ot?rt:globalThis,T=ot?rt.document:globalThis.document;import{MediaController as sa}from"media-chrome";import"media-chrome/dist/experimental/media-captions-selectmenu.js";import la,{MediaError as ve,Attributes as l}from"@mux/mux-video";import{StreamTypes as L,PlaybackTypes as Ee,addTextTrack as da,removeTextTrack as ua,CmcdTypeValues as Ot}from"@mux/playback-core";import{VideoEvents as Kt}from"@mux/mux-video";var It="en",H={code:It};var nt="en";function d(t,a=!0){var i,o;let e=a&&(o=(i=H)==null?void 0:i[t])!=null?o:t,r=a?H.code:nt;return new Se(e,r)}var Se=class{constructor(a,e=(r=>(r=H.code)!=null?r:nt)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,r)=>{var i;return(i=a[r])!=null?i:""})}toString(){return this.message}};function st(t){let a="";return Object.entries(t).forEach(([e,r])=>{r!=null&&(a+=`${de(e)}: ${r}; `)}),a?a.trim():void 0}function de(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ue(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function R(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function me(t){let a=Dt(t).toString();return a?"?"+a:""}function Dt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function N(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(e).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}var Me=(t,a)=>!t||!a?!1:t.contains(a)?!0:Me(t,a.getRootNode().host);import{StreamTypes as Ce}from"@mux/playback-core";var Pe="mux.com",Vt=()=>{try{return"1.11.1"}catch{}return"UNKNOWN"},Ht=Vt(),pe=()=>Ht,_e=(t,{maxResolution:a,token:e,domain:r=Pe}={})=>{let n=!!e?{token:e}:{redundant_streams:!0,...a?{max_resolution:a}:{}};return`https://stream.${r}/${t}.m3u8${me(n)}`},lt=(t,{token:a,thumbnailTime:e,domain:r=Pe}={})=>{let i=a==null?e:void 0,{aud:o}=N(a);if(!(a&&o!=="t"))return`https://image.${r}/${t}/thumbnail.webp${me({token:a,time:i})}`},dt=(t,{token:a,domain:e=Pe}={})=>{let{aud:r}=N(a);if(!(a&&r!=="s"))return`https://image.${e}/${t}/storyboard.vtt${me({token:a,format:"webp"})}`},X=t=>{if(!!t){if([Ce.LIVE,Ce.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Ce.LIVE}};var $t={crossorigin:"crossOrigin",playsinline:"playsInline"};function ut(t){var a;return(a=$t[t])!=null?a:ue(t)}var $,K,E,ce=class{constructor(a,e){p(this,$,void 0);p(this,K,void 0);p(this,E,[]);x(this,$,a),x(this,K,e)}[Symbol.iterator](){return m(this,E).values()}get length(){return m(this,E).length}get value(){var a;return(a=m(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 m(this,E)[a]}values(){return m(this,E).values()}keys(){return m(this,E).keys()}forEach(a){m(this,E).forEach(a)}add(...a){var e,r;a.forEach(i=>{this.contains(i)||m(this,E).push(i)}),!(this.value===""&&!((e=m(this,$))!=null&&e.hasAttribute(`${m(this,K)}`)))&&((r=m(this,$))==null||r.setAttribute(`${m(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(r=>{m(this,E).splice(m(this,E).indexOf(r),1)}),(e=m(this,$))==null||e.setAttribute(`${m(this,K)}`,`${this.value}`)}contains(a){return m(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 mt=`[mux-player ${pe()}]`;function B(...t){console.warn(mt,...t)}function O(...t){console.error(mt,...t)}function Ne(t){var e;let a=(e=t.message)!=null?e:"";if(t.context&&(a+=` ${t.context}`),t.file){let r="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${d("Read more: ")}
2
+ ${r}${t.file}`}B(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},F={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},pt=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}}),Ft=Kt.filter(t=>t!=="error"),Ut=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),Yt=Object.values(F);function bt(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),Ft.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,r=>{t.dispatchEvent(new Event(r.type))})})}var Be=class extends h.HTMLElement{static get observedAttributes(){return[...Ut,...Yt]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(r=>{var i;(i=this.media)==null||i.append(r.cloneNode())});let a=r=>{for(let i of r)i.type==="childList"&&(i.removedNodes.forEach(o=>{var u,b;let n=(u=this.media)==null?void 0:u.querySelector(`track[src="${o.src}"]`);n&&((b=this.media)==null||b.removeChild(n))}),i.addedNodes.forEach(o=>{var n;(n=this.media)==null||n.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,r){var i,o;switch(a){case F.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case F.VOLUME:{let n=(i=R(r))!=null?i:1;this.media&&(this.media.volume=n);return}case F.PLAYBACKRATE:{let n=(o=R(r))!=null?o:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);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 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:pt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:pt}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=R(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=Boolean(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){O("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 Ie=Be;import"media-chrome/dist/media-theme-element.js";var ht=`:host {
3
3
  --media-control-display: var(--controls);
4
4
  --media-loading-indicator-display: var(--loading-indicator);
5
5
  --media-dialog-display: var(--dialog);
@@ -127,7 +127,7 @@ media-theme {
127
127
  --media-range-bar-color: var(--_primary-color);
128
128
  --media-control-background: var(--_secondary-color);
129
129
  --media-control-hover-background: var(--_secondary-color);
130
- --media-time-buffered-color: rgba(255, 255, 255, 0.4);
130
+ --media-time-range-buffered-color: rgba(255, 255, 255, 0.4);
131
131
  --media-range-track-background:
132
132
  linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
133
133
  linear-gradient(rgba(20, 20, 30, 0.7), rgba(20, 20, 30, 0.7));
@@ -170,8 +170,8 @@ media-theme {
170
170
  width: 100%;
171
171
  }
172
172
 
173
- [disabled],
174
- [aria-disabled='true'] {
173
+ [disabled]:not(media-live-button),
174
+ [aria-disabled='true']:not(media-live-button) {
175
175
  opacity: 60%;
176
176
  cursor: not-allowed;
177
177
  }
@@ -180,7 +180,7 @@ media-theme {
180
180
  z-index: 10;
181
181
  }
182
182
 
183
- media-controller:not(:is([media-captions-list], [media-subtitles-list])) media-captions-selectmenu {
183
+ media-controller:not([mediasubtitleslist]) media-captions-selectmenu {
184
184
  --captions-selectmenu: none;
185
185
  }
186
186
 
@@ -190,7 +190,7 @@ media-theme {
190
190
  media-controller ::slotted([slot='media']) {
191
191
  --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;
192
192
  }
193
- media-controller:is([media-paused],:not([user-inactive])) ::slotted([slot='media']) {
193
+ media-controller:is([mediapaused],:not([userinactive])) ::slotted([slot='media']) {
194
194
  /* 42px is the height of the control bar and progress bar
195
195
  * with an additional 5px as a buffer, to get 47px */
196
196
  --media-webkit-text-track-transform: translateY(-47px);
@@ -205,23 +205,23 @@ media-theme {
205
205
  --media-text-color: white;
206
206
  }
207
207
 
208
- media-volume-range[media-volume-unavailable] {
208
+ media-volume-range[mediavolumeunavailable] {
209
209
  --volume-range: none;
210
210
  }
211
211
 
212
- media-airplay-button[media-airplay-unavailable] {
212
+ media-airplay-button[mediaairplayunavailable] {
213
213
  --airplay-button: none;
214
214
  }
215
215
 
216
- media-fullscreen-button[media-fullscreen-unavailable] {
216
+ media-fullscreen-button[mediafullscreenunavailable] {
217
217
  --fullscreen-button: none;
218
218
  }
219
219
 
220
- media-cast-button[media-cast-unavailable] {
220
+ media-cast-button[mediacastunavailable] {
221
221
  --cast-button: none;
222
222
  }
223
223
 
224
- media-pip-button[media-pip-unavailable] {
224
+ media-pip-button[mediapipunavailable] {
225
225
  --pip-button: none;
226
226
  }
227
227
 
@@ -243,11 +243,11 @@ media-theme {
243
243
  --media-control-padding: 4px 3px;
244
244
  }
245
245
 
246
- [breakpoint-sm] media-control-bar {
246
+ [breakpointsm] media-control-bar {
247
247
  --media-control-padding: 9px 5px;
248
248
  }
249
249
 
250
- [breakpoint-md] media-control-bar {
250
+ [breakpointmd] media-control-bar {
251
251
  --media-control-padding: 9px 7px;
252
252
  }
253
253
 
@@ -296,7 +296,7 @@ media-theme {
296
296
  transition: background-color 1s;
297
297
  }
298
298
 
299
- media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
299
+ media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) {
300
300
  background-color: var(--controls-backdrop-color, var(--controls, transparent));
301
301
  transition: background-color 0.25s;
302
302
  }
@@ -360,7 +360,7 @@ media-theme {
360
360
  opacity: 1;
361
361
  }
362
362
 
363
- media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
363
+ media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {
364
364
  opacity: 0;
365
365
  transition-delay: 400ms;
366
366
  }
@@ -417,7 +417,7 @@ media-theme {
417
417
 
418
418
  <template partial="SeekBackwardButton">
419
419
  <media-seek-backward-button
420
- seek-offset="{{backwardSeekOffset}}"
420
+ seekoffset="{{backwardseekoffset}}"
421
421
  part="{{section ?? 'bottom'}} seek-backward button"
422
422
  disabled="{{disabled}}"
423
423
  aria-disabled="{{disabled}}"
@@ -425,7 +425,7 @@ media-theme {
425
425
  <svg aria-hidden="true" viewBox="0 0 22 24" slot="backward">
426
426
  <path d="M11 6V3L5.37 7 11 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 11 6Z" />
427
427
  <text class="value" transform="translate(2.5 21)" style="font-size: 8px; font-family: 'ArialMT', 'Arial'">
428
- {{backwardSeekOffset}}
428
+ {{backwardseekoffset}}
429
429
  </text>
430
430
  </svg>
431
431
  </media-seek-backward-button>
@@ -433,7 +433,7 @@ media-theme {
433
433
 
434
434
  <template partial="SeekForwardButton">
435
435
  <media-seek-forward-button
436
- seek-offset="{{forwardSeekOffset}}"
436
+ seekoffset="{{forwardseekoffset}}"
437
437
  part="{{section ?? 'bottom'}} seek-forward button"
438
438
  disabled="{{disabled}}"
439
439
  aria-disabled="{{disabled}}"
@@ -441,7 +441,7 @@ media-theme {
441
441
  <svg aria-hidden="true" viewBox="0 0 22 24" slot="forward">
442
442
  <path d="M11 6V3l5.61 4L11 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 11 6Z" />
443
443
  <text class="value" transform="translate(10 21)" style="font-size: 8px; font-family: 'ArialMT', 'Arial'">
444
- {{forwardSeekOffset}}
444
+ {{forwardseekoffset}}
445
445
  </text>
446
446
  </svg>
447
447
  </media-seek-forward-button>
@@ -489,7 +489,6 @@ media-theme {
489
489
 
490
490
  <template partial="CaptionsMenuButton">
491
491
  <media-captions-selectmenu
492
- default-showing="{{defaultShowingCaptions}}"
493
492
  part="bottom captions selectmenu"
494
493
  disabled="{{disabled}}"
495
494
  aria-disabled="{{disabled}}"
@@ -565,7 +564,7 @@ media-theme {
565
564
 
566
565
  <template partial="PlaybackRateButton">
567
566
  <media-playback-rate-button
568
- rates="{{playbackRates}}"
567
+ rates="{{playbackrates}}"
569
568
  part="bottom playback-rate button"
570
569
  disabled="{{disabled}}"
571
570
  aria-disabled="{{disabled}}"
@@ -582,8 +581,8 @@ media-theme {
582
581
 
583
582
  <template partial="TimeDisplay">
584
583
  <media-time-display
585
- remaining="{{defaultShowRemainingTime}}"
586
- show-duration="{{!hideDuration}}"
584
+ remaining="{{defaultshowremainingtime}}"
585
+ showduration="{{!hideduration}}"
587
586
  part="bottom time display"
588
587
  disabled="{{disabled}}"
589
588
  aria-disabled="{{disabled}}"
@@ -599,23 +598,24 @@ media-theme {
599
598
  </template>
600
599
 
601
600
  <media-controller
602
- default-stream-type="{{defaultStreamType ?? 'on-demand'}}"
601
+ defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
603
602
  breakpoints="sm:300 md:700"
604
- gestures-disabled="{{disabled}}"
603
+ gesturesdisabled="{{disabled}}"
605
604
  hotkeys="{{hotkeys}}"
606
605
  nohotkeys="{{nohotkeys}}"
607
606
  novolumepref="{{novolumepref}}"
608
607
  audio="{{audio}}"
609
608
  noautoseektolive="{{noautoseektolive}}"
609
+ defaultsubtitles="{{defaultsubtitles}}"
610
610
  exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
611
611
  >
612
612
  <slot name="media" slot="media"></slot>
613
613
  <slot name="poster" slot="poster"></slot>
614
- <media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
614
+ <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
615
615
 
616
616
  <template if="audio">
617
617
 
618
- <template if="streamType == 'on-demand'">
618
+ <template if="streamtype == 'on-demand'">
619
619
  <template if="title">
620
620
  <media-control-bar>{{>TitleDisplay}}</media-control-bar>
621
621
  </template>
@@ -633,9 +633,9 @@ media-theme {
633
633
  </media-control-bar>
634
634
  </template>
635
635
 
636
- <template if="streamType == 'live'">
636
+ <template if="streamtype == 'live'">
637
637
 
638
- <template if="targetLiveWindow > 0">
638
+ <template if="targetlivewindow > 0">
639
639
  <template if="title">
640
640
  <media-control-bar>{{>TitleDisplay}}</media-control-bar>
641
641
  </template>
@@ -654,7 +654,7 @@ media-theme {
654
654
  </media-control-bar>
655
655
  </template>
656
656
 
657
- <template if="!targetLiveWindow">
657
+ <template if="!targetlivewindow">
658
658
  <template if="title">
659
659
  <media-control-bar>{{>TitleDisplay}}</media-control-bar>
660
660
  </template>
@@ -674,9 +674,9 @@ media-theme {
674
674
 
675
675
  <template if="!audio">
676
676
 
677
- <template if="streamType == 'on-demand'">
677
+ <template if="streamtype == 'on-demand'">
678
678
 
679
- <template if="!breakpointSm">
679
+ <template if="!breakpointsm">
680
680
  {{>TimeRange}}
681
681
  <media-control-bar>
682
682
  {{>PlayButton}}
@@ -687,8 +687,8 @@ media-theme {
687
687
  </media-control-bar>
688
688
  </template>
689
689
 
690
- <template if="breakpointSm">
691
- <template if="!breakpointMd">
690
+ <template if="breakpointsm">
691
+ <template if="!breakpointmd">
692
692
  <media-control-bar slot="top-chrome">
693
693
  {{>TitleDisplay}}
694
694
  </media-control-bar>
@@ -714,7 +714,7 @@ media-theme {
714
714
  </template>
715
715
  </template>
716
716
 
717
- <template if="breakpointMd">
717
+ <template if="breakpointmd">
718
718
  <media-control-bar slot="top-chrome">
719
719
  {{>TitleDisplay}}
720
720
  </media-control-bar>
@@ -741,11 +741,11 @@ media-theme {
741
741
 
742
742
  </template>
743
743
 
744
- <template if="streamType == 'live'">
744
+ <template if="streamtype == 'live'">
745
745
 
746
- <template if="!targetLiveWindow">
746
+ <template if="!targetlivewindow">
747
747
 
748
- <template if="!breakpointSm">
748
+ <template if="!breakpointsm">
749
749
  <media-control-bar slot="top-chrome">
750
750
  {{>LiveButton}}
751
751
  </media-control-bar>
@@ -758,8 +758,8 @@ media-theme {
758
758
  </media-control-bar>
759
759
  </template>
760
760
 
761
- <template if="breakpointSm">
762
- <template if="!breakpointMd">
761
+ <template if="breakpointsm">
762
+ <template if="!breakpointmd">
763
763
  <media-control-bar slot="top-chrome">
764
764
  {{>LiveButton}}
765
765
  {{>TitleDisplay}}
@@ -781,7 +781,7 @@ media-theme {
781
781
  </template>
782
782
  </template>
783
783
 
784
- <template if="breakpointMd">
784
+ <template if="breakpointmd">
785
785
  <media-control-bar slot="top-chrome">
786
786
  {{>LiveButton}}
787
787
  {{>TitleDisplay}}
@@ -803,9 +803,9 @@ media-theme {
803
803
  </template>
804
804
  </template>
805
805
 
806
- <template if="targetLiveWindow > 0">
806
+ <template if="targetlivewindow > 0">
807
807
 
808
- <template if="!breakpointSm">
808
+ <template if="!breakpointsm">
809
809
  <media-control-bar slot="top-chrome">
810
810
  {{>LiveButton}}
811
811
  </media-control-bar>
@@ -819,8 +819,8 @@ media-theme {
819
819
  </media-control-bar>
820
820
  </template>
821
821
 
822
- <template if="breakpointSm">
823
- <template if="!breakpointMd">
822
+ <template if="breakpointsm">
823
+ <template if="!breakpointmd">
824
824
  <media-control-bar slot="top-chrome">
825
825
  {{>LiveButton}}
826
826
  {{>TitleDisplay}}
@@ -845,7 +845,7 @@ media-theme {
845
845
  </template>
846
846
  </template>
847
847
 
848
- <template if="breakpointMd">
848
+ <template if="breakpointmd">
849
849
  <media-control-bar slot="top-chrome">
850
850
  {{>LiveButton}}
851
851
  {{>TitleDisplay}}
@@ -970,15 +970,15 @@ media-theme {
970
970
  </svg>
971
971
  </button>
972
972
  </slot>
973
- `;var ee=class extends De{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ee.template=kt;h.customElements.get("mxp-dialog")||(h.customElements.define("mxp-dialog",ee),h.MxpDialog=ee);import{TemplateInstance as qt,ChildNodePart as he,AttrPart as ge}from"media-chrome/dist/media-theme-element.js";var te=new WeakMap,ae=class{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let r=te.get(this.element);r&&r.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),r=te.get(a.element);return r&&r.has(e)?r.get(e):new ae(a.element,e)}};function Gt(t,a){return t instanceof ge&&t.attributeName.startsWith("on")?(ae.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function zt(t,a){return a instanceof be&&t instanceof he?(a.renderInto(t),!0):!1}function Jt(t,a){return a instanceof DocumentFragment&&t instanceof he?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Xt(t,a){if(t instanceof ge){let e=t.attributeNamespace,r=t.element.getAttributeNS(e,t.attributeName);return String(a)!==r&&(t.value=String(a)),!0}return t.value=String(a),!0}function Qt(t,a){if(t instanceof ge&&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 ea(t,a){if(typeof a=="boolean"&&t instanceof ge){let e=t.attributeNamespace,r=t.element.hasAttributeNS(e,t.attributeName);return a!==r&&(t.booleanValue=a),!0}return!1}function ta(t,a){return a===!1&&t instanceof he?(t.replace(""),!0):!1}function aa(t,a){Qt(t,a)||ea(t,a)||Gt(t,a)||ta(t,a)||zt(t,a)||Jt(t,a)||Xt(t,a)}var Ve=new Map,Tt=new WeakMap,At=new WeakMap,be=class{constructor(a,e,r){this.strings=a;this.values=e;this.processor=r;this.stringsKey=this.strings.join("")}get template(){if(Ve.has(this.stringsKey))return Ve.get(this.stringsKey);{let a=T.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((r,i,o)=>r+i+(o<e?`{{ ${o} }}`:""),""),Ve.set(this.stringsKey,a),a}}renderInto(a){var i;let e=this.template;if(Tt.get(a)!==e){Tt.set(a,e);let o=new qt(e,this.values,this.processor);At.set(a,o),a instanceof he?a.replace(...o.children):a.appendChild(o);return}let r=At.get(a);(i=r==null?void 0:r.update)==null||i.call(r,this.values)}},ia={processCallback(t,a,e){var r;if(!!e){for(let[i,o]of a)if(i in e){let n=(r=e[i])!=null?r:"";aa(o,n)}}}};function R(t,...a){return new be(t,a,ia)}function xt(t,a){t.renderInto(a)}import{StreamTypes as ra}from"@mux/playback-core";var He=T.createElement("template");"innerHTML"in He&&(He.innerHTML=gt);var wt=t=>R`
973
+ `;var ee=class extends De{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ee.template=kt;h.customElements.get("mxp-dialog")||(h.customElements.define("mxp-dialog",ee),h.MxpDialog=ee);import{TemplateInstance as qt,ChildNodePart as he,AttrPart as ge}from"media-chrome/dist/media-theme-element.js";var te=new WeakMap,ae=class{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let r=te.get(this.element);r&&r.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),r=te.get(a.element);return r&&r.has(e)?r.get(e):new ae(a.element,e)}};function Gt(t,a){return t instanceof ge&&t.attributeName.startsWith("on")?(ae.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function zt(t,a){return a instanceof be&&t instanceof he?(a.renderInto(t),!0):!1}function Jt(t,a){return a instanceof DocumentFragment&&t instanceof he?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Xt(t,a){if(t instanceof ge){let e=t.attributeNamespace,r=t.element.getAttributeNS(e,t.attributeName);return String(a)!==r&&(t.value=String(a)),!0}return t.value=String(a),!0}function Qt(t,a){if(t instanceof ge&&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 ea(t,a){if(typeof a=="boolean"&&t instanceof ge){let e=t.attributeNamespace,r=t.element.hasAttributeNS(e,t.attributeName);return a!==r&&(t.booleanValue=a),!0}return!1}function ta(t,a){return a===!1&&t instanceof he?(t.replace(""),!0):!1}function aa(t,a){Qt(t,a)||ea(t,a)||Gt(t,a)||ta(t,a)||zt(t,a)||Jt(t,a)||Xt(t,a)}var Ve=new Map,Tt=new WeakMap,At=new WeakMap,be=class{constructor(a,e,r){this.strings=a;this.values=e;this.processor=r;this.stringsKey=this.strings.join("")}get template(){if(Ve.has(this.stringsKey))return Ve.get(this.stringsKey);{let a=T.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((r,i,o)=>r+i+(o<e?`{{ ${o} }}`:""),""),Ve.set(this.stringsKey,a),a}}renderInto(a){var i;let e=this.template;if(Tt.get(a)!==e){Tt.set(a,e);let o=new qt(e,this.values,this.processor);At.set(a,o),a instanceof he?a.replace(...o.children):a.appendChild(o);return}let r=At.get(a);(i=r==null?void 0:r.update)==null||i.call(r,this.values)}},ia={processCallback(t,a,e){var r;if(!!e){for(let[i,o]of a)if(i in e){let n=(r=e[i])!=null?r:"";aa(o,n)}}}};function S(t,...a){return new be(t,a,ia)}function xt(t,a){t.renderInto(a)}import{StreamTypes as ra}from"@mux/playback-core";var He=T.createElement("template");"innerHTML"in He&&(He.innerHTML=gt);var wt=t=>S`
974
974
  <style>
975
975
  ${ht}
976
976
  </style>
977
977
  ${na(t)}
978
- `,oa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return X(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},na=t=>{var a,e,r,i,o,n,u,b,w,k,P,g,v,A,_,c,le,G,Y,Fe,Ue,Ye,We,Ze,je,qe,Ge,ze,Je,Xe,Qe,et,tt,at,it;return R`
978
+ `,oa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return X(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},na=t=>{var a,e,r,i,o,n,u,b,w,k,P,g,v,A,_,c,le,G,Y,Fe,Ue,Ye,We,Ze,je,qe,Ge,ze,Je,Xe,Qe,et,tt,at,it;return S`
979
979
  <media-theme
980
980
  template="${(a=t.themeTemplate)!=null?a:He.content.children[0]}"
981
- default-stream-type="${(e=t.defaultStreamType)!=null?e:!1}"
981
+ defaultstreamtype="${(e=t.defaultStreamType)!=null?e:!1}"
982
982
  hotkeys="${oa(t)||!1}"
983
983
  nohotkeys="${t.noHotKeys||!t.hasSrc||t.isDialogOpen||!1}"
984
984
  noautoseektolive="${!!((r=t.streamType)!=null&&r.includes(ra.LIVE))&&t.targetLiveWindow!==0}"
@@ -986,12 +986,12 @@ media-theme {
986
986
  disabled="${!t.hasSrc||t.isDialogOpen}"
987
987
  audio="${(i=t.audio)!=null?i:!1}"
988
988
  style="${(o=st({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor}))!=null?o:!1}"
989
- default-showing-captions="${!t.defaultHiddenCaptions}"
990
- forward-seek-offset="${(n=t.forwardSeekOffset)!=null?n:!1}"
991
- backward-seek-offset="${(u=t.backwardSeekOffset)!=null?u:!1}"
992
- playback-rates="${(b=t.playbackRates)!=null?b:!1}"
993
- default-show-remaining-time="${(w=t.defaultShowRemainingTime)!=null?w:!1}"
994
- hide-duration="${(k=t.hideDuration)!=null?k:!1}"
989
+ defaultsubtitles="${!t.defaultHiddenCaptions}"
990
+ forwardseekoffset="${(n=t.forwardSeekOffset)!=null?n:!1}"
991
+ backwardseekoffset="${(u=t.backwardSeekOffset)!=null?u:!1}"
992
+ playbackrates="${(b=t.playbackRates)!=null?b:!1}"
993
+ defaultshowremainingtime="${(w=t.defaultShowRemainingTime)!=null?w:!1}"
994
+ hideduration="${(k=t.hideDuration)!=null?k:!1}"
995
995
  title="${(P=t.title)!=null?P:!1}"
996
996
  exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display"
997
997
  >
@@ -1019,7 +1019,7 @@ media-theme {
1019
1019
  cast-src="${t.src?t.src:t.playbackId?_e(t.playbackId,{maxResolution:t.maxResolution,domain:t.customDomain,token:t.tokens.playback}):!1}"
1020
1020
  exportparts="video"
1021
1021
  >
1022
- ${t.storyboard?R`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:R``}
1022
+ ${t.storyboard?S`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:S``}
1023
1023
  </mux-video>
1024
1024
  <media-poster-image
1025
1025
  slot="poster"
@@ -1033,18 +1033,18 @@ media-theme {
1033
1033
  onclose="${t.onCloseErrorDialog}"
1034
1034
  oninitfocus="${t.onInitFocusDialog}"
1035
1035
  >
1036
- ${(Qe=t.dialog)!=null&&Qe.title?R`<h3>${t.dialog.title}</h3>`:R``}
1036
+ ${(Qe=t.dialog)!=null&&Qe.title?S`<h3>${t.dialog.title}</h3>`:S``}
1037
1037
  <p>
1038
1038
  ${(et=t.dialog)==null?void 0:et.message}
1039
- ${(tt=t.dialog)!=null&&tt.linkUrl?R`<a
1039
+ ${(tt=t.dialog)!=null&&tt.linkUrl?S`<a
1040
1040
  href="${t.dialog.linkUrl}"
1041
1041
  target="_blank"
1042
1042
  rel="external noopener"
1043
1043
  aria-label="${(at=t.dialog.linkText)!=null?at:""} ${d("(opens in a new window)")}"
1044
1044
  >${(it=t.dialog.linkText)!=null?it:t.dialog.linkUrl}</a
1045
- >`:R``}
1045
+ >`:S``}
1046
1046
  </p>
1047
1047
  </mxp-dialog>
1048
1048
  </media-theme>
1049
- `};import{MediaError as fe}from"@mux/mux-video";function ye(t,a,e,r,i){var u,b,w;let o={},n={};switch(t.code){case fe.MEDIA_ERR_NETWORK:{switch(o.title=d("Network Error",i),o.message=t.message,(u=t.data)==null?void 0:u.response.code){case 412:{o.title=d("Video is not currently available",i),o.message=d("The live stream or video file are not yet ready.",i),n.message=d("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",i),n.file="412-not-playable.md";break}case 404:{o.title=d("Video does not exist",i),o.message="",n.message=d("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",i),n.file="404-not-found.md";break}case 403:{if(o.title=d("Invalid playback URL",i),o.message=d("The video URL or playback-token are formatted with incorrect or incomplete information.",i),n.message=d("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",i),n.file="missing-signed-tokens.md",!r)break;let{exp:k,aud:P,sub:g}=N(r),v=Date.now()>k*1e3,A=g!==e,_=P!=="v",c={timeStyle:"medium",dateStyle:"medium"};if(v){o.title=d("Video URL has expired",i),o.message=d("The video\u2019s secured playback-token has expired.",i),n.message=d("The video\u2019s secured playback-token has expired.",i),n.context=d("Expired at: {expiredDate}. Current time: {currentDate}.",i).format({expiredDate:new Intl.DateTimeFormat(H.code,c).format(k*1e3),currentDate:new Intl.DateTimeFormat(H.code,c).format(Date.now())}),n.file="403-expired-token.md";break}if(A){o.title=d("Video URL is formatted incorrectly",i),o.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",i),n.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",i),n.context=d("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",i).format({playbackId:e,tokenPlaybackId:g}),n.file="403-playback-id-mismatch.md";break}if(_){o.title=d("Video URL is formatted incorrectly",i),o.message=d("The playback-token is formatted with incorrect information.",i),n.message=d("The playback-token is formatted with incorrect information.",i),n.context=d("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",i).format({tokenType:P}),n.file="403-incorrect-aud-value.md";break}n.message=d("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",i),n.file="403-malformatted-token.md";break}}break}case fe.MEDIA_ERR_DECODE:{let{message:k}=t;o={title:d("Media Error",i),message:k},n.file="media-decode-error.md";break}case fe.MEDIA_ERR_SRC_NOT_SUPPORTED:{let k=(w=(b=t.data)==null?void 0:b.response)==null?void 0:w.code;if(k>=400&&k<500){t.code=fe.MEDIA_ERR_NETWORK,t.data={response:{code:k}},{dialog:o,devlog:n}=ye(t,a,e,r);break}o={title:d("Source Not Supported",i),message:t.message},n.file="media-src-not-supported.md";break}default:o={title:d("Error",i),message:t.message};break}return a&&(o={title:d("Your device appears to be offline",i),message:d("Check your internet connection and try reloading this video.",i)}),{dialog:o,devlog:n}}var M={SRC:"src",POSTER:"poster"},s={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-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",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",NO_VOLUME_PREF:"no-volume-pref"},$e=["audio","backward-seek-offset","default-show-remaining-time","default-showing-captions","noautoseektolive","disabled","exportparts","forward-seek-offset","hide-duration","hotkeys","nohotkeys","playbackrates","default-stream-type","stream-type","style","target-live-window","template","title","no-volume-pref"];function ma(t,a){var r;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(s.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:ca(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(s.NOHOTKEYS),hotKeys:t.getAttribute(s.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(l.TARGET_LIVE_WINDOW),streamType:X(t.getAttribute(l.STREAM_TYPE)),primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:pa(t),playbackRates:t.getAttribute(s.PLAYBACK_RATES),customDomain:(r=t.getAttribute(l.CUSTOM_DOMAIN))!=null?r:void 0,title:t.getAttribute(s.TITLE),novolumepref:t.hasAttribute(s.NO_VOLUME_PREF),...a}}function ca(t){var e,r;let a=t.getAttribute(s.THEME);if(a){let i=(r=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:r.call(e,a);if(i)return i;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let o=h.customElements.get(a);if(o!=null&&o.template)return o.template}}function pa(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 St(t){return t.getAttributeNames().filter(a=>a.startsWith("metadata-")).reduce((a,e)=>{let r=t.getAttribute(e);return r!==null&&(a[e.replace(/^metadata-/,"").replace(/-/g,"_")]=r),a},{})}var ba=Object.values(l),ha=Object.values(M),ga=Object.values(s),fa=pe(),ya="mux-player",Lt={dialog:void 0,isDialogOpen:!1},re,oe,C,ne,U,D,j,ke,Rt,se,Ke,V,q,Te,Mt,Ae,Ct,xe,Pt,we,_t,ie=class extends Ie{constructor(){super();p(this,D);p(this,ke);p(this,se);p(this,V);p(this,Te);p(this,Ae);p(this,xe);p(this,we);p(this,re,!1);p(this,oe,{});p(this,C,!0);p(this,ne,new ce(this,"hotkeys"));p(this,U,{...Lt,onCloseErrorDialog:()=>f(this,se,Ke).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Me(this,T.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),f(this,ke,Rt).call(this),this.isConnected&&f(this,D,j).call(this)}static get observedAttributes(){var e;return[...(e=Ie.observedAttributes)!=null?e:[],...ha,...ba,...ga]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,r;return(r=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:r.querySelector("media-controller")}connectedCallback(){var r;let e=(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video");e&&(e.metadata=St(this))}attributeChangedCallback(e,r,i){switch(f(this,D,j).call(this),super.attributeChangedCallback(e,r,i),e){case s.HOTKEYS:m(this,ne).value=i;break;case s.THUMBNAIL_TIME:{i!=null&&this.tokens.thumbnail&&B(d("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case s.THUMBNAIL_TOKEN:{let{aud:n}=N(i);i&&n!=="t"&&B(d("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:n}));break}case s.STORYBOARD_TOKEN:{let{aud:n}=N(i);i&&n!=="s"&&B(d("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:n}));break}case l.PLAYBACK_ID:{i!=null&&i.includes("?token")&&O(d("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:i}));break}case l.STREAM_TYPE:i&&![S.LIVE,S.ON_DEMAND,S.UNKNOWN].includes(i)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=i.includes("dvr")?Number.POSITIVE_INFINITY:0:Ne({file:"invalid-stream-type.md",message:d("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=i===S.LIVE?0:Number.NaN}[l.PLAYBACK_ID,M.SRC,s.PLAYBACK_TOKEN].includes(e)&&r!==i&&x(this,U,{...m(this,U),...Lt}),f(this,V,q).call(this,{[ut(e)]:i})}get preferCmcd(){var e;return(e=this.getAttribute(l.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ot.includes(e)?this.setAttribute(l.PREFER_CMCD,e):B(`Invalid value for preferCmcd. Must be one of ${Ot.join()}`):this.removeAttribute(l.PREFER_CMCD))}get hasPlayed(){var e,r;return(r=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?r:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute("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(s.THEME))!=null?e:""}set theme(e){this.setAttribute(s.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let r={};for(let i of e.getAttributeNames()){if($e.includes(i))continue;let o=e.getAttribute(i);r[ue(i)]=o===""?!0:o}return r}set themeProps(e){var i,o;f(this,D,j).call(this);let r={...this.themeProps,...e};for(let n in r){if($e.includes(n))continue;let u=e==null?void 0:e[n];typeof u=="boolean"||u==null?(i=this.mediaTheme)==null||i.toggleAttribute(de(n),Boolean(u)):(o=this.mediaTheme)==null||o.setAttribute(de(n),u)}}get playbackId(){var e;return(e=this.getAttribute(l.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(l.PLAYBACK_ID,e):this.removeAttribute(l.PLAYBACK_ID)}get src(){var e,r;return this.playbackId?(e=Z(this,M.SRC))!=null?e:void 0:(r=this.getAttribute(M.SRC))!=null?r:void 0}set src(e){e?this.setAttribute(M.SRC,e):this.removeAttribute(M.SRC)}get poster(){var r;let e=this.getAttribute(M.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return lt(this.playbackId,{domain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,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(s.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(s.STORYBOARD_SRC,e):this.removeAttribute(s.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[S.LIVE,S.UNKNOWN].includes(this.streamType)))return dt(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(s.AUDIO)}set audio(e){if(!e){this.removeAttribute(s.AUDIO);return}this.setAttribute(s.AUDIO,"")}get hotkeys(){return m(this,ne)}get nohotkeys(){return this.hasAttribute(s.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(s.NOHOTKEYS);return}this.setAttribute(s.NOHOTKEYS,"")}get thumbnailTime(){return L(this.getAttribute(s.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(s.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(s.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(s.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Z(this,s.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(s.PLACEHOLDER,`${e}`)}get primaryColor(){var r,i;let e=this.getAttribute(s.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(i=(r=h.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_primary-color"))==null?void 0:i.trim(),e))return e}set primaryColor(e){this.setAttribute(s.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var r,i;let e=this.getAttribute(s.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(i=(r=h.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_secondary-color"))==null?void 0:i.trim(),e))return e}set secondaryColor(e){this.setAttribute(s.SECONDARY_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(s.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(s.PLAYBACK_RATES))return this.getAttribute(s.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,r)=>e-r)}set playbackRates(e){if(!e){this.removeAttribute(s.PLAYBACK_RATES);return}this.setAttribute(s.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=L(this.getAttribute(s.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(s.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=L(this.getAttribute(s.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(s.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(s.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(l.PLAYER_SOFTWARE_NAME))!=null?e:ya}get playerSoftwareVersion(){var e;return(e=this.getAttribute(l.PLAYER_SOFTWARE_VERSION))!=null?e:fa}get beaconCollectionDomain(){var e;return(e=this.getAttribute(l.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(l.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(l.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(l.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(l.MAX_RESOLUTION,e):this.removeAttribute(l.MAX_RESOLUTION))}get customDomain(){var e;return(e=this.getAttribute(l.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(l.CUSTOM_DOMAIN,e):this.removeAttribute(l.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Z(this,l.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(l.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(s.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(s.NO_VOLUME_PREF,""):this.removeAttribute(s.NO_VOLUME_PREF)}get debug(){return Z(this,l.DEBUG)!=null}set debug(e){e?this.setAttribute(l.DEBUG,""):this.removeAttribute(l.DEBUG)}get disableCookies(){return Z(this,l.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(l.DISABLE_COOKIES,""):this.removeAttribute(l.DISABLE_COOKIES)}get streamType(){var e,r,i;return(i=(r=this.getAttribute(l.STREAM_TYPE))!=null?r:(e=this.media)==null?void 0:e.streamType)!=null?i:S.UNKNOWN}set streamType(e){this.setAttribute(l.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,r,i;return(i=(r=this.getAttribute(s.DEFAULT_STREAM_TYPE))!=null?r:(e=this.mediaController)==null?void 0:e.getAttribute(s.DEFAULT_STREAM_TYPE))!=null?i:S.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(s.DEFAULT_STREAM_TYPE,e):this.removeAttribute(s.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,r;return this.hasAttribute(s.TARGET_LIVE_WINDOW)?+this.getAttribute(s.TARGET_LIVE_WINDOW):(r=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?r:Number.NaN}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(s.TARGET_LIVE_WINDOW):this.setAttribute(s.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return L(Z(this,l.START_TIME))}set startTime(e){this.setAttribute(l.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(l.PREFER_PLAYBACK);if(e===Ee.MSE||e===Ee.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Ee.MSE||e===Ee.NATIVE?this.setAttribute(l.PREFER_PLAYBACK,e):this.removeAttribute(l.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(f(this,D,j).call(this),!this.media){O("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...St(this),...e}}async addCuePoints(e){var r;if(f(this,D,j).call(this),!this.media){O("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(r=this.media)==null?void 0:r.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,r;return(r=(e=this.media)==null?void 0:e.cuePoints)!=null?r:[]}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(s.PLAYBACK_TOKEN),r=this.getAttribute(s.THUMBNAIL_TOKEN),i=this.getAttribute(s.STORYBOARD_TOKEN);return{...m(this,oe),...e!=null?{playback:e}:{},...r!=null?{thumbnail:r}:{},...i!=null?{storyboard:i}:{}}}set tokens(e){x(this,oe,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(s.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(s.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(s.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(s.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(s.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(s.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,r,i,o){var u;let n=(u=this.media)==null?void 0:u.nativeEl;if(!!n)return da(n,e,r,i,o)}removeTextTrack(e){var i;let r=(i=this.media)==null?void 0:i.nativeEl;if(!!r)return ua(r,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};re=new WeakMap,oe=new WeakMap,C=new WeakMap,ne=new WeakMap,U=new WeakMap,D=new WeakSet,j=function(){var e,r,i;if(!m(this,re)){x(this,re,!0),f(this,V,q).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof h.HTMLElement))throw""}catch{O("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof la))throw""}catch{O("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof sa))throw""}catch{O("<media-controller> failed to upgrade!")}bt(this),f(this,Te,Mt).call(this),f(this,Ae,Ct).call(this),f(this,xe,Pt).call(this),x(this,C,(r=(e=this.mediaController)==null?void 0:e.hasAttribute("user-inactive"))!=null?r:!0),f(this,we,_t).call(this),(i=this.media)==null||i.addEventListener("streamtypechange",()=>{f(this,V,q).call(this)})}},ke=new WeakSet,Rt=function(){var e,r;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(r=window==null?void 0:window.CSS)==null||r.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},se=new WeakSet,Ke=function(e){Object.assign(m(this,U),e),f(this,V,q).call(this)},V=new WeakSet,q=function(e={}){xt(wt(ma(this,{...m(this,U),...e})),this.shadowRoot)},Te=new WeakSet,Mt=function(){let e=i=>{var u,b;if(!(i!=null&&i.startsWith("theme-")))return;let o=i.replace(/^theme-/,"");if($e.includes(o))return;let n=this.getAttribute(i);n!=null?(u=this.mediaTheme)==null||u.setAttribute(o,n):(b=this.mediaTheme)==null||b.removeAttribute(o)};new MutationObserver(i=>{for(let{attributeName:o}of i)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Ae=new WeakSet,Ct=function(){var r;let e=i=>{let{detail:o}=i;if(o instanceof ve||(o=new ve(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){B(o),o.data&&B(`${o.name} data:`,o.data);return}let{dialog:n,devlog:u}=ye(o,!window.navigator.onLine,this.playbackId,this.playbackToken);u.message&&Ne(u),O(o),o.data&&O(`${o.name} data:`,o.data),f(this,se,Ke).call(this,{isDialogOpen:!0,dialog:n})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(i={})=>{var n,u,b;if(!(((n=this.media)==null?void 0:n.error)instanceof ve))return i;let{devlog:o}=ye((u=this.media)==null?void 0:u.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(b=this.media)==null?void 0:b.error.code,player_error_message:o.message?String(o.message):i.player_error_message,player_error_context:o.context?String(o.context):i.player_error_context}}),(r=this.media)==null||r.addEventListener("error",i=>{var n,u;let{detail:o}=i;if(!o){let{message:b,code:w}=(u=(n=this.media)==null?void 0:n.error)!=null?u:{};o=new ve(b,w)}!(o!=null&&o.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:o}))})},xe=new WeakSet,Pt=function(){var r,i,o,n;let e=()=>f(this,V,q).call(this);(i=(r=this.media)==null?void 0:r.textTracks)==null||i.addEventListener("addtrack",e),(n=(o=this.media)==null?void 0:o.textTracks)==null||n.addEventListener("removetrack",e)},we=new WeakSet,_t=function(){var k,P;let e=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let i,o=new WeakMap,n=()=>this.streamType===S.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,u=(g,v,A=!1)=>{if(n())return;Array.from(g&&g.activeCues||[]).forEach(c=>{if(!(!c.snapToLines||c.line<-5||c.line>=0&&c.line<10))if(!v||this.paused){let le=c.text.split(`
1050
- `).length,G=e?-2:-3;this.streamType===S.LIVE&&(G=e?-1:-2);let Y=G-le;if(c.line===Y&&!A)return;o.has(c)||o.set(c,c.line),c.line=Y-1,c.line=Y}else setTimeout(()=>{c.line=o.get(c)||"auto"},500)})},b=()=>{var g,v;u(i,(v=(g=this.mediaController)==null?void 0:g.hasAttribute("user-inactive"))!=null?v:!1)},w=()=>{var A,_;let v=Array.from(((_=(A=this.mediaController)==null?void 0:A.media)==null?void 0:_.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];v!==i&&(i==null||i.removeEventListener("cuechange",b)),i=v,i==null||i.addEventListener("cuechange",b),u(i,m(this,C))};if(w(),(k=this.textTracks)==null||k.addEventListener("change",w),(P=this.textTracks)==null||P.addEventListener("addtrack",w),navigator.userAgent.includes("Chrome/")){let g=()=>{u(i,m(this,C),!0),this.paused||window.requestAnimationFrame(g)};this.addEventListener("playing",()=>{g()})}this.addEventListener("userinactivechange",()=>{var v,A;let g=(A=(v=this.mediaController)==null?void 0:v.hasAttribute("user-inactive"))!=null?A:!0;m(this,C)!==g&&(x(this,C,g),u(i,m(this,C)))})};function Z(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}h.customElements.get("mux-player")||(h.customElements.define("mux-player",ie),h.MuxPlayerElement=ie);var ki=ie;export{ve as MediaError,ki as default,Z as getVideoAttribute};
1049
+ `};import{MediaError as fe}from"@mux/mux-video";function ye(t,a,e,r,i){var u,b,w;let o={},n={};switch(t.code){case fe.MEDIA_ERR_NETWORK:{switch(o.title=d("Network Error",i),o.message=t.message,(u=t.data)==null?void 0:u.response.code){case 412:{o.title=d("Video is not currently available",i),o.message=d("The live stream or video file are not yet ready.",i),n.message=d("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",i),n.file="412-not-playable.md";break}case 404:{o.title=d("Video does not exist",i),o.message="",n.message=d("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",i),n.file="404-not-found.md";break}case 403:{if(o.title=d("Invalid playback URL",i),o.message=d("The video URL or playback-token are formatted with incorrect or incomplete information.",i),n.message=d("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",i),n.file="missing-signed-tokens.md",!r)break;let{exp:k,aud:P,sub:g}=N(r),v=Date.now()>k*1e3,A=g!==e,_=P!=="v",c={timeStyle:"medium",dateStyle:"medium"};if(v){o.title=d("Video URL has expired",i),o.message=d("The video\u2019s secured playback-token has expired.",i),n.message=d("The video\u2019s secured playback-token has expired.",i),n.context=d("Expired at: {expiredDate}. Current time: {currentDate}.",i).format({expiredDate:new Intl.DateTimeFormat(H.code,c).format(k*1e3),currentDate:new Intl.DateTimeFormat(H.code,c).format(Date.now())}),n.file="403-expired-token.md";break}if(A){o.title=d("Video URL is formatted incorrectly",i),o.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",i),n.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",i),n.context=d("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",i).format({playbackId:e,tokenPlaybackId:g}),n.file="403-playback-id-mismatch.md";break}if(_){o.title=d("Video URL is formatted incorrectly",i),o.message=d("The playback-token is formatted with incorrect information.",i),n.message=d("The playback-token is formatted with incorrect information.",i),n.context=d("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",i).format({tokenType:P}),n.file="403-incorrect-aud-value.md";break}n.message=d("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",i),n.file="403-malformatted-token.md";break}}break}case fe.MEDIA_ERR_DECODE:{let{message:k}=t;o={title:d("Media Error",i),message:k},n.file="media-decode-error.md";break}case fe.MEDIA_ERR_SRC_NOT_SUPPORTED:{let k=(w=(b=t.data)==null?void 0:b.response)==null?void 0:w.code;if(k>=400&&k<500){t.code=fe.MEDIA_ERR_NETWORK,t.data={response:{code:k}},{dialog:o,devlog:n}=ye(t,a,e,r);break}o={title:d("Source Not Supported",i),message:t.message},n.file="media-src-not-supported.md";break}default:o={title:d("Error",i),message:t.message};break}return a&&(o={title:d("Your device appears to be offline",i),message:d("Check your internet connection and try reloading this video.",i)}),{dialog:o,devlog:n}}var M={SRC:"src",POSTER:"poster"},s={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-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",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",NO_VOLUME_PREF:"no-volume-pref"},$e=["audio","backwardseekoffset","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function ma(t,a){var r;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(s.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:ca(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(s.NOHOTKEYS),hotKeys:t.getAttribute(s.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(l.TARGET_LIVE_WINDOW),streamType:X(t.getAttribute(l.STREAM_TYPE)),primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:pa(t),playbackRates:t.getAttribute(s.PLAYBACK_RATES),customDomain:(r=t.getAttribute(l.CUSTOM_DOMAIN))!=null?r:void 0,title:t.getAttribute(s.TITLE),novolumepref:t.hasAttribute(s.NO_VOLUME_PREF),...a}}function ca(t){var e,r;let a=t.getAttribute(s.THEME);if(a){let i=(r=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:r.call(e,a);if(i)return i;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let o=h.customElements.get(a);if(o!=null&&o.template)return o.template}}function pa(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 Lt(t){return t.getAttributeNames().filter(a=>a.startsWith("metadata-")).reduce((a,e)=>{let r=t.getAttribute(e);return r!==null&&(a[e.replace(/^metadata-/,"").replace(/-/g,"_")]=r),a},{})}var ba=Object.values(l),ha=Object.values(M),ga=Object.values(s),fa=pe(),ya="mux-player",Rt={dialog:void 0,isDialogOpen:!1},re,oe,C,ne,U,D,j,ke,St,se,Ke,V,q,Te,Mt,Ae,Ct,xe,Pt,we,_t,ie=class extends Ie{constructor(){super();p(this,D);p(this,ke);p(this,se);p(this,V);p(this,Te);p(this,Ae);p(this,xe);p(this,we);p(this,re,!1);p(this,oe,{});p(this,C,!0);p(this,ne,new ce(this,"hotkeys"));p(this,U,{...Rt,onCloseErrorDialog:()=>f(this,se,Ke).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Me(this,T.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),f(this,ke,St).call(this),this.isConnected&&f(this,D,j).call(this)}static get observedAttributes(){var e;return[...(e=Ie.observedAttributes)!=null?e:[],...ha,...ba,...ga]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,r;return(r=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:r.querySelector("media-controller")}connectedCallback(){var r;let e=(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video");e&&(e.metadata=Lt(this))}attributeChangedCallback(e,r,i){switch(f(this,D,j).call(this),super.attributeChangedCallback(e,r,i),e){case s.HOTKEYS:m(this,ne).value=i;break;case s.THUMBNAIL_TIME:{i!=null&&this.tokens.thumbnail&&B(d("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case s.THUMBNAIL_TOKEN:{let{aud:n}=N(i);i&&n!=="t"&&B(d("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:n}));break}case s.STORYBOARD_TOKEN:{let{aud:n}=N(i);i&&n!=="s"&&B(d("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:n}));break}case l.PLAYBACK_ID:{i!=null&&i.includes("?token")&&O(d("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:i}));break}case l.STREAM_TYPE:i&&![L.LIVE,L.ON_DEMAND,L.UNKNOWN].includes(i)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=i.includes("dvr")?Number.POSITIVE_INFINITY:0:Ne({file:"invalid-stream-type.md",message:d("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=i===L.LIVE?0:Number.NaN}[l.PLAYBACK_ID,M.SRC,s.PLAYBACK_TOKEN].includes(e)&&r!==i&&x(this,U,{...m(this,U),...Rt}),f(this,V,q).call(this,{[ut(e)]:i})}get preferCmcd(){var e;return(e=this.getAttribute(l.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ot.includes(e)?this.setAttribute(l.PREFER_CMCD,e):B(`Invalid value for preferCmcd. Must be one of ${Ot.join()}`):this.removeAttribute(l.PREFER_CMCD))}get hasPlayed(){var e,r;return(r=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?r:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute("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(s.THEME))!=null?e:""}set theme(e){this.setAttribute(s.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let r={};for(let i of e.getAttributeNames()){if($e.includes(i))continue;let o=e.getAttribute(i);r[ue(i)]=o===""?!0:o}return r}set themeProps(e){var i,o;f(this,D,j).call(this);let r={...this.themeProps,...e};for(let n in r){if($e.includes(n))continue;let u=e==null?void 0:e[n];typeof u=="boolean"||u==null?(i=this.mediaTheme)==null||i.toggleAttribute(de(n),Boolean(u)):(o=this.mediaTheme)==null||o.setAttribute(de(n),u)}}get playbackId(){var e;return(e=this.getAttribute(l.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(l.PLAYBACK_ID,e):this.removeAttribute(l.PLAYBACK_ID)}get src(){var e,r;return this.playbackId?(e=Z(this,M.SRC))!=null?e:void 0:(r=this.getAttribute(M.SRC))!=null?r:void 0}set src(e){e?this.setAttribute(M.SRC,e):this.removeAttribute(M.SRC)}get poster(){var r;let e=this.getAttribute(M.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return lt(this.playbackId,{domain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,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(s.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(s.STORYBOARD_SRC,e):this.removeAttribute(s.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[L.LIVE,L.UNKNOWN].includes(this.streamType)))return dt(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(s.AUDIO)}set audio(e){if(!e){this.removeAttribute(s.AUDIO);return}this.setAttribute(s.AUDIO,"")}get hotkeys(){return m(this,ne)}get nohotkeys(){return this.hasAttribute(s.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(s.NOHOTKEYS);return}this.setAttribute(s.NOHOTKEYS,"")}get thumbnailTime(){return R(this.getAttribute(s.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(s.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(s.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(s.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Z(this,s.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(s.PLACEHOLDER,`${e}`)}get primaryColor(){var r,i;let e=this.getAttribute(s.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(i=(r=h.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_primary-color"))==null?void 0:i.trim(),e))return e}set primaryColor(e){this.setAttribute(s.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var r,i;let e=this.getAttribute(s.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(i=(r=h.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_secondary-color"))==null?void 0:i.trim(),e))return e}set secondaryColor(e){this.setAttribute(s.SECONDARY_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(s.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(s.PLAYBACK_RATES))return this.getAttribute(s.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,r)=>e-r)}set playbackRates(e){if(!e){this.removeAttribute(s.PLAYBACK_RATES);return}this.setAttribute(s.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=R(this.getAttribute(s.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(s.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=R(this.getAttribute(s.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(s.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(s.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(l.PLAYER_SOFTWARE_NAME))!=null?e:ya}get playerSoftwareVersion(){var e;return(e=this.getAttribute(l.PLAYER_SOFTWARE_VERSION))!=null?e:fa}get beaconCollectionDomain(){var e;return(e=this.getAttribute(l.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(l.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(l.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(l.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(l.MAX_RESOLUTION,e):this.removeAttribute(l.MAX_RESOLUTION))}get customDomain(){var e;return(e=this.getAttribute(l.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(l.CUSTOM_DOMAIN,e):this.removeAttribute(l.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Z(this,l.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(l.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(s.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(s.NO_VOLUME_PREF,""):this.removeAttribute(s.NO_VOLUME_PREF)}get debug(){return Z(this,l.DEBUG)!=null}set debug(e){e?this.setAttribute(l.DEBUG,""):this.removeAttribute(l.DEBUG)}get disableCookies(){return Z(this,l.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(l.DISABLE_COOKIES,""):this.removeAttribute(l.DISABLE_COOKIES)}get streamType(){var e,r,i;return(i=(r=this.getAttribute(l.STREAM_TYPE))!=null?r:(e=this.media)==null?void 0:e.streamType)!=null?i:L.UNKNOWN}set streamType(e){this.setAttribute(l.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,r,i;return(i=(r=this.getAttribute(s.DEFAULT_STREAM_TYPE))!=null?r:(e=this.mediaController)==null?void 0:e.getAttribute(s.DEFAULT_STREAM_TYPE))!=null?i:L.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(s.DEFAULT_STREAM_TYPE,e):this.removeAttribute(s.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,r;return this.hasAttribute(s.TARGET_LIVE_WINDOW)?+this.getAttribute(s.TARGET_LIVE_WINDOW):(r=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?r:Number.NaN}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(s.TARGET_LIVE_WINDOW):this.setAttribute(s.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return R(Z(this,l.START_TIME))}set startTime(e){this.setAttribute(l.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(l.PREFER_PLAYBACK);if(e===Ee.MSE||e===Ee.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Ee.MSE||e===Ee.NATIVE?this.setAttribute(l.PREFER_PLAYBACK,e):this.removeAttribute(l.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(f(this,D,j).call(this),!this.media){O("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Lt(this),...e}}async addCuePoints(e){var r;if(f(this,D,j).call(this),!this.media){O("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(r=this.media)==null?void 0:r.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,r;return(r=(e=this.media)==null?void 0:e.cuePoints)!=null?r:[]}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(s.PLAYBACK_TOKEN),r=this.getAttribute(s.THUMBNAIL_TOKEN),i=this.getAttribute(s.STORYBOARD_TOKEN);return{...m(this,oe),...e!=null?{playback:e}:{},...r!=null?{thumbnail:r}:{},...i!=null?{storyboard:i}:{}}}set tokens(e){x(this,oe,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(s.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(s.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(s.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(s.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(s.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(s.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,r,i,o){var u;let n=(u=this.media)==null?void 0:u.nativeEl;if(!!n)return da(n,e,r,i,o)}removeTextTrack(e){var i;let r=(i=this.media)==null?void 0:i.nativeEl;if(!!r)return ua(r,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};re=new WeakMap,oe=new WeakMap,C=new WeakMap,ne=new WeakMap,U=new WeakMap,D=new WeakSet,j=function(){var e,r,i;if(!m(this,re)){x(this,re,!0),f(this,V,q).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof h.HTMLElement))throw""}catch{O("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof la))throw""}catch{O("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof sa))throw""}catch{O("<media-controller> failed to upgrade!")}bt(this),f(this,Te,Mt).call(this),f(this,Ae,Ct).call(this),f(this,xe,Pt).call(this),x(this,C,(r=(e=this.mediaController)==null?void 0:e.hasAttribute("userinactive"))!=null?r:!0),f(this,we,_t).call(this),(i=this.media)==null||i.addEventListener("streamtypechange",()=>{f(this,V,q).call(this)})}},ke=new WeakSet,St=function(){var e,r;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(r=window==null?void 0:window.CSS)==null||r.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},se=new WeakSet,Ke=function(e){Object.assign(m(this,U),e),f(this,V,q).call(this)},V=new WeakSet,q=function(e={}){xt(wt(ma(this,{...m(this,U),...e})),this.shadowRoot)},Te=new WeakSet,Mt=function(){let e=i=>{var u,b;if(!(i!=null&&i.startsWith("theme-")))return;let o=i.replace(/^theme-/,"");if($e.includes(o))return;let n=this.getAttribute(i);n!=null?(u=this.mediaTheme)==null||u.setAttribute(o,n):(b=this.mediaTheme)==null||b.removeAttribute(o)};new MutationObserver(i=>{for(let{attributeName:o}of i)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Ae=new WeakSet,Ct=function(){var r;let e=i=>{let{detail:o}=i;if(o instanceof ve||(o=new ve(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){B(o),o.data&&B(`${o.name} data:`,o.data);return}let{dialog:n,devlog:u}=ye(o,!window.navigator.onLine,this.playbackId,this.playbackToken);u.message&&Ne(u),O(o),o.data&&O(`${o.name} data:`,o.data),f(this,se,Ke).call(this,{isDialogOpen:!0,dialog:n})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(i={})=>{var n,u,b;if(!(((n=this.media)==null?void 0:n.error)instanceof ve))return i;let{devlog:o}=ye((u=this.media)==null?void 0:u.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(b=this.media)==null?void 0:b.error.code,player_error_message:o.message?String(o.message):i.player_error_message,player_error_context:o.context?String(o.context):i.player_error_context}}),(r=this.media)==null||r.addEventListener("error",i=>{var n,u;let{detail:o}=i;if(!o){let{message:b,code:w}=(u=(n=this.media)==null?void 0:n.error)!=null?u:{};o=new ve(b,w)}!(o!=null&&o.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:o}))})},xe=new WeakSet,Pt=function(){var r,i,o,n;let e=()=>f(this,V,q).call(this);(i=(r=this.media)==null?void 0:r.textTracks)==null||i.addEventListener("addtrack",e),(n=(o=this.media)==null?void 0:o.textTracks)==null||n.addEventListener("removetrack",e)},we=new WeakSet,_t=function(){var k,P;let e=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let i,o=new WeakMap,n=()=>this.streamType===L.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,u=(g,v,A=!1)=>{if(n())return;Array.from(g&&g.activeCues||[]).forEach(c=>{if(!(!c.snapToLines||c.line<-5||c.line>=0&&c.line<10))if(!v||this.paused){let le=c.text.split(`
1050
+ `).length,G=e?-2:-3;this.streamType===L.LIVE&&(G=e?-1:-2);let Y=G-le;if(c.line===Y&&!A)return;o.has(c)||o.set(c,c.line),c.line=Y-1,c.line=Y}else setTimeout(()=>{c.line=o.get(c)||"auto"},500)})},b=()=>{var g,v;u(i,(v=(g=this.mediaController)==null?void 0:g.hasAttribute("userinactive"))!=null?v:!1)},w=()=>{var A,_;let v=Array.from(((_=(A=this.mediaController)==null?void 0:A.media)==null?void 0:_.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];v!==i&&(i==null||i.removeEventListener("cuechange",b)),i=v,i==null||i.addEventListener("cuechange",b),u(i,m(this,C))};if(w(),(k=this.textTracks)==null||k.addEventListener("change",w),(P=this.textTracks)==null||P.addEventListener("addtrack",w),navigator.userAgent.includes("Chrome/")){let g=()=>{u(i,m(this,C),!0),this.paused||window.requestAnimationFrame(g)};this.addEventListener("playing",()=>{g()})}this.addEventListener("userinactivechange",()=>{var v,A;let g=(A=(v=this.mediaController)==null?void 0:v.hasAttribute("userinactive"))!=null?A:!0;m(this,C)!==g&&(x(this,C,g),u(i,m(this,C)))})};function Z(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}h.customElements.get("mux-player")||(h.customElements.define("mux-player",ie),h.MuxPlayerElement=ie);var ki=ie;export{ve as MediaError,ki as default,Z as getVideoAttribute};