@mux/mux-video 0.15.6 → 0.16.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 CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ft=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var oe=(n,e,t)=>e in n?ft(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ce=(n,e)=>{for(var t in e)ft(n,t,{get:e[t],enumerable:!0})},ue=(n,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of ae(e))!ne.call(n,c)&&c!==t&&ft(n,c,{get:()=>e[c],enumerable:!(l=re(e,c))||l.enumerable});return n};var le=n=>ue(ft({},"__esModule",{value:!0}),n);var G=(n,e,t)=>(oe(n,typeof e!="symbol"?e+"":e,t),t),vt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)};var i=(n,e,t)=>(vt(n,e,"read from private field"),t?t.call(n):e.get(n)),o=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},f=(n,e,t,l)=>(vt(n,e,"write to private field"),l?l.call(n,t):e.set(n,t),t);var p=(n,e,t)=>(vt(n,e,"access private method"),t);var Ae={};ce(Ae,{Attributes:()=>a,MediaError:()=>u.MediaError,VideoEvents:()=>bt,default:()=>be});module.exports=le(Ae);var V=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class n extends V{}globalThis.DocumentFragment=n}var J=class extends V{},St=class extends V{},de={get(n){},define(n,e,t){},upgrade(n){},whenDefined(n){return Promise.resolve(J)}},Q,Pt=class{constructor(e,t={}){o(this,Q,void 0);f(this,Q,t==null?void 0:t.detail)}get detail(){return i(this,Q)}initCustomEvent(){}};Q=new WeakMap;function he(n,e){return new J}var Vt={document:{createElement:he},DocumentFragment,customElements:de,CustomEvent:Pt,EventTarget:V,HTMLElement:J,HTMLVideoElement:St},Kt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Z=Kt?Vt:globalThis,Se=Kt?Vt.document:globalThis.document;var u=require("@mux/playback-core");var me=()=>{try{return"0.15.6"}catch{}return"UNKNOWN"},Ee=me(),Ht=()=>Ee;var jt=n=>{var e,t,l,c,I,qt,P,pt,v,w,_,yt,Y,gt,ct,$t,lt,Xt,B,Ct,d,y,b,m,E,T,k,tt,dt,zt,$,Ot,ht,Jt,X,Mt,mt,Qt,z,It;return e=class extends n{constructor(){super();o(this,k);o(this,dt);o(this,$);o(this,ht);o(this,X);o(this,mt);o(this,z);G(this,"castEnabled",!1);o(this,d,{paused:!1});o(this,y,void 0);o(this,b,{});o(this,m,void 0);o(this,E,void 0);o(this,T,void 0);e.instances.add(this),p(this,X,Mt).call(this)}static get castElement(){return i(e,t)}static get castEnabled(){return i(e,l)}static get castState(){var s;return(s=i(e,v,w))==null?void 0:s.getCastState()}static async exitCast(){try{await i(e,v,w).endCurrentSession(!0)}catch(r){console.error(r);return}}get castPlayer(){if(e.castElement===this)return i(this,y)}attributeChangedCallback(s){if(!!this.castPlayer)switch(s){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(s={}){var r;p(r=e,B,Ct).call(r,s),f(e,t,this),Object.entries(i(this,b)).forEach(([g,S])=>{i(this,y).controller.addEventListener(g,S)});try{await i(e,v,w).requestSession()}catch{f(e,t,void 0);return}i(this,d).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(g){console.error(g)}}async load(){var D,F;if(!this.castPlayer)return super.load();let s=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),r=[...this.querySelectorAll("track")].filter(({kind:R,src:L})=>L&&(R==="subtitles"||R==="captions")),g=[],S=0;r.length&&(s.tracks=r.map(R=>{let L=++S;g.length===0&&R.track.mode==="showing"&&g.push(L);let U=new chrome.cast.media.Track(L,chrome.cast.media.TrackType.TEXT);return U.trackContentId=R.src,U.trackContentType="text/vtt",U.subtype=R.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,U.name=R.label,U.language=R.srclang,U})),this.castStreamType==="live"?s.streamType=chrome.cast.media.StreamType.LIVE:s.streamType=chrome.cast.media.StreamType.BUFFERED,s.metadata=new chrome.cast.media.GenericMediaMetadata,s.metadata.title=this.title,s.metadata.images=[{url:this.poster}];let M=new chrome.cast.media.LoadRequest(s);M.currentTime=(D=super.currentTime)!=null?D:0,M.autoplay=!i(this,d).paused,M.activeTrackIds=g,await((F=i(e,_,yt))==null?void 0:F.loadMedia(M)),this.dispatchEvent(new Event("volumechange"))}play(){var s;if(this.castPlayer){this.castPlayer.isPaused&&((s=this.castPlayer.controller)==null||s.playOrPause());return}return super.play()}pause(){var s;if(this.castPlayer){this.castPlayer.isPaused||(s=this.castPlayer.controller)==null||s.playOrPause();return}super.pause()}get castSrc(){var s,r,g;return(g=(r=this.getAttribute("cast-src"))!=null?r:(s=this.querySelector("source"))==null?void 0:s.src)!=null?g:this.currentSrc}set castSrc(s){this.castSrc!=s&&this.setAttribute("cast-src",`${s}`)}get castContentType(){var s;return(s=this.getAttribute("cast-content-type"))!=null?s:void 0}set castContentType(s){this.setAttribute("cast-content-type",`${s}`)}get castStreamType(){var s,r;return(r=(s=this.getAttribute("cast-stream-type"))!=null?s:this.streamType)!=null?r:void 0}set castStreamType(s){this.setAttribute("cast-stream-type",`${s}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var s;return this.castPlayer?(s=this.castPlayer)==null?void 0:s.isMuted:super.muted}set muted(s){var r;if(this.castPlayer){(s&&!this.castPlayer.isMuted||!s&&this.castPlayer.isMuted)&&((r=this.castPlayer.controller)==null||r.muteOrUnmute());return}super.muted=s}get volume(){var s,r;return this.castPlayer?(r=(s=this.castPlayer)==null?void 0:s.volumeLevel)!=null?r:1:super.volume}set volume(s){var r;if(this.castPlayer){this.castPlayer.volumeLevel=s,(r=this.castPlayer.controller)==null||r.setVolumeLevel();return}super.volume=s}get duration(){var s,r;return this.castPlayer&&i(this,k,tt)?(r=(s=this.castPlayer)==null?void 0:s.duration)!=null?r:NaN:super.duration}get currentTime(){var s,r;return this.castPlayer&&i(this,k,tt)?(r=(s=this.castPlayer)==null?void 0:s.currentTime)!=null?r:0:super.currentTime}set currentTime(s){var r;if(this.castPlayer){this.castPlayer.currentTime=s,(r=this.castPlayer.controller)==null||r.seek();return}super.currentTime=s}get onentercast(){return i(this,m)}set onentercast(s){i(this,m)&&(this.removeEventListener("entercast",i(this,m)),f(this,m,null)),typeof s=="function"&&(f(this,m,s),this.addEventListener("entercast",s))}get onleavecast(){return i(this,E)}set onleavecast(s){i(this,E)&&(this.removeEventListener("leavecast",i(this,E)),f(this,E,null)),typeof s=="function"&&(f(this,E,s),this.addEventListener("leavecast",s))}get oncastchange(){return i(this,T)}set oncastchange(s){i(this,T)&&(this.removeEventListener("castchange",i(this,T)),f(this,T,null)),typeof s=="function"&&(f(this,T,s),this.addEventListener("castchange",s))}},t=new WeakMap,l=new WeakMap,c=new WeakMap,I=new WeakSet,qt=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},P=new WeakSet,pt=function(){return typeof cast!="undefined"&&cast.framework},v=new WeakSet,w=function(){if(i(e,P,pt))return cast.framework.CastContext.getInstance()},_=new WeakSet,yt=function(){var s;return(s=i(e,v,w))==null?void 0:s.getCurrentSession()},Y=new WeakSet,gt=function(){var s;return(s=i(e,_,yt))==null?void 0:s.getSessionObj().media[0]},ct=new WeakSet,$t=function(s){return new Promise((r,g)=>{i(e,Y,gt).editTracksInfo(s,r,g)})},lt=new WeakSet,Xt=function(s){return new Promise((r,g)=>{i(e,Y,gt).getStatus(s,r,g)})},B=new WeakSet,Ct=function(s){return i(e,v,w).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...s})},d=new WeakMap,y=new WeakMap,b=new WeakMap,m=new WeakMap,E=new WeakMap,T=new WeakMap,k=new WeakSet,tt=function(){var s;return(s=this.castPlayer)==null?void 0:s.isMediaLoaded},dt=new WeakSet,zt=function(){i(e,t)===this&&(Object.entries(i(this,b)).forEach(([s,r])=>{i(this,y).controller.removeEventListener(s,r)}),f(e,t,void 0),this.muted=i(this,y).isMuted,this.currentTime=i(this,y).savedPlayerState.currentTime,i(this,y).savedPlayerState.isPaused===!1&&this.play())},$=new WeakSet,Ot=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:i(e,v,w).getCastState()}))},ht=new WeakSet,Jt=async function(){var r,g;let{SESSION_RESUMED:s}=cast.framework.SessionState;if(i(e,v,w).getSessionState()===s&&this.castSrc===((r=i(e,Y,gt))==null?void 0:r.media.contentId)){f(e,t,this),Object.entries(i(this,b)).forEach(([S,M])=>{i(this,y).controller.addEventListener(S,M)});try{await p(g=e,lt,Xt).call(g,new chrome.cast.media.GetStatusRequest)}catch(S){console.error(S)}i(this,b)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),i(this,b)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},X=new WeakSet,Mt=function(){var s;!i(e,P,pt)||this.castEnabled||(this.castEnabled=!0,p(s=e,B,Ct).call(s),this.textTracks.addEventListener("change",p(this,z,It).bind(this)),p(this,$,Ot).call(this),f(this,y,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(i(this,y)),f(this,b,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:r})=>{r===!1&&p(this,dt,zt).call(this),this.dispatchEvent(new Event(r?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!i(this,k,tt)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var r,g;((r=this.castPlayer)==null?void 0:r.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(g=this.castPlayer)==null?void 0:g.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!i(this,k,tt)||(await Promise.resolve(),p(this,mt,Qt).call(this))}}))},mt=new WeakSet,Qt=function(){p(this,z,It).call(this)},z=new WeakSet,It=async function(){var wt,Nt,xt,Gt,Ft,Ut;if(!this.castPlayer)return;let r=((Nt=(wt=i(this,y).mediaInfo)==null?void 0:wt.tracks)!=null?Nt:[]).filter(({type:A})=>A===chrome.cast.media.TrackType.TEXT),g=[...this.textTracks].filter(({kind:A})=>A==="subtitles"||A==="captions"),S=r.map(({language:A,name:Et,trackId:Tt})=>{var Bt;let{mode:Yt}=(Bt=g.find(Wt=>Wt.language===A&&Wt.label===Et))!=null?Bt:{};return Yt?{mode:Yt,trackId:Tt}:!1}).filter(Boolean),D=S.filter(({mode:A})=>A!=="showing").map(({trackId:A})=>A),F=S.find(({mode:A})=>A==="showing"),R=(Ft=(Gt=(xt=i(e,_,yt))==null?void 0:xt.getSessionObj().media[0])==null?void 0:Gt.activeTrackIds)!=null?Ft:[],L=R;if(R.length&&(L=L.filter(A=>!D.includes(A))),F!=null&&F.trackId&&(L=[...L,F.trackId]),L=[...new Set(L)],!((A,Et)=>A.length===Et.length&&A.every(Tt=>Et.includes(Tt)))(R,L))try{let A=new chrome.cast.media.EditTracksInfoRequest(L);await p(Ut=e,ct,$t).call(Ut,A)}catch(A){console.error(A)}},o(e,I),o(e,P),o(e,v),o(e,_),o(e,Y),o(e,ct),o(e,lt),o(e,B),G(e,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),G(e,"instances",new Set),o(e,t,void 0),o(e,l,!1),G(e,"initCast",()=>{var s;i(e,I,qt)?i(e,P,pt)?i(s=e,c).call(s,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var r;return i(r=e,c).call(r,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var r;return i(r=e,c).call(r,chrome.cast.isAvailable)})}}),o(e,c,s=>{if(s){f(e,l,!0);let{CAST_STATE_CHANGED:r}=cast.framework.CastContextEventType;i(e,v,w).addEventListener(r,S=>{e.instances.forEach(M=>{var D;return p(D=M,$,Ot).call(D,S)})});let{SESSION_STATE_CHANGED:g}=cast.framework.CastContextEventType;i(e,v,w).addEventListener(g,S=>{e.instances.forEach(M=>{var D;return p(D=M,ht,Jt).call(D,S)})}),e.instances.forEach(S=>{var M;return p(M=S,X,Mt).call(M)})}}),e},kt=globalThis.HTMLVideoElement?jt(HTMLVideoElement):jt(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",kt,{extends:"video"}),globalThis.CastableVideoElement=kt);kt.initCast();var bt=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Zt,Lt=(Zt=globalThis.document)==null?void 0:Zt.createElement("template");Lt&&(Lt.innerHTML=`
1
+ "use strict";var Ht=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ze=Object.prototype.hasOwnProperty;var ti=(i,e,t)=>e in i?Ht(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var ei=(i,e)=>{for(var t in e)Ht(i,t,{get:e[t],enumerable:!0})},ii=(i,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Qe(e))!Ze.call(i,n)&&n!==t&&Ht(i,n,{get:()=>e[n],enumerable:!(a=Je(e,n))||a.enumerable});return i};var ri=i=>ii(Ht({},"__esModule",{value:!0}),i);var p=(i,e,t)=>(ti(i,typeof e!="symbol"?e+"":e,t),t),re=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var r=(i,e,t)=>(re(i,e,"read from private field"),t?t.call(i):e.get(i)),c=(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)},d=(i,e,t,a)=>(re(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t);var A=(i,e,t)=>(re(i,e,"access private method"),t);var fi={};ei(fi,{Attributes:()=>h,MediaError:()=>m.MediaError,VideoEvents:()=>Jt,default:()=>mi});module.exports=ri(fi);var ht=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends ht{}globalThis.DocumentFragment=i}var Lt=class extends ht{},se=class extends ht{},si={get(i){},define(i,e,t){},upgrade(i){},whenDefined(i){return Promise.resolve(Lt)}},Ct,ne=class{constructor(e,t={}){c(this,Ct,void 0);d(this,Ct,t==null?void 0:t.detail)}get detail(){return r(this,Ct)}initCustomEvent(){}};Ct=new WeakMap;function ni(i,e){return new Lt}var Le={document:{createElement:ni},DocumentFragment,customElements:si,CustomEvent:ne,EventTarget:ht,HTMLElement:Lt,HTMLVideoElement:se},Ce=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Ot=Ce?Le:globalThis,gi=Ce?Le.document:globalThis.document;var m=require("@mux/playback-core");var ai=()=>{try{return"0.16.0"}catch{}return"UNKNOWN"},oi=ai(),Oe=()=>oi;var Ie=i=>{var e,t,a,n,w,we,b,$t,C,V,l,zt,v,Xt,qt,Me,Ut,_e,dt,ae,f,k,P,g,y,O,D,It,Yt,xe,St,oe,Wt,De,Pt,ce,jt,Ne,Rt,de;return e=class extends i{constructor(){super();c(this,D);c(this,Yt);c(this,St);c(this,Wt);c(this,Pt);c(this,jt);c(this,Rt);p(this,"castEnabled",!1);c(this,f,{paused:!1});c(this,k,void 0);c(this,P,{});c(this,g,void 0);c(this,y,void 0);c(this,O,void 0);e.instances.add(this),A(this,Pt,ce).call(this)}static get castElement(){return r(e,t)}static get castEnabled(){return r(e,a)}static get castState(){var s;return(s=r(e,C,V))==null?void 0:s.getCastState()}static async exitCast(){try{await r(e,C,V).endCurrentSession(!0)}catch(u){console.error(u);return}}get castPlayer(){if(e.castElement===this)return r(this,k)}attributeChangedCallback(s){if(!!this.castPlayer)switch(s){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(s={}){var u;A(u=e,dt,ae).call(u,s),d(e,t,this),Object.entries(r(this,P)).forEach(([S,_])=>{r(this,k).controller.addEventListener(S,_)});try{await r(e,C,V).requestSession()}catch{d(e,t,void 0);return}r(this,f).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(S){console.error(S)}}async load(){var F,it;if(!this.castPlayer)return super.load();let s=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),u=[...this.querySelectorAll("track")].filter(({kind:G,src:N})=>N&&(G==="subtitles"||G==="captions")),S=[],_=0;u.length&&(s.tracks=u.map(G=>{let N=++_;S.length===0&&G.track.mode==="showing"&&S.push(N);let rt=new chrome.cast.media.Track(N,chrome.cast.media.TrackType.TEXT);return rt.trackContentId=G.src,rt.trackContentType="text/vtt",rt.subtype=G.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,rt.name=G.label,rt.language=G.srclang,rt})),this.castStreamType==="live"?s.streamType=chrome.cast.media.StreamType.LIVE:s.streamType=chrome.cast.media.StreamType.BUFFERED,s.metadata=new chrome.cast.media.GenericMediaMetadata,s.metadata.title=this.title,s.metadata.images=[{url:this.poster}];let x=new chrome.cast.media.LoadRequest(s);x.currentTime=(F=super.currentTime)!=null?F:0,x.autoplay=!r(this,f).paused,x.activeTrackIds=S,await((it=r(e,l,zt))==null?void 0:it.loadMedia(x)),this.dispatchEvent(new Event("volumechange"))}play(){var s;if(this.castPlayer){this.castPlayer.isPaused&&((s=this.castPlayer.controller)==null||s.playOrPause());return}return super.play()}pause(){var s;if(this.castPlayer){this.castPlayer.isPaused||(s=this.castPlayer.controller)==null||s.playOrPause();return}super.pause()}get castSrc(){var s,u,S;return(S=(u=this.getAttribute("cast-src"))!=null?u:(s=this.querySelector("source"))==null?void 0:s.src)!=null?S:this.currentSrc}set castSrc(s){this.castSrc!=s&&this.setAttribute("cast-src",`${s}`)}get castContentType(){var s;return(s=this.getAttribute("cast-content-type"))!=null?s:void 0}set castContentType(s){this.setAttribute("cast-content-type",`${s}`)}get castStreamType(){var s,u;return(u=(s=this.getAttribute("cast-stream-type"))!=null?s:this.streamType)!=null?u:void 0}set castStreamType(s){this.setAttribute("cast-stream-type",`${s}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var s;return this.castPlayer?(s=this.castPlayer)==null?void 0:s.isMuted:super.muted}set muted(s){var u;if(this.castPlayer){(s&&!this.castPlayer.isMuted||!s&&this.castPlayer.isMuted)&&((u=this.castPlayer.controller)==null||u.muteOrUnmute());return}super.muted=s}get volume(){var s,u;return this.castPlayer?(u=(s=this.castPlayer)==null?void 0:s.volumeLevel)!=null?u:1:super.volume}set volume(s){var u;if(this.castPlayer){this.castPlayer.volumeLevel=s,(u=this.castPlayer.controller)==null||u.setVolumeLevel();return}super.volume=s}get duration(){var s,u;return this.castPlayer&&r(this,D,It)?(u=(s=this.castPlayer)==null?void 0:s.duration)!=null?u:NaN:super.duration}get currentTime(){var s,u;return this.castPlayer&&r(this,D,It)?(u=(s=this.castPlayer)==null?void 0:s.currentTime)!=null?u:0:super.currentTime}set currentTime(s){var u;if(this.castPlayer){this.castPlayer.currentTime=s,(u=this.castPlayer.controller)==null||u.seek();return}super.currentTime=s}get onentercast(){return r(this,g)}set onentercast(s){r(this,g)&&(this.removeEventListener("entercast",r(this,g)),d(this,g,null)),typeof s=="function"&&(d(this,g,s),this.addEventListener("entercast",s))}get onleavecast(){return r(this,y)}set onleavecast(s){r(this,y)&&(this.removeEventListener("leavecast",r(this,y)),d(this,y,null)),typeof s=="function"&&(d(this,y,s),this.addEventListener("leavecast",s))}get oncastchange(){return r(this,O)}set oncastchange(s){r(this,O)&&(this.removeEventListener("castchange",r(this,O)),d(this,O,null)),typeof s=="function"&&(d(this,O,s),this.addEventListener("castchange",s))}},t=new WeakMap,a=new WeakMap,n=new WeakMap,w=new WeakSet,we=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},b=new WeakSet,$t=function(){return typeof cast!="undefined"&&cast.framework},C=new WeakSet,V=function(){if(r(e,b,$t))return cast.framework.CastContext.getInstance()},l=new WeakSet,zt=function(){var s;return(s=r(e,C,V))==null?void 0:s.getCurrentSession()},v=new WeakSet,Xt=function(){var s;return(s=r(e,l,zt))==null?void 0:s.getSessionObj().media[0]},qt=new WeakSet,Me=function(s){return new Promise((u,S)=>{r(e,v,Xt).editTracksInfo(s,u,S)})},Ut=new WeakSet,_e=function(s){return new Promise((u,S)=>{r(e,v,Xt).getStatus(s,u,S)})},dt=new WeakSet,ae=function(s){return r(e,C,V).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...s})},f=new WeakMap,k=new WeakMap,P=new WeakMap,g=new WeakMap,y=new WeakMap,O=new WeakMap,D=new WeakSet,It=function(){var s;return(s=this.castPlayer)==null?void 0:s.isMediaLoaded},Yt=new WeakSet,xe=function(){r(e,t)===this&&(Object.entries(r(this,P)).forEach(([s,u])=>{r(this,k).controller.removeEventListener(s,u)}),d(e,t,void 0),this.muted=r(this,k).isMuted,this.currentTime=r(this,k).savedPlayerState.currentTime,r(this,k).savedPlayerState.isPaused===!1&&this.play())},St=new WeakSet,oe=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:r(e,C,V).getCastState()}))},Wt=new WeakSet,De=async function(){var u,S;let{SESSION_RESUMED:s}=cast.framework.SessionState;if(r(e,C,V).getSessionState()===s&&this.castSrc===((u=r(e,v,Xt))==null?void 0:u.media.contentId)){d(e,t,this),Object.entries(r(this,P)).forEach(([_,x])=>{r(this,k).controller.addEventListener(_,x)});try{await A(S=e,Ut,_e).call(S,new chrome.cast.media.GetStatusRequest)}catch(_){console.error(_)}r(this,P)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),r(this,P)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Pt=new WeakSet,ce=function(){var s;!r(e,b,$t)||this.castEnabled||(this.castEnabled=!0,A(s=e,dt,ae).call(s),this.textTracks.addEventListener("change",A(this,Rt,de).bind(this)),A(this,St,oe).call(this),d(this,k,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(r(this,k)),d(this,P,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:u})=>{u===!1&&A(this,Yt,xe).call(this),this.dispatchEvent(new Event(u?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!r(this,D,It)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var u,S;((u=this.castPlayer)==null?void 0:u.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(S=this.castPlayer)==null?void 0:S.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!r(this,D,It)||(await Promise.resolve(),A(this,jt,Ne).call(this))}}))},jt=new WeakSet,Ne=function(){A(this,Rt,de).call(this)},Rt=new WeakSet,de=async function(){var ye,ve,Te,be,Ae,ke;if(!this.castPlayer)return;let u=((ve=(ye=r(this,k).mediaInfo)==null?void 0:ye.tracks)!=null?ve:[]).filter(({type:L})=>L===chrome.cast.media.TrackType.TEXT),S=[...this.textTracks].filter(({kind:L})=>L==="subtitles"||L==="captions"),_=u.map(({language:L,name:Kt,trackId:ie})=>{var Pe;let{mode:Se}=(Pe=S.find(Re=>Re.language===L&&Re.label===Kt))!=null?Pe:{};return Se?{mode:Se,trackId:ie}:!1}).filter(Boolean),F=_.filter(({mode:L})=>L!=="showing").map(({trackId:L})=>L),it=_.find(({mode:L})=>L==="showing"),G=(Ae=(be=(Te=r(e,l,zt))==null?void 0:Te.getSessionObj().media[0])==null?void 0:be.activeTrackIds)!=null?Ae:[],N=G;if(G.length&&(N=N.filter(L=>!F.includes(L))),it!=null&&it.trackId&&(N=[...N,it.trackId]),N=[...new Set(N)],!((L,Kt)=>L.length===Kt.length&&L.every(ie=>Kt.includes(ie)))(G,N))try{let L=new chrome.cast.media.EditTracksInfoRequest(N);await A(ke=e,qt,Me).call(ke,L)}catch(L){console.error(L)}},c(e,w),c(e,b),c(e,C),c(e,l),c(e,v),c(e,qt),c(e,Ut),c(e,dt),p(e,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),p(e,"instances",new Set),c(e,t,void 0),c(e,a,!1),p(e,"initCast",()=>{var s;r(e,w,we)?r(e,b,$t)?r(s=e,n).call(s,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var u;return r(u=e,n).call(u,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var u;return r(u=e,n).call(u,chrome.cast.isAvailable)})}}),c(e,n,s=>{if(s){d(e,a,!0);let{CAST_STATE_CHANGED:u}=cast.framework.CastContextEventType;r(e,C,V).addEventListener(u,_=>{e.instances.forEach(x=>{var F;return A(F=x,St,oe).call(F,_)})});let{SESSION_STATE_CHANGED:S}=cast.framework.CastContextEventType;r(e,C,V).addEventListener(S,_=>{e.instances.forEach(x=>{var F;return A(F=x,Wt,De).call(F,_)})}),e.instances.forEach(_=>{var x;return A(x=_,Pt,ce).call(x)})}}),e},ue=globalThis.HTMLVideoElement?Ie(HTMLVideoElement):Ie(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",ue,{extends:"video"}),globalThis.CastableVideoElement=ue);ue.initCast();var Jt=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Ge,he=(Ge=globalThis.document)==null?void 0:Ge.createElement("template");he&&(he.innerHTML=`
2
2
  <style>
3
3
  :host {
4
4
  display: inline-block;
@@ -13,7 +13,7 @@
13
13
  }
14
14
  </style>
15
15
  <slot></slot>
16
- `);var te,_t=(te=globalThis.document)==null?void 0:te.createElement("template");_t&&(_t.innerHTML=`
16
+ `);var Fe,le=(Fe=globalThis.document)==null?void 0:Fe.createElement("template");le&&(le.innerHTML=`
17
17
  <style>
18
18
  :host {
19
19
  display: inline-block;
@@ -35,5 +35,5 @@
35
35
  }
36
36
  </style>
37
37
  <slot></slot>
38
- `);var At=(n,{tag:e,is:t})=>{var I,C,P,O,ee,q,_,x,K,ot,se,ut,ie;let l=(I=globalThis.document)==null?void 0:I.createElement(e,{is:t}),c=l?fe(l):[];return C=class extends n{constructor(){super();o(this,x);o(this,ot);o(this,ut);o(this,q,void 0);o(this,_,void 0);this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var d,y,b;return p(d=C,O,ee).call(d),[...(b=(y=l==null?void 0:l.constructor)==null?void 0:y.observedAttributes)!=null?b:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var h,d;return(d=(h=i(this,_))!=null?h:this.shadowRoot.querySelector(e))!=null?d:this.querySelector(e)}set nativeEl(h){f(this,_,h)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(h){this.toggleAttribute("muted",Boolean(h))}get src(){return this.getAttribute("src")}set src(h){this.setAttribute("src",`${h}`)}get preload(){var h,d;return(d=this.getAttribute("preload"))!=null?d:(h=this.nativeEl)==null?void 0:h.preload}set preload(h){this.setAttribute("preload",`${h}`)}attributeChangedCallback(h,d,y){p(this,x,K).call(this),p(this,ut,ie).call(this,h,d,y)}connectedCallback(){p(this,x,K).call(this)}},P=new WeakMap,O=new WeakSet,ee=function(){if(i(this,P))return;f(this,P,!0);let h=new Set(this.observedAttributes);h.delete("muted");for(let d of c){if(d in this.prototype)continue;if(typeof l[d]=="function")this.prototype[d]=function(...b){return p(this,x,K).call(this),(()=>this.call?this.call(d,...b):this.nativeEl[d].apply(this.nativeEl,b))()};else{let b={get(){var E,T,k;p(this,x,K).call(this);let m=d.toLowerCase();if(h.has(m)){let W=this.getAttribute(m);return W===null?!1:W===""?!0:W}return(k=(E=this.get)==null?void 0:E.call(this,d))!=null?k:(T=this.nativeEl)==null?void 0:T[d]}};d!==d.toUpperCase()&&(b.set=function(m){p(this,x,K).call(this);let E=d.toLowerCase();if(h.has(E)){m===!0||m===!1||m==null?this.toggleAttribute(E,Boolean(m)):this.setAttribute(E,m);return}if(this.set){this.set(d,m);return}this.nativeEl[d]=m}),Object.defineProperty(this.prototype,d,b)}}},q=new WeakMap,_=new WeakMap,x=new WeakSet,K=function(){var y,b;if(i(this,q))return;if(f(this,q,!0),!this.nativeEl){let m=document.createElement(e,{is:t});m.part=e,this.shadowRoot.append(m)}this.nativeEl.muted=this.hasAttribute("muted");for(let m of c)p(this,ot,se).call(this,m);let h=new Map,d=this.shadowRoot.querySelector("slot:not([name])");d==null||d.addEventListener("slotchange",()=>{let m=new Map(h);d.assignedElements().filter(E=>["track","source"].includes(E.localName)).forEach(E=>{var k,W;m.delete(E);let T=h.get(E);T||(T=E.cloneNode(),h.set(E,T)),(W=(k=this.nativeEl).append)==null||W.call(k,T)}),m.forEach(E=>E.remove())});for(let m of this.constructor.Events)(b=(y=this.shadowRoot).addEventListener)==null||b.call(y,m,E=>{E.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(E.type,{detail:E.detail}))},!0)},ot=new WeakSet,se=function(h){if(Object.prototype.hasOwnProperty.call(this,h)){let d=this[h];delete this[h],this[h]=d}},ut=new WeakSet,ie=function(h,d,y){var b,m,E,T;["id","class"].includes(h)||(y===null?(m=(b=this.nativeEl).removeAttribute)==null||m.call(b,h):(T=(E=this.nativeEl).setAttribute)==null||T.call(E,h,y))},o(C,O),G(C,"Events",bt),G(C,"template",e.endsWith("audio")?Lt:_t),o(C,P,void 0),C};function fe(n){let e=[];for(let t=Object.getPrototypeOf(n);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))e.push(...Object.getOwnPropertyNames(t));return e}var ke=globalThis.document?At(HTMLElement,{tag:"video"}):class{},Le=globalThis.document?At(HTMLElement,{tag:"audio"}):class{};bt.push("castchange","entercast","leavecast");var Rt=At(Z.HTMLElement,{tag:"video",is:"castable-video"}),a={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_COOKIES:"disable-cookies",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},pe=Object.values(a),ye=Ht(),ge="mux-video",N,H,st,j,it,rt,at,nt,Dt,et=class extends Rt{constructor(){super();o(this,nt);o(this,N,void 0);o(this,H,void 0);o(this,st,void 0);o(this,j,{});o(this,it,void 0);o(this,rt,void 0);o(this,at,void 0);f(this,st,(0,u.generatePlayerInitTime)())}static get observedAttributes(){var t;return[...pe,...(t=Rt.observedAttributes)!=null?t:[]]}get preferCmcd(){var t;return(t=this.getAttribute(a.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?u.CmcdTypeValues.includes(t)?this.setAttribute(a.PREFER_CMCD,t):console.warn(`Invalid value for preferCmcd. Must be one of ${u.CmcdTypeValues.join()}`):this.removeAttribute(a.PREFER_CMCD))}get playerInitTime(){return i(this,st)}get playerSoftwareName(){var t;return(t=i(this,rt))!=null?t:ge}set playerSoftwareName(t){f(this,rt,t)}get playerSoftwareVersion(){var t;return(t=i(this,it))!=null?t:ye}set playerSoftwareVersion(t){f(this,it,t)}get _hls(){var t;return(t=i(this,N))==null?void 0:t.engine}get mux(){return this.nativeEl.mux}get error(){var t;return(t=(0,u.getError)(this.nativeEl))!=null?t:null}get errorTranslator(){return i(this,at)}set errorTranslator(t){f(this,at,t)}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get type(){var t;return(t=this.getAttribute(a.TYPE))!=null?t:void 0}set type(t){t!==this.type&&(t?this.setAttribute(a.TYPE,t):this.removeAttribute(a.TYPE))}get autoplay(){let t=this.getAttribute("autoplay");return t===null?!1:t===""?!0:t}set autoplay(t){let l=this.autoplay;t!==l&&(t?this.setAttribute("autoplay",typeof t=="string"?t:""):this.removeAttribute("autoplay"))}get preload(){let t=this.getAttribute("preload");return t===""?"auto":["none","metadata","auto"].includes(t)?t:super.preload}set preload(t){t!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(t)?this.setAttribute("preload",t):this.removeAttribute("preload"))}get debug(){return this.getAttribute(a.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(a.DEBUG,""):this.removeAttribute(a.DEBUG))}get disableCookies(){return this.hasAttribute(a.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(a.DISABLE_COOKIES,""):this.removeAttribute(a.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(a.START_TIME);if(t==null)return;let l=+t;return Number.isNaN(l)?void 0:l}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(a.START_TIME):this.setAttribute(a.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(a.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(a.PLAYBACK_ID,t):this.removeAttribute(a.PLAYBACK_ID))}get maxResolution(){var t;return(t=this.getAttribute(a.MAX_RESOLUTION))!=null?t:void 0}set maxResolution(t){t!==this.maxResolution&&(t?this.setAttribute(a.MAX_RESOLUTION,t):this.removeAttribute(a.MAX_RESOLUTION))}get customDomain(){var t;return(t=this.getAttribute(a.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(a.CUSTOM_DOMAIN,t):this.removeAttribute(a.CUSTOM_DOMAIN))}get ended(){return(0,u.getEnded)(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(a.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(a.ENV_KEY,t):this.removeAttribute(a.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(a.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(a.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(a.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(a.STREAM_TYPE))!=null?t:(0,u.getStreamType)(this.nativeEl)}set streamType(t){t!==this.streamType&&(t?this.setAttribute(a.STREAM_TYPE,t):this.removeAttribute(a.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(a.TARGET_LIVE_WINDOW)?+this.getAttribute(a.TARGET_LIVE_WINDOW):(0,u.getTargetLiveWindow)(this.nativeEl)}set targetLiveWindow(t){t!=this.targetLiveWindow&&(t==null?this.removeAttribute(a.TARGET_LIVE_WINDOW):this.setAttribute(a.TARGET_LIVE_WINDOW,`${+t}`))}get liveEdgeStart(){var t,l;if(this.hasAttribute(a.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:c}=this,I=(t=this.nativeEl.seekable.end(0))!=null?t:0,C=(l=this.nativeEl.seekable.start(0))!=null?l:0;return Math.max(C,I-c)}return(0,u.getLiveEdgeStart)(this.nativeEl)}get liveEdgeOffset(){if(!!this.hasAttribute(a.LIVE_EDGE_OFFSET))return+this.getAttribute(a.LIVE_EDGE_OFFSET)}set liveEdgeOffset(t){t!=this.targetLiveWindow&&(t==null?this.removeAttribute(a.LIVE_EDGE_OFFSET):this.setAttribute(a.LIVE_EDGE_OFFSET,`${+t}`))}get seekable(){return(0,u.getSeekable)(this.nativeEl)}async addCuePoints(t){return(0,u.addCuePoints)(this.nativeEl,t)}get activeCuePoint(){return(0,u.getActiveCuePoint)(this.nativeEl)}get cuePoints(){return(0,u.getCuePoints)(this.nativeEl)}getStartDate(){return(0,u.getStartDate)(this.nativeEl,this._hls)}get currentPdt(){return(0,u.getCurrentPdt)(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(a.PREFER_PLAYBACK);if(t===u.PlaybackTypes.MSE||t===u.PlaybackTypes.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===u.PlaybackTypes.MSE||t===u.PlaybackTypes.NATIVE?this.setAttribute(a.PREFER_PLAYBACK,t):this.removeAttribute(a.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(l=>l.startsWith("metadata-")&&![a.METADATA_URL].includes(l)).reduce((l,c)=>{let I=this.getAttribute(c);return I!=null&&(l[c.replace(/^metadata-/,"").replace(/-/g,"_")]=I),l},{}),...i(this,j)}}set metadata(t){f(this,j,t!=null?t:{}),this.mux&&this.mux.emit("hb",i(this,j))}load(){f(this,N,(0,u.initialize)(this,this.nativeEl,i(this,N)))}unload(){(0,u.teardown)(this.nativeEl,i(this,N)),f(this,N,void 0)}attributeChangedCallback(t,l,c){var C,P;switch(Rt.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,l,c),t){case a.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=c!=null?c:void 0;break;case a.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=c!=null?c:void 0;break;case"src":{let O=!!l,v=!!c;!O&&v?p(this,nt,Dt).call(this):O&&!v?this.unload():O&&v&&(this.unload(),p(this,nt,Dt).call(this));break}case"autoplay":if(c===l)break;(C=i(this,N))==null||C.setAutoplay(this.autoplay);break;case"preload":if(c===l)break;(P=i(this,N))==null||P.setPreload(c);break;case a.PLAYBACK_ID:this.src=(0,u.toMuxVideoURL)(c!=null?c:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case a.DEBUG:{let O=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=O);break}case a.METADATA_URL:c&&fetch(c).then(O=>O.json()).then(O=>this.metadata=O).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${c}!`));break;case a.STREAM_TYPE:(c==null||c!==l)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case a.TARGET_LIVE_WINDOW:(c==null||c!==l)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};N=new WeakMap,H=new WeakMap,st=new WeakMap,j=new WeakMap,it=new WeakMap,rt=new WeakMap,at=new WeakMap,nt=new WeakSet,Dt=async function(){i(this,H)||(await f(this,H,Promise.resolve()),f(this,H,null),this.load())};Z.customElements.get("mux-video")||(Z.customElements.define("mux-video",et),Z.MuxVideoElement=et);var be=et;
38
+ `);var Qt=(i,{tag:e,is:t})=>{var w,I,b,M,Ve,T,l,R,lt,Y,qe,Bt,Be;let a=(w=globalThis.document)==null?void 0:w.createElement(e,{is:t}),n=a?ci(a):[];return I=class extends i{constructor(){super();c(this,R);c(this,Y);c(this,Bt);c(this,T,void 0);c(this,l,void 0);this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var f,k,P;return A(f=I,M,Ve).call(f),[...(P=(k=a==null?void 0:a.constructor)==null?void 0:k.observedAttributes)!=null?P:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var E,f;return(f=(E=r(this,l))!=null?E:this.shadowRoot.querySelector(e))!=null?f:this.querySelector(e)}set nativeEl(E){d(this,l,E)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(E){this.toggleAttribute("muted",Boolean(E))}get src(){return this.getAttribute("src")}set src(E){this.setAttribute("src",`${E}`)}get preload(){var E,f;return(f=this.getAttribute("preload"))!=null?f:(E=this.nativeEl)==null?void 0:E.preload}set preload(E){this.setAttribute("preload",`${E}`)}attributeChangedCallback(E,f,k){A(this,R,lt).call(this),A(this,Bt,Be).call(this,E,f,k)}connectedCallback(){A(this,R,lt).call(this)}},b=new WeakMap,M=new WeakSet,Ve=function(){if(r(this,b))return;d(this,b,!0);let E=new Set(this.observedAttributes);E.delete("muted");for(let f of n){if(f in this.prototype)continue;if(typeof a[f]=="function")this.prototype[f]=function(...P){return A(this,R,lt).call(this),(()=>this.call?this.call(f,...P):this.nativeEl[f].apply(this.nativeEl,P))()};else{let P={get(){var y,O,D;A(this,R,lt).call(this);let g=f.toLowerCase();if(E.has(g)){let ut=this.getAttribute(g);return ut===null?!1:ut===""?!0:ut}return(D=(y=this.get)==null?void 0:y.call(this,f))!=null?D:(O=this.nativeEl)==null?void 0:O[f]}};f!==f.toUpperCase()&&(P.set=function(g){A(this,R,lt).call(this);let y=f.toLowerCase();if(E.has(y)){g===!0||g===!1||g==null?this.toggleAttribute(y,Boolean(g)):this.setAttribute(y,g);return}if(this.set){this.set(f,g);return}this.nativeEl[f]=g}),Object.defineProperty(this.prototype,f,P)}}},T=new WeakMap,l=new WeakMap,R=new WeakSet,lt=function(){var k,P;if(r(this,T))return;if(d(this,T,!0),!this.nativeEl){let g=document.createElement(e,{is:t});g.part=e,this.shadowRoot.append(g)}this.nativeEl.muted=this.hasAttribute("muted");for(let g of n)A(this,Y,qe).call(this,g);let E=new Map,f=this.shadowRoot.querySelector("slot:not([name])");f==null||f.addEventListener("slotchange",()=>{let g=new Map(E);f.assignedElements().filter(y=>["track","source"].includes(y.localName)).forEach(y=>{var D,ut;g.delete(y);let O=E.get(y);O||(O=y.cloneNode(),E.set(y,O)),(ut=(D=this.nativeEl).append)==null||ut.call(D,O)}),g.forEach(y=>y.remove())});for(let g of this.constructor.Events)(P=(k=this.shadowRoot).addEventListener)==null||P.call(k,g,y=>{y.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(y.type,{detail:y.detail}))},!0)},Y=new WeakSet,qe=function(E){if(Object.prototype.hasOwnProperty.call(this,E)){let f=this[E];delete this[E],this[E]=f}},Bt=new WeakSet,Be=function(E,f,k){var P,g,y,O;["id","class"].includes(E)||(k===null?(g=(P=this.nativeEl).removeAttribute)==null||g.call(P,E):(O=(y=this.nativeEl).setAttribute)==null||O.call(y,E,k))},c(I,M),p(I,"Events",Jt),p(I,"template",e.endsWith("audio")?he:le),c(I,b,void 0),I};function ci(i){let e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))e.push(...Object.getOwnPropertyNames(t));return e}var ki=globalThis.document?Qt(HTMLElement,{tag:"video"}):class{},Si=globalThis.document?Qt(HTMLElement,{tag:"audio"}):class{};var B=class extends Event{constructor(t,a){super(t);p(this,"track");this.track=a.track}};var me=new WeakMap;function o(i){var e;return(e=me.get(i))!=null?e:di(i,{})}function di(i,e){let t=me.get(i);return t||me.set(i,t={}),Object.assign(t,e)}function Zt(i,e){let t=i.videoTracks;o(e).media=i,o(e).renditionSet||(o(e).renditionSet=new Set);let a=o(t).trackSet;a.add(e);let n=a.size-1;n in nt.prototype||Object.defineProperty(nt.prototype,n,{get(){return[...o(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new B("addtrack",{track:e}))})}function fe(i){let e=o(i).media.videoTracks;o(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new B("removetrack",{track:i}))})}function Ue(i){var a;let e=(a=o(i).media.videoTracks)!=null?a:[],t=!1;for(let n of e)n!==i&&(n.selected=!1,t=!0);if(t){if(o(e).changeRequested)return;o(e).changeRequested=!0,queueMicrotask(()=>{delete o(e).changeRequested,e.dispatchEvent(new Event("change"))})}}var W,j,K,st,wt,nt=class extends EventTarget{constructor(){super();c(this,st);c(this,W,void 0);c(this,j,void 0);c(this,K,void 0);o(this).trackSet=new Set}[Symbol.iterator](){return r(this,st,wt).values()}get length(){return r(this,st,wt).size}getTrackById(t){var a;return(a=[...r(this,st,wt)].find(n=>n.id===t))!=null?a:null}get selectedIndex(){return[...r(this,st,wt)].findIndex(t=>t.selected)}get onaddtrack(){return r(this,W)}set onaddtrack(t){r(this,W)&&(this.removeEventListener("addtrack",r(this,W)),d(this,W,void 0)),typeof t=="function"&&(d(this,W,t),this.addEventListener("addtrack",t))}get onremovetrack(){return r(this,j)}set onremovetrack(t){r(this,j)&&(this.removeEventListener("removetrack",r(this,j)),d(this,j,void 0)),typeof t=="function"&&(d(this,j,t),this.addEventListener("removetrack",t))}get onchange(){return r(this,K)}set onchange(t){r(this,K)&&(this.removeEventListener("change",r(this,K)),d(this,K,void 0)),typeof t=="function"&&(d(this,K,t),this.addEventListener("change",t))}};W=new WeakMap,j=new WeakMap,K=new WeakMap,st=new WeakSet,wt=function(){return o(this).trackSet};var U=class extends Event{constructor(t,a){super(t);p(this,"rendition");this.rendition=a.rendition}};function Ye(i,e){let t=o(i).media.videoRenditions;o(e).media=o(i).media,o(e).track=i;let a=o(i).renditionSet;a.add(e);let n=a.size-1;n in at.prototype||Object.defineProperty(at.prototype,n,{get(){return mt(this)[n]}}),queueMicrotask(()=>{!i.selected||t.dispatchEvent(new U("addrendition",{rendition:e}))})}function We(i){let e=o(i).media.videoRenditions,t=o(i).track;o(t).renditionSet.delete(i),queueMicrotask(()=>{!o(i).track.selected||e.dispatchEvent(new U("removerendition",{rendition:i}))})}function je(i){let e=o(i).media.videoRenditions;!e||o(e).changeRequested||(o(e).changeRequested=!0,queueMicrotask(()=>{delete o(e).changeRequested,o(i).track.selected&&e.dispatchEvent(new Event("change"))}))}function mt(i){return[...o(i).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...o(t).renditionSet])}var H,$,z,at=class extends EventTarget{constructor(){super(...arguments);c(this,H,void 0);c(this,$,void 0);c(this,z,void 0)}[Symbol.iterator](){return mt(this).values()}get length(){return mt(this).length}getRenditionById(t){var a;return(a=mt(this).find(n=>`${n.id}`==`${t}`))!=null?a:null}get selectedIndex(){return mt(this).findIndex(t=>t.selected)}set selectedIndex(t){for(let[a,n]of mt(this).entries())n.selected=a===t}get onaddrendition(){return r(this,H)}set onaddrendition(t){r(this,H)&&(this.removeEventListener("addrendition",r(this,H)),d(this,H,void 0)),typeof t=="function"&&(d(this,H,t),this.addEventListener("addrendition",t))}get onremoverendition(){return r(this,$)}set onremoverendition(t){r(this,$)&&(this.removeEventListener("removerendition",r(this,$)),d(this,$,void 0)),typeof t=="function"&&(d(this,$,t),this.addEventListener("removerendition",t))}get onchange(){return r(this,z)}set onchange(t){r(this,z)&&(this.removeEventListener("change",r(this,z)),d(this,z,void 0)),typeof t=="function"&&(d(this,z,t),this.addEventListener("change",t))}};H=new WeakMap,$=new WeakMap,z=new WeakMap;var ft,Mt=class{constructor(){p(this,"src");p(this,"id");p(this,"width");p(this,"height");p(this,"bitrate");p(this,"frameRate");p(this,"codec");c(this,ft,!1)}get selected(){return r(this,ft)}set selected(e){r(this,ft)!==e&&(d(this,ft,e),je(this))}};ft=new WeakMap;var pt,Et=class{constructor(){p(this,"id");p(this,"kind");p(this,"label","");p(this,"language","");p(this,"sourceBuffer");c(this,pt,!1)}addRendition(e,t,a,n,w,I){let b=new Mt;return b.src=e,b.width=t,b.height=a,b.frameRate=I,b.bitrate=w,b.codec=n,Ye(this,b),b}removeRendition(e){We(e)}get selected(){return r(this,pt)}set selected(e){r(this,pt)!==e&&(d(this,pt,e),e===!0&&Ue(this))}};pt=new WeakMap;function Ke(i,e){let t=o(i).media.audioRenditions;o(e).media=o(i).media,o(e).track=i;let a=o(i).renditionSet;a.add(e);let n=a.size-1;n in ot.prototype||Object.defineProperty(ot.prototype,n,{get(){return gt(this)[n]}}),queueMicrotask(()=>{!i.enabled||t.dispatchEvent(new U("addrendition",{rendition:e}))})}function He(i){let e=o(i).media.audioRenditions,t=o(i).track;o(t).renditionSet.delete(i),queueMicrotask(()=>{!o(i).track.enabled||e.dispatchEvent(new U("removerendition",{rendition:i}))})}function $e(i){let e=o(i).media.audioRenditions;!e||o(e).changeRequested||(o(e).changeRequested=!0,queueMicrotask(()=>{delete o(e).changeRequested,o(i).track.enabled&&e.dispatchEvent(new Event("change"))}))}function gt(i){return[...o(i).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...o(t).renditionSet])}var X,J,Q,ot=class extends EventTarget{constructor(){super(...arguments);c(this,X,void 0);c(this,J,void 0);c(this,Q,void 0)}[Symbol.iterator](){return gt(this).values()}get length(){return gt(this).length}getRenditionById(t){var a;return(a=gt(this).find(n=>`${n.id}`==`${t}`))!=null?a:null}get selectedIndex(){return gt(this).findIndex(t=>t.selected)}set selectedIndex(t){for(let[a,n]of gt(this).entries())n.selected=a===t}get onaddrendition(){return r(this,X)}set onaddrendition(t){r(this,X)&&(this.removeEventListener("addrendition",r(this,X)),d(this,X,void 0)),typeof t=="function"&&(d(this,X,t),this.addEventListener("addrendition",t))}get onremoverendition(){return r(this,J)}set onremoverendition(t){r(this,J)&&(this.removeEventListener("removerendition",r(this,J)),d(this,J,void 0)),typeof t=="function"&&(d(this,J,t),this.addEventListener("removerendition",t))}get onchange(){return r(this,Q)}set onchange(t){r(this,Q)&&(this.removeEventListener("change",r(this,Q)),d(this,Q,void 0)),typeof t=="function"&&(d(this,Q,t),this.addEventListener("change",t))}};X=new WeakMap,J=new WeakMap,Q=new WeakMap;var yt,_t=class{constructor(){p(this,"src");p(this,"id");p(this,"bitrate");p(this,"codec");c(this,yt,!1)}get selected(){return r(this,yt)}set selected(e){r(this,yt)!==e&&(d(this,yt,e),$e(this))}};yt=new WeakMap;function ee(i,e){let t=i.audioTracks;o(e).media=i,o(e).renditionSet||(o(e).renditionSet=new Set);let a=o(t).trackSet;a.add(e);let n=a.size-1;n in ct.prototype||Object.defineProperty(ct.prototype,n,{get(){return[...o(this).trackSet][n]}}),queueMicrotask(()=>{t.dispatchEvent(new B("addtrack",{track:e}))})}function pe(i){let e=o(i).media.audioTracks;o(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new B("removetrack",{track:i}))})}function ze(i){let e=o(i).media.audioTracks;!e||o(e).changeRequested||(o(e).changeRequested=!0,queueMicrotask(()=>{delete o(e).changeRequested,e.dispatchEvent(new Event("change"))}))}var Z,tt,et,vt,te,ct=class extends EventTarget{constructor(){super();c(this,vt);c(this,Z,void 0);c(this,tt,void 0);c(this,et,void 0);o(this).trackSet=new Set}[Symbol.iterator](){return r(this,vt,te).values()}get length(){return r(this,vt,te).size}getTrackById(t){var a;return(a=[...r(this,vt,te)].find(n=>n.id===t))!=null?a:null}get onaddtrack(){return r(this,Z)}set onaddtrack(t){r(this,Z)&&(this.removeEventListener("addtrack",r(this,Z)),d(this,Z,void 0)),typeof t=="function"&&(d(this,Z,t),this.addEventListener("addtrack",t))}get onremovetrack(){return r(this,tt)}set onremovetrack(t){r(this,tt)&&(this.removeEventListener("removetrack",r(this,tt)),d(this,tt,void 0)),typeof t=="function"&&(d(this,tt,t),this.addEventListener("removetrack",t))}get onchange(){return r(this,et)}set onchange(t){r(this,et)&&(this.removeEventListener("change",r(this,et)),d(this,et,void 0)),typeof t=="function"&&(d(this,et,t),this.addEventListener("change",t))}};Z=new WeakMap,tt=new WeakMap,et=new WeakMap,vt=new WeakSet,te=function(){return o(this).trackSet};var Tt,bt=class{constructor(){p(this,"id");p(this,"kind");p(this,"label","");p(this,"language","");p(this,"sourceBuffer");c(this,Tt,!1)}addRendition(e,t,a){let n=new _t;return n.src=e,n.codec=t,n.bitrate=a,Ke(this,n),n}removeRendition(e){He(e)}get enabled(){return r(this,Tt)}set enabled(e){r(this,Tt)!==e&&(d(this,Tt,e),ze(this))}};Tt=new WeakMap;function Xe(i){var M,C;if(!(i!=null&&i.prototype))return i;let e=(M=Object.getOwnPropertyDescriptor(i.prototype,"videoTracks"))==null?void 0:M.get,t=(C=Object.getOwnPropertyDescriptor(i.prototype,"audioTracks"))==null?void 0:C.get;if(e&&!`${e}`.includes("[native code]"))return i;Object.defineProperty(i.prototype,"videoTracks",{get(){return n(this)}}),Object.defineProperty(i.prototype,"audioTracks",{get(){return w(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(T,l="",R=""){let v=new Et;return v.kind=T,v.label=l,v.language=R,Zt(this,v),v}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=fe),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(T,l="",R=""){let v=new bt;return v.kind=T,v.label=l,v.language=R,ee(this,v),v}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=pe);let n=T=>{let l=o(T).videoTracks;if(!l&&(l=new nt,o(T).videoTracks=l,e)){let R=e.call(T);for(let v of R)Zt(T,v);R.addEventListener("change",()=>{l.dispatchEvent(new Event("change"))}),R.addEventListener("addtrack",v=>{[...l].some(Y=>Y instanceof Et)||Zt(T,v.track)}),R.addEventListener("removetrack",v=>{fe(v.track)})}return l},w=T=>{let l=o(T).audioTracks;if(!l&&(l=new ct,o(T).audioTracks=l,t)){let R=t.call(T);for(let v of R)ee(T,v);R.addEventListener("change",()=>{l.dispatchEvent(new Event("change"))}),R.addEventListener("addtrack",v=>{[...l].some(Y=>Y instanceof bt)||ee(T,v.track)}),R.addEventListener("removetrack",v=>{pe(v.track)})}return l};"videoRenditions"in i.prototype||Object.defineProperty(i.prototype,"videoRenditions",{get(){return I(this)}});let I=T=>{let l=o(T).videoRenditions;return l||(l=new at,o(l).media=T,o(T).videoRenditions=l),l};"audioRenditions"in i.prototype||Object.defineProperty(i.prototype,"audioRenditions",{get(){return b(this)}});let b=T=>{let l=o(T).audioRenditions;return l||(l=new ot,o(l).media=T,o(T).audioRenditions=l),l};return i}Jt.push("castchange","entercast","leavecast");var Ee=Xe(Qt(Ot.HTMLElement,{tag:"video",is:"castable-video"})),h={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_COOKIES:"disable-cookies",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},ui=Object.values(h),hi=Oe(),li="mux-video",q,At,Dt,kt,Nt,Gt,Ft,Vt,ge,xt=class extends Ee{constructor(){super();c(this,Vt);c(this,q,void 0);c(this,At,void 0);c(this,Dt,void 0);c(this,kt,{});c(this,Nt,void 0);c(this,Gt,void 0);c(this,Ft,void 0);d(this,Dt,(0,m.generatePlayerInitTime)())}static get observedAttributes(){var t;return[...ui,...(t=Ee.observedAttributes)!=null?t:[]]}get preferCmcd(){var t;return(t=this.getAttribute(h.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?m.CmcdTypeValues.includes(t)?this.setAttribute(h.PREFER_CMCD,t):console.warn(`Invalid value for preferCmcd. Must be one of ${m.CmcdTypeValues.join()}`):this.removeAttribute(h.PREFER_CMCD))}get playerInitTime(){return r(this,Dt)}get playerSoftwareName(){var t;return(t=r(this,Gt))!=null?t:li}set playerSoftwareName(t){d(this,Gt,t)}get playerSoftwareVersion(){var t;return(t=r(this,Nt))!=null?t:hi}set playerSoftwareVersion(t){d(this,Nt,t)}get _hls(){var t;return(t=r(this,q))==null?void 0:t.engine}get mux(){return this.nativeEl.mux}get error(){var t;return(t=(0,m.getError)(this.nativeEl))!=null?t:null}get errorTranslator(){return r(this,Ft)}set errorTranslator(t){d(this,Ft,t)}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get type(){var t;return(t=this.getAttribute(h.TYPE))!=null?t:void 0}set type(t){t!==this.type&&(t?this.setAttribute(h.TYPE,t):this.removeAttribute(h.TYPE))}get autoplay(){let t=this.getAttribute("autoplay");return t===null?!1:t===""?!0:t}set autoplay(t){let a=this.autoplay;t!==a&&(t?this.setAttribute("autoplay",typeof t=="string"?t:""):this.removeAttribute("autoplay"))}get preload(){let t=this.getAttribute("preload");return t===""?"auto":["none","metadata","auto"].includes(t)?t:super.preload}set preload(t){t!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(t)?this.setAttribute("preload",t):this.removeAttribute("preload"))}get debug(){return this.getAttribute(h.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(h.DEBUG,""):this.removeAttribute(h.DEBUG))}get disableCookies(){return this.hasAttribute(h.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(h.DISABLE_COOKIES,""):this.removeAttribute(h.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(h.START_TIME);if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(h.START_TIME):this.setAttribute(h.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(h.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(h.PLAYBACK_ID,t):this.removeAttribute(h.PLAYBACK_ID))}get maxResolution(){var t;return(t=this.getAttribute(h.MAX_RESOLUTION))!=null?t:void 0}set maxResolution(t){t!==this.maxResolution&&(t?this.setAttribute(h.MAX_RESOLUTION,t):this.removeAttribute(h.MAX_RESOLUTION))}get customDomain(){var t;return(t=this.getAttribute(h.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(h.CUSTOM_DOMAIN,t):this.removeAttribute(h.CUSTOM_DOMAIN))}get ended(){return(0,m.getEnded)(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(h.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(h.ENV_KEY,t):this.removeAttribute(h.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(h.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(h.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(h.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(h.STREAM_TYPE))!=null?t:(0,m.getStreamType)(this.nativeEl)}set streamType(t){t!==this.streamType&&(t?this.setAttribute(h.STREAM_TYPE,t):this.removeAttribute(h.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(h.TARGET_LIVE_WINDOW)?+this.getAttribute(h.TARGET_LIVE_WINDOW):(0,m.getTargetLiveWindow)(this.nativeEl)}set targetLiveWindow(t){t!=this.targetLiveWindow&&(t==null?this.removeAttribute(h.TARGET_LIVE_WINDOW):this.setAttribute(h.TARGET_LIVE_WINDOW,`${+t}`))}get liveEdgeStart(){var t,a;if(this.hasAttribute(h.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:n}=this,w=(t=this.nativeEl.seekable.end(0))!=null?t:0,I=(a=this.nativeEl.seekable.start(0))!=null?a:0;return Math.max(I,w-n)}return(0,m.getLiveEdgeStart)(this.nativeEl)}get liveEdgeOffset(){if(!!this.hasAttribute(h.LIVE_EDGE_OFFSET))return+this.getAttribute(h.LIVE_EDGE_OFFSET)}set liveEdgeOffset(t){t!=this.targetLiveWindow&&(t==null?this.removeAttribute(h.LIVE_EDGE_OFFSET):this.setAttribute(h.LIVE_EDGE_OFFSET,`${+t}`))}get seekable(){return(0,m.getSeekable)(this.nativeEl)}async addCuePoints(t){return(0,m.addCuePoints)(this.nativeEl,t)}get activeCuePoint(){return(0,m.getActiveCuePoint)(this.nativeEl)}get cuePoints(){return(0,m.getCuePoints)(this.nativeEl)}getStartDate(){return(0,m.getStartDate)(this.nativeEl,this._hls)}get currentPdt(){return(0,m.getCurrentPdt)(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(h.PREFER_PLAYBACK);if(t===m.PlaybackTypes.MSE||t===m.PlaybackTypes.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===m.PlaybackTypes.MSE||t===m.PlaybackTypes.NATIVE?this.setAttribute(h.PREFER_PLAYBACK,t):this.removeAttribute(h.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(a=>a.startsWith("metadata-")&&![h.METADATA_URL].includes(a)).reduce((a,n)=>{let w=this.getAttribute(n);return w!=null&&(a[n.replace(/^metadata-/,"").replace(/-/g,"_")]=w),a},{}),...r(this,kt)}}set metadata(t){d(this,kt,t!=null?t:{}),this.mux&&this.mux.emit("hb",r(this,kt))}load(){d(this,q,(0,m.initialize)(this,this.nativeEl,r(this,q)))}unload(){(0,m.teardown)(this.nativeEl,r(this,q)),d(this,q,void 0)}attributeChangedCallback(t,a,n){var I,b;switch(Ee.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,a,n),t){case h.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=n!=null?n:void 0;break;case h.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=n!=null?n:void 0;break;case"src":{let M=!!a,C=!!n;!M&&C?A(this,Vt,ge).call(this):M&&!C?this.unload():M&&C&&(this.unload(),A(this,Vt,ge).call(this));break}case"autoplay":if(n===a)break;(I=r(this,q))==null||I.setAutoplay(this.autoplay);break;case"preload":if(n===a)break;(b=r(this,q))==null||b.setPreload(n);break;case h.PLAYBACK_ID:this.src=(0,m.toMuxVideoURL)(n!=null?n:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case h.DEBUG:{let M=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=M);break}case h.METADATA_URL:n&&fetch(n).then(M=>M.json()).then(M=>this.metadata=M).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${n}!`));break;case h.STREAM_TYPE:(n==null||n!==a)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case h.TARGET_LIVE_WINDOW:(n==null||n!==a)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};q=new WeakMap,At=new WeakMap,Dt=new WeakMap,kt=new WeakMap,Nt=new WeakMap,Gt=new WeakMap,Ft=new WeakMap,Vt=new WeakSet,ge=async function(){r(this,At)||(await d(this,At,Promise.resolve()),d(this,At,null),this.load())};Ot.customElements.get("mux-video")||(Ot.customElements.define("mux-video",xt),Ot.MuxVideoElement=xt);var mi=xt;
39
39
  //# sourceMappingURL=index.cjs.js.map