PageSourceSearch

https://audioboom.com/assets/packs/js/7560-71251d059106f2cbc08a.chunk.js

js audioboom.com collected 2026-09-24 07:30:51 UTC 178,068 bytes, 2 lines download raw bytes

1/*! For license information please see 7560-71251d059106f2cbc08a.chunk.js.LICENSE.txt */
2!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3bd603f6-9a82-4499-88ab-23e75b5b1610",e._sentryDebugIdIdentifier="sentry-dbid-3bd603f6-9a82-4499-88ab-23e75b5b1610")}catch(e){}}(),(self.webpackChunkaudioboom_web=self.webpackChunkaudioboom_web||[]).push([[7560],{61329:function(e,t,i){var n;!function(){"use strict";var o=function(){this.init()};o.prototype={init:function(){var e=this||s;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="u">typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var t=this||s;if(e=parseFloat(e),t.ctx||p(),void 0!==e&&e>=0&&e<=1){if(t._volume=e,t._muted)return t;t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e,s.ctx.currentTime);for(var i=0;i<t._howls.length;i++)if(!t._howls[i]._webAudio)for(var n=t._howls[i]._getSoundIds(),o=0;o<n.length;o++){var r=t._howls[i]._soundById(n[o]);r&&r._node&&(r._node.volume=r._volume*e)}return t}return t._volume},mute:function(e){var t=this||s;t.ctx||p(),t._muted=e,t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e?0:t._volume,s.ctx.currentTime);for(var i=0;i<t._howls.length;i++)if(!t._howls[i]._webAudio)for(var n=t._howls[i]._getSoundIds(),o=0;o<n.length;o++){var r=t._howls[i]._soundById(n[o]);r&&r._node&&(r._node.muted=!!e||r._muted)}return t},stop:function(){for(var e=this||s,t=0;t<e._howls.length;t++)e._howls[t].stop();return e},unload:function(){for(var e=this||s,t=e._howls.length-1;t>=0;t--)e._howls[t].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,p()),e},codecs:function(e){return(this||s)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||s;if(e.state=e.ctx&&e.ctx.state||"suspended",e._autoSuspend(),!e.usingWebAudio)if("u">typeof Audio)try{var t=new Audio;void 0===t.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(t){e.noAudio=!0}else e.noAudio=!0;try{var t=new Audio;t.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||s,t=null;try{t="u">typeof Audio?new Audio:null}catch(t){return e}if(!t||"function"!=typeof t.canPlayType)return e;var i=t.canPlayType("audio/mpeg;").replace(/^no$/,""),n=e._navigator?e._navigator.userAgent:"",o=n.match(/OPR\/(\d+)/g),r=o&&33>parseInt(o[0].split("/")[1],10),a=-1!==n.indexOf("Safari")&&-1===n.indexOf("Chrome"),h=n.match(/Version\/(.*?) /),l=a&&h&&15>parseInt(h[1],10);return e._codecs={mp3:!(r||!i&&!t.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!i,opus:!!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(t.canPlayType('audio/wav; codecs="1"')||t.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!t.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!t.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/m4a;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(t.canPlayType("audio/x-m4b;")||t.canPlayType("audio/m4b;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(t.canPlayType("audio/x-mp4;")||t.canPlayType("audio/mp4;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(l||!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(l||!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(t.canPlayType("audio/x-flac;")||t.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||s;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var t=function(i){for(;e._html5AudioPool.length<e.html5PoolSize;)try{var n=new Audio;n._unlocked=!0,e._releaseHtml5Audio(n)}catch(t){e.noAudio=!0;break}for(var o=0;o<e._howls.length;o++)if(!e._howls[o]._webAudio)for(var s=e._howls[o]._getSoundIds(),r=0;r<s.length;r++){var a=e._howls[o]._soundById(s[r]);a&&a._node&&!a._node._unlocked&&(a._node._unlocked=!0,a._node.load())}e._autoResume();var h=e.ctx.createBufferSource();h.buffer=e._scratchBuffer,h.connect(e.ctx.destination),void 0===h.start?h.noteOn(0):h.start(0),"function"==typeof e.ctx.resume&&e.ctx.resume(),h.onended=function(){h.disconnect(0),e._audioUnlocked=!0,document.removeEventListener("touchstart",t,!0),document.removeEventListener("touchend",t,!0),document.removeEventListener("click",t,!0),document.removeEventListener("keydown",t,!0);for(var i=0;i<e._howls.length;i++)e._howls[i]._emit("unlock")}};return document.addEventListener("touchstart",t,!0),document.addEventListener("touchend",t,!0),document.addEventListener("click",t,!0),document.addEventListener("keydown",t,!0),e}},_obtainHtml5Audio:function(){var e=this||s;if(e._html5AudioPool.length)return e._html5AudioPool.pop();var t=(new Audio).play();return t&&"u">typeof Promise&&(t instanceof Promise||"function"==typeof t.then)&&t.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(e){var t=this||s;
vendor: 10,218 bytes, line 2
2return e._unlocked&&t._html5AudioPool.push(e),t},_autoSuspend:function(){var e=this;if(e.autoSuspend&&e.ctx&&void 0!==e.ctx.suspend&&s.usingWebAudio){for(var t=0;t<e._howls.length;t++)if(e._howls[t]._webAudio){for(var i=0;i<e._howls[t]._sounds.length;i++)if(!e._howls[t]._sounds[i]._paused)return e}return e._suspendTimer&&clearTimeout(e._suspendTimer),e._suspendTimer=setTimeout(function(){if(e.autoSuspend){e._suspendTimer=null,e.state="suspending";var t=function(){e.state="suspended",e._resumeAfterSuspend&&(delete e._resumeAfterSuspend,e._autoResume())};e.ctx.suspend().then(t,t)}},3e4),e}},_autoResume:function(){var e=this;if(e.ctx&&void 0!==e.ctx.resume&&s.usingWebAudio)return"running"===e.state&&"interrupted"!==e.ctx.state&&e._suspendTimer?(clearTimeout(e._suspendTimer),e._suspendTimer=null):"suspended"===e.state||"running"===e.state&&"interrupted"===e.ctx.state?(e.ctx.resume().then(function(){e.state="running";for(var t=0;t<e._howls.length;t++)e._howls[t]._emit("resume")}),e._suspendTimer&&(clearTimeout(e._suspendTimer),e._suspendTimer=null)):"suspending"===e.state&&(e._resumeAfterSuspend=!0),e}};var s=new o,r=function(e){e.src&&0!==e.src.length?this.init(e):console.error("An array of source files must be passed with any new Howl.")};r.prototype={init:function(e){var t=this;return s.ctx||p(),t._autoplay=e.autoplay||!1,t._format="string"!=typeof e.format?e.format:[e.format],t._html5=e.html5||!1,t._muted=e.mute||!1,t._loop=e.loop||!1,t._pool=e.pool||5,t._preload="boolean"!=typeof e.preload&&"metadata"!==e.preload||e.preload,t._rate=e.rate||1,t._sprite=e.sprite||{},t._src="string"!=typeof e.src?e.src:[e.src],t._volume=void 0!==e.volume?e.volume:1,t._xhr={method:e.xhr&&e.xhr.method?e.xhr.method:"GET",headers:e.xhr&&e.xhr.headers?e.xhr.headers:null,withCredentials:!(!e.xhr||!e.xhr.withCredentials)&&e.xhr.withCredentials},t._duration=0,t._state="unloaded",t._sounds=[],t._endTimers={},t._queue=[],t._playLock=!1,t._onend=e.onend?[{fn:e.onend}]:[],t._onfade=e.onfade?[{fn:e.onfade}]:[],t._onload=e.onload?[{fn:e.onload}]:[],t._onloaderror=e.onloaderror?[{fn:e.onloaderror}]:[],t._onplayerror=e.onplayerror?[{fn:e.onplayerror}]:[],t._onpause=e.onpause?[{fn:e.onpause}]:[],t._onplay=e.onplay?[{fn:e.onplay}]:[],t._onstop=e.onstop?[{fn:e.onstop}]:[],t._onmute=e.onmute?[{fn:e.onmute}]:[],t._onvolume=e.onvolume?[{fn:e.onvolume}]:[],t._onrate=e.onrate?[{fn:e.onrate}]:[],t._onseek=e.onseek?[{fn:e.onseek}]:[],t._onunlock=e.onunlock?[{fn:e.onunlock}]:[],t._onresume=[],t._webAudio=s.usingWebAudio&&!t._html5,void 0!==s.ctx&&s.ctx&&s.autoUnlock&&s._unlockAudio(),s._howls.push(t),t._autoplay&&t._queue.push({event:"play",action:function(){t.play()}}),t._preload&&"none"!==t._preload&&t.load(),t},load:function(){var e,t,i=null;if(s.noAudio)return void this._emit("loaderror",null,"No audio support.");"string"==typeof this._src&&(this._src=[this._src]);for(var n=0;n<this._src.length;n++){if(this._format&&this._format[n])e=this._format[n];else{if("string"!=typeof(t=this._src[n])){this._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(e=/^data:audio\/([^;,]+);/i.exec(t))||(e=/\.([^.]+)$/.exec(t.split("?",1)[0])),e&&(e=e[1].toLowerCase())}if(e||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),e&&s.codecs(e)){i=this._src[n];break}}return i?(this._src=i,this._state="loading","https:"===window.location.protocol&&"http:"===i.slice(0,5)&&(this._html5=!0,this._webAudio=!1),new a(this),this._webAudio&&l(this),this):void this._emit("loaderror",null,"No codec support for selected audio sources.")},play:function(e,t){var i=this,n=null;if("number"==typeof e)n=e,e=null;else{if("string"==typeof e&&"loaded"===i._state&&!i._sprite[e])return null;if(void 0===e&&(e="__default",!i._playLock)){for(var o=0,r=0;r<i._sounds.length;r++)i._sounds[r]._paused&&!i._sounds[r]._ended&&(o++,n=i._sounds[r]._id);1===o?e=null:n=null}}var a=n?i._soundById(n):i._inactiveSound();if(!a)return null;if(n&&!e&&(e=a._sprite||"__default"),"loaded"!==i._state){a._sprite=e,a._ended=!1;var h=a._id;return i._queue.push({event:"play",action:function(){i.play(h)}}),h}if(n&&!a._paused)return t||i._loadQueue("play"),a._id;i._webAudio&&s._autoResume();var l=Math.max(0,a._seek>0?a._seek:i._sprite[e][0]/1e3),d=Math.max(0,(i._sprite[e][0]+i._sprite[e][1])/1e3-l),_=1e3*d/Math.abs(a._rate),u=i._sprite[e][0]/1e3,p=(i._sprite[e][0]+i._sprite[e][1])/1e3;a._sprite=e,a._ended=!1;var m=function(){a._paused=!1,a._seek=l,a._start=u,a._stop=p,a._loop=!(!a._loop&&!i._sprite[e][2])};if(l>=p)return void i._ended(a);var g=a._node;if(i._webAudio){var f=function(){i._playLock=!1,m(),i._refreshBuffer(a);var e=a._muted||i._muted?0:a._volume;g.gain.setValueAtTime(e,s.ctx.currentTime),a._playStart=s.ctx.currentTime,void 0===g.bufferSource.start?a._loop?g.bufferSource.noteGrainOn(0,l,86400):g.bufferSource.noteGrainOn(0,l,d):a._loop?g.bufferSource.start(0,l,86400):g.bufferSource.start(0,l,d),1/0!==_&&(i._endTimers[a._id]=setTimeout(i._ended.bind(i,a),_)),t||setTimeout(function(){i._emit("play",a._id),i._loadQueue()},0)};"running"===s.state&&"interrupted"!==s.ctx.state?f():(i._playLock=!0,i.once("resume",f),i._clearTimer(a._id))}else{var c=function(){g.currentTime=l,g.muted=a._muted||i._muted||s._muted||g.muted,g.volume=a._volume*s.volume(),g.playbackRate=a._rate;try{var n=g.play();if(n&&"u">typeof Promise&&(n instanceof Promise||"function"==typeof n.then)?(i._playLock=!0,m(),n.then(function(){i._playLock=!1,g._unlocked=!0,t?i._loadQueue():i._emit("play",a._id)}).catch(function(){i._playLock=!1,i._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),a._ended=!0,a._paused=!0})):t||(i._playLock=!1,m(),i._emit("play",a._id)),g.playbackRate=a._rate,g.paused)return void i._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||a._loop?i._endTimers[a._id]=setTimeout(i._ended.bind(i,a),_):(i._endTimers[a._id]=function(){i._ended(a),g.removeEventListener("ended",i._endTimers[a._id],!1)},g.addEventListener("ended",i._endTimers[a._id],!1))}catch(e){i._emit("playerror",a._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===g.src&&(g.src=i._src,g.load());var v=window&&window.ejecta||!g.readyState&&s._navigator.isCocoonJS;if(g.readyState>=3||v)c();else{i._playLock=!0,i._state="loading";var y=function(){i._state="loaded",c(),g.removeEventListener(s._canPlayEvent,y,!1)};g.addEventListener(s._canPlayEvent,y,!1),i._clearTimer(a._id)}}return a._id},pause:function(e){var t=this;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"pause",action:function(){t.pause(e)}}),t;for(var i=t._getSoundIds(e),n=0;n<i.length;n++){t._clearTimer(i[n]);var o=t._soundById(i[n]);if(o&&!o._paused&&(o._seek=t.seek(i[n]),o._rateSeek=0,o._paused=!0,t._stopFade(i[n]),o._node))if(t._webAudio){if(!o._node.bufferSource)continue;void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),t._cleanBuffer(o._node)}else isNaN(o._node.duration)&&1/0!==o._node.duration||o._node.pause();arguments[1]||t._emit("pause",o?o._id:null)}return t},stop:function(e,t){var i=this;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"stop",action:function(){i.stop(e)}}),i;for(var n=i._getSoundIds(e),o=0;o<n.length;o++){i._clearTimer(n[o]);var s=i._soundById(n[o]);s&&(s._seek=s._start||0,s._rateSeek=0,s._paused=!0,s._ended=!0,i._stopFade(n[o]),s._node&&(i._webAudio?s._node.bufferSource&&(void 0===s._node.bufferSource.stop?s._node.bufferSource.noteOff(0):s._node.bufferSource.stop(0),i._cleanBuffer(s._node)):isNaN(s._node.duration)&&1/0!==s._node.duration||(s._node.currentTime=s._start||0,s._node.pause(),1/0===s._node.duration&&i._clearSound(s._node))),t||i._emit("stop",s._id))}return i},mute:function(e,t){var i=this;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"mute",action:function(){i.mute(e,t)}}),i;if(void 0===t){if("boolean"!=typeof e)return i._muted;i._muted=e}for(var n=i._getSoundIds(t),o=0;o<n.length;o++){var r=i._soundById(n[o]);r&&(r._muted=e,r._interval&&i._stopFade(r._id),i._webAudio&&r._node?r._node.gain.setValueAtTime(e?0:r._volume,s.ctx.currentTime):r._node&&(r._node.muted=!!s._muted||e),i._emit("mute",r._id))}return i},volume:function(){var e,t,i,n=this,o=arguments;if(0===o.length)return n._volume;if(1===o.length||2===o.length&&void 0===o[1]?n._getSoundIds().indexOf(o[0])>=0?i=parseInt(o[0],10):t=parseFloat(o[0]):o.length>=2&&(t=parseFloat(o[0]),i=parseInt(o[1],10)),!(void 0!==t&&t>=0&&t<=1))return(e=i?n._soundById(i):n._sounds[0])?e._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,o)}}),n;void 0===i&&(n._volume=t),i=n._getSoundIds(i);for(var r=0;r<i.length;r++)(e=n._soundById(i[r]))&&(e._volume=t,o[2]||n._stopFade(i[r]),n._webAudio&&e._node&&!e._muted?e._node.gain.setValueAtTime(t,s.ctx.currentTime):e._node&&!e._muted&&(e._node.volume=t*s.volume()),n._emit("volume",e._id));return n},fade:function(e,t,i,n){var o=this;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"fade",action:function(){o.fade(e,t,i,n)}}),o;e=Math.min(Math.max(0,parseFloat(e)),1),t=Math.min(Math.max(0,parseFloat(t)),1),i=parseFloat(i),o.volume(e,n);for(var r=o._getSoundIds(n),a=0;a<r.length;a++){var h=o._soundById(r[a]);if(h){if(n||o._stopFade(r[a]),o._webAudio&&!h._muted){var l=s.ctx.currentTime,d=l+i/1e3;h._volume=e,h._node.gain.setValueAtTime(e,l),h._node.gain.linearRampToValueAtTime(t,d)}o._startFadeInterval(h,e,t,i,r[a],void 0===n)}}return o},_startFadeInterval:function(e,t,i,n,o,s){var r=this,a=t,h=i-t,l=Math.abs(h/.01),d=Math.max(4,l>0?n/l:n),_=Date.now();e._fadeTo=i,e._interval=setInterval(function(){var o=(Date.now()-_)/n;_=Date.now(),a+=h*o,a=Math.round(100*a)/100,a=h<0?Math.max(i,a):Math.min(i,a),r._webAudio?e._volume=a:r.volume(a,e._id,!0),s&&(r._volume=a),(i<t&&a<=i||i>t&&a>=i)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,r.volume(i,e._id),r._emit
2("fade",e._id))},d)},_stopFade:function(e){var t=this._soundById(e);return t&&t._interval&&(this._webAudio&&t._node.gain.cancelScheduledValues(s.ctx.currentTime),clearInterval(t._interval),t._interval=null,this.volume(t._fadeTo,e),t._fadeTo=null,this._emit("fade",e)),this},loop:function(){var e,t,i,n=arguments;if(0===n.length)return this._loop;if(1===n.length){if("boolean"!=typeof n[0])return!!(i=this._soundById(parseInt(n[0],10)))&&i._loop;e=n[0],this._loop=e}else 2===n.length&&(e=n[0],t=parseInt(n[1],10));for(var o=this._getSoundIds(t),s=0;s<o.length;s++)(i=this._soundById(o[s]))&&(i._loop=e,this._webAudio&&i._node&&i._node.bufferSource&&(i._node.bufferSource.loop=e,e&&(i._node.bufferSource.loopStart=i._start||0,i._node.bufferSource.loopEnd=i._stop,this.playing(o[s])&&(this.pause(o[s],!0),this.play(o[s],!0)))));return this},rate:function(){var e,t,i,n=this,o=arguments;if(0===o.length?i=n._sounds[0]._id:1===o.length?n._getSoundIds().indexOf(o[0])>=0?i=parseInt(o[0],10):t=parseFloat(o[0]):2===o.length&&(t=parseFloat(o[0]),i=parseInt(o[1],10)),"number"!=typeof t)return(e=n._soundById(i))?e._rate:n._rate;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"rate",action:function(){n.rate.apply(n,o)}}),n;void 0===i&&(n._rate=t),i=n._getSoundIds(i);for(var r=0;r<i.length;r++)if(e=n._soundById(i[r])){n.playing(i[r])&&(e._rateSeek=n.seek(i[r]),e._playStart=n._webAudio?s.ctx.currentTime:e._playStart),e._rate=t,n._webAudio&&e._node&&e._node.bufferSource?e._node.bufferSource.playbackRate.setValueAtTime(t,s.ctx.currentTime):e._node&&(e._node.playbackRate=t);var a=n.seek(i[r]),h=1e3*((n._sprite[e._sprite][0]+n._sprite[e._sprite][1])/1e3-a)/Math.abs(e._rate);!n._endTimers[i[r]]&&e._paused||(n._clearTimer(i[r]),n._endTimers[i[r]]=setTimeout(n._ended.bind(n,e),h)),n._emit("rate",e._id)}return n},seek:function(){var e,t,i=this,n=arguments;if(0===n.length?i._sounds.length&&(t=i._sounds[0]._id):1===n.length?i._getSoundIds().indexOf(n[0])>=0?t=parseInt(n[0],10):i._sounds.length&&(t=i._sounds[0]._id,e=parseFloat(n[0])):2===n.length&&(e=parseFloat(n[0]),t=parseInt(n[1],10)),void 0===t)return 0;if("number"==typeof e&&("loaded"!==i._state||i._playLock))return i._queue.push({event:"seek",action:function(){i.seek.apply(i,n)}}),i;var o=i._soundById(t);if(o){if(!("number"==typeof e&&e>=0)){if(i._webAudio){var r=i.playing(t)?s.ctx.currentTime-o._playStart:0,a=o._rateSeek?o._rateSeek-o._seek:0;return o._seek+(a+r*Math.abs(o._rate))}return o._node.currentTime}var h=i.playing(t);h&&i.pause(t,!0),o._seek=e,o._ended=!1,i._clearTimer(t),i._webAudio||!o._node||isNaN(o._node.duration)||(o._node.currentTime=e);var l=function(){h&&i.play(t,!0),i._emit("seek",t)};if(h&&!i._webAudio){var d=function(){i._playLock?setTimeout(d,0):l()};setTimeout(d,0)}else l()}return i},playing:function(e){if("number"==typeof e){var t=this._soundById(e);return!!t&&!t._paused}for(var i=0;i<this._sounds.length;i++)if(!this._sounds[i]._paused)return!0;return!1},duration:function(e){var t=this._duration,i=this._soundById(e);return i&&(t=this._sprite[i._sprite][1]/1e3),t},state:function(){return this._state},unload:function(){for(var e=this,t=e._sounds,i=0;i<t.length;i++)t[i]._paused||e.stop(t[i]._id),e._webAudio||(e._clearSound(t[i]._node),t[i]._node.removeEventListener("error",t[i]._errorFn,!1),t[i]._node.removeEventListener(s._canPlayEvent,t[i]._loadFn,!1),t[i]._node.removeEventListener("ended",t[i]._endFn,!1),s._releaseHtml5Audio(t[i]._node)),delete t[i]._node,e._clearTimer(t[i]._id);var n=s._howls.indexOf(e);n>=0&&s._howls.splice(n,1);var o=!0;for(i=0;i<s._howls.length;i++)if(s._howls[i]._src===e._src||e._src.indexOf(s._howls[i]._src)>=0){o=!1;break}return h&&o&&delete h[e._src],s.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,t,i,n){var o=this["_on"+e];return"function"==typeof t&&o.push(n?{id:i,fn:t,once:n}:{id:i,fn:t}),this},off:function(e,t,i){var n=this["_on"+e],o=0;if("number"==typeof t&&(i=t,t=null),t||i)for(o=0;o<n.length;o++){var s=i===n[o].id;if(t===n[o].fn&&s||!t&&s){n.splice(o,1);break}}else if(e)this["_on"+e]=[];else{var r=Object.keys(this);for(o=0;o<r.length;o++)0===r[o].indexOf("_on")&&Array.isArray(this[r[o]])&&(this[r[o]]=[])}return this},once:function(e,t,i){return this.on(e,t,i,1),this},_emit:function(e,t,i){for(var n=this["_on"+e],o=n.length-1;o>=0;o--)n[o].id&&n[o].id!==t&&"load"!==e||(setTimeout((function(e){e.call(this,t,i)}).bind(this,n[o].fn),0),n[o].once&&this.off(e,n[o].fn,n[o].id));return this._loadQueue(e),this},_loadQueue:function(e){if(this._queue.length>0){var t=this._queue[0];t.event===e&&(this._queue.shift(),this._loadQueue()),e||t.action()}return this},_ended:function(e){var t=e._sprite;if(!this._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime<e._stop)return setTimeout(this._ended.bind(this,e),100),this;var i=!(!e._loop&&!this._sprite[t][2]);if(this._emit("end",e._id),!this._webAudio&&i&&this.stop(e._id,!0).play(e._id),this._webAudio&&i){this._emit("play",e._id),e._seek=e._start||0,e._rateSeek=0,e._playStart=s.ctx.currentTime;var n=1e3*(e._stop-e._start)/Math.abs(e._rate);this._endTimers[e._id]=setTimeout(this._ended.bind(this,e),n)}return this._webAudio&&!i&&(e._paused=!0,e._ended=!0,e._seek=e._start||0,e._rateSeek=0,this._clearTimer(e._id),this._cleanBuffer(e._node),s._autoSuspend()),this._webAudio||i||this.stop(e._id,!0),this}
2,_clearTimer:function(e){if(this._endTimers[e]){if("function"!=typeof this._endTimers[e])clearTimeout(this._endTimers[e]);else{var t=this._soundById(e);t&&t._node&&t._node.removeEventListener("ended",this._endTimers[e],!1)}delete this._endTimers[e]}return this},_soundById:function(e){for(var t=0;t<this._sounds.length;t++)if(e===this._sounds[t]._id)return this._sounds[t];return null},_inactiveSound:function(){this._drain();for(var e=0;e<this._sounds.length;e++)if(this._sounds[e]._ended)return this._sounds[e].reset();return new a(this)},_drain:function(){var e=this._pool,t=0,i=0;if(!(this._sounds.length<e)){for(i=0;i<this._sounds.length;i++)this._sounds[i]._ended&&t++;for(i=this._sounds.length-1;i>=0;i--){if(t<=e)return;this._sounds[i]._ended&&(this._webAudio&&this._sounds[i]._node&&this._sounds[i]._node.disconnect(0),this._sounds.splice(i,1),t--)}}},_getSoundIds:function(e){if(void 0===e){for(var t=[],i=0;i<this._sounds.length;i++)t.push(this._sounds[i]._id);return t}return[e]},_refreshBuffer:function(e){return e._node.bufferSource=s.ctx.createBufferSource(),e._node.bufferSource.buffer=h[this._src],e._panner?e._node.bufferSource.connect(e._panner):e._node.bufferSource.connect(e._node),e._node.bufferSource.loop=e._loop,e._loop&&(e._node.bufferSource.loopStart=e._start||0,e._node.bufferSource.loopEnd=e._stop||0),e._node.bufferSource.playbackRate.setValueAtTime(e._rate,s.ctx.currentTime),this},_cleanBuffer:function(e){var t=s._navigator&&s._navigator.vendor.indexOf("Apple")>=0;if(!e.bufferSource)return this;if(s._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=s._scratchBuffer}catch(e){}return e.bufferSource=null,this},_clearSound:function(e){/MSIE |Trident\//.test(s._navigator&&s._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var a=function(e){this._parent=e,this.init()};a.prototype={init:function(){var e=this._parent;return this._muted=e._muted,this._loop=e._loop,this._volume=e._volume,this._rate=e._rate,this._seek=0,this._paused=!0,this._ended=!0,this._sprite="__default",this._id=++s._counter,e._sounds.push(this),this.create(),this},create:function(){var e=this._parent,t=s._muted||this._muted||this._parent._muted?0:this._volume;return e._webAudio?(this._node=void 0===s.ctx.createGain?s.ctx.createGainNode():s.ctx.createGain(),this._node.gain.setValueAtTime(t,s.ctx.currentTime),this._node.paused=!0,this._node.connect(s.masterGain)):s.noAudio||(this._node=s._obtainHtml5Audio(),this._errorFn=this._errorListener.bind(this),this._node.addEventListener("error",this._errorFn,!1),this._loadFn=this._loadListener.bind(this),this._node.addEventListener(s._canPlayEvent,this._loadFn,!1),this._endFn=this._endListener.bind(this),this._node.addEventListener("ended",this._endFn,!1),this._node.src=e._src,this._node.preload=!0===e._preload?"auto":e._preload,this._node.volume=t*s.volume(),this._node.load()),this},reset:function(){var e=this._parent;return this._muted=e._muted,this._loop=e._loop,this._volume=e._volume,this._rate=e._rate,this._seek=0,this._rateSeek=0,this._paused=!0,this._ended=!0,this._sprite="__default",this._id=++s._counter,this},_errorListener:function(){this._parent._emit("loaderror",this._id,this._node.error?this._node.error.code:0),this._node.removeEventListener("error",this._errorFn,!1)},_loadListener:function(){var e=this._parent;e._duration=Math.ceil(10*this._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),this._node.removeEventListener(s._canPlayEvent,this._loadFn,!1)},_endListener:function(){var e=this._parent;1/0===e._duration&&(e._duration=Math.ceil(10*this._node.duration)/10,1/0===e._sprite.__default[1]&&(e._sprite.__default[1]=1e3*e._duration),e._ended(this)),this._node.removeEventListener("ended",this._endFn,!1)}};var h={},l=function(e){var t=e._src;if(h[t])return e._duration=h[t].duration,void u(e);if(/^data:[^;]+;base64,/.test(t)){for(var i=atob(t.split(",")[1]),n=new Uint8Array(i.length),o=0;o<i.length;++o)n[o]=i.charCodeAt(o);_(n.buffer,e)}else{var s=new XMLHttpRequest;s.open(e._xhr.method,t,!0),s.withCredentials=e._xhr.withCredentials,s.responseType="arraybuffer",e._xhr.headers&&Object.keys(e._xhr.headers).forEac
2h(function(t){s.setRequestHeader(t,e._xhr.headers[t])}),s.onload=function(){var t=(s.status+"")[0];"0"!==t&&"2"!==t&&"3"!==t?e._emit("loaderror",null,"Failed loading audio file with status: "+s.status+"."):_(s.response,e)},s.onerror=function(){e._webAudio&&(e._html5=!0,e._webAudio=!1,e._sounds=[],delete h[t],e.load())},d(s)}},d=function(e){try{e.send()}catch(t){e.onerror()}},_=function(e,t){var i=function(){t._emit("loaderror",null,"Decoding audio data failed.")},n=function(e){e&&t._sounds.length>0?(h[t._src]=e,u(t,e)):i()};"u">typeof Promise&&1===s.ctx.decodeAudioData.length?s.ctx.decodeAudioData(e).then(n).catch(i):s.ctx.decodeAudioData(e,n,i)},u=function(e,t){t&&!e._duration&&(e._duration=t.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},p=function(){if(s.usingWebAudio){try{"u">typeof AudioContext?s.ctx=new AudioContext:"u">typeof webkitAudioContext?s.ctx=new webkitAudioContext:s.usingWebAudio=!1}catch(e){s.usingWebAudio=!1}s.ctx||(s.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(s._navigator&&s._navigator.platform),t=s._navigator&&s._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),i=t?parseInt(t[1],10):null;if(e&&i&&i<9){var n=/safari/.test(s._navigator&&s._navigator.userAgent.toLowerCase());s._navigator&&!n&&(s.usingWebAudio=!1)}s.usingWebAudio&&(s.masterGain=void 0===s.ctx.createGain?s.ctx.createGainNode():s.ctx.createGain(),s.masterGain.gain.setValueAtTime(s._muted?0:s._volume,s.ctx.currentTime),s.masterGain.connect(s.ctx.destination)),s._setup()}};void 0===(n=(function(){return{Howler:s,Howl:r}}).apply(t,[]))||(e.exports=n),t.Howler=s,t.Howl=r,void 0!==i.g?(i.g.HowlerGlobal=o,i.g.Howler=s,i.g.Howl=r,i.g.Sound=a):"u">typeof window&&(window.HowlerGlobal=o,window.Howler=s,window.Howl=r,window.Sound=a)}()},98961:function(e,t,i){var n,o,s;!function(r){"use strict";o=[t,i(29224)],void 0===(s="function"==typeof(n=r)?n.apply(t,o):n)||(e.exports=s)}(function(e,t){"use strict";var i={AENC:"Audio encryption",APIC:"Attached picture",CHAP:"Chapter",COMM:"Comments",COMR:"Commercial frame",ENCR:"Encryption method registration",EQUA:"Equalization",ETCO:"Event timing codes",GEOB:"General encapsulated object",GRID:"Group identification registration",IPLS:"Involved people list",LINK:"Linked information",MCDI:"Music CD identifier",MLLT:"MPEG location lookup table",OWNE:"Ownership frame",PRIV:"Private frame",PCNT:"Play counter",POPM:"Popularimeter",POSS:"Position synchronisation frame",RBUF:"Recommended buffer size",RVAD:"Relative volume adjustment",RVRB:"Reverb",SYLT:"Synchronized lyric/text",SYTC:"Synchronized tempo codes",TALB:"Album/Movie/Show title",TBPM:"BPM (beats per minute)",TCOM:"Composer",TCON:"Content type",TCOP:"Copyright message",TDAT:"Date",TDLY:"Playlist delay",TENC:"Encoded by",TEXT:"Lyricist/Text writer",TFLT:"File type",TIME:"Time",TIT1:"Content group description",TIT2:"Title/songname/content description",TIT3:"Subtitle/Description refinement",TKEY:"Initial key",TLAN:"Language(s)",TLEN:"Length",TMED:"Media type",TOAL:"Original album/movie/show title",TOFN:"Original filename",TOLY:"Original lyricist(s)/text writer(s)",TOPE:"Original artist(s)/performer(s)",TORY:"Original release year",TOWN:"File owner/licensee",TPE1:"Lead performer(s)/Soloist(s)",TPE2:"Band/orchestra/accompaniment",TPE3:"Conductor/performer refinement",TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding",TYER:"Year",TXXX:"User defined text information frame",UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"},n={};n.T=function(e,i,n){var o={encoding:e.getUint8(i)};return o.value=t.readStr[0===o.encoding?"iso":"ucs"](e,i+1,n-1),o},n.TXXX=function(e,i,n){var o={encoding:e.getUint8(i)};if(n<2)return o;var s=0===o.encoding?"iso":"ucs",r=i+1,a=t.locateStrTrm[s](e,r,n-4);return -1===a||(o.description=t.readStr[s](e,r,a-r),a+="ucs"===s?2:1,o.value=t.readStr[s](e,a,i+n-a)
2),o},n.W=function(e,i,n){return{value:t.readStr.iso(e,i,n)}},n.WXXX=function(e,i,n){var o={encoding:e.getUint8(i)};if(n<2)return o;var s=0===o.encoding?"iso":"ucs",r=i+1,a=t.locateStrTrm[s](e,r,n-4);return -1===a||(o.description=t.readStr[s](e,r,a-r),a+="ucs"===s?2:1,o.value=t.readStr.iso(e,a,i+n-a)),o},n.COMM=function(e,i,n){var o={encoding:e.getUint8(i)};if(n<5)return o;var s=0===o.encoding?"iso":"ucs",r=i+4;o.language=t.readTrmStr.iso(e,i+1,3);var a=t.locateStrTrm[s](e,r,n-4);return -1===a||(o.description=t.readStr[s](e,r,a-r),a+="ucs"===s?2:1,o.text=t.readStr[s](e,a,i+n-a)),o},n.UFID=function(e,i,n){var o=t.readTrmStr.iso(e,i,n),s=new DataView(e.buffer,i+o.length+1,n-o.length-1);return{ownerIdentifier:o,identifier:s}},n.IPLS=function(e,i,n){for(var o,s={encoding:e.getUint8(i),values:[]},r=0===s.encoding?"iso":"ucs",a=i+1;a<i+n;)-1===(o=t.locateStrTrm[r](e,a,n-(a-i)))&&(o=i+n),s.values.push(t.readStr[r](e,a,o-a)),a=o+("ucs"===r?2:1);return s},n.USER=function(e,i,n){var o={encoding:e.getUint8(i)};if(n<5)return o;o.language=t.readTrmStr.iso(e,i+1,3);var s=i+4,r=0===o.encoding?"iso":"ucs";return o.text=t.readStr[r](e,s,i+n-s),o},n.PRIV=function(e,i,n){var o=t.readTrmStr.iso(e,i,n),s=new DataView(e.buffer,i+o.length+1,n-o.length-1);return{ownerIdentifier:o,privateData:s}},n.PCNT=function(e,t,i){return i<4?{}:{counter:e.getUint32(t)}},n.POPM=function(e,i,n){var o={email:t.readTrmStr.iso(e,i,n)};return i+=o.email.length+1,n<6||(o.rating=e.getUint8(i),o.counter=e.getUint32(i+1)),o},n.APIC=function(e,i,n){var o,s,r={encoding:e.getUint8(i)};if(n<4)return r;var a=0===r.encoding?"iso":"ucs";return o=i+1,-1===(s=t.locateStrTrm.iso(e,o,n-1))||(r.mimeType=t.readStr.iso(e,o,s-o),o=s+1,r.pictureType=e.getUint8(o),o+=1,-1===(s=t.locateStrTrm[a](e,o,i+n-o))||(r.description=t.readStr[a](e,o,s-o),o=s+("ucs"===a?2:1),r.pictureData=new DataView(e.buffer,o,i+n-o))),r},n.CHAP=function(i,n,o){var s={encoding:i.getUint8(n)},r=t.locateStrTrm.iso(i,n,o-1);if(-1===r)return s;s.id=t.readStr.iso(i,n,r-n),s.startTime=i.getUint32(r+1),s.endTime=i.getUint32(r+5),s.startOffset=i.getUint32(r+9),s.endOffset=i.getUint32(r+13);var a=r+17;for(s.frames=[];a<n+o;){var h=e.readId3v2TagFrame(i,a);s.frames.push(h),a+=h.header.size+10}return s},e.readId3v2TagFrame=function(e,o){var s,r={header:{id:t.readStr.iso(e,o,4),size:e.getUint32(o+4),flagsOctet1:e.getUint8(o+8),flagsOctet2:e.getUint8(o+9)}};if(r.header.size<1)return r;var a="TXXX"===(s=r.header.id)?n.TXXX:"T"===s.charAt(0)?n.T:"WXXX"===s?n.WXXX:"W"===s.charAt(0)?n.W:"COMM"===s||"USLT"===s?n.COMM:n[s]||t.noOp;return r.name=i[r.header.id],r.content=a(e,o+10,r.header.size),r},e.readId3v2Tag=function(i,n){if(n||(n=0),i.byteLength-n<10||!t.isSeq(t.seq.id3,i,n))return null;var o,s=i.getUint8(n+5),r={_section:{type:"ID3v2",offset:n},header:{majorVersion:i.getUint8(n+3),minorRevision:i.getUint8(n+4),flagsOctet:s,unsynchronisationFlag:(128&s)==128,extendedHeaderFlag:(64&s)==64,experimentalIndicatorFlag:(32&s)==32,size:t.unsynchsafe(i.getUint32(n+6))},frames:[]};r._section.byteLength=r.header.size+10;var a=n+r._section.byteLength;if(3!==r.header.majorVersion)return r;for(n+=10;n<a&&0!==i.getUint32(n)&&(o=e.readId3v2TagFrame(i,n));)r.frames.push(o),n+=o.header.size+10;return r}})},29224:function(e,t){var i,n,o;!function(s){"use strict";n=[t],void 0===(o="function"==typeof(i=s)?i.apply(t,n):i)||(e.exports=o)}(function(e){"use strict";var t,i=(t=[],function(e){return t[0]=(128&e)==128?"1":"0",t[1]=(64&e)==64?"1":"0",t[2]=(32&e)==32?"1":"0",t[3]=(16&e)==16?"1":"0",t[4]=(8&e)==8?"1":"0",t[5]=(4&e)==4?"1":"0",t[6]=(2&e)==2?"1":"0",t[7]=(1&e)==1?"1":"0",t.join("")});e.getFrameByteLength=function(t,i,n,o,s){return Math.floor(1e3*t/8*e.sampleLengthMap[o][s]/i+(n?"11"===s?4:1:0))},e.getXingOffset=function(e,t){var i="11"===t;return"11"===e?i?21:36:i?13:21},e.v1l1Bitrates={"0000":"free","0001":32,"0010":64,"0011":96,"0100":128,"0101":160,"0110":192,"0111":224,1e3:256,1001:288,1010:320,1011:352,1100:384,1101:416,1110:448,1111:"bad"},e.v1l2Bitrates={"0000":"free","0001":32,"0010":48,"0011":56,"0100":64,"0101":80,"0110":96,"0111":112,1e3:128,1001:160,1010:192,1011:224,1100:256,
21101:320,1110:384,1111:"bad"},e.v1l3Bitrates={"0000":"free","0001":32,"0010":40,"0011":48,"0100":56,"0101":64,"0110":80,"0111":96,1e3:112,1001:128,1010:160,1011:192,1100:224,1101:256,1110:320,1111:"bad"},e.v2l1Bitrates={"0000":"free","0001":32,"0010":48,"0011":56,"0100":64,"0101":80,"0110":96,"0111":112,1e3:128,1001:144,1010:160,1011:176,1100:192,1101:224,1110:256,1111:"bad"},e.v2l2Bitrates={"0000":"free","0001":8,"0010":16,"0011":24,"0100":32,"0101":40,"0110":48,"0111":56,1e3:64,1001:80,1010:96,1011:112,1100:128,1101:144,1110:160,1111:"bad"},e.v2l3Bitrates=e.v2l2Bitrates,e.v1SamplingRates={"00":44100,"01":48e3,10:32e3,11:"reserved"},e.v2SamplingRates={"00":22050,"01":24e3,10:16e3,11:"reserved"},e.v25SamplingRates={"00":11025,"01":12e3,10:8e3,11:"reserved"},e.channelModes={"00":"Stereo","01":"Joint stereo (Stereo)",10:"Dual channel (Stereo)",11:"Single channel (Mono)"},e.mpegVersionDescription={"00":"MPEG Version 2.5 (unofficial)","01":"reserved",10:"MPEG Version 2 (ISO/IEC 13818-3)",11:"MPEG Version 1 (ISO/IEC 11172-3)"},e.layerDescription={"00":"reserved","01":"Layer III",10:"Layer II",11:"Layer I"},e.bitrateMap={11:{"01":e.v1l3Bitrates,10:e.v1l2Bitrates,11:e.v1l1Bitrates},10:{"01":e.v2l3Bitrates,10:e.v2l2Bitrates,11:e.v2l1Bitrates}},e.samplingRateMap={"00":e.v25SamplingRates,10:e.v2SamplingRates,11:e.v1SamplingRates},e.v1SampleLengths={"01":1152,10:1152,11:384},e.v2SampleLengths={"01":576,10:1152,11:384},e.sampleLengthMap={"01":e.v2SampleLengths,10:e.v2SampleLengths,11:e.v1SampleLengths},e.wordSeqFromStr=function(e){for(var t=e.length-1,i=[];t>=0;--t)i[t]=e.charCodeAt(t);return i},e.seq={id3:e.wordSeqFromStr("ID3"),xing:e.wordSeqFromStr("Xing"),info:e.wordSeqFromStr("Info")},e.noOp=function(){},e.unsynchsafe=function(e){for(var t=0,i=0x7f000000;i;)t>>=1,t|=e&i,i>>=8;return t},e.isSeq=function(e,t,i){for(var n=e.length-1;n>=0;n--)if(e[n]!==t.getUint8(i+n))return!1;return!0},e.locateSeq=function(t,i,n,o){for(var s=0,r=o-t.length+1;s<r;++s)if(e.isSeq(t,i,n+s))return n+s;return -1},e.locateStrTrm={iso:function(t,i,n){return e.locateSeq([0],t,i,n)},ucs:function(t,i,n){var o=e.locateSeq([0,0],t,i,n);return -1===o?-1:((o-i)%2!=0&&++o,o)}},e.readStr={iso:function(e,t,i){return String.fromCharCode.apply(null,new Uint8Array(e.buffer,t,i))},ucs:function(e,t,i){(65534===e.getUint16(t)||65279===e.getUint16(t))&&(t+=2,i-=2);var n=e.buffer;return t%2==1&&(n=n.slice(t,t+i),t=0),String.fromCharCode.apply(null,new Uint16Array(n,t,i/2))}},e.readTrmStr={iso:function(t,i,n){var o=e.locateStrTrm.iso(t,i,n);return -1!==o&&(n=o-i),e.readStr.iso(t,i,n)},ucs:function(t,i,n){var o=e.locateStrTrm.ucs(t,i,n);return -1!==o&&(n=o-i),e.readStr.ucs(t,i,n)}},e.readFrameHeader=function(t,n){if(n||(n=0),t.byteLength-n<=4||255!==t.getUint8(n))return null;var o=t.getUint8(n+1);if(o<224)return null;var s=i(o).substr(3,2),r=i(o).substr(5,2),a={_section:{type:"frameHeader",byteLength:4,offset:n},mpegAudioVersionBits:s,mpegAudioVersion:e.mpegVersionDescription[s],layerDescriptionBits:r,layerDescription:e.layerDescription[r],isProtected:1&o};if(a.protectionBit=a.isProtected?"1":"0","reserved"===a.mpegAudioVersion||"reserved"===a.layerDescription)return null;var h=t.getUint8(n+2);return(a.bitrateBits=(h=i(h)).substr(0,4),a.bitrate=e.bitrateMap[s][r][a.bitrateBits],"bad"===a.bitrate||(a.samplingRateBits=h.substr(4,2),a.samplingRate=e.samplingRateMap[s][a.samplingRateBits],"reserved"===a.samplingRate))?null:(a.frameIsPaddedBit=h.substr(6,1),a.frameIsPadded="1"===a.frameIsPaddedBit,a.framePadding=+!!a.frameIsPadded,a.privateBit=h.substr(7,1),a.channelModeBits=i(t.getUint8(n+3)).substr(0,2),a.channelMode=e.channelModes[a.channelModeBits],a)},e.readFrame=function(t,i,n){i||(i=0);var o={_section:{type:"frame",offset:i},header:e.readFrameHeader(t,i)},s=o.header;if(!s)return null;o._section.sampleLength=e.sampleLengthMap[s.mpegAudioVersionBits][s.layerDescriptionBits],o._section.byteLength=e.getFrameByteLength(s.bitrate,s.samplingRate,s.framePadding,s.mpegAudioVersionBits,s.layerDescriptionBits),o._section.nextFrameIndex=i+o._section.byteLength;var r=e.getXingOffset(s.mpegAudioVersionBits,s.channelModeBits);return e.isSeq(e.seq.xing,t,i+r)||e.isSeq(e.seq.info,t,i+r)||n&&!e.readFrameHeader(t,o._section.nextFrameIndex)?null:o}})},47275:function(e,t,i){var n,o,s;!function(r){"use strict";o=[t,i(29224)],void 0===(s="function"==typeof(n=r)?n.apply(t,o):n)||(e.exports=s)}(function(e,t){"use strict";e.readXingTag=function(e,i){i||(i=0);var n={_section:{type:"Xing",offset:i},header:t.readFrameHeader(e,i)},o=n.header;if(!o)return null;var s=i+t.getXingOffset(o.mpegAudioVersionBits,o.channelModeBits);return e.byteLength<s+4?null:(n.identifier=t.isSeq(t.seq.xing,e,s)&&"Xing"||t.isSeq(t.seq.info,e,s)&&"Info",n.identifier)?(n._section.byteLength=t.getFrameByteLength(o.bitrate,o.samplingRate,o.framePadding,o.mpegAudioVersionBits,o.layerDescriptionBits),n._section.nextFrameIndex=i+n._section.byteLength,n):null}})},89546:function(e,t,i){var n,o,s;!function(r){"use strict";o=[t,i(29224),i(98961),i(47275)],void 0===(s="function"==typeof(n=r)?n.apply(t,o):n)||(e.exports=s)}(function(e,t,i,n){"use strict";e.readFrameHeader=function(e,i){return t.readFrameHeader(e,i)},e.readFrame=function(e,i,n){return t.readFrame(e,i,n)},e.readLastFrame=function(t,i,n){i||(i=t.byteLength-1);for(var o=null;i>=0;--i)if(255===t.getUint8(i)&&(o=e.readFrame(t,i,n)))return o;return null},e.readId3v2Tag=function(e,t){return i.readId3v2Tag(e,t)},e.readXingTag=function(e,t){return n.readXingTag(e,t)},e.readTags=function(t,i){i||(i=0);for(var n=[],o=null,s=!1,r=t.byteLength,a=[e.readId3v2Tag,e.readXingTag,e.readFrame],h=a.length;i<r&&!s;++i)for(var l=0;l<h;++l)if(o=a[l](t,i)){if(n.push(o),i+=o._section.byteLength,"frame"===o._section.type){s=!0;break}l=-1}return n}})},39223:function(e,t,i){"use strict";i.d(t,{A:function(){return eq}});var n,o,s,r=i(6298),a=i(86349),h=i(97573),l=i(28502),d=i(50799),_=i(96584);class u extends _.W{constructor(e){super(e),this.listening(!1),a.J0.warn('Konva.FastLayer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}u.prototype.nodeType="FastLayer",(0,r.bo)(u);var p=i(62418),m=i(93047),g=i(16184);let f=(null==(o=r.TI.performance)?void 0:o.now)?()=>r.TI.performance.now():Date.now;class c{constructor(e,t){this.id=c.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:f(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){return this.layers=e?[].concat(e):[],this}getLayers(){return this.layers}addLayer(e){let t=this.layers,i=t.length;for(let n=0;n<i;n++)if(t[n]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){return c.animations.has(this)}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=f(),c._addAnimation(this),this}stop(){return c._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.add(e),this._handleAnimation()}static _removeAnimation(e){this.animations.delete(e)}static _runFrames(){let e=new Set;
2Array.from(this.animations).forEach(t=>{!this.animations.has(t)||(t._updateFrameObject(f()),t.func&&!1===t.func.call(t,t.frame)||t.layers.forEach(t=>t&&e.add(t)))}),e.forEach(e=>e.batchDraw())}static _animationLoop(){c.animations.size?(c._runFrames(),a.J0.requestAnimFrame(c._animationLoop)):c.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,a.J0.requestAnimFrame(this._animationLoop))}}c.animations=new Set,c.animIdCounter=0,c.animRunning=!1;let v={node:1,duration:1,easing:1,onFinish:1,onUpdate:1,onReset:1,yoyo:1},y=["fill","stroke","shadowColor"],b=0;function w(e){return a.J0.colorToRGBA(e)||a.J0.throw('can not tween the color "'+e+'", because it is not a valid color.')}class S{constructor(e,t,i,n,o,s,r){this.prop=e,this.propFunc=t,this.begin=n,this._pos=n,this.duration=s,this._change=0,this.prevPos=0,this.yoyo=r,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=o-this.begin,this.pause()}fire(e){let t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){let e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return Date.now()}}class T{constructor(e){let t,i,n=this,o=e.node,s=o._id,h=e.easing||k.Linear,l=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=o,this._id=b++;let d=o.getLayer()||(o instanceof r.kg.Stage?o.getLayers():null);for(i in d||a.J0.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new c(function(){n.tween.onEnterFrame()},d),this.tween=new S(i,function(e){n._tweenFunc(e)},h,0,1,1e3*t,l),this._addListeners(),T.attrs[s]||(T.attrs[s]={}),T.attrs[s][this._id]||(T.attrs[s][this._id]={}),T.tweens[s]||(T.tweens[s]={}),e)void 0===v[i]&&this._addAttr(i,e[i]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){let i,n,o,s,r;if(a.J0._isPlainObject(t)){for(let i in t)this._addAttr(e+a.J0._capitalize(i),t[i]);return}let h=this.node,l=h._id,d=T.tweens[l][e];void 0!==d&&delete T.attrs[l][d][e];let _=h.getAttr(e);if(a.J0._isArray(t))if(i=[],_=(_||[]).slice(),n=Math.max(t.length,_.length),"points"===e&&t.length!==_.length&&(t.length>_.length?(s=_,_=a.J0._prepareArrayForTween(_,t,h.closed())):(o=t,t=a.J0._prepareArrayForTween(t,_,h.closed()))),0===e.indexOf("fill"))for(let e=0;e<n;e++)if(e%2==0)i.push(t[e]-(_[e]||0));else{let n=w(_[e]);r=w(t[e]),_[e]=n,i.push({r:r.r-n.r,g:r.g-n.g,b:r.b-n.b,a:r.a-n.a})}else for(let e=0;e<n;e++)i.push(t[e]-(_[e]||0));else -1!==y.indexOf(e)?(_=w(_),i={r:(r=w(t)).r-_.r,g:r.g-_.g,b:r.b-_.b,a:r.a-_.a}):i=t-_;T.attrs[l][this._id][e]={start:_,diff:i,end:t,trueEnd:o,trueStart:s},T.tweens[l][e]=this._id}_tweenFunc(e){let t,i,n,o,s,r,h,l,d=this.node,_=T.attrs[d._id][this._id];for(t in _){if(n=(i=_[t]).start,o=i.diff,l=i.end,a.J0._isArray(n))if(s=[],h=Math.max(n.length,l.length),0===t.indexOf("fill"))for(r=0;r<h;r++)r%2==0?s.push((n[r]||0)+o[r]*e):s.push("rgba("+Math.round(n[r].r+o[r].r*e)+","+Math.round(n[r].g+o[r].g*e)+","+Math.round(n[r].b+o[r].b*e)+","+(n[r].a+o[r].a*e)+")");else for(r=0;r<h;r++)s.push((n[r]||0)+o[r]*e);else s=-1!==y.indexOf(t)?"rgba("+Math.round(n.r+o.r*e)+","+Math.round(n.g+o.g*e)+","+Math.round(n.b+o.b*e)+","+(n.a+o.a*e)+")":n+o*e;d.setAttr(t,s)}}_addListeners(){let e=`destroy.konva-tween${this._id}`,t=()=>this.destroy(),i=()=>{this.node.off(e).on(e,t),this.anim.start()};this.tween.onPlay=i,this.tween.onReverse=i,this.tween.onPause=()=>{this.node.off(e),this.anim.stop()},this.tween.onFinish=()=>{let e=this.node,t=T.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{let e=this.node,t=T.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()}
2,this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e;let t=this.node._id,i=this._id,n=null==(e=T.attrs[t])?void 0:e[i],o=T.tweens[t];if(this.pause(),this.anim&&this.anim.stop(),n){if(o){for(let e in n)delete o[e];0===Object.keys(o).length&&delete T.tweens[t]}delete T.attrs[t][i],0===Object.keys(T.attrs[t]).length&&delete T.attrs[t]}}}T.attrs={},T.tweens={},h.b.prototype.to=function(e){let t=e.onFinish,i=new T({...e,node:this,onFinish(){i.destroy(),t&&t()}});return i.play(),i};let k={BackEaseIn(e,t,i,n){return i*(e/=n)*e*(2.70158*e-1.70158)+t},BackEaseOut(e,t,i,n){return i*((e=e/n-1)*e*(2.70158*e+1.70158)+1)+t},BackEaseInOut(e,t,i,n){let o=1.70158;return(e/=n/2)<1?i/2*(e*e*(((o*=1.525)+1)*e-o))+t:i/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+t},ElasticEaseIn(e,t,i,n,o,s){let r=0;return 0===e?t:1==(e/=n)?t+i:(s||(s=.3*n),!o||o<Math.abs(i)?(o=i,r=s/4):r=s/(2*Math.PI)*Math.asin(i/o),-(o*Math.pow(2,10*(e-=1))*Math.sin(2*Math.PI*(e*n-r)/s))+t)},ElasticEaseOut(e,t,i,n,o,s){let r=0;return 0===e?t:1==(e/=n)?t+i:(s||(s=.3*n),!o||o<Math.abs(i)?(o=i,r=s/4):r=s/(2*Math.PI)*Math.asin(i/o),o*Math.pow(2,-10*e)*Math.sin(2*Math.PI*(e*n-r)/s)+i+t)},ElasticEaseInOut(e,t,i,n,o,s){let r=0;return 0===e?t:2==(e/=n/2)?t+i:(s||(s=.3*1.5*n),!o||o<Math.abs(i)?(o=i,r=s/4):r=s/(2*Math.PI)*Math.asin(i/o),e<1)?-.5*(o*Math.pow(2,10*(e-=1))*Math.sin(2*Math.PI*(e*n-r)/s))+t:o*Math.pow(2,-10*(e-=1))*Math.sin(2*Math.PI*(e*n-r)/s)*.5+i+t},BounceEaseOut(e,t,i,n){return(e/=n)<1/2.75?7.5625*e*e*i+t:e<2/2.75?i*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?i*(7.5625*(e-=2.25/2.75)*e+.9375)+t:i*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,i,n){return i-k.BounceEaseOut(n-e,0,i,n)+t},BounceEaseInOut(e,t,i,n){return e<n/2?.5*k.BounceEaseIn(2*e,0,i,n)+t:.5*k.BounceEaseOut(2*e-n,0,i,n)+.5*i+t},EaseIn(e,t,i,n){return i*(e/=n)*e+t},EaseOut(e,t,i,n){return-i*(e/=n)*(e-2)+t},EaseInOut(e,t,i,n){return(e/=n/2)<1?i/2*e*e+t:-i/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,i,n){return i*(e/=n)*e*e*e*e+t},StrongEaseOut(e,t,i,n){return i*((e=e/n-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,i,n){return(e/=n/2)<1?i/2*e*e*e*e*e+t:i/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,i,n){return i*e/n+t}};var A=i(76714),C=i(37981);let I=a.J0._assign(r.kg,{Util:a.J0,Transform:a.dL,Node:h.b,Container:l.m,Stage:d.B,stages:d._,Layer:_.W,FastLayer:u,Group:p.Y,DD:m.DD,Shape:g.y,shapes:g.n,Animation:c,Tween:T,Easings:k,Context:A.ob,Canvas:C.Hl});var x=i(30268),M=i(70135),P=i(73825),E=i(70317),D={exports:{}},L=(s||(s=1,!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function s(e,t,n,s,r){if("function"!=typeof n)throw TypeError("The listener must be a function");var a=new o(n,s||e,r),h=i?i+t:t;return e._events[h]?e._events[h].fn?e._events[h]=[e._events[h],a]:e._events[h].push(a):(e._events[h]=a,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,s=n.length,r=Array(s);o<s;o++)r[o]=n[o].fn;return r},a.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,o,s,r){var a=i?i+e:e;if(!this._events[a])return!1;var h,l,d=this._events[a],_=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),_){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,o),!0;case 5:return d.fn.call(d.context,t,n,o,s),!0;case 6:return d.fn.call(d.context,t,n,o,s,r),!0}for(l=1,h=Array(_-1);l<_;l++)h[l-1]=arguments[l];d.fn.apply(d.context,h)}else{var u,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),_){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,n);break;case 4:d[l].fn.call(d[l].context,t,n,o);break;default:if(!h)for(u=1,h=Array(_-1);u<_;u++)h[u-1]=arguments[u];d[l].fn.apply(d[l].context,h)}}return!0},a.prototype.on=function(e,t,i){return s(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return s(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,n,o){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return r(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||o&&!a.once||n&&a.context!==n||r(this,s);else{for(var h=0,l=[],d=a.length;h<d;h++)(a[h].fn!==t||o&&!a[h].once||n&&a[h].context!==n)&&l.push(a[h]);l.length?this._events[s]=1===l.length?l[0]:l:r(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&r(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}
2(D)),(n=D.exports)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default"))?n.default:n;function W(e){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function B(e,t,i){this.time=e,this.type=t,this.id=i}function F(e,t){for(e=e.toString();e.length<t;)e="0"+e;return e}function O(e,t){var i=[],n=Math.floor(e%1*Math.pow(10,t)),o=Math.floor(e),s=Math.floor(o/60),r=Math.floor(s/60);r>0&&i.push(r),i.push(s%60),i.push(o%60);for(var a=0;a<i.length;a++)i[a]=F(i[a],2);return i=i.join(":"),t>0&&(i+="."+F(n,t)),i}function X(e,t,i){return e<t?t:e>i?i:e}function V(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function H(e,t){for(var i in t)V(t,i)&&(e[i]=t[i]);return e}function R(e){return"number"==typeof e}function G(e){return"number"==typeof e&&Number.isFinite(e)}function z(e){return null!==e&&"object"===W(e)&&!Array.isArray(e)}function Z(e){return"string"==typeof e}function U(e){return null==e}function Y(e){return!0===e||!1===e}function N(e){return e instanceof HTMLElement}function K(e){return z(e)&&V(e,"linearGradientStart")&&V(e,"linearGradientEnd")&&V(e,"linearGradientColorStops")&&R(e.linearGradientStart)&&R(e.linearGradientEnd)&&Array.isArray(e.linearGradientColorStops)&&2===e.linearGradientColorStops.length}function j(e){for(;null!==e.parent;){if(e.parent instanceof I.Layer)return e;e=e.parent}return null}B.POINT=0,B.SEGMENT_START=1,B.SEGMENT_END=2,B.sorter=function(e,t){return e.time-t.time};var J=/HeadlessChrome/.test(navigator.userAgent),q=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,Q=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame,$={},ee={};$[B.POINT]=0,$[B.SEGMENT_START]=1,$[B.SEGMENT_END]=2,ee[B.POINT]=0,ee[B.SEGMENT_START]=2,ee[B.SEGMENT_END]=1;var et={};et[0]="points.enter",et[1]="segments.enter",et[2]="segments.exit";var ei={};function en(e){this._cues=[],this._peaks=e,this._previousTime=-1,this._updateCues=this._updateCues.bind(this),this._onPlaying=this._onPlaying.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onTimeUpdate=this._onTimeUpdate.bind(this),this._onAnimationFrame=this._onAnimationFrame.bind(this),this._rAFHandle=null,this._activeSegments={},this._attachEventHandlers()}ei[0]="point",ei[1]="segment",ei[2]="segment",en.prototype._updateCues=function(){var e=this,t=e._peaks.points.getPoints(),i=e._peaks.segments.getSegments();e._cues.length=0,t.forEach(function(t){e._cues.push(new B(t.time,B.POINT,t.id))}
2),i.forEach(function(t){e._cues.push(new B(t.startTime,B.SEGMENT_START,t.id)),e._cues.push(new B(t.endTime,B.SEGMENT_END,t.id))}),e._cues.sort(B.sorter);var n=e._peaks.player.getCurrentTime();e._updateActiveSegments(n)},en.prototype._onUpdate=function(e,t){var i,n,o,s=e>t;s?(i=0,n=this._cues.length,o=1):(i=this._cues.length-1,n=-1,o=-1);for(var r=i;s?r<n:r>n;r+=o){var a=this._cues[r];if(s?a.time>t:a.time<t){if(s?a.time>e:a.time<e)break;var h=function(e,t){switch(t.type){case B.POINT:return e.points.getPoint(t.id);case B.SEGMENT_START:case B.SEGMENT_END:return e.segments.getSegment(t.id);default:throw Error("getPointOrSegment: id not found?")}}(this._peaks,a),l=s?$[a.type]:ee[a.type];1===l?this._activeSegments[h.id]=h:2===l&&delete this._activeSegments[h.id];var d={time:e};d[ei[l]]=h,this._peaks.emit(et[l],d)}}},en.prototype._onTimeUpdate=function(e){!J&&!navigator.webdriver&&("u"<typeof document?"undefined":W(document))==="object"&&"visibilityState"in document&&"visible"===document.visibilityState||(this._peaks.player.isPlaying()&&!this._peaks.player.isSeeking()&&this._onUpdate(e,this._previousTime),this._previousTime=e)},en.prototype._onAnimationFrame=function(){var e=this._peaks.player.getCurrentTime();this._peaks.player.isSeeking()||this._onUpdate(e,this._previousTime),this._previousTime=e,this._peaks.player.isPlaying()&&(this._rAFHandle=q(this._onAnimationFrame))},en.prototype._onPlaying=function(){this._previousTime=this._peaks.player.getCurrentTime(),this._rAFHandle=q(this._onAnimationFrame)},en.prototype._onSeeked=function(e){this._previousTime=e,this._updateActiveSegments(e)},en.prototype._updateActiveSegments=function(e){var t=this,i=t._peaks.segments.getSegmentsAtTime(e);for(var n in t._activeSegments)V(t._activeSegments,n)&&(i.find(function(e){return function(t){return t.id===e}}(n))||(t._peaks.emit("segments.exit",{segment:t._activeSegments[n],time:e}),delete t._activeSegments[n]));i.forEach(function(i){i.id in t._activeSegments||(t._activeSegments[i.id]=i,t._peaks.emit("segments.enter",{segment:i,time:e}))})};var eo=["points.update","points.dragmove","points.add","points.remove","points.remove_all","segments.update","segments.dragged","segments.add","segments.remove","segments.remove_all"];en.prototype._attachEventHandlers=function(){this._peaks.on("player.timeupdate",this._onTimeUpdate),this._peaks.on("player.playing",this._onPlaying),this._peaks.on("player.seeked",this._onSeeked);for(var e=0;e<eo.length;e++)this._peaks.on(eo[e],this._updateCues);this._updateCues()},en.prototype._detachEventHandlers=function(){this._peaks.off("player.timeupdate",this._onTimeUpdate),this._peaks.off("player.playing",this._onPlaying),this._peaks.off("player.seeked",this._onSeeked);for(var e=0;e<eo.length;e++)this._peaks.off(eo[e],this._updateCues)},en.prototype.destroy=function(){this._rAFHandle&&(Q(this._rAFHandle),this._rAFHandle=null),this._detachEventHandlers(),this._previousTime=-1};var es=["id","pid","time","labelText","color","editable"],er=["update","isVisible","peaks","pid"];function ea(e,t){var i=t?"update()":"add()";if((!t||t&&V(e,"time"))&&!G(e.time))throw TypeError("peaks.points."+i+": time should be a numeric value");if(e.time<0)throw RangeError("peaks.points."+i+": time should not be negative");if(V(e,"labelText")&&!Z(e.labelText))throw TypeError("peaks.points."+i+": labelText must be a string");if(V(e,"editable")&&!Y(e.editable))throw TypeError("peaks.points."+i+": editable must be true or false");if(V(e,"color")&&!Z(e.color)&&!K(e.color))throw TypeError("peaks.points."+i+": color must be a string or a valid linear gradient object");er.forEach(function(t){if(V(e,t))throw Error("peaks.points."+i+": invalid option name: "+t)}
2),es.forEach(function(t){if(V(e,"_"+t))throw Error("peaks.points."+i+": invalid option name: _"+t)})}function eh(e,t,i){this._peaks=e,this._pid=t,this._setUserData(i)}function el(e){this._peaks=e,this._points=[],this._pointsById={},this._pointsByPid={},this._pointIdCounter=0,this._pointPid=0}eh.prototype._setUserData=function(e){for(var t in e)V(e,t)&&(-1===es.indexOf(t)?this[t]=e[t]:this["_"+t]=e[t])},Object.defineProperties(eh.prototype,{id:{enumerable:!0,get:function(){return this._id}},pid:{enumerable:!0,get:function(){return this._pid}},time:{enumerable:!0,get:function(){return this._time}},labelText:{get:function(){return this._labelText}},color:{enumerable:!0,get:function(){return this._color}},editable:{enumerable:!0,get:function(){return this._editable}}}),eh.prototype.update=function(e){if(ea(e,!0),V(e,"id")){if(U(e.id))throw TypeError("point.update(): invalid id");this._peaks.points.updatePointId(this,e.id)}this._setUserData(e),this._peaks.emit("points.update",this,e)},eh.prototype.isVisible=function(e,t){return this.time>=e&&this.time<t},eh.prototype._setTime=function(e){this._time=e},el.prototype._getNextPointId=function(){return"peaks.point."+this._pointIdCounter++},el.prototype._getNextPid=function(){return this._pointPid++},el.prototype._addPoint=function(e){this._points.push(e),this._pointsById[e.id]=e,this._pointsByPid[e.pid]=e},el.prototype._createPoint=function(e){var t,i={};H(i,e),U(i.id)&&(i.id=this._getNextPointId());var n=this._getNextPid();return t=this._peaks.options,U(i.labelText)&&(i.labelText=""),U(i.editable)&&(i.editable=!1),U(i.color)&&(i.color=t.pointMarkerColor),ea(i,!1),new eh(this._peaks,n,i)},el.prototype.getPoints=function(){return this._points},el.prototype.getPoint=function(e){return this._pointsById[e]},el.prototype.find=function(e,t){return this._points.filter(function(i){return i.isVisible(e,t)})},el.prototype.add=function(){var e=this,t=Array.isArray(arguments[0]),i=t?arguments[0]:Array.prototype.slice.call(arguments);return(i=i.map(function(t){var i=e._createPoint(t);if(V(e._pointsById,i.id))throw Error("peaks.points.add(): duplicate id");return i})).forEach(function(t){e._addPoint(t)}),this._peaks.emit("points.add",{points:i}),t?i:i[0]},el.prototype.updatePointId=function(e,t){if(this._pointsById[e.id])if(this._pointsById[t])throw Error("point.update(): duplicate id");else delete this._pointsById[e.id],this._pointsById[t]=e},el.prototype._findPoint=function(e){for(var t=[],i=0,n=this._points.length;i<n;i++)e(this._points[i])&&t.push(i);return t},el.prototype._removeIndexes=function(e){for(var t=[],i=0;i<e.length;i++){var n=e[i]-t.length,o=this._points.splice(n,1)[0];delete this._pointsById[o.id],delete this._pointsByPid[o.pid],t.push(o)}return t},el.prototype._removePoints=function(e){var t=this._findPoint(e),i=this._removeIndexes(t);return this._peaks.emit("points.remove",{points:i}),i},el.prototype.remove=function(e){return this._removePoints(function(t){return t===e})},el.prototype.removeById=function(e){return this._removePoints(function(t){return t.id===e})},el.prototype.removeByTime=function(e){return this._removePoints(function(t){return t.time===e})},el.prototype.removeAll=function(){this._points=[],this._pointsById={},this._pointsByPid={},this._peaks.emit("points.remove_all")};var ed=["id","pid","startTime","endTime","labelText","color","borderColor","markers","overlay","editable"],e_=["update","isVisible","peaks","pid"];function eu(e,t){var i=t?"update()":"add()";if(V(e,"startTime")&&!G(e.startTime))throw TypeError("peaks.segments."+i+": startTime should be a valid number");if(V(e,"endTime")&&!G(e.endTime))throw TypeError("peaks.segments."+i+": endTime should be a valid number");if(!t&&(!V(e,"startTime")||!V(e,"endTime")))throw TypeError("peaks.segments."+i+": missing startTime or endTime");if(e.startTime<0)throw RangeError("peaks.segments."+i+": startTime should not be negative");if(e.endTime<0)throw RangeError("peaks.segments."+i+": endTime should not be negative");if(e.endTime<e.startTime)throw RangeError("peaks.segments."+i+": endTime should not be less than startTime");if(V(e,"labelText")&&!Z(e.labelText))throw TypeError("peaks.segments."+i+": labelText must be a string");if(t&&V(e,"markers"))throw TypeError("peaks.segments."+i+": cannot update markers attribute");if(V(e,"markers")&&!Y(e.markers))throw TypeError("peaks.segments."+i+": markers must be true or false");if(t&&V(e,"overlay"))throw TypeError("peaks.segments."+i+": cannot update overlay attribute");if(V(e,"overlay")&&!Y(e.overlay))throw TypeError("peaks.segments."+i+": overlay must be true or false");if(V(e,"editable")&&!Y(e.editable))throw TypeError("peaks.segments."+i+": editable must be true or false");if(V(e,"color")&&!Z(e.color)&&!K(e.color))throw TypeError("peaks.segments."+i+": color must be a string or a valid linear gradient object");
2if(V(e,"borderColor")&&!Z(e.borderColor))throw TypeError("peaks.segments."+i+": borderColor must be a string");e_.forEach(function(t){if(V(e,t))throw Error("peaks.segments."+i+": invalid option name: "+t)}),ed.forEach(function(t){if(V(e,"_"+t))throw Error("peaks.segments."+i+": invalid option name: _"+t)})}function ep(e,t,i){this._peaks=e,this._pid=t,this._id=i.id,this._startTime=i.startTime,this._endTime=i.endTime,this._labelText=i.labelText,this._color=i.color,this._borderColor=i.borderColor,this._editable=i.editable,this._markers=i.markers,this._overlay=i.overlay,this._setUserData(i)}function em(e){this._peaks=e,this._segments=[],this._segmentsById={},this._segmentsByPid={},this._segmentIdCounter=0,this._segmentPid=0,this._isInserting=!1}ep.prototype._setUserData=function(e){for(var t in e)V(e,t)&&(-1===ed.indexOf(t)?this[t]=e[t]:this["_"+t]=e[t])},Object.defineProperties(ep.prototype,{id:{enumerable:!0,get:function(){return this._id}},pid:{enumerable:!0,get:function(){return this._pid}},startTime:{enumerable:!0,get:function(){return this._startTime}},endTime:{enumerable:!0,get:function(){return this._endTime}},labelText:{enumerable:!0,get:function(){return this._labelText}},color:{enumerable:!0,get:function(){return this._color}},borderColor:{enumerable:!0,get:function(){return this._borderColor}},markers:{enumerable:!0,get:function(){return this._markers}},overlay:{enumerable:!0,get:function(){return this._overlay}},editable:{enumerable:!0,get:function(){return this._editable}}}),ep.prototype.update=function(e){if(eu(e,!0),V(e,"id")){if(U(e.id))throw TypeError("segment.update(): invalid id");this._peaks.segments.updateSegmentId(this,e.id)}this._setUserData(e),this._peaks.emit("segments.update",this,e)},ep.prototype.isVisible=function(e,t){return this.startTime===this.endTime&&this.startTime===e||!(this.endTime<=e)&&!(this.startTime>=t)},ep.prototype._setStartTime=function(e){this._startTime=e},ep.prototype._setEndTime=function(e){this._endTime=e},em.prototype._getNextSegmentId=function(){return"peaks.segment."+this._segmentIdCounter++},em.prototype._getNextPid=function(){return this._segmentPid++},em.prototype._addSegment=function(e){this._segments.push(e),this._segmentsById[e.id]=e,this._segmentsByPid[e.pid]=e},em.prototype._createSegment=function(e){var t,i={};H(i,e),U(i.id)&&(i.id=this._getNextSegmentId());var n=this._getNextPid();return t=this._peaks.options.segmentOptions,U(i.color)&&(t.overlay?i.color=t.overlayColor:i.color=t.waveformColor),U(i.borderColor)&&(i.borderColor=t.overlayBorderColor),U(i.labelText)&&(i.labelText=""),U(i.markers)&&(i.markers=t.markers),U(i.overlay)&&(i.overlay=t.overlay),U(i.editable)&&(i.editable=!1),eu(i,!1),new ep(this._peaks,n,i)},em.prototype.getSegments=function(){return this._segments},em.prototype.getSegment=function(e){return this._segmentsById[e]},em.prototype.getSegmentsAtTime=function(e){return this._segments.filter(function(t){return e>=t.startTime&&e<t.endTime})},em.prototype.find=function(e,t){return this._segments.filter(function(i){return i.isVisible(e,t)})},em.prototype._getSortedSegments=function(){return this._segments.slice().sort(function(e,t){return e.startTime-t.startTime})},em.prototype.findPreviousSegment=function(e){var t=this._getSortedSegments(),i=t.findIndex(function(t){return t.id===e.id});if(-1!==i)return t[i-1]},em.prototype.findNextSegment=function(e){var t=this._getSortedSegments(),i=t.findIndex(function(t){return t.id===e.id});if(-1!==i)return t[i+1]},em.prototype.add=function(){var e=this,t=Array.isArray(arguments[0]),i=t?arguments[0]:Array.prototype.slice.call(arguments);return(i=i.map(function(t){var i=e._createSegment(t);if(V(e._segmentsById,i.id))throw Error("peaks.segments.add(): duplicate id");return i})).forEach(function(t){e._addSegment(t)}),this._peaks.emit("segments.add",{segments:i,insert:this._isInserting}),t?i:i[0]},em.prototype.updateSegmentId=function(e,t){if(this._segmentsById[e.id])if(this._segmentsById[t])throw Error("segment.update(): duplicate id");else delete this._segmentsById[e.id],this._segmentsById[t]=e},em.prototype._findSegment=function(e){for(var t=[],i=0,n=this._segments.length;i<n;
2i++)e(this._segments[i])&&t.push(i);return t},em.prototype._removeIndexes=function(e){for(var t=[],i=0;i<e.length;i++){var n=e[i]-t.length,o=this._segments.splice(n,1)[0];delete this._segmentsById[o.id],delete this._segmentsByPid[o.pid],t.push(o)}return t},em.prototype._removeSegments=function(e){var t=this._findSegment(e),i=this._removeIndexes(t);return this._peaks.emit("segments.remove",{segments:i}),i},em.prototype.remove=function(e){return this._removeSegments(function(t){return t===e})},em.prototype.removeById=function(e){return this._removeSegments(function(t){return t.id===e})},em.prototype.removeByTime=function(e,t){var i;return i=(t="number"==typeof t?t:0)>0?function(i){return i.startTime===e&&i.endTime===t}:function(t){return t.startTime===e},this._removeSegments(i)},em.prototype.removeAll=function(){this._segments=[],this._segmentsById={},this._segmentsByPid={},this._peaks.emit("segments.remove_all")},em.prototype.setInserting=function(e){this._isInserting=e},em.prototype.isInserting=function(){return this._isInserting};var eg=["OBJECT","TEXTAREA","INPUT","SELECT","OPTION"],ef=[32,9,37,39];function ec(e){this.eventEmitter=e,this._handleKeyEvent=this._handleKeyEvent.bind(this),document.addEventListener("keydown",this._handleKeyEvent),document.addEventListener("keypress",this._handleKeyEvent),document.addEventListener("keyup",this._handleKeyEvent)}function ev(e){this._mediaElement=e}function ey(e,t){this._eventEmitter=e,this._mediaElement=t,this._playerCanPlayHandler=this._playerCanPlayHandler.bind(this),this._playerErrorHandler=this._playerErrorHandler.bind(this)}function eb(e,t){var i;this._peaks=e,this._playingSegment=!1,this._segment=null,this._loop=!1,this._playSegmentTimerCallback=this._playSegmentTimerCallback.bind(this),i=function(e){for(var t=[],i=e;i;)Object.getOwnPropertyNames(i).forEach(function(e){t.push(e)}),i=Object.getPrototypeOf(i);return t}(t),["init","destroy","play","pause","isPlaying","isSeeking","getCurrentTime","getDuration","seek"].forEach(function(e){if(!i.includes(e))throw TypeError("Peaks.init(): Player method "+e+" is undefined");if("function"!=typeof t[e])throw TypeError("Peaks.init(): Player method "+e+" is not a function")}),this._adapter=t}function ew(e){this._options=e,this._draggable=e.editable}function eS(e){this._options=e,this._editable=e.editable}function eT(e){return"zoomview"===e.view?new eS(e):null}function ek(e){return new P.EY({x:12,y:12,text:e.segment.labelText,textAlign:"center",fontFamily:e.fontFamily||"sans-serif",fontSize:e.fontSize||12,fontStyle:e.fontStyle||"normal",fill:"#000"})}function eA(e){return new ew(e)}function eC(e,t){this._view=e,this._offset=t.highlightOffset,this._color=t.highlightColor,this._layer=new I.Layer({listening:!1}),this._highlightRect=null,this._startTime=null,this._endTime=null,this._strokeColor=t.highlightStrokeColor,this._opacity=t.highlightOpacity,this._cornerRadius=t.highlightCornerRadius}function eI(e){this._point=e.point,this._marker=e.marker,this._draggable=e.draggable,this._onDragStart=e.onDragStart,this._onDragMove=e.onDragMove,this._onDragEnd=e.onDragEnd,this._dragBoundFunc=e.dragBoundFunc,this._onMouseEnter=e.onMouseEnter,this._onMouseLeave=e.onMouseLeave,this._group=new I.Group({name:"point-marker",point:this._point,draggable:this._draggable,dragBoundFunc:e.dragBoundFunc}),this._bindDefaultEventHandlers(),this._marker.init(this._group)}function ex(e,t,i){this._peaks=e,this._view=t,this._enableEditing=i,this._pointMarkers={},this._layer=new I.Layer,this._onPointsDrag=this._onPointsDrag.bind(this),this._onPointMarkerDragStart=this._onPointMarkerDragStart.bind(this),this._onPointMarkerDragMove=this._onPointMarkerDragMove.bind(this),this._onPointMarkerDragEnd=this._onPointMarkerDragEnd.bind(this),this._pointMarkerDragBoundFunc=this._pointMarkerDragBoundFunc.bind(this),this._onPointMarkerMouseEnter=this._onPointMarkerMouseEnter.bind(this),this._onPointMarkerMouseLeave=this._onPointMarkerMouseLeave.bind(this),this._onPointsUpdate=this._onPointsUpdate.bind(this),this._onPointsAdd=this._onPointsAdd.bind(this),this._onPointsRemove=this._onPointsRemove.bind(this),this._onPointsRemoveAll=this._onPointsRemoveAll.bind(this),this._peaks.on("points.update",this._onPointsUpdate),this._peaks.on("points.add",this._onPointsAdd),this._peaks.on("points.remove",this._onPointsRemove),this._peaks.on("points.remove_all",this._onPointsRemoveAll),this._peaks.on("points.dragstart",this._onPointsDrag),this._peaks.on("points.dragmove",this._onPointsDrag),this._peaks.on("points.dragend",this._onPointsDrag)}function eM(e,t,i){this._player=e,this._view=t,this._playheadPixel=0,this._playheadLineAnimation=null,this._playheadVisible=!1,this._playheadColor=i.playheadColor,this._playheadTextColor=i.playheadTextColor,this._playheadBackgroun
2dColor=i.playheadBackgroundColor,this._playheadPadding=i.playheadPadding,this._playheadWidth=i.playheadWidth,this._playheadFontFamily=i.playheadFontFamily,this._playheadFontSize=i.playheadFontSize,this._playheadFontStyle=i.playheadFontStyle,this._playheadLayer=new I.Layer({listening:!1}),this._createPlayhead(),i.showPlayheadTime&&this._createPlayheadText(),this.fitToView(),this.zoomLevelChanged()}function eP(e){this._options=e}function eE(e){var t=this;t._segment=e.segment,t._marker=e.marker,t._segmentShape=e.segmentShape,t._editable=e.editable,t._startMarker=e.startMarker,t._onClick=e.onClick,t._onDragStart=e.onDragStart,t._onDragMove=e.onDragMove,t._onDragEnd=e.onDragEnd,t._group=new I.Group({name:"segment-marker",segment:t._segment,draggable:t._editable,visible:t._editable,dragBoundFunc:function(i){return e.dragBoundFunc(t,i)}}),t._bindDefaultEventHandlers(),t._marker.init(t._group)}function eD(e){this._color=e.color;var t={};if(Z(e.color))t.fill=e.color;else if(K(e.color)){var i=e.view._height*(e.color.linearGradientStart/100),n=e.view._height*(e.color.linearGradientEnd/100);t.fillLinearGradientStartPointY=i,t.fillLinearGradientEndPointY=n,t.fillLinearGradientColorStops=[0,e.color.linearGradientColorStops[0],1,e.color.linearGradientColorStops[1]]}else throw TypeError("Unknown type for color property");this._shape=new I.Shape(t),this._view=e.view,this._segment=e.segment,this._shape.sceneFunc(this._sceneFunc.bind(this))}function eL(e,t,i,n){this._segment=e,this._peaks=t,this._layer=i,this._view=n,this._label=null,this._startMarker=null,this._endMarker=null,this._color=e.color,this._borderColor=e.borderColor,this._draggable=this._segment.editable&&this._view.isSegmentDraggingEnabled(),this._dragging=!1;var o,s,r,a,h,l=n.getViewOptions(),d=l.segmentOptions;this._overlayOffset=d.overlayOffset,e.overlay||(this._waveformShape=new eD({color:e.color,view:n,segment:e})),this._onMouseEnter=this._onMouseEnter.bind(this),this._onMouseLeave=this._onMouseLeave.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._dragBoundFunc=this._dragBoundFunc.bind(this),this._onSegmentDragStart=this._onSegmentDragStart.bind(this),this._onSegmentDragMove=this._onSegmentDragMove.bind(this),this._onSegmentDragEnd=this._onSegmentDragEnd.bind(this),this._onSegmentMarkerClick=this._onSegmentMarkerClick.bind(this),this._onSegmentMarkerDragStart=this._onSegmentMarkerDragStart.bind(this),this._onSegmentMarkerDragMove=this._onSegmentMarkerDragMove.bind(this),this._onSegmentMarkerDragEnd=this._onSegmentMarkerDragEnd.bind(this),this._segmentMarkerDragBoundFunc=this._segmentMarkerDragBoundFunc.bind(this),this._label=this._peaks.options.createSegmentLabel({segment:e,view:this._view.getName(),layer:this._layer,fontFamily:l.fontFamily,fontSize:l.fontSize,fontStyle:l.fontStyle}),this._label&&this._label.hide();var _=this._view.timeToPixelOffset(this._segment.startTime),u=this._view.timeToPixelOffset(this._segment.endTime),p=X(0,this._view.getHeight()-2*this._overlayOffset);this._overlay=new I.Group({name:"segment-overlay",segment:this._segment,x:_,y:0,width:u-_,height:this._view.getHeight(),clipX:0,clipY:this._overlayOffset,clipWidth:u-_,clipHeight:p,draggable:this._draggable,dragBoundFunc:this._dragBoundFunc}),e.overlay&&(o=this._borderColor||d.overlayBorderColor,s=d.overlayBorderWidth,r=this._color||d.overlayColor,a=d.overlayOpacity,h=d.overlayCornerRadius),this._overlayRect=new I.Rect({x:0,y:this._overlayOffset,width:u-_,stroke:o,strokeWidth:s,height:p,fill:r,opacity:a,cornerRadius:h}),this._overlay.add(this._overlayRect),e.overlay&&(this._overlayText=new I.Text({x:0,y:this._overlayOffset,text:this._segment.labelText,fontFamily:d.overlayFontFamily,fontSize:d.overlayFontSize,fontStyle:d.overlayFontStyle,fill:d.overlayLabelColor,listening:!1,align:d.overlayLabelAlign,width:u-_,verticalAlign:d.overlayLabelVerticalAlign,height:p,padding:d.overlayLabelPadding}),this._overlay.add(this._overlayText)),this._overlay.on("mouseenter",this._onMouseEnter),this._overlay.on("mouseleave",this._onMouseLeave),this._overlay.on("mousedown",this._onMouseDown),this._overlay.on("mouseup",this._onMouseUp),this._draggable&&(this._overlay.on("dragstart",this._onSegmentDragStart),this._overlay.on("dragmove",this._onSegmentDragMove),this._overlay.on("dragend",this._onSegmentDragEnd)),this._createMarkers()}function eW(e){return new eP(e)}function eB(e){return e.endTime-e.startTime}function eF(e,t,i){this._peaks=e,this._view=t,this._enableEditing=i,this._segmentShapes={},this._layer=new I.Layer,this._onSegmentsUpdate=this._onSegmentsUpdate.bind(this),this._onSegmentsAdd=this._onSegmentsAdd.bind(this),this._onSegmentsRemove=this._onSegmentsRemove.bind(this),this._onSegmentsRemoveAll=this._onSegmentsRemoveAll.bind(this),this._onSegmentsDragged=this._onSegmentsDragged.bind(this),this._peaks.on("segments.update",this._onSegmentsUpdate),this._peaks.on("segments.add",this._onSegmentsAdd),this._peaks.on("segments.remove",this._onSegmentsRemove),this._peaks.on("segments.remove_all",this._onSegmentsRemoveAll),this._peaks.on("segments.dragged",this._onSegmentsDragged)}function eO(e,t){var i=this;
2i._axisGridlineColor=t.axisGridlineColor,i._axisLabelColor=t.axisLabelColor,i._showAxisLabels=t.showAxisLabels,i._axisTopMarkerHeight=t.axisTopMarkerHeight,i._axisBottomMarkerHeight=t.axisBottomMarkerHeight,t.formatAxisTime?i._formatAxisTime=t.formatAxisTime:i._formatAxisTime=function(e){return O(e,0)},i._axisLabelFont=eO._buildFontString(t.fontFamily,t.fontSize,t.fontStyle),i._axisShape=new I.Shape({sceneFunc:function(t){i._drawAxis(t,e)}})}function eX(e,t,i,n){var o=this;o._container=t,o._peaks=i,o._options=i.options,o._viewOptions=n,o._originalWaveformData=e,o._data=e,o._frameOffset=0,o._width=t.clientWidth,o._height=t.clientHeight,o._amplitudeScale=1,o._waveformColor=o._viewOptions.waveformColor,o._playedWaveformColor=o._viewOptions.playedWaveformColor,o._timeLabelPrecision=o._viewOptions.timeLabelPrecision,o._viewOptions.formatPlayheadTime?o._formatPlayheadTime=o._viewOptions.formatPlayheadTime:o._formatPlayheadTime=function(e){return O(e,o._timeLabelPrecision)},o._enableSeek=!0,o.initWaveformData(),I.showWarnings=!1,o._stage=new I.Stage({container:t,width:o._width,height:o._height}),o._createWaveform(),o._viewOptions.enableSegments&&(o._segmentsLayer=new eF(i,o,o._viewOptions.enableEditing),o._segmentsLayer.addToStage(o._stage)),o._viewOptions.enablePoints&&(o._pointsLayer=new ex(i,o,o._viewOptions.enableEditing),o._pointsLayer.addToStage(o._stage)),o.initHighlightLayer(),o._createAxisLabels(),o._playheadLayer=new eM(o._peaks.player,o,o._viewOptions),o._playheadLayer.addToStage(o._stage),o._onClick=o._onClick.bind(o),o._onDblClick=o._onDblClick.bind(o),o._onContextMenu=o._onContextMenu.bind(o),o._stage.on("click",o._onClick),o._stage.on("dblclick",o._onDblClick),o._stage.on("contextmenu",o._onContextMenu)}function eV(e,t){this._stage=e,this._handlers=t,this._dragging=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseUp=this._mouseUp.bind(this),this._mouseMove=this._mouseMove.bind(this),this._stage.on("mousedown",this._mouseDown),this._stage.on("touchstart",this._mouseDown),this._lastMouseClientX=null}function eH(e,t){this._peaks=e,this._view=t,this._firstMove=!1,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._mouseDragHandler=new eV(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove,onMouseUp:this._onMouseUp})}function eR(e,t,i){eX.call(this,e,t,i,i.options.overview),this._onTimeUpdate=this._onTimeUpdate.bind(this),this._onPlaying=this._onPlaying.bind(this),this._onPause=this._onPause.bind(this),this._onZoomviewUpdate=this._onZoomviewUpdate.bind(this),i.on("player.timeupdate",this._onTimeUpdate),i.on("player.playing",this._onPlaying),i.on("player.pause",this._onPause),i.on("zoomview.update",this._onZoomviewUpdate);var n=this._peaks.player.getCurrentTime();this._playheadLayer.updatePlayheadTime(n),this._mouseDragHandler=new eH(i,this);var o=i.views.getView("zoomview");o&&this._highlightLayer.showHighlight(o.getStartTime(),o.getEndTime())}function eG(e,t){this._peaks=e,this._view=t,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._mouseDragHandler=new eV(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove,onMouseUp:this._onMouseUp})}function ez(e,t){this._peaks=e,this._view=t,this._seeking=!1,this._firstMove=!1,this._segment=null,this._segmentIsDraggable=!1,this._initialFrameOffset=0,this._mouseDownX=0,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._mouseDragHandler=new eV(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove,onMouseUp:this._onMouseUp})}function eZ(e,t,i){eX.call(this,e,t,i,i.options.zoomview),this._onTimeUpdate=this._onTimeUpdate.bind(this),this._onPlaying=this._onPlaying.bind(this),this._onPause=this._onPause.bind(this),this._onKeyboardLeft=this._onKeyboardLeft.bind(this),this._onKeyboardRight=this._onKeyboardRight.bind(this),this._onKeyboardShiftLeft=this._onKeyboardShiftLeft.b
2ind(this),this._onKeyboardShiftRight=this._onKeyboardShiftRight.bind(this),this._peaks.on("player.timeupdate",this._onTimeUpdate),this._peaks.on("player.playing",this._onPlaying),this._peaks.on("player.pause",this._onPause),this._peaks.on("keyboard.left",this._onKeyboardLeft),this._peaks.on("keyboard.right",this._onKeyboardRight),this._peaks.on("keyboard.shift_left",this._onKeyboardShiftLeft),this._peaks.on("keyboard.shift_right",this._onKeyboardShiftRight),this._autoScroll=this._viewOptions.autoScroll,this._autoScrollOffset=this._viewOptions.autoScrollOffset,this._enableSegmentDragging=!1,this._segmentDragMode="overlap",this._minSegmentDragWidth=0,this._insertSegmentShape=null,this._playheadClickTolerance=this._viewOptions.playheadClickTolerance,this._zoomLevelAuto=!1,this._zoomLevelSeconds=null;var n=this._peaks.player.getCurrentTime();this._syncPlayhead(n),this._mouseDragHandler=new ez(i,this),this._onWheel=this._onWheel.bind(this),this._onWheelCaptureVerticalScroll=this._onWheelCaptureVerticalScroll.bind(this),this.setWheelMode(this._viewOptions.wheelMode),this._peaks.emit("zoomview.update",{startTime:0,endTime:this.getEndTime()})}function eU(e,t){this._container=e,this._peaks=t,this._options=t.options.scrollbar,this._zoomview=t.views.getView("zoomview"),this._dragBoundFunc=this._dragBoundFunc.bind(this),this._onScrollboxDragStart=this._onScrollboxDragStart.bind(this),this._onScrollboxDragMove=this._onScrollboxDragMove.bind(this),this._onScrollboxDragEnd=this._onScrollboxDragEnd.bind(this),this._onZoomviewUpdate=this._onZoomviewUpdate.bind(this),this._onScrollbarClick=this._onScrollbarClick.bind(this),this._peaks.on("zoomview.update",this._onZoomviewUpdate),this._width=e.clientWidth,this._height=e.clientHeight,this._stage=new I.Stage({container:e,width:this._width,height:this._height}),this._layer=new I.Layer,this._stage.on("click",this._onScrollbarClick),this._stage.add(this._layer),this._color=this._options.color,this._scrollboxX=0,this._minScrollboxWidth=this._options.minWidth,this._offsetY=0,this._scrollbox=new I.Group({draggable:!0,dragBoundFunc:this._dragBoundFunc}),this._scrollboxRect=new M.r({x:this._scrollboxX,y:this._offsetY,width:0,height:this._height,fill:this._color}),this._scrollbox.add(this._scrollboxRect),this._setScrollboxWidth(),this._scrollbox.on("dragstart",this._onScrollboxDragStart),this._scrollbox.on("dragmove",this._onScrollboxDragMove),this._scrollbox.on("dragend",this._onScrollboxDragEnd),this._layer.add(this._scrollbox),this._updateScrollbarWidthAndPosition()}function eY(e){this._peaks=e,this._overview=null,this._zoomview=null,this._scrollbar=null}function eN(e,t){this._peaks=e,this._zoomLevels=t,this._zoomLevelIndex=0}ec.prototype._handleKeyEvent=function(e){if(-1===eg.indexOf(e.target.nodeName)){if(ef.indexOf(e.type)>-1&&e.preventDefault(),"keydown"===e.type||"keypress"===e.type)switch(e.keyCode){case 32:this.eventEmitter.emit("keyboard.space");break;case 9:this.eventEmitter.emit("keyboard.tab")}else if("keyup"===e.type)switch(e.keyCode){case 37:e.shiftKey?this.eventEmitter.emit("keyboard.shift_left"):this.eventEmitter.emit("keyboard.left");break;case 39:e.shiftKey?this.eventEmitter.emit("keyboard.shift_right"):this.eventEmitter.emit("keyboard.right")}}},ec.prototype.destroy=function(){document.removeEventListener("keydown",this._handleKeyEvent),document.removeEventListener("keypress",this._handleKeyEvent),document.removeEventListener("keyup",this._handleKeyEvent)},ev.prototype._addMediaListener=function(e,t){this._listeners.push({type:e,callback:t}),this._mediaElement.addEventListener(e,t)},ev.prototype.init=function(e){var t,i=this;return(i._eventEmitter=e,i._listeners=[],i._duration=i.getDuration(),i._addMediaListener("timeupdate",function(){i._eventEmitter.emit("player.timeupdate",i.getCurrentTime())}),i._addMediaListener("playing",function(){i._eventEmitter.emit("player.playing",i.getCurrentTime())}),i._addMediaListener("pause",function(){i._eventEmitter.emit("player.pause",i.getCurrentTime())}),i._addMediaListener("ended",function(){i._eventEmitter.emit("player.ended")}),i._addMediaListener("seeked",function(){i._eventEmitter.emit("player.seeked",i.getCurrentTime())}),i._addMediaListener("canplay",function(){i._eventEmitter.emit("player.canplay")}),i._addMediaListener("error",function(e){i._eventEmitter.emit("player.error",e.target.error)}),i._interval=null,(t=i._mediaElement).src||t.querySelector("source"))?i._mediaElement.error&&i._mediaElement.error.code===MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED?Promise.reject(i._mediaElement.error):new Promise(function(e,t){function n(o){i._mediaElement.removeEventListener("loadedmetadata",n),i._mediaElement.removeEventListener("error",n),"loadedmetadata"===o.type?e():t(o.target.error)}i._mediaElement.readyState===HTMLMediaElement.HAVE_NOTHING?(i._mediaElement.addEventListener("loadedmetadata",n),i._mediaElement.addEventListener("error",n),i._mediaElement.load()):e()}):Promise.resolve()},ev.prototype.destroy=function(){for(var e=0;e<this._listeners.length;e++){var t=this._listeners[e];this._mediaElement.removeEventListener(t.type,t.callback)}this._listeners.length=0,this._mediaElement=null},ev.prototype.play=function(){return this._mediaElement.play()},ev.prototype.pause=function(){this._mediaElement.pause()},ev.prototype.isPlaying=function(){return!this._mediaElement.paused},ev.prototype.isSeeking=function(){return this._mediaElement.seeking},ev.prototype.getCurrentTime=function(){return this._mediaElement.currentTime},ev.prototype.getDuration=function(){return this._mediaElement.duration},ev.prototype.seek=function(e){this._mediaElement.currentTime=e},ey.prototype.setSource=function(e,t){var i=this;return i._options=e,i._callback=t,i._eventEmitter.on("player.canplay",i._playerCanPlayHandler),i._eventEmitter.on("player.error",i._playerErrorHandler),new Promise(function(t,n){i._resolve=t,i._reject=n,i._eventEmitter.on("player.canplay",i._playerCanPlayHandler),i._eventEmitter.on("player.error",i._playerErrorHandler),i._mediaElement.setAttribute("src",e.mediaUrl),i._mediaElement.readyState===HTMLMediaElement.HAVE_NOTHING&&i._mediaElement.load()})},ey.prototype._reset=function(){this._eventEmitter.removeListener("player.canplay",this._playerCanPlayHandler),this._eventEmitter.removeListener("player.error",this._playerErrorHandler)},ey.prototype._playerCanPlayHandler=function(){this._reset(),this._resolve()},ey.prototype._playerErrorHandler=function(e){this._reset(),this._reject(e)},ev.prototype.setSource=function(e){return e.mediaUrl?new ey(this._eventEmitter,this._mediaElement).setSource(e):Promise.reject(Error("peaks.setSource(): options must contain a mediaUrl when using mediaElement"))},eb.prototype.init=function(){return this._adapter.init(this._peaks)},eb.prototype.destroy=function(){this._adapter.destroy()},eb.prototype.play=function(){return this._adapter.play()},eb.prototype.pause=function(){this._adapter.pause()},eb.prototype.isPlaying=function(){return this._adapter.isPlaying()},eb.prototype.isSeeking=function(){return this._adapter.isSeeking()},eb.prototype.getCurrentTime=function(){return this._adapter.getCurrentTime()},eb.prototype.getDuration=function(){return this._adapter.getDuration()},eb.prototype.seek=function(e){G(e)?this._adapter.seek(e):this._peaks._logger("peaks.player.seek(): parameter must be a valid time, in seconds")},eb.prototype.playSegment=function(e,t){var i=this;return e&&G(e.startTime)&&G(e.endTime)?(i._segment=e,i._loop=t,i.seek(e.startTime),i._peaks.once("player.playing",function(){i._playingSegment||(i._playingSegment=!0,window.requestAnimationFrame(i._playSegmentTimerCallback))}),i.play()):Promise.reject(Error("peaks.player.playSegment(): parameter must be a segment object"))},eb.prototype._playSegmentTimerCallback=function(){if(this.isPlaying()){if(this.getCurrentTime()>=this._segment.endTime)if(this._loop)this.seek(this._segment.startTime);else{this.pause(),this._peaks.emit("player.ended"),this._playingSegment=!1;return}}else{this._playingSegment=!1;return}window.requestAnimationFrame(this._playSegmentTimerCallback)},eb.prototype._setSource=function(e){return this._adapter.setSource(e)},ew.prototype.init=function(e){"zoomview"===this._options.view&&(this._label=new P.EY({x:2,y:0,text:this._options.point.labelText,textAlign:"left",fontFamily:this._options.fontFamily||"sans-serif",fontSize:this._options.fontSize||10,fontStyle:this._options.fontStyle||"normal",fill:"#000"})),this._handle=new M.r({x:-4.5,y:0,width:10,height:20,fill:this._options.color,visible:this._draggable}),this._line=new x.N({x:0,y:0,stroke:this._options.color,strokeWidth:1}),this._time=new P.EY({x:-24,y:0,text:this._options.layer.formatTime(this._options.point.time),fontFamily:this._options.fontFamily,fontSize:this._options.fontSize,fontStyle:this._options.fontStyle,fill:"#000",textAlign:"center"}),this._time.hide(),e.add(this._handle),e.add(this._line),this._label&&e.add(this._label),e.add(this._time),this.fitToView(),this.bindEventHandlers(e)},ew.prototype.bindEventHandlers=function(e){var t=this;t._handle.on("mouseover touchstart",function(){t._draggable&&(t._time.setX(-24-t._time.getW
2idth()),t._time.show())}),t._handle.on("mouseout touchend",function(){t._draggable&&t._time.hide()}),e.on("dragstart",function(){t._time.setX(-24-t._time.getWidth()),t._time.show()}),e.on("dragend",function(){t._time.hide()})},ew.prototype.fitToView=function(){var e=this._options.layer.getHeight();this._line.points([.5,0,.5,e]),this._label&&this._label.y(12),this._handle&&this._handle.y(e/2-10.5),this._time&&this._time.y(e/2-5)},ew.prototype.update=function(e){void 0!==e.time&&this._time&&this._time.setText(this._options.layer.formatTime(e.time)),void 0!==e.labelText&&this._label&&this._label.text(e.labelText),void 0!==e.color&&(this._handle&&this._handle.fill(e.color),this._line.stroke(e.color)),void 0!==e.editable&&(this._draggable=e.editable,this._handle.visible(this._draggable))},eS.prototype.init=function(e){var t=this._options.startMarker?-24:24,i=this._options.startMarker?this._options.segment.startTime:this._options.segment.endTime;this._label=new P.EY({x:t,y:0,text:this._options.layer.formatTime(i),fontFamily:this._options.fontFamily,fontSize:this._options.fontSize,fontStyle:this._options.fontStyle,fill:"#000",textAlign:"center",visible:this._editable}),this._label.hide(),this._handle=new M.r({x:-4.5,y:0,width:10,height:20,fill:this._options.color,stroke:this._options.color,strokeWidth:1,visible:this._editable}),this._line=new x.N({x:0,y:0,stroke:this._options.color,strokeWidth:1,visible:this._editable}),e.add(this._label),e.add(this._line),e.add(this._handle),this.fitToView(),this.bindEventHandlers(e)},eS.prototype.bindEventHandlers=function(e){var t=this,i=t._options.startMarker?-24:24;e.on("dragstart",function(){t._options.startMarker&&t._label.setX(i-t._label.getWidth()),t._label.show()}),e.on("dragend",function(){t._label.hide()}),t._handle.on("mouseover touchstart",function(){t._options.startMarker&&t._label.setX(i-t._label.getWidth()),t._label.show()}),t._handle.on("mouseout touchend",function(){t._label.hide()})},eS.prototype.fitToView=function(){var e=this._options.layer.getHeight();this._label.y(e/2-5),this._handle.y(e/2-10.5),this._line.points([.5,0,.5,e])},eS.prototype.update=function(e){void 0!==e.startTime&&this._options.startMarker&&this._label.text(this._options.layer.formatTime(e.startTime)),void 0===e.endTime||this._options.startMarker||this._label.text(this._options.layer.formatTime(e.endTime)),void 0!==e.editable&&(this._editable=e.editable,this._label.visible(this._editable),this._handle.visible(this._editable),this._line.visible(this._editable))},eC.prototype.addToStage=function(e){e.add(this._layer)},eC.prototype.showHighlight=function(e,t){this._highlightRect||this._createHighlightRect(e,t),this._update(e,t)},eC.prototype._update=function(e,t){this._startTime=e,this._endTime=t;var i=this._view.timeToPixels(e),n=this._view.timeToPixels(t);this._highlightRect.setAttrs({x:i,width:n-i})},eC.prototype._createHighlightRect=function(e,t){this._startTime=e,this._endTime=t;var i=this._view.timeToPixels(e),n=this._view.timeToPixels(t);this._highlightRect=new M.r({x:i,y:0,width:n-i,height:0,stroke:this._strokeColor,strokeWidth:1,fill:this._color,opacity:this._opacity,cornerRadius:this._cornerRadius}),this.fitToView(),this._layer.add(this._highlightRect)},eC.prototype.removeHighlight=function(){this._highlightRect&&(this._highlightRect.destroy(),this._highlightRect=null)},eC.prototype.updateHighlight=function(){this._highlightRect&&this._update(this._startTime,this._endTime)},eC.prototype.fitToView=function(){if(this._highlightRect){var e=this._view.getHeight(),t=X(this._offset,0,Math.floor(e/2));this._highlightRect.setAttrs({y:t,height:e-2*t})}},eI.prototype._bindDefaultEventHandlers=function(){var e=this;e._group.on("dragstart",function(t){e._onDragStart(t,e._point)}),e._group.on("dragmove",function(t){e._onDragMove(t,e._point)}),e._group.on("dragend",function(t){e._onDragEnd(t,e._point)}),e._group.on("mouseenter",function(t){e._onMouseEnter(t,e._point)}),e._group.on("mouseleave",function(t){e._onMouseLeave(t,e._point)})},eI.prototype.addToLayer=function(e){e.add(this._group)},eI.prototype.fitToView=function(){this._marker.fitToView()},eI.prototype.getPoint=function(){return this._point},eI.prototype.getX=function(){return this._group.getX()},eI.prototype.setX=function(e){this._group.setX(e)},eI.prototype.getWidth=function(){return this._group.getWidth()},eI.prototype.getAbsolutePosition=function(){return this._group.getAbsolutePosition()},eI.prototype.update=function(e){void 0!==e.editable&&this._group.draggable(e.editable),this._marker.update&&this._marker.update(e)},eI.prototype.destroy=function(){this._marker.destroy&&this._marker.destroy(),this._group.destroyChildren(),this._group.destroy()},ex.prototype.addToStage=function(e){e.add(this._layer)},ex.prototype.setListening=function(e){this._layer.listening(e)},ex.prototype.enableEditing=function(e){this._enableEditing=e},ex.prototype.getPointMarker=function(e){return this._pointMarkers[e.pid]},ex.prototype.formatTime=function(e){return this._view.formatTime(e)},ex.prototype._onPointsUpdate=function(e,t){var i=this._view.getStartTime(),n=this._view.getEndTime(),o=this.getPointMarker(e),s=e.isVisible(i,n);if(o&&!s)this._removePoint(e);else if(!o&&s)this._updatePoint(e);else if(o&&s){if(V(t,"time")){var r=this._view.timeToPixels(e.time)-this._view.getFrameOffset();o.setX(r)}o.update(t)}},ex.prototype._onPointsAdd=function(e){var t=this,i=t._view.getStartTime(),n=t._view.getEndTime();
2e.points.forEach(function(e){e.isVisible(i,n)&&t._updatePoint(e)})},ex.prototype._onPointsRemove=function(e){var t=this;e.points.forEach(function(e){t._removePoint(e)})},ex.prototype._onPointsRemoveAll=function(){this._layer.removeChildren(),this._pointMarkers={}},ex.prototype._createPointMarker=function(e){var t=this._enableEditing&&e.editable,i=this._view.getViewOptions(),n=this._peaks.options.createPointMarker({point:e,editable:t,color:e.color,fontFamily:i.fontFamily,fontSize:i.fontSize,fontStyle:i.fontStyle,layer:this,view:this._view.getName()});return new eI({point:e,draggable:t,marker:n,onDragStart:this._onPointMarkerDragStart,onDragMove:this._onPointMarkerDragMove,onDragEnd:this._onPointMarkerDragEnd,dragBoundFunc:this._pointMarkerDragBoundFunc,onMouseEnter:this._onPointMarkerMouseEnter,onMouseLeave:this._onPointMarkerMouseLeave})},ex.prototype.getHeight=function(){return this._view.getHeight()},ex.prototype._addPointMarker=function(e){var t=this._createPointMarker(e);return this._pointMarkers[e.pid]=t,t.addToLayer(this._layer),t},ex.prototype._onPointsDrag=function(e){this._updatePoint(e.point).update({time:e.point.time})},ex.prototype._onPointMarkerMouseEnter=function(e,t){this._peaks.emit("points.mouseenter",{point:t,evt:e.evt})},ex.prototype._onPointMarkerMouseLeave=function(e,t){this._peaks.emit("points.mouseleave",{point:t,evt:e.evt})},ex.prototype._onPointMarkerDragStart=function(e,t){this._dragPointMarker=this.getPointMarker(t),this._peaks.emit("points.dragstart",{point:t,evt:e.evt})},ex.prototype._onPointMarkerDragMove=function(e,t){var i=this._pointMarkers[t.pid],n=i.getX()+i.getWidth();t._setTime(this._view.pixelOffsetToTime(n)),this._peaks.emit("points.dragmove",{point:t,evt:e.evt})},ex.prototype._onPointMarkerDragEnd=function(e,t){this._dragPointMarker=null,this._peaks.emit("points.dragend",{point:t,evt:e.evt})},ex.prototype._pointMarkerDragBoundFunc=function(e){return{x:X(e.x,0,this._view.getWidth()),y:this._dragPointMarker.getAbsolutePosition().y}},ex.prototype.updatePoints=function(e,t){this._peaks.points.find(e,t).forEach(this._updatePoint.bind(this)),this._removeInvisiblePoints(e,t)},ex.prototype._updatePoint=function(e){var t=this.getPointMarker(e);t||(t=this._addPointMarker(e));var i=this._view.timeToPixels(e.time)-this._view.getFrameOffset();return t.setX(i),t},ex.prototype._removeInvisiblePoints=function(e,t){for(var i in this._pointMarkers)if(V(this._pointMarkers,i)){var n=this._pointMarkers[i].getPoint();n.isVisible(e,t)||this._removePoint(n)}},ex.prototype._removePoint=function(e){var t=this.getPointMarker(e);t&&(t.destroy(),delete this._pointMarkers[e.pid])},ex.prototype.setVisible=function(e){this._layer.setVisible(e)},ex.prototype.destroy=function(){this._peaks.off("points.update",this._onPointsUpdate),this._peaks.off("points.add",this._onPointsAdd),this._peaks.off("points.remove",this._onPointsRemove),this._peaks.off("points.remove_all",this._onPointsRemoveAll),this._peaks.off("points.dragstart",this._onPointsDrag),this._peaks.off("points.dragmove",this._onPointsDrag),this._peaks.off("points.dragend",this._onPointsDrag)},ex.prototype.fitToView=function(){for(var e in this._pointMarkers)V(this._pointMarkers,e)&&this._pointMarkers[e].fitToView()},ex.prototype.draw=function(){this._layer.draw()},eM.prototype.addToStage=function(e){e.add(this._playheadLayer)},eM.prototype.zoomLevelChanged=function(){var e=this._view.timeToPixels(1);if(this._useAnimation=e>=5,this._useAnimation)this._player.isPlaying()&&!this._playheadLineAnimation&&this._start();else if(this._playheadLineAnimation){var t=this._player.getCurrentTime();this.stop(t)}},eM.prototype.fitToView=function(){var e=this._view.getHeight();this._playheadLine.points([.5,0,.5,e]),this._playheadText&&this._playheadText.y(12)},eM.prototype._createPlayhead=function(){this._playheadLine=new x.N({stroke:this._playheadColor,strokeWidth:this._playheadWidth}),this._playheadGroup=new I.Group({x:0,y:0}),this._playheadGroup.add(this._playheadLine),this._playheadLayer.add(this._playheadGroup)},eM.prototype._createPlayheadText=function(){var e=this,t=e._player.getCurrentTime(),i=e._view.formatTime(t);e._playheadText=new P.EY({x:0,y:0,padding:e._playheadPadding,text:i,fontSize:e._playheadFontSize,fontFamily:e._playheadFontFamily,fontStyle:e._playheadFontStyle,fill:e._playheadTextColor,align:"right",sceneFunc:function(t,i){var n=i.width(),o=i.height()+2*e._playheadPadding;
2t.fillStyle=e._playheadBackgroundColor,t.fillRect(0,-e._playheadPadding,n,o),i._sceneFunc(t)}}),e._playheadGroup.add(e._playheadText)},eM.prototype.updatePlayheadTime=function(e){this._syncPlayhead(e),this._player.isPlaying()&&this._start()},eM.prototype._syncPlayhead=function(e){var t=this._view.timeToPixels(e),i=this._view.getFrameOffset(),n=this._view.getWidth();if(this._playheadPixel=t,t>=i&&t<=i+n){var o=this._playheadPixel-i;if(this._playheadVisible||(this._playheadVisible=!0,this._playheadGroup.show()),this._playheadGroup.setX(o),this._playheadText){var s=this._view.formatTime(e),r=this._playheadText.width();this._playheadText.setText(s),r+o>n-2?this._playheadText.setX(-r):r+o<n&&this._playheadText.setX(0)}}else this._playheadVisible&&(this._playheadVisible=!1,this._playheadGroup.hide());this._view.playheadPosChanged&&this._view.playheadPosChanged(e)},eM.prototype._start=function(){var e=this;if(e._playheadLineAnimation&&(e._playheadLineAnimation.stop(),e._playheadLineAnimation=null),e._useAnimation){var t=null;e._playheadLineAnimation=new c(function(){var i=e._player.getCurrentTime(),n=e._view.timeToPixels(i);
2n!==t&&(e._syncPlayhead(i),t=n)},e._playheadLayer),e._playheadLineAnimation.start()}},eM.prototype.stop=function(e){this._playheadLineAnimation&&(this._playheadLineAnimation.stop(),this._playheadLineAnimation=null),this._syncPlayhead(e)},eM.prototype.getPlayheadPixel=function(){return this._playheadPixel},eM.prototype.showPlayheadTime=function(e){e?this._playheadText||(this._createPlayheadText(this._playheadTextColor,this._playheadBackgroundColor,this._playheadPadding),this.fitToView()):this._playheadText&&(this._playheadText.remove(),this._playheadText.destroy(),this._playheadText=null)},eM.prototype.updatePlayheadText=function(){if(this._playheadText){var e=this._player.getCurrentTime(),t=this._view.formatTime(e);this._playheadText.setText(t)}},eM.prototype.destroy=function(){this._playheadLineAnimation&&(this._playheadLineAnimation.stop(),this._playheadLineAnimation=null)},eP.prototype.init=function(e){var t=this._options.startMarker?-24:24,i=this._options.startMarker?this._options.segment.startTime:this._options.segment.endTime;this._label=new P.EY({x:t,y:0,text:this._options.layer.formatTime(i),fontFamily:this._options.fontFamily,fontSize:this._options.fontSize,fontStyle:this._options.fontStyle,fill:"#000",textAlign:"center",visible:!1}),this._handle=new M.r({x:-4.5,y:0,width:10,height:20}),e.add(this._label),e.add(this._handle),this.fitToView(),this.bindEventHandlers(e)},eP.prototype.bindEventHandlers=function(e){var t=this,i=t._options.startMarker?-24:24;e.on("dragstart",function(){t._options.startMarker&&t._label.setX(i-t._label.getWidth()),t._label.show()}),e.on("dragend",function(){t._label.hide()}),t._handle.on("mouseover touchstart",function(){t._options.startMarker&&t._label.setX(i-t._label.getWidth()),t._label.show(),document.body.style.cursor="ew-resize"}),t._handle.on("mouseout touchend",function(){t._label.hide(),document.body.style.cursor="default"})},eP.prototype.fitToView=function(){var e=this._options.layer.getHeight(),t=this._options.segmentOptions.overlayOffset,i=X(0,e-2*t);this._label.y(e/2-5),this._handle.y(t),this._handle.height(i)},eP.prototype.update=function(e){void 0!==e.startTime&&this._options.startMarker&&this._label.text(this._options.layer.formatTime(e.startTime)),void 0===e.endTime||this._options.startMarker||this._label.text(this._options.layer.formatTime(e.endTime))},eE.prototype._bindDefaultEventHandlers=function(){var e=this;e._group.on("click",function(t){e._onClick(e,t)}),e._group.on("dragstart",function(t){e._onDragStart(e,t)}),e._group.on("dragmove",function(t){e._onDragMove(e,t)}),e._group.on("dragend",function(t){e._onDragEnd(e,t)})},eE.prototype.addToLayer=function(e){e.add(this._group)},eE.prototype.moveToTop=function(){this._group.moveToTop()},eE.prototype.fitToView=function(){this._marker.fitToView()},eE.prototype.getSegment=function(){return this._segment},eE.prototype.getX=function(){return this._group.getX()},eE.prototype.setX=function(e){this._group.setX(e)},eE.prototype.getWidth=function(){return this._group.getWidth()},eE.prototype.getAbsolutePosition=function(){return this._group.getAbsolutePosition()},eE.prototype.isStartMarker=function(){return this._startMarker},eE.prototype.update=function(e){void 0!==e.editable&&(this._group.visible(e.editable),this._group.draggable(e.editable)),this._marker.update&&this._marker.update(e)},eE.prototype.destroy=function(){this._marker.destroy&&this._marker.destroy(),this._group.destroyChildren(),this._group.destroy()},eE.prototype.startDrag=function(){this._group.startDrag()},eE.prototype.stopDrag=function(){this._group.stopDrag()},eD.prototype.getX=function(){return this._shape.getX()},eD.prototype.setX=function(e){return this._shape.setX(e)},eD.prototype.setSegment=function(e){this._segment=e},eD.prototype.setWaveformColor=function(e){if(Z(e))this._shape.fill(e),this._shape.fillLinearGradientStartPointY(null),this._shape.fillLinearGradientEndPointY(null),this._shape.fillLinearGradientColorStops(null);else if(K(e)){this._shape.fill(null);var t=this._view._height*(e.linearGradientStart/100),i=this._view._height*(e.linearGradientEnd/100);
2this._shape.fillLinearGradientStartPointY(t),this._shape.fillLinearGradientEndPointY(i),this._shape.fillLinearGradientColorStops([0,e.linearGradientColorStops[0],1,e.linearGradientColorStops[1]])}else throw TypeError("Unknown type for color property")},eD.prototype.fitToView=function(){this.setWaveformColor(this._color)},eD.prototype._sceneFunc=function(e){var t=this._view.getFrameOffset(),i=this._view.getWidth(),n=this._view.getHeight();this._drawWaveform(e,this._view.getWaveformData(),t,this._segment?this._view.timeToPixels(this._segment.startTime):t,this._segment?this._view.timeToPixels(this._segment.endTime):t+i,i,n)},eD.prototype._drawWaveform=function(e,t,i,n,o,s,r){n<i&&(n=i);var a=i+s;o>a&&(o=a),o>t.length-1&&(o=t.length-1);for(var h=t.channels,l=0,d=Math.floor(r/h),_=0;_<h;_++)_===h-1&&(d=r-(h-1)*d),this._drawChannel(e,t.channel(_),i,n,o,l,d),l+=d},eD.prototype._drawChannel=function(e,t,i,n,o,s,r){var a,h,l,d,_=this._view.getAmplitudeScale();for(e.beginPath(),a=n;a<=o;a++)h=t.min_sample(a),l=a-i+.5,d=s+eD.scaleY(h,r,_)+.5,e.lineTo(l,d);for(a=o;a>=n;a--)h=t.max_sample(a),l=a-i+.5,d=s+eD.scaleY(h,r,_)+1,e.lineTo(l,d);e.closePath(),e.fillShape(this._shape)},eD.prototype.addToLayer=function(e){e.add(this._shape)},eD.prototype.destroy=function(){this._shape.destroy(),this._shape=null},eD.prototype.on=function(e,t){this._shape.on(e,t)},eD.prototype.off=function(e,t){this._shape.off(e,t)},eD.scaleY=function(e,t,i){return X(Math.floor(-(t-1)*(e*i+128)/255+(t-1)),0,t-1)},eL.prototype._createMarkers=function(){var e,t,i,n=this._layer.isEditingEnabled()&&this._segment.editable,o=this._view.getViewOptions(),s=o.segmentOptions;this._segment.markers?e=this._peaks.options.createSegmentMarker:this._segment.overlay&&(e=eW),e&&(t=e({segment:this._segment,editable:n,startMarker:!0,color:s.startMarkerColor,fontFamily:o.fontFamily,fontSize:o.fontSize,fontStyle:o.fontStyle,layer:this._layer,view:this._view.getName(),segmentOptions:this._view.getViewOptions().segmentOptions})),t&&(this._startMarker=new eE({segment:this._segment,segmentShape:this,editable:n,startMarker:!0,marker:t,onClick:this._onSegmentMarkerClick,onDragStart:this._onSegmentMarkerDragStart,onDragMove:this._onSegmentMarkerDragMove,onDragEnd:this._onSegmentMarkerDragEnd,dragBoundFunc:this._segmentMarkerDragBoundFunc})),e&&(i=e({segment:this._segment,editable:n,startMarker:!1,color:s.endMarkerColor,fontFamily:o.fontFamily,fontSize:o.fontSize,fontStyle:o.fontStyle,layer:this._layer,view:this._view.getName(),segmentOptions:this._view.getViewOptions().segmentOptions})),i&&(this._endMarker=new eE({segment:this._segment,segmentShape:this,editable:n,startMarker:!1,marker:i,onClick:this._onSegmentMarkerClick,onDragStart:this._onSegmentMarkerDragStart,onDragMove:this._onSegmentMarkerDragMove,onDragEnd:this._onSegmentMarkerDragEnd,dragBoundFunc:this._segmentMarkerDragBoundFunc}))},eL.prototype._dragBoundFunc=function(e){return{x:e.x,y:0}},eL.prototype.update=function(e){var t,i=this._view.timeToPixelOffset(this._segment.startTime),n=this._view.timeToPixelOffset(this._segment.endTime),o=n-i;(t=this.getStartMarker())&&(t.setX(i-t.getWidth()),e&&t.update(e)),(t=this.getEndMarker())&&(t.setX(n),e&&t.update(e)),this._color=this._segment.color,this._borderColor=this._segment.bordercolor,this._label&&this._label.text(this._segment.labelText),this._overlayText&&this._overlayText.text(this._segment.labelText),this._segment.overlay?(this._color&&this._overlayRect.fill(this._color),this._borderColor&&this._overlayRect.stroke(this._borderColor)):this._waveformShape.setWaveformColor(this._segment.color),!this._dragging&&this._overlay&&(this._overlay.setAttrs({x:i,width:o,clipWidth:o<1?1:o}),this._overlayRect.setAttrs({x:0,width:o}),this._overlayText&&this._overlayText.setAttrs({width:o}))},eL.prototype.getSegment=function(){return this._segment},eL.prototype.getStartMarker=function(){return this._startMarker},eL.prototype.getEndMarker=function(){return this._endMarker},eL.prototype.addToLayer=function(e){this._waveformShape&&this._waveformShape.addToLayer(e),this._label&&e.add(this._label),this._overlay&&e.add(this._overlay),this._startMarker&&this._startMarker.addToLayer(e),this._endMarker&&this._endMarker.addToLayer(e)},eL.prototype.isDragging=function(){return this._dragging},eL.prototype._onMouseEnter=function(e){this._label&&(this._label.moveToTop(),this._label.show()),this._peaks.emit("segments.mouseenter",{segment:this._segment,evt:e.evt})},eL.prototype._onMouseLeave=function(e){this._label&&this._label.hide(),this._peaks.emit("segments.mouseleave",{segment:this._segment,evt:e.evt})},eL.prototype._onMouseDown=function(e){this._peaks.emit("segments.mousedown",{segment:this._segment,evt:e.evt})},eL.prototype._onMouseUp=function(e){this._peaks.emit("segments.mouseup",{segment:this._segment,evt:e.evt})},eL.prototype.segmentClicked=function(e,t){this._moveToTop(),this._peaks.emit("segments."+e,t)},eL.prototype._moveToTop=function(){this._overlay.moveToTop(),this._layer.moveSegmentMarkersToTop()},eL.prototype.enableSegmentDragging=function(e){this._segment.editable&&(!this._draggable&&e?(this._overlay.on("dragstart",this._onSegmentDragStart),this._overlay.on("dragmove",this._onSegmentDragMove),this._overlay.on("dragend",this._onSegmentDragEnd)):this._draggable&&!e&&(this._overlay.off("dragstart",this._onSegmentDragStart),this._overlay.off("dragmove",this._onSegmentDragMove),this._overlay.off("dragend",this._onSegmentDragEnd)),this._overlay.draggable(e),this._draggable=e)}
2,eL.prototype._setPreviousAndNextSegments=function(){"overlap"!==this._view.getSegmentDragMode()?(this._nextSegment=this._peaks.segments.findNextSegment(this._segment),this._previousSegment=this._peaks.segments.findPreviousSegment(this._segment)):(this._nextSegment=null,this._previousSegment=null)},eL.prototype._onSegmentDragStart=function(e){this._setPreviousAndNextSegments(),this._dragging=!0,this._dragStartX=this._overlay.getX(),this._dragStartTime=this._segment.startTime,this._dragEndTime=this._segment.endTime,this._peaks.emit("segments.dragstart",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt})},eL.prototype._onSegmentDragMove=function(e){var t,i=this._overlay.getX()-this._dragStartX,n=this._view.pixelsToTime(i),o=this._dragStartTime+n,s=this._dragEndTime+n,r=this._segment.endTime-this._segment.startTime,a=this._view.getMinSegmentDragWidth(),h=this._view.pixelsToTime(a),l=!1,d=!1;if(o<0&&(o=0,s=r,this._overlay.setX(this._view.timeToPixelOffset(o))),this._previousSegment){var _=this._view.timeToPixelOffset(this._previousSegment.endTime);if(o<this._previousSegment.endTime)if("no-overlap"!==(t=this._view.getSegmentDragMode())&&("compress"!==t||this._previousSegment.editable)){if("compress"===t){var u=o,p=this._previousSegment.startTime+h;u<p&&(u=p,_=this._view.timeToPixelOffset(u),this._overlay.setX(_),s=(o=u)+r),this._previousSegment.update({endTime:u}),l=!0}}else s=(o=this._previousSegment.endTime)+r,this._overlay.setX(_)}if(this._nextSegment){var m=this._view.timeToPixelOffset(this._nextSegment.startTime);if(s>this._nextSegment.startTime)if("no-overlap"!==(t=this._view.getSegmentDragMode())&&("compress"!==t||this._nextSegment.editable)){if("compress"===t){var g=s,f=this._nextSegment.endTime-h;g>f&&(g=f,m=this._view.timeToPixelOffset(g),this._overlay.setX(m-this._overlay.getWidth()),o=(s=g)-r),this._nextSegment.update({startTime:g}),d=!0}}else o=(s=this._nextSegment.startTime)-r,this._overlay.setX(m-this._overlay.getWidth())}this._segment._setStartTime(o),this._segment._setEndTime(s),this._peaks.emit("segments.dragged",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt}),l?this._peaks.emit("segments.dragged",{segment:this._previousSegment,marker:!1,startMarker:!1,evt:e.evt}):d&&this._peaks.emit("segments.dragged",{segment:this._nextSegment,marker:!1,startMarker:!1,evt:e.evt})},eL.prototype._onSegmentDragEnd=function(e){this._dragging=!1,this._peaks.emit("segments.dragend",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt})},eL.prototype.moveMarkersToTop=function(){this._startMarker&&this._startMarker.moveToTop(),this._endMarker&&this._endMarker.moveToTop()},eL.prototype.startDrag=function(){this._endMarker&&this._endMarker.startDrag()},eL.prototype.stopDrag=function(){this._endMarker&&this._endMarker.stopDrag()},eL.prototype._onSegmentMarkerDragStart=function(e,t){this._setPreviousAndNextSegments(),this._moveToTop(),this._startMarkerX=this._startMarker.getX(),this._endMarkerX=this._endMarker.getX(),this._peaks.emit("segments.dragstart",{segment:this._segment,marker:!0,startMarker:e.isStartMarker(),evt:t.evt})},eL.prototype._onSegmentMarkerDragMove=function(e,t){e.isStartMarker()?(this._segmentStartMarkerDragMove(e,t),e.update({startTime:this._segment.startTime})):(this._segmentEndMarkerDragMove(e,t),e.update({endTime:this._segment.endTime}))},eL.prototype._segmentStartMarkerDragMove=function(e,t){var i,n=this._view.getWidth(),o=this._startMarker.getX(),s=this._endMarker.getX(),r=this._view.pixelsToTime(50),a=this._view.getMinSegmentDragWidth(),h=this._endMarker.getX()-a;h>n&&(h=n);var l=!1,d=!1;if(this._previousSegment&&(l=(i=this._view.timeToPixelOffset(this._previousSegment.endTime))>=0),o>h)e.setX(h),this._overlay.clipWidth(h-s),0===a&&h<n?this._segment._setStartTime(this._segment.endTime):this._segment._setStartTime(this._view.pixelOffsetToTime(h));else if(this._previousSegment&&l){var _=this._view.getSegmentDragMode(),u="no-overlap"===_||"compress"===_&&!this._previousSegment.editable,p="compress"===_&&this._previousSegment.editable;if(o<=i){if(u)e.setX(i),this._overlay.clipWidth(i-s),this._segment._setStartTime(this._previousSegment.endTime);else if(p){var m=eB(this._previousSegment);m<r&&(r=m);
2var g=this._view.timeToPixelOffset(this._previousSegment.startTime+r);o<g&&(o=g),e.setX(o),this._overlay.clipWidth(s-o),this._segment._setStartTime(this._view.pixelOffsetToTime(o)),this._previousSegment.update({endTime:this._view.pixelOffsetToTime(o)}),d=!0}}else o<0&&(o=0),e.setX(o),this._overlay.clipWidth(s-o),this._segment._setStartTime(this._view.pixelOffsetToTime(o))}else o<0&&(o=0),e.setX(o),this._overlay.clipWidth(s-o),this._segment._setStartTime(this._view.pixelOffsetToTime(o));this._peaks.emit("segments.dragged",{segment:this._segment,marker:!0,startMarker:!0,evt:t.evt}),d&&this._peaks.emit("segments.dragged",{segment:this._previousSegment,marker:!0,startMarker:!1,evt:t.evt})},eL.prototype._segmentEndMarkerDragMove=function(e,t){var i,n=this._view.getWidth(),o=this._startMarker.getX(),s=this._endMarker.getX(),r=this._view.pixelsToTime(50),a=this._view.getMinSegmentDragWidth(),h=this._startMarker.getX()+a;h<0&&(h=0);var l=!1,d=!1;if(this._nextSegment&&(l=(i=this._view.timeToPixelOffset(this._nextSegment.startTime))<n),s<h)e.setX(h),this._overlay.clipWidth(h-o),0===a&&h>0?this._segment._setEndTime(this._segment.startTime):this._segment._setEndTime(this._view.pixelOffsetToTime(h));else if(this._nextSegment&&l){var _=this._view.getSegmentDragMode(),u="no-overlap"===_||"compress"===_&&!this._nextSegment.editable,p="compress"===_&&this._nextSegment.editable;if(s>=i){if(u)e.setX(i),this._overlay.clipWidth(i-o),this._segment._setEndTime(this._nextSegment.startTime);else if(p){var m=eB(this._nextSegment);m<r&&(r=m);var g=this._view.timeToPixelOffset(this._nextSegment.endTime-r);s>g&&(s=g),e.setX(s),this._overlay.clipWidth(s-o),this._segment._setEndTime(this._view.pixelOffsetToTime(s)),this._nextSegment.update({startTime:this._view.pixelOffsetToTime(s)}),d=!0}}else s>n&&(s=n),e.setX(s),this._overlay.clipWidth(s-o),this._segment._setEndTime(this._view.pixelOffsetToTime(s))}else s>n&&(s=n),e.setX(s),this._overlay.clipWidth(s-o),this._segment._setEndTime(this._view.pixelOffsetToTime(s));this._peaks.emit("segments.dragged",{segment:this._segment,marker:!0,startMarker:!1,evt:t.evt}),d&&this._peaks.emit("segments.dragged",{segment:this._nextSegment,marker:!0,startMarker:!0,evt:t.evt})},eL.prototype._onSegmentMarkerDragEnd=function(e,t){this._nextSegment=null,this._previousSegment=null;var i=e.isStartMarker();this._peaks.emit("segments.dragend",{segment:this._segment,marker:!0,startMarker:i,evt:t.evt})},eL.prototype._segmentMarkerDragBoundFunc=function(e,t){return{x:t.x,y:e.getAbsolutePosition().y}},eL.prototype._onSegmentMarkerClick=function(){this._moveToTop()},eL.prototype.fitToView=function(){if(this._startMarker&&this._startMarker.fitToView(),this._endMarker&&this._endMarker.fitToView(),this._overlay){var e=this._view.getHeight(),t=X(0,e-2*this._overlayOffset);this._overlay.setAttrs({y:0,height:e,clipY:this._overlayOffset,clipHeight:t}),this._overlayRect.setAttrs({y:this._overlayOffset,height:t}),this._overlayText&&this._overlayText.setAttrs({y:this._overlayOffset,height:t})}},eL.prototype.destroy=function(){this._waveformShape&&this._waveformShape.destroy(),this._label&&this._label.destroy(),this._startMarker&&this._startMarker.destroy(),this._endMarker&&this._endMarker.destroy(),this._overlay&&this._overlay.destroy()},eF.prototype.addToStage=function(e){e.add(this._layer)},eF.prototype.setListening=function(e){this._layer.listening(e)},eF.prototype.enableEditing=function(e){this._enableEditing=e},eF.prototype.isEditingEnabled=function(){return this._enableEditing},eF.prototype.enableSegmentDragging=function(e){for(var t in this._segmentShapes)V(this._segmentShapes,t)&&this._segmentShapes[t].enableSegmentDragging(e)},eF.prototype.getSegmentShape=function(e){return this._segmentShapes[e.pid]},eF.prototype.formatTime=function(e){return this._view.formatTime(e)},eF.prototype._onSegmentsUpdate=function(e,t){var i=this._view.getStartTime(),n=this._view.getEndTime(),o=this.getSegmentShape(e),s=e.isVisible(i,n);o&&!s?o.isDragging()||this._removeSegment(e):!o&&s?o=this._updateSegment(e):o&&s&&o.update(t)},eF.prototype._onSegmentsAdd=function(e){var t=this,i=t._view.getStartTime(),n=t._view.getEndTime();
2e.segments.forEach(function(e){e.isVisible(i,n)&&t._addSegmentShape(e).update()}),this.moveSegmentMarkersToTop()},eF.prototype._onSegmentsRemove=function(e){var t=this;e.segments.forEach(function(e){t._removeSegment(e)})},eF.prototype._onSegmentsRemoveAll=function(){this._layer.removeChildren(),this._segmentShapes={}},eF.prototype._onSegmentsDragged=function(e){this._updateSegment(e.segment)},eF.prototype._createSegmentShape=function(e){return new eL(e,this._peaks,this,this._view)},eF.prototype._addSegmentShape=function(e){var t=this._createSegmentShape(e);return t.addToLayer(this._layer),this._segmentShapes[e.pid]=t,t},eF.prototype.updateSegments=function(e,t){this._peaks.segments.find(e,t).forEach(this._updateSegment.bind(this)),this._removeInvisibleSegments(e,t)},eF.prototype._updateSegment=function(e){var t=this.getSegmentShape(e);t||(t=this._addSegmentShape(e)),t.update()},eF.prototype._removeInvisibleSegments=function(e,t){for(var i in this._segmentShapes)if(V(this._segmentShapes,i)){var n=this._segmentShapes[i].getSegment();n.isVisible(e,t)||this._removeSegment(n)}},eF.prototype._removeSegment=function(e){var t=this._segmentShapes[e.pid];t&&(t.destroy(),delete this._segmentShapes[e.pid])},eF.prototype.moveSegmentMarkersToTop=function(){for(var e in this._segmentShapes)V(this._segmentShapes,e)&&this._segmentShapes[e].moveMarkersToTop()},eF.prototype.setVisible=function(e){this._layer.setVisible(e)},eF.prototype.segmentClicked=function(e,t){var i=this._segmentShapes[t.segment.pid];i&&i.segmentClicked(e,t)},eF.prototype.destroy=function(){this._peaks.off("segments.update",this._onSegmentsUpdate),this._peaks.off("segments.add",this._onSegmentsAdd),this._peaks.off("segments.remove",this._onSegmentsRemove),this._peaks.off("segments.remove_all",this._onSegmentsRemoveAll),this._peaks.off("segments.dragged",this._onSegmentsDragged)},eF.prototype.fitToView=function(){for(var e in this._segmentShapes)V(this._segmentShapes,e)&&this._segmentShapes[e].fitToView()},eF.prototype.draw=function(){this._layer.draw()},eF.prototype.getHeight=function(){return this._layer.getHeight()},eO._buildFontString=function(e,t,i){return t||(t=11),e||(e="sans-serif"),i||(i="normal"),i+" "+t+"px "+e},eO.prototype.addToLayer=function(e){e.add(this._axisShape)},eO.prototype.showAxisLabels=function(e,t){this._showAxisLabels=e,t&&(V(t,"topMarkerHeight")&&(this._axisTopMarkerHeight=t.topMarkerHeight),V(t,"bottomMarkerHeight")&&(this._axisBottomMarkerHeight=t.bottomMarkerHeight))},eO.prototype.setAxisLabelColor=function(e){this._axisLabelColor=e},eO.prototype.setAxisGridlineColor=function(e){this._axisGridlineColor=e},eO.prototype._getAxisLabelScale=function(e){for(var t,i=1,n=[1,2,5,10,20,30],o=0;;)if(t=i*n[o],60>e.timeToPixels(t))++o===n.length&&(i*=60,o=0);else break;return t},eO.prototype._drawAxis=function(e,t){var i=t.getStartTime(),n=this._getAxisLabelScale(t),o=function(e,t){if(0===t)return 0;var i=1;return e<0&&(i=-1,e=-e),i*((Math.ceil(e)+t-1)/t|0)*t}(i,n),s=t.timeToPixels(o-i);e.setAttr("strokeStyle",this._axisGridlineColor),e.setAttr("lineWidth",1),e.setAttr("font",this._axisLabelFont),e.setAttr("fillStyle",this._axisLabelColor),e.setAttr("textAlign","left"),e.setAttr("textBaseline","bottom");for(var r=t.getWidth(),a=t.getHeight(),h=o;;){var l=s+t.timeToPixels(h-o);if(l>=r)break;
2if(this._axisTopMarkerHeight>0&&(e.beginPath(),e.moveTo(l+.5,0),e.lineTo(l+.5,0+this._axisTopMarkerHeight),e.stroke()),this._axisBottomMarkerHeight>0&&(e.beginPath(),e.moveTo(l+.5,a),e.lineTo(l+.5,a-this._axisBottomMarkerHeight),e.stroke()),this._showAxisLabels){var d=this._formatAxisTime(h),_=l-e.measureText(d).width/2,u=a-1-this._axisBottomMarkerHeight;_>=0&&e.fillText(d,_,u)}h+=n}},eX.prototype.getViewOptions=function(){return this._viewOptions},eX.prototype.getWaveformData=function(){return this._data},eX.prototype.setWaveformData=function(e){this._data=e},eX.prototype.timeToPixels=function(e){return Math.floor(e*this._data.sample_rate/this._data.scale)},eX.prototype.pixelsToTime=function(e){return e*this._data.scale/this._data.sample_rate},eX.prototype.pixelOffsetToTime=function(e){return(this._frameOffset+e)*this._data.scale/this._data.sample_rate},eX.prototype.timeToPixelOffset=function(e){return Math.floor(e*this._data.sample_rate/this._data.scale)-this._frameOffset},eX.prototype.getFrameOffset=function(){return this._frameOffset},eX.prototype.getWidth=function(){return this._width},eX.prototype.getHeight=function(){return this._height},eX.prototype.getStartTime=function(){return this.pixelOffsetToTime(0)},eX.prototype.getEndTime=function(){return this.pixelOffsetToTime(this._width)},eX.prototype._getDuration=function(){return this._peaks.player.getDuration()},eX.prototype._createWaveform=function(){this._waveformLayer=new I.Layer({listening:!1}),this._createWaveformShapes(),this._stage.add(this._waveformLayer)},eX.prototype._createWaveformShapes=function(){if(this._waveformShape||(this._waveformShape=new eD({color:this._waveformColor,view:this}),this._waveformShape.addToLayer(this._waveformLayer)),this._playedWaveformColor&&!this._playedWaveformShape){var e=this._peaks.player.getCurrentTime();this._playedSegment={startTime:0,endTime:e},this._unplayedSegment={startTime:e,endTime:this._getDuration()},this._waveformShape.setSegment(this._unplayedSegment),this._playedWaveformShape=new eD({color:this._playedWaveformColor,view:this,segment:this._playedSegment}),this._playedWaveformShape.addToLayer(this._waveformLayer)}},eX.prototype.setWaveformColor=function(e){this._waveformColor=e,this._waveformShape.setWaveformColor(e)},eX.prototype.setPlayedWaveformColor=function(e){this._playedWaveformColor=e,e?(this._playedWaveformShape||this._createWaveformShapes(),this._playedWaveformShape.setWaveformColor(e)):this._playedWaveformShape&&this._destroyPlayedWaveformShape()},eX.prototype._destroyPlayedWaveformShape=function(){this._waveformShape.setSegment(null),this._playedWaveformShape.destroy(),this._playedWaveformShape=null,this._playedSegment=null,this._unplayedSegment=null},eX.prototype._createAxisLabels=function(){this._axisLayer=new I.Layer({listening:!1}),this._axis=new eO(this,this._viewOptions),this._axis.addToLayer(this._axisLayer),this._stage.add(this._axisLayer)},eX.prototype.showAxisLabels=function(e,t){this._axis.showAxisLabels(e,t),this._axisLayer.draw()},eX.prototype.setAxisLabelColor=function(e){this._axis.setAxisLabelColor(e),this._axisLayer.draw()},eX.prototype.setAxisGridlineColor=function(e){this._axis.setAxisGridlineColor(e),this._axisLayer.draw()},eX.prototype.showPlayheadTime=function(e){this._playheadLayer.showPlayheadTime(e)},eX.prototype.setTimeLabelPrecision=function(e){this._timeLabelPrecision=e,this._playheadLayer.updatePlayheadText()},eX.prototype.formatTime=function(e){return this._formatPlayheadTime(e)},eX.prototype.setAmplitudeScale=function(e){if(!R(e)||"number"!=typeof e||e!=e||1/0===e||-1/0===e)throw Error("view.setAmplitudeScale(): Scale must be a valid number");this._amplitudeScale=e,this.drawWaveformLayer(),this._segmentsLayer&&this._segmentsLayer.draw()},eX.prototype.getAmplitudeScale=function(){return this._amplitudeScale},eX.prototype.enableSeek=function(e){this._enableSeek=e},eX.prototype.isSeekEnabled=function(){return this._enableSeek},eX.prototype._onClick=function(e){this._clickHandler(e,"click")},eX.prototype._onDblClick=function(e){this._clickHandler(e,"dblclick")},eX.prototype._onContextMenu=function(e){this._clickHandler(e,"contextmenu")},eX.prototype._clickHandler=function(e,t){var i=e.evt.offsetX;i<0&&(i=0);var n=!0;if(e.target!==this._stage){var o=j(e.target);if(o){if("point-marker"===o.attrs.name){var s=o.getAttr("point");s&&this._peaks.emit("points."+t,{point:s,evt:e.evt,preventViewEvent:function(){n=!1}})}else if("segment-overlay"===o.attrs.name){var r=o.getAttr("segment");
2if(r){var a={segment:r,evt:e.evt,preventViewEvent:function(){n=!1}};this._segmentsLayer&&this._segmentsLayer.segmentClicked(t,a)}}}}if(n){var h=this.pixelOffsetToTime(i),l=this.getName();this._peaks.emit(l+"."+t,{time:h,evt:e.evt})}},eX.prototype.updatePlayheadTime=function(e){this._playheadLayer.updatePlayheadTime(e)},eX.prototype.playheadPosChanged=function(e){this._playedWaveformShape&&(this._playedSegment.endTime=e,this._unplayedSegment.startTime=e,this.drawWaveformLayer())},eX.prototype.drawWaveformLayer=function(){this._waveformLayer.draw()},eX.prototype.enableMarkerEditing=function(e){this._segmentsLayer&&this._segmentsLayer.enableEditing(e),this._pointsLayer&&this._pointsLayer.enableEditing(e)},eX.prototype.dragSeek=function(e){this._segmentsLayer&&this._segmentsLayer.setListening(!e),this._pointsLayer&&this._pointsLayer.setListening(!e)},eX.prototype.fitToContainer=function(){if(0!==this._container.clientWidth||0!==this._container.clientHeight){var e=!1;this._container.clientWidth!==this._width&&(this._width=this._container.clientWidth,this._stage.setWidth(this._width),e=this.containerWidthChange());var t=!1;this._container.clientHeight!==this._height&&(this._height=this._container.clientHeight,this._stage.setHeight(this._height),this._waveformShape.fitToView(),this._playheadLayer.fitToView(),this.containerHeightChange(),t=!0),e?this.updateWaveform(this._frameOffset,!0):t&&(this._segmentsLayer&&this._segmentsLayer.fitToView(),this._pointsLayer&&this._pointsLayer.fitToView())}},eX.prototype.destroy=function(){this._playheadLayer.destroy(),this._segmentsLayer&&this._segmentsLayer.destroy(),this._pointsLayer&&this._pointsLayer.destroy(),this._stage&&(this._stage.destroy(),this._stage=null)},eV.prototype._mouseDown=function(e){var t=null;if("mousedown"!==e.type||0===e.evt.button){var i=j(e.target);if(i){if("point-marker"===i.attrs.name||"segment-marker"===i.attrs.name)return;"segment-overlay"===i.attrs.name&&(t=i)}if(this._lastMouseClientX=Math.floor("touchstart"===e.type?e.evt.touches[0].clientX:e.evt.clientX),this._handlers.onMouseDown){var n=this._getMousePosX(this._lastMouseClientX);this._handlers.onMouseDown(n,t)}window.addEventListener("mousemove",this._mouseMove,{capture:!1,passive:!0}),window.addEventListener("touchmove",this._mouseMove,{capture:!1,passive:!0}),window.addEventListener("mouseup",this._mouseUp,{capture:!1,passive:!0}),window.addEventListener("touchend",this._mouseUp,{capture:!1}),window.addEventListener("blur",this._mouseUp,{capture:!1,passive:!0})}},eV.prototype._mouseMove=function(e){var t=Math.floor("touchmove"===e.type?e.changedTouches[0].clientX:e.clientX);if(t!==this._lastMouseClientX&&(this._lastMouseClientX=t,this._dragging=!0,this._handlers.onMouseMove)){var i=this._getMousePosX(t);this._handlers.onMouseMove(i)}},eV.prototype._mouseUp=function(e){var t;if("touchend"===e.type?(t=Math.floor(e.changedTouches[0].clientX),e.cancelable&&e.preventDefault()):t=Math.floor(e.clientX),this._handlers.onMouseUp){var i=this._getMousePosX(t);this._handlers.onMouseUp(i)}window.removeEventListener("mousemove",this._mouseMove,{capture:!1}),window.removeEventListener("touchmove",this._mouseMove,{capture:!1}),window.removeEventListener("mouseup",this._mouseUp,{capture:!1}),window.removeEventListener("touchend",this._mouseUp,{capture:!1}),window.removeEventListener("blur",this._mouseUp,{capture:!1}),this._dragging=!1},eV.prototype._getMousePosX=function(e){return Math.floor(e-this._stage.getContainer().getBoundingClientRect().left)},eV.prototype.isDragging=function(){return this._dragging},eV.prototype.destroy=function(){this._stage.off("mousedown",this._mouseDown),this._stage.off("touchstart",this._mouseDown)},eH.prototype._onMouseDown=function(e){this._firstMove=!0,this._seek(e)},eH.prototype._onMouseMove=function(e){this._firstMove&&(this._view.dragSeek(!0),this._firstMove=!1),this._seek(e)},eH.prototype._onMouseUp=function(){this._view.dragSeek(!1)},eH.prototype._seek=function(e){if(this._view.isSeekEnabled()){e=X(e,0,this._width);var t=this._view.pixelsToTime(e),i=this._peaks.player.getDuration();t>i&&(t=i),this._view.updatePlayheadTime(t),this._peaks.player.seek(t)}},eH.prototype.destroy=function(){this._mouseDragHandler.destroy()},eR.prototype=Object.create(eX.prototype),eR.prototype.initWaveformData=function(){0!==this._width&&this._resampleAndSetWaveformData(this._originalWaveformData,this._width)},eR.prototype.initHighlightLayer=function(){this._highlightLayer=new eC(this,this._viewOptions),this._highlightLayer.addToStage(this._stage)},eR.prototype.isSegmentDraggingEnabled=function(){return!1},eR.prototype.getName=function(){return"overview"}
2,eR.prototype._onTimeUpdate=function(e){this._playheadLayer.updatePlayheadTime(e)},eR.prototype._onPlaying=function(e){this._playheadLayer.updatePlayheadTime(e)},eR.prototype._onPause=function(e){this._playheadLayer.stop(e)},eR.prototype._onZoomviewUpdate=function(e){this.showHighlight(e.startTime,e.endTime)},eR.prototype.showHighlight=function(e,t){this._highlightLayer.showHighlight(e,t)},eR.prototype.setWaveformData=function(e){this._originalWaveformData=e,0!==this._width?this._resampleAndSetWaveformData(e,this._width):this._data=e,this.updateWaveform()},eR.prototype._resampleAndSetWaveformData=function(e,t){try{return this._data=e.resample({width:t}),!0}catch(t){return this._data=e,!1}},eR.prototype.removeHighlightRect=function(){this._highlightLayer.removeHighlight()},eR.prototype.updateWaveform=function(){this._waveformLayer.draw(),this._axisLayer.draw();var e=this._peaks.player.getCurrentTime();this._playheadLayer.updatePlayheadTime(e),this._highlightLayer.updateHighlight();var t=this.pixelsToTime(this._width);this._pointsLayer&&this._pointsLayer.updatePoints(0,t),this._segmentsLayer&&this._segmentsLayer.updateSegments(0,t)},eR.prototype.containerWidthChange=function(){return this._resampleAndSetWaveformData(this._originalWaveformData,this._width)},eR.prototype.containerHeightChange=function(){this._highlightLayer.fitToView()},eR.prototype.destroy=function(){this._peaks.off("player.playing",this._onPlaying),this._peaks.off("player.pause",this._onPause),this._peaks.off("player.timeupdate",this._onTimeUpdate),this._peaks.off("zoomview.update",this._onZoomviewUpdate),this._mouseDragHandler.destroy(),eX.prototype.destroy.call(this)},eG.prototype.isDragging=function(){return this._mouseDragHandler.isDragging()},eG.prototype._reset=function(){this._insertSegment=null,this._insertSegmentShape=null,this._segmentIsDraggable=!1,this._peaks.segments.setInserting(!1)},eG.prototype._onMouseDown=function(e,t){if(this._reset(),this._segment=t,this._segment)if("overlap"!==this._view.getSegmentDragMode())return;else this._segmentIsDraggable=this._segment.draggable(),this._segment.draggable(!1);var i=this._view.pixelsToTime(e+this._view.getFrameOffset());this._peaks.segments.setInserting(!0),this._insertSegment=this._peaks.segments.add({startTime:i,endTime:i,editable:!0}),this._insertSegmentShape=this._view._segmentsLayer.getSegmentShape(this._insertSegment),this._insertSegmentShape&&(this._insertSegmentShape.moveMarkersToTop(),this._insertSegmentShape.startDrag())},eG.prototype._onMouseMove=function(){},eG.prototype._onMouseUp=function(){this._insertSegment&&(this._insertSegmentShape&&(this._insertSegmentShape.stopDrag(),this._insertSegmentShape=null),this._segment&&this._segmentIsDraggable&&this._segment.draggable(!0),this._peaks.emit("segments.insert",{segment:this._insertSegment}),this._peaks.segments.setInserting(!1))},eG.prototype.destroy=function(){this._mouseDragHandler.destroy()},ez.prototype.isDragging=function(){return this._mouseDragHandler.isDragging()},ez.prototype._onMouseDown=function(e,t){this._seeking=!1,this._firstMove=!0,t&&!t.attrs.draggable?this._segment=null:this._segment=t;var i=this._view.getPlayheadOffset();if(this._view.isSeekEnabled()&&Math.abs(e-i)<=this._view.getPlayheadClickTolerance()&&(this._seeking=!0,this._segment&&(this._segmentIsDraggable=this._segment.draggable(),this._segment.draggable(!1))),this._seeking){e=X(e,0,this._view.getWidth());var n=this._view.pixelsToTime(e+this._view.getFrameOffset());this._seek(n)}else this._initialFrameOffset=this._view.getFrameOffset(),this._mouseDownX=e},ez.prototype._onMouseMove=function(e){if(!this._segment||this._seeking){if(this._seeking){this._firstMove&&(this._view.dragSeek(!0),this._firstMove=!1),e=X(e,0,this._view.getWidth());var t=this._view.pixelsToTime(e+this._view.getFrameOffset());this._seek(t)}else if(!this._view.isAutoZoom()){var i=this._mouseDownX-e,n=this._initialFrameOffset+i;n!==this._initialFrameOffset&&this._view.updateWaveform(n)}}},ez.prototype._onMouseUp=function(){if(this._seeking)this._view.dragSeek(!1);else if(this._view._enableSeek&&!this._mouseDragHandler.isDragging()){var e=this._view.pixelOffsetToTime(this._mouseDownX);this._seek(e)}this._segment&&this._seeking&&this._segmentIsDraggable&&this._segment.draggable(!0)},ez.prototype._seek=function(e){var t=this._peaks.player.getDuration();e>t&&(e=t),this._view.updatePlayheadTime(e),this._peaks.player.seek(e)},ez.prototype.destroy=function(){this._mouseDragHandler.destroy()},eZ.prototype=Object.create(eX.prototype),eZ.prototype.initWaveformData=function(){this._enableWaveformCache=this._options.waveformCache,this._initWaveformCache();var e=this._peaks.zoom.getZoomLevel();this._resampleData({scale:e})},eZ.prototype._initWaveformCache=function(){this._enableWaveformCache&&(this._waveformData=new Map,this._waveformData.set(this._originalWaveformData.scale,this._originalWaveformData),this._waveformScales=[this._originalWaveformData.scale])},eZ.prototype.initHighlightLayer=function(){},eZ.prototype.setWheelMode=function(e,t){t||(t={}
2),(e!==this._wheelMode||t.captureVerticalScroll!==this._captureVerticalScroll)&&(this._stage.off("wheel"),this._wheelMode=e,this._captureVerticalScroll=t.captureVerticalScroll,"scroll"===e&&(t.captureVerticalScroll?this._stage.on("wheel",this._onWheelCaptureVerticalScroll):this._stage.on("wheel",this._onWheel)))},eZ.prototype._onWheel=function(e){var t,i=e.evt;if(i.shiftKey)if(0!==i.deltaY)t=i.deltaY;else{if(0===i.deltaX)return;t=i.deltaX}else{if(Math.abs(i.deltaX)<Math.abs(i.deltaY))return;t=i.deltaX}i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._width),i.preventDefault();var n=X(this._frameOffset+Math.floor(t),0,this._pixelLength-this._width);this.updateWaveform(n,!1)},eZ.prototype._onWheelCaptureVerticalScroll=function(e){var t=e.evt,i=Math.abs(t.deltaX)<Math.abs(t.deltaY)?t.deltaY:t.deltaX;t.preventDefault();var n=X(this._frameOffset+Math.floor(i),0,this._pixelLength-this._width);this.updateWaveform(n,!1)},eZ.prototype.setWaveformDragMode=function(e){this._segmentsLayer&&(this._mouseDragHandler.destroy(),this.dragSeek(!1),"insert-segment"===e?this._mouseDragHandler=new eG(this._peaks,this):this._mouseDragHandler=new ez(this._peaks,this))},eZ.prototype.enableSegmentDragging=function(e){this._enableSegmentDragging=e,this._segmentsLayer&&this._segmentsLayer.enableSegmentDragging(e)},eZ.prototype.isSegmentDraggingEnabled=function(){return this._enableSegmentDragging},eZ.prototype.setSegmentDragMode=function(e){this._segmentDragMode=e},eZ.prototype.getSegmentDragMode=function(){return this._segmentDragMode},eZ.prototype.getName=function(){return"zoomview"}
2,eZ.prototype._onTimeUpdate=function(e){this._mouseDragHandler.isDragging()||this._syncPlayhead(e)},eZ.prototype._onPlaying=function(e){this._playheadLayer.updatePlayheadTime(e)},eZ.prototype._onPause=function(e){this._playheadLayer.stop(e)},eZ.prototype._onKeyboardLeft=function(){this._keyboardScroll(-1,!1)},eZ.prototype._onKeyboardRight=function(){this._keyboardScroll(1,!1)},eZ.prototype._onKeyboardShiftLeft=function(){this._keyboardScroll(-1,!0)},eZ.prototype._onKeyboardShiftRight=function(){this._keyboardScroll(1,!0)},eZ.prototype._keyboardScroll=function(e,t){var i;i=t?e*this._width:e*this.timeToPixels(this._options.nudgeIncrement),this.scrollWaveform({pixels:i})},eZ.prototype.setWaveformData=function(e){this._originalWaveformData=e,this._initWaveformCache()},eZ.prototype.getPlayheadOffset=function(){return this._playheadLayer.getPlayheadPixel()-this._frameOffset},eZ.prototype.getPlayheadClickTolerance=function(){return this._playheadClickTolerance},eZ.prototype._syncPlayhead=function(e){if(this._playheadLayer.updatePlayheadTime(e),this._autoScroll&&!this._zoomLevelAuto){var t=this.timeToPixels(e),i=this._frameOffset+this._width-this._autoScrollOffset,n=this._frameOffset;(t>=i||t<n)&&((n=t-this._autoScrollOffset)<0&&(n=0),this.updateWaveform(n,!1))}},eZ.prototype._getScale=function(e){return Math.floor(e*this._data.sample_rate/this._width)},eZ.prototype.setZoom=function(e){if(V(e,"scale")&&"auto"===e.scale||V(e,"seconds")&&"auto"===e.seconds){var t,i,n=this._originalWaveformData.duration;this._zoomLevelAuto=!0,this._zoomLevelSeconds=null,t=this._getScale(n)}else{if(V(e,"scale"))this._zoomLevelSeconds=null,t=Math.floor(e.scale);else if(V(e,"seconds")){if(!G(e.seconds))return!1;this._zoomLevelSeconds=e.seconds,t=this._getScale(e.seconds)}this._zoomLevelAuto=!1}t<this._originalWaveformData.scale&&(this._peaks._logger("peaks.zoomview.setZoom(): zoom level must be at least "+this._originalWaveformData.scale),t=this._originalWaveformData.scale);var o=this._peaks.player.getCurrentTime(),s=this.getPlayheadOffset();s>=0&&s<this._width?i=o:(s=Math.floor(this._width/2),i=this.pixelOffsetToTime(s));var r=this._scale;this._resampleData({scale:t});var a=this.timeToPixels(i)-s;return this.updateWaveform(a,!0),this._playheadLayer.zoomLevelChanged(),this._playheadLayer.updatePlayheadTime(o),this._peaks.emit("zoom.update",{currentZoom:t,previousZoom:r}),!0},eZ.prototype._resampleData=function(e){var t=e.scale;if(this._enableWaveformCache){if(!this._waveformData.has(t)){for(var i=this._originalWaveformData,n=0;n<this._waveformScales.length;n++)if(this._waveformScales[n]<t)i=this._waveformData.get(this._waveformScales[n]);else break;this._waveformData.set(t,i.resample(e)),this._waveformScales.push(t),this._waveformScales.sort(function(e,t){return e-t})}this._data=this._waveformData.get(t)}else this._data=this._originalWaveformData.resample(e);this._scale=this._data.scale,this._pixelLength=this._data.length},eZ.prototype.isAutoZoom=function(){return this._zoomLevelAuto},eZ.prototype.setStartTime=function(e){e<0&&(e=0),this._zoomLevelAuto&&(e=0),this.updateWaveform(this.timeToPixels(e),!1)},eZ.prototype.getPixelLength=function(){return this._pixelLength},eZ.prototype.scrollWaveform=function(e){var t;if(V(e,"pixels"))t=Math.floor(e.pixels);else if(V(e,"seconds"))t=this.timeToPixels(e.seconds);else throw TypeError("view.scrollWaveform(): Missing umber of pixels or seconds");this.updateWaveform(this._frameOffset+t,!1)},eZ.prototype.updateWaveform=function(e,t){if(this._pixelLength<this._width?(e=0,i=this._width):i=this._pixelLength-this._width,e=X(e,0,i),t||e!==this._frameOffset){this._frameOffset=e;var i,n=this._playheadLayer.getPlayheadPixel();this._playheadLayer.updatePlayheadTime(this.pixelsToTime(n)),this.drawWaveformLayer(),this._axisLayer.draw();var o=this.getStartTime(),s=this.getEndTime();this._pointsLayer&&this._pointsLayer.updatePoints(o,s),this._segmentsLayer&&this._segmentsLayer.updateSegments(o,s),this._peaks.emit("zoomview.update",{startTime:o,endTime:s})}},eZ.prototype.enableAutoScroll=function(e,t){t||(t={}),this._autoScroll=e,V(t,"offset")&&(this._autoScrollOffset=t.offset)},eZ.prototype.getMinSegmentDragWidth=function(){return this._insertSegmentShape?0:this._minSegmentDragWidth},eZ.prototype.setMinSegmentDragWidth=function(e){this._minSegmentDragWidth=e},eZ.prototype.containerWidthChange=function(){var e,t=!1;if(this._zoomLevelAuto?(t=!0,e={width:this._width}):null!==this._zoomLevelSeconds&&(t=!0,e={scale:this._getScale(this._zoomLevelSeconds)}),t)try{this._resampleData(e)}catch(e){}return!0}
2,eZ.prototype.containerHeightChange=function(){},eZ.prototype.getStage=function(){return this._stage},eZ.prototype.getSegmentsLayer=function(){return this._segmentsLayer},eZ.prototype.destroy=function(){this._peaks.off("player.playing",this._onPlaying),this._peaks.off("player.pause",this._onPause),this._peaks.off("player.timeupdate",this._onTimeUpdate),this._peaks.off("keyboard.left",this._onKeyboardLeft),this._peaks.off("keyboard.right",this._onKeyboardRight),this._peaks.off("keyboard.shift_left",this._onKeyboardShiftLeft),this._peaks.off("keyboard.shift_right",this._onKeyboardShiftRight),this._enableWaveformCache?(this._waveformData.clear(),delete this._waveformData,delete this._waveformScales):delete this._data,this._mouseDragHandler.destroy(),eX.prototype.destroy.call(this)},eU.prototype.setZoomview=function(e){this._zoomview=e,this._updateScrollbarWidthAndPosition()},eU.prototype._setScrollboxWidth=function(){this._zoomview?(this._scrollboxWidth=Math.floor(this._width*this._zoomview.pixelsToTime(this._zoomview.getWidth())/this._peaks.player.getDuration()),this._scrollboxWidth<this._minScrollboxWidth&&(this._scrollboxWidth=this._minScrollboxWidth)):this._scrollboxWidth=this._width,this._scrollboxRect.width(this._scrollboxWidth)},eU.prototype._getScrollbarRange=function(){return this._width-this._scrollboxWidth},eU.prototype._dragBoundFunc=function(e){return{x:e.x,y:0}},eU.prototype._onScrollboxDragStart=function(){this._dragging=!0},eU.prototype._onScrollboxDragEnd=function(){this._dragging=!1},eU.prototype._onScrollboxDragMove=function(){var e=this._getScrollbarRange(),t=X(this._scrollbox.x(),0,e);this._scrollbox.x(t),t!==this._scrollboxX&&(this._scrollboxX=t,this._zoomview&&this._updateWaveform(t))},eU.prototype._onZoomviewUpdate=function(){this._dragging||this._updateScrollbarWidthAndPosition()},eU.prototype._updateScrollbarWidthAndPosition=function(){if(this._setScrollboxWidth(),this._zoomview){var e=this._zoomview.getStartTime(),t=this._zoomview.getPixelLength()-this._zoomview.getWidth(),i=Math.floor(this._zoomview.timeToPixels(e)*this._getScrollbarRange()/t);this._scrollbox.x(i),this._layer.draw()}},eU.prototype._onScrollbarClick=function(e){if(e.target===this._stage&&this._zoomview){var t=Math.floor(e.evt.offsetX-this._scrollboxWidth/2);t<0&&(t=0),this._updateWaveform(t)}},eU.prototype._updateWaveform=function(e){var t=Math.floor((this._zoomview.getPixelLength()-this._zoomview.getWidth())*e/this._getScrollbarRange());this._zoomview.updateWaveform(t)},eU.prototype.fitToContainer=function(){(0!==this._container.clientWidth||0!==this._container.clientHeight)&&(this._container.clientWidth!==this._width&&(this._width=this._container.clientWidth,this._stage.width(this._width),this._updateScrollbarWidthAndPosition()),this._height=this._container.clientHeight,this._stage.height(this._height))},eU.prototype.destroy=function(){this._peaks.off("zoomview.update",this._onZoomviewUpdate),this._layer.destroy(),this._stage.destroy(),this._stage=null},eY.prototype.createOverview=function(e){if(this._overview)return this._overview;var t=this._peaks.getWaveformData();return this._overview=new eR(t,e,this._peaks),this._zoomview&&this._overview.showHighlight(this._zoomview.getStartTime(),this._zoomview.getEndTime()),this._overview},eY.prototype.createZoomview=function(e){if(this._zoomview)return this._zoomview;var t=this._peaks.getWaveformData();return this._zoomview=new eZ(t,e,this._peaks),this._scrollbar&&this._scrollbar.setZoomview(this._zoomview),this._zoomview},eY.prototype.createScrollbar=function(e){return this._scrollbar=new eU(e,this._peaks),this._scrollbar},eY.prototype.destroyOverview=function(){!this._overview||this._zoomview&&(this._overview.destroy(),this._overview=null)},eY.prototype.destroyZoomview=function(){!this._zoomview||this._overview&&(this._zoomview.destroy(),this._zoomview=null,this._overview.removeHighlightRect())},eY.prototype.destroy=function(){this._overview&&(this._overview.destroy(),this._overview=null),this._zoomview&&(this._zoomview.destroy(),this._zoomview=null),this._scrollbar&&(this._scrollbar.destroy(),this._scrollbar=null)},eY.prototype.getView=function(e){if(U(e))if(this._overview&&this._zoomview)return null;else if(this._overview)return this._overview;else if(this._zoomview)return this._zoomview;else return null;switch(e){case"overview":return this._overview;case"zoomview":return this._zoomview;default:return null}},eY.prototype.getScrollbar=function(){return this._scrollbar},eN.prototype.setZoomLevels=function(e){this._zoomLevels=e,this.setZoom(0,!0)},eN.prototype.zoomIn=function(){this.setZoom(this._zoomLevelIndex-1,!1)},eN.prototype.zoomOut=function(){this.setZoom(this._zoomLevelIndex+1,!1)},eN.prototype.setZoom=function(e,t){if(e>=this._zoomLevels.length&&(e=this._zoomLevels.length-1),e<0&&(e=0),t||e!==this._zoomLevelIndex){this._zoomLevelIndex=e;var i=this._peaks.views.getView("zoomview");i&&i.setZoom({scale:this._zoomLevels[e]})}},eN.prototype.getZoom=function(){return this._zoomLevelIndex},eN.prototype.getZoomLevel=function(){return this._zoomLevels[this._zoomLevelIndex]};var eK="withCredentials"in new XMLHttpRequest;function ej(e){this._peaks=e}function eJ(e){var t=e.getResponseHeader("content-range");if(!t)return!1;var i=t.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(i&&4===i.length){var n=parseInt(i[1],10),o=parseInt(i[2],10),s=parseInt(i[3],10);if(0===n&&o+1===s)return!0}return!1}function eq(){return L.call(this),this.options={zoomLevels:[512,1024,2048,4096],waveformCache:!0,mediaElement:null,mediaUrl:null,dataUri:null,withCredentials:!1,waveformData:null,webAudio:null,nudgeIncrement:1,pointMarkerColor:"#39cccc",createSegmentMarker:eT,createSegmentLabel:ek,createPointMarker:eA,logger:console.error.bind(console)}
2,this}ej.prototype.init=function(e,t){if(e.dataUri&&(e.webAudio||e.audioContext)||e.waveformData&&(e.webAudio||e.audioContext)||e.dataUri&&e.waveformData)return void t(TypeError("Peaks.init(): You may only pass one source (webAudio, dataUri, or waveformData) to render waveform data."));if(e.audioContext&&(this._peaks._logger("Peaks.init(): The audioContext option is deprecated, please pass a webAudio object instead"),e.webAudio={audioContext:e.audioContext}),e.dataUri)return this._getRemoteWaveformData(e,t);if(e.waveformData)return this._buildWaveformFromLocalData(e,t);if(e.webAudio)if(e.webAudio.audioBuffer)return this._buildWaveformDataFromAudioBuffer(e,t);else return this._buildWaveformDataUsingWebAudio(e,t);t(Error("Peaks.init(): You must pass an audioContext, or dataUri, or waveformData to render waveform data"))},ej.prototype._getRemoteWaveformData=function(e,t){var i,n=this,o=null,s=null;z(e.dataUri)?(o=e.dataUri,["ArrayBuffer","JSON"].some(function(e){if(window[e])return!!(i=o[s=e.toLowerCase()])}),i)?(n._xhr=n._createXHR(i,s,e.withCredentials,function(e){if(4===this.readyState){if(200!==this.status&&!(206===this.status&&eJ(this)))return void t(Error("Unable to fetch remote data. HTTP status "+this.status));n._xhr=null;var i=E.A.create(e.target.response);if(1!==i.channels&&2!==i.channels)return void t(Error("Peaks.init(): Only mono or stereo waveforms are currently supported"));if(8!==i.bits)return void t(Error("Peaks.init(): 16-bit waveform data is not supported"));t(void 0,i)}},function(){t(Error("XHR failed"))},function(){t(Error("XHR aborted"))}),n._xhr.send()):t(Error("Peaks.init(): Unable to determine a compatible dataUri format for this browser")):t(TypeError("Peaks.init(): The dataUri option must be an object"))},ej.prototype._buildWaveformFromLocalData=function(e,t){var i,n=null,o=null;if(!z(e.waveformData))return void t(Error("Peaks.init(): The waveformData option must be an object"));if(z((n=e.waveformData).json)?o=n.json:(i=n.arraybuffer,Object.prototype.toString.call(i).includes("ArrayBuffer")&&(o=n.arraybuffer)),!o)return void t(Error("Peaks.init(): Unable to determine a compatible waveformData format"));try{var s=E.A.create(o);if(1!==s.channels&&2!==s.channels)return void t(Error("Peaks.init(): Only mono or stereo waveforms are currently supported"));if(8!==s.bits)return void t(Error("Peaks.init(): 16-bit waveform data is not supported"));t(void 0,s)}catch(e){t(e)}},ej.prototype._buildWaveformDataUsingWebAudio=function(e,t){var i=this,n=window.AudioContext||window.webkitAudioContext;if(!(e.webAudio.audioContext instanceof n))return void t(TypeError("Peaks.init(): The webAudio.audioContext option must be a valid AudioContext"));var o=e.webAudio;o.scale!==e.zoomLevels[0]&&(o.scale=e.zoomLevels[0]);var s=i._peaks.options.mediaElement.currentSrc;s?i._requestAudioAndBuildWaveformData(s,o,e.withCredentials,t):i._peaks.once("player.canplay",function(){i._requestAudioAndBuildWaveformData(i._peaks.options.mediaElement.currentSrc,o,e.withCredentials,t)})},ej.prototype._buildWaveformDataFromAudioBuffer=function(e,t){var i=e.webAudio;i.scale!==e.zoomLevels[0]&&(i.scale=e.zoomLevels[0]);var n={audio_buffer:i.audioBuffer,split_channels:i.multiChannel,scale:i.scale,disable_worker:!0};E.A.createFromAudio(n,t)},ej.prototype._requestAudioAndBuildWaveformData=function(e,t,i,n){var o=this;e?(o._xhr=o._createXHR(e,"arraybuffer",i,function(e){if(4===this.readyState){if(200!==this.status&&!(206===this.status&&eJ(this)))return void n(Error("Unable to fetch remote data. HTTP status "+this.status));o._xhr=null;var i={audio_context:t.audioContext,array_buffer:e.target.response,split_channels:t.multiChannel,scale:t.scale};E.A.createFromAudio(i,n)}},function(){n(Error("XHR failed"))},function(){n(Error("XHR aborted"))}),o._xhr.send()):o._peaks._logger("Peaks.init(): The mediaElement src is invalid")},ej.prototype.abort=function(){this._xhr&&this._xhr.abort()},ej.prototype._createXHR=function(e,t,i,n,o,s){var r=new XMLHttpRequest;if(r.open("GET",e,!0),eK)try{r.responseType=t}catch(e){}return r.onload=n,r.onerror=o,eK&&i&&(r.withCredentials=!0),r.addEventListener("abort",s),r},eq.prototype=Object.create(L.prototype);var eQ={playheadColor:"#111111",playheadTextColor:"#aaaaaa",playheadBackgroun
2dColor:"transparent",playheadPadding:2,playheadWidth:1,axisGridlineColor:"#cccccc",showAxisLabels:!0,axisTopMarkerHeight:10,axisBottomMarkerHeight:10,axisLabelColor:"#aaaaaa",fontFamily:"sans-serif",fontSize:11,fontStyle:"normal",timeLabelPrecision:2,enablePoints:!0,enableSegments:!0},e$={playheadClickTolerance:3,waveformColor:"rgba(0, 225, 128, 1)",wheelMode:"none",autoScroll:!0,autoScrollOffset:100,enableEditing:!0},e0={waveformColor:"rgba(0, 0, 0, 0.2)",highlightColor:"#aaaaaa",highlightStrokeColor:"transparent",highlightOpacity:.3,highlightOffset:11,highlightCornerRadius:2,enableEditing:!1},e1={overlay:!1,markers:!0,startMarkerColor:"#aaaaaa",endMarkerColor:"#aaaaaa",waveformColor:"#0074d9",overlayColor:"#ff0000",overlayOpacity:.3,overlayBorderColor:"#ff0000",overlayBorderWidth:2,overlayCornerRadius:5,overlayOffset:25,overlayLabelAlign:"left",overlayLabelVerticalAlign:"top",overlayLabelPadding:8,overlayLabelColor:"#000000",overlayFontFamily:"sans-serif",overlayFontSize:12,overlayFontStyle:"normal"},e2={color:"#888888",minWidth:50};function e3(e,t){for(var i in t)V(t,i)&&V(e,i)&&(e[i]=t[i]);return e}function e5(e){var t=e.zoomview.container,i=e.overview.container;return N(t)||N(i)?t&&(t.clientWidth<=0||t.clientHeight<=0)?Error("Peaks.init(): The zoomview container must be visible and have non-zero width and height"):i&&(i.clientWidth<=0||i.clientHeight<=0)?Error("Peaks.init(): The overview container must be visible and have non-zero width and height"):void 0:TypeError("Peaks.init(): The zoomview and/or overview container options must be valid HTML elements")}eq.init=function(e,t){if(!t)throw Error("Peaks.init(): Missing callback function");var i=new eq,n=i._setOptions(e);if(n||(n=e5(i.options)),n)return void t(n);var o=null;if(i.options.scrollbar){if(!N(o=i.options.scrollbar.container))return void t(TypeError("Peaks.init(): The scrollbar container option must be a valid HTML element"));if(o.clientWidth<=0)return void t(TypeError("Peaks.init(): The scrollbar container must be visible and have non-zero width"))}e.keyboard&&(i._keyboardHandler=new ec(i));var s=e.player?e.player:new ev(i.options.mediaElement);i.player=new eb(i,s),i.segments=new em(i),i.points=new el(i),i.zoom=new eN(i,i.options.zoomLevels),i.views=new eY(i),i._waveformBuilder=new ej(i),i.player.init(i).then(function(){i._waveformBuilder.init(i.options,function(n,s){if(n||(n=e5(i.options)))return void t(n);i._waveformBuilder=null,i._waveformData=s;var r=i.options.zoomview.container,a=i.options.overview.container;r&&i.views.createZoomview(r),a&&i.views.createOverview(a),o&&i.views.createScrollbar(o),e.segments&&i.segments.add(e.segments),e.points&&i.points.add(e.points),e.emitCueEvents&&(i._cueEmitter=new en(i)),t(null,i)})}).catch(function(e){t(e)})},eq.prototype._setOptions=function(e){var t,i,n;if(!z(e))return TypeError("Peaks.init(): The options parameter should be an object");if(!e.player){if(!e.mediaElement)return Error("Peaks.init(): Missing mediaElement option");if(!(e.mediaElement instanceof HTMLMediaElement))return TypeError("Peaks.init(): The mediaElement option should be an HTMLMediaElement")}return e.logger&&"function"!=typeof e.logger?TypeError("Peaks.init(): The logger option should be a function"):e.segments&&!Array.isArray(e.segments)?TypeError("Peaks.init(): options.segments must be an array of segment objects"):e.points&&!Array.isArray(e.points)?TypeError("Peaks.init(): options.points must be an array of point objects"):(e3(this.options,e),this.options.overview=(t={},e.overview&&e.overview.showPlayheadTime&&(t.showPlayheadTime=e.overview.showPlayheadTime),["container","waveformColor","playedWaveformColor","playheadColor","playheadTextColor","playheadBackgroundColor","playheadPadding","playheadWidth","formatPlayheadTime","timeLabelPrecision","axisGridlineColor","showAxisLabels","axisTopMarkerHeight","axisBottomMarkerHeight","axisLabelColor","formatAxisTime","fontFamily","fontSize","fontStyle","highlightColor","highlightStrokeColor","highlightOpacity","highlightCornerRadius","highlightOffset","enablePoints","enableSegments","enableEditing"].forEach(function(i){e.overview&&V(e.overview,i)?t[i]=e.overview[i]:V(e,i)?t[i]=e[i]:!V(t,i)&&(V(e0,i)?t[i]=e0[i]:V(eQ,i)&&(t[i]=eQ[i]))}),t),this.options.zoomview=(i={},e.showPlayheadTime?i.showPlayheadTime=e.showPlayheadTime:e.zoomview&&e.zoomview.showPlayheadTime&&(i.showPlayheadTime=e.zoomview.showPlayheadTime),["container","waveformColor","playedWaveformColor","playheadColor","playheadTextColor","playheadBackgroun
2dColor","playheadPadding","playheadWidth","formatPlayheadTime","playheadClickTolerance","timeLabelPrecision","axisGridlineColor","showAxisLabels","axisTopMarkerHeight","axisBottomMarkerHeight","axisLabelColor","formatAxisTime","fontFamily","fontSize","fontStyle","wheelMode","autoScroll","autoScrollOffset","enablePoints","enableSegments","enableEditing"].forEach(function(t){e.zoomview&&V(e.zoomview,t)?i[t]=e.zoomview[t]:V(e,t)?i[t]=e[t]:!V(i,t)&&(V(e$,t)?i[t]=e$[t]:V(eQ,t)&&(i[t]=eQ[t]))}),i),this.options.scrollbar=function(e){if(!V(e,"scrollbar"))return null;var t={};return["container","color","minWidth"].forEach(function(i){V(e.scrollbar,i)?t[i]=e.scrollbar[i]:t[i]=e2[i]}),t}(e),n=this.options,n.segmentOptions={},H(n.segmentOptions,e1),e.segmentOptions&&e3(n.segmentOptions,e.segmentOptions),n.zoomview.segmentOptions={},H(n.zoomview.segmentOptions,n.segmentOptions),e.zoomview&&e.zoomview.segmentOptions&&e3(n.zoomview.segmentOptions,e.zoomview.segmentOptions),n.overview.segmentOptions={},H(n.overview.segmentOptions,n.segmentOptions),e.overview&&e.overview.segmentOptions&&e3(n.overview.segmentOptions,e.overview.segmentOptions),Array.isArray(this.options.zoomLevels))?0===this.options.zoomLevels.length?Error("Peaks.init(): The zoomLevels array must not be empty"):!function(e){if(0===e.length)return!0;for(var t=e[0],i=1;i<e.length;i++){if(t>=e[i])return!1;t=e[i]}return!0}(this.options.zoomLevels)?Error("Peaks.init(): The zoomLevels array must be sorted in ascending order"):void(this._logger=this.options.logger):TypeError("Peaks.init(): The zoomLevels option should be an array")},eq.prototype.setSource=function(e,t){var i=this;i.player._setSource(e).then(function(){e.zoomLevels||(e.zoomLevels=i.options.zoomLevels),i._waveformBuilder=new ej(i),i._waveformBuilder.init(e,function(n,o){n?t(n):(i._waveformBuilder=null,i._waveformData=o,["overview","zoomview"].forEach(function(e){var t=i.views.getView(e);t&&t.setWaveformData(o)}),i.zoom.setZoomLevels(e.zoomLevels),t())})}).catch(function(e){t(e)})},eq.prototype.getWaveformData=function(){return this._waveformData},eq.prototype.destroy=function(){this._waveformBuilder&&this._waveformBuilder.abort(),this._keyboardHandler&&this._keyboardHandler.destroy(),this.views&&this.views.destroy(),this.player&&this.player.destroy(),this._cueEmitter&&this._cueEmitter.destroy()}},70317:function(e,t,i){"use strict";function n(e,t){this._waveformData=e,this._channelIndex=t}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e){return null==e}i.d(t,{A:function(){return h}}),n.prototype.min_sample=function(e){var t=(e*this._waveformData.channels+this._channelIndex)*2;return this._waveformData._at(t)},n.prototype.max_sample=function(e){var t=(e*this._waveformData.channels+this._channelIndex)*2+1;return this._waveformData._at(t)},n.prototype.set_min_sample=function(e,t){var i=(e*this._waveformData.channels+this._channelIndex)*2;return this._waveformData._set_at(i,t)},n.prototype.set_max_sample=function(e,t){var i=(e*this._waveformData.channels+this._channelIndex)*2+1;return this._waveformData._set_at(i,t)},n.prototype.min_array=function(){for(var e=this._waveformData.length,t=[],i=0;i<e;i++)t.push(this.min_sample(i));return t},n.prototype.max_array=function(){for(var e=this._waveformData.length,t=[],i=0;i<e;i++)t.push(this.max_sample(i));return t};var r,a=function(e){var t,i,n,o;return new Worker(r=r||(t=null,n=(i=function(e,t){var i=atob(e);if(t){for(var n=new Uint8Array(i.length),o=0,s=i.length;o<s;++o)n[o]=i.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(n.buffer))}return i}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICd1c2Ugc3RyaWN0JzsKCiAgLyoqCiAgICogQXVkaW9CdWZmZXItYmFzZWQgV2F2ZWZvcm1EYXRhIGdlbmVyYXRvcgogICAqCiAgICogQWRhcHRlZCBmcm9tIEJsb2NrRmlsZTo6Q2FsY1N1bW1hcnkgaW4gQXVkYWNpdHksIHdpdGggcGVybWlzc2lvbi4KICAgKiBTZWUgaHR0cHM6Ly9naXRodWIuY29tL2F1ZGFjaXR5L2F1ZGFjaXR5L2Jsb2IvCiAgICogICAxMTA4YzEzNzZjMDkxNjYxNjIzMzVmYWI0NzQzMDA4Y2JhNTdjNGVlL3NyYy9CbG9ja0ZpbGUuY3BwI0wxOTgKICAgKi8KCiAgdmFyIElOVDhfTUFYID0gMTI3OwogIHZhciBJTlQ4X01JTiA9IC0xMjg7CiAgdmFyIElOVDE2X01BWCA9IDMyNzY3OwogIHZhciBJTlQxNl9NSU4gPSAtMzI3Njg7CiAgZnVuY3Rpb24gY2FsY3VsYXRlV2F2ZWZvcm1EYXRhTGVuZ3RoKGF1ZGlvX3NhbXBsZV9jb3VudCwgc2NhbGUpIHsKICAgIHZhciBkYXRhX2xlbmd0aCA9IE1hdGguZmxvb3IoYXVkaW9fc2FtcGxlX2NvdW50IC8gc2NhbGUpOwogICAgdmFyIHNhbXBsZXNfcmVtYWluaW5nID0gYXVkaW9fc2FtcGxlX2NvdW50IC0gZGF0YV9sZW5ndGggKiBzY2FsZTsKICAgIGlmIChzYW1wbGVzX3JlbWFpbmluZyA+IDApIHsKICAgICAgZGF0YV9sZW5ndGgrKzsKICAgIH0KICAgIHJldHVybi
2BkYXRhX2xlbmd0aDsKICB9CiAgZnVuY3Rpb24gZ2VuZXJhdGVXYXZlZm9ybURhdGEob3B0aW9ucykgewogICAgdmFyIHNjYWxlID0gb3B0aW9ucy5zY2FsZTsKICAgIHZhciBhbXBsaXR1ZGVfc2NhbGUgPSBvcHRpb25zLmFtcGxpdHVkZV9zY2FsZTsKICAgIHZhciBzcGxpdF9jaGFubmVscyA9IG9wdGlvbnMuc3BsaXRfY2hhbm5lbHM7CiAgICB2YXIgbGVuZ3RoID0gb3B0aW9ucy5sZW5ndGg7CiAgICB2YXIgc2FtcGxlX3JhdGUgPSBvcHRpb25zLnNhbXBsZV9yYXRlOwogICAgdmFyIGNoYW5uZWxzID0gb3B0aW9ucy5jaGFubmVscy5tYXAoZnVuY3Rpb24gKGNoYW5uZWwpIHsKICAgICAgcmV0dXJuIG5ldyBGbG9hdDMyQXJyYXkoY2hhbm5lbCk7CiAgICB9KTsKICAgIHZhciBvdXRwdXRfY2hhbm5lbHMgPSBzcGxpdF9jaGFubmVscyA/IGNoYW5uZWxzLmxlbmd0aCA6IDE7CiAgICB2YXIgaGVhZGVyX3NpemUgPSAyNDsKICAgIHZhciBkYXRhX2xlbmd0aCA9IGNhbGN1bGF0ZVdhdmVmb3JtRGF0YUxlbmd0aChsZW5ndGgsIHNjYWxlKTsKICAgIHZhciBieXRlc19wZXJfc2FtcGxlID0gb3B0aW9ucy5iaXRzID09PSA4ID8gMSA6IDI7CiAgICB2YXIgdG90YWxfc2l6ZSA9IGhlYWRlcl9zaXplICsgZGF0YV9sZW5ndGggKiAyICogYnl0ZXNfcGVyX3NhbXBsZSAqIG91dHB1dF9jaGFubmVsczsKICAgIHZhciBidWZmZXIgPSBuZXcgQXJyYXlCdWZmZXIodG90YWxfc2l6ZSk7CiAgICB2YXIgZGF0YV92aWV3ID0gbmV3IERhdGFWaWV3KGJ1ZmZlcik7CiAgICB2YXIgc2NhbGVfY291bnRlciA9IDA7CiAgICB2YXIgb2Zmc2V0ID0gaGVhZGVyX3NpemU7CiAgICB2YXIgbWluX3ZhbHVlID0gbmV3IEFycmF5KG91dHB1dF9jaGFubmVscyk7CiAgICB2YXIgbWF4X3ZhbHVlID0gbmV3IEFycmF5KG91dHB1dF9jaGFubmVscyk7CiAgICBmb3IgKHZhciBjaGFubmVsID0gMDsgY2hhbm5lbCA8IG91dHB1dF9jaGFubmVsczsgY2hhbm5lbCsrKSB7CiAgICAgIG1pbl92YWx1ZVtjaGFubmVsXSA9IEluZmluaXR5OwogICAgICBtYXhfdmFsdWVbY2hhbm5lbF0gPSAtSW5maW5pdHk7CiAgICB9CiAgICB2YXIgcmFuZ2VfbWluID0gb3B0aW9ucy5iaXRzID09PSA4ID8gSU5UOF9NSU4gOiBJTlQxNl9NSU47CiAgICB2YXIgcmFuZ2VfbWF4ID0gb3B0aW9ucy5iaXRzID09PSA4ID8gSU5UOF9NQVggOiBJTlQxNl9NQVg7CiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMCwgMiwgdHJ1ZSk7IC8vIFZlcnNpb24KICAgIGRhdGFfdmlldy5zZXRVaW50MzIoNCwgb3B0aW9ucy5iaXRzID09PSA4LCB0cnVlKTsgLy8gSXMgOCBiaXQ/CiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoOCwgc2FtcGxlX3JhdGUsIHRydWUpOyAvLyBTYW1wbGUgcmF0ZQogICAgZGF0YV92aWV3LnNldEludDMyKDEyLCBzY2FsZSwgdHJ1ZSk7IC8vIFNjYWxlCiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMTYsIGRhdGFfbGVuZ3RoLCB0cnVlKTsgLy8gTGVuZ3RoCiAgICBkYXRhX3ZpZXcuc2V0SW50MzIoMjAsIG91dHB1dF9jaGFubmVscywgdHJ1ZSk7CiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7CiAgICAgIHZhciBzYW1wbGUgPSAwOwogICAgICBpZiAob3V0cHV0X2NoYW5uZWxzID09PSAxKSB7CiAgICAgICAgZm9yICh2YXIgX2NoYW5uZWwgPSAwOyBfY2hhbm5lbCA8IGNoYW5uZWxzLmxlbmd0aDsgKytfY2hhbm5lbCkgewogICAgICAgICAgc2FtcGxlICs9IGNoYW5uZWxzW19jaGFubmVsXVtpXTsKICAgICAgICB9CiAgICAgICAgc2FtcGxlID0gTWF0aC5mbG9vcihyYW5nZV9tYXggKiBzYW1wbGUgKiBhbXBsaXR1ZGVfc2NhbGUgLyBjaGFubmVscy5sZW5ndGgpOwogICAgICAgIGlmIChzYW1wbGUgPCBtaW5fdmFsdWVbMF0pIHsKICAgICAgICAgIG1pbl92YWx1ZVswXSA9IHNhbXBsZTsKICAgICAgICAgIGlmIChtaW5fdmFsdWVbMF0gPCByYW5nZV9taW4pIHsKICAgICAgICAgICAgbWluX3ZhbHVlWzBdID0gcmFuZ2VfbWluOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoc2FtcGxlID4gbWF4X3ZhbHVlWzBdKSB7CiAgICAgICAgICBtYXhfdmFsdWVbMF0gPSBzYW1wbGU7CiAgICAgICAgICBpZiAobWF4X3ZhbHVlWzBdID4gcmFuZ2VfbWF4KSB7CiAgICAgICAgICAgIG1heF92YWx1ZVswXSA9IHJhbmdlX21heDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yICh2YXIgX2NoYW5uZWwyID0gMDsgX2NoYW5uZWwyIDwgb3V0cHV0X2NoYW5uZWxzOyArK19jaGFubmVsMikgewogICAgICAgICAgc2FtcGxlID0gTWF0aC5mbG9vcihyYW5nZV9tYXggKiBjaGFubmVsc1tfY2hhbm5lbDJdW2ldICogYW1wbGl0dWRlX3NjYWxlKTsKICAgICAgICAgIGlmIChzYW1wbGUgPCBtaW5fdmFsdWVbX2NoYW5uZWwyXSkgewogICAgICAgICAgICBtaW5fdmFsdWVbX2NoYW5uZWwyXSA9IHNhbXBsZTsKICAgICAgICAgICAgaWYgKG1pbl92YWx1ZVtfY2hhbm5lbDJdIDwgcmFuZ2VfbWluKSB7CiAgICAgICAgICAgICAgbWluX3ZhbHVlW19jaGFubmVsMl0gPSByYW5nZV9taW47CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzYW1wbGUgPiBtYXhfdmFsdWVbX2NoYW5uZWwyXSkgewogICAgICAgICAgICBtYXhfdmFsdWVbX2NoYW5uZWwyXSA9IHNhbXBsZTsKICAgICAgICAgICAgaWYgKG1heF92YWx1ZVtfY2hhbm5lbDJdID4gcmFuZ2VfbWF4KSB7CiAgICAgICAgICAgICAgbWF4X3ZhbHVlW19jaGFubmVsMl0gPSByYW5nZV9tYXg7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgaWYgKCsrc2NhbGVfY291bnRlciA9PT0gc2NhbGUpIHsKICAgICAgICBmb3IgKHZhciBfY2hhbm5lbDMgPSAwOyBfY2hhbm5lbDMgPCBvdXRwdXRfY2hhbm5lbHM7IF9jaGFubmVsMysrKSB7CiAgICAgICAgICBpZiAob3B0aW9ucy5iaXRzID09PSA4KSB7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQ4KG9mZnNldCsrLCBtaW5fdmFsdWVbX2NoYW5uZWwzXSk7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQ4KG9mZnNldCsrLCBtYXhfdmFsdWVbX2NoYW5uZWwz
2XSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBkYXRhX3ZpZXcuc2V0SW50MTYob2Zmc2V0LCBtaW5fdmFsdWVbX2NoYW5uZWwzXSwgdHJ1ZSk7CiAgICAgICAgICAgIGRhdGFfdmlldy5zZXRJbnQxNihvZmZzZXQgKyAyLCBtYXhfdmFsdWVbX2NoYW5uZWwzXSwgdHJ1ZSk7CiAgICAgICAgICAgIG9mZnNldCArPSA0OwogICAgICAgICAgfQogICAgICAgICAgbWluX3ZhbHVlW19jaGFubmVsM10gPSBJbmZpbml0eTsKICAgICAgICAgIG1heF92YWx1ZVtfY2hhbm5lbDNdID0gLUluZmluaXR5OwogICAgICAgIH0KICAgICAgICBzY2FsZV9jb3VudGVyID0gMDsKICAgICAgfQogICAgfQogICAgaWYgKHNjYWxlX2NvdW50ZXIgPiAwKSB7CiAgICAgIGZvciAodmFyIF9jaGFubmVsNCA9IDA7IF9jaGFubmVsNCA8IG91dHB1dF9jaGFubmVsczsgX2NoYW5uZWw0KyspIHsKICAgICAgICBpZiAob3B0aW9ucy5iaXRzID09PSA4KSB7CiAgICAgICAgICBkYXRhX3ZpZXcuc2V0SW50OChvZmZzZXQrKywgbWluX3ZhbHVlW19jaGFubmVsNF0pOwogICAgICAgICAgZGF0YV92aWV3LnNldEludDgob2Zmc2V0KyssIG1heF92YWx1ZVtfY2hhbm5lbDRdKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGF0YV92aWV3LnNldEludDE2KG9mZnNldCwgbWluX3ZhbHVlW19jaGFubmVsNF0sIHRydWUpOwogICAgICAgICAgZGF0YV92aWV3LnNldEludDE2KG9mZnNldCArIDIsIG1heF92YWx1ZVtfY2hhbm5lbDRdLCB0cnVlKTsKICAgICAgICB9CiAgICAgIH0KICAgIH0KICAgIHJldHVybiBidWZmZXI7CiAgfQoKICBvbm1lc3NhZ2UgPSBmdW5jdGlvbiBvbm1lc3NhZ2UoZXZ0KSB7CiAgICB2YXIgYnVmZmVyID0gZ2VuZXJhdGVXYXZlZm9ybURhdGEoZXZ0LmRhdGEpOwoKICAgIC8vIFRyYW5zZmVyIGJ1ZmZlciB0byB0aGUgY2FsbGluZyB0aHJlYWQKICAgIHRoaXMucG9zdE1lc3NhZ2UoYnVmZmVyLCBbYnVmZmVyXSk7CiAgICB0aGlzLmNsb3NlKCk7CiAgfTsKCn0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPXdhdmVmb3JtLWRhdGEtd29ya2VyLmpzLm1hcAoK",!1)).indexOf("\n",10)+1,o=new Blob([i.substring(n)+(t?"//# sourceMappingURL="+t:"")],{type:"application/javascript"}),URL.createObjectURL(o)),e)};function h(e){var t;if((t=e)&&"object"===o(t)&&"sample_rate"in t&&"samples_per_pixel"in t&&"bits"in t&&"length"in t&&"data"in t&&(e=function(e){var t=e.data,i=e.channels||1,n=8===e.bits?1:2,o=2*e.length*i;if(t.length!==o)throw Error("WaveformData.create(): Length mismatch in JSON waveform data");var s=new ArrayBuffer(24+t.length*n),r=new DataView(s);r.setInt32(0,2,!0),r.setUint32(4,8===e.bits,!0),r.setInt32(8,e.sample_rate,!0),r.setInt32(12,e.samples_per_pixel,!0),r.setInt32(16,e.length,!0),r.setInt32(20,i,!0);var a=24;if(8===e.bits)for(var h=0;h<t.length;h++)r.setInt8(a++,t[h],!0);else for(var l=0;l<t.length;l++)r.setInt16(a,t[l],!0),a+=2;return s}(e)),function(e){var t=e&&"object"===o(e)&&"byteLength"in e;if(t){var i=new DataView(e).getInt32(0,!0);if(1!==i&&2!==i)throw TypeError("WaveformData.create(): This waveform data version not supported")}return t}(e)){this._data=new DataView(e),this._offset=2===this._version()?24:20,this._channels=[];for(var i=0;i<this.channels;i++)this._channels[i]=new n(this,i)}else throw TypeError("WaveformData.create(): Unknown data format")}function l(e,t,i){var n=function(e){for(var t=[],i=0;i<e.numberOfChannels;++i)t.push(e.getChannelData(i).buffer);return t}(e);if(t.disable_worker)i(void 0,new h(function(e){for(var t,i=e.scale,n=e.amplitude_scale,o=e.split_channels,s=e.length,r=e.sample_rate,a=e.channels.map(function(e){return new Float32Array(e)}),h=o?a.length:1,l=(t=Math.floor(s/i),s-t*i>0&&t++,t),d=new ArrayBuffer(24+2*l*(8===e.bits?1:2)*h),_=new DataView(d),u=0,p=24,m=Array(h),g=Array(h),f=0;f<h;f++)m[f]=1/0,g[f]=-1/0;var c=8===e.bits?-128:-32768,v=8===e.bits?127:32767;_.setInt32(0,2,!0),_.setUint32(4,8===e.bits,!0),_.setInt32(8,r,!0),_.setInt32(12,i,!0),_.setInt32(16,l,!0),_.setInt32(20,h,!0);for(var y=0;y<s;y++){var b=0;if(1===h){for(var w=0;w<a.length;++w)b+=a[w][y];(b=Math.floor(v*b*n/a.length))<m[0]&&(m[0]=b,m[0]<c&&(m[0]=c)),b>g[0]&&(g[0]=b,g[0]>v&&(g[0]=v))}else for(var S=0;S<h;++S)(b=Math.floor(v*a[S][y]*n))<m[S]&&(m[S]=b,m[S]<c&&(m[S]=c)),b>g[S]&&(g[S]=b,g[S]>v&&(g[S]=v));if(++u===i){for(var T=0;T<h;T++)8===e.bits?(_.setInt8(p++,m[T]),_.setInt8(p++,g[T])):(_.setInt16(p,m[T],!0),_.setInt16(p+2,g[T],!0),p+=4),m[T]=1/0,g[T]=-1/0;u=0}}if(u>0)for(var k=0;k<h;k++)8===e.bits?(_.setInt8(p++,m[k]),_.setInt8(p++,g[k])):(_.setInt16(p,m[k],!0),_.setInt16(p+2,g[k],!0));return d}({scale:t.scale,bits:t.bits,amplitude_scale:t.amplitude_scale,split_channels:t.split_channels,length:e.length,sample_rate:e.sampleRate,channels:n})),e);else{var o=new a;o.onmessage=function(t){i(void 0,new h(t.data),e)},o.postMessage({scale:t.scale,bits:t.bits,amplitude_scale:t.amplitude_scale,split_channels:t.split_channels,length:e.length,sample_rate:e.s
2ampleRate,channels:n},n)}}function d(e){this._inputData=e.waveformData,this._output_samples_per_pixel=e.scale,this._scale=this._inputData.scale,this._input_buffer_size=this._inputData.length;var t=Math.ceil(this._input_buffer_size*this._inputData.scale/this._output_samples_per_pixel),i=8===this._inputData.bits?1:2,n=24+2*t*this._inputData.channels*i;this._output_data=new ArrayBuffer(n),this.output_dataview=new DataView(this._output_data),this.output_dataview.setInt32(0,2,!0),this.output_dataview.setUint32(4,8===this._inputData.bits,!0),this.output_dataview.setInt32(8,this._inputData.sample_rate,!0),this.output_dataview.setInt32(12,this._output_samples_per_pixel,!0),this.output_dataview.setInt32(16,t,!0),this.output_dataview.setInt32(20,this._inputData.channels,!0),this._outputWaveformData=new h(this._output_data),this._input_index=0,this._output_index=0;var o=this._inputData.channels;this._min=Array(o),this._max=Array(o);for(var s=0;s<o;++s)this._input_buffer_size>0?(this._min[s]=this._inputData.channel(s).min_sample(this._input_index),this._max[s]=this._inputData.channel(s).max_sample(this._input_index)):(this._min[s]=0,this._max[s]=0);this._min_value=8===this._inputData.bits?-128:-32768,this._max_value=8===this._inputData.bits?127:32767,this._where=0,this._prev_where=0,this._stop=0,this._last_input_index=0}h.create=function(e){return new h(e)},h.createFromAudio=function(e,t){var i={scale:e.scale||512,bits:e.bits||8,amplitude_scale:e.amplitude_scale||1,split_channels:e.split_channels||!1,disable_worker:e.disable_worker||!1};if(e.audio_context&&e.array_buffer)return function(e,t,i,n){function o(e){e||(e=new DOMException("EncodingError")),n(e),n=function(){}}var s=e.decodeAudioData(t,function(e){l(e,i,n)},o);s&&s.catch(o)}(e.audio_context,e.array_buffer,i,t);if(e.audio_buffer)return l(e.audio_buffer,i,t);throw TypeError("WaveformData.createFromAudio(): Pass either an AudioContext and ArrayBuffer, or an AudioBuffer object")},d.prototype.sample_at_pixel=function(e){return Math.floor(e*this._output_samples_per_pixel)},d.prototype.next=function(){for(var e,t=0,i=this._inputData.channels;this._input_index<this._input_buffer_size&&t<1e3;){for(;Math.floor(this.sample_at_pixel(this._output_index)/this._scale)===this._input_index;){if(this._output_index>0)for(var n=0;n<i;++n)(e=this._outputWaveformData.channel(n)).set_min_sample(this._output_index-1,this._min[n]),e.set_max_sample(this._output_index-1,this._max[n]);if(this._last_input_index=this._input_index,this._output_index++,this._where=this.sample_at_pixel(this._output_index),this._prev_where=this.sample_at_pixel(this._output_index-1),this._where!==this._prev_where)for(var o=0;o<i;++o)this._min[o]=this._max_value,this._max[o]=this._min_value}for(this._where=this.sample_at_pixel(this._output_index),this._stop=Math.floor(this._where/this._scale),this._stop>this._input_buffer_size&&(this._stop=this._input_buffer_size);this._input_index<this._stop;){for(var s=0;s<i;++s){var r=(e=this._inputData.channel(s)).min_sample(this._input_index);r<this._min[s]&&(this._min[s]=r),(r=e.max_sample(this._input_index))>this._max[s]&&(this._max[s]=r)}this._input_index++}t++}if(this._input_index<this._input_buffer_size)return!1;if(this._input_index!==this._last_input_index)for(var a=0;a<i;++a)(e=this._outputWaveformData.channel(a)).set_min_sample(this._output_index-1,this._min[a]),e.set_max_sample(this._output_index-1,this._max[a]);return!0},d.prototype.getOutputData=function(){return this._output_data},h.prototype={_getResampleOptions:function(e){var t={};if(t.scale=e.scale,t.width=e.width,!s(t.width)&&("number"!=typeof t.width||t.width<=0))throw RangeError("WaveformData.resample(): width should be a positive integer value");if(!s(t.scale)&&("number"!=typeof t.scale||t.scale<=0))throw RangeError("WaveformData.resample(): scale should be a positive integer value");if(!t.scale&&!t.width)throw Error("WaveformData.resample(): Missing scale or width option");if(t.width&&(t.scale=Math.floor(this.duration*this.sample_rate/t.width)),t.scale<this.scale)throw Error("WaveformData.resample(): Zoom level "+t.scale+" too low, minimum: "+this.scale);return t.abortSignal=e.abortSignal,t},resample:function(e){(e=this._getResampleOptions(e)).waveformData=this;for(var t=new d(e);!t.next(););return new h(t.getOutputData())},concat:function(){var e=this,t=Array.prototype.slice.call(arguments);t.forEach(function(t){if(e.channels!==t.channels||e.sample_rate!==t.sample_rate||e.bits!==t.bits||e.scale!==t.scale)throw Error("WaveformData.concat(): Waveforms are incompatible")});var i=this._concatBuffers.apply(this,t);return h.create(i)},_concatBuffers:function(){for(var e=Array.prototype.slice.call(arguments),t=this._offset,i=t,n=0,o=[this].concat(e).map(function(e){return e._data.buffer}),s=0;s<o.length;s++){var r=o[s],a=new DataView(r).getInt32(16,!0);i+=r.byteLength-t,n+=a}for(var h=new ArrayBuffer(i),l=new DataView(o[0]),d=new DataView(
2h),_=0;_<t;_++)d.setUint8(_,l.getUint8(_));d.setInt32(16,n,!0);for(var u=0,p=new Uint8Array(h,t),m=0;m<o.length;m++){var g=o[m];p.set(new Uint8Array(g,t),u),u+=g.byteLength-t}return h},slice:function(e){var t=0,i=0;if(s(e.startIndex)||s(e.endIndex)?s(e.startTime)||s(e.endTime)||(t=this.at_time(e.startTime),i=this.at_time(e.endTime)):(t=e.startIndex,i=e.endIndex),t<0)throw RangeError("startIndex or startTime must not be negative");if(i<0)throw RangeError("endIndex or endTime must not be negative");t>this.length&&(t=this.length),i>this.length&&(i=this.length),t>i&&(t=i);var n=i-t,o=8===this.bits?1:2,r=new ArrayBuffer(24+2*n*this.channels*o),a=new DataView(r);a.setInt32(0,2,!0),a.setUint32(4,8===this.bits,!0),a.setInt32(8,this.sample_rate,!0),a.setInt32(12,this.scale,!0),a.setInt32(16,n,!0),a.setInt32(20,this.channels,!0);for(var l=0;l<n*this.channels*2;l++){var d=this._at(t*this.channels*2+l);8===this.bits?a.setInt8(24+l,d):a.setInt16(24+2*l,d,!0)}return new h(r)},_version:function(){return this._data.getInt32(0,!0)},get length(){return this._data.getUint32(16,!0)},get bits(){return this._data.getUint32(4,!0)?8:16},get duration(){return this.length*this.scale/this.sample_rate},get pixels_per_second(){return this.sample_rate/this.scale},get seconds_per_pixel(){return this.scale/this.sample_rate},get channels(){return 2===this._version()?this._data.getInt32(20,!0):1},channel:function(e){if(e>=0&&e<this._channels.length)return this._channels[e];throw RangeError("Invalid channel: "+e)},get sample_rate(){return this._data.getInt32(8,!0)},get scale(){return this._data.getInt32(12,!0)},_at:function(e){return 8===this.bits?this._data.getInt8(this._offset+e):this._data.getInt16(this._offset+2*e,!0)},_set_at:function(e,t){return 8===this.bits?this._data.setInt8(this._offset+e,t):this._data.setInt16(this._offset+2*e,t,!0)},at_time:function(e){return Math.floor(e*this.sample_rate/this.scale)},time:function(e){return e*this.scale/this.sample_rate},toJSON:function(){for(var e={version:2,channels:this.channels,sample_rate:this.sample_rate,samples_per_pixel:this.scale,bits:this.bits,length:this.length,data:[]},t=0;t<this.length;t++)for(var i=0;i<this.channels;i++)e.data.push(this.channel(i).min_sample(t)),e.data.push(this.channel(i).max_sample(t));return e},toArrayBuffer:function(){return this._data.buffer}}},73995:function(e,t,i){"use strict";function n(e){let t=e||void 0!==globalThis.window&&globalThis;return!!(t&&(/Chromatic/.test(t.navigator.userAgent)||/chromatic=true/.test(t.location.href)))}i.d(t,{A:function(){return n}})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.