@mux/mux-player 1.7.1 → 1.7.2

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
@@ -889,7 +889,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
889
889
  <slot slot="captions-indicator" name="captions-indicator">${Ws}</slot>
890
890
  </media-captions-listbox>
891
891
  </media-chrome-menu-button>
892
- `;var Wr=class extends l.HTMLElement{constructor(){super(),pe(this,Br),pe(this,Fr),pe(this,na),pe(this,sa),pe(this,xe,void 0),pe(this,ze,void 0),pe(this,kt,void 0),pe(this,oe,void 0),pe(this,ri,void 0);let e=this.attachShadow({mode:"open"}),t=Ks.content.cloneNode(!0);this.nativeEl=t,e.append(t),ai(this,xe,this.shadowRoot.querySelector("media-chrome-menu-button")),ai(this,ze,O(this,xe).querySelector(".enabled")),ai(this,kt,O(this,xe).querySelector(".disabled")),ai(this,oe,O(this,xe).querySelector("media-captions-listbox")),ai(this,ri,Mt(this,Br,Vs).bind(this)),this._captionsReady=!1,Mt(this,sa,$r).call(this)}static get observedAttributes(){return["disabled",p.MEDIA_CONTROLLER,"no-subtitles-fallback","default-showing",o.MEDIA_CAPTIONS_LIST,o.MEDIA_CAPTIONS_SHOWING,o.MEDIA_SUBTITLES_LIST,o.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,a){var r,n;if(e===p.MEDIA_CONTROLLER){if(t){let s=u.getElementById(t);(r=s==null?void 0:s.unassociateElement)==null||r.call(s,this)}if(a){let s=u.getElementById(a);(n=s==null?void 0:s.associateElement)==null||n.call(s,this)}}else e===o.MEDIA_CAPTIONS_SHOWING||e===o.MEDIA_SUBTITLES_SHOWING&&a!==t?a?Mt(this,na,Hr).call(this):Mt(this,sa,$r).call(this):e==="disabled"&&a!==t&&(a==null?this.enable():this.disable());if(this.hasAttribute("default-showing")&&O(this,ze).hidden){let s=!this.hasAttribute("no-subtitles-fallback");if((s?[o.MEDIA_CAPTIONS_LIST,o.MEDIA_SUBTITLES_LIST]:[o.MEDIA_CAPTIONS_LIST]).includes(e)){let c=!!this.getAttribute(o.MEDIA_CAPTIONS_LIST)||!!(s&&this.getAttribute(o.MEDIA_SUBTITLES_LIST));this._captionsReady!==c&&(this._captionsReady=c,this._captionsReady&&ye(this))}}}enable(){this.addEventListener("click",O(this,ri)),O(this,xe).removeAttribute("disabled")}disable(){this.removeEventListener("click",O(this,ri)),O(this,xe).setAttribute("disabled","")}connectedCallback(){var e;this.hasAttribute("disabled")||this.enable(),Ht(this)&&Mt(this,na,Hr).call(this);let t=this.getAttribute(p.MEDIA_CONTROLLER);if(t){let a=u.getElementById(t);(e=a==null?void 0:a.associateElement)==null||e.call(a,this)}}disconnectedCallback(){var e;this.disable();let t=this.getAttribute(p.MEDIA_CONTROLLER);if(t){let a=u.getElementById(t);(e=a==null?void 0:a.unassociateElement)==null||e.call(a,this)}}get keysUsed(){return["Enter"," ","ArrowUp","ArrowDown","f","c","k","m"]}};xe=new WeakMap;ze=new WeakMap;kt=new WeakMap;oe=new WeakMap;ri=new WeakMap;Br=new WeakSet;Vs=function(){Mt(this,Fr,Fs).call(this)};Fr=new WeakSet;Fs=function(){var i,e,t;if(O(this,oe).offsetWidth===0)return;let a=this.shadowRoot.querySelectorAll("svg"),r=((i=O(this,ze).assignedElements()[0])!=null?i:a[0]).getBoundingClientRect(),n=((e=O(this,kt).assignedElements()[0])!=null?e:a[1]).getBoundingClientRect();if(this.hasAttribute("media-controller")){let s=r.width,d=n.width,c=s>0?s:d>0?d:0,m=r.height,b=n.height,y=m>0?m:b>0?b:0;O(this,oe).style.marginLeft=`calc(-${c}px - 10px * 2)`,O(this,oe).style.marginTop=`calc(${y}px + 10px * 2)`}else{let s=r.x,d=n.x,c=s>0?s:d>0?d:0,m=(t=this.getAttribute("bounds")?Fe(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?t:this,b=m.getBoundingClientRect().x;O(this,oe).offsetWidth+c-b>m.offsetWidth?O(this,oe).style.translate=m.offsetWidth-O(this,oe).offsetWidth+"px":O(this,oe).style.translate=`calc(${c}px - ${b}px - 10px)`}};na=new WeakSet;Hr=function(){O(this,ze).hidden=!1,O(this,kt).hidden=!0};sa=new WeakSet;$r=function(){O(this,ze).hidden=!0,O(this,kt).hidden=!1};l.customElements.get("media-captions-menu-button")||l.customElements.define("media-captions-menu-button",Wr);var v=Vo(require("@mux/mux-video")),x=require("@mux/playback-core");var eo=require("@mux/mux-video");var td="en",Xe={code:td};var Ys="en";function _(i,e=!0){var r,n;let t=e&&(n=(r=Xe)==null?void 0:r[i])!=null?n:i,a=e?Xe.code:Ys;return new Kr(t,a)}var Kr=class{constructor(e,t=(a=>(a=Xe.code)!=null?a:Ys)()){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 Gs(i){let e="";return Object.entries(i).forEach(([t,a])=>{a!=null&&(e+=`${id(t)}: ${a}; `)}),e?e.trim():void 0}function id(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Zs(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function be(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function oa(i){let e=ad(i).toString();return e?"?"+e:""}function ad(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}function De(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 Yr=(i,e)=>!i||!e?!1:i.contains(e)?!0:Yr(i,e.getRootNode().host);var Gr="mux.com",rd=()=>{try{return"1.7.1"}catch{}return"UNKNOWN"},nd=rd(),da=()=>nd,Zr=(i,{token:e,domain:t=Gr}={})=>`https://stream.${t}/${i}.m3u8${oa(!!e?{token:e}:{redundant_streams:!0})}`,qs=(i,{token:e,thumbnailTime:t,domain:a=Gr}={})=>{let r=e==null?t:void 0,{aud:n}=De(e);if(!(e&&n!=="t"))return`https://image.${a}/${i}/thumbnail.webp${oa({token:e,time:r})}`},Qs=(i,{token:e,domain:t=Gr}={})=>{let{aud:a}=De(e);if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${oa({token:e,format:"webp"})}`};var sd={crossorigin:"crossOrigin",playsinline:"playsInline"};function zs(i){var e;return(e=sd[i])!=null?e:Zs(i)}var Je,je,K,la=class{constructor(e,t){L(this,Je,void 0);L(this,je,void 0);L(this,K,[]);G(this,Je,e),G(this,je,t)}[Symbol.iterator](){return A(this,K).values()}get length(){return A(this,K).length}get value(){var e;return(e=A(this,K).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(G(this,K,[]),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return A(this,K)[e]}values(){return A(this,K).values()}keys(){return A(this,K).keys()}forEach(e){A(this,K).forEach(e)}add(...e){var t,a;e.forEach(r=>{this.contains(r)||A(this,K).push(r)}),!(this.value===""&&!((t=A(this,Je))!=null&&t.hasAttribute(`${A(this,je)}`)))&&((a=A(this,Je))==null||a.setAttribute(`${A(this,je)}`,`${this.value}`))}remove(...e){var t;e.forEach(a=>{A(this,K).splice(A(this,K).indexOf(a),1)}),(t=A(this,Je))==null||t.setAttribute(`${A(this,je)}`,`${this.value}`)}contains(e){return A(this,K).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)}};Je=new WeakMap,je=new WeakMap,K=new WeakMap;var Xs=`[mux-player ${da()}]`;function Re(...i){console.warn(Xs,...i)}function re(...i){console.error(Xs,...i)}function ca(i){var t;let e=(t=i.message)!=null?t:"";if(i.file){let a="https://github.com/muxinc/elements/blob/main/errors/";e+=` ${_("Read more: ")}
892
+ `;var Wr=class extends l.HTMLElement{constructor(){super(),pe(this,Br),pe(this,Fr),pe(this,na),pe(this,sa),pe(this,xe,void 0),pe(this,ze,void 0),pe(this,kt,void 0),pe(this,oe,void 0),pe(this,ri,void 0);let e=this.attachShadow({mode:"open"}),t=Ks.content.cloneNode(!0);this.nativeEl=t,e.append(t),ai(this,xe,this.shadowRoot.querySelector("media-chrome-menu-button")),ai(this,ze,O(this,xe).querySelector(".enabled")),ai(this,kt,O(this,xe).querySelector(".disabled")),ai(this,oe,O(this,xe).querySelector("media-captions-listbox")),ai(this,ri,Mt(this,Br,Vs).bind(this)),this._captionsReady=!1,Mt(this,sa,$r).call(this)}static get observedAttributes(){return["disabled",p.MEDIA_CONTROLLER,"no-subtitles-fallback","default-showing",o.MEDIA_CAPTIONS_LIST,o.MEDIA_CAPTIONS_SHOWING,o.MEDIA_SUBTITLES_LIST,o.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,a){var r,n;if(e===p.MEDIA_CONTROLLER){if(t){let s=u.getElementById(t);(r=s==null?void 0:s.unassociateElement)==null||r.call(s,this)}if(a){let s=u.getElementById(a);(n=s==null?void 0:s.associateElement)==null||n.call(s,this)}}else e===o.MEDIA_CAPTIONS_SHOWING||e===o.MEDIA_SUBTITLES_SHOWING&&a!==t?a?Mt(this,na,Hr).call(this):Mt(this,sa,$r).call(this):e==="disabled"&&a!==t&&(a==null?this.enable():this.disable());if(this.hasAttribute("default-showing")&&O(this,ze).hidden){let s=!this.hasAttribute("no-subtitles-fallback");if((s?[o.MEDIA_CAPTIONS_LIST,o.MEDIA_SUBTITLES_LIST]:[o.MEDIA_CAPTIONS_LIST]).includes(e)){let c=!!this.getAttribute(o.MEDIA_CAPTIONS_LIST)||!!(s&&this.getAttribute(o.MEDIA_SUBTITLES_LIST));this._captionsReady!==c&&(this._captionsReady=c,this._captionsReady&&ye(this))}}}enable(){this.addEventListener("click",O(this,ri)),O(this,xe).removeAttribute("disabled")}disable(){this.removeEventListener("click",O(this,ri)),O(this,xe).setAttribute("disabled","")}connectedCallback(){var e;this.hasAttribute("disabled")||this.enable(),Ht(this)&&Mt(this,na,Hr).call(this);let t=this.getAttribute(p.MEDIA_CONTROLLER);if(t){let a=u.getElementById(t);(e=a==null?void 0:a.associateElement)==null||e.call(a,this)}}disconnectedCallback(){var e;this.disable();let t=this.getAttribute(p.MEDIA_CONTROLLER);if(t){let a=u.getElementById(t);(e=a==null?void 0:a.unassociateElement)==null||e.call(a,this)}}get keysUsed(){return["Enter"," ","ArrowUp","ArrowDown","f","c","k","m"]}};xe=new WeakMap;ze=new WeakMap;kt=new WeakMap;oe=new WeakMap;ri=new WeakMap;Br=new WeakSet;Vs=function(){Mt(this,Fr,Fs).call(this)};Fr=new WeakSet;Fs=function(){var i,e,t;if(O(this,oe).offsetWidth===0)return;let a=this.shadowRoot.querySelectorAll("svg"),r=((i=O(this,ze).assignedElements()[0])!=null?i:a[0]).getBoundingClientRect(),n=((e=O(this,kt).assignedElements()[0])!=null?e:a[1]).getBoundingClientRect();if(this.hasAttribute("media-controller")){let s=r.width,d=n.width,c=s>0?s:d>0?d:0,m=r.height,b=n.height,y=m>0?m:b>0?b:0;O(this,oe).style.marginLeft=`calc(-${c}px - 10px * 2)`,O(this,oe).style.marginTop=`calc(${y}px + 10px * 2)`}else{let s=r.x,d=n.x,c=s>0?s:d>0?d:0,m=(t=this.getAttribute("bounds")?Fe(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?t:this,b=m.getBoundingClientRect().x;O(this,oe).offsetWidth+c-b>m.offsetWidth?O(this,oe).style.translate=m.offsetWidth-O(this,oe).offsetWidth+"px":O(this,oe).style.translate=`calc(${c}px - ${b}px - 10px)`}};na=new WeakSet;Hr=function(){O(this,ze).hidden=!1,O(this,kt).hidden=!0};sa=new WeakSet;$r=function(){O(this,ze).hidden=!0,O(this,kt).hidden=!1};l.customElements.get("media-captions-menu-button")||l.customElements.define("media-captions-menu-button",Wr);var v=Vo(require("@mux/mux-video")),x=require("@mux/playback-core");var eo=require("@mux/mux-video");var td="en",Xe={code:td};var Ys="en";function _(i,e=!0){var r,n;let t=e&&(n=(r=Xe)==null?void 0:r[i])!=null?n:i,a=e?Xe.code:Ys;return new Kr(t,a)}var Kr=class{constructor(e,t=(a=>(a=Xe.code)!=null?a:Ys)()){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 Gs(i){let e="";return Object.entries(i).forEach(([t,a])=>{a!=null&&(e+=`${id(t)}: ${a}; `)}),e?e.trim():void 0}function id(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Zs(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function be(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function oa(i){let e=ad(i).toString();return e?"?"+e:""}function ad(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}function De(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 Yr=(i,e)=>!i||!e?!1:i.contains(e)?!0:Yr(i,e.getRootNode().host);var Gr="mux.com",rd=()=>{try{return"1.7.2"}catch{}return"UNKNOWN"},nd=rd(),da=()=>nd,Zr=(i,{token:e,domain:t=Gr}={})=>`https://stream.${t}/${i}.m3u8${oa(!!e?{token:e}:{redundant_streams:!0})}`,qs=(i,{token:e,thumbnailTime:t,domain:a=Gr}={})=>{let r=e==null?t:void 0,{aud:n}=De(e);if(!(e&&n!=="t"))return`https://image.${a}/${i}/thumbnail.webp${oa({token:e,time:r})}`},Qs=(i,{token:e,domain:t=Gr}={})=>{let{aud:a}=De(e);if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${oa({token:e,format:"webp"})}`};var sd={crossorigin:"crossOrigin",playsinline:"playsInline"};function zs(i){var e;return(e=sd[i])!=null?e:Zs(i)}var Je,je,K,la=class{constructor(e,t){L(this,Je,void 0);L(this,je,void 0);L(this,K,[]);G(this,Je,e),G(this,je,t)}[Symbol.iterator](){return A(this,K).values()}get length(){return A(this,K).length}get value(){var e;return(e=A(this,K).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(G(this,K,[]),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return A(this,K)[e]}values(){return A(this,K).values()}keys(){return A(this,K).keys()}forEach(e){A(this,K).forEach(e)}add(...e){var t,a;e.forEach(r=>{this.contains(r)||A(this,K).push(r)}),!(this.value===""&&!((t=A(this,Je))!=null&&t.hasAttribute(`${A(this,je)}`)))&&((a=A(this,Je))==null||a.setAttribute(`${A(this,je)}`,`${this.value}`))}remove(...e){var t;e.forEach(a=>{A(this,K).splice(A(this,K).indexOf(a),1)}),(t=A(this,Je))==null||t.setAttribute(`${A(this,je)}`,`${this.value}`)}contains(e){return A(this,K).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)}};Je=new WeakMap,je=new WeakMap,K=new WeakMap;var Xs=`[mux-player ${da()}]`;function Re(...i){console.warn(Xs,...i)}function re(...i){console.error(Xs,...i)}function ca(i){var t;let e=(t=i.message)!=null?t:"";if(i.file){let a="https://github.com/muxinc/elements/blob/main/errors/";e+=` ${_("Read more: ")}
893
893
  ${a}${i.file}`}Re(e)}var V={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},et={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},js=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}}),od=eo.VideoEvents.filter(i=>i!=="error"),ld=Object.values(V).filter(i=>![V.PLAYSINLINE].includes(i)),dd=Object.values(et);function to(i){i.querySelectorAll(":scope > track").forEach(e=>{var t;(t=i.media)==null||t.append(e.cloneNode())}),od.forEach(e=>{var t;(t=i.media)==null||t.addEventListener(e,a=>{i.dispatchEvent(new Event(a.type))})})}var qr=class extends R.HTMLElement{static get observedAttributes(){return[...ld,...dd]}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 d,c;let s=(d=this.media)==null?void 0:d.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 et.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case et.VOLUME:{let s=(r=be(a))!=null?r:1;this.media&&(this.media.volume=s);return}case et.PLAYBACKRATE:{let s=(n=be(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:js}get seekable(){var e,t;return(t=(e=this.media)==null?void 0:e.seekable)!=null?t:js}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=be(this.getAttribute(et.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(et.PLAYBACKRATE,`${e}`):this.removeAttribute(et.PLAYBACKRATE)}get crossOrigin(){return ni(this,V.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(V.CROSSORIGIN,`${e}`)}get autoplay(){return ni(this,V.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(V.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(V.AUTOPLAY)}get loop(){return ni(this,V.LOOP)!=null}set loop(e){e?this.setAttribute(V.LOOP,""):this.removeAttribute(V.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 ni(this,V.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(V.MUTED,""):this.removeAttribute(V.MUTED)}get playsInline(){return ni(this,V.PLAYSINLINE)!=null}set playsInline(e){re("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(V.PRELOAD,e):this.removeAttribute(V.PRELOAD)}};function ni(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var Qr=qr;var cd=Object.defineProperty,ud=(i,e,t)=>e in i?cd(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,md=(i,e,t)=>(ud(i,typeof e!="symbol"?e+"":e,t),t),so=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},g=(i,e,t)=>(so(i,e,"read from private field"),t?t.call(i):e.get(i)),le=(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)},Ee=(i,e,t,a)=>(so(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t),St,ua,tt,si,Oe,Pe,Ue,it,Ct,ma,ne,io=1,ao=0,hd=1,pd={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 Y&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=n:typeof n=="function"&&r instanceof Y?r.element[r.attributeName]=n:r.value=n}}}},fe=class extends l.DocumentFragment{constructor(e,t,a=pd){var r;super(),le(this,St,void 0),le(this,ua,void 0),this.append(e.content.cloneNode(!0)),Ee(this,St,oo(this)),Ee(this,ua,a),(r=a.createCallback)==null||r.call(a,this,g(this,St),t),a.processCallback(this,g(this,St),t)}update(e){g(this,ua).processCallback(this,g(this,St),e)}};St=new WeakMap;ua=new WeakMap;var oo=(i,e=[])=>{let t,a;for(let r of i.attributes||[])if(r.value.includes("{{")){let n=new zr;for([t,a]of no(r.value))if(!t)n.append(a);else{let s=new Y(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===io&&!(r instanceof HTMLTemplateElement))oo(r,e);else if(r.nodeType===io||r.data.includes("{{")){let n=[];if(r.data)for([t,a]of no(r.data))if(!t)n.push(new Text(a));else{let s=new ve(i);n.push(s),e.push([a,s])}else if(r instanceof HTMLTemplateElement){let s=new oi(i,r);n.push(s),e.push([s.expression,s])}r.replaceWith(...n.flatMap(s=>s.replacementNodes||[s]))}return e},ro={},no=i=>{let e="",t=0,a=ro[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([ao,e]),e="",r++):n==="}"&&i[r+1]==="}"&&i[r-1]!=="\\"&&!--t?(a.push([hd,e.trim()]),e="",r++):e+=n||"";return e&&a.push([ao,(t>0?"{{":"")+e]),ro[i]=a},bd=11,ha=class{get value(){return""}set value(e){}toString(){return this.value}},lo=new WeakMap,zr=class{constructor(){le(this,tt,[])}[Symbol.iterator](){return g(this,tt).values()}get length(){return g(this,tt).length}item(e){return g(this,tt)[e]}append(...e){for(let t of e)t instanceof Y&&lo.set(t,this),g(this,tt).push(t)}toString(){return g(this,tt).join("")}};tt=new WeakMap;var Y=class extends ha{constructor(e,t,a){super(),le(this,it),le(this,si,""),le(this,Oe,void 0),le(this,Pe,void 0),le(this,Ue,void 0),Ee(this,Oe,e),Ee(this,Pe,t),Ee(this,Ue,a)}get attributeName(){return g(this,Pe)}get attributeNamespace(){return g(this,Ue)}get element(){return g(this,Oe)}get value(){return g(this,si)}set value(e){g(this,si)!==e&&(Ee(this,si,e),!g(this,it,Ct)||g(this,it,Ct).length===1?e==null?g(this,Oe).removeAttributeNS(g(this,Ue),g(this,Pe)):g(this,Oe).setAttributeNS(g(this,Ue),g(this,Pe),e):g(this,Oe).setAttributeNS(g(this,Ue),g(this,Pe),g(this,it,Ct)))}get booleanValue(){return g(this,Oe).hasAttributeNS(g(this,Ue),g(this,Pe))}set booleanValue(e){if(!g(this,it,Ct)||g(this,it,Ct).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};si=new WeakMap;Oe=new WeakMap;Pe=new WeakMap;Ue=new WeakMap;it=new WeakSet;Ct=function(){return lo.get(this)};var ve=class extends ha{constructor(e,t){super(),le(this,ma,void 0),le(this,ne,void 0),Ee(this,ma,e),Ee(this,ne,t?[...t]:[new Text])}get replacementNodes(){return g(this,ne)}get parentNode(){return g(this,ma)}get nextSibling(){return g(this,ne)[g(this,ne).length-1].nextSibling}get previousSibling(){return g(this,ne)[0].previousSibling}get value(){return g(this,ne).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===bd?[...a.childNodes]:a.nodeType?[a]:[new Text(a)]);t.length||t.push(new Text),Ee(this,ne,Ed(g(this,ne)[0].parentNode,g(this,ne),t,this.nextSibling))}};ma=new WeakMap;ne=new WeakMap;var oi=class extends ve{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),md(this,"directive"),this.expression=r,this.template=t,this.directive=a}};function Ed(i,e,t,a=null){let r=0,n,s,d,c=t.length,m=e.length;for(;r<c&&r<m&&e[r]==t[r];)r++;for(;r<c&&r<m&&t[c-1]==e[m-1];)a=t[--m,--c];if(r==m)for(;r<c;)i.insertBefore(t[r++],a);if(r==c)for(;r<m;)i.removeChild(e[r++]);else{for(n=e[r];r<c;)d=t[r++],s=n?n.nextSibling:a,n==d?n=s:r<c&&t[r]==s?(i.replaceChild(d,n),n=s):i.insertBefore(d,n);for(;n!=a;)s=n.nextSibling,i.removeChild(n),n=s}return t}var fd=/([>&])?\s*(\w+)\s*(.*)/,vd=/^(\?\?|\|)?\s*(['"\w]*)/,gd={"|":{string:i=>String(i)},"??":(i,e)=>i!=null?i:e},pa=class{constructor(e){this.template=e}},at=new WeakMap,rt=new WeakMap,Jr={partial:(i,e)=>{e[i.expression]=new pa(i.template)},if:(i,e)=>{var t;if(yd(i.expression,e))if(at.get(i)!==i.template){at.set(i,i.template);let a=new fe(i.template,e,ba);i.replace(a),rt.set(i,a)}else(t=rt.get(i))==null||t.update(e);else i.replace(""),at.delete(i),rt.delete(i)}},Ad=Object.keys(Jr),ba={processCallback(i,e,t){var a,r,n,s;if(!!t)for(let[d,c]of e){if(c instanceof oi){if(!c.directive){let M=Ad.find(k=>c.template.hasAttribute(k));M&&(c.directive=M,c.expression=c.template.getAttribute(M))}(a=Jr[c.directive])==null||a.call(Jr,c,t);continue}let[,m,b,y]=(r=d.match(fd))!=null?r:[],f=t[b],[,I,B]=(n=y.match(vd))!=null?n:[],D=gd[I];if(typeof D=="function")f=D(f,li(B,t));else if(D&&f!=null){let M=D[B];M&&(f=M(f))}if(f){if(f instanceof pa){if(m!==">")continue;let M={...t},k=d.matchAll(/(\w+)\s*=\s*(['"\w]*)/g);for(let[,j,Q]of k)M[j]=li(Q,t);at.get(c)!==f.template?(at.set(c,f.template),f=new fe(f.template,M,ba),c.value=f,rt.set(c,f)):(s=rt.get(c))==null||s.update(M);continue}c instanceof Y&&c.attributeName.startsWith("aria-")&&(f=String(f)),c instanceof Y?typeof f=="boolean"?c.booleanValue=f:typeof f=="function"?c.element[c.attributeName]=f:c.value=f:(c.value=f,at.delete(c),rt.delete(c))}else c instanceof Y?c.booleanValue=!1:(c.value=void 0,at.delete(c),rt.delete(c))}}},_d={"==":(i,e)=>i==e,"!=":(i,e)=>i!=e,">":(i,e)=>i>e,">=":(i,e)=>i>=e,"<":(i,e)=>i<e,"<=":(i,e)=>i<=e};function yd(i,e){var t;let a=Id(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 Xr(a[0])?li(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=_d[(t=r[1])==null?void 0:t.token];return!n||!Xr(r[0])||!Xr(r[2])?(console.warn(`Warning: invalid expression \`${i}\``),!1):n(li(r[0].token,e),li(r[2].token,e))}}function Xr({type:i}){return["number","boolean","string","param"].includes(i)}function li(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):An(i)?parseFloat(i):e[i]}function Id(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 Td=Object.defineProperty,Md=(i,e,t)=>e in i?Td(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,di=(i,e,t)=>(Md(i,typeof e!="symbol"?e+"":e,t),t),ho=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},co=(i,e,t)=>(ho(i,e,"read from private field"),t?t.call(i):e.get(i)),uo=(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)},mo=(i,e,t,a)=>(ho(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t),Ea,fa,jr={"media-target-live-window":"targetLiveWindow","media-stream-type":"streamType"},Lt=class extends l.HTMLElement{constructor(){super(),di(this,"renderRoot"),di(this,"renderer"),uo(this,Ea,void 0),uo(this,fa,void 0),this.renderRoot=this.attachShadow({mode:"open"});let e=new MutationObserver(t=>{t.some(a=>{let r=a.target;return r===this?!0:r.localName!=="media-controller"?!1:!!(jr[a.attributeName]||a.attributeName.startsWith("breakpoint-"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!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=co(this,Ea))!=null?t:this.constructor.template}set template(e){mo(this,Ea,e),this.createRenderer()}get props(){var e,t,a;let r=[...Array.from((t=(e=this.mediaController)==null?void 0:e.attributes)!=null?t:[]).filter(({name:s})=>jr[s]||s.startsWith("breakpoint-")),...Array.from(this.attributes)],n={};for(let s of r){let d=(a=jr[s.name])!=null?a:vn(s.name);s.value!=null?n[d]=s.value===""?!0:s.value:n[d]=!1}return n}attributeChangedCallback(e,t,a){e==="template"&&t!=a&&this.createRenderer()}createRenderer(){this.template&&this.template!==co(this,fa)&&(mo(this,fa,this.template),this.renderer=new fe(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)}};Ea=new WeakMap;fa=new WeakMap;di(Lt,"template");di(Lt,"observedAttributes",["template"]);di(Lt,"processor",ba);l.customElements.get("media-theme")||l.customElements.define("media-theme",Lt);var bo=`
894
894
  :host {
895
895
  cursor: pointer;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var Se=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var l=(t,a,e)=>(Se(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)},A=(t,a,e,i)=>(Se(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var b=(t,a,e)=>(Se(t,a,"access private method"),e);var j=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends j{}globalThis.DocumentFragment=t}var Q=class extends j{},Ce=class extends j{},Dt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(Q)}},X,Re=class{constructor(a,e={}){c(this,X,void 0);A(this,X,e==null?void 0:e.detail)}get detail(){return l(this,X)}initCustomEvent(){}};X=new WeakMap;function It(t,a){return new Q}var Xe={document:{createElement:It},DocumentFragment,customElements:Dt,CustomEvent:Re,EventTarget:j,HTMLElement:Q,HTMLVideoElement:Ce},et=typeof window=="undefined"||typeof globalThis.customElements=="undefined",p=et?Xe:globalThis,v=et?Xe.document:globalThis.document;import{MediaController as sa}from"media-chrome";import"media-chrome/dist/media-captions-menu-button.js";import la,{MediaError as $e,Attributes as u}from"@mux/mux-video";import{StreamTypes as R,PlaybackTypes as Te,addTextTrack as da,removeTextTrack as ua,CmcdTypeValues as St}from"@mux/playback-core";import{VideoEvents as Ft}from"@mux/mux-video";var _t="en",H={code:_t};var tt="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:tt;return new Me(e,i)}var Me=class{constructor(a,e=(i=>(i=H.code)!=null?i:tt)()){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 at(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${Nt(e)}: ${i}; `)}),a?a.trim():void 0}function Nt(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function it(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function S(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ce(t){let a=Vt(t).toString();return a?"?"+a:""}function Vt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function I(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 Pe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Pe(t,a.getRootNode().host);var Be="mux.com",Ht=()=>{try{return"1.7.1"}catch{}return"UNKNOWN"},$t=Ht(),be=()=>$t,De=(t,{token:a,domain:e=Be}={})=>`https://stream.${e}/${t}.m3u8${ce(!!a?{token:a}:{redundant_streams:!0})}`,rt=(t,{token:a,thumbnailTime:e,domain:i=Be}={})=>{let r=a==null?e:void 0,{aud:o}=I(a);if(!(a&&o!=="t"))return`https://image.${i}/${t}/thumbnail.webp${ce({token:a,time:r})}`},ot=(t,{token:a,domain:e=Be}={})=>{let{aud:i}=I(a);if(!(a&&i!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ce({token:a,format:"webp"})}`};var Kt={crossorigin:"crossOrigin",playsinline:"playsInline"};function nt(t){var a;return(a=Kt[t])!=null?a:it(t)}var $,K,k,pe=class{constructor(a,e){c(this,$,void 0);c(this,K,void 0);c(this,k,[]);A(this,$,a),A(this,K,e)}[Symbol.iterator](){return l(this,k).values()}get length(){return l(this,k).length}get value(){var a;return(a=l(this,k).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(A(this,k,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return l(this,k)[a]}values(){return l(this,k).values()}keys(){return l(this,k).keys()}forEach(a){l(this,k).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||l(this,k).push(r)}),!(this.value===""&&!((e=l(this,$))!=null&&e.hasAttribute(`${l(this,K)}`)))&&((i=l(this,$))==null||i.setAttribute(`${l(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{l(this,k).splice(l(this,k).indexOf(i),1)}),(e=l(this,$))==null||e.setAttribute(`${l(this,K)}`,`${this.value}`)}contains(a){return l(this,k).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};$=new WeakMap,K=new WeakMap,k=new WeakMap;var st=`[mux-player ${be()}]`;function _(...t){console.warn(st,...t)}function x(...t){console.error(st,...t)}function he(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: ")}
1
+ var Se=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var l=(t,a,e)=>(Se(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)},A=(t,a,e,i)=>(Se(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var b=(t,a,e)=>(Se(t,a,"access private method"),e);var j=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends j{}globalThis.DocumentFragment=t}var Q=class extends j{},Ce=class extends j{},Dt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(Q)}},X,Re=class{constructor(a,e={}){c(this,X,void 0);A(this,X,e==null?void 0:e.detail)}get detail(){return l(this,X)}initCustomEvent(){}};X=new WeakMap;function It(t,a){return new Q}var Xe={document:{createElement:It},DocumentFragment,customElements:Dt,CustomEvent:Re,EventTarget:j,HTMLElement:Q,HTMLVideoElement:Ce},et=typeof window=="undefined"||typeof globalThis.customElements=="undefined",p=et?Xe:globalThis,v=et?Xe.document:globalThis.document;import{MediaController as sa}from"media-chrome";import"media-chrome/dist/experimental/media-captions-menu-button.js";import la,{MediaError as $e,Attributes as u}from"@mux/mux-video";import{StreamTypes as R,PlaybackTypes as Te,addTextTrack as da,removeTextTrack as ua,CmcdTypeValues as St}from"@mux/playback-core";import{VideoEvents as Ft}from"@mux/mux-video";var _t="en",H={code:_t};var tt="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:tt;return new Me(e,i)}var Me=class{constructor(a,e=(i=>(i=H.code)!=null?i:tt)()){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 at(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${Nt(e)}: ${i}; `)}),a?a.trim():void 0}function Nt(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function it(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function S(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ce(t){let a=Vt(t).toString();return a?"?"+a:""}function Vt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function I(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 Pe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Pe(t,a.getRootNode().host);var Be="mux.com",Ht=()=>{try{return"1.7.2"}catch{}return"UNKNOWN"},$t=Ht(),be=()=>$t,De=(t,{token:a,domain:e=Be}={})=>`https://stream.${e}/${t}.m3u8${ce(!!a?{token:a}:{redundant_streams:!0})}`,rt=(t,{token:a,thumbnailTime:e,domain:i=Be}={})=>{let r=a==null?e:void 0,{aud:o}=I(a);if(!(a&&o!=="t"))return`https://image.${i}/${t}/thumbnail.webp${ce({token:a,time:r})}`},ot=(t,{token:a,domain:e=Be}={})=>{let{aud:i}=I(a);if(!(a&&i!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ce({token:a,format:"webp"})}`};var Kt={crossorigin:"crossOrigin",playsinline:"playsInline"};function nt(t){var a;return(a=Kt[t])!=null?a:it(t)}var $,K,k,pe=class{constructor(a,e){c(this,$,void 0);c(this,K,void 0);c(this,k,[]);A(this,$,a),A(this,K,e)}[Symbol.iterator](){return l(this,k).values()}get length(){return l(this,k).length}get value(){var a;return(a=l(this,k).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(A(this,k,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return l(this,k)[a]}values(){return l(this,k).values()}keys(){return l(this,k).keys()}forEach(a){l(this,k).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||l(this,k).push(r)}),!(this.value===""&&!((e=l(this,$))!=null&&e.hasAttribute(`${l(this,K)}`)))&&((i=l(this,$))==null||i.setAttribute(`${l(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{l(this,k).splice(l(this,k).indexOf(i),1)}),(e=l(this,$))==null||e.setAttribute(`${l(this,K)}`,`${this.value}`)}contains(a){return l(this,k).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};$=new WeakMap,K=new WeakMap,k=new WeakMap;var st=`[mux-player ${be()}]`;function _(...t){console.warn(st,...t)}function x(...t){console.error(st,...t)}function he(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
2
  ${i}${t.file}`}_(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},F={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},dt=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}}),Ut=Ft.filter(t=>t!=="error"),Yt=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),Zt=Object.values(F);function ut(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),Ut.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,i=>{t.dispatchEvent(new Event(i.type))})})}var Ie=class extends p.HTMLElement{static get observedAttributes(){return[...Yt,...Zt]}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,g;let n=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);n&&((g=this.media)==null||g.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 F.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case F.VOLUME:{let n=(r=S(i))!=null?r:1;this.media&&(this.media.volume=n);return}case F.PLAYBACKRATE:{let n=(o=S(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:dt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:dt}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=S(this.getAttribute(F.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(F.PLAYBACKRATE,`${a}`):this.removeAttribute(F.PLAYBACKRATE)}get crossOrigin(){return ee(this,y.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(y.CROSSORIGIN,`${a}`)}get autoplay(){return ee(this,y.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(y.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return ee(this,y.LOOP)!=null}set loop(a){a?this.setAttribute(y.LOOP,""):this.removeAttribute(y.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return ee(this,y.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return ee(this,y.PLAYSINLINE)!=null}set playsInline(a){x("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(y.PRELOAD,a):this.removeAttribute(y.PRELOAD)}};function ee(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var _e=Ie;import"media-chrome/dist/media-theme-element.js";var ct=`
3
3
  :host {
4
4
  cursor: pointer;