(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,615364,(e,t,r)=>{let n,i,s;var a=Object.create,o=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,h=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of p(t))u.call(e,i)||i===r||o(e,i,{get:()=>t[i],enumerable:!(n=l(t,i))||n.enumerable});return e},c=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?o(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r},y={},m={default:()=>b};for(var v in m)o(y,v,{get:m[v],enumerable:!0});t.exports=d(o({},"__esModule",{value:!0}),y);var P=(s=null!=(n=e.r(271645))?a(h(n)):{},d(!i&&n&&n.__esModule?s:o(s,"default",{value:n,enumerable:!0}),n)),E=e.r(933066);class b extends P.Component{constructor(){super(...arguments),c(this,"onReady",(...e)=>this.props.onReady(...e)),c(this,"onPlay",(...e)=>this.props.onPlay(...e)),c(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),c(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),c(this,"onPause",(...e)=>this.props.onPause(...e)),c(this,"onEnded",(...e)=>this.props.onEnded(...e)),c(this,"onError",(...e)=>this.props.onError(...e)),c(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),c(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),c(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),c(this,"onDurationChange",()=>{let e=this.getDuration();this.props.onDuration(e)}),c(this,"mute",()=>{this.player.muted=!0}),c(this,"unmute",()=>{this.player.muted=!1}),c(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);let e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){let{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;let{onError:r,config:n}=this.props;if(!(null==(t=globalThis.customElements)?void 0:t.get("mux-player")))try{let e="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs".replace("VERSION",n.version);await import(`${e}`),this.props.onLoaded()}catch(e){r(e)}let[,i]=e.match(E.MATCH_URL_MUX);this.player.playbackId=i}play(){let e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(e){this.props.onError(e)}}getDuration(){if(!this.player)return null;let{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;let{buffered:e}=this.player;if(0===e.length)return 0;let t=e.end(e.length-1),r=this.getDuration();return t>r?r:t}getPlaybackId(e){let[,t]=e.match(E.MATCH_URL_MUX);return t}render(){let{url:e,playing:t,loop:r,controls:n,muted:i,config:s,width:a,height:o}=this.props,l={width:"auto"===a?a:"100%",height:"auto"===o?o:"100%"};return!1===n&&(l["--controls"]="none"),P.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:l,preload:"auto",autoPlay:t||void 0,muted:i?"":void 0,loop:r?"":void 0,...s.attributes})}}c(b,"displayName","Mux"),c(b,"canPlay",E.canPlay.mux)}]);