@mux/mux-player 3.0.0 → 3.1.0-canary.0-192aa79
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/CHANGELOG.md +1079 -0
- package/README.md +6 -2
- package/dist/cjs.json +1 -0
- package/dist/esm.json +1 -0
- package/dist/iife.json +1 -0
- package/dist/index.cjs.js +214 -214
- package/dist/index.mjs +78 -78
- package/dist/module.json +1 -0
- package/dist/mux-player.js +275 -265
- package/dist/mux-player.mjs +275 -265
- package/dist/themes/classic/index.cjs.js +108 -82
- package/dist/themes/classic/index.js +108 -82
- package/dist/themes/classic/index.mjs +108 -82
- package/dist/themes/gerwig/index.cjs.js +109 -83
- package/dist/themes/gerwig/index.js +109 -83
- package/dist/themes/gerwig/index.mjs +109 -83
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/errors.d.ts +2 -2
- package/dist/types/helpers.d.ts +3 -3
- package/dist/types/index.d.ts +10 -7
- package/dist/types/template.d.ts +1 -1
- package/dist/types/utils.d.ts +0 -2
- package/dist/types-ts3.4/errors.d.ts +2 -2
- package/dist/types-ts3.4/helpers.d.ts +3 -3
- package/dist/types-ts3.4/index.d.ts +8 -7
- package/dist/types-ts3.4/template.d.ts +1 -1
- package/dist/types-ts3.4/utils.d.ts +0 -2
- package/package.json +10 -8
- package/LICENSE +0 -9
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var ke=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var u=(t,a,e)=>(ke(t,a,"read from private field"),e?e.call(t):a.get(t)),b=(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)},R=(t,a,e,i)=>(ke(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var h=(t,a,e)=>(ke(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 X=class extends W{},Re=class extends W{},qt={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(X)}},J,Oe=class{constructor(a,e={}){b(this,J,void 0);R(this,J,e==null?void 0:e.detail)}get detail(){return u(this,J)}initCustomEvent(){}};J=new WeakMap;function zt(t,a){return new X}var lt={document:{createElement:zt},DocumentFragment,customElements:qt,CustomEvent:Oe,EventTarget:W,HTMLElement:X,HTMLVideoElement:Re},ut=typeof window=="undefined"||typeof globalThis.customElements=="undefined",p=ut?lt:globalThis,C=ut?lt.document:globalThis.document;import{MediaController as Na}from"media-chrome";import{Attributes as He}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Ht}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import wa,{MediaError as fe,Attributes as s}from"@mux/mux-video";import{StreamTypes as L,PlaybackTypes as ye,addTextTrack as Pa,removeTextTrack as Ia,CmcdTypeValues as Kt,i18n as G,parseJwt as Ke,MuxJWTAud as Ue}from"@mux/playback-core";import{VideoEvents as aa}from"@mux/mux-video";import{i18n as ta}from"@mux/playback-core";import{StreamTypes as Le,parseJwt as ct}from"@mux/playback-core";function mt(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${le(e)}: ${i}; `)}),a?a.trim():void 0}function le(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 T(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function xe(t){let a=Xt(t).toString();return a?"?"+a:""}function Xt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var _e=(t,a)=>!t||!a?!1:t.contains(a)?!0:_e(t,a.getRootNode().host);var pt="mux.com",Jt=()=>{try{return"3.1.0"}catch{}return"UNKNOWN"},Qt=Jt(),ce=()=>Qt,bt=(t,{token:a,customDomain:e=pt,thumbnailTime:i,programTime:r}={})=>{var l;let o=a==null?i:void 0,{aud:d}=(l=ct(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${xe({token:a,time:o,program_time:r})}`},ht=(t,{token:a,customDomain:e=pt,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:o}=(d=ct(a))!=null?d:{};if(!(a&&o!=="s"))return`https://image.${e}/${t}/storyboard.vtt${xe({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},Q=t=>{if(t){if([Le.LIVE,Le.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Le.LIVE}};var ea={crossorigin:"crossOrigin",playsinline:"playsInline"};function gt(t){var a;return(a=ea[t])!=null?a:ue(t)}var H,K,v,me=class{constructor(a,e){b(this,H,void 0);b(this,K,void 0);b(this,v,[]);R(this,H,a),R(this,K,e)}[Symbol.iterator](){return u(this,v).values()}get length(){return u(this,v).length}get value(){var a;return(a=u(this,v).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(R(this,v,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,v)[a]}values(){return u(this,v).values()}keys(){return u(this,v).keys()}forEach(a){u(this,v).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,v).push(r)}),!(this.value===""&&!((e=u(this,H))!=null&&e.hasAttribute(`${u(this,K)}`)))&&((i=u(this,H))==null||i.setAttribute(`${u(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,v).splice(u(this,v).indexOf(i),1)}),(e=u(this,H))==null||e.setAttribute(`${u(this,K)}`,`${this.value}`)}contains(a){return u(this,v).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)}};H=new WeakMap,K=new WeakMap,v=new WeakMap;var ft=`[mux-player ${ce()}]`;function _(...t){console.warn(ft,...t)}function E(...t){console.error(ft,...t)}function Me(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${ta("Read more: ")}
|
|
2
|
+
https://github.com/muxinc/elements/blob/main/errors/${t.file}`),_(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},U={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},vt=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}}),ia=aa.filter(t=>t!=="error"),ra=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),oa=Object.values(U),Z,Se=class extends p.HTMLElement{constructor(){super();b(this,Z,new WeakMap);let e=r=>{for(let o of r)o.type==="childList"&&(o.removedNodes.forEach(d=>{var l;(l=u(this,Z).get(d))==null||l.remove()}),o.addedNodes.forEach(d=>{var c;let l=d;l!=null&&l.slot||(c=this.media)==null||c.append(Tt(u(this,Z),d))}))};new MutationObserver(e).observe(this,{childList:!0,subtree:!0})}static get observedAttributes(){return[...ra,...oa]}init(){this.querySelectorAll(":scope > :not([slot])").forEach(e=>{var i;(i=this.media)==null||i.append(Tt(u(this,Z),e))}),ia.forEach(e=>{var i;(i=this.media)==null||i.addEventListener(e,r=>{this.dispatchEvent(new Event(r.type))})})}attributeChangedCallback(e,i,r){var o,d;switch(e){case U.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case U.VOLUME:{let l=(o=T(r))!=null?o:1;this.media&&(this.media.volume=l);return}case U.PLAYBACKRATE:{let l=(d=T(r))!=null?d:1;this.media&&(this.media.playbackRate=l,this.media.defaultPlaybackRate=l);return}}}play(){var e,i;return(i=(e=this.media)==null?void 0:e.play())!=null?i:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}load(){var e;(e=this.media)==null||e.load()}requestCast(e){var i;return(i=this.media)==null?void 0:i.requestCast(e)}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var e,i;return(i=(e=this.media)==null?void 0:e.paused)!=null?i:!0}get duration(){var e,i;return(i=(e=this.media)==null?void 0:e.duration)!=null?i:NaN}get ended(){var e,i;return(i=(e=this.media)==null?void 0:e.ended)!=null?i:!1}get buffered(){var e,i;return(i=(e=this.media)==null?void 0:e.buffered)!=null?i:vt}get seekable(){var e,i;return(i=(e=this.media)==null?void 0:e.seekable)!=null?i:vt}get readyState(){var e,i;return(i=(e=this.media)==null?void 0:e.readyState)!=null?i:0}get videoWidth(){var e,i;return(i=(e=this.media)==null?void 0:e.videoWidth)!=null?i:0}get videoHeight(){var e,i;return(i=(e=this.media)==null?void 0:e.videoHeight)!=null?i:0}get currentSrc(){var e,i;return(i=(e=this.media)==null?void 0:e.currentSrc)!=null?i:""}get currentTime(){var e,i;return(i=(e=this.media)==null?void 0:e.currentTime)!=null?i:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,i;return(i=(e=this.media)==null?void 0:e.volume)!=null?i:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,i;return(i=(e=this.media)==null?void 0:e.playbackRate)!=null?i:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=T(this.getAttribute(U.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(U.PLAYBACKRATE,`${e}`):this.removeAttribute(U.PLAYBACKRATE)}get crossOrigin(){return ee(this,y.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(y.CROSSORIGIN,`${e}`)}get autoplay(){return ee(this,y.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(y.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return ee(this,y.LOOP)!=null}set loop(e){e?this.setAttribute(y.LOOP,""):this.removeAttribute(y.LOOP)}get muted(){var e,i;return(i=(e=this.media)==null?void 0:e.muted)!=null?i:!1}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return ee(this,y.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return ee(this,y.PLAYSINLINE)!=null}set playsInline(e){E("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(e){["","none","metadata","auto"].includes(e)?this.setAttribute(y.PRELOAD,e):this.removeAttribute(y.PRELOAD)}};Z=new WeakMap;function ee(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}function Tt(t,a){let e=t.get(a);return e||(e=a.cloneNode(),t.set(a,e)),e}var Ne=Se;import"media-chrome/dist/media-theme-element.js";var Et=`:host {
|
|
3
3
|
--media-control-display: var(--controls);
|
|
4
4
|
--media-loading-indicator-display: var(--loading-indicator);
|
|
5
5
|
--media-dialog-display: var(--dialog);
|
|
@@ -9,15 +9,15 @@ ${a}${t.file}`}O(i)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"l
|
|
|
9
9
|
--media-seek-forward-button-display: var(--seek-forward-button);
|
|
10
10
|
--media-mute-button-display: var(--mute-button);
|
|
11
11
|
--media-captions-button-display: var(--captions-button);
|
|
12
|
-
--media-captions-
|
|
13
|
-
--media-rendition-
|
|
14
|
-
--media-audio-track-
|
|
12
|
+
--media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display));
|
|
13
|
+
--media-rendition-menu-button-display: var(--rendition-menu-button);
|
|
14
|
+
--media-audio-track-menu-button-display: var(--audio-track-menu-button);
|
|
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
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
|
-
--media-playback-rate-
|
|
20
|
+
--media-playback-rate-menu-button-display: var(--playback-rate-menu-button);
|
|
21
21
|
--media-volume-range-display: var(--volume-range);
|
|
22
22
|
--media-time-range-display: var(--time-range);
|
|
23
23
|
--media-time-display-display: var(--time-display);
|
|
@@ -64,20 +64,20 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
64
64
|
--media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button));
|
|
65
65
|
--media-mute-button-display: var(--mute-button, var(--top-mute-button));
|
|
66
66
|
--media-captions-button-display: var(--captions-button, var(--top-captions-button));
|
|
67
|
-
--media-captions-
|
|
68
|
-
--captions-
|
|
69
|
-
var(--media-captions-button-display, var(--top-captions-
|
|
67
|
+
--media-captions-menu-button-display: var(
|
|
68
|
+
--captions-menu-button,
|
|
69
|
+
var(--media-captions-button-display, var(--top-captions-menu-button))
|
|
70
70
|
);
|
|
71
|
-
--media-rendition-
|
|
72
|
-
--media-audio-track-
|
|
71
|
+
--media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button));
|
|
72
|
+
--media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button));
|
|
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
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
|
-
--media-playback-rate-
|
|
79
|
-
--captions-
|
|
80
|
-
var(--media-playback-rate-button-display, var(--top-playback-rate-
|
|
78
|
+
--media-playback-rate-menu-button-display: var(
|
|
79
|
+
--captions-menu-button,
|
|
80
|
+
var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button))
|
|
81
81
|
);
|
|
82
82
|
--media-volume-range-display: var(--volume-range, var(--top-volume-range));
|
|
83
83
|
--media-time-range-display: var(--time-range, var(--top-time-range));
|
|
@@ -95,20 +95,20 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
95
95
|
--media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button));
|
|
96
96
|
--media-mute-button-display: var(--mute-button, var(--center-mute-button));
|
|
97
97
|
--media-captions-button-display: var(--captions-button, var(--center-captions-button));
|
|
98
|
-
--media-captions-
|
|
99
|
-
--captions-
|
|
100
|
-
var(--media-captions-button-display, var(--center-captions-
|
|
98
|
+
--media-captions-menu-button-display: var(
|
|
99
|
+
--captions-menu-button,
|
|
100
|
+
var(--media-captions-button-display, var(--center-captions-menu-button))
|
|
101
101
|
);
|
|
102
|
-
--media-rendition-
|
|
103
|
-
--media-audio-track-
|
|
102
|
+
--media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button));
|
|
103
|
+
--media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button));
|
|
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
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
|
-
--media-playback-rate-
|
|
110
|
-
--playback-rate-
|
|
111
|
-
var(--media-playback-rate-button-display, var(--center-playback-rate-
|
|
109
|
+
--media-playback-rate-menu-button-display: var(
|
|
110
|
+
--playback-rate-menu-button,
|
|
111
|
+
var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button))
|
|
112
112
|
);
|
|
113
113
|
--media-volume-range-display: var(--volume-range, var(--center-volume-range));
|
|
114
114
|
--media-time-range-display: var(--time-range, var(--center-time-range));
|
|
@@ -125,20 +125,20 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
125
125
|
--media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button));
|
|
126
126
|
--media-mute-button-display: var(--mute-button, var(--bottom-mute-button));
|
|
127
127
|
--media-captions-button-display: var(--captions-button, var(--bottom-captions-button));
|
|
128
|
-
--media-captions-
|
|
129
|
-
--captions-
|
|
130
|
-
var(--media-captions-button-display, var(--bottom-captions-
|
|
128
|
+
--media-captions-menu-button-display: var(
|
|
129
|
+
--captions-menu-button,
|
|
130
|
+
var(--media-captions-button-display, var(--bottom-captions-menu-button))
|
|
131
131
|
);
|
|
132
|
-
--media-rendition-
|
|
133
|
-
--media-audio-track-
|
|
132
|
+
--media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button));
|
|
133
|
+
--media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button));
|
|
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
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
|
-
--media-playback-rate-
|
|
140
|
-
--playback-rate-
|
|
141
|
-
var(--media-playback-rate-button-display, var(--bottom-playback-rate-
|
|
139
|
+
--media-playback-rate-menu-button-display: var(
|
|
140
|
+
--playback-rate-menu-button,
|
|
141
|
+
var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button))
|
|
142
142
|
);
|
|
143
143
|
--media-volume-range-display: var(--volume-range, var(--bottom-volume-range));
|
|
144
144
|
--media-time-range-display: var(--time-range, var(--bottom-time-range));
|
|
@@ -150,7 +150,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
150
150
|
:host([no-tooltips]) {
|
|
151
151
|
--media-tooltip-display: none;
|
|
152
152
|
}
|
|
153
|
-
`;var
|
|
153
|
+
`;var Ct=`
|
|
154
154
|
:host {
|
|
155
155
|
z-index: 100;
|
|
156
156
|
display: var(--media-dialog-display, flex);
|
|
@@ -202,17 +202,17 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
202
202
|
text-align: center;
|
|
203
203
|
line-height: 1.4;
|
|
204
204
|
}
|
|
205
|
-
`,
|
|
205
|
+
`,kt=C.createElement("template");kt.innerHTML=`
|
|
206
206
|
<style>
|
|
207
|
-
${
|
|
207
|
+
${Ct}
|
|
208
208
|
</style>
|
|
209
209
|
|
|
210
210
|
<div class="dialog">
|
|
211
211
|
<slot></slot>
|
|
212
212
|
</div>
|
|
213
|
-
`;var
|
|
213
|
+
`;var I=class extends p.HTMLElement{constructor(){var a;super(),this.attachShadow({mode:"open"}),(a=this.shadowRoot)==null||a.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),At(this)}close(){this.hasAttribute("open")&&(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),sa(this))}attributeChangedCallback(a,e,i){a==="open"&&e!==i&&(i!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&At(this)}};I.styles=Ct,I.template=kt,I.observedAttributes=["open"];function At(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=Rt(t.shadowRoot)),t._previouslyFocusedElement=C.activeElement,C.activeElement instanceof HTMLElement&&C.activeElement.blur(),t.addEventListener("transitionend",()=>{e instanceof HTMLElement&&e.focus({preventScroll:!0})},{once:!0})}function Rt(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=Rt(r[o].shadowRoot),i));o++);}return i}function sa(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}p.customElements.get("media-dialog")||(p.customElements.define("media-dialog",I),p.MediaDialog=I);var we=I;var Ot=C.createElement("template");Ot.innerHTML=`
|
|
214
214
|
<style>
|
|
215
|
-
${
|
|
215
|
+
${we.styles}
|
|
216
216
|
|
|
217
217
|
.close {
|
|
218
218
|
background: none;
|
|
@@ -241,58 +241,58 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
241
241
|
</svg>
|
|
242
242
|
</button>
|
|
243
243
|
</slot>
|
|
244
|
-
`;var te=class extends
|
|
244
|
+
`;var te=class extends we{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};te.template=Ot;p.customElements.get("mxp-dialog")||(p.customElements.define("mxp-dialog",te),p.MxpDialog=te);import{TemplateInstance as da,ChildNodePart as be,AttrPart as he}from"media-chrome/dist/media-theme-element.js";var ae=new WeakMap,Ie=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=ae.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=ae.get(this.element);e&&e.delete(this.type)}}static for(a){ae.has(a.element)||ae.set(a.element,new Map);let e=a.attributeName.slice(2),i=ae.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function la(t,a){return t instanceof he&&t.attributeName.startsWith("on")?(Ie.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function ua(t,a){return a instanceof pe&&t instanceof be?(a.renderInto(t),!0):!1}function ma(t,a){return a instanceof DocumentFragment&&t instanceof be?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function ca(t,a){if(t instanceof he){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 pa(t,a){if(t instanceof he&&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 ba(t,a){if(typeof a=="boolean"&&t instanceof he){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function ha(t,a){return a===!1&&t instanceof be?(t.replace(""),!0):!1}function ga(t,a){pa(t,a)||ba(t,a)||la(t,a)||ha(t,a)||ua(t,a)||ma(t,a)||ca(t,a)}var Pe=new Map,xt=new WeakMap,_t=new WeakMap,pe=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(Pe.has(this.stringsKey))return Pe.get(this.stringsKey);{let a=C.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,o)=>i+r+(o<e?`{{ ${o} }}`:""),""),Pe.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 da(e,this.values,this.processor);_t.set(a,o),a instanceof be?a.replace(...o.children):a.appendChild(o);return}let i=_t.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},fa={processCallback(t,a,e){var i;if(e){for(let[r,o]of a)if(r in e){let d=(i=e[r])!=null?i:"";ga(o,d)}}}};function S(t,...a){return new pe(t,a,fa)}function Lt(t,a){t.renderInto(a)}import{i18n as ya,StreamTypes as va,toMuxVideoURL as Mt}from"@mux/playback-core";var Ta=t=>{let{tokens:a}=t;return a.drm?":host { --_cast-button-drm-display: none; }":""},St=t=>S`
|
|
245
245
|
<style>
|
|
246
|
-
${
|
|
246
|
+
${Ta(t)}
|
|
247
247
|
${Et}
|
|
248
248
|
</style>
|
|
249
|
-
${
|
|
250
|
-
`,
|
|
249
|
+
${ka(t)}
|
|
250
|
+
`,Ea=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return Q(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},Aa={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",LISTBOX:"listbox",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},Ca=Object.values(Aa).join(", "),ka=t=>{var a,e,i,r,o,d,l,c,O,j,k,A,x,Y,g,de,q,z,Fe,Ye,We,Ze,Ge,je,qe,ze,Xe,Je,Qe,et,tt,at,it,rt,ot,nt,st,dt;return S`
|
|
251
251
|
<media-theme
|
|
252
252
|
template="${t.themeTemplate||!1}"
|
|
253
|
-
defaultstreamtype="${(
|
|
254
|
-
hotkeys="${
|
|
253
|
+
defaultstreamtype="${(a=t.defaultStreamType)!=null?a:!1}"
|
|
254
|
+
hotkeys="${Ea(t)||!1}"
|
|
255
255
|
nohotkeys="${t.noHotKeys||!t.hasSrc||t.isDialogOpen||!1}"
|
|
256
|
-
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(
|
|
256
|
+
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(va.LIVE))&&t.targetLiveWindow!==0}"
|
|
257
257
|
novolumepref="${t.novolumepref||!1}"
|
|
258
258
|
disabled="${!t.hasSrc||t.isDialogOpen}"
|
|
259
|
-
audio="${(
|
|
260
|
-
style="${(r=
|
|
259
|
+
audio="${(i=t.audio)!=null?i:!1}"
|
|
260
|
+
style="${(r=mt({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
|
|
261
261
|
defaultsubtitles="${!t.defaultHiddenCaptions}"
|
|
262
262
|
forwardseekoffset="${(o=t.forwardSeekOffset)!=null?o:!1}"
|
|
263
|
-
backwardseekoffset="${(
|
|
263
|
+
backwardseekoffset="${(d=t.backwardSeekOffset)!=null?d:!1}"
|
|
264
264
|
playbackrates="${(l=t.playbackRates)!=null?l:!1}"
|
|
265
|
-
defaultshowremainingtime="${(
|
|
266
|
-
defaultduration="${(
|
|
267
|
-
hideduration="${(
|
|
268
|
-
title="${(
|
|
269
|
-
exportparts="${
|
|
265
|
+
defaultshowremainingtime="${(c=t.defaultShowRemainingTime)!=null?c:!1}"
|
|
266
|
+
defaultduration="${(O=t.defaultDuration)!=null?O:!1}"
|
|
267
|
+
hideduration="${(j=t.hideDuration)!=null?j:!1}"
|
|
268
|
+
title="${(k=t.title)!=null?k:!1}"
|
|
269
|
+
exportparts="${Ca}"
|
|
270
270
|
>
|
|
271
271
|
<mux-video
|
|
272
272
|
slot="media"
|
|
273
|
-
target-live-window="${(
|
|
274
|
-
stream-type="${(
|
|
275
|
-
crossorigin="${(
|
|
273
|
+
target-live-window="${(A=t.targetLiveWindow)!=null?A:!1}"
|
|
274
|
+
stream-type="${(x=Q(t.streamType))!=null?x:!1}"
|
|
275
|
+
crossorigin="${(Y=t.crossOrigin)!=null?Y:""}"
|
|
276
276
|
playsinline
|
|
277
277
|
autoplay="${(g=t.autoplay)!=null?g:!1}"
|
|
278
|
-
muted="${(
|
|
278
|
+
muted="${(de=t.muted)!=null?de:!1}"
|
|
279
279
|
loop="${(q=t.loop)!=null?q:!1}"
|
|
280
280
|
preload="${(z=t.preload)!=null?z:!1}"
|
|
281
|
-
debug="${(
|
|
281
|
+
debug="${(Fe=t.debug)!=null?Fe:!1}"
|
|
282
282
|
prefer-cmcd="${(Ye=t.preferCmcd)!=null?Ye:!1}"
|
|
283
|
-
disable-tracking="${(
|
|
284
|
-
disable-cookies="${(
|
|
285
|
-
prefer-playback="${(
|
|
283
|
+
disable-tracking="${(We=t.disableTracking)!=null?We:!1}"
|
|
284
|
+
disable-cookies="${(Ze=t.disableCookies)!=null?Ze:!1}"
|
|
285
|
+
prefer-playback="${(Ge=t.preferPlayback)!=null?Ge:!1}"
|
|
286
286
|
start-time="${t.startTime!=null?t.startTime:!1}"
|
|
287
|
-
beacon-collection-domain="${(
|
|
288
|
-
player-software-name="${(
|
|
289
|
-
player-software-version="${(
|
|
290
|
-
env-key="${(
|
|
291
|
-
custom-domain="${(
|
|
292
|
-
src="${t.src?t.src:t.playbackId?
|
|
293
|
-
cast-src="${t.src?t.src:t.playbackId?
|
|
294
|
-
cast-receiver="${(
|
|
295
|
-
drm-token="${(
|
|
287
|
+
beacon-collection-domain="${(je=t.beaconCollectionDomain)!=null?je:!1}"
|
|
288
|
+
player-software-name="${(qe=t.playerSoftwareName)!=null?qe:!1}"
|
|
289
|
+
player-software-version="${(ze=t.playerSoftwareVersion)!=null?ze:!1}"
|
|
290
|
+
env-key="${(Xe=t.envKey)!=null?Xe:!1}"
|
|
291
|
+
custom-domain="${(Je=t.customDomain)!=null?Je:!1}"
|
|
292
|
+
src="${t.src?t.src:t.playbackId?Mt(t):!1}"
|
|
293
|
+
cast-src="${t.src?t.src:t.playbackId?Mt(t):!1}"
|
|
294
|
+
cast-receiver="${(Qe=t.castReceiver)!=null?Qe:!1}"
|
|
295
|
+
drm-token="${(tt=(et=t.tokens)==null?void 0:et.drm)!=null?tt:!1}"
|
|
296
296
|
exportparts="video"
|
|
297
297
|
>
|
|
298
298
|
${t.storyboard?S`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:S``}
|
|
@@ -302,29 +302,29 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
302
302
|
part="poster"
|
|
303
303
|
exportparts="poster, img"
|
|
304
304
|
src="${t.poster?t.poster:!1}"
|
|
305
|
-
placeholdersrc="${(
|
|
305
|
+
placeholdersrc="${(at=t.placeholder)!=null?at:!1}"
|
|
306
306
|
></media-poster-image>
|
|
307
307
|
</slot>
|
|
308
308
|
<mxp-dialog
|
|
309
309
|
no-auto-hide
|
|
310
|
-
open="${(
|
|
310
|
+
open="${(it=t.isDialogOpen)!=null?it:!1}"
|
|
311
311
|
onclose="${t.onCloseErrorDialog}"
|
|
312
312
|
oninitfocus="${t.onInitFocusDialog}"
|
|
313
313
|
>
|
|
314
|
-
${(
|
|
314
|
+
${(rt=t.dialog)!=null&&rt.title?S`<h3>${t.dialog.title}</h3>`:S``}
|
|
315
315
|
<p>
|
|
316
|
-
${(
|
|
317
|
-
${(
|
|
316
|
+
${(ot=t.dialog)==null?void 0:ot.message}
|
|
317
|
+
${(nt=t.dialog)!=null&&nt.linkUrl?S`<a
|
|
318
318
|
href="${t.dialog.linkUrl}"
|
|
319
319
|
target="_blank"
|
|
320
320
|
rel="external noopener"
|
|
321
|
-
aria-label="${(
|
|
322
|
-
>${(
|
|
321
|
+
aria-label="${(st=t.dialog.linkText)!=null?st:""} ${ya("(opens in a new window)")}"
|
|
322
|
+
>${(dt=t.dialog.linkText)!=null?dt:t.dialog.linkUrl}</a
|
|
323
323
|
>`:S``}
|
|
324
324
|
</p>
|
|
325
325
|
</mxp-dialog>
|
|
326
326
|
</media-theme>
|
|
327
|
-
`};import{MediaError as
|
|
327
|
+
`};import{errorCategoryToTokenNameOrPrefix as Nt,i18n as f,MediaError as N,MuxErrorCategory as wt,MuxErrorCode as m}from"@mux/playback-core";var Pt=t=>t.charAt(0).toUpperCase()+t.slice(1),Ra=(t,a=!1)=>{var e,i;if(t.muxCode){let r=Pt((e=t.errorCategory)!=null?e:"video"),o=Nt((i=t.errorCategory)!=null?i:wt.VIDEO);if(t.muxCode===m.NETWORK_OFFLINE)return f("Your device appears to be offline",a);if(t.muxCode===m.NETWORK_TOKEN_EXPIRED)return f("{category} URL has expired",a).format({category:r});if([m.NETWORK_TOKEN_SUB_MISMATCH,m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING,m.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return f("{category} URL is formatted incorrectly",a).format({category:r});if(t.muxCode===m.NETWORK_TOKEN_MISSING)return f("Invalid {categoryName} URL",a).format({categoryName:o});if(t.muxCode===m.NETWORK_NOT_FOUND)return f("{category} does not exist",a).format({category:r});if(t.muxCode===m.NETWORK_NOT_READY)return f("{category} is not currently available",a).format({category:r})}if(t.code){if(t.code===N.MEDIA_ERR_NETWORK)return f("Network Error",a);if(t.code===N.MEDIA_ERR_DECODE)return f("Media Error",a);if(t.code===N.MEDIA_ERR_SRC_NOT_SUPPORTED)return f("Source Not Supported",a)}return f("Error",a)},Oa=(t,a=!1)=>{var e,i;if(t.muxCode){let r=Pt((e=t.errorCategory)!=null?e:"video"),o=Nt((i=t.errorCategory)!=null?i:wt.VIDEO);return t.muxCode===m.NETWORK_OFFLINE?f("Check your internet connection and try reloading this video.",a):t.muxCode===m.NETWORK_TOKEN_EXPIRED?f("The video\u2019s secured {tokenNamePrefix}-token has expired.",a).format({tokenNamePrefix:o}):t.muxCode===m.NETWORK_TOKEN_SUB_MISMATCH?f("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",a).format({tokenNamePrefix:o}):t.muxCode===m.NETWORK_TOKEN_MALFORMED?f("{category} URL is formatted incorrectly",a).format({category:r}):[m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?f("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:o}):[m.NETWORK_TOKEN_MISSING,m.NETWORK_INVALID_URL].includes(t.muxCode)?f("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",a).format({tokenNamePrefix:o}):t.muxCode===m.NETWORK_NOT_FOUND?"":t.muxCode===m.NETWORK_NOT_READY?f("The live stream or video file are not yet ready.",a):t.message}return t.code&&(t.code===N.MEDIA_ERR_NETWORK||t.code===N.MEDIA_ERR_DECODE||t.code===N.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},xa=(t,a=!1)=>{let e=Ra(t,a),i=Oa(t,a);return{title:e,message:i}},_a=t=>{if(t.muxCode){if(t.muxCode===m.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===m.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===m.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===m.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===m.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===m.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===N.MEDIA_ERR_NETWORK)return"";if(t.code===N.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===N.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},La=(t,a)=>{let e=_a(t);return{message:t.message,context:t.context,file:e}};function De(t,a=!1){let e=xa(t,a),i=La(t,a);return{dialog:e,devlog:i}}var It=`<template id="media-theme-gerwig">
|
|
328
328
|
<style>
|
|
329
329
|
@keyframes pre-play-hide {
|
|
330
330
|
0% {
|
|
@@ -834,7 +834,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
834
834
|
--bottom-seek-backward-button: none;
|
|
835
835
|
--bottom-seek-forward-button: none;
|
|
836
836
|
--bottom-time-display: none;
|
|
837
|
-
--bottom-playback-rate-
|
|
837
|
+
--bottom-playback-rate-menu-button: none;
|
|
838
838
|
--bottom-pip-button: none;
|
|
839
839
|
}
|
|
840
840
|
</style>
|
|
@@ -1330,5 +1330,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1330
1330
|
<slot></slot>
|
|
1331
1331
|
</media-controller>
|
|
1332
1332
|
</template>
|
|
1333
|
-
`;import{MediaThemeElement as va}from"media-chrome/dist/media-theme-element.js";import"media-chrome/menu";var He=A.createElement("template");"innerHTML"in He&&(He.innerHTML=_t);var St,Pt,fe=class extends va{};fe.template=(Pt=(St=He.content)==null?void 0:St.children)==null?void 0:Pt[0];c.customElements.get("media-theme-gerwig")||c.customElements.define("media-theme-gerwig",fe);var Ca="gerwig";var P={SRC:"src",POSTER:"poster"},n={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips"},Ue=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function xa(t,i){var a;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src||!!t.currentSrc,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(n.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:Ra(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:Q(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:(a=t.getAttribute(d.CUSTOM_DOMAIN))!=null?a:void 0,title:t.getAttribute(n.TITLE),novolumepref:t.hasAttribute(n.NO_VOLUME_PREF),castReceiver:t.castReceiver,...i,extraSourceParams:t.extraSourceParams}}function Ra(t){var e,a;let i=t.theme;if(i){let r=(a=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:a.call(e,i);if(r&&r instanceof HTMLTemplateElement)return r;i.startsWith("media-theme-")||(i=`media-theme-${i}`);let o=c.customElements.get(i);if(o!=null&&o.template)return o.template}}function La(t){var e;let i=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return i&&getComputedStyle(i).getPropertyValue("--media-duration-display-display").trim()==="none"}function Dt(t){let i=t.hasAttribute(n.TITLE)?{video_title:t.getAttribute(n.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,a)=>{let r=t.getAttribute(a);return r!==null&&(e[a.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},i)}var Oa=Object.values(d),wa=Object.values(P),Ma=Object.values(n),_a=ue(),Sa="mux-player",Vt={dialog:void 0,isDialogOpen:!1},Pa={redundant_streams:!0},re,oe,H,ne,Z,M,V,Ee,Ht,se,Ke,N,W,Te,Bt,ke,Ut,Ae,Kt,Ce,$t,ie=class extends Ne{constructor(){super();p(this,M);p(this,Ee);p(this,se);p(this,N);p(this,Te);p(this,ke);p(this,Ae);p(this,Ce);p(this,re,!1);p(this,oe,{});p(this,H,!0);p(this,ne,new me(this,"hotkeys"));p(this,Z,{...Vt,onCloseErrorDialog:()=>b(this,se,Ke).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Me(this,A.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),b(this,Ee,Ht).call(this),this.isConnected&&b(this,M,V).call(this)}static get observedAttributes(){var e;return[...(e=Ne.observedAttributes)!=null?e:[],...wa,...Oa,...Ma]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,a;return(a=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:a.querySelector("media-controller")}connectedCallback(){var a;let e=(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video");e&&(e.metadata=Dt(this))}attributeChangedCallback(e,a,r){switch(b(this,M,V).call(this),super.attributeChangedCallback(e,a,r),e){case n.HOTKEYS:u(this,ne).value=r;break;case n.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&O(m("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case n.THUMBNAIL_TOKEN:{if(r){let{aud:s}=_(r);s!=="t"&&O(m("The provided thumbnail-token should have audience value 'd' instead of '{aud}'.").format({aud:s}))}break}case n.STORYBOARD_TOKEN:{if(r){let{aud:s}=_(r);s!=="s"&&O(m("The provided storyboard-token should have audience value 'd' instead of '{aud}'.").format({aud:s}))}break}case n.DRM_TOKEN:{if(r){let{aud:s}=_(r);s!=="d"&&O(m("The provided drm-token should have audience value 'd' instead of '{aud}'.").format({aud:s}))}break}case d.PLAYBACK_ID:{r!=null&&r.includes("?token")&&k(m("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:Se({file:"invalid-stream-type.md",message:m("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,P.SRC,n.PLAYBACK_TOKEN].includes(e)&&a!==r&&x(this,Z,{...u(this,Z),...Vt}),b(this,N,W).call(this,{[ht(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(d.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?It.includes(e)?this.setAttribute(d.PREFER_CMCD,e):O(`Invalid value for preferCmcd. Must be one of ${It.join()}`):this.removeAttribute(d.PREFER_CMCD))}get hasPlayed(){var e,a;return(a=(e=this.mediaController)==null?void 0:e.hasAttribute(Nt.MEDIA_HAS_PLAYED))!=null?a:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Nt.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:Ca}set theme(e){this.setAttribute(n.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let a={};for(let r of e.getAttributeNames()){if(Ue.includes(r))continue;let o=e.getAttribute(r);a[le(r)]=o===""?!0:o}return a}set themeProps(e){var r,o;b(this,M,V).call(this);let a={...this.themeProps,...e};for(let s in a){if(Ue.includes(s))continue;let l=e==null?void 0:e[s];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(de(s),!!l):(o=this.mediaTheme)==null||o.setAttribute(de(s),l)}}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,a;return this.playbackId?(e=F(this,P.SRC))!=null?e:void 0:(a=this.getAttribute(P.SRC))!=null?a:void 0}set src(e){e?this.setAttribute(P.SRC,e):this.removeAttribute(P.SRC)}get poster(){var r;let e=this.getAttribute(P.POSTER);if(e!=null)return e;let{tokens:a}=this;if(a.playback&&!a.thumbnail){O("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return pt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:a.thumbnail})}set poster(e){e||e===""?this.setAttribute(P.POSTER,e):this.removeAttribute(P.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(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[w.LIVE,w.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return bt(this.playbackId,{customDomain:this.customDomain,token:e.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,ne)}get nohotkeys(){return this.hasAttribute(n.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(n.NOHOTKEYS);return}this.setAttribute(n.NOHOTKEYS,"")}get thumbnailTime(){return R(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=F(this,n.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(n.PLACEHOLDER,`${e}`)}get primaryColor(){var a,r;let e=this.getAttribute(n.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(a=c.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(n.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var a,r;let e=this.getAttribute(n.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(a=c.getComputedStyle(this.mediaTheme))==null?void 0:a.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(n.SECONDARY_COLOR,`${e}`)}get accentColor(){var a,r;let e=this.getAttribute(n.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(a=c.getComputedStyle(this.mediaTheme))==null?void 0:a.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,a)=>e-a)}set playbackRates(e){if(!e){this.removeAttribute(n.PLAYBACK_RATES);return}this.setAttribute(n.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=R(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=R(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 R(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:Sa}get playerSoftwareVersion(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_VERSION))!=null?e:_a}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 R(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 R(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,[a,r])=>(e[a]=r,e),{}):Pa}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=F(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 F(this,d.DEBUG)!=null}set debug(e){e?this.setAttribute(d.DEBUG,""):this.removeAttribute(d.DEBUG)}get disableTracking(){return F(this,d.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(d.DISABLE_TRACKING,!!e)}get disableCookies(){return F(this,d.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(d.DISABLE_COOKIES,""):this.removeAttribute(d.DISABLE_COOKIES)}get streamType(){var e,a,r;return(r=(a=this.getAttribute(d.STREAM_TYPE))!=null?a:(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,a,r;return(r=(a=this.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?a:(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,a;return this.hasAttribute(n.TARGET_LIVE_WINDOW)?+this.getAttribute(n.TARGET_LIVE_WINDOW):(a=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?a: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 R(F(this,d.START_TIME))}set startTime(e){this.setAttribute(d.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(d.PREFER_PLAYBACK);if(e===ve.MSE||e===ve.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===ve.MSE||e===ve.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(b(this,M,V).call(this),!this.media){k("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Dt(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(b(this,M,V).call(this),!this.media){k("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var a;if(b(this,M,V).call(this),!this.media){k("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(a=this.media)==null?void 0:a.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,a;return(a=(e=this.media)==null?void 0:e.cuePoints)!=null?a:[]}addChapters(e){var a;if(b(this,M,V).call(this),!this.media){k("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(a=this.media)==null?void 0:a.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,a;return(a=(e=this.media)==null?void 0:e.chapters)!=null?a:[]}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),a=this.getAttribute(n.DRM_TOKEN),r=this.getAttribute(n.THUMBNAIL_TOKEN),o=this.getAttribute(n.STORYBOARD_TOKEN);return{...u(this,oe),...e!=null?{playback:e}:{},...a!=null?{drm:a}:{},...r!=null?{thumbnail:r}:{},...o!=null?{storyboard:o}:{}}}set tokens(e){x(this,oe,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,a,r,o){var l;let s=(l=this.media)==null?void 0:l.nativeEl;if(s)return ka(s,e,a,r,o)}removeTextTrack(e){var r;let a=(r=this.media)==null?void 0:r.nativeEl;if(a)return Aa(a,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(n.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(n.CAST_RECEIVER,e):this.removeAttribute(n.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){k("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(n.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(n.NO_TOOLTIPS);return}this.setAttribute(n.NO_TOOLTIPS,"")}};re=new WeakMap,oe=new WeakMap,H=new WeakMap,ne=new WeakMap,Z=new WeakMap,M=new WeakSet,V=function(){var e,a,r,o;if(!u(this,re)){x(this,re,!0),b(this,N,W).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof c.HTMLElement))throw""}catch{k("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Ta))throw""}catch{k("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ea))throw""}catch{k("<media-controller> failed to upgrade!")}this.init(),b(this,Te,Bt).call(this),b(this,ke,Ut).call(this),b(this,Ae,Kt).call(this),x(this,H,(a=(e=this.mediaController)==null?void 0:e.hasAttribute(Be.USER_INACTIVE))!=null?a:!0),b(this,Ce,$t).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>b(this,N,W).call(this)),(o=this.media)==null||o.addEventListener("loadstart",()=>b(this,N,W).call(this))}},Ee=new WeakSet,Ht=function(){var e,a;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(a=window==null?void 0:window.CSS)==null||a.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},se=new WeakSet,Ke=function(e){Object.assign(u(this,Z),e),b(this,N,W).call(this)},N=new WeakSet,W=function(e={}){Ot(Mt(xa(this,{...u(this,Z),...e})),this.shadowRoot)},Te=new WeakSet,Bt=function(){let e=r=>{var l,h;if(!(r!=null&&r.startsWith("theme-")))return;let o=r.replace(/^theme-/,"");if(Ue.includes(o))return;let s=this.getAttribute(r);s!=null?(l=this.mediaTheme)==null||l.setAttribute(o,s):(h=this.mediaTheme)==null||h.removeAttribute(o)};new MutationObserver(r=>{for(let{attributeName:o}of r)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},ke=new WeakSet,Ut=function(){var a;let e=r=>{let{detail:o}=r;if(o instanceof ye||(o=new ye(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){O(o),o.data&&O(`${o.name} data:`,o.data);return}let{dialog:s,devlog:l}=ge(o,!window.navigator.onLine,this.playbackId,this.playbackToken);l.message&&Se(l),k(o),o.data&&k(`${o.name} data:`,o.data),b(this,se,Ke).call(this,{isDialogOpen:!0,dialog:s})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var s,l,h;if(!(((s=this.media)==null?void 0:s.error)instanceof ye))return r;let{devlog:o}=ge((l=this.media)==null?void 0:l.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(h=this.media)==null?void 0:h.error.code,player_error_message:o.message?String(o.message):r.player_error_message,player_error_context:o.context?String(o.context):r.player_error_context}}),(a=this.media)==null||a.addEventListener("error",r=>{var s,l;let{detail:o}=r;if(!o){let{message:h,code:L}=(l=(s=this.media)==null?void 0:s.error)!=null?l:{};o=new ye(h,L)}o!=null&&o.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:o}))})},Ae=new WeakSet,Kt=function(){var a,r,o,s;let e=()=>b(this,N,W).call(this);(r=(a=this.media)==null?void 0:a.textTracks)==null||r.addEventListener("addtrack",e),(s=(o=this.media)==null?void 0:o.textTracks)==null||s.addEventListener("removetrack",e)},Ce=new WeakSet,$t=function(){var L,T;if(!/Firefox/i.test(navigator.userAgent))return;let a,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(g=>{if(!(!g.snapToLines||g.line<-5||g.line>=0&&g.line<10))if(!f||this.paused){let B=g.text.split(`
|
|
1334
|
-
`).length,q=-3;this.streamType===
|
|
1333
|
+
`;import{MediaThemeElement as Sa}from"media-chrome/dist/media-theme-element.js";import"media-chrome/menu";var Ve=C.createElement("template");"innerHTML"in Ve&&(Ve.innerHTML=It);var Dt,Vt,ge=class extends Sa{};ge.template=(Vt=(Dt=Ve.content)==null?void 0:Dt.children)==null?void 0:Vt[0];p.customElements.get("media-theme-gerwig")||p.customElements.define("media-theme-gerwig",ge);var Da="gerwig";var w={SRC:"src",POSTER:"poster"},n={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips"},Be=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function Va(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src||!!t.currentSrc,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(n.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:Ha(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,assetStartTime:t.assetStartTime,assetEndTime:t.assetEndTime,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(s.TARGET_LIVE_WINDOW),streamType:Q(t.getAttribute(s.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:Ka(t),playbackRates:t.getAttribute(n.PLAYBACK_RATES),customDomain:(i=t.getAttribute(s.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(n.TITLE),novolumepref:t.hasAttribute(n.NO_VOLUME_PREF),castReceiver:t.castReceiver,...a,extraSourceParams:t.extraSourceParams}}function Ha(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=p.customElements.get(a);if(o!=null&&o.template)return o.template}}function Ka(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 Ut(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 Ua=Object.values(s),Ba=Object.values(w),$a=Object.values(n),Bt=ce(),$t="mux-player",Ft={dialog:void 0,isDialogOpen:!1},Fa={redundant_streams:!0},re,oe,V,ne,F,M,D,ve,Yt,se,$e,P,$,Te,Wt,Ee,Zt,Ae,Gt,Ce,jt,ie=class extends Ne{constructor(){super();b(this,M);b(this,ve);b(this,se);b(this,P);b(this,Te);b(this,Ee);b(this,Ae);b(this,Ce);b(this,re,!1);b(this,oe,{});b(this,V,!0);b(this,ne,new me(this,"hotkeys"));b(this,F,{...Ft,onCloseErrorDialog:()=>h(this,se,$e).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{_e(this,C.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),h(this,ve,Yt).call(this),this.isConnected&&h(this,M,D).call(this)}static get NAME(){return $t}static get VERSION(){return Bt}static get observedAttributes(){var e;return[...(e=Ne.observedAttributes)!=null?e:[],...Ba,...Ua,...$a]}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=Ut(this))}attributeChangedCallback(e,i,r){switch(h(this,M,D).call(this),super.attributeChangedCallback(e,i,r),e){case n.HOTKEYS:u(this,ne).value=r;break;case n.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&_(G("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case n.THUMBNAIL_TOKEN:{if(r){let d=Ke(r);if(d){let{aud:l}=d,c=Ue.THUMBNAIL;l!==c&&_(G("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"thumbnail"}))}}break}case n.STORYBOARD_TOKEN:{if(r){let d=Ke(r);if(d){let{aud:l}=d,c=Ue.STORYBOARD;l!==c&&_(G("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"storyboard"}))}}break}case n.DRM_TOKEN:{if(r){let d=Ke(r);if(d){let{aud:l}=d,c=Ue.DRM;l!==c&&_(G("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&E(G("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:r&&![L.LIVE,L.ON_DEMAND,L.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:G("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===L.LIVE?this.getAttribute(n.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[s.PLAYBACK_ID,w.SRC,n.PLAYBACK_TOKEN].includes(e)&&i!==r&&R(this,F,{...u(this,F),...Ft}),h(this,P,$).call(this,{[gt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Kt.includes(e)?this.setAttribute(s.PREFER_CMCD,e):_(`Invalid value for preferCmcd. Must be one of ${Kt.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Ht.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Ht.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:Da}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[ue(r)]=o===""?!0:o}return i}set themeProps(e){var r,o;h(this,M,D).call(this);let i={...this.themeProps,...e};for(let d in i){if(Be.includes(d))continue;let l=e==null?void 0:e[d];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(le(d),!!l):(o=this.mediaTheme)==null||o.setAttribute(le(d),l)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=B(this,w.SRC))!=null?e:void 0:(i=this.getAttribute(w.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(w.SRC,e):this.removeAttribute(w.SRC)}get poster(){var r;let e=this.getAttribute(w.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){_("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return bt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(w.POSTER,e):this.removeAttribute(w.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(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[L.LIVE,L.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return ht(this.playbackId,{customDomain:this.customDomain,token:e.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,ne)}get nohotkeys(){return this.hasAttribute(n.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(n.NOHOTKEYS);return}this.setAttribute(n.NOHOTKEYS,"")}get thumbnailTime(){return T(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=B(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=p.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=p.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=p.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=T(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=T(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 T(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(s.PLAYER_SOFTWARE_NAME))!=null?e:$t}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:Bt}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return T(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return T(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return T(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return T(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(n.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(n.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Fa}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(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=B(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.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 B(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return B(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return B(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:L.UNKNOWN}set streamType(e){this.setAttribute(s.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:L.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 T(B(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.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(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(h(this,M,D).call(this),!this.media){E("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Ut(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(h(this,M,D).call(this),!this.media){E("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(h(this,M,D).call(this),!this.media){E("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(i=this.media)==null?void 0:i.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,i;return(i=(e=this.media)==null?void 0:e.cuePoints)!=null?i:[]}addChapters(e){var i;if(h(this,M,D).call(this),!this.media){E("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(n.PLAYBACK_TOKEN),i=this.getAttribute(n.DRM_TOKEN),r=this.getAttribute(n.THUMBNAIL_TOKEN),o=this.getAttribute(n.STORYBOARD_TOKEN);return{...u(this,oe),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...o!=null?{storyboard:o}:{}}}set tokens(e){R(this,oe,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 l;let d=(l=this.media)==null?void 0:l.nativeEl;if(d)return Pa(d,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return Ia(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(n.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(n.CAST_RECEIVER,e):this.removeAttribute(n.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){E("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(n.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(n.NO_TOOLTIPS);return}this.setAttribute(n.NO_TOOLTIPS,"")}};re=new WeakMap,oe=new WeakMap,V=new WeakMap,ne=new WeakMap,F=new WeakMap,M=new WeakSet,D=function(){var e,i,r,o;if(!u(this,re)){R(this,re,!0),h(this,P,$).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof p.HTMLElement))throw""}catch{E("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof wa))throw""}catch{E("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Na))throw""}catch{E("<media-controller> failed to upgrade!")}this.init(),h(this,Te,Wt).call(this),h(this,Ee,Zt).call(this),h(this,Ae,Gt).call(this),R(this,V,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(He.USER_INACTIVE))!=null?i:!0),h(this,Ce,jt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>h(this,P,$).call(this)),(o=this.media)==null||o.addEventListener("loadstart",()=>h(this,P,$).call(this))}},ve=new WeakSet,Yt=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},se=new WeakSet,$e=function(e){Object.assign(u(this,F),e),h(this,P,$).call(this)},P=new WeakSet,$=function(e={}){Lt(St(Va(this,{...u(this,F),...e})),this.shadowRoot)},Te=new WeakSet,Wt=function(){let e=r=>{var l,c;if(!(r!=null&&r.startsWith("theme-")))return;let o=r.replace(/^theme-/,"");if(Be.includes(o))return;let d=this.getAttribute(r);d!=null?(l=this.mediaTheme)==null||l.setAttribute(o,d):(c=this.mediaTheme)==null||c.removeAttribute(o)};new MutationObserver(r=>{for(let{attributeName:o}of r)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Ee=new WeakSet,Zt=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)){_(o),o.data&&_(`${o.name} data:`,o.data);return}let{dialog:d,devlog:l}=De(o,!1);l.message&&Me(l),E(o),o.data&&E(`${o.name} data:`,o.data),h(this,se,$e).call(this,{isDialogOpen:!0,dialog:d})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var d,l,c;if(!(((d=this.media)==null?void 0:d.error)instanceof fe))return r;let{devlog:o}=De((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(c=this.media)==null?void 0:c.error.code,player_error_message: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 d,l;let{detail:o}=r;if(!o){let{message:c,code:O}=(l=(d=this.media)==null?void 0:d.error)!=null?l:{};o=new fe(c,O)}o!=null&&o.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:o}))})},Ae=new WeakSet,Gt=function(){var i,r,o,d;let e=()=>h(this,P,$).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(d=(o=this.media)==null?void 0:o.textTracks)==null||d.addEventListener("removetrack",e)},Ce=new WeakSet,jt=function(){var O,j;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,o=()=>this.streamType===L.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(k,A,x=!1)=>{if(o())return;Array.from(k&&k.activeCues||[]).forEach(g=>{if(!(!g.snapToLines||g.line<-5||g.line>=0&&g.line<10))if(!A||this.paused){let de=g.text.split(`
|
|
1334
|
+
`).length,q=-3;this.streamType===L.LIVE&&(q=-2);let z=q-de;if(g.line===z&&!x)return;r.has(g)||r.set(g,g.line),g.line=z}else setTimeout(()=>{g.line=r.get(g)||"auto"},500)})},l=()=>{var k,A;d(i,(A=(k=this.mediaController)==null?void 0:k.hasAttribute(He.USER_INACTIVE))!=null?A:!1)},c=()=>{var x,Y;let A=Array.from(((Y=(x=this.mediaController)==null?void 0:x.media)==null?void 0:Y.textTracks)||[]).filter(g=>["subtitles","captions"].includes(g.kind)&&g.mode==="showing")[0];A!==i&&(i==null||i.removeEventListener("cuechange",l)),i=A,i==null||i.addEventListener("cuechange",l),d(i,u(this,V))};c(),(O=this.textTracks)==null||O.addEventListener("change",c),(j=this.textTracks)==null||j.addEventListener("addtrack",c),this.addEventListener("userinactivechange",()=>{var A,x;let k=(x=(A=this.mediaController)==null?void 0:A.hasAttribute(He.USER_INACTIVE))!=null?x:!0;u(this,V)!==k&&(R(this,V,k),d(i,u(this,V)))})};function B(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}p.customElements.get("mux-player")||(p.customElements.define("mux-player",ie),p.MuxPlayerElement=ie);var Zi=ie;export{fe as MediaError,Zi as default,B as getVideoAttribute,$t as playerSoftwareName,Bt as playerSoftwareVersion};
|