(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6125],{13587:function(e,t,r){let o,s,i;var l=Object.create,a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,p=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,d=(e,t,r)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c=(e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of u(t))h.call(e,s)||s===r||a(e,s,{get:()=>t[s],enumerable:!(o=n(t,s))||o.enumerable});return e},y=(e,t,r)=>(d(e,"symbol"!=typeof t?t+"":t,r),r),m={};((e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})})(m,{default:()=>g}),e.exports=c(a({},"__esModule",{value:!0}),m);var f=(i=null!=(o=r(40929))?l(p(o)):{},c(!s&&o&&o.__esModule?i:a(i,"default",{value:o,enumerable:!0}),o)),b=r(1532),P=r(85098);class g extends f.Component{constructor(){super(...arguments),y(this,"callPlayer",b.callPlayer),y(this,"duration",null),y(this,"currentTime",null),y(this,"fractionLoaded",null),y(this,"mute",()=>{this.setVolume(0)}),y(this,"unmute",()=>{null!==this.props.volume&&this.setVolume(this.props.volume)}),y(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){(0,b.getSDK)("https://w.soundcloud.com/player/api.js","SC").then(r=>{if(!this.iframe)return;let{PLAY:o,PLAY_PROGRESS:s,PAUSE:i,FINISH:l,ERROR:a}=r.Widget.Events;t||(this.player=r.Widget(this.iframe),this.player.bind(o,this.props.onPlay),this.player.bind(i,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(s,e=>{this.currentTime=e.currentPosition/1e3,this.fractionLoaded=e.loadedProgress}),this.player.bind(l,()=>this.props.onEnded()),this.player.bind(a,e=>this.props.onError(e))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(e=>{this.duration=e/1e3,this.props.onReady()})}})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("seekTo",1e3*e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",100*e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){let{display:e}=this.props;return f.default.createElement("iframe",{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:{width:"100%",height:"100%",display:e},frameBorder:0,allow:"autoplay"})}}y(g,"displayName","SoundCloud"),y(g,"canPlay",P.canPlay.soundcloud),y(g,"loopOnEnded",!0)}}]);