@mux/mux-player 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +260 -324
- package/dist/index.mjs +57 -149
- package/dist/mux-player.js +264 -328
- package/dist/mux-player.mjs +264 -328
- package/dist/themes/classic/index.cjs.js +39 -56
- package/dist/themes/classic/index.js +39 -56
- package/dist/themes/classic/index.mjs +39 -56
- package/dist/themes/gerwig/index.cjs.js +39 -56
- package/dist/themes/gerwig/index.js +39 -56
- package/dist/themes/gerwig/index.mjs +39 -56
- package/dist/themes/microvideo/index.cjs.js +1164 -900
- package/dist/themes/microvideo/index.js +1164 -900
- package/dist/themes/microvideo/index.mjs +1164 -900
- package/dist/themes/minimal/index.cjs.js +1162 -898
- package/dist/themes/minimal/index.js +1162 -898
- package/dist/themes/minimal/index.mjs +1162 -898
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/errors.d.ts +2 -0
- package/dist/types/index.d.ts +8 -2
- package/dist/types/template.d.ts +0 -1
- package/dist/types/video-api.d.ts +1 -2
- package/dist/types-ts3.4/errors.d.ts +2 -0
- package/dist/types-ts3.4/index.d.ts +7 -2
- package/dist/types-ts3.4/template.d.ts +0 -1
- package/dist/types-ts3.4/video-api.d.ts +1 -2
- package/package.json +11 -14
- package/LICENSE +0 -9
- package/dist/types/dialog.d.ts +0 -6
- package/dist/types/media-chrome/dialog.d.ts +0 -13
- package/dist/types-ts3.4/dialog.d.ts +0 -6
- package/dist/types-ts3.4/media-chrome/dialog.d.ts +0 -13
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
https://github.com/muxinc/elements/blob/main/errors/${t.file}`),_(a)}var
|
|
1
|
+
var Ae=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var u=(t,a,e)=>(Ae(t,a,"read from private field"),e?e.call(t):a.get(t)),p=(t,a,e)=>{if(a.has(t))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(t):a.set(t,e)},C=(t,a,e,i)=>(Ae(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var b=(t,a,e)=>(Ae(t,a,"access private method"),e);var Y=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends Y{}globalThis.DocumentFragment=t}var j=class extends Y{},Ce=class extends Y{},Vt={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(j)}},q,ke=class{constructor(a,e={}){p(this,q,void 0);C(this,q,e==null?void 0:e.detail)}get detail(){return u(this,q)}initCustomEvent(){}};q=new WeakMap;function Kt(t,a){return new j}var tt={document:{createElement:Kt},DocumentFragment,customElements:Vt,CustomEvent:ke,EventTarget:Y,HTMLElement:j,HTMLVideoElement:Ce},at=typeof window=="undefined"||typeof globalThis.customElements=="undefined",v=at?tt:globalThis,F=at?tt.document:globalThis.document;import{MediaController as fa,MediaErrorDialog as Nt}from"media-chrome";import{Attributes as Ie}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Rt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ga,{MediaError as ee,Attributes as s}from"@mux/mux-video";import{StreamTypes as x,PlaybackTypes as fe,addTextTrack as ya,removeTextTrack as Ta,CmcdTypeValues as Ot,i18n as H,parseJwt as De,MuxJWTAud as Ve,generatePlayerInitTime as va}from"@mux/playback-core";import{VideoEvents as Ft}from"@mux/mux-video";import{i18n as Yt}from"@mux/playback-core";import{StreamTypes as _e,parseJwt as rt}from"@mux/playback-core";function it(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${de(e)}: ${i}; `)}),a?a.trim():void 0}function de(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function le(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function Re(t){let a=Ht(t).toString();return a?"?"+a:""}function Ht(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var Oe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Oe(t,a.getRootNode().host);var ot="mux.com",Ut=()=>{try{return"3.2.0"}catch{}return"UNKNOWN"},Bt=Ut(),me=()=>Bt,nt=(t,{token:a,customDomain:e=ot,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=rt(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${Re({token:a,time:n,program_time:r})}`},st=(t,{token:a,customDomain:e=ot,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=rt(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${Re({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},z=t=>{if(t){if([_e.LIVE,_e.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return _e.LIVE}};var $t={crossorigin:"crossOrigin",playsinline:"playsInline"};function dt(t){var a;return(a=$t[t])!=null?a:le(t)}var I,D,T,ue=class{constructor(a,e){p(this,I,void 0);p(this,D,void 0);p(this,T,[]);C(this,I,a),C(this,D,e)}[Symbol.iterator](){return u(this,T).values()}get length(){return u(this,T).length}get value(){var a;return(a=u(this,T).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(C(this,T,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,T)[a]}values(){return u(this,T).values()}keys(){return u(this,T).keys()}forEach(a){u(this,T).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,T).push(r)}),!(this.value===""&&!((e=u(this,I))!=null&&e.hasAttribute(`${u(this,D)}`)))&&((i=u(this,I))==null||i.setAttribute(`${u(this,D)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,T).splice(u(this,T).indexOf(i),1)}),(e=u(this,I))==null||e.setAttribute(`${u(this,D)}`,`${this.value}`)}contains(a){return u(this,T).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};I=new WeakMap,D=new WeakMap,T=new WeakMap;var lt=`[mux-player ${me()}]`;function _(...t){console.warn(lt,...t)}function E(...t){console.error(lt,...t)}function xe(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Yt("Read more: ")}
|
|
2
|
+
https://github.com/muxinc/elements/blob/main/errors/${t.file}`),_(a)}var g={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},V={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},mt=Object.freeze({length:0,start(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Wt=Ft.filter(t=>t!=="error"),Zt=Object.values(g).filter(t=>![g.PLAYSINLINE].includes(t)),Gt=Object.values(V),Me=class extends v.HTMLElement{static get observedAttributes(){return[...Zt,...Gt]}constructor(){super()}init(){Wt.forEach(a=>{var e;(e=this.media)==null||e.addEventListener(a,i=>{this.dispatchEvent(new Event(i.type))})})}attributeChangedCallback(a,e,i){var r,n;switch(a){case V.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case V.VOLUME:{let d=(r=y(i))!=null?r:1;this.media&&(this.media.volume=d);return}case V.PLAYBACKRATE:{let d=(n=y(i))!=null?n:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}load(){var a;(a=this.media)==null||a.load()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:mt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:mt}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentSrc(){var a,e;return(e=(a=this.media)==null?void 0:a.currentSrc)!=null?e:""}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=y(this.getAttribute(V.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(V.PLAYBACKRATE,`${a}`):this.removeAttribute(V.PLAYBACKRATE)}get crossOrigin(){return X(this,g.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(g.CROSSORIGIN,`${a}`)}get autoplay(){return X(this,g.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(g.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(g.AUTOPLAY)}get loop(){return X(this,g.LOOP)!=null}set loop(a){a?this.setAttribute(g.LOOP,""):this.removeAttribute(g.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return X(this,g.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(g.MUTED,""):this.removeAttribute(g.MUTED)}get playsInline(){return X(this,g.PLAYSINLINE)!=null}set playsInline(a){E("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(g.PRELOAD,a):this.removeAttribute(g.PRELOAD)}};function X(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Le=Me;import"media-chrome/dist/media-theme-element.js";var ct=`:host {
|
|
3
3
|
--media-control-display: var(--controls);
|
|
4
4
|
--media-loading-indicator-display: var(--loading-indicator);
|
|
5
5
|
--media-dialog-display: var(--dialog);
|
|
@@ -150,181 +150,76 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
150
150
|
:host([no-tooltips]) {
|
|
151
151
|
--media-tooltip-display: none;
|
|
152
152
|
}
|
|
153
|
-
`;var
|
|
154
|
-
:host {
|
|
155
|
-
z-index: 100;
|
|
156
|
-
display: var(--media-dialog-display, flex);
|
|
157
|
-
justify-content: center;
|
|
158
|
-
align-items: center;
|
|
159
|
-
width: 100%;
|
|
160
|
-
height: 100%;
|
|
161
|
-
position: absolute;
|
|
162
|
-
top: 0;
|
|
163
|
-
left: 0;
|
|
164
|
-
box-sizing: border-box;
|
|
165
|
-
color: #fff;
|
|
166
|
-
line-height: 18px;
|
|
167
|
-
font-family: Arial, sans-serif;
|
|
168
|
-
padding: var(--media-dialog-backdrop-padding, 0);
|
|
169
|
-
background: var(--media-dialog-backdrop-background,
|
|
170
|
-
linear-gradient(to bottom, rgba(20, 20, 30, 0.7) 50%, rgba(20, 20, 30, 0.9))
|
|
171
|
-
);
|
|
172
|
-
/* Needs to use !important to prevent overwrite of media-chrome */
|
|
173
|
-
transition: var(--media-dialog-transition-open, visibility .2s, opacity .2s) !important;
|
|
174
|
-
transform: var(--media-dialog-transform-open, none) !important;
|
|
175
|
-
visibility: visible !important;
|
|
176
|
-
opacity: 1 !important;
|
|
177
|
-
pointer-events: auto !important;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
:host(:not([open])) {
|
|
181
|
-
/* Needs to use !important to prevent overwrite of media-chrome */
|
|
182
|
-
transition: var(--media-dialog-transition-close, visibility .1s, opacity .1s) !important;
|
|
183
|
-
transform: var(--media-dialog-transform-close, none) !important;
|
|
184
|
-
visibility: hidden !important;
|
|
185
|
-
opacity: 0 !important;
|
|
186
|
-
pointer-events: none !important;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
:focus-visible {
|
|
190
|
-
box-shadow: 0 0 0 2px rgba(27, 127, 204, 0.9);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.dialog {
|
|
194
|
-
position: relative;
|
|
195
|
-
box-sizing: border-box;
|
|
196
|
-
background: var(--media-dialog-background, none);
|
|
197
|
-
padding: var(--media-dialog-padding, 10px);
|
|
198
|
-
width: min(320px, 100%);
|
|
199
|
-
word-wrap: break-word;
|
|
200
|
-
max-height: 100%;
|
|
201
|
-
overflow: auto;
|
|
202
|
-
text-align: center;
|
|
203
|
-
line-height: 1.4;
|
|
204
|
-
}
|
|
205
|
-
`,kt=C.createElement("template");kt.innerHTML=`
|
|
153
|
+
`;import{TemplateInstance as qt,ChildNodePart as pe,AttrPart as be}from"media-chrome/dist/media-theme-element.js";var J=new WeakMap,Se=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=J.get(this.element);i&&i.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let e=J.get(this.element);e&&e.delete(this.type)}}static for(a){J.has(a.element)||J.set(a.element,new Map);let e=a.attributeName.slice(2),i=J.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function zt(t,a){return t instanceof be&&t.attributeName.startsWith("on")?(Se.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function Xt(t,a){return a instanceof ce&&t instanceof pe?(a.renderInto(t),!0):!1}function Jt(t,a){return a instanceof DocumentFragment&&t instanceof pe?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Qt(t,a){if(t instanceof be){let e=t.attributeNamespace,i=t.element.getAttributeNS(e,t.attributeName);return String(a)!==i&&(t.value=String(a)),!0}return t.value=String(a),!0}function ea(t,a){if(t instanceof be&&a instanceof Element){let e=t.element;return e[t.attributeName]!==a&&(t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),e[t.attributeName]=a),!0}return!1}function ta(t,a){if(typeof a=="boolean"&&t instanceof be){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function aa(t,a){return a===!1&&t instanceof pe?(t.replace(""),!0):!1}function ia(t,a){ea(t,a)||ta(t,a)||zt(t,a)||aa(t,a)||Xt(t,a)||Jt(t,a)||Qt(t,a)}var Ne=new Map,pt=new WeakMap,bt=new WeakMap,ce=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(Ne.has(this.stringsKey))return Ne.get(this.stringsKey);{let a=F.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<e?`{{ ${n} }}`:""),""),Ne.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(pt.get(a)!==e){pt.set(a,e);let n=new qt(e,this.values,this.processor);bt.set(a,n),a instanceof pe?a.replace(...n.children):a.appendChild(n);return}let i=bt.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},ra={processCallback(t,a,e){var i;if(e){for(let[r,n]of a)if(r in e){let d=(i=e[r])!=null?i:"";ia(n,d)}}}};function Q(t,...a){return new ce(t,a,ra)}function ht(t,a){t.renderInto(a)}import{StreamTypes as oa,toMuxVideoURL as ft}from"@mux/playback-core";var na=t=>{let{tokens:a}=t;return a.drm?":host { --_cast-button-drm-display: none; }":""},gt=t=>Q`
|
|
206
154
|
<style>
|
|
207
|
-
${
|
|
155
|
+
${na(t)}
|
|
156
|
+
${ct}
|
|
208
157
|
</style>
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<slot></slot>
|
|
212
|
-
</div>
|
|
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})),oa(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 oa(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
|
-
<style>
|
|
215
|
-
${we.styles}
|
|
216
|
-
|
|
217
|
-
.close {
|
|
218
|
-
background: none;
|
|
219
|
-
color: inherit;
|
|
220
|
-
border: none;
|
|
221
|
-
padding: 0;
|
|
222
|
-
font: inherit;
|
|
223
|
-
cursor: pointer;
|
|
224
|
-
outline: inherit;
|
|
225
|
-
width: 28px;
|
|
226
|
-
height: 28px;
|
|
227
|
-
position: absolute;
|
|
228
|
-
top: 1rem;
|
|
229
|
-
right: 1rem;
|
|
230
|
-
}
|
|
231
|
-
</style>
|
|
232
|
-
|
|
233
|
-
<div class="dialog">
|
|
234
|
-
<slot></slot>
|
|
235
|
-
</div>
|
|
236
|
-
|
|
237
|
-
<slot name="close">
|
|
238
|
-
<button class="close" tabindex="0">
|
|
239
|
-
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
240
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
241
|
-
</svg>
|
|
242
|
-
</button>
|
|
243
|
-
</slot>
|
|
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 na,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 sa(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 da(t,a){return a instanceof pe&&t instanceof be?(a.renderInto(t),!0):!1}function la(t,a){return a instanceof DocumentFragment&&t instanceof be?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function ua(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 ma(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 ca(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 pa(t,a){return a===!1&&t instanceof be?(t.replace(""),!0):!1}function ba(t,a){ma(t,a)||ca(t,a)||sa(t,a)||pa(t,a)||da(t,a)||la(t,a)||ua(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 na(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)}},ha={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:"";ba(o,d)}}}};function S(t,...a){return new pe(t,a,ha)}function Lt(t,a){t.renderInto(a)}import{i18n as ga,StreamTypes as fa,toMuxVideoURL as Mt}from"@mux/playback-core";var ya=t=>{let{tokens:a}=t;return a.drm?":host { --_cast-button-drm-display: none; }":""},St=t=>S`
|
|
245
|
-
<style>
|
|
246
|
-
${ya(t)}
|
|
247
|
-
${Et}
|
|
248
|
-
</style>
|
|
249
|
-
${Aa(t)}
|
|
250
|
-
`,va=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return Q(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},Ta={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"},Ea=Object.values(Ta).join(", "),Aa=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`
|
|
158
|
+
${ua(t)}
|
|
159
|
+
`,sa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return z(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},da={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",LISTBOX:"listbox",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},la=Object.values(da).join(", "),ua=t=>{var a,e,i,r,n,d,l,c,R,W,k,A,O,$,h,se,Z,G,Ue,Be,$e,Ye,Fe,We,Ze,Ge,je,qe,ze,Xe,Je,Qe,et;return Q`
|
|
251
160
|
<media-theme
|
|
252
161
|
template="${t.themeTemplate||!1}"
|
|
253
162
|
defaultstreamtype="${(a=t.defaultStreamType)!=null?a:!1}"
|
|
254
|
-
hotkeys="${
|
|
255
|
-
nohotkeys="${t.noHotKeys||!t.hasSrc
|
|
256
|
-
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(
|
|
163
|
+
hotkeys="${sa(t)||!1}"
|
|
164
|
+
nohotkeys="${t.noHotKeys||!t.hasSrc||!1}"
|
|
165
|
+
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(oa.LIVE))&&t.targetLiveWindow!==0}"
|
|
257
166
|
novolumepref="${t.novolumepref||!1}"
|
|
258
167
|
disabled="${!t.hasSrc||t.isDialogOpen}"
|
|
259
168
|
audio="${(i=t.audio)!=null?i:!1}"
|
|
260
|
-
style="${(r=
|
|
169
|
+
style="${(r=it({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
|
|
261
170
|
defaultsubtitles="${!t.defaultHiddenCaptions}"
|
|
262
|
-
forwardseekoffset="${(
|
|
171
|
+
forwardseekoffset="${(n=t.forwardSeekOffset)!=null?n:!1}"
|
|
263
172
|
backwardseekoffset="${(d=t.backwardSeekOffset)!=null?d:!1}"
|
|
264
173
|
playbackrates="${(l=t.playbackRates)!=null?l:!1}"
|
|
265
174
|
defaultshowremainingtime="${(c=t.defaultShowRemainingTime)!=null?c:!1}"
|
|
266
|
-
defaultduration="${(
|
|
267
|
-
hideduration="${(
|
|
175
|
+
defaultduration="${(R=t.defaultDuration)!=null?R:!1}"
|
|
176
|
+
hideduration="${(W=t.hideDuration)!=null?W:!1}"
|
|
268
177
|
title="${(k=t.title)!=null?k:!1}"
|
|
269
|
-
exportparts="${
|
|
178
|
+
exportparts="${la}"
|
|
179
|
+
onclose="${t.onCloseErrorDialog}"
|
|
180
|
+
onfocusin="${t.onFocusInErrorDialog}"
|
|
270
181
|
>
|
|
271
182
|
<mux-video
|
|
272
183
|
slot="media"
|
|
273
184
|
target-live-window="${(A=t.targetLiveWindow)!=null?A:!1}"
|
|
274
|
-
stream-type="${(
|
|
275
|
-
crossorigin="${(
|
|
185
|
+
stream-type="${(O=z(t.streamType))!=null?O:!1}"
|
|
186
|
+
crossorigin="${($=t.crossOrigin)!=null?$:""}"
|
|
276
187
|
playsinline
|
|
277
|
-
autoplay="${(
|
|
278
|
-
muted="${(
|
|
279
|
-
loop="${(
|
|
280
|
-
preload="${(
|
|
281
|
-
debug="${(
|
|
282
|
-
prefer-cmcd="${(
|
|
283
|
-
disable-tracking="${(
|
|
284
|
-
disable-cookies="${(
|
|
285
|
-
prefer-playback="${(
|
|
188
|
+
autoplay="${(h=t.autoplay)!=null?h:!1}"
|
|
189
|
+
muted="${(se=t.muted)!=null?se:!1}"
|
|
190
|
+
loop="${(Z=t.loop)!=null?Z:!1}"
|
|
191
|
+
preload="${(G=t.preload)!=null?G:!1}"
|
|
192
|
+
debug="${(Ue=t.debug)!=null?Ue:!1}"
|
|
193
|
+
prefer-cmcd="${(Be=t.preferCmcd)!=null?Be:!1}"
|
|
194
|
+
disable-tracking="${($e=t.disableTracking)!=null?$e:!1}"
|
|
195
|
+
disable-cookies="${(Ye=t.disableCookies)!=null?Ye:!1}"
|
|
196
|
+
prefer-playback="${(Fe=t.preferPlayback)!=null?Fe:!1}"
|
|
286
197
|
start-time="${t.startTime!=null?t.startTime:!1}"
|
|
287
|
-
beacon-collection-domain="${(
|
|
288
|
-
player-
|
|
289
|
-
player-software-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
cast-
|
|
295
|
-
|
|
198
|
+
beacon-collection-domain="${(We=t.beaconCollectionDomain)!=null?We:!1}"
|
|
199
|
+
player-init-time="${(Ze=t.playerInitTime)!=null?Ze:!1}"
|
|
200
|
+
player-software-name="${(Ge=t.playerSoftwareName)!=null?Ge:!1}"
|
|
201
|
+
player-software-version="${(je=t.playerSoftwareVersion)!=null?je:!1}"
|
|
202
|
+
env-key="${(qe=t.envKey)!=null?qe:!1}"
|
|
203
|
+
custom-domain="${(ze=t.customDomain)!=null?ze:!1}"
|
|
204
|
+
src="${t.src?t.src:t.playbackId?ft(t):!1}"
|
|
205
|
+
cast-src="${t.src?t.src:t.playbackId?ft(t):!1}"
|
|
206
|
+
cast-receiver="${(Xe=t.castReceiver)!=null?Xe:!1}"
|
|
207
|
+
drm-token="${(Qe=(Je=t.tokens)==null?void 0:Je.drm)!=null?Qe:!1}"
|
|
296
208
|
exportparts="video"
|
|
297
209
|
>
|
|
298
|
-
${t.storyboard?
|
|
210
|
+
${t.storyboard?Q`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:Q``}
|
|
211
|
+
<slot></slot>
|
|
299
212
|
</mux-video>
|
|
300
213
|
<slot name="poster" slot="poster">
|
|
301
214
|
<media-poster-image
|
|
302
215
|
part="poster"
|
|
303
216
|
exportparts="poster, img"
|
|
304
217
|
src="${t.poster?t.poster:!1}"
|
|
305
|
-
placeholdersrc="${(
|
|
218
|
+
placeholdersrc="${(et=t.placeholder)!=null?et:!1}"
|
|
306
219
|
></media-poster-image>
|
|
307
220
|
</slot>
|
|
308
|
-
<mxp-dialog
|
|
309
|
-
no-auto-hide
|
|
310
|
-
open="${(it=t.isDialogOpen)!=null?it:!1}"
|
|
311
|
-
onclose="${t.onCloseErrorDialog}"
|
|
312
|
-
oninitfocus="${t.onInitFocusDialog}"
|
|
313
|
-
>
|
|
314
|
-
${(rt=t.dialog)!=null&&rt.title?S`<h3>${t.dialog.title}</h3>`:S``}
|
|
315
|
-
<p>
|
|
316
|
-
${(ot=t.dialog)==null?void 0:ot.message}
|
|
317
|
-
${(nt=t.dialog)!=null&&nt.linkUrl?S`<a
|
|
318
|
-
href="${t.dialog.linkUrl}"
|
|
319
|
-
target="_blank"
|
|
320
|
-
rel="external noopener"
|
|
321
|
-
aria-label="${(st=t.dialog.linkText)!=null?st:""} ${ga("(opens in a new window)")}"
|
|
322
|
-
>${(dt=t.dialog.linkText)!=null?dt:t.dialog.linkUrl}</a
|
|
323
|
-
>`:S``}
|
|
324
|
-
</p>
|
|
325
|
-
</mxp-dialog>
|
|
326
221
|
</media-theme>
|
|
327
|
-
`};import{errorCategoryToTokenNameOrPrefix as
|
|
222
|
+
`};import{errorCategoryToTokenNameOrPrefix as yt,i18n as f,MediaError as L,MuxErrorCategory as Tt,MuxErrorCode as m}from"@mux/playback-core";var vt=t=>t.charAt(0).toUpperCase()+t.slice(1),ma=(t,a=!1)=>{var e,i;if(t.muxCode){let r=vt((e=t.errorCategory)!=null?e:"video"),n=yt((i=t.errorCategory)!=null?i:Tt.VIDEO);if(t.muxCode===m.NETWORK_OFFLINE)return f("Your device appears to be offline",a);if(t.muxCode===m.NETWORK_TOKEN_EXPIRED)return f("{category} URL has expired",a).format({category:r});if([m.NETWORK_TOKEN_SUB_MISMATCH,m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING,m.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return f("{category} URL is formatted incorrectly",a).format({category:r});if(t.muxCode===m.NETWORK_TOKEN_MISSING)return f("Invalid {categoryName} URL",a).format({categoryName:n});if(t.muxCode===m.NETWORK_NOT_FOUND)return f("{category} does not exist",a).format({category:r});if(t.muxCode===m.NETWORK_NOT_READY)return f("{category} is not currently available",a).format({category:r})}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return f("Network Error",a);if(t.code===L.MEDIA_ERR_DECODE)return f("Media Error",a);if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return f("Source Not Supported",a)}return f("Error",a)},ca=(t,a=!1)=>{var e,i;if(t.muxCode){let r=vt((e=t.errorCategory)!=null?e:"video"),n=yt((i=t.errorCategory)!=null?i:Tt.VIDEO);return t.muxCode===m.NETWORK_OFFLINE?f("Check your internet connection and try reloading this video.",a):t.muxCode===m.NETWORK_TOKEN_EXPIRED?f("The video\u2019s secured {tokenNamePrefix}-token has expired.",a).format({tokenNamePrefix:n}):t.muxCode===m.NETWORK_TOKEN_SUB_MISMATCH?f("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",a).format({tokenNamePrefix:n}):t.muxCode===m.NETWORK_TOKEN_MALFORMED?f("{category} URL is formatted incorrectly",a).format({category:r}):[m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?f("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:n}):[m.NETWORK_TOKEN_MISSING,m.NETWORK_INVALID_URL].includes(t.muxCode)?f("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",a).format({tokenNamePrefix:n}):t.muxCode===m.NETWORK_NOT_FOUND?"":t.muxCode===m.NETWORK_NOT_READY?f("The live stream or video file are not yet ready.",a):t.message}return t.code&&(t.code===L.MEDIA_ERR_NETWORK||t.code===L.MEDIA_ERR_DECODE||t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},Et=(t,a=!1)=>{let e=ma(t,a),i=ca(t,a);return{title:e,message:i}},pa=t=>{if(t.muxCode){if(t.muxCode===m.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===m.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([m.NETWORK_TOKEN_AUD_MISMATCH,m.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===m.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===m.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===m.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===m.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return"";if(t.code===L.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},we=(t,a)=>{let e=pa(t);return{message:t.message,context:t.context,file:e}};var At=`<template id="media-theme-gerwig">
|
|
328
223
|
<style>
|
|
329
224
|
@keyframes pre-play-hide {
|
|
330
225
|
0% {
|
|
@@ -1235,6 +1130,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1235
1130
|
<slot name="poster" slot="poster"></slot>
|
|
1236
1131
|
|
|
1237
1132
|
<media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
|
|
1133
|
+
<media-error-dialog slot="dialog" noautohide></media-error-dialog>
|
|
1238
1134
|
|
|
1239
1135
|
<template if="!audio">
|
|
1240
1136
|
<!-- Pre-playback UI -->
|
|
@@ -1330,5 +1226,17 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1330
1226
|
<slot></slot>
|
|
1331
1227
|
</media-controller>
|
|
1332
1228
|
</template>
|
|
1333
|
-
`;import{MediaThemeElement as La}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 La{};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 Pa="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 Ia(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:Da(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:Va(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 Da(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 Va(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 Ha=Object.values(s),Ka=Object.values(w),Ua=Object.values(n),Ba=ce(),$a="mux-player",Bt={dialog:void 0,isDialogOpen:!1},Fa={redundant_streams:!0},re,oe,V,ne,F,M,D,ve,$t,se,$e,P,$,Te,Ft,Ee,Yt,Ae,Wt,Ce,Zt,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,{...Bt,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,$t).call(this),this.isConnected&&h(this,M,D).call(this)}static get observedAttributes(){var e;return[...(e=Ne.observedAttributes)!=null?e:[],...Ka,...Ha,...Ua]}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),...Bt}),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:Pa}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:$a}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:Ba}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 Na(d,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return wa(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 Sa))throw""}catch{E("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ma))throw""}catch{E("<media-controller> failed to upgrade!")}this.init(),h(this,Te,Ft).call(this),h(this,Ee,Yt).call(this),h(this,Ae,Wt).call(this),R(this,V,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(He.USER_INACTIVE))!=null?i:!0),h(this,Ce,Zt).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,$t=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(Ia(this,{...u(this,F),...e})),this.shadowRoot)},Te=new WeakSet,Ft=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,Yt=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,Wt=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,Zt=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
|
-
|
|
1229
|
+
`;import{MediaThemeElement as ha}from"media-chrome/dist/media-theme-element.js";import"media-chrome/menu";var Pe=F.createElement("template");"innerHTML"in Pe&&(Pe.innerHTML=At);var Ct,kt,he=class extends ha{};he.template=(kt=(Ct=Pe.content)==null?void 0:Ct.children)==null?void 0:kt[0];v.customElements.get("media-theme-gerwig")||v.customElements.define("media-theme-gerwig",he);var Ea="gerwig";var N={SRC:"src",POSTER:"poster"},o={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips"},Ke=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function Aa(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src||!!t.currentSrc,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(o.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:ka(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(o.NOHOTKEYS),hotKeys:t.getAttribute(o.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableTracking:t.disableTracking,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,minResolution:t.minResolution,programStartTime:t.programStartTime,programEndTime:t.programEndTime,assetStartTime:t.assetStartTime,assetEndTime:t.assetEndTime,renditionOrder:t.renditionOrder,metadata:t.metadata,playerInitTime:t.playerInitTime,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(s.TARGET_LIVE_WINDOW),streamType:z(t.getAttribute(s.STREAM_TYPE)),primaryColor:t.getAttribute(o.PRIMARY_COLOR),secondaryColor:t.getAttribute(o.SECONDARY_COLOR),accentColor:t.getAttribute(o.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:Ra(t),playbackRates:t.getAttribute(o.PLAYBACK_RATES),customDomain:(i=t.getAttribute(s.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(o.TITLE),novolumepref:t.hasAttribute(o.NO_VOLUME_PREF),castReceiver:t.castReceiver,...a,extraSourceParams:t.extraSourceParams}}var Ca=Nt.formatErrorMessage;Nt.formatErrorMessage=t=>{var a,e;if(t instanceof ee){let i=Et(t,!1);return`
|
|
1230
|
+
${i!=null&&i.title?`<h3>${i.title}</h3>`:""}
|
|
1231
|
+
${i!=null&&i.message||i!=null&&i.linkUrl?`<p>
|
|
1232
|
+
${i==null?void 0:i.message}
|
|
1233
|
+
${i!=null&&i.linkUrl?`<a
|
|
1234
|
+
href="${i.linkUrl}"
|
|
1235
|
+
target="_blank"
|
|
1236
|
+
rel="external noopener"
|
|
1237
|
+
aria-label="${(a=i.linkText)!=null?a:""} ${H("(opens in a new window)")}"
|
|
1238
|
+
>${(e=i.linkText)!=null?e:i.linkUrl}</a
|
|
1239
|
+
>`:""}
|
|
1240
|
+
</p>`:""}
|
|
1241
|
+
`}return Ca(t)};function ka(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let n=v.customElements.get(a);if(n!=null&&n.template)return n.template}}function Ra(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function _t(t){let a=t.hasAttribute(o.TITLE)?{video_title:t.getAttribute(o.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var Oa=Object.values(s),_a=Object.values(N),xa=Object.values(o),xt=me(),Mt="mux-player",Lt={isDialogOpen:!1},Ma={redundant_streams:!0},ae,ie,re,P,oe,B,M,w,ge,St,ne,He,S,U,ye,wt,Te,Pt,ve,It,Ee,Dt,te=class extends Le{constructor(){super();p(this,M);p(this,ge);p(this,ne);p(this,S);p(this,ye);p(this,Te);p(this,ve);p(this,Ee);p(this,ae,void 0);p(this,ie,!1);p(this,re,{});p(this,P,!0);p(this,oe,new ue(this,"hotkeys"));p(this,B,{...Lt,onCloseErrorDialog:e=>{var r;((r=e.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&b(this,ne,He).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var n;if(((n=e.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;Oe(this,F.activeElement)||e.preventDefault()}});C(this,ae,va()),this.attachShadow({mode:"open"}),b(this,ge,St).call(this),this.isConnected&&b(this,M,w).call(this)}static get NAME(){return Mt}static get VERSION(){return xt}static get observedAttributes(){var e;return[...(e=Le.observedAttributes)!=null?e:[],..._a,...Oa,...xa]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){var i;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=_t(this))}attributeChangedCallback(e,i,r){switch(b(this,M,w).call(this),super.attributeChangedCallback(e,i,r),e){case o.HOTKEYS:u(this,oe).value=r;break;case o.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&_(H("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case o.THUMBNAIL_TOKEN:{if(r){let d=De(r);if(d){let{aud:l}=d,c=Ve.THUMBNAIL;l!==c&&_(H("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"thumbnail"}))}}break}case o.STORYBOARD_TOKEN:{if(r){let d=De(r);if(d){let{aud:l}=d,c=Ve.STORYBOARD;l!==c&&_(H("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"storyboard"}))}}break}case o.DRM_TOKEN:{if(r){let d=De(r);if(d){let{aud:l}=d,c=Ve.DRM;l!==c&&_(H("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:c,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&E(H("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:r&&![x.LIVE,x.ON_DEMAND,x.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:xe({file:"invalid-stream-type.md",message:H("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===x.LIVE?this.getAttribute(o.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[s.PLAYBACK_ID,N.SRC,o.PLAYBACK_TOKEN].includes(e)&&i!==r&&C(this,B,{...u(this,B),...Lt}),b(this,S,U).call(this,{[dt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ot.includes(e)?this.setAttribute(s.PREFER_CMCD,e):_(`Invalid value for preferCmcd. Must be one of ${Ot.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Rt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Rt.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(o.THEME))!=null?e:Ea}set theme(e){this.setAttribute(o.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Ke.includes(r))continue;let n=e.getAttribute(r);i[le(r)]=n===""?!0:n}return i}set themeProps(e){var r,n;b(this,M,w).call(this);let i={...this.themeProps,...e};for(let d in i){if(Ke.includes(d))continue;let l=e==null?void 0:e[d];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(de(d),!!l):(n=this.mediaTheme)==null||n.setAttribute(de(d),l)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=K(this,N.SRC))!=null?e:void 0:(i=this.getAttribute(N.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(N.SRC,e):this.removeAttribute(N.SRC)}get poster(){var r;let e=this.getAttribute(N.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){_("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return nt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(N.POSTER,e):this.removeAttribute(N.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(o.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(o.STORYBOARD_SRC,e):this.removeAttribute(o.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[x.LIVE,x.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return st(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(o.AUDIO)}set audio(e){if(!e){this.removeAttribute(o.AUDIO);return}this.setAttribute(o.AUDIO,"")}get hotkeys(){return u(this,oe)}get nohotkeys(){return this.hasAttribute(o.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(o.NOHOTKEYS);return}this.setAttribute(o.NOHOTKEYS,"")}get thumbnailTime(){return y(this.getAttribute(o.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(o.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(o.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(o.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=K(this,o.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(o.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(o.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=v.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(o.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(o.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=v.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(o.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(o.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=v.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(o.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(o.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(o.PLAYBACK_RATES))return this.getAttribute(o.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(o.PLAYBACK_RATES);return}this.setAttribute(o.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=y(this.getAttribute(o.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(o.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=y(this.getAttribute(o.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(o.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(o.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return y(this.getAttribute(o.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(o.DEFAULT_DURATION):this.setAttribute(o.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(s.PLAYER_INIT_TIME)?y(this.getAttribute(s.PLAYER_INIT_TIME)):u(this,ae)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(s.PLAYER_INIT_TIME):this.setAttribute(s.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_NAME))!=null?e:Mt}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:xt}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return y(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return y(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return y(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return y(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(o.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(o.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Ma}set extraSourceParams(e){e==null?this.removeAttribute(o.EXTRA_SOURCE_PARAMS):this.setAttribute(o.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=K(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(o.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(o.NO_VOLUME_PREF,""):this.removeAttribute(o.NO_VOLUME_PREF)}get debug(){return K(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return K(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return K(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:x.UNKNOWN}set streamType(e){this.setAttribute(s.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?r:x.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(o.DEFAULT_STREAM_TYPE,e):this.removeAttribute(o.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return y(K(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.PREFER_PLAYBACK);if(e===fe.MSE||e===fe.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===fe.MSE||e===fe.NATIVE?this.setAttribute(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={..._t(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(i=this.media)==null?void 0:i.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,i;return(i=(e=this.media)==null?void 0:e.cuePoints)!=null?i:[]}addChapters(e){var i;if(b(this,M,w).call(this),!this.media){E("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(o.PLAYBACK_TOKEN),i=this.getAttribute(o.DRM_TOKEN),r=this.getAttribute(o.THUMBNAIL_TOKEN),n=this.getAttribute(o.STORYBOARD_TOKEN);return{...u(this,re),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...n!=null?{storyboard:n}:{}}}set tokens(e){C(this,re,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(o.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(o.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(o.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(o.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(o.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(o.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(o.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(o.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,n){var l;let d=(l=this.media)==null?void 0:l.nativeEl;if(d)return ya(d,e,i,r,n)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return Ta(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(o.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(o.CAST_RECEIVER,e):this.removeAttribute(o.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){E("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(o.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(o.NO_TOOLTIPS);return}this.setAttribute(o.NO_TOOLTIPS,"")}};ae=new WeakMap,ie=new WeakMap,re=new WeakMap,P=new WeakMap,oe=new WeakMap,B=new WeakMap,M=new WeakSet,w=function(){var e,i,r,n;if(!u(this,ie)){C(this,ie,!0),b(this,S,U).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof v.HTMLElement))throw""}catch{E("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ga))throw""}catch{E("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof fa))throw""}catch{E("<media-controller> failed to upgrade!")}this.init(),b(this,ye,wt).call(this),b(this,Te,Pt).call(this),b(this,ve,It).call(this),C(this,P,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Ie.USER_INACTIVE))!=null?i:!0),b(this,Ee,Dt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>b(this,S,U).call(this)),(n=this.media)==null||n.addEventListener("loadstart",()=>b(this,S,U).call(this))}},ge=new WeakSet,St=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},ne=new WeakSet,He=function(e){Object.assign(u(this,B),e),b(this,S,U).call(this)},S=new WeakSet,U=function(e={}){ht(gt(Aa(this,{...u(this,B),...e})),this.shadowRoot)},ye=new WeakSet,wt=function(){let e=r=>{var l,c;if(!(r!=null&&r.startsWith("theme-")))return;let n=r.replace(/^theme-/,"");if(Ke.includes(n))return;let d=this.getAttribute(r);d!=null?(l=this.mediaTheme)==null||l.setAttribute(n,d):(c=this.mediaTheme)==null||c.removeAttribute(n)};new MutationObserver(r=>{for(let{attributeName:n}of r)e(n)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Te=new WeakSet,Pt=function(){var i;let e=r=>{let{detail:n}=r;if(n instanceof ee||(n=new ee(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){_(n),n.data&&_(`${n.name} data:`,n.data);return}let d=we(n,!1);d.message&&xe(d),E(n),n.data&&E(`${n.name} data:`,n.data),b(this,ne,He).call(this,{isDialogOpen:!0})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var d,l,c;if(!(((d=this.media)==null?void 0:d.error)instanceof ee))return r;let n=we((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(c=this.media)==null?void 0:c.error.code,player_error_message:n.message?String(n.message):r.player_error_message,player_error_context:n.context?String(n.context):r.player_error_context}}),(i=this.media)==null||i.addEventListener("error",r=>{var d,l;let{detail:n}=r;if(!n){let{message:c,code:R}=(l=(d=this.media)==null?void 0:d.error)!=null?l:{};n=new ee(c,R)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},ve=new WeakSet,It=function(){var i,r,n,d;let e=()=>b(this,S,U).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(d=(n=this.media)==null?void 0:n.textTracks)==null||d.addEventListener("removetrack",e)},Ee=new WeakSet,Dt=function(){var R,W;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,n=()=>this.streamType===x.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(k,A,O=!1)=>{if(n())return;Array.from(k&&k.activeCues||[]).forEach(h=>{if(!(!h.snapToLines||h.line<-5||h.line>=0&&h.line<10))if(!A||this.paused){let se=h.text.split(`
|
|
1242
|
+
`).length,Z=-3;this.streamType===x.LIVE&&(Z=-2);let G=Z-se;if(h.line===G&&!O)return;r.has(h)||r.set(h,h.line),h.line=G}else setTimeout(()=>{h.line=r.get(h)||"auto"},500)})},l=()=>{var k,A;d(i,(A=(k=this.mediaController)==null?void 0:k.hasAttribute(Ie.USER_INACTIVE))!=null?A:!1)},c=()=>{var O,$;let A=Array.from((($=(O=this.mediaController)==null?void 0:O.media)==null?void 0:$.textTracks)||[]).filter(h=>["subtitles","captions"].includes(h.kind)&&h.mode==="showing")[0];A!==i&&(i==null||i.removeEventListener("cuechange",l)),i=A,i==null||i.addEventListener("cuechange",l),d(i,u(this,P))};c(),(R=this.textTracks)==null||R.addEventListener("change",c),(W=this.textTracks)==null||W.addEventListener("addtrack",c),this.addEventListener("userinactivechange",()=>{var A,O;let k=(O=(A=this.mediaController)==null?void 0:A.hasAttribute(Ie.USER_INACTIVE))!=null?O:!0;u(this,P)!==k&&(C(this,P,k),d(i,u(this,P)))})};function K(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}v.customElements.get("mux-player")||(v.customElements.define("mux-player",te),v.MuxPlayerElement=te);var Ri=te;export{ee as MediaError,Ri as default,va as generatePlayerInitTime,K as getVideoAttribute,Mt as playerSoftwareName,xt as playerSoftwareVersion};
|