@mux/mux-player 3.6.2-canary.2 → 3.7.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/base.cjs.js CHANGED
@@ -1271,7 +1271,7 @@
1271
1271
 
1272
1272
  </slot>
1273
1273
  </div>
1274
- `}var an=(t,e=t.mediaCurrentTime)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;if(Number.isNaN(a))return 0;let r=(e-i)/(a-i);return Math.max(0,Math.min(r,1))},bc=(t,e=t.range.valueAsNumber)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;return Number.isNaN(a)?0:e*(a-i)+i},mr=class extends Ke{constructor(){super(),te(this,Zi),te(this,al),te(this,sn),te(this,ln),te(this,dn),te(this,el),te(this,cr),te(this,tl),te(this,Gi,void 0),te(this,ii,void 0),te(this,on,void 0),te(this,lr,void 0),te(this,nn,void 0),te(this,rn,void 0),te(this,dr,void 0),te(this,ur,void 0),te(this,Yi,void 0),te(this,qi,void 0),te(this,js,a=>{this.dragging||(Ai(a)&&(this.range.valueAsNumber=a),J(this,qi)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),we(this,on,this.shadowRoot.querySelectorAll('[part~="box"]')),we(this,nn,this.shadowRoot.querySelector('[part~="preview-box"]')),we(this,rn,this.shadowRoot.querySelector('[part~="current-box"]'));let i=getComputedStyle(this);we(this,dr,parseInt(i.getPropertyValue("--media-box-padding-left"))),we(this,ur,parseInt(i.getPropertyValue("--media-box-padding-right"))),we(this,ii,new tn(this.range,J(this,js),60))}static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_PAUSED,n.MEDIA_DURATION,n.MEDIA_SEEKABLE,n.MEDIA_CURRENT_TIME,n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_TIME,n.MEDIA_PREVIEW_CHAPTER,n.MEDIA_BUFFERED,n.MEDIA_PLAYBACK_RATE,n.MEDIA_LOADING,n.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",h("seek")),le(this,Zi,sr).call(this),we(this,Gi,this.getRootNode()),(e=J(this,Gi))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),le(this,Zi,sr).call(this),(e=J(this,Gi))==null||e.removeEventListener("transitionstart",this),we(this,Gi,null)}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),i!=a&&(e===n.MEDIA_CURRENT_TIME||e===n.MEDIA_PAUSED||e===n.MEDIA_ENDED||e===n.MEDIA_LOADING||e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE?(J(this,ii).update({start:an(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),le(this,Zi,sr).call(this),rf(this)):e===n.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=J(this,Yi),this.updateBar()))}get mediaChaptersCues(){return J(this,Yi)}set mediaChaptersCues(e){var i;we(this,Yi,e),this.updateSegments((i=J(this,Yi))==null?void 0:i.map(a=>({start:an(this,a.startTime),end:an(this,a.endTime)})))}get mediaPaused(){return k(this,n.MEDIA_PAUSED)}set mediaPaused(e){S(this,n.MEDIA_PAUSED,e)}get mediaLoading(){return k(this,n.MEDIA_LOADING)}set mediaLoading(e){S(this,n.MEDIA_LOADING,e)}get mediaDuration(){return R(this,n.MEDIA_DURATION)}set mediaDuration(e){O(this,n.MEDIA_DURATION,e)}get mediaCurrentTime(){return R(this,n.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){O(this,n.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return R(this,n.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){O(this,n.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){let e=this.getAttribute(n.MEDIA_BUFFERED);return e?e.split(" ").map(i=>i.split(":").map(a=>+a)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(n.MEDIA_BUFFERED);return}let i=e.map(a=>a.join(":")).join(" ");this.setAttribute(n.MEDIA_BUFFERED,i)}get mediaSeekable(){let e=this.getAttribute(n.MEDIA_SEEKABLE);if(e)return e.split(":").map(i=>+i)}set mediaSeekable(e){if(e==null){this.removeAttribute(n.MEDIA_SEEKABLE);return}this.setAttribute(n.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;let[,i=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaSeekableStart(){var e;let[i=0]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaPreviewImage(){return I(this,n.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){M(this,n.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return R(this,n.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){O(this,n.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return k(this,n.MEDIA_ENDED)}set mediaEnded(e){S(this,n.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;let i=this.mediaBuffered;if(!i.length)return;let a;if(this.mediaEnded)a=1;else{let o=this.mediaCurrentTime,[,s=this.mediaSeekableStart]=(e=i.find(([l,u])=>l<=o&&o<=u))!=null?e:[];a=an(this,s)}let{style:r}=W(this.shadowRoot,"#buffered");r.setProperty("width",`${a*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let i=W(this.shadowRoot,"#current-rail"),a=W(this.shadowRoot,'[part~="current-box"]'),r=le(this,sn,rl).call(this,J(this,rn)),o=le(this,ln,ol).call(this,r,this.range.valueAsNumber),s=le(this,dn,nl).call(this,r,this.range.valueAsNumber);i.style.transform=`translateX(${o})`,i.style.setProperty("--_range-width",`${r.range.width}`),a.style.setProperty("--_box-shift",`${s}`),a.style.setProperty("--_box-width",`${r.box.width}px`),a.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":le(this,tl,vc).call(this);break;case"pointermove":le(this,el,fc).call(this,e);break;case"pointerup":J(this,qi)&&we(this,qi,!1);break;case"pointerdown":we(this,qi,!0);break;case"pointerleave":le(this,cr,un).call(this,null);break;case"transitionstart":de(e.target,this)&&setTimeout(()=>le(this,Zi,sr).call(this),0);break}}};Gi=new WeakMap;ii=new WeakMap;on=new WeakMap;lr=new WeakMap;nn=new WeakMap;rn=new WeakMap;dr=new WeakMap;ur=new WeakMap;Yi=new WeakMap;qi=new WeakMap;Zi=new WeakSet;sr=function(){le(this,al,pc).call(this)?J(this,ii).start():J(this,ii).stop()};al=new WeakSet;pc=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&Jr(this)};js=new WeakMap;sn=new WeakSet;rl=function(t){var e;let a=((e=this.getAttribute("bounds")?$e(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),o=t.offsetWidth,s=-(r.left-a.left-o/2),l=a.right-r.left-o/2;return{box:{width:o,min:s,max:l},bounds:a,range:r}};ln=new WeakSet;ol=function(t,e){let i=`${e*100}%`,{width:a,min:r,max:o}=t.box;if(!a)return i;if(Number.isNaN(r)||(i=`max(${`calc(1 / var(--_range-width) * 100 * ${r}% + var(--media-box-padding-left))`}, ${i})`),!Number.isNaN(o)){let l=`calc(1 / var(--_range-width) * 100 * ${o}% - var(--media-box-padding-right))`;i=`min(${i}, ${l})`}return i};dn=new WeakSet;nl=function(t,e){let{width:i,min:a,max:r}=t.box,o=e*t.range.width;if(o<a+J(this,dr)){let s=t.range.left-t.bounds.left-J(this,dr);return`${o-i/2+s}px`}if(o>r-J(this,ur)){let s=t.bounds.right-t.range.right-J(this,ur);return`${o+i/2-s-t.range.width}px`}return 0};el=new WeakSet;fc=function(t){let e=[...J(this,on)].some(_=>t.composedPath().includes(_));if(!this.dragging&&(e||!t.composedPath().includes(this))){le(this,cr,un).call(this,null);return}let i=this.mediaSeekableEnd;if(!i)return;let a=W(this.shadowRoot,"#preview-rail"),r=W(this.shadowRoot,'[part~="preview-box"]'),o=le(this,sn,rl).call(this,J(this,nn)),s=(t.clientX-o.range.left)/o.range.width;s=Math.max(0,Math.min(1,s));let l=le(this,ln,ol).call(this,o,s),u=le(this,dn,nl).call(this,o,s);a.style.transform=`translateX(${l})`,a.style.setProperty("--_range-width",`${o.range.width}`),r.style.setProperty("--_box-shift",`${u}`),r.style.setProperty("--_box-width",`${o.box.width}px`);let m=Math.round(J(this,lr))-Math.round(s*i);Math.abs(m)<1&&s>.01&&s<.99||(we(this,lr,s*i),le(this,cr,un).call(this,J(this,lr)))};cr=new WeakSet;un=function(t){this.dispatchEvent(new d.CustomEvent(p.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:t}))};tl=new WeakSet;vc=function(){J(this,ii).stop();let t=bc(this);this.dispatchEvent(new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t}))};mr.shadowRootOptions={mode:"open"};mr.getTemplateHTML=of;d.customElements.get("media-time-range")||d.customElements.define("media-time-range",mr);var nf=1,sf=t=>t.mediaMuted?0:t.mediaVolume,lf=t=>`${Math.round(t*100)}%`,sl=class extends Ke{static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_VOLUME,n.MEDIA_MUTED,n.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{let e=this.range.value,i=new d.CustomEvent(p.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(i)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",h("volume"))}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),(e===n.MEDIA_VOLUME||e===n.MEDIA_MUTED)&&(this.range.valueAsNumber=sf(this),this.range.setAttribute("aria-valuetext",lf(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return R(this,n.MEDIA_VOLUME,nf)}set mediaVolume(e){O(this,n.MEDIA_VOLUME,e)}get mediaMuted(){return k(this,n.MEDIA_MUTED)}set mediaMuted(e){S(this,n.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return I(this,n.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){M(this,n.MEDIA_VOLUME_UNAVAILABLE,e)}};d.customElements.get("media-volume-range")||d.customElements.define("media-volume-range",sl);var E=require("@mux/mux-video/base"),w=require("@mux/playback-core");var yc=require("@mux/playback-core");var oi=require("@mux/playback-core");function Ec(t){let e="";return Object.entries(t).forEach(([i,a])=>{a!=null&&(e+=`${cn(i)}: ${a}; `)}),e?e.trim():void 0}function cn(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function mn(t){return t.replace(/[-_]([a-z])/g,(e,i)=>i.toUpperCase())}function ue(t){if(t==null)return;let e=+t;return Number.isNaN(e)?void 0:e}function ll(t){let e=df(t).toString();return e?"?"+e:""}function df(t){let e={};for(let i in t)t[i]!=null&&(e[i]=t[i]);return new URLSearchParams(e)}var dl=(t,e)=>!t||!e?!1:t.contains(e)?!0:dl(t,e.getRootNode().host);var gc="mux.com",uf=()=>{try{return"3.6.1"}catch{}return"UNKNOWN"},cf=uf(),pn=()=>cf,_c=(t,{token:e,customDomain:i=gc,thumbnailTime:a,programTime:r}={})=>{var l;let o=e==null?a:void 0,{aud:s}=(l=(0,oi.parseJwt)(e))!=null?l:{};if(!(e&&s!=="t"))return`https://image.${i}/${t}/thumbnail.webp${ll({token:e,time:o,program_time:r})}`},Ac=(t,{token:e,customDomain:i=gc,programStartTime:a,programEndTime:r}={})=>{var s;let{aud:o}=(s=(0,oi.parseJwt)(e))!=null?s:{};if(!(e&&o!=="s"))return`https://image.${i}/${t}/storyboard.vtt${ll({token:e,format:"webp",program_start_time:a,program_end_time:r})}`},hr=t=>{if(t){if([oi.StreamTypes.LIVE,oi.StreamTypes.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return oi.StreamTypes.LIVE}};var mf={crossorigin:"crossOrigin",playsinline:"playsInline"};function Tc(t){var e;return(e=mf[t])!=null?e:mn(t)}var ai,ri,ce,hn=class{constructor(e,i){he(this,ai);he(this,ri);he(this,ce,[]);ye(this,ai,e),ye(this,ri,i)}[Symbol.iterator](){return U(this,ce).values()}get length(){return U(this,ce).length}get value(){var e;return(e=U(this,ce).join(" "))!=null?e:""}set value(e){var i;e!==this.value&&(ye(this,ce,[]),this.add(...(i=e==null?void 0:e.split(" "))!=null?i:[]))}toString(){return this.value}item(e){return U(this,ce)[e]}values(){return U(this,ce).values()}keys(){return U(this,ce).keys()}forEach(e){U(this,ce).forEach(e)}add(...e){var i,a;e.forEach(r=>{this.contains(r)||U(this,ce).push(r)}),!(this.value===""&&!((i=U(this,ai))!=null&&i.hasAttribute(`${U(this,ri)}`)))&&((a=U(this,ai))==null||a.setAttribute(`${U(this,ri)}`,`${this.value}`))}remove(...e){var i;e.forEach(a=>{U(this,ce).splice(U(this,ce).indexOf(a),1)}),(i=U(this,ai))==null||i.setAttribute(`${U(this,ri)}`,`${this.value}`)}contains(e){return U(this,ce).includes(e)}toggle(e,i){return typeof i!="undefined"?i?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,i){this.remove(e),this.add(i)}};ai=new WeakMap,ri=new WeakMap,ce=new WeakMap;var kc=`[mux-player ${pn()}]`;function Xe(...t){console.warn(kc,...t)}function Ee(...t){console.error(kc,...t)}function ul(t){var i;let e=(i=t.message)!=null?i:"";t.context&&(e+=` ${t.context}`),t.file&&(e+=` ${(0,yc.i18n)("Read more: ")}
1274
+ `}var an=(t,e=t.mediaCurrentTime)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;if(Number.isNaN(a))return 0;let r=(e-i)/(a-i);return Math.max(0,Math.min(r,1))},bc=(t,e=t.range.valueAsNumber)=>{let i=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,a=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;return Number.isNaN(a)?0:e*(a-i)+i},mr=class extends Ke{constructor(){super(),te(this,Zi),te(this,al),te(this,sn),te(this,ln),te(this,dn),te(this,el),te(this,cr),te(this,tl),te(this,Gi,void 0),te(this,ii,void 0),te(this,on,void 0),te(this,lr,void 0),te(this,nn,void 0),te(this,rn,void 0),te(this,dr,void 0),te(this,ur,void 0),te(this,Yi,void 0),te(this,qi,void 0),te(this,js,a=>{this.dragging||(Ai(a)&&(this.range.valueAsNumber=a),J(this,qi)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),we(this,on,this.shadowRoot.querySelectorAll('[part~="box"]')),we(this,nn,this.shadowRoot.querySelector('[part~="preview-box"]')),we(this,rn,this.shadowRoot.querySelector('[part~="current-box"]'));let i=getComputedStyle(this);we(this,dr,parseInt(i.getPropertyValue("--media-box-padding-left"))),we(this,ur,parseInt(i.getPropertyValue("--media-box-padding-right"))),we(this,ii,new tn(this.range,J(this,js),60))}static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_PAUSED,n.MEDIA_DURATION,n.MEDIA_SEEKABLE,n.MEDIA_CURRENT_TIME,n.MEDIA_PREVIEW_IMAGE,n.MEDIA_PREVIEW_TIME,n.MEDIA_PREVIEW_CHAPTER,n.MEDIA_BUFFERED,n.MEDIA_PLAYBACK_RATE,n.MEDIA_LOADING,n.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",h("seek")),le(this,Zi,sr).call(this),we(this,Gi,this.getRootNode()),(e=J(this,Gi))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),le(this,Zi,sr).call(this),(e=J(this,Gi))==null||e.removeEventListener("transitionstart",this),we(this,Gi,null)}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),i!=a&&(e===n.MEDIA_CURRENT_TIME||e===n.MEDIA_PAUSED||e===n.MEDIA_ENDED||e===n.MEDIA_LOADING||e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE?(J(this,ii).update({start:an(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),le(this,Zi,sr).call(this),rf(this)):e===n.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===n.MEDIA_DURATION||e===n.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=J(this,Yi),this.updateBar()))}get mediaChaptersCues(){return J(this,Yi)}set mediaChaptersCues(e){var i;we(this,Yi,e),this.updateSegments((i=J(this,Yi))==null?void 0:i.map(a=>({start:an(this,a.startTime),end:an(this,a.endTime)})))}get mediaPaused(){return k(this,n.MEDIA_PAUSED)}set mediaPaused(e){S(this,n.MEDIA_PAUSED,e)}get mediaLoading(){return k(this,n.MEDIA_LOADING)}set mediaLoading(e){S(this,n.MEDIA_LOADING,e)}get mediaDuration(){return R(this,n.MEDIA_DURATION)}set mediaDuration(e){O(this,n.MEDIA_DURATION,e)}get mediaCurrentTime(){return R(this,n.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){O(this,n.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return R(this,n.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){O(this,n.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){let e=this.getAttribute(n.MEDIA_BUFFERED);return e?e.split(" ").map(i=>i.split(":").map(a=>+a)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(n.MEDIA_BUFFERED);return}let i=e.map(a=>a.join(":")).join(" ");this.setAttribute(n.MEDIA_BUFFERED,i)}get mediaSeekable(){let e=this.getAttribute(n.MEDIA_SEEKABLE);if(e)return e.split(":").map(i=>+i)}set mediaSeekable(e){if(e==null){this.removeAttribute(n.MEDIA_SEEKABLE);return}this.setAttribute(n.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;let[,i=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaSeekableStart(){var e;let[i=0]=(e=this.mediaSeekable)!=null?e:[];return i}get mediaPreviewImage(){return I(this,n.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){M(this,n.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return R(this,n.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){O(this,n.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return k(this,n.MEDIA_ENDED)}set mediaEnded(e){S(this,n.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;let i=this.mediaBuffered;if(!i.length)return;let a;if(this.mediaEnded)a=1;else{let o=this.mediaCurrentTime,[,s=this.mediaSeekableStart]=(e=i.find(([l,u])=>l<=o&&o<=u))!=null?e:[];a=an(this,s)}let{style:r}=W(this.shadowRoot,"#buffered");r.setProperty("width",`${a*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let i=W(this.shadowRoot,"#current-rail"),a=W(this.shadowRoot,'[part~="current-box"]'),r=le(this,sn,rl).call(this,J(this,rn)),o=le(this,ln,ol).call(this,r,this.range.valueAsNumber),s=le(this,dn,nl).call(this,r,this.range.valueAsNumber);i.style.transform=`translateX(${o})`,i.style.setProperty("--_range-width",`${r.range.width}`),a.style.setProperty("--_box-shift",`${s}`),a.style.setProperty("--_box-width",`${r.box.width}px`),a.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":le(this,tl,vc).call(this);break;case"pointermove":le(this,el,fc).call(this,e);break;case"pointerup":J(this,qi)&&we(this,qi,!1);break;case"pointerdown":we(this,qi,!0);break;case"pointerleave":le(this,cr,un).call(this,null);break;case"transitionstart":de(e.target,this)&&setTimeout(()=>le(this,Zi,sr).call(this),0);break}}};Gi=new WeakMap;ii=new WeakMap;on=new WeakMap;lr=new WeakMap;nn=new WeakMap;rn=new WeakMap;dr=new WeakMap;ur=new WeakMap;Yi=new WeakMap;qi=new WeakMap;Zi=new WeakSet;sr=function(){le(this,al,pc).call(this)?J(this,ii).start():J(this,ii).stop()};al=new WeakSet;pc=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&Jr(this)};js=new WeakMap;sn=new WeakSet;rl=function(t){var e;let a=((e=this.getAttribute("bounds")?$e(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),o=t.offsetWidth,s=-(r.left-a.left-o/2),l=a.right-r.left-o/2;return{box:{width:o,min:s,max:l},bounds:a,range:r}};ln=new WeakSet;ol=function(t,e){let i=`${e*100}%`,{width:a,min:r,max:o}=t.box;if(!a)return i;if(Number.isNaN(r)||(i=`max(${`calc(1 / var(--_range-width) * 100 * ${r}% + var(--media-box-padding-left))`}, ${i})`),!Number.isNaN(o)){let l=`calc(1 / var(--_range-width) * 100 * ${o}% - var(--media-box-padding-right))`;i=`min(${i}, ${l})`}return i};dn=new WeakSet;nl=function(t,e){let{width:i,min:a,max:r}=t.box,o=e*t.range.width;if(o<a+J(this,dr)){let s=t.range.left-t.bounds.left-J(this,dr);return`${o-i/2+s}px`}if(o>r-J(this,ur)){let s=t.bounds.right-t.range.right-J(this,ur);return`${o+i/2-s-t.range.width}px`}return 0};el=new WeakSet;fc=function(t){let e=[...J(this,on)].some(_=>t.composedPath().includes(_));if(!this.dragging&&(e||!t.composedPath().includes(this))){le(this,cr,un).call(this,null);return}let i=this.mediaSeekableEnd;if(!i)return;let a=W(this.shadowRoot,"#preview-rail"),r=W(this.shadowRoot,'[part~="preview-box"]'),o=le(this,sn,rl).call(this,J(this,nn)),s=(t.clientX-o.range.left)/o.range.width;s=Math.max(0,Math.min(1,s));let l=le(this,ln,ol).call(this,o,s),u=le(this,dn,nl).call(this,o,s);a.style.transform=`translateX(${l})`,a.style.setProperty("--_range-width",`${o.range.width}`),r.style.setProperty("--_box-shift",`${u}`),r.style.setProperty("--_box-width",`${o.box.width}px`);let m=Math.round(J(this,lr))-Math.round(s*i);Math.abs(m)<1&&s>.01&&s<.99||(we(this,lr,s*i),le(this,cr,un).call(this,J(this,lr)))};cr=new WeakSet;un=function(t){this.dispatchEvent(new d.CustomEvent(p.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:t}))};tl=new WeakSet;vc=function(){J(this,ii).stop();let t=bc(this);this.dispatchEvent(new d.CustomEvent(p.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t}))};mr.shadowRootOptions={mode:"open"};mr.getTemplateHTML=of;d.customElements.get("media-time-range")||d.customElements.define("media-time-range",mr);var nf=1,sf=t=>t.mediaMuted?0:t.mediaVolume,lf=t=>`${Math.round(t*100)}%`,sl=class extends Ke{static get observedAttributes(){return[...super.observedAttributes,n.MEDIA_VOLUME,n.MEDIA_MUTED,n.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{let e=this.range.value,i=new d.CustomEvent(p.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(i)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",h("volume"))}attributeChangedCallback(e,i,a){super.attributeChangedCallback(e,i,a),(e===n.MEDIA_VOLUME||e===n.MEDIA_MUTED)&&(this.range.valueAsNumber=sf(this),this.range.setAttribute("aria-valuetext",lf(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return R(this,n.MEDIA_VOLUME,nf)}set mediaVolume(e){O(this,n.MEDIA_VOLUME,e)}get mediaMuted(){return k(this,n.MEDIA_MUTED)}set mediaMuted(e){S(this,n.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return I(this,n.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){M(this,n.MEDIA_VOLUME_UNAVAILABLE,e)}};d.customElements.get("media-volume-range")||d.customElements.define("media-volume-range",sl);var E=require("@mux/mux-video/base"),w=require("@mux/playback-core");var yc=require("@mux/playback-core");var oi=require("@mux/playback-core");function Ec(t){let e="";return Object.entries(t).forEach(([i,a])=>{a!=null&&(e+=`${cn(i)}: ${a}; `)}),e?e.trim():void 0}function cn(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function mn(t){return t.replace(/[-_]([a-z])/g,(e,i)=>i.toUpperCase())}function ue(t){if(t==null)return;let e=+t;return Number.isNaN(e)?void 0:e}function ll(t){let e=df(t).toString();return e?"?"+e:""}function df(t){let e={};for(let i in t)t[i]!=null&&(e[i]=t[i]);return new URLSearchParams(e)}var dl=(t,e)=>!t||!e?!1:t.contains(e)?!0:dl(t,e.getRootNode().host);var gc="mux.com",uf=()=>{try{return"3.7.0"}catch{}return"UNKNOWN"},cf=uf(),pn=()=>cf,_c=(t,{token:e,customDomain:i=gc,thumbnailTime:a,programTime:r}={})=>{var l;let o=e==null?a:void 0,{aud:s}=(l=(0,oi.parseJwt)(e))!=null?l:{};if(!(e&&s!=="t"))return`https://image.${i}/${t}/thumbnail.webp${ll({token:e,time:o,program_time:r})}`},Ac=(t,{token:e,customDomain:i=gc,programStartTime:a,programEndTime:r}={})=>{var s;let{aud:o}=(s=(0,oi.parseJwt)(e))!=null?s:{};if(!(e&&o!=="s"))return`https://image.${i}/${t}/storyboard.vtt${ll({token:e,format:"webp",program_start_time:a,program_end_time:r})}`},hr=t=>{if(t){if([oi.StreamTypes.LIVE,oi.StreamTypes.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return oi.StreamTypes.LIVE}};var mf={crossorigin:"crossOrigin",playsinline:"playsInline"};function Tc(t){var e;return(e=mf[t])!=null?e:mn(t)}var ai,ri,ce,hn=class{constructor(e,i){he(this,ai);he(this,ri);he(this,ce,[]);ye(this,ai,e),ye(this,ri,i)}[Symbol.iterator](){return U(this,ce).values()}get length(){return U(this,ce).length}get value(){var e;return(e=U(this,ce).join(" "))!=null?e:""}set value(e){var i;e!==this.value&&(ye(this,ce,[]),this.add(...(i=e==null?void 0:e.split(" "))!=null?i:[]))}toString(){return this.value}item(e){return U(this,ce)[e]}values(){return U(this,ce).values()}keys(){return U(this,ce).keys()}forEach(e){U(this,ce).forEach(e)}add(...e){var i,a;e.forEach(r=>{this.contains(r)||U(this,ce).push(r)}),!(this.value===""&&!((i=U(this,ai))!=null&&i.hasAttribute(`${U(this,ri)}`)))&&((a=U(this,ai))==null||a.setAttribute(`${U(this,ri)}`,`${this.value}`))}remove(...e){var i;e.forEach(a=>{U(this,ce).splice(U(this,ce).indexOf(a),1)}),(i=U(this,ai))==null||i.setAttribute(`${U(this,ri)}`,`${this.value}`)}contains(e){return U(this,ce).includes(e)}toggle(e,i){return typeof i!="undefined"?i?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,i){this.remove(e),this.add(i)}};ai=new WeakMap,ri=new WeakMap,ce=new WeakMap;var kc=`[mux-player ${pn()}]`;function Xe(...t){console.warn(kc,...t)}function Ee(...t){console.error(kc,...t)}function ul(t){var i;let e=(i=t.message)!=null?i:"";t.context&&(e+=` ${t.context}`),t.file&&(e+=` ${(0,yc.i18n)("Read more: ")}
1275
1275
  https://github.com/muxinc/elements/blob/main/errors/${t.file}`),Xe(e)}var se={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},wt={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},e_={...se,...wt},Ic=Object.freeze({length:0,start(t){let e=t>>>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(t){let e=t>>>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}}),hf=Object.values(se).filter(t=>se.PLAYSINLINE!==t),pf=Object.values(wt),ff=[...hf,...pf],cl=class extends ke.HTMLElement{static get observedAttributes(){return ff}constructor(){super()}attributeChangedCallback(e,i,a){var r,o;switch(e){case wt.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case wt.VOLUME:{let s=(r=ue(a))!=null?r:1;this.media&&(this.media.volume=s);return}case wt.PLAYBACKRATE:{let s=(o=ue(a))!=null?o:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);return}}}play(){var e,i;return(i=(e=this.media)==null?void 0:e.play())!=null?i:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}load(){var e;(e=this.media)==null||e.load()}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var e,i;return(i=(e=this.media)==null?void 0:e.paused)!=null?i:!0}get duration(){var e,i;return(i=(e=this.media)==null?void 0:e.duration)!=null?i:NaN}get ended(){var e,i;return(i=(e=this.media)==null?void 0:e.ended)!=null?i:!1}get buffered(){var e,i;return(i=(e=this.media)==null?void 0:e.buffered)!=null?i:Ic}get seekable(){var e,i;return(i=(e=this.media)==null?void 0:e.seekable)!=null?i:Ic}get readyState(){var e,i;return(i=(e=this.media)==null?void 0:e.readyState)!=null?i:0}get videoWidth(){var e,i;return(i=(e=this.media)==null?void 0:e.videoWidth)!=null?i:0}get videoHeight(){var e,i;return(i=(e=this.media)==null?void 0:e.videoHeight)!=null?i:0}get currentSrc(){var e,i;return(i=(e=this.media)==null?void 0:e.currentSrc)!=null?i:""}get currentTime(){var e,i;return(i=(e=this.media)==null?void 0:e.currentTime)!=null?i:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,i;return(i=(e=this.media)==null?void 0:e.volume)!=null?i:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,i;return(i=(e=this.media)==null?void 0:e.playbackRate)!=null?i:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=ue(this.getAttribute(wt.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(wt.PLAYBACKRATE,`${e}`):this.removeAttribute(wt.PLAYBACKRATE)}get crossOrigin(){return pr(this,se.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(se.CROSSORIGIN,`${e}`)}get autoplay(){return pr(this,se.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(se.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(se.AUTOPLAY)}get loop(){return pr(this,se.LOOP)!=null}set loop(e){e?this.setAttribute(se.LOOP,""):this.removeAttribute(se.LOOP)}get muted(){var e,i;return(i=(e=this.media)==null?void 0:e.muted)!=null?i:!1}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return pr(this,se.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(se.MUTED,""):this.removeAttribute(se.MUTED)}get playsInline(){return pr(this,se.PLAYSINLINE)!=null}set playsInline(e){Ee("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(se.PRELOAD,e):this.removeAttribute(se.PRELOAD)}};function pr(t,e){return t.media?t.media.getAttribute(e):t.getAttribute(e)}var ml=cl;var Rc=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},D=(t,e,i)=>(Rc(t,e,"read from private field"),i?i.call(t):e.get(t)),Je=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},ht=(t,e,i,a)=>(Rc(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),zi,fn,ni,fr,Rt,xt,Dt,si,Qi,vn,Ue,Mc=1,Cc=0,vf=1,bf={processCallback(t,e,i){if(i){for(let[a,r]of e)if(a in i){let o=i[a];typeof o=="boolean"&&r instanceof me&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=o:typeof o=="function"&&r instanceof me?r.element[r.attributeName]=o:r.value=o}}}},pt=class extends d.DocumentFragment{constructor(e,i,a=bf){var r;super(),Je(this,zi,void 0),Je(this,fn,void 0),this.append(e.content.cloneNode(!0)),ht(this,zi,xc(this)),ht(this,fn,a),(r=a.createCallback)==null||r.call(a,this,D(this,zi),i),a.processCallback(this,D(this,zi),i)}update(e){D(this,fn).processCallback(this,D(this,zi),e)}};zi=new WeakMap;fn=new WeakMap;var xc=(t,e=[])=>{let i,a;for(let r of t.attributes||[])if(r.value.includes("{{")){let o=new hl;for([i,a]of wc(r.value))if(!i)o.append(a);else{let s=new me(t,r.name,r.namespaceURI);o.append(s),e.push([a,s])}r.value=o.toString()}for(let r of t.childNodes)if(r.nodeType===Mc&&!(r instanceof HTMLTemplateElement))xc(r,e);else{let o=r.data;if(r.nodeType===Mc||o.includes("{{")){let s=[];if(o)for([i,a]of wc(o))if(!i)s.push(new Text(a));else{let l=new ft(t);s.push(l),e.push([a,l])}else if(r instanceof HTMLTemplateElement){let l=new vr(t,r);s.push(l),e.push([l.expression,l])}r.replaceWith(...s.flatMap(l=>l.replacementNodes||[l]))}}return e},Lc={},wc=t=>{let e="",i=0,a=Lc[t],r=0,o;if(a)return a;for(a=[];o=t[r];r++)o==="{"&&t[r+1]==="{"&&t[r-1]!=="\\"&&t[r+2]&&++i==1?(e&&a.push([Cc,e]),e="",r++):o==="}"&&t[r+1]==="}"&&t[r-1]!=="\\"&&!--i?(a.push([vf,e.trim()]),e="",r++):e+=o||"";return e&&a.push([Cc,(i>0?"{{":"")+e]),Lc[t]=a},Ef=11,bn=class{get value(){return""}set value(e){}toString(){return this.value}},Dc=new WeakMap,hl=class{constructor(){Je(this,ni,[])}[Symbol.iterator](){return D(this,ni).values()}get length(){return D(this,ni).length}item(e){return D(this,ni)[e]}append(...e){for(let i of e)i instanceof me&&Dc.set(i,this),D(this,ni).push(i)}toString(){return D(this,ni).join("")}};ni=new WeakMap;var me=class extends bn{constructor(e,i,a){super(),Je(this,si),Je(this,fr,""),Je(this,Rt,void 0),Je(this,xt,void 0),Je(this,Dt,void 0),ht(this,Rt,e),ht(this,xt,i),ht(this,Dt,a)}get attributeName(){return D(this,xt)}get attributeNamespace(){return D(this,Dt)}get element(){return D(this,Rt)}get value(){return D(this,fr)}set value(e){D(this,fr)!==e&&(ht(this,fr,e),!D(this,si,Qi)||D(this,si,Qi).length===1?e==null?D(this,Rt).removeAttributeNS(D(this,Dt),D(this,xt)):D(this,Rt).setAttributeNS(D(this,Dt),D(this,xt),e):D(this,Rt).setAttributeNS(D(this,Dt),D(this,xt),D(this,si,Qi).toString()))}get booleanValue(){return D(this,Rt).hasAttributeNS(D(this,Dt),D(this,xt))}set booleanValue(e){if(!D(this,si,Qi)||D(this,si,Qi).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};fr=new WeakMap;Rt=new WeakMap;xt=new WeakMap;Dt=new WeakMap;si=new WeakSet;Qi=function(){return Dc.get(this)};var ft=class extends bn{constructor(e,i){super(),Je(this,vn,void 0),Je(this,Ue,void 0),ht(this,vn,e),ht(this,Ue,i?[...i]:[new Text])}get replacementNodes(){return D(this,Ue)}get parentNode(){return D(this,vn)}get nextSibling(){return D(this,Ue)[D(this,Ue).length-1].nextSibling}get previousSibling(){return D(this,Ue)[0].previousSibling}get value(){return D(this,Ue).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let i=e.flat().flatMap(a=>a==null?[new Text]:a.forEach?[...a]:a.nodeType===Ef?[...a.childNodes]:a.nodeType?[a]:[new Text(a)]);i.length||i.push(new Text),ht(this,Ue,gf(D(this,Ue)[0].parentNode,D(this,Ue),i,this.nextSibling))}};vn=new WeakMap;Ue=new WeakMap;var vr=class extends ft{constructor(e,i){let a=i.getAttribute("directive")||i.getAttribute("type"),r=i.getAttribute("expression")||i.getAttribute(a)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),this.expression=r,this.template=i,this.directive=a}};function gf(t,e,i,a=null){let r=0,o,s,l,u=i.length,m=e.length;for(;r<u&&r<m&&e[r]==i[r];)r++;for(;r<u&&r<m&&i[u-1]==e[m-1];)a=i[--m,--u];if(r==m)for(;r<u;)t.insertBefore(i[r++],a);if(r==u)for(;r<m;)t.removeChild(e[r++]);else{for(o=e[r];r<u;)l=i[r++],s=o?o.nextSibling:a,o==l?o=s:r<u&&i[r]==s?(t.replaceChild(l,o),o=s):t.insertBefore(l,o);for(;o!=a;)s=o.nextSibling,t.removeChild(o),o=s}return i}var Oc={string:t=>String(t)},gn=class{constructor(e){this.template=e,this.state=void 0}},li=new WeakMap,di=new WeakMap,pl={partial:(t,e)=>{e[t.expression]=new gn(t.template)},if:(t,e)=>{var i;if(Pc(t.expression,e))if(li.get(t)!==t.template){li.set(t,t.template);let a=new pt(t.template,e,_n);t.replace(a),di.set(t,a)}else(i=di.get(t))==null||i.update(e);else t.replace(""),li.delete(t),di.delete(t)}},_f=Object.keys(pl),_n={processCallback(t,e,i){var a,r;if(i)for(let[o,s]of e){if(s instanceof vr){if(!s.directive){let u=_f.find(m=>s.template.hasAttribute(m));u&&(s.directive=u,s.expression=s.template.getAttribute(u))}(a=pl[s.directive])==null||a.call(pl,s,i);continue}let l=Pc(o,i);if(l instanceof gn){li.get(s)!==l.template?(li.set(s,l.template),l=new pt(l.template,l.state,_n),s.value=l,di.set(s,l)):(r=di.get(s))==null||r.update(l.state);continue}l?(s instanceof me&&s.attributeName.startsWith("aria-")&&(l=String(l)),s instanceof me?typeof l=="boolean"?s.booleanValue=l:typeof l=="function"?s.element[s.attributeName]=l:s.value=l:(s.value=l,li.delete(s),di.delete(s))):s instanceof me?s.value=void 0:(s.value=void 0,li.delete(s),di.delete(s))}}},Nc={"!":t=>!t,"!!":t=>!!t,"==":(t,e)=>t==e,"!=":(t,e)=>t!=e,">":(t,e)=>t>e,">=":(t,e)=>t>=e,"<":(t,e)=>t<e,"<=":(t,e)=>t<=e,"??":(t,e)=>t!=null?t:e,"|":(t,e)=>{var i;return(i=Oc[e])==null?void 0:i.call(Oc,t)}};function Af(t){return Tf(t,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function Pc(t,e={}){var i,a,r,o,s,l,u;let m=Af(t);if(m.length===0||m.some(({type:_})=>!_))return br(t);if(((i=m[0])==null?void 0:i.token)===">"){let _=e[(a=m[1])==null?void 0:a.token];if(!_)return br(t);let g={...e};_.state=g;let f=m.slice(2);for(let v=0;v<f.length;v+=3){let N=(r=f[v])==null?void 0:r.token,T=(o=f[v+1])==null?void 0:o.token,C=(s=f[v+2])==null?void 0:s.token;N&&T==="="&&(g[N]=Er(C,e))}return _}if(m.length===1)return En(m[0])?Er(m[0].token,e):br(t);if(m.length===2){let _=(l=m[0])==null?void 0:l.token,g=Nc[_];if(!g||!En(m[1]))return br(t);let f=Er(m[1].token,e);return g(f)}if(m.length===3){let _=(u=m[1])==null?void 0:u.token,g=Nc[_];if(!g||!En(m[0])||!En(m[2]))return br(t);let f=Er(m[0].token,e);if(_==="|")return g(f,m[2].token);let v=Er(m[2].token,e);return g(f,v)}}function br(t){return console.warn(`Warning: invalid expression \`${t}\``),!1}function En({type:t}){return["number","boolean","string","param"].includes(t)}function Er(t,e){let i=t[0],a=t.slice(-1);return t==="true"||t==="false"?t==="true":i===a&&["'",'"'].includes(i)?t.slice(1,-1):Kr(t)?parseFloat(t):e[t]}function Tf(t,e){let i,a,r,o=[];for(;t;){r=null,i=t.length;for(let s in e)a=e[s].exec(t),a&&a.index<i&&(r={token:a[0],type:s,matches:a.slice(1)},i=a.index);i&&o.push({token:t.substr(0,i),type:void 0}),r&&o.push(r),t=t.substr(i+(r?r.token.length:0))}return o}var _l=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},bl=(t,e,i)=>(_l(t,e,"read from private field"),i?i.call(t):e.get(t)),gr=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},ui=(t,e,i,a)=>(_l(t,e,"write to private field"),a?a.call(t,i):e.set(t,i),i),fl=(t,e,i)=>(_l(t,e,"access private method"),i),Xi,An,Ji,El,Uc,Tn,gl,vl={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Hc=Y.createElement("template");Hc.innerHTML=`
1276
1276
  <style>
1277
1277
  :host {
package/dist/base.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var Je=t=>{throw TypeError(t)};var he=(t,a,e)=>a.has(t)||Je("Cannot "+e);var u=(t,a,e)=>(he(t,a,"read from private field"),e?e.call(t):a.get(t)),T=(t,a,e)=>a.has(t)?Je("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),C=(t,a,e,i)=>(he(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e),p=(t,a,e)=>(he(t,a,"access private method"),e);var $=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends ${}globalThis.DocumentFragment=t}var G=class extends ${},ge=class extends ${},Ut={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(G)}},j,fe=class{constructor(a,e={}){T(this,j);C(this,j,e==null?void 0:e.detail)}get detail(){return u(this,j)}initCustomEvent(){}};j=new WeakMap;function Vt(t,a){return new G}var et={document:{createElement:Vt},DocumentFragment,customElements:Ut,CustomEvent:fe,EventTarget:$,HTMLElement:G,HTMLVideoElement:ge},tt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",k=tt?et:globalThis,Y=tt?et.document:globalThis.document;import{MediaController as ha,MediaErrorDialog as St}from"media-chrome";import{Attributes as Oe}from"media-chrome/dist/media-container.js";import{MediaStateChangeEvents as kt,MediaUIAttributes as ce,MediaUIEvents as _t}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import{MediaError as be,Attributes as s}from"@mux/mux-video/base";import{StreamTypes as O,PlaybackTypes as pe,addTextTrack as ga,removeTextTrack as fa,CmcdTypeValues as xt,i18n as V,parseJwt as Le,MuxJWTAud as Me,generatePlayerInitTime as ya}from"@mux/playback-core";import{i18n as Yt}from"@mux/playback-core";import{StreamTypes as Te,parseJwt as it}from"@mux/playback-core";function at(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${re(e)}: ${i}; `)}),a?a.trim():void 0}function re(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function oe(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ye(t){let a=Bt(t).toString();return a?"?"+a:""}function Bt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var ve=(t,a)=>!t||!a?!1:t.contains(a)?!0:ve(t,a.getRootNode().host);var rt="mux.com",Ht=()=>{try{return"3.6.1"}catch{}return"UNKNOWN"},Kt=Ht(),se=()=>Kt,ot=(t,{token:a,customDomain:e=rt,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=it(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${ye({token:a,time:n,program_time:r})}`},nt=(t,{token:a,customDomain:e=rt,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=it(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ye({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},z=t=>{if(t){if([Te.LIVE,Te.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Te.LIVE}};var $t={crossorigin:"crossOrigin",playsinline:"playsInline"};function st(t){var a;return(a=$t[t])!=null?a:oe(t)}var P,D,v,ne=class{constructor(a,e){T(this,P);T(this,D);T(this,v,[]);C(this,P,a),C(this,D,e)}[Symbol.iterator](){return u(this,v).values()}get length(){return u(this,v).length}get value(){var a;return(a=u(this,v).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(C(this,v,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,v)[a]}values(){return u(this,v).values()}keys(){return u(this,v).keys()}forEach(a){u(this,v).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,v).push(r)}),!(this.value===""&&!((e=u(this,P))!=null&&e.hasAttribute(`${u(this,D)}`)))&&((i=u(this,P))==null||i.setAttribute(`${u(this,D)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,v).splice(u(this,v).indexOf(i),1)}),(e=u(this,P))==null||e.setAttribute(`${u(this,D)}`,`${this.value}`)}contains(a){return u(this,v).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};P=new WeakMap,D=new WeakMap,v=new WeakMap;var dt=`[mux-player ${se()}]`;function R(...t){console.warn(dt,...t)}function E(...t){console.error(dt,...t)}function Ee(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Yt("Read more: ")}
1
+ var Je=t=>{throw TypeError(t)};var he=(t,a,e)=>a.has(t)||Je("Cannot "+e);var u=(t,a,e)=>(he(t,a,"read from private field"),e?e.call(t):a.get(t)),T=(t,a,e)=>a.has(t)?Je("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),C=(t,a,e,i)=>(he(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e),p=(t,a,e)=>(he(t,a,"access private method"),e);var $=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends ${}globalThis.DocumentFragment=t}var G=class extends ${},ge=class extends ${},Ut={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(G)}},j,fe=class{constructor(a,e={}){T(this,j);C(this,j,e==null?void 0:e.detail)}get detail(){return u(this,j)}initCustomEvent(){}};j=new WeakMap;function Vt(t,a){return new G}var et={document:{createElement:Vt},DocumentFragment,customElements:Ut,CustomEvent:fe,EventTarget:$,HTMLElement:G,HTMLVideoElement:ge},tt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",k=tt?et:globalThis,Y=tt?et.document:globalThis.document;import{MediaController as ha,MediaErrorDialog as St}from"media-chrome";import{Attributes as Oe}from"media-chrome/dist/media-container.js";import{MediaStateChangeEvents as kt,MediaUIAttributes as ce,MediaUIEvents as _t}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import{MediaError as be,Attributes as s}from"@mux/mux-video/base";import{StreamTypes as O,PlaybackTypes as pe,addTextTrack as ga,removeTextTrack as fa,CmcdTypeValues as xt,i18n as V,parseJwt as Le,MuxJWTAud as Me,generatePlayerInitTime as ya}from"@mux/playback-core";import{i18n as Yt}from"@mux/playback-core";import{StreamTypes as Te,parseJwt as it}from"@mux/playback-core";function at(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${re(e)}: ${i}; `)}),a?a.trim():void 0}function re(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function oe(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ye(t){let a=Bt(t).toString();return a?"?"+a:""}function Bt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var ve=(t,a)=>!t||!a?!1:t.contains(a)?!0:ve(t,a.getRootNode().host);var rt="mux.com",Ht=()=>{try{return"3.7.0"}catch{}return"UNKNOWN"},Kt=Ht(),se=()=>Kt,ot=(t,{token:a,customDomain:e=rt,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=it(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${ye({token:a,time:n,program_time:r})}`},nt=(t,{token:a,customDomain:e=rt,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=it(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ye({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},z=t=>{if(t){if([Te.LIVE,Te.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Te.LIVE}};var $t={crossorigin:"crossOrigin",playsinline:"playsInline"};function st(t){var a;return(a=$t[t])!=null?a:oe(t)}var P,D,v,ne=class{constructor(a,e){T(this,P);T(this,D);T(this,v,[]);C(this,P,a),C(this,D,e)}[Symbol.iterator](){return u(this,v).values()}get length(){return u(this,v).length}get value(){var a;return(a=u(this,v).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(C(this,v,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,v)[a]}values(){return u(this,v).values()}keys(){return u(this,v).keys()}forEach(a){u(this,v).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,v).push(r)}),!(this.value===""&&!((e=u(this,P))!=null&&e.hasAttribute(`${u(this,D)}`)))&&((i=u(this,P))==null||i.setAttribute(`${u(this,D)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,v).splice(u(this,v).indexOf(i),1)}),(e=u(this,P))==null||e.setAttribute(`${u(this,D)}`,`${this.value}`)}contains(a){return u(this,v).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};P=new WeakMap,D=new WeakMap,v=new WeakMap;var dt=`[mux-player ${se()}]`;function R(...t){console.warn(dt,...t)}function E(...t){console.error(dt,...t)}function Ee(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Yt("Read more: ")}
2
2
  https://github.com/muxinc/elements/blob/main/errors/${t.file}`),R(a)}var g={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},N={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Ha={...g,...N},ut=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}}),Ft=Object.values(g).filter(t=>g.PLAYSINLINE!==t),Wt=Object.values(N),Zt=[...Ft,...Wt],Ae=class extends k.HTMLElement{static get observedAttributes(){return Zt}constructor(){super()}attributeChangedCallback(a,e,i){var r,n;switch(a){case N.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case N.VOLUME:{let d=(r=y(i))!=null?r:1;this.media&&(this.media.volume=d);return}case N.PLAYBACKRATE:{let d=(n=y(i))!=null?n:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}load(){var a;(a=this.media)==null||a.load()}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:ut}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:ut}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentSrc(){var a,e;return(e=(a=this.media)==null?void 0:a.currentSrc)!=null?e:""}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=y(this.getAttribute(N.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(N.PLAYBACKRATE,`${a}`):this.removeAttribute(N.PLAYBACKRATE)}get crossOrigin(){return X(this,g.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(g.CROSSORIGIN,`${a}`)}get autoplay(){return X(this,g.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(g.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(g.AUTOPLAY)}get loop(){return X(this,g.LOOP)!=null}set loop(a){a?this.setAttribute(g.LOOP,""):this.removeAttribute(g.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return X(this,g.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(g.MUTED,""):this.removeAttribute(g.MUTED)}get playsInline(){return X(this,g.PLAYSINLINE)!=null}set playsInline(a){E("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(g.PRELOAD,a):this.removeAttribute(g.PRELOAD)}};function X(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ce=Ae;import"media-chrome/dist/media-theme-element.js";var mt=`:host {
3
3
  --media-control-display: var(--controls);
4
4
  --media-loading-indicator-display: var(--loading-indicator);