@mux/mux-player 1.5.1 → 1.6.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 +3 -3
- package/dist/index.mjs +10 -10
- package/dist/mux-player.js +150 -149
- package/dist/mux-player.mjs +150 -149
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/helpers.d.ts +3 -3
- package/dist/types/index.d.ts +10 -2
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/video-api.d.ts +3 -3
- package/dist/types-ts3.4/helpers.d.ts +3 -3
- package/dist/types-ts3.4/index.d.ts +9 -2
- package/dist/types-ts3.4/utils.d.ts +1 -1
- package/dist/types-ts3.4/video-api.d.ts +3 -3
- package/package.json +8 -8
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var co=Object.create;var Dt=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var ho=Object.getOwnPropertyNames;var po=Object.getPrototypeOf,bo=Object.prototype.hasOwnProperty;var Eo=(i,e)=>{for(var t in e)Dt(i,t,{get:e[t],enumerable:!0})},tr=(i,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ho(e))!bo.call(i,r)&&r!==t&&Dt(i,r,{get:()=>e[r],enumerable:!(a=mo(e,r))||a.enumerable});return i};var fo=(i,e,t)=>(t=i!=null?co(po(i)):{},tr(e||!i||!i.__esModule?Dt(t,"default",{value:i,enumerable:!0}):t,i)),vo=i=>tr(Dt({},"__esModule",{value:!0}),i);var Di=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var v=(i,e,t)=>(Di(i,e,"read from private field"),t?t.call(i):e.get(i)),I=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},V=(i,e,t,a)=>(Di(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t);var S=(i,e,t)=>(Di(i,e,"access private method"),t);var Il={};Eo(Il,{MediaError:()=>g.MediaError,default:()=>Tl,getVideoAttribute:()=>ge});module.exports=vo(Il);var Pe=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends Pe{}globalThis.DocumentFragment=i}var Je=class extends Pe{},xi=class extends Pe{},go={get(i){},define(i,e,t){},upgrade(i){},whenDefined(i){return Promise.resolve(Je)}},et,Ri=class{constructor(e,t={}){I(this,et,void 0);V(this,et,t==null?void 0:t.detail)}get detail(){return v(this,et)}initCustomEvent(){}};et=new WeakMap;function Ao(i,e){return new Je}var ir={document:{createElement:Ao},DocumentFragment,customElements:go,CustomEvent:Ri,EventTarget:Pe,HTMLElement:Je,HTMLVideoElement:xi},ar=typeof window=="undefined"||typeof globalThis.customElements=="undefined",D=ar?ir:globalThis,H=ar?ir.document:globalThis.document;var p={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},tt={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_CAPTIONS_LIST:"mediacaptionslistchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_CAPTIONS_SHOWING:"mediacaptionsshowingchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",USER_INACTIVE:"userinactivechange"},A={MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller"},o={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"media-fullscreen-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_CAST_UNAVAILABLE:"media-cast-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_IS_CASTING:"media-is-casting",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_SEEKABLE:"media-seekable",MEDIA_PREVIEW_TIME:"media-preview-time",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_LOADING:"media-loading",MEDIA_BUFFERED:"media-buffered",MEDIA_STREAM_TYPE:"media-stream-type"},
|
|
1
|
+
"use strict";var co=Object.create;var Dt=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var ho=Object.getOwnPropertyNames;var po=Object.getPrototypeOf,bo=Object.prototype.hasOwnProperty;var Eo=(i,e)=>{for(var t in e)Dt(i,t,{get:e[t],enumerable:!0})},tr=(i,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ho(e))!bo.call(i,r)&&r!==t&&Dt(i,r,{get:()=>e[r],enumerable:!(a=mo(e,r))||a.enumerable});return i};var fo=(i,e,t)=>(t=i!=null?co(po(i)):{},tr(e||!i||!i.__esModule?Dt(t,"default",{value:i,enumerable:!0}):t,i)),vo=i=>tr(Dt({},"__esModule",{value:!0}),i);var Di=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var v=(i,e,t)=>(Di(i,e,"read from private field"),t?t.call(i):e.get(i)),I=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},V=(i,e,t,a)=>(Di(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t);var S=(i,e,t)=>(Di(i,e,"access private method"),t);var Il={};Eo(Il,{MediaError:()=>g.MediaError,default:()=>Tl,getVideoAttribute:()=>ge});module.exports=vo(Il);var Pe=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends Pe{}globalThis.DocumentFragment=i}var Je=class extends Pe{},xi=class extends Pe{},go={get(i){},define(i,e,t){},upgrade(i){},whenDefined(i){return Promise.resolve(Je)}},et,Ri=class{constructor(e,t={}){I(this,et,void 0);V(this,et,t==null?void 0:t.detail)}get detail(){return v(this,et)}initCustomEvent(){}};et=new WeakMap;function Ao(i,e){return new Je}var ir={document:{createElement:Ao},DocumentFragment,customElements:go,CustomEvent:Ri,EventTarget:Pe,HTMLElement:Je,HTMLVideoElement:xi},ar=typeof window=="undefined"||typeof globalThis.customElements=="undefined",D=ar?ir:globalThis,H=ar?ir.document:globalThis.document;var p={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},tt={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_CAPTIONS_LIST:"mediacaptionslistchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_CAPTIONS_SHOWING:"mediacaptionsshowingchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",USER_INACTIVE:"userinactivechange"},A={MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller"},o={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"media-fullscreen-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_CAST_UNAVAILABLE:"media-cast-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_IS_CASTING:"media-is-casting",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_SEEKABLE:"media-seekable",MEDIA_PREVIEW_TIME:"media-preview-time",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_LOADING:"media-loading",MEDIA_BUFFERED:"media-buffered",MEDIA_STREAM_TYPE:"media-stream-type"},Ll=Object.entries(tt).reduce((i,[e,t])=>{let a=o[e];return a&&(i[t]=a),i},{userinactivechange:"user-inactive"}),rr=Object.entries(o).reduce((i,[e,t])=>{let a=tt[e];return a&&(i[t]=a),i},{"user-inactive":"userinactivechange"}),Ue={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},_e={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var Pi={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},q={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},xt={LIVE:"live",ON_DEMAND:"on-demand"};var B={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:i=1}={})=>`current playback rate ${i}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},C={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:i=30}={})=>`seek forward ${i} seconds`,SEEK_BACK_N_SECS:({seekOffset:i=30}={})=>`seek back ${i} seconds`},yo={...B,...C};function Rt(i,e=!1){return i.split("_").map(function(t,a){return(a||e?t[0].toUpperCase():t[0].toLowerCase())+t.slice(1).toLowerCase()}).join("")}function Ui(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function nr(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function or(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}var sr=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],To=(i,e)=>{let t=i===1?sr[e].singular:sr[e].plural;return`${i} ${t}`},ye=i=>{if(!nr(i))return"";let e=Math.abs(i),t=e!==i,a=new Date(0,0,0,0,0,e,0);return`${[a.getHours(),a.getMinutes(),a.getSeconds()].map((l,c)=>l&&To(l,c)).filter(l=>l).join(", ")}${t?" remaining":""}`};function j(i,e){let t=!1;i<0&&(t=!0,i=0-i),i=i<0?0:i;let a=Math.floor(i%60),r=Math.floor(i/60%60),n=Math.floor(i/3600),s=Math.floor(e/60%60),l=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=r=a="-"),n=n>0||l>0?n+":":"",r=((n||s>=10)&&r<10?"0"+r:r)+":",a=a<10?"0"+a:a,(t?"-":"")+n+r+a}var Pt=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},lr={HTMLElement:class extends Pt{},DocumentFragment:class extends Pt{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){}},Mo={createElement:function(){return new lr.HTMLElement}},dr=typeof window=="undefined"||typeof window.customElements=="undefined",u=dr?lr:window,d=dr?Mo:window.document;function h(i,e){u.customElements.get(i)||(u.customElements.define(i,e),u[e.name]=e)}var ko=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Te=(i,e,t)=>(ko(i,e,"read from private field"),t?t.call(i):e.get(i)),Oi=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ut,Oe,Ni,ur=d.createElement("template");ur.innerHTML=`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
display: inline-flex;
|
|
@@ -737,7 +737,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
737
737
|
}
|
|
738
738
|
</style>
|
|
739
739
|
<slot></slot>
|
|
740
|
-
`;var Ta=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(hn.content.cloneNode(!0))}};h("media-title-bar",Ta);var _s=100,ys=i=>{var e;if(i.getAttribute(o.MEDIA_MUTED)!=null)return 0;let a=+((e=i.getAttribute(o.MEDIA_VOLUME))!=null?e:1);return Math.round(a*i.range.max)},Ts=({value:i,max:e})=>`${Math.round(i/e*100)}%`,Ia=class extends ut{static get observedAttributes(){return[...super.observedAttributes,o.MEDIA_VOLUME,o.MEDIA_MUTED,o.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=_s,this.range.addEventListener("input",()=>{let t=this.range.value/this.range.max,a=new u.CustomEvent(p.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(a)})}connectedCallback(){this.range.setAttribute("aria-label",B.VOLUME()),super.connectedCallback()}attributeChangedCallback(e,t,a){if(e===o.MEDIA_VOLUME||e===o.MEDIA_MUTED){let r=ys(this);this.range.value=r,this.range.setAttribute("aria-valuetext",Ts(this.range)),this.updateBar()}super.attributeChangedCallback(e,t,a)}};h("media-volume-range",Ia);var Is=Object.defineProperty,Ms=(i,e,t)=>e in i?Is(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ks=(i,e,t)=>(Ms(i,typeof e!="symbol"?e+"":e,t),t),oi=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}render(){this.shadowRoot.textContent="";let e=d.createElement("template");e.innerHTML=this.constructor.template,this.shadowRoot.append(e.content.cloneNode(!0))}get mediaController(){return this.shadowRoot.querySelector("media-controller")}};ks(oi,"template","");h("media-theme-base",oi);var Ma=class extends dt{};u.customElements.get("media-chrome")||u.customElements.define("media-chrome",Ma);var ka=class extends dt{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};u.customElements.get("media-container")||u.customElements.define("media-container",ka);var g=fo(require("@mux/mux-video")),k=require("@mux/playback-core");var Sn=require("@mux/mux-video");var Ss="en",Me={code:Ss};var pn="en";function y(i,e=!0){var r,n;let t=e&&(n=(r=Me)==null?void 0:r[i])!=null?n:i,a=e?Me.code:pn;return new Sa(t,a)}var Sa=class{constructor(e,t=(a=>(a=Me.code)!=null?a:pn)()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,a)=>{var r;return(r=e[a])!=null?r:""})}toString(){return this.message}};function bn(i){let e="";return Object.entries(i).forEach(([t,a])=>{a!=null&&(e+=`${Ls(t)}: ${a}; `)}),e?e.trim():void 0}function Ls(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function En(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function re(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function si(i){let e=Cs(i).toString();return e?"?"+e:""}function Cs(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}function he(i){let e=(i!=null?i:"").split(".")[1];if(!e)return{};let t=e.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var La=(i,e)=>!i||!e?!1:i.contains(e)?!0:La(i,e.getRootNode().host);var bt=require("@mux/playback-core");var Ca="mux.com",ws=()=>{try{return"1.
|
|
740
|
+
`;var Ta=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(hn.content.cloneNode(!0))}};h("media-title-bar",Ta);var _s=100,ys=i=>{var e;if(i.getAttribute(o.MEDIA_MUTED)!=null)return 0;let a=+((e=i.getAttribute(o.MEDIA_VOLUME))!=null?e:1);return Math.round(a*i.range.max)},Ts=({value:i,max:e})=>`${Math.round(i/e*100)}%`,Ia=class extends ut{static get observedAttributes(){return[...super.observedAttributes,o.MEDIA_VOLUME,o.MEDIA_MUTED,o.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=_s,this.range.addEventListener("input",()=>{let t=this.range.value/this.range.max,a=new u.CustomEvent(p.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(a)})}connectedCallback(){this.range.setAttribute("aria-label",B.VOLUME()),super.connectedCallback()}attributeChangedCallback(e,t,a){if(e===o.MEDIA_VOLUME||e===o.MEDIA_MUTED){let r=ys(this);this.range.value=r,this.range.setAttribute("aria-valuetext",Ts(this.range)),this.updateBar()}super.attributeChangedCallback(e,t,a)}};h("media-volume-range",Ia);var Is=Object.defineProperty,Ms=(i,e,t)=>e in i?Is(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ks=(i,e,t)=>(Ms(i,typeof e!="symbol"?e+"":e,t),t),oi=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}render(){this.shadowRoot.textContent="";let e=d.createElement("template");e.innerHTML=this.constructor.template,this.shadowRoot.append(e.content.cloneNode(!0))}get mediaController(){return this.shadowRoot.querySelector("media-controller")}};ks(oi,"template","");h("media-theme-base",oi);var Ma=class extends dt{};u.customElements.get("media-chrome")||u.customElements.define("media-chrome",Ma);var ka=class extends dt{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};u.customElements.get("media-container")||u.customElements.define("media-container",ka);var g=fo(require("@mux/mux-video")),k=require("@mux/playback-core");var Sn=require("@mux/mux-video");var Ss="en",Me={code:Ss};var pn="en";function y(i,e=!0){var r,n;let t=e&&(n=(r=Me)==null?void 0:r[i])!=null?n:i,a=e?Me.code:pn;return new Sa(t,a)}var Sa=class{constructor(e,t=(a=>(a=Me.code)!=null?a:pn)()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,a)=>{var r;return(r=e[a])!=null?r:""})}toString(){return this.message}};function bn(i){let e="";return Object.entries(i).forEach(([t,a])=>{a!=null&&(e+=`${Ls(t)}: ${a}; `)}),e?e.trim():void 0}function Ls(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function En(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function re(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function si(i){let e=Cs(i).toString();return e?"?"+e:""}function Cs(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}function he(i){let e=(i!=null?i:"").split(".")[1];if(!e)return{};let t=e.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var La=(i,e)=>!i||!e?!1:i.contains(e)?!0:La(i,e.getRootNode().host);var bt=require("@mux/playback-core");var Ca="mux.com",ws=()=>{try{return"1.6.0"}catch{}return"UNKNOWN"},Ds=ws(),di=()=>Ds,wa=(i,{token:e,domain:t=Ca}={})=>`https://stream.${t}/${i}.m3u8${si(!!e?{token:e}:{redundant_streams:!0})}`,gn=(i,{token:e,thumbnailTime:t,domain:a=Ca}={})=>{let r=e==null?t:void 0,{aud:n}=he(e);if(!(e&&n!=="t"))return`https://image.${a}/${i}/thumbnail.webp${si({token:e,time:r})}`},An=(i,{token:e,domain:t=Ca}={})=>{let{aud:a}=he(e);if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${si({token:e,format:"webp"})}`};var xs={crossorigin:"crossOrigin",playsinline:"playsInline"};function _n(i){var e;return(e=xs[i])!=null?e:En(i)}var yn=i=>{var t,a;let{media:e}=i;return(a=(t=e==null?void 0:e._hls)==null?void 0:t.liveSyncPosition)!=null?a:e!=null&&e.seekable.length?e==null?void 0:e.seekable.end(e.seekable.length-1):void 0},Da=i=>{let e=yn(i);if(e==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}i.currentTime=e},Rs=1,Ps=5,fn=3,vn=.5,Tn=i=>{var n;let{streamType:e}=i,t=yn(i),a=(n=i.media)==null?void 0:n.currentTime;if(t==null||a==null)return!1;let r=t-a;return e===bt.StreamTypes.LL_LIVE||e===bt.StreamTypes.LL_DVR?r<=Rs*(fn+vn):e===bt.StreamTypes.LIVE||e===bt.StreamTypes.DVR?r<=Ps*(fn+vn):!1},ke,Se,W,li=class{constructor(e,t){I(this,ke,void 0);I(this,Se,void 0);I(this,W,[]);V(this,ke,e),V(this,Se,t)}[Symbol.iterator](){return v(this,W).values()}get length(){return v(this,W).length}get value(){var e;return(e=v(this,W).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(V(this,W,[]),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return v(this,W)[e]}values(){return v(this,W).values()}keys(){return v(this,W).keys()}forEach(e){v(this,W).forEach(e)}add(...e){var t,a;e.forEach(r=>{this.contains(r)||v(this,W).push(r)}),!(this.value===""&&!((t=v(this,ke))!=null&&t.hasAttribute(`${v(this,Se)}`)))&&((a=v(this,ke))==null||a.setAttribute(`${v(this,Se)}`,`${this.value}`))}remove(...e){var t;e.forEach(a=>{v(this,W).splice(v(this,W).indexOf(a),1)}),(t=v(this,ke))==null||t.setAttribute(`${v(this,Se)}`,`${this.value}`)}contains(e){return v(this,W).includes(e)}toggle(e,t){return typeof t!="undefined"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};ke=new WeakMap,Se=new WeakMap,W=new WeakMap;var In=`[mux-player ${di()}]`;function pe(...i){console.warn(In,...i)}function J(...i){console.error(In,...i)}function ui(i){var t;let e=(t=i.message)!=null?t:"";if(i.file){let a="https://github.com/muxinc/elements/blob/main/errors/";e+=` ${y("Read more: ")}
|
|
741
741
|
${a}${i.file}`}pe(e)}var $={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Le={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},kn=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Us=Sn.VideoEvents.filter(i=>i!=="error"),Os=Object.values($).filter(i=>![$.PLAYSINLINE].includes(i)),Ns=Object.values(Le);function Ln(i){i.querySelectorAll(":scope > track").forEach(e=>{var t;(t=i.media)==null||t.append(e.cloneNode())}),Us.forEach(e=>{var t;(t=i.media)==null||t.addEventListener(e,a=>{i.dispatchEvent(new Event(a.type))})})}var xa=class extends D.HTMLElement{static get observedAttributes(){return[...Os,...Ns]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(a=>{var r;(r=this.media)==null||r.append(a.cloneNode())});let e=a=>{for(let r of a)r.type==="childList"&&(r.removedNodes.forEach(n=>{var l,c;let s=(l=this.media)==null?void 0:l.querySelector(`track[src="${n.src}"]`);s&&((c=this.media)==null||c.removeChild(s))}),r.addedNodes.forEach(n=>{var s;(s=this.media)==null||s.append(n.cloneNode())}))};new MutationObserver(e).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(e,t,a){var r,n;switch(e){case Le.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case Le.VOLUME:{let s=(r=re(a))!=null?r:1;this.media&&(this.media.volume=s);return}case Le.PLAYBACKRATE:{let s=(n=re(a))!=null?n:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);return}}}play(){var e,t;return(t=(e=this.media)==null?void 0:e.play())!=null?t:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}requestCast(e){var t;return(t=this.media)==null?void 0:t.requestCast(e)}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get paused(){var e,t;return(t=(e=this.media)==null?void 0:e.paused)!=null?t:!0}get duration(){var e,t;return(t=(e=this.media)==null?void 0:e.duration)!=null?t:NaN}get ended(){var e,t;return(t=(e=this.media)==null?void 0:e.ended)!=null?t:!1}get buffered(){var e,t;return(t=(e=this.media)==null?void 0:e.buffered)!=null?t:kn}get seekable(){var e,t;return(t=(e=this.media)==null?void 0:e.seekable)!=null?t:kn}get readyState(){var e,t;return(t=(e=this.media)==null?void 0:e.readyState)!=null?t:0}get videoWidth(){var e,t;return(t=(e=this.media)==null?void 0:e.videoWidth)!=null?t:0}get videoHeight(){var e,t;return(t=(e=this.media)==null?void 0:e.videoHeight)!=null?t:0}get currentTime(){var e,t;return(t=(e=this.media)==null?void 0:e.currentTime)!=null?t:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,t;return(t=(e=this.media)==null?void 0:e.volume)!=null?t:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,t;return(t=(e=this.media)==null?void 0:e.playbackRate)!=null?t:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=re(this.getAttribute(Le.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(Le.PLAYBACKRATE,`${e}`):this.removeAttribute(Le.PLAYBACKRATE)}get crossOrigin(){return Et(this,$.CROSSORIGIN)}set crossOrigin(e){this.setAttribute($.CROSSORIGIN,`${e}`)}get autoplay(){return Et(this,$.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute($.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute($.AUTOPLAY)}get loop(){return Et(this,$.LOOP)!=null}set loop(e){e?this.setAttribute($.LOOP,""):this.removeAttribute($.LOOP)}get muted(){var e,t;return(t=(e=this.media)==null?void 0:e.muted)!=null?t:!1}set muted(e){this.media&&(this.media.muted=Boolean(e))}get defaultMuted(){return Et(this,$.MUTED)!=null}set defaultMuted(e){e?this.setAttribute($.MUTED,""):this.removeAttribute($.MUTED)}get playsInline(){return Et(this,$.PLAYSINLINE)!=null}set playsInline(e){J("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($.PRELOAD,e):this.removeAttribute($.PRELOAD)}};function Et(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var Ra=xa;var Bs=Object.defineProperty,$s=(i,e,t)=>e in i?Bs(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Vs=(i,e,t)=>($s(i,typeof e!="symbol"?e+"":e,t),t),Rn=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},_=(i,e,t)=>(Rn(i,e,"read from private field"),t?t.call(i):e.get(i)),ee=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ne=(i,e,t,a)=>(Rn(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t),Ke,ci,Ce,ft,be,Ee,fe,we,Ye,mi,z,Cn=1,wn=0,Hs=1,Ws={processCallback(i,e,t){if(!!t){for(let[a,r]of e)if(a in t){let n=t[a];typeof n=="boolean"&&r instanceof F&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=n:typeof n=="function"&&r instanceof F?r.element[r.attributeName]=n:r.value=n}}}},oe=class extends u.DocumentFragment{constructor(e,t,a=Ws){var r;super(),ee(this,Ke,void 0),ee(this,ci,void 0),this.append(e.content.cloneNode(!0)),ne(this,Ke,Pn(this)),ne(this,ci,a),(r=a.createCallback)==null||r.call(a,this,_(this,Ke),t),a.processCallback(this,_(this,Ke),t)}update(e){_(this,ci).processCallback(this,_(this,Ke),e)}};Ke=new WeakMap;ci=new WeakMap;var Pn=(i,e=[])=>{let t,a;for(let r of i.attributes||[])if(r.value.includes("{{")){let n=new Pa;for([t,a]of xn(r.value))if(!t)n.append(a);else{let s=new F(i,r.name,r.namespaceURI);n.append(s),e.push([a,s])}r.value=n.toString()}for(let r of i.childNodes)if(r.nodeType===Cn&&!(r instanceof HTMLTemplateElement))Pn(r,e);else if(r.nodeType===Cn||r.data.includes("{{")){let n=[];if(r.data)for([t,a]of xn(r.data))if(!t)n.push(new Text(a));else{let s=new se(i);n.push(s),e.push([a,s])}else if(r instanceof HTMLTemplateElement){let s=new vt(i,r);n.push(s),e.push([s.expression,s])}r.replaceWith(...n.flatMap(s=>s.replacementNodes||[s]))}return e},Dn={},xn=i=>{let e="",t=0,a=Dn[i],r=0,n;if(a)return a;for(a=[];n=i[r];r++)n==="{"&&i[r+1]==="{"&&i[r-1]!=="\\"&&i[r+2]&&++t==1?(e&&a.push([wn,e]),e="",r++):n==="}"&&i[r+1]==="}"&&i[r-1]!=="\\"&&!--t?(a.push([Hs,e.trim()]),e="",r++):e+=n||"";return e&&a.push([wn,(t>0?"{{":"")+e]),Dn[i]=a},Fs=11,hi=class{get value(){return""}set value(e){}toString(){return this.value}},Un=new WeakMap,Pa=class{constructor(){ee(this,Ce,[])}[Symbol.iterator](){return _(this,Ce).values()}get length(){return _(this,Ce).length}item(e){return _(this,Ce)[e]}append(...e){for(let t of e)t instanceof F&&Un.set(t,this),_(this,Ce).push(t)}toString(){return _(this,Ce).join("")}};Ce=new WeakMap;var F=class extends hi{constructor(e,t,a){super(),ee(this,we),ee(this,ft,""),ee(this,be,void 0),ee(this,Ee,void 0),ee(this,fe,void 0),ne(this,be,e),ne(this,Ee,t),ne(this,fe,a)}get attributeName(){return _(this,Ee)}get attributeNamespace(){return _(this,fe)}get element(){return _(this,be)}get value(){return _(this,ft)}set value(e){_(this,ft)!==e&&(ne(this,ft,e),!_(this,we,Ye)||_(this,we,Ye).length===1?e==null?_(this,be).removeAttributeNS(_(this,fe),_(this,Ee)):_(this,be).setAttributeNS(_(this,fe),_(this,Ee),e):_(this,be).setAttributeNS(_(this,fe),_(this,Ee),_(this,we,Ye)))}get booleanValue(){return _(this,be).hasAttributeNS(_(this,fe),_(this,Ee))}set booleanValue(e){if(!_(this,we,Ye)||_(this,we,Ye).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};ft=new WeakMap;be=new WeakMap;Ee=new WeakMap;fe=new WeakMap;we=new WeakSet;Ye=function(){return Un.get(this)};var se=class extends hi{constructor(e,t){super(),ee(this,mi,void 0),ee(this,z,void 0),ne(this,mi,e),ne(this,z,t?[...t]:[new Text])}get replacementNodes(){return _(this,z)}get parentNode(){return _(this,mi)}get nextSibling(){return _(this,z)[_(this,z).length-1].nextSibling}get previousSibling(){return _(this,z)[0].previousSibling}get value(){return _(this,z).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let t=e.flat().flatMap(a=>a==null?[new Text]:a.forEach?[...a]:a.nodeType===Fs?[...a.childNodes]:a.nodeType?[a]:[new Text(a)]);t.length||t.push(new Text("")),_(this,z)[0].before(...t);for(let a of _(this,z))t.includes(a)||a.remove();ne(this,z,t)}};mi=new WeakMap;z=new WeakMap;var vt=class extends se{constructor(e,t){let a=t.getAttribute("directive")||t.getAttribute("type"),r=t.getAttribute("expression")||t.getAttribute(a)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),Vs(this,"directive"),this.expression=r,this.template=t,this.directive=a}};var Ks=/([>&])?\s*(\w+)\s*(.*)/,Ys=/^(\?\?|\|)?\s*(['"\w]*)/,Gs={"|":{string:i=>String(i)},"??":(i,e)=>i!=null?i:e},pi=class{constructor(e){this.template=e}},Oa={partial:(i,e)=>{e[i.expression]=new pi(i.template)},if:(i,e)=>{Qs(i.expression,e)?i.replace(new oe(i.template,e,bi)):i.replace("")}},Zs=Object.keys(Oa),bi={processCallback(i,e,t){var a,r,n;if(!!t)for(let[s,l]of e){if(l instanceof vt){if(!l.directive){let M=Zs.find(R=>l.template.hasAttribute(R));M&&(l.directive=M,l.expression=l.template.getAttribute(M))}(a=Oa[l.directive])==null||a.call(Oa,l,t);continue}let[,c,m,E]=(r=s.match(Ks))!=null?r:[],f=t[m],[,w,T]=(n=E.match(Ys))!=null?n:[],P=Gs[w];if(typeof P=="function")f=P(f,gt(T,t));else if(P&&f!=null){let M=P[T];M&&(f=M(f))}if(f){if(f instanceof pi){if(c!==">")continue;let M={...t},R=s.matchAll(/(\w+)\s*=\s*(['"\w]*)/g);for(let[,L,G]of R)M[L]=gt(G,t);f=new oe(f.template,M,bi)}l instanceof F&&l.attributeName.startsWith("aria-")&&(f=String(f)),l instanceof F?typeof f=="boolean"?l.booleanValue=f:typeof f=="function"?l.element[l.attributeName]=f:l.value=f:l.value=f}else l instanceof F&&(l.booleanValue=!1)}}},qs={"==":(i,e)=>i==e,"!=":(i,e)=>i!=e};function Qs(i,e){var t;let a=zs(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=]=/,ws:/\s+/,param:/[$a-z_][$\w]*/i});if(a.length===0||a.some(({type:n})=>!n))return console.warn(`Warning: invalid expression \`${i}\``),!1;if(a.length===1)return Ua(a[0])?gt(a[0].token,e):(console.warn(`Warning: invalid expression \`${i}\``),!1);let r=a.filter(({type:n})=>n!=="ws");if(r.length===3){let n=qs[(t=r[1])==null?void 0:t.token];return!n||!Ua(r[0])||!Ua(r[2])?(console.warn(`Warning: invalid expression \`${i}\``),!1):n(gt(r[0].token,e),gt(r[2].token,e))}}function Ua({type:i}){return["number","boolean","string","param"].includes(i)}function gt(i,e){let t=i[0],a=i.slice(-1);return i==="true"||i==="false"?i==="true":t===a&&["'",'"'].includes(t)?i.slice(1,-1):or(i)?parseFloat(i):e[i]}function zs(i,e){let t,a,r,n=[];for(;i;){r=null,t=i.length;for(let s in e)a=e[s].exec(i),a&&a.index<t&&(r={token:a[0],type:s,matches:a.slice(1)},t=a.index);t&&n.push({token:i.substr(0,t),type:void 0}),r&&n.push(r),i=i.substr(t+(r?r.token.length:0))}return n}var Xs=Object.defineProperty,js=(i,e,t)=>e in i?Xs(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,At=(i,e,t)=>(js(i,typeof e!="symbol"?e+"":e,t),t),$n=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},On=(i,e,t)=>($n(i,e,"read from private field"),t?t.call(i):e.get(i)),Nn=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Bn=(i,e,t,a)=>($n(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t),Ei,fi,Ge=class extends u.HTMLElement{constructor(){super(),At(this,"renderRoot"),At(this,"renderer"),Nn(this,Ei,void 0),Nn(this,fi,void 0),this.renderRoot=this.attachShadow({mode:"open"}),new MutationObserver(()=>this.render()).observe(this,{attributes:!0}),this.createRenderer()}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e,t;let a=this.getAttribute("template");if(a){let r=(e=this.getRootNode())==null?void 0:e.getElementById(a);if(r)return r}return(t=On(this,Ei))!=null?t:this.constructor.template}set template(e){Bn(this,Ei,e),this.createRenderer()}get props(){let e={};for(let t of this.attributes)t.value!=null?e[Ui(t.name)]=t.value===""?!0:t.value:e[Ui(t.name)]=!1;return e}attributeChangedCallback(e,t,a){e==="template"&&t!=a&&this.createRenderer()}createRenderer(){this.template&&this.template!==On(this,fi)&&(Bn(this,fi,this.template),this.renderer=new oe(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}};Ei=new WeakMap;fi=new WeakMap;At(Ge,"template");At(Ge,"observedAttributes",["template"]);At(Ge,"processor",bi);h("media-theme",Ge);var Hn=`
|
|
742
742
|
:host {
|
|
743
743
|
cursor: pointer;
|
|
@@ -1730,5 +1730,5 @@ a {
|
|
|
1730
1730
|
</p>
|
|
1731
1731
|
</mxp-dialog>
|
|
1732
1732
|
</media-theme>
|
|
1733
|
-
`};var Mt=require("@mux/mux-video");function Ai(i,e,t,a,r){var l,c,m;let n={},s={};switch(i.code){case Mt.MediaError.MEDIA_ERR_NETWORK:{switch(n.title=y("Network Error",r),n.message=i.message,(l=i.data)==null?void 0:l.response.code){case 412:{n.title=y("Video is not currently available",r),n.message=y("The live stream or video file are not yet ready.",r),s.message=y("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),s.file="412-not-playable.md";break}case 404:{n.title=y("Video does not exist",r),n.message="",s.message=y("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),s.file="404-not-found.md";break}case 403:{if(n.title=y("Invalid playback URL",r),n.message=y("The video URL or playback-token are formatted with incorrect or incomplete information.",r),s.message=y("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),s.file="missing-signed-tokens.md",!a)break;let{exp:E,aud:f,sub:w}=he(a),T=Date.now()>E*1e3,P=w!==t,M=f!=="v",R={timeStyle:"medium",dateStyle:"medium"};if(T){n.title=y("Video URL has expired",r),n.message=y("The video\u2019s secured playback-token has expired.",r),s.message=y("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(Me.code,R).format(E*1e3),currentDate:new Intl.DateTimeFormat(Me.code,R).format(Date.now())}),s.file="403-expired-token.md";break}if(P){n.title=y("Video URL is formatted incorrectly",r),n.message=y("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.message=y("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:t,tokenPlaybackId:w}),s.file="403-playback-id-mismatch.md";break}if(M){n.title=y("Video URL is formatted incorrectly",r),n.message=y("The playback-token is formatted with incorrect information.",r),s.message=y("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:f}),s.file="403-incorrect-aud-value.md";break}s.message=y("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),s.file="403-malformatted-token.md";break}}break}case Mt.MediaError.MEDIA_ERR_DECODE:{let{message:E}=i;n={title:y("Media Error",r),message:E},s.file="media-decode-error.md";break}case Mt.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:{let E=(m=(c=i.data)==null?void 0:c.response)==null?void 0:m.code;if(E>=400&&E<500){i.code=Mt.MediaError.MEDIA_ERR_NETWORK,i.data={response:{code:E}},{dialog:n,devlog:s}=Ai(i,e,t,a);break}n={title:y("Source Not Supported",r),message:i.message},s.file="media-src-not-supported.md";break}default:n={title:y("Error",r),message:i.message};break}return e&&(n={title:y("Your device appears to be offline",r),message:y("Check your internet connection and try reloading this video.",r)}),{dialog:n,devlog:s}}var pl=Object.values(k.StreamTypes),bl=700,El=300,Wa={LG:"large",SM:"small",XS:"extra-small"};function _i(i){let e=i.getBoundingClientRect();return e.width<El?Wa.XS:e.width<bl?Wa.SM:Wa.LG}var le={SRC:"src",POSTER:"poster"},b={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function fl(i,e){var a,r;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src,poster:i.poster,storyboard:i.storyboard,placeholder:i.getAttribute("placeholder"),theme:i.getAttribute("theme"),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(b.NOHOTKEYS),hotKeys:i.getAttribute(b.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,metadata:i.metadata,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,streamType:i.streamType,primaryColor:i.primaryColor,secondaryColor:i.secondaryColor,forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultShowRemainingTime:i.defaultShowRemainingTime,playbackRates:i.getAttribute(b.PLAYBACK_RATES),customDomain:(a=i.getAttribute(g.Attributes.CUSTOM_DOMAIN))!=null?a:void 0,playerSize:_i((r=i.mediaController)!=null?r:i),title:i.getAttribute(b.TITLE),...e}}var vl=Object.values(g.Attributes),gl=Object.values(le),Al=Object.values(b),_l=di(),yl="mux-player",eo={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},xe,St,de,Lt,ze,te,Xe,yi,Ii,to,Ae,Qe,je,Ti,Ct,Fa,Mi,io,ki,ao,Si,ro,Li,no,Ci,oo,wi,so,kt=class extends Ra{constructor(){super();I(this,Xe);I(this,Ii);I(this,Ae);I(this,je);I(this,Ct);I(this,Mi);I(this,ki);I(this,Si);I(this,Li);I(this,Ci);I(this,wi);I(this,xe,!1);I(this,St,{});I(this,de,!0);I(this,Lt,new li(this,"hotkeys"));I(this,ze,void 0);I(this,te,{...eo,onCloseErrorDialog:()=>S(this,Ae,Qe).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:t=>{La(this,H.activeElement)||t.preventDefault()},onSeekToLive:()=>Da(this)});this.attachShadow({mode:"open"}),S(this,Ii,to).call(this),this.isConnected&&S(this,Xe,yi).call(this)}static get observedAttributes(){var t;return[...(t=Ra.observedAttributes)!=null?t:[],...gl,...vl,...Al]}get theme(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("media-theme")}get mediaController(){var t,a;return(a=(t=this.theme)==null?void 0:t.shadowRoot)==null?void 0:a.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,a)=>{let r=this.getAttribute(a);return r!==null&&(t[a.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},{})}connectedCallback(){var a;S(this,Ct,Fa).call(this);let t=(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video");t&&(t.metadata=this.metadataFromAttrs),S(this,Mi,io).call(this)}disconnectedCallback(){S(this,ki,ao).call(this)}attributeChangedCallback(t,a,r){switch(v(this,xe)||S(this,Xe,yi).call(this),super.attributeChangedCallback(t,a,r),t){case b.HOTKEYS:v(this,Lt).value=r;break;case b.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&pe(y("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case b.THUMBNAIL_TOKEN:{let{aud:s}=he(r);r&&s!=="t"&&pe(y("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:s}));break}case b.STORYBOARD_TOKEN:{let{aud:s}=he(r);r&&s!=="s"&&pe(y("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:s}));break}case g.Attributes.PLAYBACK_ID:{r!=null&&r.includes("?token")&&J(y("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!pl.includes(this.streamType)&&ui({file:"invalid-stream-type.md",message:y("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):ui({file:"invalid-stream-type.md",message:String(y("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[g.Attributes.PLAYBACK_ID,le.SRC,b.PLAYBACK_TOKEN].includes(t)&&a!==r&&V(this,te,{...v(this,te),...eo}),S(this,je,Ti).call(this,{[_n(t)]:r})}get preferCmcd(){var t;return(t=this.getAttribute(g.Attributes.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?k.CmcdTypeValues.includes(t)?this.setAttribute(g.Attributes.PREFER_CMCD,t):pe(`Invalid value for preferCmcd. Must be one of ${k.CmcdTypeValues.join()}`):this.removeAttribute(g.Attributes.PREFER_CMCD))}get hasPlayed(){var t,a;return(a=(t=this.mediaController)==null?void 0:t.hasAttribute("media-has-played"))!=null?a:!1}get inLiveWindow(){return v(this,te).inLiveWindow}get _hls(){var t;return(t=this.media)==null?void 0:t._hls}get mux(){var t;return(t=this.media)==null?void 0:t.mux}get playbackId(){var t;return(t=this.getAttribute(g.Attributes.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t?this.setAttribute(g.Attributes.PLAYBACK_ID,t):this.removeAttribute(g.Attributes.PLAYBACK_ID)}get src(){var t,a;return this.playbackId?(t=ge(this,le.SRC))!=null?t:void 0:(a=this.getAttribute(le.SRC))!=null?a:void 0}set src(t){t?this.setAttribute(le.SRC,t):this.removeAttribute(le.SRC)}get poster(){var a;let t=this.getAttribute(le.POSTER);if(t!=null)return t;if(this.playbackId&&!this.audio)return gn(this.playbackId,{domain:this.customDomain,thumbnailTime:(a=this.thumbnailTime)!=null?a:this.startTime,token:this.tokens.thumbnail})}set poster(t){t||t===""?this.setAttribute(le.POSTER,t):this.removeAttribute(le.POSTER)}get storyboard(){if(this.playbackId&&!this.audio&&(!this.streamType||![k.StreamTypes.LIVE,k.StreamTypes.LL_LIVE,k.StreamTypes.DVR,k.StreamTypes.LL_DVR].includes(this.streamType)))return An(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(b.AUDIO)}set audio(t){if(!t){this.removeAttribute(b.AUDIO);return}this.setAttribute(b.AUDIO,"")}get hotkeys(){return v(this,Lt)}get nohotkeys(){return this.hasAttribute(b.NOHOTKEYS)}set nohotkeys(t){if(!t){this.removeAttribute(b.NOHOTKEYS);return}this.setAttribute(b.NOHOTKEYS,"")}get thumbnailTime(){return re(this.getAttribute(b.THUMBNAIL_TIME))}set thumbnailTime(t){this.setAttribute(b.THUMBNAIL_TIME,`${t}`)}get title(){var t;return(t=this.getAttribute(b.TITLE))!=null?t:""}set title(t){t!==this.title&&(t?this.setAttribute(b.TITLE,t):this.removeAttribute("title"),super.title=t)}get placeholder(){var t;return(t=ge(this,b.PLACEHOLDER))!=null?t:""}set placeholder(t){this.setAttribute(b.PLACEHOLDER,`${t}`)}get primaryColor(){var t;return(t=this.getAttribute(b.PRIMARY_COLOR))!=null?t:void 0}set primaryColor(t){this.setAttribute(b.PRIMARY_COLOR,`${t}`)}get secondaryColor(){var t;return(t=this.getAttribute(b.SECONDARY_COLOR))!=null?t:"rgb(0 0 0 / .65)"}set secondaryColor(t){this.setAttribute(b.SECONDARY_COLOR,`${t}`)}get defaultShowRemainingTime(){return this.hasAttribute(b.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(t){t?this.setAttribute(b.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(b.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(b.PLAYBACK_RATES))return this.getAttribute(b.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,a)=>t-a)}set playbackRates(t){if(!t){this.removeAttribute(b.PLAYBACK_RATES);return}this.setAttribute(b.PLAYBACK_RATES,t.join(" "))}get forwardSeekOffset(){var t;return(t=re(this.getAttribute(b.FORWARD_SEEK_OFFSET)))!=null?t:10}set forwardSeekOffset(t){this.setAttribute(b.FORWARD_SEEK_OFFSET,`${t}`)}get backwardSeekOffset(){var t;return(t=re(this.getAttribute(b.BACKWARD_SEEK_OFFSET)))!=null?t:10}set backwardSeekOffset(t){this.setAttribute(b.BACKWARD_SEEK_OFFSET,`${t}`)}get defaultHiddenCaptions(){return this.hasAttribute(b.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(t){t?this.setAttribute(b.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(b.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var t;return(t=this.getAttribute(g.Attributes.PLAYER_SOFTWARE_NAME))!=null?t:yl}get playerSoftwareVersion(){var t;return(t=this.getAttribute(g.Attributes.PLAYER_SOFTWARE_VERSION))!=null?t:_l}get beaconCollectionDomain(){var t;return(t=this.getAttribute(g.Attributes.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(g.Attributes.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(g.Attributes.BEACON_COLLECTION_DOMAIN))}get customDomain(){var t;return(t=this.getAttribute(g.Attributes.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(g.Attributes.CUSTOM_DOMAIN,t):this.removeAttribute(g.Attributes.CUSTOM_DOMAIN))}get envKey(){var t;return(t=ge(this,g.Attributes.ENV_KEY))!=null?t:void 0}set envKey(t){this.setAttribute(g.Attributes.ENV_KEY,`${t}`)}get debug(){return ge(this,g.Attributes.DEBUG)!=null}set debug(t){t?this.setAttribute(g.Attributes.DEBUG,""):this.removeAttribute(g.Attributes.DEBUG)}get disableCookies(){return ge(this,g.Attributes.DISABLE_COOKIES)!=null}set disableCookies(t){t?this.setAttribute(g.Attributes.DISABLE_COOKIES,""):this.removeAttribute(g.Attributes.DISABLE_COOKIES)}get streamType(){return ge(this,g.Attributes.STREAM_TYPE)}set streamType(t){this.setAttribute(g.Attributes.STREAM_TYPE,`${t}`)}get startTime(){return re(ge(this,g.Attributes.START_TIME))}set startTime(t){this.setAttribute(g.Attributes.START_TIME,`${t}`)}get preferPlayback(){let t=this.getAttribute(g.Attributes.PREFER_PLAYBACK);if(t===k.PlaybackTypes.MSE||t===k.PlaybackTypes.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===k.PlaybackTypes.MSE||t===k.PlaybackTypes.NATIVE?this.setAttribute(g.Attributes.PREFER_PLAYBACK,t):this.removeAttribute(g.Attributes.PREFER_PLAYBACK))}get metadata(){var t;return(t=this.media)==null?void 0:t.metadata}set metadata(t){if(v(this,xe)||S(this,Xe,yi).call(this),!this.media){J("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...t}}get tokens(){let t=this.getAttribute(b.PLAYBACK_TOKEN),a=this.getAttribute(b.THUMBNAIL_TOKEN),r=this.getAttribute(b.STORYBOARD_TOKEN);return{...v(this,St),...t!=null?{playback:t}:{},...a!=null?{thumbnail:a}:{},...r!=null?{storyboard:r}:{}}}set tokens(t){V(this,St,t!=null?t:{})}get playbackToken(){var t;return(t=this.getAttribute(b.PLAYBACK_TOKEN))!=null?t:void 0}set playbackToken(t){this.setAttribute(b.PLAYBACK_TOKEN,`${t}`)}get thumbnailToken(){var t;return(t=this.getAttribute(b.THUMBNAIL_TOKEN))!=null?t:void 0}set thumbnailToken(t){this.setAttribute(b.THUMBNAIL_TOKEN,`${t}`)}get storyboardToken(){var t;return(t=this.getAttribute(b.STORYBOARD_TOKEN))!=null?t:void 0}set storyboardToken(t){this.setAttribute(b.STORYBOARD_TOKEN,`${t}`)}addTextTrack(t,a,r,n){var l;let s=(l=this.media)==null?void 0:l.nativeEl;if(!!s)return(0,k.addTextTrack)(s,t,a,r,n)}removeTextTrack(t){var r;let a=(r=this.media)==null?void 0:r.nativeEl;if(!!a)return(0,k.removeTextTrack)(a,t)}get textTracks(){var t;return(t=this.media)==null?void 0:t.textTracks}};xe=new WeakMap,St=new WeakMap,de=new WeakMap,Lt=new WeakMap,ze=new WeakMap,te=new WeakMap,Xe=new WeakSet,yi=function(){var t,a;if(!v(this,xe)){V(this,xe,!0),S(this,Ae,Qe).call(this,{playerSize:_i(this)});try{if(customElements.upgrade(this.theme),!(this.theme instanceof D.HTMLElement))throw""}catch{J("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof g.default))throw""}catch{J("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof dt))throw""}catch{J("<media-controller> failed to upgrade!")}Ln(this),S(this,Li,no).call(this),S(this,Ci,oo).call(this),S(this,Si,ro).call(this),V(this,de,(a=(t=this.mediaController)==null?void 0:t.hasAttribute("user-inactive"))!=null?a:!0),S(this,wi,so).call(this)}},Ii=new WeakSet,to=function(){var t,a;try{(t=window==null?void 0:window.CSS)==null||t.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(a=window==null?void 0:window.CSS)==null||a.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},Ae=new WeakSet,Qe=function(t){Object.assign(v(this,te),t),S(this,je,Ti).call(this)},je=new WeakSet,Ti=function(t={}){jn(Jn(fl(this,{...v(this,te),...t})),this.shadowRoot)},Ct=new WeakSet,Fa=function(){var t,a;v(this,te).playerSize!=_i((t=this.mediaController)!=null?t:this)&&S(this,Ae,Qe).call(this,{playerSize:_i((a=this.mediaController)!=null?a:this)})},Mi=new WeakSet,io=function(){var t;V(this,ze,new ResizeObserver(()=>S(this,Ct,Fa).call(this))),v(this,ze).observe((t=this.mediaController)!=null?t:this)},ki=new WeakSet,ao=function(){var t;(t=v(this,ze))==null||t.disconnect()},Si=new WeakSet,ro=function(){var a,r,n,s,l;(a=this.mediaController)==null||a.addEventListener("mediaplayrequest",c=>{var m;((m=c.target)==null?void 0:m.localName)==="media-play-button"&&this.streamType&&[k.StreamTypes.LIVE,k.StreamTypes.LL_LIVE,k.StreamTypes.DVR,k.StreamTypes.LL_DVR].includes(this.streamType)&&this.hasPlayed&&Da(this)});let t=()=>{let c=Tn(this),m=v(this,te).inLiveWindow;c!==m&&(S(this,Ae,Qe).call(this,{inLiveWindow:c}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(r=this.media)==null||r.addEventListener("progress",t),(n=this.media)==null||n.addEventListener("waiting",t),(s=this.media)==null||s.addEventListener("timeupdate",t),(l=this.media)==null||l.addEventListener("emptied",t)},Li=new WeakSet,no=function(){var a;let t=r=>{let{detail:n}=r;if(n instanceof g.MediaError||(n=new g.MediaError(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){pe(n),n.data&&pe(`${n.name} data:`,n.data);return}let{dialog:s,devlog:l}=Ai(n,!window.navigator.onLine,this.playbackId,this.playbackToken);l.message&&ui(l),J(n),n.data&&J(`${n.name} data:`,n.data),S(this,Ae,Qe).call(this,{isDialogOpen:!0,dialog:s})};this.addEventListener("error",t),this.media&&(this.media.errorTranslator=(r={})=>{var s,l,c;if(!((s=this.media)!=null&&s.error))return r;let{devlog:n}=Ai((l=this.media)==null?void 0:l.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!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}}),(a=this.media)==null||a.addEventListener("error",r=>{var s,l;let{detail:n}=r;if(!n){let{message:c,code:m}=(l=(s=this.media)==null?void 0:s.error)!=null?l:{};n=new g.MediaError(c,m)}!(n!=null&&n.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Ci=new WeakSet,oo=function(){var a,r,n,s;let t=()=>S(this,je,Ti).call(this);(r=(a=this.media)==null?void 0:a.textTracks)==null||r.addEventListener("addtrack",t),(s=(n=this.media)==null?void 0:n.textTracks)==null||s.addEventListener("removetrack",t)},wi=new WeakSet,so=function(){var E,f,w;let t=this.mediaController,a=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(a)return;let r,n=new WeakMap,s=()=>this.streamType&&[k.StreamTypes.LIVE,k.StreamTypes.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,l=(T,P,M=!1)=>{if(s())return;Array.from(T&&T.activeCues||[]).forEach(L=>{if(!(!L.snapToLines||L.line<-5||L.line>=0&&L.line<10))if(!P||this.paused){let G=L.text.split(`
|
|
1733
|
+
`};var Mt=require("@mux/mux-video");function Ai(i,e,t,a,r){var l,c,m;let n={},s={};switch(i.code){case Mt.MediaError.MEDIA_ERR_NETWORK:{switch(n.title=y("Network Error",r),n.message=i.message,(l=i.data)==null?void 0:l.response.code){case 412:{n.title=y("Video is not currently available",r),n.message=y("The live stream or video file are not yet ready.",r),s.message=y("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),s.file="412-not-playable.md";break}case 404:{n.title=y("Video does not exist",r),n.message="",s.message=y("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),s.file="404-not-found.md";break}case 403:{if(n.title=y("Invalid playback URL",r),n.message=y("The video URL or playback-token are formatted with incorrect or incomplete information.",r),s.message=y("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),s.file="missing-signed-tokens.md",!a)break;let{exp:E,aud:f,sub:w}=he(a),T=Date.now()>E*1e3,P=w!==t,M=f!=="v",R={timeStyle:"medium",dateStyle:"medium"};if(T){n.title=y("Video URL has expired",r),n.message=y("The video\u2019s secured playback-token has expired.",r),s.message=y("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(Me.code,R).format(E*1e3),currentDate:new Intl.DateTimeFormat(Me.code,R).format(Date.now())}),s.file="403-expired-token.md";break}if(P){n.title=y("Video URL is formatted incorrectly",r),n.message=y("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.message=y("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:t,tokenPlaybackId:w}),s.file="403-playback-id-mismatch.md";break}if(M){n.title=y("Video URL is formatted incorrectly",r),n.message=y("The playback-token is formatted with incorrect information.",r),s.message=y("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:f}),s.file="403-incorrect-aud-value.md";break}s.message=y("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),s.file="403-malformatted-token.md";break}}break}case Mt.MediaError.MEDIA_ERR_DECODE:{let{message:E}=i;n={title:y("Media Error",r),message:E},s.file="media-decode-error.md";break}case Mt.MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:{let E=(m=(c=i.data)==null?void 0:c.response)==null?void 0:m.code;if(E>=400&&E<500){i.code=Mt.MediaError.MEDIA_ERR_NETWORK,i.data={response:{code:E}},{dialog:n,devlog:s}=Ai(i,e,t,a);break}n={title:y("Source Not Supported",r),message:i.message},s.file="media-src-not-supported.md";break}default:n={title:y("Error",r),message:i.message};break}return e&&(n={title:y("Your device appears to be offline",r),message:y("Check your internet connection and try reloading this video.",r)}),{dialog:n,devlog:s}}var pl=Object.values(k.StreamTypes),bl=700,El=300,Wa={LG:"large",SM:"small",XS:"extra-small"};function _i(i){let e=i.getBoundingClientRect();return e.width<El?Wa.XS:e.width<bl?Wa.SM:Wa.LG}var le={SRC:"src",POSTER:"poster"},b={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function fl(i,e){var a,r;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src,poster:i.poster,storyboard:i.storyboard,storyboardSrc:i.getAttribute(b.STORYBOARD_SRC),placeholder:i.getAttribute("placeholder"),theme:i.getAttribute("theme"),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(b.NOHOTKEYS),hotKeys:i.getAttribute(b.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,metadata:i.metadata,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,streamType:i.streamType,primaryColor:i.primaryColor,secondaryColor:i.secondaryColor,forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultShowRemainingTime:i.defaultShowRemainingTime,playbackRates:i.getAttribute(b.PLAYBACK_RATES),customDomain:(a=i.getAttribute(g.Attributes.CUSTOM_DOMAIN))!=null?a:void 0,playerSize:_i((r=i.mediaController)!=null?r:i),title:i.getAttribute(b.TITLE),...e}}var vl=Object.values(g.Attributes),gl=Object.values(le),Al=Object.values(b),_l=di(),yl="mux-player",eo={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},xe,St,de,Lt,ze,te,Xe,yi,Ii,to,Ae,Qe,je,Ti,Ct,Fa,Mi,io,ki,ao,Si,ro,Li,no,Ci,oo,wi,so,kt=class extends Ra{constructor(){super();I(this,Xe);I(this,Ii);I(this,Ae);I(this,je);I(this,Ct);I(this,Mi);I(this,ki);I(this,Si);I(this,Li);I(this,Ci);I(this,wi);I(this,xe,!1);I(this,St,{});I(this,de,!0);I(this,Lt,new li(this,"hotkeys"));I(this,ze,void 0);I(this,te,{...eo,onCloseErrorDialog:()=>S(this,Ae,Qe).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:t=>{La(this,H.activeElement)||t.preventDefault()},onSeekToLive:()=>Da(this)});this.attachShadow({mode:"open"}),S(this,Ii,to).call(this),this.isConnected&&S(this,Xe,yi).call(this)}static get observedAttributes(){var t;return[...(t=Ra.observedAttributes)!=null?t:[],...gl,...vl,...Al]}get theme(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("media-theme")}get mediaController(){var t,a;return(a=(t=this.theme)==null?void 0:t.shadowRoot)==null?void 0:a.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,a)=>{let r=this.getAttribute(a);return r!==null&&(t[a.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},{})}connectedCallback(){var a;S(this,Ct,Fa).call(this);let t=(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video");t&&(t.metadata=this.metadataFromAttrs),S(this,Mi,io).call(this)}disconnectedCallback(){S(this,ki,ao).call(this)}attributeChangedCallback(t,a,r){switch(v(this,xe)||S(this,Xe,yi).call(this),super.attributeChangedCallback(t,a,r),t){case b.HOTKEYS:v(this,Lt).value=r;break;case b.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&pe(y("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case b.THUMBNAIL_TOKEN:{let{aud:s}=he(r);r&&s!=="t"&&pe(y("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:s}));break}case b.STORYBOARD_TOKEN:{let{aud:s}=he(r);r&&s!=="s"&&pe(y("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:s}));break}case g.Attributes.PLAYBACK_ID:{r!=null&&r.includes("?token")&&J(y("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!pl.includes(this.streamType)&&ui({file:"invalid-stream-type.md",message:y("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):ui({file:"invalid-stream-type.md",message:String(y("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[g.Attributes.PLAYBACK_ID,le.SRC,b.PLAYBACK_TOKEN].includes(t)&&a!==r&&V(this,te,{...v(this,te),...eo}),S(this,je,Ti).call(this,{[_n(t)]:r})}get preferCmcd(){var t;return(t=this.getAttribute(g.Attributes.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?k.CmcdTypeValues.includes(t)?this.setAttribute(g.Attributes.PREFER_CMCD,t):pe(`Invalid value for preferCmcd. Must be one of ${k.CmcdTypeValues.join()}`):this.removeAttribute(g.Attributes.PREFER_CMCD))}get hasPlayed(){var t,a;return(a=(t=this.mediaController)==null?void 0:t.hasAttribute("media-has-played"))!=null?a:!1}get inLiveWindow(){return v(this,te).inLiveWindow}get _hls(){var t;return(t=this.media)==null?void 0:t._hls}get mux(){var t;return(t=this.media)==null?void 0:t.mux}get playbackId(){var t;return(t=this.getAttribute(g.Attributes.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t?this.setAttribute(g.Attributes.PLAYBACK_ID,t):this.removeAttribute(g.Attributes.PLAYBACK_ID)}get src(){var t,a;return this.playbackId?(t=ge(this,le.SRC))!=null?t:void 0:(a=this.getAttribute(le.SRC))!=null?a:void 0}set src(t){t?this.setAttribute(le.SRC,t):this.removeAttribute(le.SRC)}get poster(){var a;let t=this.getAttribute(le.POSTER);if(t!=null)return t;if(this.playbackId&&!this.audio)return gn(this.playbackId,{domain:this.customDomain,thumbnailTime:(a=this.thumbnailTime)!=null?a:this.startTime,token:this.tokens.thumbnail})}set poster(t){t||t===""?this.setAttribute(le.POSTER,t):this.removeAttribute(le.POSTER)}get storyboardSrc(){var t;return(t=this.getAttribute(b.STORYBOARD_SRC))!=null?t:void 0}set storyboardSrc(t){t?this.setAttribute(b.STORYBOARD_SRC,t):this.removeAttribute(b.STORYBOARD_SRC)}get storyboard(){if(!this.audio&&(!this.streamType||![k.StreamTypes.LIVE,k.StreamTypes.LL_LIVE,k.StreamTypes.DVR,k.StreamTypes.LL_DVR].includes(this.streamType))){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(this.playbackId)return An(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}}get audio(){return this.hasAttribute(b.AUDIO)}set audio(t){if(!t){this.removeAttribute(b.AUDIO);return}this.setAttribute(b.AUDIO,"")}get hotkeys(){return v(this,Lt)}get nohotkeys(){return this.hasAttribute(b.NOHOTKEYS)}set nohotkeys(t){if(!t){this.removeAttribute(b.NOHOTKEYS);return}this.setAttribute(b.NOHOTKEYS,"")}get thumbnailTime(){return re(this.getAttribute(b.THUMBNAIL_TIME))}set thumbnailTime(t){this.setAttribute(b.THUMBNAIL_TIME,`${t}`)}get title(){var t;return(t=this.getAttribute(b.TITLE))!=null?t:""}set title(t){t!==this.title&&(t?this.setAttribute(b.TITLE,t):this.removeAttribute("title"),super.title=t)}get placeholder(){var t;return(t=ge(this,b.PLACEHOLDER))!=null?t:""}set placeholder(t){this.setAttribute(b.PLACEHOLDER,`${t}`)}get primaryColor(){var t;return(t=this.getAttribute(b.PRIMARY_COLOR))!=null?t:void 0}set primaryColor(t){this.setAttribute(b.PRIMARY_COLOR,`${t}`)}get secondaryColor(){var t;return(t=this.getAttribute(b.SECONDARY_COLOR))!=null?t:"rgb(0 0 0 / .65)"}set secondaryColor(t){this.setAttribute(b.SECONDARY_COLOR,`${t}`)}get defaultShowRemainingTime(){return this.hasAttribute(b.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(t){t?this.setAttribute(b.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(b.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(b.PLAYBACK_RATES))return this.getAttribute(b.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,a)=>t-a)}set playbackRates(t){if(!t){this.removeAttribute(b.PLAYBACK_RATES);return}this.setAttribute(b.PLAYBACK_RATES,t.join(" "))}get forwardSeekOffset(){var t;return(t=re(this.getAttribute(b.FORWARD_SEEK_OFFSET)))!=null?t:10}set forwardSeekOffset(t){this.setAttribute(b.FORWARD_SEEK_OFFSET,`${t}`)}get backwardSeekOffset(){var t;return(t=re(this.getAttribute(b.BACKWARD_SEEK_OFFSET)))!=null?t:10}set backwardSeekOffset(t){this.setAttribute(b.BACKWARD_SEEK_OFFSET,`${t}`)}get defaultHiddenCaptions(){return this.hasAttribute(b.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(t){t?this.setAttribute(b.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(b.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var t;return(t=this.getAttribute(g.Attributes.PLAYER_SOFTWARE_NAME))!=null?t:yl}get playerSoftwareVersion(){var t;return(t=this.getAttribute(g.Attributes.PLAYER_SOFTWARE_VERSION))!=null?t:_l}get beaconCollectionDomain(){var t;return(t=this.getAttribute(g.Attributes.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(g.Attributes.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(g.Attributes.BEACON_COLLECTION_DOMAIN))}get customDomain(){var t;return(t=this.getAttribute(g.Attributes.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(g.Attributes.CUSTOM_DOMAIN,t):this.removeAttribute(g.Attributes.CUSTOM_DOMAIN))}get envKey(){var t;return(t=ge(this,g.Attributes.ENV_KEY))!=null?t:void 0}set envKey(t){this.setAttribute(g.Attributes.ENV_KEY,`${t}`)}get debug(){return ge(this,g.Attributes.DEBUG)!=null}set debug(t){t?this.setAttribute(g.Attributes.DEBUG,""):this.removeAttribute(g.Attributes.DEBUG)}get disableCookies(){return ge(this,g.Attributes.DISABLE_COOKIES)!=null}set disableCookies(t){t?this.setAttribute(g.Attributes.DISABLE_COOKIES,""):this.removeAttribute(g.Attributes.DISABLE_COOKIES)}get streamType(){return ge(this,g.Attributes.STREAM_TYPE)}set streamType(t){this.setAttribute(g.Attributes.STREAM_TYPE,`${t}`)}get startTime(){return re(ge(this,g.Attributes.START_TIME))}set startTime(t){this.setAttribute(g.Attributes.START_TIME,`${t}`)}get preferPlayback(){let t=this.getAttribute(g.Attributes.PREFER_PLAYBACK);if(t===k.PlaybackTypes.MSE||t===k.PlaybackTypes.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===k.PlaybackTypes.MSE||t===k.PlaybackTypes.NATIVE?this.setAttribute(g.Attributes.PREFER_PLAYBACK,t):this.removeAttribute(g.Attributes.PREFER_PLAYBACK))}get metadata(){var t;return(t=this.media)==null?void 0:t.metadata}set metadata(t){if(v(this,xe)||S(this,Xe,yi).call(this),!this.media){J("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...t}}get tokens(){let t=this.getAttribute(b.PLAYBACK_TOKEN),a=this.getAttribute(b.THUMBNAIL_TOKEN),r=this.getAttribute(b.STORYBOARD_TOKEN);return{...v(this,St),...t!=null?{playback:t}:{},...a!=null?{thumbnail:a}:{},...r!=null?{storyboard:r}:{}}}set tokens(t){V(this,St,t!=null?t:{})}get playbackToken(){var t;return(t=this.getAttribute(b.PLAYBACK_TOKEN))!=null?t:void 0}set playbackToken(t){this.setAttribute(b.PLAYBACK_TOKEN,`${t}`)}get thumbnailToken(){var t;return(t=this.getAttribute(b.THUMBNAIL_TOKEN))!=null?t:void 0}set thumbnailToken(t){this.setAttribute(b.THUMBNAIL_TOKEN,`${t}`)}get storyboardToken(){var t;return(t=this.getAttribute(b.STORYBOARD_TOKEN))!=null?t:void 0}set storyboardToken(t){this.setAttribute(b.STORYBOARD_TOKEN,`${t}`)}addTextTrack(t,a,r,n){var l;let s=(l=this.media)==null?void 0:l.nativeEl;if(!!s)return(0,k.addTextTrack)(s,t,a,r,n)}removeTextTrack(t){var r;let a=(r=this.media)==null?void 0:r.nativeEl;if(!!a)return(0,k.removeTextTrack)(a,t)}get textTracks(){var t;return(t=this.media)==null?void 0:t.textTracks}};xe=new WeakMap,St=new WeakMap,de=new WeakMap,Lt=new WeakMap,ze=new WeakMap,te=new WeakMap,Xe=new WeakSet,yi=function(){var t,a;if(!v(this,xe)){V(this,xe,!0),S(this,Ae,Qe).call(this,{playerSize:_i(this)});try{if(customElements.upgrade(this.theme),!(this.theme instanceof D.HTMLElement))throw""}catch{J("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof g.default))throw""}catch{J("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof dt))throw""}catch{J("<media-controller> failed to upgrade!")}Ln(this),S(this,Li,no).call(this),S(this,Ci,oo).call(this),S(this,Si,ro).call(this),V(this,de,(a=(t=this.mediaController)==null?void 0:t.hasAttribute("user-inactive"))!=null?a:!0),S(this,wi,so).call(this)}},Ii=new WeakSet,to=function(){var t,a;try{(t=window==null?void 0:window.CSS)==null||t.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(a=window==null?void 0:window.CSS)==null||a.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},Ae=new WeakSet,Qe=function(t){Object.assign(v(this,te),t),S(this,je,Ti).call(this)},je=new WeakSet,Ti=function(t={}){jn(Jn(fl(this,{...v(this,te),...t})),this.shadowRoot)},Ct=new WeakSet,Fa=function(){var t,a;v(this,te).playerSize!=_i((t=this.mediaController)!=null?t:this)&&S(this,Ae,Qe).call(this,{playerSize:_i((a=this.mediaController)!=null?a:this)})},Mi=new WeakSet,io=function(){var t;V(this,ze,new ResizeObserver(()=>S(this,Ct,Fa).call(this))),v(this,ze).observe((t=this.mediaController)!=null?t:this)},ki=new WeakSet,ao=function(){var t;(t=v(this,ze))==null||t.disconnect()},Si=new WeakSet,ro=function(){var a,r,n,s,l;(a=this.mediaController)==null||a.addEventListener("mediaplayrequest",c=>{var m;((m=c.target)==null?void 0:m.localName)==="media-play-button"&&this.streamType&&[k.StreamTypes.LIVE,k.StreamTypes.LL_LIVE,k.StreamTypes.DVR,k.StreamTypes.LL_DVR].includes(this.streamType)&&this.hasPlayed&&Da(this)});let t=()=>{let c=Tn(this),m=v(this,te).inLiveWindow;c!==m&&(S(this,Ae,Qe).call(this,{inLiveWindow:c}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(r=this.media)==null||r.addEventListener("progress",t),(n=this.media)==null||n.addEventListener("waiting",t),(s=this.media)==null||s.addEventListener("timeupdate",t),(l=this.media)==null||l.addEventListener("emptied",t)},Li=new WeakSet,no=function(){var a;let t=r=>{let{detail:n}=r;if(n instanceof g.MediaError||(n=new g.MediaError(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){pe(n),n.data&&pe(`${n.name} data:`,n.data);return}let{dialog:s,devlog:l}=Ai(n,!window.navigator.onLine,this.playbackId,this.playbackToken);l.message&&ui(l),J(n),n.data&&J(`${n.name} data:`,n.data),S(this,Ae,Qe).call(this,{isDialogOpen:!0,dialog:s})};this.addEventListener("error",t),this.media&&(this.media.errorTranslator=(r={})=>{var s,l,c;if(!((s=this.media)!=null&&s.error))return r;let{devlog:n}=Ai((l=this.media)==null?void 0:l.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!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}}),(a=this.media)==null||a.addEventListener("error",r=>{var s,l;let{detail:n}=r;if(!n){let{message:c,code:m}=(l=(s=this.media)==null?void 0:s.error)!=null?l:{};n=new g.MediaError(c,m)}!(n!=null&&n.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Ci=new WeakSet,oo=function(){var a,r,n,s;let t=()=>S(this,je,Ti).call(this);(r=(a=this.media)==null?void 0:a.textTracks)==null||r.addEventListener("addtrack",t),(s=(n=this.media)==null?void 0:n.textTracks)==null||s.addEventListener("removetrack",t)},wi=new WeakSet,so=function(){var E,f,w;let t=this.mediaController,a=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(a)return;let r,n=new WeakMap,s=()=>this.streamType&&[k.StreamTypes.LIVE,k.StreamTypes.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,l=(T,P,M=!1)=>{if(s())return;Array.from(T&&T.activeCues||[]).forEach(L=>{if(!(!L.snapToLines||L.line<-5||L.line>=0&&L.line<10))if(!P||this.paused){let G=L.text.split(`
|
|
1734
1734
|
`).length,Z=a?-2:-3;this.streamType&&[k.StreamTypes.LIVE,k.StreamTypes.LL_LIVE].includes(this.streamType)&&(Z=a?-1:-2);let ie=Z-G;if(L.line===ie&&!M)return;n.has(L)||n.set(L,L.line),L.line=ie-1,L.line=ie}else setTimeout(()=>{L.line=n.get(L)||"auto"},500)})},c=()=>{var T;l(r,(T=t==null?void 0:t.hasAttribute("user-inactive"))!=null?T:!1)},m=()=>{var M;let P=Array.from(((M=t==null?void 0:t.media)==null?void 0:M.textTracks)||[]).filter(R=>["subtitles","captions"].includes(R.kind)&&R.mode==="showing")[0];P!==r&&(r==null||r.removeEventListener("cuechange",c)),r=P,r==null||r.addEventListener("cuechange",c),l(r,v(this,de))};if(m(),(E=t==null?void 0:t.media)==null||E.textTracks.addEventListener("change",m),(f=t==null?void 0:t.media)==null||f.textTracks.addEventListener("addtrack",m),navigator.userAgent.includes("Chrome/")){let T=()=>{l(r,v(this,de),!0),this.paused||window.requestAnimationFrame(T)};(w=t==null?void 0:t.media)==null||w.addEventListener("playing",()=>{T()})}t==null||t.addEventListener("userinactivechange",()=>{let T=t==null?void 0:t.hasAttribute("user-inactive");v(this,de)!==T&&(V(this,de,T),l(r,v(this,de)))})};function ge(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}D.customElements.get("mux-player")||(D.customElements.define("mux-player",kt),D.MuxPlayerElement=kt);var Tl=kt;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var _e=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var l=(t,a,e)=>(_e(t,a,"read from private field"),e?e.call(t):a.get(t)),c=(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)},k=(t,a,e,i)=>(_e(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var p=(t,a,e)=>(_e(t,a,"access private method"),e);var z=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends z{}globalThis.DocumentFragment=t}var ae=class extends z{},Ne=class extends z{},ea={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(ae)}},ie,Ve=class{constructor(a,e={}){c(this,ie,void 0);k(this,ie,e==null?void 0:e.detail)}get detail(){return l(this,ie)}initCustomEvent(){}};ie=new WeakMap;function ta(t,a){return new ae}var pt={document:{createElement:ta},DocumentFragment,customElements:ea,CustomEvent:Ve,EventTarget:z,HTMLElement:ae,HTMLVideoElement:Ne},bt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",h=bt?pt:globalThis,E=bt?pt.document:globalThis.document;import{MediaController as Ra}from"media-chrome";import Ma,{MediaError as Je,Attributes as u}from"@mux/mux-video";import{StreamTypes as x,PlaybackTypes as we,addTextTrack as Pa,removeTextTrack as Ba,CmcdTypeValues as Ut}from"@mux/playback-core";import{VideoEvents as ua}from"@mux/mux-video";var aa="en",H={code:aa};var ht="en";function d(t,a=!0){var r,o;let e=a&&(o=(r=H)==null?void 0:r[t])!=null?o:t,i=a?H.code:ht;return new $e(e,i)}var $e=class{constructor(a,e=(i=>(i=H.code)!=null?i:ht)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function gt(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${ia(e)}: ${i}; `)}),a?a.trim():void 0}function ia(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ft(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function M(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function be(t){let a=ra(t).toString();return a?"?"+a:""}function ra(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function _(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var He=(t,a)=>!t||!a?!1:t.contains(a)?!0:He(t,a.getRootNode().host);import{StreamTypes as he}from"@mux/playback-core";var Ke="mux.com",oa=()=>{try{return"1.
|
|
2
|
-
${i}${t.file}`}N(a)}var v={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},U={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},St=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}}),ma=ua.filter(t=>t!=="error"),ca=Object.values(v).filter(t=>![v.PLAYSINLINE].includes(t)),pa=Object.values(U);function
|
|
1
|
+
var _e=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var l=(t,a,e)=>(_e(t,a,"read from private field"),e?e.call(t):a.get(t)),c=(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)},k=(t,a,e,i)=>(_e(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var p=(t,a,e)=>(_e(t,a,"access private method"),e);var z=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends z{}globalThis.DocumentFragment=t}var ae=class extends z{},Ne=class extends z{},ea={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(ae)}},ie,Ve=class{constructor(a,e={}){c(this,ie,void 0);k(this,ie,e==null?void 0:e.detail)}get detail(){return l(this,ie)}initCustomEvent(){}};ie=new WeakMap;function ta(t,a){return new ae}var pt={document:{createElement:ta},DocumentFragment,customElements:ea,CustomEvent:Ve,EventTarget:z,HTMLElement:ae,HTMLVideoElement:Ne},bt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",h=bt?pt:globalThis,E=bt?pt.document:globalThis.document;import{MediaController as Ra}from"media-chrome";import Ma,{MediaError as Je,Attributes as u}from"@mux/mux-video";import{StreamTypes as x,PlaybackTypes as we,addTextTrack as Pa,removeTextTrack as Ba,CmcdTypeValues as Ut}from"@mux/playback-core";import{VideoEvents as ua}from"@mux/mux-video";var aa="en",H={code:aa};var ht="en";function d(t,a=!0){var r,o;let e=a&&(o=(r=H)==null?void 0:r[t])!=null?o:t,i=a?H.code:ht;return new $e(e,i)}var $e=class{constructor(a,e=(i=>(i=H.code)!=null?i:ht)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function gt(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${ia(e)}: ${i}; `)}),a?a.trim():void 0}function ia(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ft(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function M(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function be(t){let a=ra(t).toString();return a?"?"+a:""}function ra(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function _(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var He=(t,a)=>!t||!a?!1:t.contains(a)?!0:He(t,a.getRootNode().host);import{StreamTypes as he}from"@mux/playback-core";var Ke="mux.com",oa=()=>{try{return"1.6.0"}catch{}return"UNKNOWN"},na=oa(),fe=()=>na,Fe=(t,{token:a,domain:e=Ke}={})=>`https://stream.${e}/${t}.m3u8${be(!!a?{token:a}:{redundant_streams:!0})}`,kt=(t,{token:a,thumbnailTime:e,domain:i=Ke}={})=>{let r=a==null?e:void 0,{aud:o}=_(a);if(!(a&&o!=="t"))return`https://image.${i}/${t}/thumbnail.webp${be({token:a,time:r})}`},Et=(t,{token:a,domain:e=Ke}={})=>{let{aud:i}=_(a);if(!(a&&i!=="s"))return`https://image.${e}/${t}/storyboard.vtt${be({token:a,format:"webp"})}`};var sa={crossorigin:"crossOrigin",playsinline:"playsInline"};function Tt(t){var a;return(a=sa[t])!=null?a:ft(t)}var At=t=>{var e,i;let{media:a}=t;return(i=(e=a==null?void 0:a._hls)==null?void 0:e.liveSyncPosition)!=null?i:a!=null&&a.seekable.length?a==null?void 0:a.seekable.end(a.seekable.length-1):void 0},Ue=t=>{let a=At(t);if(a==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}t.currentTime=a},la=1,da=5,yt=3,vt=.5,xt=t=>{var o;let{streamType:a}=t,e=At(t),i=(o=t.media)==null?void 0:o.currentTime;if(e==null||i==null)return!1;let r=e-i;return a===he.LL_LIVE||a===he.LL_DVR?r<=la*(yt+vt):a===he.LIVE||a===he.DVR?r<=da*(yt+vt):!1},K,F,T,ge=class{constructor(a,e){c(this,K,void 0);c(this,F,void 0);c(this,T,[]);k(this,K,a),k(this,F,e)}[Symbol.iterator](){return l(this,T).values()}get length(){return l(this,T).length}get value(){var a;return(a=l(this,T).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(k(this,T,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return l(this,T)[a]}values(){return l(this,T).values()}keys(){return l(this,T).keys()}forEach(a){l(this,T).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||l(this,T).push(r)}),!(this.value===""&&!((e=l(this,K))!=null&&e.hasAttribute(`${l(this,F)}`)))&&((i=l(this,K))==null||i.setAttribute(`${l(this,F)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{l(this,T).splice(l(this,T).indexOf(i),1)}),(e=l(this,K))==null||e.setAttribute(`${l(this,F)}`,`${this.value}`)}contains(a){return l(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)}};K=new WeakMap,F=new WeakMap,T=new WeakMap;var wt=`[mux-player ${fe()}]`;function N(...t){console.warn(wt,...t)}function L(...t){console.error(wt,...t)}function ye(t){var e;let a=(e=t.message)!=null?e:"";if(t.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${d("Read more: ")}
|
|
2
|
+
${i}${t.file}`}N(a)}var v={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},U={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},St=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}}),ma=ua.filter(t=>t!=="error"),ca=Object.values(v).filter(t=>![v.PLAYSINLINE].includes(t)),pa=Object.values(U);function Ot(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),ma.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,i=>{t.dispatchEvent(new Event(i.type))})})}var Ye=class extends h.HTMLElement{static get observedAttributes(){return[...ca,...pa]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(i=>{var r;(r=this.media)==null||r.append(i.cloneNode())});let a=i=>{for(let r of i)r.type==="childList"&&(r.removedNodes.forEach(o=>{var m,b;let n=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);n&&((b=this.media)==null||b.removeChild(n))}),r.addedNodes.forEach(o=>{var n;(n=this.media)==null||n.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,i){var r,o;switch(a){case U.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case U.VOLUME:{let n=(r=M(i))!=null?r:1;this.media&&(this.media.volume=n);return}case U.PLAYBACKRATE:{let n=(o=M(i))!=null?o:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:St}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:St}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=M(this.getAttribute(U.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(U.PLAYBACKRATE,`${a}`):this.removeAttribute(U.PLAYBACKRATE)}get crossOrigin(){return re(this,v.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(v.CROSSORIGIN,`${a}`)}get autoplay(){return re(this,v.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(v.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(v.AUTOPLAY)}get loop(){return re(this,v.LOOP)!=null}set loop(a){a?this.setAttribute(v.LOOP,""):this.removeAttribute(v.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return re(this,v.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(v.MUTED,""):this.removeAttribute(v.MUTED)}get playsInline(){return re(this,v.PLAYSINLINE)!=null}set playsInline(a){L("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(v.PRELOAD,a):this.removeAttribute(v.PRELOAD)}};function re(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ze=Ye;import"media-chrome/dist/media-theme-element.js";var Rt=`
|
|
3
3
|
:host {
|
|
4
4
|
cursor: pointer;
|
|
5
5
|
}
|
|
@@ -11,7 +11,7 @@ ${i}${t.file}`}N(a)}var v={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"l
|
|
|
11
11
|
${Rt}
|
|
12
12
|
</style>
|
|
13
13
|
<media-time-display show-duration></media-time-display>
|
|
14
|
-
`;var
|
|
14
|
+
`;var Ct=["Enter"," "],oe,j,ve,q=class extends h.HTMLElement{constructor(){var e,i;super();c(this,j);c(this,oe,void 0);this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(i=this.shadowRoot)==null?void 0:i.querySelector("media-time-display")}static get observedAttributes(){return["hide-duration","remaining","disabled","aria-disabled"]}toggleTimeDisplay(){var e,i,r;(e=this.timeDisplayEl)!=null&&e.hasAttribute("remaining")?(i=this.timeDisplayEl)==null||i.removeAttribute("remaining"):(r=this.timeDisplayEl)==null||r.setAttribute("remaining","")}connectedCallback(){let e=i=>{let{key:r}=i;if(!Ct.includes(r)){this.removeEventListener("keyup",e);return}this.toggleTimeDisplay()};this.addEventListener("keydown",i=>{let{metaKey:r,altKey:o,key:n}=i;if(r||o||!Ct.includes(n)){this.removeEventListener("keyup",e);return}this.addEventListener("keyup",e)}),this.addEventListener("click",this.toggleTimeDisplay),k(this,oe,setInterval(p(this,j,ve).bind(this),200)),requestAnimationFrame(()=>p(this,j,ve).call(this))}disconnectedCallback(){clearInterval(l(this,oe))}attributeChangedCallback(e,i,r){var o,n;e==="hide-duration"&&p(this,j,ve).call(this),["remaining","disabled","aria-disabled"].includes(e)&&i!==r&&(r==null?(o=this.timeDisplayEl)==null||o.removeAttribute(e):(n=this.timeDisplayEl)==null||n.setAttribute(e,r))}};oe=new WeakMap,j=new WeakSet,ve=function(){var i,r,o,n;getComputedStyle(this).getPropertyValue("--media-duration-display").trim()==="none"||this.getAttribute("hide-duration")!=null?(i=this.timeDisplayEl)!=null&&i.hasAttribute("show-duration")&&((r=this.timeDisplayEl)==null||r.removeAttribute("show-duration")):(o=this.timeDisplayEl)!=null&&o.hasAttribute("show-duration")||(n=this.timeDisplayEl)==null||n.setAttribute("show-duration","")},q.styles=Rt,q.template=Mt;h.customElements.get("mxp-time-display")||(h.customElements.define("mxp-time-display",q),h.MxpTimeDisplay=q);var Pt=`:host {
|
|
15
15
|
display: inline-block;
|
|
16
16
|
width: 100%;
|
|
17
17
|
}
|
|
@@ -913,14 +913,14 @@ a {
|
|
|
913
913
|
<style>
|
|
914
914
|
${Pt}
|
|
915
915
|
</style>
|
|
916
|
-
${
|
|
917
|
-
`,je=t=>[G.LIVE,G.LL_LIVE].includes(t.streamType),Ge=t=>[G.LIVE,G.LL_LIVE,G.DVR,G.LL_DVR].includes(t.streamType),Sa=t=>{let a="";return t.audio&&(a+="audio "),je(t)?a+="live":Ge(t)?a+="dvr":a+=t.streamType||"on-demand",!t.audio&&t.playerSize&&(a+=` ${t.playerSize}`),a},
|
|
916
|
+
${Ca(t)}
|
|
917
|
+
`,je=t=>[G.LIVE,G.LL_LIVE].includes(t.streamType),Ge=t=>[G.LIVE,G.LL_LIVE,G.DVR,G.LL_DVR].includes(t.streamType),Sa=t=>{let a="";return t.audio&&(a+="audio "),je(t)?a+="live":Ge(t)?a+="dvr":a+=t.streamType||"on-demand",!t.audio&&t.playerSize&&(a+=` ${t.playerSize}`),a},Oa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return Ge(t)&&(a+=" noarrowleft noarrowright"),a},Ca=t=>{var a,e,i,r,o,n,m,b,f,A,D,I,g,O,C,R,y,pe,te,W,et,tt,at,it,rt,ot,nt,st,lt,dt,ut,mt;return w`
|
|
918
918
|
<media-theme
|
|
919
919
|
template="${(a=t.theme)!=null?a:qe.content.children[0]}"
|
|
920
920
|
class="size-${t.playerSize}${t.secondaryColor?" two-tone":""}"
|
|
921
921
|
player-size="${(e=t.playerSize)!=null?e:!1}"
|
|
922
922
|
layout="${Sa(t)}"
|
|
923
|
-
hotkeys="${
|
|
923
|
+
hotkeys="${Oa(t)||!1}"
|
|
924
924
|
nohotkeys="${t.noHotKeys||!t.hasSrc||t.isDialogOpen||!1}"
|
|
925
925
|
disabled="${!t.hasSrc||t.isDialogOpen}"
|
|
926
926
|
audio="${(i=t.audio)!=null?i:!1}"
|
|
@@ -940,8 +940,8 @@ a {
|
|
|
940
940
|
crossorigin="${(I=t.crossOrigin)!=null?I:""}"
|
|
941
941
|
playsinline
|
|
942
942
|
autoplay="${(g=t.autoplay)!=null?g:!1}"
|
|
943
|
-
muted="${(
|
|
944
|
-
loop="${(
|
|
943
|
+
muted="${(O=t.muted)!=null?O:!1}"
|
|
944
|
+
loop="${(C=t.loop)!=null?C:!1}"
|
|
945
945
|
preload="${(R=t.preload)!=null?R:!1}"
|
|
946
946
|
debug="${(y=t.debug)!=null?y:!1}"
|
|
947
947
|
prefer-cmcd="${(pe=t.preferCmcd)!=null?pe:!1}"
|
|
@@ -991,5 +991,5 @@ a {
|
|
|
991
991
|
</p>
|
|
992
992
|
</mxp-dialog>
|
|
993
993
|
</media-theme>
|
|
994
|
-
`};import{MediaError as Ae}from"@mux/mux-video";function xe(t,a,e,i,r){var m,b,f;let o={},n={};switch(t.code){case Ae.MEDIA_ERR_NETWORK:{switch(o.title=d("Network Error",r),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=d("Video is not currently available",r),o.message=d("The live stream or video file are not yet ready.",r),n.message=d("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),n.file="412-not-playable.md";break}case 404:{o.title=d("Video does not exist",r),o.message="",n.message=d("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),n.file="404-not-found.md";break}case 403:{if(o.title=d("Invalid playback URL",r),o.message=d("The video URL or playback-token are formatted with incorrect or incomplete information.",r),n.message=d("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),n.file="missing-signed-tokens.md",!i)break;let{exp:A,aud:D,sub:I}=_(i),g=Date.now()>A*1e3,C=I!==e,O=D!=="v",R={timeStyle:"medium",dateStyle:"medium"};if(g){o.title=d("Video URL has expired",r),o.message=d("The video\u2019s secured playback-token has expired.",r),n.message=d("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(H.code,R).format(A*1e3),currentDate:new Intl.DateTimeFormat(H.code,R).format(Date.now())}),n.file="403-expired-token.md";break}if(C){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),n.message=d("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:e,tokenPlaybackId:I}),n.file="403-playback-id-mismatch.md";break}if(O){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The playback-token is formatted with incorrect information.",r),n.message=d("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:D}),n.file="403-incorrect-aud-value.md";break}n.message=d("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),n.file="403-malformatted-token.md";break}}break}case Ae.MEDIA_ERR_DECODE:{let{message:A}=t;o={title:d("Media Error",r),message:A},n.file="media-decode-error.md";break}case Ae.MEDIA_ERR_SRC_NOT_SUPPORTED:{let A=(f=(b=t.data)==null?void 0:b.response)==null?void 0:f.code;if(A>=400&&A<500){t.code=Ae.MEDIA_ERR_NETWORK,t.data={response:{code:A}},{dialog:o,devlog:n}=xe(t,a,e,i);break}o={title:d("Source Not Supported",r),message:t.message},n.file="media-src-not-supported.md";break}default:o={title:d("Error",r),message:t.message};break}return a&&(o={title:d("Your device appears to be offline",r),message:d("Check your internet connection and try reloading this video.",r)}),{dialog:o,devlog:n}}var Da=Object.values(x),Ia=700,_a=300,Xe={LG:"large",SM:"small",XS:"extra-small"};function Le(t){let a=t.getBoundingClientRect();return a.width<_a?Xe.XS:a.width<Ia?Xe.SM:Xe.LG}var P={SRC:"src",POSTER:"poster"},s={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function Na(t,a){var i,r;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,placeholder:t.getAttribute("placeholder"),theme:t.getAttribute("theme"),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(s.NOHOTKEYS),hotKeys:t.getAttribute(s.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,streamType:t.streamType,primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultShowRemainingTime:t.defaultShowRemainingTime,playbackRates:t.getAttribute(s.PLAYBACK_RATES),customDomain:(i=t.getAttribute(u.CUSTOM_DOMAIN))!=null?i:void 0,playerSize:Le((r=t.mediaController)!=null?r:t),title:t.getAttribute(s.TITLE),...a}}var Va=Object.values(u),$a=Object.values(P),Ha=Object.values(s),Ka=fe(),Fa="mux-player",Yt={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},Z,ue,B,me,X,S,Q,Se,Oe,Zt,$,J,ee,Ce,ce,Qe,Re,Wt,Me,zt,Pe,qt,Be,jt,De,Gt,Ie,Jt,de=class extends Ze{constructor(){super();c(this,Q);c(this,Oe);c(this,$);c(this,ee);c(this,ce);c(this,Re);c(this,Me);c(this,Pe);c(this,Be);c(this,De);c(this,Ie);c(this,Z,!1);c(this,ue,{});c(this,B,!0);c(this,me,new ge(this,"hotkeys"));c(this,X,void 0);c(this,S,{...Yt,onCloseErrorDialog:()=>p(this,$,J).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{He(this,E.activeElement)||e.preventDefault()},onSeekToLive:()=>Ue(this)});this.attachShadow({mode:"open"}),p(this,Oe,Zt).call(this),this.isConnected&&p(this,Q,Se).call(this)}static get observedAttributes(){var e;return[...(e=Ze.observedAttributes)!=null?e:[],...$a,...Va,...Ha]}get theme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.theme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=this.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},{})}connectedCallback(){var i;p(this,ce,Qe).call(this);let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=this.metadataFromAttrs),p(this,Re,Wt).call(this)}disconnectedCallback(){p(this,Me,zt).call(this)}attributeChangedCallback(e,i,r){switch(l(this,Z)||p(this,Q,Se).call(this),super.attributeChangedCallback(e,i,r),e){case s.HOTKEYS:l(this,me).value=r;break;case s.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&N(d("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case s.THUMBNAIL_TOKEN:{let{aud:n}=_(r);r&&n!=="t"&&N(d("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:n}));break}case s.STORYBOARD_TOKEN:{let{aud:n}=_(r);r&&n!=="s"&&N(d("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:n}));break}case u.PLAYBACK_ID:{r!=null&&r.includes("?token")&&L(d("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!Da.includes(this.streamType)&&ye({file:"invalid-stream-type.md",message:d("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):ye({file:"invalid-stream-type.md",message:String(d("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[u.PLAYBACK_ID,P.SRC,s.PLAYBACK_TOKEN].includes(e)&&i!==r&&k(this,S,{...l(this,S),...Yt}),p(this,ee,Ce).call(this,{[Tt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(u.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ut.includes(e)?this.setAttribute(u.PREFER_CMCD,e):N(`Invalid value for preferCmcd. Must be one of ${Ut.join()}`):this.removeAttribute(u.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?i:!1}get inLiveWindow(){return l(this,S).inLiveWindow}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 playbackId(){var e;return(e=this.getAttribute(u.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(u.PLAYBACK_ID,e):this.removeAttribute(u.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=Y(this,P.SRC))!=null?e:void 0:(i=this.getAttribute(P.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(P.SRC,e):this.removeAttribute(P.SRC)}get poster(){var i;let e=this.getAttribute(P.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return kt(this.playbackId,{domain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(P.POSTER,e):this.removeAttribute(P.POSTER)}get storyboard(){if(this.playbackId&&!this.audio&&(!this.streamType||![x.LIVE,x.LL_LIVE,x.DVR,x.LL_DVR].includes(this.streamType)))return Et(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(s.AUDIO)}set audio(e){if(!e){this.removeAttribute(s.AUDIO);return}this.setAttribute(s.AUDIO,"")}get hotkeys(){return l(this,me)}get nohotkeys(){return this.hasAttribute(s.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(s.NOHOTKEYS);return}this.setAttribute(s.NOHOTKEYS,"")}get thumbnailTime(){return M(this.getAttribute(s.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(s.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(s.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(s.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Y(this,s.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(s.PLACEHOLDER,`${e}`)}get primaryColor(){var e;return(e=this.getAttribute(s.PRIMARY_COLOR))!=null?e:void 0}set primaryColor(e){this.setAttribute(s.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e;return(e=this.getAttribute(s.SECONDARY_COLOR))!=null?e:"rgb(0 0 0 / .65)"}set secondaryColor(e){this.setAttribute(s.SECONDARY_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(s.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(s.PLAYBACK_RATES))return this.getAttribute(s.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(s.PLAYBACK_RATES);return}this.setAttribute(s.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=M(this.getAttribute(s.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(s.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=M(this.getAttribute(s.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(s.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(s.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_NAME))!=null?e:Fa}get playerSoftwareVersion(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_VERSION))!=null?e:Ka}get beaconCollectionDomain(){var e;return(e=this.getAttribute(u.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(u.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(u.BEACON_COLLECTION_DOMAIN))}get customDomain(){var e;return(e=this.getAttribute(u.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(u.CUSTOM_DOMAIN,e):this.removeAttribute(u.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Y(this,u.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(u.ENV_KEY,`${e}`)}get debug(){return Y(this,u.DEBUG)!=null}set debug(e){e?this.setAttribute(u.DEBUG,""):this.removeAttribute(u.DEBUG)}get disableCookies(){return Y(this,u.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(u.DISABLE_COOKIES,""):this.removeAttribute(u.DISABLE_COOKIES)}get streamType(){return Y(this,u.STREAM_TYPE)}set streamType(e){this.setAttribute(u.STREAM_TYPE,`${e}`)}get startTime(){return M(Y(this,u.START_TIME))}set startTime(e){this.setAttribute(u.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(u.PREFER_PLAYBACK);if(e===we.MSE||e===we.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===we.MSE||e===we.NATIVE?this.setAttribute(u.PREFER_PLAYBACK,e):this.removeAttribute(u.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(l(this,Z)||p(this,Q,Se).call(this),!this.media){L("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...e}}get tokens(){let e=this.getAttribute(s.PLAYBACK_TOKEN),i=this.getAttribute(s.THUMBNAIL_TOKEN),r=this.getAttribute(s.STORYBOARD_TOKEN);return{...l(this,ue),...e!=null?{playback:e}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(e){k(this,ue,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(s.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(s.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(s.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(s.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(s.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(s.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,o){var m;let n=(m=this.media)==null?void 0:m.nativeEl;if(!!n)return Pa(n,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(!!i)return Ba(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};Z=new WeakMap,ue=new WeakMap,B=new WeakMap,me=new WeakMap,X=new WeakMap,S=new WeakMap,Q=new WeakSet,Se=function(){var e,i;if(!l(this,Z)){k(this,Z,!0),p(this,$,J).call(this,{playerSize:Le(this)});try{if(customElements.upgrade(this.theme),!(this.theme instanceof h.HTMLElement))throw""}catch{L("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Ma))throw""}catch{L("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ra))throw""}catch{L("<media-controller> failed to upgrade!")}Ct(this),p(this,Be,jt).call(this),p(this,De,Gt).call(this),p(this,Pe,qt).call(this),k(this,B,(i=(e=this.mediaController)==null?void 0:e.hasAttribute("user-inactive"))!=null?i:!0),p(this,Ie,Jt).call(this)}},Oe=new WeakSet,Zt=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},$=new WeakSet,J=function(e){Object.assign(l(this,S),e),p(this,ee,Ce).call(this)},ee=new WeakSet,Ce=function(e={}){Kt(Ft(Na(this,{...l(this,S),...e})),this.shadowRoot)},ce=new WeakSet,Qe=function(){var e,i;l(this,S).playerSize!=Le((e=this.mediaController)!=null?e:this)&&p(this,$,J).call(this,{playerSize:Le((i=this.mediaController)!=null?i:this)})},Re=new WeakSet,Wt=function(){var e;k(this,X,new ResizeObserver(()=>p(this,ce,Qe).call(this))),l(this,X).observe((e=this.mediaController)!=null?e:this)},Me=new WeakSet,zt=function(){var e;(e=l(this,X))==null||e.disconnect()},Pe=new WeakSet,qt=function(){var i,r,o,n,m;(i=this.mediaController)==null||i.addEventListener("mediaplayrequest",b=>{var f;((f=b.target)==null?void 0:f.localName)==="media-play-button"&&this.streamType&&[x.LIVE,x.LL_LIVE,x.DVR,x.LL_DVR].includes(this.streamType)&&this.hasPlayed&&Ue(this)});let e=()=>{let b=xt(this),f=l(this,S).inLiveWindow;b!==f&&(p(this,$,J).call(this,{inLiveWindow:b}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(r=this.media)==null||r.addEventListener("progress",e),(o=this.media)==null||o.addEventListener("waiting",e),(n=this.media)==null||n.addEventListener("timeupdate",e),(m=this.media)==null||m.addEventListener("emptied",e)},Be=new WeakSet,jt=function(){var i;let e=r=>{let{detail:o}=r;if(o instanceof Je||(o=new Je(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){N(o),o.data&&N(`${o.name} data:`,o.data);return}let{dialog:n,devlog:m}=xe(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&ye(m),L(o),o.data&&L(`${o.name} data:`,o.data),p(this,$,J).call(this,{isDialogOpen:!0,dialog:n})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var n,m,b;if(!((n=this.media)!=null&&n.error))return r;let{devlog:o}=xe((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(b=this.media)==null?void 0:b.error.code,player_error_message:o.message?String(o.message):r.player_error_message}}),(i=this.media)==null||i.addEventListener("error",r=>{var n,m;let{detail:o}=r;if(!o){let{message:b,code:f}=(m=(n=this.media)==null?void 0:n.error)!=null?m:{};o=new Je(b,f)}!(o!=null&&o.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:o}))})},De=new WeakSet,Gt=function(){var i,r,o,n;let e=()=>p(this,ee,Ce).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(n=(o=this.media)==null?void 0:o.textTracks)==null||n.addEventListener("removetrack",e)},Ie=new WeakSet,Jt=function(){var A,D,I;let e=this.mediaController,i=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(i)return;let r,o=new WeakMap,n=()=>this.streamType&&[x.LIVE,x.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,m=(g,C,O=!1)=>{if(n())return;Array.from(g&&g.activeCues||[]).forEach(y=>{if(!(!y.snapToLines||y.line<-5||y.line>=0&&y.line<10))if(!C||this.paused){let pe=y.text.split(`
|
|
995
|
-
`).length,te=i?-2:-3;this.streamType&&[x.LIVE,x.LL_LIVE].includes(this.streamType)&&(te=i?-1:-2);let W=te-pe;if(y.line===W&&!
|
|
994
|
+
`};import{MediaError as Ae}from"@mux/mux-video";function xe(t,a,e,i,r){var m,b,f;let o={},n={};switch(t.code){case Ae.MEDIA_ERR_NETWORK:{switch(o.title=d("Network Error",r),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=d("Video is not currently available",r),o.message=d("The live stream or video file are not yet ready.",r),n.message=d("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),n.file="412-not-playable.md";break}case 404:{o.title=d("Video does not exist",r),o.message="",n.message=d("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),n.file="404-not-found.md";break}case 403:{if(o.title=d("Invalid playback URL",r),o.message=d("The video URL or playback-token are formatted with incorrect or incomplete information.",r),n.message=d("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),n.file="missing-signed-tokens.md",!i)break;let{exp:A,aud:D,sub:I}=_(i),g=Date.now()>A*1e3,O=I!==e,C=D!=="v",R={timeStyle:"medium",dateStyle:"medium"};if(g){o.title=d("Video URL has expired",r),o.message=d("The video\u2019s secured playback-token has expired.",r),n.message=d("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(H.code,R).format(A*1e3),currentDate:new Intl.DateTimeFormat(H.code,R).format(Date.now())}),n.file="403-expired-token.md";break}if(O){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),n.message=d("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:e,tokenPlaybackId:I}),n.file="403-playback-id-mismatch.md";break}if(C){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The playback-token is formatted with incorrect information.",r),n.message=d("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:D}),n.file="403-incorrect-aud-value.md";break}n.message=d("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),n.file="403-malformatted-token.md";break}}break}case Ae.MEDIA_ERR_DECODE:{let{message:A}=t;o={title:d("Media Error",r),message:A},n.file="media-decode-error.md";break}case Ae.MEDIA_ERR_SRC_NOT_SUPPORTED:{let A=(f=(b=t.data)==null?void 0:b.response)==null?void 0:f.code;if(A>=400&&A<500){t.code=Ae.MEDIA_ERR_NETWORK,t.data={response:{code:A}},{dialog:o,devlog:n}=xe(t,a,e,i);break}o={title:d("Source Not Supported",r),message:t.message},n.file="media-src-not-supported.md";break}default:o={title:d("Error",r),message:t.message};break}return a&&(o={title:d("Your device appears to be offline",r),message:d("Check your internet connection and try reloading this video.",r)}),{dialog:o,devlog:n}}var Da=Object.values(x),Ia=700,_a=300,Xe={LG:"large",SM:"small",XS:"extra-small"};function Le(t){let a=t.getBoundingClientRect();return a.width<_a?Xe.XS:a.width<Ia?Xe.SM:Xe.LG}var P={SRC:"src",POSTER:"poster"},s={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function Na(t,a){var i,r;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(s.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),theme:t.getAttribute("theme"),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(s.NOHOTKEYS),hotKeys:t.getAttribute(s.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,streamType:t.streamType,primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultShowRemainingTime:t.defaultShowRemainingTime,playbackRates:t.getAttribute(s.PLAYBACK_RATES),customDomain:(i=t.getAttribute(u.CUSTOM_DOMAIN))!=null?i:void 0,playerSize:Le((r=t.mediaController)!=null?r:t),title:t.getAttribute(s.TITLE),...a}}var Va=Object.values(u),$a=Object.values(P),Ha=Object.values(s),Ka=fe(),Fa="mux-player",Yt={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},Z,ue,B,me,X,S,Q,Se,Ce,Zt,$,J,ee,Oe,ce,Qe,Re,Wt,Me,zt,Pe,qt,Be,jt,De,Gt,Ie,Jt,de=class extends Ze{constructor(){super();c(this,Q);c(this,Ce);c(this,$);c(this,ee);c(this,ce);c(this,Re);c(this,Me);c(this,Pe);c(this,Be);c(this,De);c(this,Ie);c(this,Z,!1);c(this,ue,{});c(this,B,!0);c(this,me,new ge(this,"hotkeys"));c(this,X,void 0);c(this,S,{...Yt,onCloseErrorDialog:()=>p(this,$,J).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{He(this,E.activeElement)||e.preventDefault()},onSeekToLive:()=>Ue(this)});this.attachShadow({mode:"open"}),p(this,Ce,Zt).call(this),this.isConnected&&p(this,Q,Se).call(this)}static get observedAttributes(){var e;return[...(e=Ze.observedAttributes)!=null?e:[],...$a,...Va,...Ha]}get theme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.theme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=this.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},{})}connectedCallback(){var i;p(this,ce,Qe).call(this);let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=this.metadataFromAttrs),p(this,Re,Wt).call(this)}disconnectedCallback(){p(this,Me,zt).call(this)}attributeChangedCallback(e,i,r){switch(l(this,Z)||p(this,Q,Se).call(this),super.attributeChangedCallback(e,i,r),e){case s.HOTKEYS:l(this,me).value=r;break;case s.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&N(d("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case s.THUMBNAIL_TOKEN:{let{aud:n}=_(r);r&&n!=="t"&&N(d("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:n}));break}case s.STORYBOARD_TOKEN:{let{aud:n}=_(r);r&&n!=="s"&&N(d("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:n}));break}case u.PLAYBACK_ID:{r!=null&&r.includes("?token")&&L(d("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!Da.includes(this.streamType)&&ye({file:"invalid-stream-type.md",message:d("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):ye({file:"invalid-stream-type.md",message:String(d("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[u.PLAYBACK_ID,P.SRC,s.PLAYBACK_TOKEN].includes(e)&&i!==r&&k(this,S,{...l(this,S),...Yt}),p(this,ee,Oe).call(this,{[Tt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(u.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ut.includes(e)?this.setAttribute(u.PREFER_CMCD,e):N(`Invalid value for preferCmcd. Must be one of ${Ut.join()}`):this.removeAttribute(u.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?i:!1}get inLiveWindow(){return l(this,S).inLiveWindow}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 playbackId(){var e;return(e=this.getAttribute(u.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(u.PLAYBACK_ID,e):this.removeAttribute(u.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=Y(this,P.SRC))!=null?e:void 0:(i=this.getAttribute(P.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(P.SRC,e):this.removeAttribute(P.SRC)}get poster(){var i;let e=this.getAttribute(P.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return kt(this.playbackId,{domain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(P.POSTER,e):this.removeAttribute(P.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(s.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(s.STORYBOARD_SRC,e):this.removeAttribute(s.STORYBOARD_SRC)}get storyboard(){if(!this.audio&&(!this.streamType||![x.LIVE,x.LL_LIVE,x.DVR,x.LL_DVR].includes(this.streamType))){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(this.playbackId)return Et(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}}get audio(){return this.hasAttribute(s.AUDIO)}set audio(e){if(!e){this.removeAttribute(s.AUDIO);return}this.setAttribute(s.AUDIO,"")}get hotkeys(){return l(this,me)}get nohotkeys(){return this.hasAttribute(s.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(s.NOHOTKEYS);return}this.setAttribute(s.NOHOTKEYS,"")}get thumbnailTime(){return M(this.getAttribute(s.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(s.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(s.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(s.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Y(this,s.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(s.PLACEHOLDER,`${e}`)}get primaryColor(){var e;return(e=this.getAttribute(s.PRIMARY_COLOR))!=null?e:void 0}set primaryColor(e){this.setAttribute(s.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e;return(e=this.getAttribute(s.SECONDARY_COLOR))!=null?e:"rgb(0 0 0 / .65)"}set secondaryColor(e){this.setAttribute(s.SECONDARY_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(s.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(s.PLAYBACK_RATES))return this.getAttribute(s.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(s.PLAYBACK_RATES);return}this.setAttribute(s.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=M(this.getAttribute(s.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(s.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=M(this.getAttribute(s.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(s.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(s.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_NAME))!=null?e:Fa}get playerSoftwareVersion(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_VERSION))!=null?e:Ka}get beaconCollectionDomain(){var e;return(e=this.getAttribute(u.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(u.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(u.BEACON_COLLECTION_DOMAIN))}get customDomain(){var e;return(e=this.getAttribute(u.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(u.CUSTOM_DOMAIN,e):this.removeAttribute(u.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Y(this,u.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(u.ENV_KEY,`${e}`)}get debug(){return Y(this,u.DEBUG)!=null}set debug(e){e?this.setAttribute(u.DEBUG,""):this.removeAttribute(u.DEBUG)}get disableCookies(){return Y(this,u.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(u.DISABLE_COOKIES,""):this.removeAttribute(u.DISABLE_COOKIES)}get streamType(){return Y(this,u.STREAM_TYPE)}set streamType(e){this.setAttribute(u.STREAM_TYPE,`${e}`)}get startTime(){return M(Y(this,u.START_TIME))}set startTime(e){this.setAttribute(u.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(u.PREFER_PLAYBACK);if(e===we.MSE||e===we.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===we.MSE||e===we.NATIVE?this.setAttribute(u.PREFER_PLAYBACK,e):this.removeAttribute(u.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(l(this,Z)||p(this,Q,Se).call(this),!this.media){L("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...e}}get tokens(){let e=this.getAttribute(s.PLAYBACK_TOKEN),i=this.getAttribute(s.THUMBNAIL_TOKEN),r=this.getAttribute(s.STORYBOARD_TOKEN);return{...l(this,ue),...e!=null?{playback:e}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(e){k(this,ue,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(s.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(s.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(s.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(s.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(s.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(s.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,o){var m;let n=(m=this.media)==null?void 0:m.nativeEl;if(!!n)return Pa(n,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(!!i)return Ba(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};Z=new WeakMap,ue=new WeakMap,B=new WeakMap,me=new WeakMap,X=new WeakMap,S=new WeakMap,Q=new WeakSet,Se=function(){var e,i;if(!l(this,Z)){k(this,Z,!0),p(this,$,J).call(this,{playerSize:Le(this)});try{if(customElements.upgrade(this.theme),!(this.theme instanceof h.HTMLElement))throw""}catch{L("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Ma))throw""}catch{L("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ra))throw""}catch{L("<media-controller> failed to upgrade!")}Ot(this),p(this,Be,jt).call(this),p(this,De,Gt).call(this),p(this,Pe,qt).call(this),k(this,B,(i=(e=this.mediaController)==null?void 0:e.hasAttribute("user-inactive"))!=null?i:!0),p(this,Ie,Jt).call(this)}},Ce=new WeakSet,Zt=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},$=new WeakSet,J=function(e){Object.assign(l(this,S),e),p(this,ee,Oe).call(this)},ee=new WeakSet,Oe=function(e={}){Kt(Ft(Na(this,{...l(this,S),...e})),this.shadowRoot)},ce=new WeakSet,Qe=function(){var e,i;l(this,S).playerSize!=Le((e=this.mediaController)!=null?e:this)&&p(this,$,J).call(this,{playerSize:Le((i=this.mediaController)!=null?i:this)})},Re=new WeakSet,Wt=function(){var e;k(this,X,new ResizeObserver(()=>p(this,ce,Qe).call(this))),l(this,X).observe((e=this.mediaController)!=null?e:this)},Me=new WeakSet,zt=function(){var e;(e=l(this,X))==null||e.disconnect()},Pe=new WeakSet,qt=function(){var i,r,o,n,m;(i=this.mediaController)==null||i.addEventListener("mediaplayrequest",b=>{var f;((f=b.target)==null?void 0:f.localName)==="media-play-button"&&this.streamType&&[x.LIVE,x.LL_LIVE,x.DVR,x.LL_DVR].includes(this.streamType)&&this.hasPlayed&&Ue(this)});let e=()=>{let b=xt(this),f=l(this,S).inLiveWindow;b!==f&&(p(this,$,J).call(this,{inLiveWindow:b}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(r=this.media)==null||r.addEventListener("progress",e),(o=this.media)==null||o.addEventListener("waiting",e),(n=this.media)==null||n.addEventListener("timeupdate",e),(m=this.media)==null||m.addEventListener("emptied",e)},Be=new WeakSet,jt=function(){var i;let e=r=>{let{detail:o}=r;if(o instanceof Je||(o=new Je(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){N(o),o.data&&N(`${o.name} data:`,o.data);return}let{dialog:n,devlog:m}=xe(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&ye(m),L(o),o.data&&L(`${o.name} data:`,o.data),p(this,$,J).call(this,{isDialogOpen:!0,dialog:n})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var n,m,b;if(!((n=this.media)!=null&&n.error))return r;let{devlog:o}=xe((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(b=this.media)==null?void 0:b.error.code,player_error_message:o.message?String(o.message):r.player_error_message}}),(i=this.media)==null||i.addEventListener("error",r=>{var n,m;let{detail:o}=r;if(!o){let{message:b,code:f}=(m=(n=this.media)==null?void 0:n.error)!=null?m:{};o=new Je(b,f)}!(o!=null&&o.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:o}))})},De=new WeakSet,Gt=function(){var i,r,o,n;let e=()=>p(this,ee,Oe).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(n=(o=this.media)==null?void 0:o.textTracks)==null||n.addEventListener("removetrack",e)},Ie=new WeakSet,Jt=function(){var A,D,I;let e=this.mediaController,i=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(i)return;let r,o=new WeakMap,n=()=>this.streamType&&[x.LIVE,x.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,m=(g,O,C=!1)=>{if(n())return;Array.from(g&&g.activeCues||[]).forEach(y=>{if(!(!y.snapToLines||y.line<-5||y.line>=0&&y.line<10))if(!O||this.paused){let pe=y.text.split(`
|
|
995
|
+
`).length,te=i?-2:-3;this.streamType&&[x.LIVE,x.LL_LIVE].includes(this.streamType)&&(te=i?-1:-2);let W=te-pe;if(y.line===W&&!C)return;o.has(y)||o.set(y,y.line),y.line=W-1,y.line=W}else setTimeout(()=>{y.line=o.get(y)||"auto"},500)})},b=()=>{var g;m(r,(g=e==null?void 0:e.hasAttribute("user-inactive"))!=null?g:!1)},f=()=>{var C;let O=Array.from(((C=e==null?void 0:e.media)==null?void 0:C.textTracks)||[]).filter(R=>["subtitles","captions"].includes(R.kind)&&R.mode==="showing")[0];O!==r&&(r==null||r.removeEventListener("cuechange",b)),r=O,r==null||r.addEventListener("cuechange",b),m(r,l(this,B))};if(f(),(A=e==null?void 0:e.media)==null||A.textTracks.addEventListener("change",f),(D=e==null?void 0:e.media)==null||D.textTracks.addEventListener("addtrack",f),navigator.userAgent.includes("Chrome/")){let g=()=>{m(r,l(this,B),!0),this.paused||window.requestAnimationFrame(g)};(I=e==null?void 0:e.media)==null||I.addEventListener("playing",()=>{g()})}e==null||e.addEventListener("userinactivechange",()=>{let g=e==null?void 0:e.hasAttribute("user-inactive");l(this,B)!==g&&(k(this,B,g),m(r,l(this,B)))})};function Y(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}h.customElements.get("mux-player")||(h.customElements.define("mux-player",de),h.MuxPlayerElement=de);var qi=de;export{Je as MediaError,qi as default,Y as getVideoAttribute};
|