forked from MaxLaumeister/bitlisten
-
Notifications
You must be signed in to change notification settings - Fork 3
/
bitlisten.min.js
4 lines (3 loc) · 64.2 KB
/
bitlisten.min.js
1
2
3
4
/*! BitListen Copyright (c) 2023 Maximillian Laumeister, see README.md for license info. */
var Konami=function(e){var t={addEvent:function(e,t,n,o){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&(e["e"+t+n]=n,e[t+n]=function(){e["e"+t+n](window.event,o)},e.attachEvent("on"+t,e[t+n]))},input:"",pattern:"38384040373937396665",load:function(e){this.addEvent(document,"keydown",function(n,o){if(o&&(t=o),t.input+=n?n.keyCode:event.keyCode,t.input.length>t.pattern.length&&(t.input=t.input.substr(t.input.length-t.pattern.length)),t.input==t.pattern)return t.code(e),t.input="",n.preventDefault(),!1},this),this.iphone.load(e)},code:function(e){window.location=e},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP"],code:function(e){t.code(e)},load:function(e){this.orig_keys=this.keys,t.addEvent(document,"touchmove",function(e){if(1==e.touches.length&&1==t.iphone.capture){var n=e.touches[0];t.iphone.stop_x=n.pageX,t.iphone.stop_y=n.pageY,t.iphone.tap=!1,t.iphone.capture=!1,t.iphone.check_direction()}}),t.addEvent(document,"touchend",function(n){1==t.iphone.tap&&t.iphone.check_direction(e)},!1),t.addEvent(document,"touchstart",function(e){t.iphone.start_x=e.changedTouches[0].pageX,t.iphone.start_y=e.changedTouches[0].pageY,t.iphone.tap=!0,t.iphone.capture=!0})},check_direction:function(e){x_magnitude=Math.abs(this.start_x-this.stop_x),y_magnitude=Math.abs(this.start_y-this.stop_y),x=this.start_x-this.stop_x<0?"RIGHT":"LEFT",y=this.start_y-this.stop_y<0?"DOWN":"UP",result=x_magnitude>y_magnitude?x:y,result=1==this.tap?"TAP":result,result==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length)),0==this.keys.length&&(this.keys=this.orig_keys,this.code(e))}}};return"string"==typeof e&&t.load(e),"function"==typeof e&&(t.code=e,t.load()),t};function surrogateCtor(){}function extend(e,t){surrogateCtor.prototype=e.prototype,t.prototype=new surrogateCtor,t.prototype.constructor=t}function Block(e,t,n,o){Floatable.call(this);const i=n.toLocaleString("en-GB",{maximumFractionDigits:2})+" PIV",r=(o/1e3).toLocaleString("en-GB",{maximumFractionDigits:2})+" KB";this.width=this.height=300,this.addImage("block",this.width,this.height),this.addText("Block #"+e.toLocaleString("en-GB")+"<br />Number of Transactions: "+t+"<br />Transaction Volume: "+i+"<br />Block Size: "+r),this.initPosition(),Sound.playRandomSwell()}function Floatable(){this.velocity={x:0,y:-1},this.pageDiv=document.getElementById("bubbleDiv"),this.updateContainerSize(),this.div=document.createElement("div"),this.div.className="floatableDiv",this.pageDiv.appendChild(this.div),this.innerDiv=document.createElement("div"),this.div.appendChild(this.innerDiv),this.innerDiv.className="innerDiv",updateTargets.push(this)}!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||t;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=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 n=this||t;if(e=parseFloat(e),n.ctx||l(),void 0!==e&&e>=0&&e<=1){if(n._volume=e,n._muted)return n;n.usingWebAudio&&n.masterGain.gain.setValueAtTime(e,t.ctx.currentTime);for(var o=0;o<n._howls.length;o++)if(!n._howls[o]._webAudio)for(var i=n._howls[o]._getSoundIds(),r=0;r<i.length;r++){var a=n._howls[o]._soundById(i[r]);a&&a._node&&(a._node.volume=a._volume*e)}return n}return n._volume},mute:function(e){var n=this||t;n.ctx||l(),n._muted=e,n.usingWebAudio&&n.masterGain.gain.setValueAtTime(e?0:n._volume,t.ctx.currentTime);for(var o=0;o<n._howls.length;o++)if(!n._howls[o]._webAudio)for(var i=n._howls[o]._getSoundIds(),r=0;r<i.length;r++){var a=n._howls[o]._soundById(i[r]);a&&a._node&&(a._node.muted=!!e||a._muted)}return n},unload:function(){for(var e=this||t,n=e._howls.length-1;n>=0;n--)e._howls[n].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,l()),e},codecs:function(e){return(this||t)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||t;if(e.state=e.ctx&&e.ctx.state||"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(e._canPlayEvent="canplay")}catch(t){e.noAudio=!0}else e.noAudio=!0;try{(new Audio).muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||t,n=null;try{n="undefined"!=typeof Audio?new Audio:null}catch(t){return e}if(!n||"function"!=typeof n.canPlayType)return e;var o=n.canPlayType("audio/mpeg;").replace(/^no$/,""),i=e._navigator&&e._navigator.userAgent.match(/OPR\/([0-6].)/g),r=i&&parseInt(i[0].split("/")[1],10)<33;return e._codecs={mp3:!(r||!o&&!n.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!o,opus:!!n.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!n.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!n.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!n.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(n.canPlayType("audio/x-m4a;")||n.canPlayType("audio/m4a;")||n.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(n.canPlayType("audio/x-mp4;")||n.canPlayType("audio/mp4;")||n.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!n.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!n.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!n.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(n.canPlayType("audio/x-flac;")||n.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||t;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 n=function(t){for(var o=0;o<e.html5PoolSize;o++)try{var i=new Audio;i._unlocked=!0,e._releaseHtml5Audio(i)}catch(t){e.noAudio=!0}for(o=0;o<e._howls.length;o++)if(!e._howls[o]._webAudio)for(var r=e._howls[o]._getSoundIds(),a=0;a<r.length;a++){var s=e._howls[o]._soundById(r[a]);s&&s._node&&!s._node._unlocked&&(s._node._unlocked=!0,s._node.load())}e._autoResume();var u=e.ctx.createBufferSource();u.buffer=e._scratchBuffer,u.connect(e.ctx.destination),void 0===u.start?u.noteOn(0):u.start(0),"function"==typeof e.ctx.resume&&e.ctx.resume(),u.onended=function(){u.disconnect(0),e._audioUnlocked=!0,document.removeEventListener("touchstart",n,!0),document.removeEventListener("touchend",n,!0),document.removeEventListener("click",n,!0);for(var t=0;t<e._howls.length;t++)e._howls[t]._emit("unlock")}};return document.addEventListener("touchstart",n,!0),document.addEventListener("touchend",n,!0),document.addEventListener("click",n,!0),e}},_obtainHtml5Audio:function(){var e=this||t;if(e._html5AudioPool.length)return e._html5AudioPool.pop();var n=(new Audio).play();return n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)&&n.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(e){var n=this||t;return e._unlocked&&n._html5AudioPool.push(e),n},_autoSuspend:function(){var e=this;if(e.autoSuspend&&e.ctx&&void 0!==e.ctx.suspend&&t.usingWebAudio){for(var n=0;n<e._howls.length;n++)if(e._howls[n]._webAudio)for(var o=0;o<e._howls[n]._sounds.length;o++)if(!e._howls[n]._sounds[o]._paused)return e;return e._suspendTimer&&clearTimeout(e._suspendTimer),e._suspendTimer=setTimeout(function(){e.autoSuspend&&(e._suspendTimer=null,e.state="suspending",e.ctx.suspend().then(function(){e.state="suspended",e._resumeAfterSuspend&&(delete e._resumeAfterSuspend,e._autoResume())}))},3e4),e}},_autoResume:function(){var e=this;if(e.ctx&&void 0!==e.ctx.resume&&t.usingWebAudio)return"running"===e.state&&e._suspendTimer?(clearTimeout(e._suspendTimer),e._suspendTimer=null):"suspended"===e.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 t=new e,n=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.")};n.prototype={init:function(e){var n=this;return t.ctx||l(),n._autoplay=e.autoplay||!1,n._format="string"!=typeof e.format?e.format:[e.format],n._html5=e.html5||!1,n._muted=e.mute||!1,n._loop=e.loop||!1,n._pool=e.pool||5,n._preload="boolean"!=typeof e.preload||e.preload,n._rate=e.rate||1,n._sprite=e.sprite||{},n._src="string"!=typeof e.src?e.src:[e.src],n._volume=void 0!==e.volume?e.volume:1,n._xhrWithCredentials=e.xhrWithCredentials||!1,n._duration=0,n._state="unloaded",n._sounds=[],n._endTimers={},n._queue=[],n._playLock=!1,n._onend=e.onend?[{fn:e.onend}]:[],n._onfade=e.onfade?[{fn:e.onfade}]:[],n._onload=e.onload?[{fn:e.onload}]:[],n._onloaderror=e.onloaderror?[{fn:e.onloaderror}]:[],n._onplayerror=e.onplayerror?[{fn:e.onplayerror}]:[],n._onpause=e.onpause?[{fn:e.onpause}]:[],n._onplay=e.onplay?[{fn:e.onplay}]:[],n._onstop=e.onstop?[{fn:e.onstop}]:[],n._onmute=e.onmute?[{fn:e.onmute}]:[],n._onvolume=e.onvolume?[{fn:e.onvolume}]:[],n._onrate=e.onrate?[{fn:e.onrate}]:[],n._onseek=e.onseek?[{fn:e.onseek}]:[],n._onunlock=e.onunlock?[{fn:e.onunlock}]:[],n._onresume=[],n._webAudio=t.usingWebAudio&&!n._html5,void 0!==t.ctx&&t.ctx&&t.autoUnlock&&t._unlockAudio(),t._howls.push(n),n._autoplay&&n._queue.push({event:"play",action:function(){n.play()}}),n._preload&&n.load(),n},load:function(){var e=this,n=null;if(!t.noAudio){"string"==typeof e._src&&(e._src=[e._src]);for(var i=0;i<e._src.length;i++){var a,s;if(e._format&&e._format[i])a=e._format[i];else{if("string"!=typeof(s=e._src[i])){e._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(a=/^data:audio\/([^;,]+);/i.exec(s))||(a=/\.([^.]+)$/.exec(s.split("?",1)[0])),a&&(a=a[1].toLowerCase())}if(a||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),a&&t.codecs(a)){n=e._src[i];break}}return n?(e._src=n,e._state="loading","https:"===window.location.protocol&&"http:"===n.slice(0,5)&&(e._html5=!0,e._webAudio=!1),new o(e),e._webAudio&&r(e),e):void e._emit("loaderror",null,"No codec support for selected audio sources.")}e._emit("loaderror",null,"No audio support.")},play:function(e,n){var o=this,i=null;if("number"==typeof e)i=e,e=null;else{if("string"==typeof e&&"loaded"===o._state&&!o._sprite[e])return null;if(void 0===e&&(e="__default",!o._playLock)){for(var r=0,a=0;a<o._sounds.length;a++)o._sounds[a]._paused&&!o._sounds[a]._ended&&(r++,i=o._sounds[a]._id);1===r?e=null:i=null}}var s=i?o._soundById(i):o._inactiveSound();if(!s)return null;if(i&&!e&&(e=s._sprite||"__default"),"loaded"!==o._state){s._sprite=e,s._ended=!1;var u=s._id;return o._queue.push({event:"play",action:function(){o.play(u)}}),u}if(i&&!s._paused)return n||o._loadQueue("play"),s._id;o._webAudio&&t._autoResume();var l=Math.max(0,s._seek>0?s._seek:o._sprite[e][0]/1e3),d=Math.max(0,(o._sprite[e][0]+o._sprite[e][1])/1e3-l),c=1e3*d/Math.abs(s._rate),p=o._sprite[e][0]/1e3,_=(o._sprite[e][0]+o._sprite[e][1])/1e3;s._sprite=e,s._ended=!1;var f=function(){s._paused=!1,s._seek=l,s._start=p,s._stop=_,s._loop=!(!s._loop&&!o._sprite[e][2])};if(!(l>=_)){var h=s._node;if(o._webAudio){var m=function(){o._playLock=!1,f(),o._refreshBuffer(s);var e=s._muted||o._muted?0:s._volume;h.gain.setValueAtTime(e,t.ctx.currentTime),s._playStart=t.ctx.currentTime,void 0===h.bufferSource.start?s._loop?h.bufferSource.noteGrainOn(0,l,86400):h.bufferSource.noteGrainOn(0,l,d):s._loop?h.bufferSource.start(0,l,86400):h.bufferSource.start(0,l,d),c!==1/0&&(o._endTimers[s._id]=setTimeout(o._ended.bind(o,s),c)),n||setTimeout(function(){o._emit("play",s._id),o._loadQueue()},0)};"running"===t.state?m():(o._playLock=!0,o.once("resume",m),o._clearTimer(s._id))}else{var v=function(){h.currentTime=l,h.muted=s._muted||o._muted||t._muted||h.muted,h.volume=s._volume*t.volume(),h.playbackRate=s._rate;try{var i=h.play();if(i&&"undefined"!=typeof Promise&&(i instanceof Promise||"function"==typeof i.then)?(o._playLock=!0,f(),i.then(function(){o._playLock=!1,h._unlocked=!0,n||(o._emit("play",s._id),o._loadQueue())}).catch(function(){o._playLock=!1,o._emit("playerror",s._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."),s._ended=!0,s._paused=!0})):n||(o._playLock=!1,f(),o._emit("play",s._id),o._loadQueue()),h.playbackRate=s._rate,h.paused)return void o._emit("playerror",s._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||s._loop?o._endTimers[s._id]=setTimeout(o._ended.bind(o,s),c):(o._endTimers[s._id]=function(){o._ended(s),h.removeEventListener("ended",o._endTimers[s._id],!1)},h.addEventListener("ended",o._endTimers[s._id],!1))}catch(e){o._emit("playerror",s._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===h.src&&(h.src=o._src,h.load());var g=window&&window.ejecta||!h.readyState&&t._navigator.isCocoonJS;if(h.readyState>=3||g)v();else{o._playLock=!0;var y=function(){v(),h.removeEventListener(t._canPlayEvent,y,!1)};h.addEventListener(t._canPlayEvent,y,!1),o._clearTimer(s._id)}}return s._id}o._ended(s)},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 n=t._getSoundIds(e),o=0;o<n.length;o++){t._clearTimer(n[o]);var i=t._soundById(n[o]);if(i&&!i._paused&&(i._seek=t.seek(n[o]),i._rateSeek=0,i._paused=!0,t._stopFade(n[o]),i._node))if(t._webAudio){if(!i._node.bufferSource)continue;void 0===i._node.bufferSource.stop?i._node.bufferSource.noteOff(0):i._node.bufferSource.stop(0),t._cleanBuffer(i._node)}else isNaN(i._node.duration)&&i._node.duration!==1/0||i._node.pause();arguments[1]||t._emit("pause",i?i._id:null)}return t},stop:function(e,t){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(e)}}),n;for(var o=n._getSoundIds(e),i=0;i<o.length;i++){n._clearTimer(o[i]);var r=n._soundById(o[i]);r&&(r._seek=r._start||0,r._rateSeek=0,r._paused=!0,r._ended=!0,n._stopFade(o[i]),r._node&&(n._webAudio?r._node.bufferSource&&(void 0===r._node.bufferSource.stop?r._node.bufferSource.noteOff(0):r._node.bufferSource.stop(0),n._cleanBuffer(r._node)):isNaN(r._node.duration)&&r._node.duration!==1/0||(r._node.currentTime=r._start||0,r._node.pause(),r._node.duration===1/0&&n._clearSound(r._node))),t||n._emit("stop",r._id))}return n},mute:function(e,n){var o=this;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"mute",action:function(){o.mute(e,n)}}),o;if(void 0===n){if("boolean"!=typeof e)return o._muted;o._muted=e}for(var i=o._getSoundIds(n),r=0;r<i.length;r++){var a=o._soundById(i[r]);a&&(a._muted=e,a._interval&&o._stopFade(a._id),o._webAudio&&a._node?a._node.gain.setValueAtTime(e?0:a._volume,t.ctx.currentTime):a._node&&(a._node.muted=!!t._muted||e),o._emit("mute",a._id))}return o},volume:function(){var e,n,o,i=this,r=arguments;if(0===r.length)return i._volume;if(1===r.length||2===r.length&&void 0===r[1]?i._getSoundIds().indexOf(r[0])>=0?n=parseInt(r[0],10):e=parseFloat(r[0]):r.length>=2&&(e=parseFloat(r[0]),n=parseInt(r[1],10)),!(void 0!==e&&e>=0&&e<=1))return(o=n?i._soundById(n):i._sounds[0])?o._volume:0;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"volume",action:function(){i.volume.apply(i,r)}}),i;void 0===n&&(i._volume=e),n=i._getSoundIds(n);for(var a=0;a<n.length;a++)(o=i._soundById(n[a]))&&(o._volume=e,r[2]||i._stopFade(n[a]),i._webAudio&&o._node&&!o._muted?o._node.gain.setValueAtTime(e,t.ctx.currentTime):o._node&&!o._muted&&(o._node.volume=e*t.volume()),i._emit("volume",o._id));return i},fade:function(e,n,o,i){var r=this;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"fade",action:function(){r.fade(e,n,o,i)}}),r;e=parseFloat(e),n=parseFloat(n),o=parseFloat(o),r.volume(e,i);for(var a=r._getSoundIds(i),s=0;s<a.length;s++){var u=r._soundById(a[s]);if(u){if(i||r._stopFade(a[s]),r._webAudio&&!u._muted){var l=t.ctx.currentTime,d=l+o/1e3;u._volume=e,u._node.gain.setValueAtTime(e,l),u._node.gain.linearRampToValueAtTime(n,d)}r._startFadeInterval(u,e,n,o,a[s],void 0===i)}}return r},_startFadeInterval:function(e,t,n,o,i,r){var a=this,s=t,u=n-t,l=Math.abs(u/.01),d=Math.max(4,l>0?o/l:o),c=Date.now();e._fadeTo=n,e._interval=setInterval(function(){var i=(Date.now()-c)/o;c=Date.now(),s+=u*i,s=Math.max(0,s),s=Math.min(1,s),s=Math.round(100*s)/100,a._webAudio?e._volume=s:a.volume(s,e._id,!0),r&&(a._volume=s),(n<t&&s<=n||n>t&&s>=n)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,a.volume(n,e._id),a._emit("fade",e._id))},d)},_stopFade:function(e){var n=this,o=n._soundById(e);return o&&o._interval&&(n._webAudio&&o._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(o._interval),o._interval=null,n.volume(o._fadeTo,e),o._fadeTo=null,n._emit("fade",e)),n},loop:function(){var e,t,n,o=this,i=arguments;if(0===i.length)return o._loop;if(1===i.length){if("boolean"!=typeof i[0])return!!(n=o._soundById(parseInt(i[0],10)))&&n._loop;e=i[0],o._loop=e}else 2===i.length&&(e=i[0],t=parseInt(i[1],10));for(var r=o._getSoundIds(t),a=0;a<r.length;a++)(n=o._soundById(r[a]))&&(n._loop=e,o._webAudio&&n._node&&n._node.bufferSource&&(n._node.bufferSource.loop=e,e&&(n._node.bufferSource.loopStart=n._start||0,n._node.bufferSource.loopEnd=n._stop)));return o},rate:function(){var e,n,o,i=this,r=arguments;if(0===r.length)n=i._sounds[0]._id;else if(1===r.length){i._getSoundIds().indexOf(r[0])>=0?n=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),n=parseInt(r[1],10));if("number"!=typeof e)return(o=i._soundById(n))?o._rate:i._rate;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"rate",action:function(){i.rate.apply(i,r)}}),i;void 0===n&&(i._rate=e),n=i._getSoundIds(n);for(var a=0;a<n.length;a++)if(o=i._soundById(n[a])){i.playing(n[a])&&(o._rateSeek=i.seek(n[a]),o._playStart=i._webAudio?t.ctx.currentTime:o._playStart),o._rate=e,i._webAudio&&o._node&&o._node.bufferSource?o._node.bufferSource.playbackRate.setValueAtTime(e,t.ctx.currentTime):o._node&&(o._node.playbackRate=e);var s=i.seek(n[a]),u=1e3*((i._sprite[o._sprite][0]+i._sprite[o._sprite][1])/1e3-s)/Math.abs(o._rate);!i._endTimers[n[a]]&&o._paused||(i._clearTimer(n[a]),i._endTimers[n[a]]=setTimeout(i._ended.bind(i,o),u)),i._emit("rate",o._id)}return i},seek:function(){var e,n,o=this,i=arguments;if(0===i.length)n=o._sounds[0]._id;else if(1===i.length){o._getSoundIds().indexOf(i[0])>=0?n=parseInt(i[0],10):o._sounds.length&&(n=o._sounds[0]._id,e=parseFloat(i[0]))}else 2===i.length&&(e=parseFloat(i[0]),n=parseInt(i[1],10));if(void 0===n)return o;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"seek",action:function(){o.seek.apply(o,i)}}),o;var r=o._soundById(n);if(r){if(!("number"==typeof e&&e>=0)){if(o._webAudio){var a=o.playing(n)?t.ctx.currentTime-r._playStart:0,s=r._rateSeek?r._rateSeek-r._seek:0;return r._seek+(s+a*Math.abs(r._rate))}return r._node.currentTime}var u=o.playing(n);u&&o.pause(n,!0),r._seek=e,r._ended=!1,o._clearTimer(n),o._webAudio||!r._node||isNaN(r._node.duration)||(r._node.currentTime=e);var l=function(){o._emit("seek",n),u&&o.play(n,!0)};if(u&&!o._webAudio){var d=function(){o._playLock?setTimeout(d,0):l()};setTimeout(d,0)}else l()}return o},playing:function(e){var t=this;if("number"==typeof e){var n=t._soundById(e);return!!n&&!n._paused}for(var o=0;o<t._sounds.length;o++)if(!t._sounds[o]._paused)return!0;return!1},duration:function(e){var t=this,n=t._duration,o=t._soundById(e);return o&&(n=t._sprite[o._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var e=this,n=e._sounds,o=0;o<n.length;o++)n[o]._paused||e.stop(n[o]._id),e._webAudio||(e._clearSound(n[o]._node),n[o]._node.removeEventListener("error",n[o]._errorFn,!1),n[o]._node.removeEventListener(t._canPlayEvent,n[o]._loadFn,!1),t._releaseHtml5Audio(n[o]._node)),delete n[o]._node,e._clearTimer(n[o]._id);var r=t._howls.indexOf(e);r>=0&&t._howls.splice(r,1);var a=!0;for(o=0;o<t._howls.length;o++)if(t._howls[o]._src===e._src||e._src.indexOf(t._howls[o]._src)>=0){a=!1;break}return i&&a&&delete i[e._src],t.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,t,n,o){var i=this["_on"+e];return"function"==typeof t&&i.push(o?{id:n,fn:t,once:o}:{id:n,fn:t}),this},off:function(e,t,n){var o=this,i=o["_on"+e],r=0;if("number"==typeof t&&(n=t,t=null),t||n)for(r=0;r<i.length;r++){var a=n===i[r].id;if(t===i[r].fn&&a||!t&&a){i.splice(r,1);break}}else if(e)o["_on"+e]=[];else{var s=Object.keys(o);for(r=0;r<s.length;r++)0===s[r].indexOf("_on")&&Array.isArray(o[s[r]])&&(o[s[r]]=[])}return o},once:function(e,t,n){return this.on(e,t,n,1),this},_emit:function(e,t,n){for(var o=this,i=o["_on"+e],r=i.length-1;r>=0;r--)i[r].id&&i[r].id!==t&&"load"!==e||(setTimeout(function(e){e.call(this,t,n)}.bind(o,i[r].fn),0),i[r].once&&o.off(e,i[r].fn,i[r].id));return o._loadQueue(e),o},_loadQueue:function(e){var t=this;if(t._queue.length>0){var n=t._queue[0];n.event===e&&(t._queue.shift(),t._loadQueue()),e||n.action()}return t},_ended:function(e){var n=this,o=e._sprite;if(!n._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime<e._stop)return setTimeout(n._ended.bind(n,e),100),n;var i=!(!e._loop&&!n._sprite[o][2]);if(n._emit("end",e._id),!n._webAudio&&i&&n.stop(e._id,!0).play(e._id),n._webAudio&&i){n._emit("play",e._id),e._seek=e._start||0,e._rateSeek=0,e._playStart=t.ctx.currentTime;var r=1e3*(e._stop-e._start)/Math.abs(e._rate);n._endTimers[e._id]=setTimeout(n._ended.bind(n,e),r)}return n._webAudio&&!i&&(e._paused=!0,e._ended=!0,e._seek=e._start||0,e._rateSeek=0,n._clearTimer(e._id),n._cleanBuffer(e._node),t._autoSuspend()),n._webAudio||i||n.stop(e._id,!0),n},_clearTimer:function(e){var t=this;if(t._endTimers[e]){if("function"!=typeof t._endTimers[e])clearTimeout(t._endTimers[e]);else{var n=t._soundById(e);n&&n._node&&n._node.removeEventListener("ended",t._endTimers[e],!1)}delete t._endTimers[e]}return t},_soundById:function(e){for(var t=this,n=0;n<t._sounds.length;n++)if(e===t._sounds[n]._id)return t._sounds[n];return null},_inactiveSound:function(){var e=this;e._drain();for(var t=0;t<e._sounds.length;t++)if(e._sounds[t]._ended)return e._sounds[t].reset();return new o(e)},_drain:function(){var e=this,t=e._pool,n=0,o=0;if(!(e._sounds.length<t)){for(o=0;o<e._sounds.length;o++)e._sounds[o]._ended&&n++;for(o=e._sounds.length-1;o>=0;o--){if(n<=t)return;e._sounds[o]._ended&&(e._webAudio&&e._sounds[o]._node&&e._sounds[o]._node.disconnect(0),e._sounds.splice(o,1),n--)}}},_getSoundIds:function(e){if(void 0===e){for(var t=[],n=0;n<this._sounds.length;n++)t.push(this._sounds[n]._id);return t}return[e]},_refreshBuffer:function(e){return e._node.bufferSource=t.ctx.createBufferSource(),e._node.bufferSource.buffer=i[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,t.ctx.currentTime),this},_cleanBuffer:function(e){var n=t._navigator&&t._navigator.vendor.indexOf("Apple")>=0;if(t._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),n))try{e.bufferSource.buffer=t._scratchBuffer}catch(e){}return e.bufferSource=null,this},_clearSound:function(e){/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(e){this._parent=e,this.init()};o.prototype={init:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._rate=n._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++t._counter,n._sounds.push(e),e.create(),e},create:function(){var e=this,n=e._parent,o=t._muted||e._muted||e._parent._muted?0:e._volume;return n._webAudio?(e._node=void 0===t.ctx.createGain?t.ctx.createGainNode():t.ctx.createGain(),e._node.gain.setValueAtTime(o,t.ctx.currentTime),e._node.paused=!0,e._node.connect(t.masterGain)):t.noAudio||(e._node=t._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(t._canPlayEvent,e._loadFn,!1),e._node.src=n._src,e._node.preload="auto",e._node.volume=o*t.volume(),e._node.load()),e},reset:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._rate=n._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++t._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,n=e._parent;n._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(n._sprite).length&&(n._sprite={__default:[0,1e3*n._duration]}),"loaded"!==n._state&&(n._state="loaded",n._emit("load"),n._loadQueue()),e._node.removeEventListener(t._canPlayEvent,e._loadFn,!1)}};var i={},r=function(e){var t=e._src;if(i[t])return e._duration=i[t].duration,void u(e);if(/^data:[^;]+;base64,/.test(t)){for(var n=atob(t.split(",")[1]),o=new Uint8Array(n.length),r=0;r<n.length;++r)o[r]=n.charCodeAt(r);s(o.buffer,e)}else{var l=new XMLHttpRequest;l.open("GET",t,!0),l.withCredentials=e._xhrWithCredentials,l.responseType="arraybuffer",l.onload=function(){var t=(l.status+"")[0];"0"===t||"2"===t||"3"===t?s(l.response,e):e._emit("loaderror",null,"Failed loading audio file with status: "+l.status+".")},l.onerror=function(){e._webAudio&&(e._html5=!0,e._webAudio=!1,e._sounds=[],delete i[t],e.load())},a(l)}},a=function(e){try{e.send()}catch(t){e.onerror()}},s=function(e,n){var o=function(){n._emit("loaderror",null,"Decoding audio data failed.")},r=function(e){e&&n._sounds.length>0?(i[n._src]=e,u(n,e)):o()};"undefined"!=typeof Promise&&1===t.ctx.decodeAudioData.length?t.ctx.decodeAudioData(e).then(r).catch(o):t.ctx.decodeAudioData(e,r,o)},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())},l=function(){if(t.usingWebAudio){try{"undefined"!=typeof AudioContext?t.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch(e){t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),n=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),o=n?parseInt(n[1],10):null;if(e&&o&&o<9){var i=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());(t._navigator&&t._navigator.standalone&&!i||t._navigator&&!t._navigator.standalone&&!i)&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=void 0===t.ctx.createGain?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:t,Howl:n}}),"undefined"!=typeof exports&&(exports.Howler=t,exports.Howl=n),"undefined"!=typeof window?(window.HowlerGlobal=e,window.Howler=t,window.Howl=n,window.Sound=o):"undefined"!=typeof global&&(global.HowlerGlobal=e,global.Howler=t,global.Howl=n,global.Sound=o)}(),function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var t=this;if(!t.ctx||!t.ctx.listener)return t;for(var n=t._howls.length-1;n>=0;n--)t._howls[n].stereo(e);return t},HowlerGlobal.prototype.pos=function(e,t,n){var o=this;return o.ctx&&o.ctx.listener?(t="number"!=typeof t?o._pos[1]:t,n="number"!=typeof n?o._pos[2]:n,"number"!=typeof e?o._pos:(o._pos=[e,t,n],void 0!==o.ctx.listener.positionX?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]),o)):o},HowlerGlobal.prototype.orientation=function(e,t,n,o,i,r){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return t="number"!=typeof t?s[1]:t,n="number"!=typeof n?s[2]:n,o="number"!=typeof o?s[3]:o,i="number"!=typeof i?s[4]:i,r="number"!=typeof r?s[5]:r,"number"!=typeof e?s:(a._orientation=[e,t,n,o,i,r],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(i,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(r,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,t,n,o,i,r),a)},Howl.prototype.init=function(e){return function(t){var n=this;return n._orientation=t.orientation||[1,0,0],n._stereo=t.stereo||null,n._pos=t.pos||null,n._pannerAttr={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:360,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:360,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:0,distanceModel:void 0!==t.distanceModel?t.distanceModel:"inverse",maxDistance:void 0!==t.maxDistance?t.maxDistance:1e4,panningModel:void 0!==t.panningModel?t.panningModel:"HRTF",refDistance:void 0!==t.refDistance?t.refDistance:1,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:1},n._onstereo=t.onstereo?[{fn:t.onstereo}]:[],n._onpos=t.onpos?[{fn:t.onpos}]:[],n._onorientation=t.onorientation?[{fn:t.onorientation}]:[],e.call(this,t)}}(Howl.prototype.init),Howl.prototype.stereo=function(t,n){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"stereo",action:function(){o.stereo(t,n)}}),o;var i=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof t)return o._stereo;o._stereo=t,o._pos=[t,0,0]}for(var r=o._getSoundIds(n),a=0;a<r.length;a++){var s=o._soundById(r[a]);if(s){if("number"!=typeof t)return s._stereo;s._stereo=t,s._pos=[t,0,0],s._node&&(s._pannerAttr.panningModel="equalpower",s._panner&&s._panner.pan||e(s,i),"spatial"===i?void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):s._panner.setPosition(t,0,0):s._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),o._emit("stereo",s._id)}}return o},Howl.prototype.pos=function(t,n,o,i){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"pos",action:function(){r.pos(t,n,o,i)}}),r;if(n="number"!=typeof n?0:n,o="number"!=typeof o?-.5:o,void 0===i){if("number"!=typeof t)return r._pos;r._pos=[t,n,o]}for(var a=r._getSoundIds(i),s=0;s<a.length;s++){var u=r._soundById(a[s]);if(u){if("number"!=typeof t)return u._pos;u._pos=[t,n,o],u._node&&(u._panner&&!u._panner.pan||e(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setPosition(t,n,o)),r._emit("pos",u._id)}}return r},Howl.prototype.orientation=function(t,n,o,i){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"orientation",action:function(){r.orientation(t,n,o,i)}}),r;if(n="number"!=typeof n?r._orientation[1]:n,o="number"!=typeof o?r._orientation[2]:o,void 0===i){if("number"!=typeof t)return r._orientation;r._orientation=[t,n,o]}for(var a=r._getSoundIds(i),s=0;s<a.length;s++){var u=r._soundById(a[s]);if(u){if("number"!=typeof t)return u._orientation;u._orientation=[t,n,o],u._node&&(u._panner||(u._pos||(u._pos=r._pos||[0,0,-.5]),e(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setOrientation(t,n,o)),r._emit("orientation",u._id)}}return r},Howl.prototype.pannerAttr=function(){var t,n,o,i=this,r=arguments;if(!i._webAudio)return i;if(0===r.length)return i._pannerAttr;if(1===r.length){if("object"!=typeof r[0])return(o=i._soundById(parseInt(r[0],10)))?o._pannerAttr:i._pannerAttr;t=r[0],void 0===n&&(t.pannerAttr||(t.pannerAttr={coneInnerAngle:t.coneInnerAngle,coneOuterAngle:t.coneOuterAngle,coneOuterGain:t.coneOuterGain,distanceModel:t.distanceModel,maxDistance:t.maxDistance,refDistance:t.refDistance,rolloffFactor:t.rolloffFactor,panningModel:t.panningModel}),i._pannerAttr={coneInnerAngle:void 0!==t.pannerAttr.coneInnerAngle?t.pannerAttr.coneInnerAngle:i._coneInnerAngle,coneOuterAngle:void 0!==t.pannerAttr.coneOuterAngle?t.pannerAttr.coneOuterAngle:i._coneOuterAngle,coneOuterGain:void 0!==t.pannerAttr.coneOuterGain?t.pannerAttr.coneOuterGain:i._coneOuterGain,distanceModel:void 0!==t.pannerAttr.distanceModel?t.pannerAttr.distanceModel:i._distanceModel,maxDistance:void 0!==t.pannerAttr.maxDistance?t.pannerAttr.maxDistance:i._maxDistance,refDistance:void 0!==t.pannerAttr.refDistance?t.pannerAttr.refDistance:i._refDistance,rolloffFactor:void 0!==t.pannerAttr.rolloffFactor?t.pannerAttr.rolloffFactor:i._rolloffFactor,panningModel:void 0!==t.pannerAttr.panningModel?t.pannerAttr.panningModel:i._panningModel})}else 2===r.length&&(t=r[0],n=parseInt(r[1],10));for(var a=i._getSoundIds(n),s=0;s<a.length;s++)if(o=i._soundById(a[s])){var u=o._pannerAttr;u={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==t.distanceModel?t.distanceModel:u.distanceModel,maxDistance:void 0!==t.maxDistance?t.maxDistance:u.maxDistance,refDistance:void 0!==t.refDistance?t.refDistance:u.refDistance,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:u.rolloffFactor,panningModel:void 0!==t.panningModel?t.panningModel:u.panningModel};var l=o._panner;l?(l.coneInnerAngle=u.coneInnerAngle,l.coneOuterAngle=u.coneOuterAngle,l.coneOuterGain=u.coneOuterGain,l.distanceModel=u.distanceModel,l.maxDistance=u.maxDistance,l.refDistance=u.refDistance,l.rolloffFactor=u.rolloffFactor,l.panningModel=u.panningModel):(o._pos||(o._pos=i._pos||[0,0,-.5]),e(o,"spatial"))}return i},Sound.prototype.init=function(e){return function(){var t=this,n=t._parent;t._orientation=n._orientation,t._stereo=n._stereo,t._pos=n._pos,t._pannerAttr=n._pannerAttr,e.call(this),t._stereo?n.stereo(t._stereo):t._pos&&n.pos(t._pos[0],t._pos[1],t._pos[2],t._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var t=this,n=t._parent;return t._orientation=n._orientation,t._stereo=n._stereo,t._pos=n._pos,t._pannerAttr=n._pannerAttr,t._stereo?n.stereo(t._stereo):t._pos?n.pos(t._pos[0],t._pos[1],t._pos[2],t._id):t._panner&&(t._panner.disconnect(0),t._panner=void 0,n._refreshBuffer(t)),e.call(this)}}(Sound.prototype.reset);var e=function(e,t){"spatial"===(t=t||"spatial")?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}(),function(e){e.fn.qr=function(t){return this.each(function(){var n={size:"230",delay:"0"};t&&e.extend(n,t);var o=e(this);o.qr_div=function(t,n){var o=escape(t);for(;-1!=o.indexOf("/");)o=o.replace("/","%2f");var i=document.createElement("div");return $qr=e(i),$qr.css({background:"url('https://chart.apis.google.com/chart?cht=qr&chs="+n+"x"+n+"&chl="+o+"') no-repeat",width:n+"px",height:n+"px",display:"none","border-style":"solid","border-width":"1px",position:"absolute","z-index":"1000"}),e("body").append($qr),i}(o.attr("qrtarget"),n.size),o.mouseenter(function(t){o.qr_timeout_id=window.setTimeout(function(){e(o.qr_div).css({display:"block",top:t.pageY+5,left:t.pageX+15})},n.delay)}),o.mouseleave(function(t){null!=o.qr_timeout_id&&(window.clearTimeout(o.qr_timeout_id),o.qr_timeout_id=null),e(o.qr_div).css({display:"none"})})})}}(jQuery),function(e){"use strict";var t=e(document),n=".nui",o=e.fn.val,i=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"},r=["noUi-target","noUi-base","noUi-origin","noUi-handle","noUi-horizontal","noUi-vertical","noUi-background","noUi-connect","noUi-ltr","noUi-rtl","noUi-dragable","","noUi-state-drag","","noUi-state-tap","noUi-active","noUi-extended","noUi-stacking"],a=["decimals","mark","thousand","prefix","postfix","encoder","decoder","negative","negativeBefore"],s=[2,".","","","",function(e){return e},function(e){return e},"-",""];function u(e){throw new RangeError("noUiSlider: "+e)}function l(e,t,n){(e[t]||e[n])&&e[t]===e[n]&&u("(Link) '"+t+"' can't match '"+n+"'.'")}function d(e){return Math.max(Math.min(e,100),0)}function c(e,t){return 100/(t-e)}function p(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function _(e,t,n){e.addClass(t),setTimeout(function(){e.removeClass(t)},n)}function f(e,t){return 100*t/(e[1]-e[0])}function h(e,t){if(t>=e.xVal.slice(-1)[0])return 100;for(var n,o,i,r,a=1;t>=e.xVal[a];)a++;return n=e.xVal[a-1],o=e.xVal[a],i=e.xPct[a-1],r=e.xPct[a],i+function(e,t){return f(e,e[0]<0?t+Math.abs(e[0]):t-e[0])}([n,o],t)/c(i,r)}function m(e,t){for(var n,o,i=1;t>=e.xPct[i];)i++;return e.snap?t-(n=e.xPct[i-1])>((o=e.xPct[i])-n)/2?o:n:e.xSteps[i-1]?e.xPct[i-1]+function(e,t){return Math.round(e/t)*t}(t-e.xPct[i-1],e.xSteps[i-1]):t}function v(t){void 0===t&&(t={}),"object"!=typeof t&&u("(Format) 'format' option must be an object.");var n={};e(a).each(function(e,o){var i,r;void 0===t[o]?n[o]=s[e]:(i=t[o],r=s[e],typeof i==typeof r?("decimals"===o&&(t[o]<0||t[o]>7)&&u("(Format) 'format.decimals' option must be between 0 and 7."),n[o]=t[o]):u("(Format) 'format."+o+"' must be a "+typeof s[e]+"."))}),l(n,"mark","thousand"),l(n,"prefix","negative"),l(n,"prefix","negativeBefore"),this.settings=n}function g(t,n){if(!(this instanceof g))throw new Error("Link: Don't use Link as a function. Use the 'new' keyword.");if(!t)throw new RangeError("Link: missing parameters.");this.formatting=t.format||{},this.update=!n;var o,i=this,r=t.target||function(){},a=t.method,s="string"==typeof r&&0===r.indexOf("-tooltip-"),u="string"==typeof r&&0!==r.indexOf("-"),l="function"==typeof r,d=(o=r)instanceof e||e.zepto&&e.zepto.isZ(o),c=d&&r.is("input, select, textarea"),p=d&&"function"==typeof a,_=d&&"string"==typeof a&&r[a];if(s)return this.method=a||"html",void(this.el=e(r.replace("-tooltip-","")||"<div/>")[0]);if(u)return this.method="val",this.el=document.createElement("input"),this.el.name=r,void(this.el.type="hidden");if(l)return this.target=!1,void(this.method=r);if(d){if(a&&(p||_))return this.target=r,void(this.method=a);if(!a&&c)return this.method="val",this.target=r,void this.target.on("change",function(t){var n,o,r,a=(n=null,o=e(t.target).val(),[(r=i.N)?n:o,r?o:n]);i.obj.val(a,{link:i})});if(!a&&!c)return this.method="html",void(this.target=r)}throw new RangeError("Link: Invalid Link.")}function y(e,t){p(t)||u("'step' is not numeric."),e.xSteps[0]=t}function w(t,n){("object"!=typeof n||e.isArray(n))&&u("'range' is not an object."),e.each(n,function(n,o){var i;"number"==typeof o&&(o=[o]),e.isArray(o)||u("'range' contains invalid value."),p(i="min"===n?0:"max"===n?100:parseFloat(n))&&p(o[0])||u("'range' value isn't numeric."),t.xPct.push(i),t.xVal.push(o[0]),i?t.xSteps.push(!isNaN(o[1])&&o[1]):isNaN(o[1])||(t.xSteps[0]=o[1])}),e.each(t.xSteps,function(e,n){if(!n)return!0;t.xSteps[e]=f([t.xVal[e],t.xVal[e+1]],n)/c(t.xPct[e],t.xPct[e+1])})}function b(t,n){"number"==typeof n&&(n=[n]),(!e.isArray(n)||!n.length||n.length>2)&&u("'start' option is incorrect."),t.handles=n.length,t.start=n}function x(e,t){e.snap=t,"boolean"!=typeof t&&u("'snap' option must be a boolean.")}function A(e,t){"lower"===t&&1===e.handles?e.connect=1:"upper"===t&&1===e.handles?e.connect=2:!0===t&&2===e.handles?e.connect=3:!1===t?e.connect=0:u("'connect' option was doesn't match handle count.")}function k(e,t){switch(t){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:u("'orientation' option is invalid.")}}function T(e,t){e.xPct.length>2&&u("'margin' option is only supported on linear sliders."),e.margin=f(e.xVal,t),p(t)||u("'margin' option must be numeric.")}function S(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1,e.connect=[0,2,1,3][e.connect];break;default:u("'direction' option was not recognized.")}}function I(e,t){"string"!=typeof t&&u("'behaviour' must be a string containing options.");var n=t.indexOf("tap")>=0,o=t.indexOf("extend")>=0,i=t.indexOf("drag")>=0,r=t.indexOf("fixed")>=0,a=t.indexOf("snap")>=0;e.events={tap:n||a,extend:o,drag:i,fixed:r,snap:a}}function O(t,n,o){t.ser=[n.lower,n.upper],t.formatting=new v(n.format),e.each(t.ser,function(t,i){e.isArray(i)||u("'serialization."+(t?"upper":"lower")+"' must be an array."),e.each(i,function(){this instanceof g||u("'serialization."+(t?"upper":"lower")+"' can only contain Link instances."),this.N=t,this.obj=o,this.scope=this.scope||o,this.formatting=new v(e.extend({},n.format,this.formatting))})}),t.dir&&t.handles>1&&t.ser.reverse()}function B(t,n){var o=e("<div><div/></div>").addClass(r[2]),i=["-lower","-upper"];return t.dir&&i.reverse(),o.children().addClass(r[3]+" "+r[3]+i[n]),o}function C(t,n){return n.el&&(n=new g({target:e(n.el).clone().appendTo(t),method:n.method,format:n.formatting},!0)),n}function E(e,t,n){var o,i=[];for(i.push(new g({format:n},!0)),o=0;o<e.length;o++)i.push(C(t,e[o]));return i}function M(o,a,s){var u,l,c,p=e(o),f=[-1,-1];function v(){return u[["width","height"][a.ort]]()}function g(e){var t,n=[p.val()];for(t=0;t<e.length;t++)p.trigger(e[t],n)}function y(t,n,o){var i=t[0]!==c[0][0]?1:0,s=f[0]+a.margin,u=f[1]-a.margin;return o&&c.length>1&&(n=i?Math.max(n,s):Math.min(n,u)),n<100&&(n=m(a,n)),(n=d(parseFloat(n.toFixed(7))))===f[i]?1!==c.length&&((n===s||n===u)&&0):(t.css(a.style,n+"%"),t.is(":first-child")&&t.toggleClass(r[17],n>50),f[i]=n,a.dir&&(n=100-n),e(l[i]).each(function(){this.write(a,n,t.children(),p)}),!0)}function w(e,t,n){n||_(p,r[14],300),y(e,t,!1),g(["slide","set","change"])}function b(e,t,o,i){return e=e.replace(/\s/g,n+" ")+n,t.on(e,function(e){var t=p.attr("disabled");if(t=!(void 0===t||null===t),p.hasClass(r[14])||t)return!1;(e=function(e){e.preventDefault();var t,n,o=0===e.type.indexOf("touch"),i=0===e.type.indexOf("mouse"),r=0===e.type.indexOf("pointer"),a=e;return 0===e.type.indexOf("MSPointer")&&(r=!0),e.originalEvent&&(e=e.originalEvent),o&&(t=e.changedTouches[0].pageX,n=e.changedTouches[0].pageY),(i||r)&&(r||void 0!==window.pageXOffset||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=document.documentElement.scrollTop),t=e.clientX+window.pageXOffset,n=e.clientY+window.pageYOffset),a.points=[t,n],a.cursor=i,a}(e)).calcPoint=e.points[a.ort],o(e,i)})}function x(e,t){var n,o,i,r,a,s,u=t.handles||c,l=!1,p=100*(e.calcPoint-t.start)/v(),_=u[0][0]!==c[0][0]?1:0;o=p,i=t.positions,r=u.length>1,a=o+i[0],s=o+i[1],n=r?(a<0&&(s+=Math.abs(a)),s>100&&(a-=s-100),[d(a),d(s)]):[a,s],l=y(u[0],n[_],1===u.length),u.length>1&&(l=y(u[1],n[_?0:1],!1)||l),l&&g(["slide"])}function A(o){e("."+r[15]).removeClass(r[15]),o.cursor&&e("body").css("cursor","").off(n),t.off(n),p.removeClass(r[12]),g(["set","change"])}function k(o,a){1===a.handles.length&&a.handles[0].children().addClass(r[15]),o.stopPropagation(),b(i.move,t,x,{start:o.calcPoint,handles:a.handles,positions:[f[0],f[c.length-1]]}),b(i.end,t,A,null),o.cursor&&(e("body").css("cursor",e(o.target).css("cursor")),c.length>1&&p.addClass(r[12]),e("body").on("selectstart"+n,!1))}function T(t){var n,o=t.calcPoint,i=0;t.stopPropagation(),e.each(c,function(){i+=this.offset()[a.style]}),i=o<i/2||1===c.length?0:1,n=100*(o-=u.offset()[a.style])/v(),w(c[i],n,a.events.snap),a.events.snap&&k(t,{handles:[c[i]]})}function S(e){var t=e.calcPoint<u.offset()[a.style],n=t?0:100;t=t?0:c.length-1,w(c[t],n,!1)}if(!p.is(":empty"))throw new Error("Slider was already initialized.");u=function(t,n){return n.addClass([r[0],r[8+t.dir],r[4+t.ort]].join(" ")),e("<div/>").appendTo(n).addClass(r[1])}(a,p),c=function(e,t){var n,o=[];for(n=0;n<e.handles;n++)o.push(B(e,n).appendTo(t));return o}(a,u),l=function(e,t){var n,o=[];for(n=0;n<e.handles;n++)o[n]=E(e.ser[n],t[n].children(),e.formatting);return o}(a,c),function(e,t,n){switch(e){case 1:t.addClass(r[7]),n[0].addClass(r[6]);break;case 3:n[1].addClass(r[6]);case 2:n[0].addClass(r[7]);case 0:t.addClass(r[6])}}(a.connect,p,c),function(e){var t,n;if(!e.fixed)for(t=0;t<c.length;t++)b(i.start,c[t].children(),k,{handles:[c[t]]});e.tap&&b(i.start,u,T,{handles:c}),e.extend&&(p.addClass(r[16]),e.tap&&b(i.start,p,S,{handles:c})),e.drag&&(n=u.find("."+r[7]).addClass(r[10]),e.fixed&&(n=n.add(u.children().not(n).children())),b(i.start,n,k,{handles:c}))}(a.events),o.vSet=function(t,n,o,i,s){var u,d;for(a.dir&&a.handles>1&&t.reverse(),s&&_(p,r[14],300),u=0;u<(c.length>1?3:1);u++)!1!==(d=(d=o||l[u%2][0]).valueOf(t[u%2]))&&(d=h(a,d),a.dir&&(d=100-d),!0!==y(c[u%2],d,!0)&&e(l[u%2]).each(function(){this.write(a,f[u%2],c[u%2].children(),p,i)}));return!0===n&&g(["set"]),this},o.vGet=function(){var e,t=[];for(e=0;e<a.handles;e++)t[e]=l[e][0].saved;return 1===t.length?t[0]:a.dir&&a.handles>1?t.reverse():t},o.destroy=function(){return e.each(l,function(){e.each(this,function(){this.target&&this.target.off(n)})}),e(this).off(n).removeClass(r.join(" ")).empty(),s},p.val(a.start)}function P(t){this.length||u("Can't initialize slider on empty selection.");var n=function(t,n){var o,i={xPct:[],xVal:[],xSteps:[!1],margin:0};return o={step:{r:!1,t:y},range:{r:!0,t:w},start:{r:!0,t:b},snap:{r:!1,t:x},connect:{r:!0,t:A},orientation:{r:!1,t:k},margin:{r:!1,t:T},direction:{r:!0,t:S},behaviour:{r:!0,t:I},serialization:{r:!0,t:O}},(t=e.extend({connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"},t)).serialization=e.extend({lower:[],upper:[],format:{}},t.serialization),e.each(o,function(e,o){if(void 0===t[e]){if(!o.r)return!0;u("'"+e+"' is required.")}o.t(i,t[e],n)}),i.style=i.ort?"top":"left",i}(t,this);return this.each(function(){M(this,n,t)})}v.prototype.v=function(e){return this.settings[e]},v.prototype.to=function(e){function t(e){return e.split("").reverse().join("")}var n="",o="",i="",r="";return(e=this.v("encoder")(e))<0&&(n=this.v("negative"),o=this.v("negativeBefore")),e=(e=Math.abs(e).toFixed(this.v("decimals")).toString()).split("."),0===parseFloat(e)&&(e[0]="0"),i=this.v("thousand")?t((i=t(e[0]).match(/.{1,3}/g)).join(t(this.v("thousand")))):e[0],this.v("mark")&&e.length>1&&(r=this.v("mark")+e[1]),o+this.v("prefix")+n+i+r+this.v("postfix")},v.prototype.from=function(e){function t(e){return e.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")}var n;return null!==e&&void 0!==e&&((e=e.toString())!==(n=e.replace(new RegExp("^"+t(this.v("negativeBefore"))),""))?(e=n,n="-"):n="",e=e.replace(new RegExp("^"+t(this.v("prefix"))),""),this.v.negative&&(n="",e=e.replace(new RegExp("^"+t(this.v("negative"))),"-")),e=e.replace(new RegExp(t(this.v("postfix"))+"$"),"").replace(new RegExp(t(this.v("thousand")),"g"),"").replace(this.v("mark"),"."),e=this.v("decoder")(parseFloat(n+e)),!isNaN(e)&&e)},g.prototype.write=function(e,t,n,o,i){this.update&&!1===i||(t=function(e,t){if(t>=100)return e.xVal.slice(-1)[0];for(var n,o=1;t>=e.xPct[o];)o++;return function(e,t){return t*(e[1]-e[0])/100+e[0]}([e.xVal[o-1],e.xVal[o]],(t-(n=e.xPct[o-1]))*c(n,e.xPct[o]))}(e,t),t=this.format(t),this.saved=t,"function"==typeof this.method?this.method.call(this.target[0]||o[0],t,n,o):this.target[this.method](t,n,o))},g.prototype.format=function(e){return this.formatting.to(e)},g.prototype.valueOf=function(e){return this.formatting.from(e)},e.noUiSlider={Link:g},e.fn.noUiSlider=function(t,n){return(n?function(t){return this.each(function(){var n=e(this).val(),o=this.destroy(),i=e.extend({},o,t);e(this).noUiSlider(i),o.start===i.start&&e(this).val(n)})}:P).call(this,t)},e.fn.val=function(){var t,n,i,a,s=Array.prototype.slice.call(arguments,0);return s.length?("object"==typeof s[1]?(t=s[1].set,n=s[1].link,i=s[1].update,a=s[1].animate):!0===s[1]&&(t=!0),this.each(function(){var u;e(this).hasClass(r[0])?this.vSet((u=s[0],e.isArray(u)?u:[u]),t,n,i,a):o.apply(e(this),s)})):this.hasClass(r[0])?this[0].vGet():o.apply(this)}}(window.jQuery||window.Zepto),window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)}),function(){window.visibly={b:null,q:document,p:void 0,prefixes:["webkit","ms"],props:["VisibilityState","visibilitychange","Hidden"],m:["focus","blur"],visibleCallbacks:[],hiddenCallbacks:[],_callbacks:[],onVisible:function(e){this.visibleCallbacks.push(e)},onHidden:function(e){this.hiddenCallbacks.push(e)},isSupported:function(){return this._supports(0)||this._supports(1)},_supports:function(e){return this.prefixes[e]+this.props[2]in this.q},runCallbacks:function(e){if(e){this._callbacks=1==e?this.visibleCallbacks:this.hiddenCallbacks;for(var t=0;t<this._callbacks.length;t++)this._callbacks[t]()}},_visible:function(){window.visibly.runCallbacks(1)},_hidden:function(){window.visibly.runCallbacks(2)},_nativeSwitch:function(){!0===this.q[this.b+this.props[2]]?this._hidden():this._visible()},listen:function(){try{this.isSupported()?(this.b=this._supports(0)==this.p?this.prefixes[1]:this.prefixes[0],this.q.addEventListener(this.b+this.props[1],function(){window.visibly._nativeSwitch.apply(window.visibly,arguments)},1)):document.addEventListener?(window.addEventListener(this.m[0],this._visible,1),window.addEventListener(this.m[1],this._hidden,1)):(this.q.attachEvent("onfocusin",this._visible),this.q.attachEvent("onfocusout",this._hidden))}catch(e){}},init:function(){this.listen()}},this.visibly.init()}(),function(e,t){"function"==typeof define&&define.amd?define([],t):"undefined"!=typeof module&&module.exports?module.exports=t():e.ReconnectingWebSocket=t()}(this,function(){function e(t,n){n=n||[],this.debug=!1,this.reconnectInterval=1e3,this.reconnectDecay=1.5,this.reconnectAttempts=0,this.timeoutInterval=2e3;var o,i=this,r=!1,a=!1;this.url=t,this.protocols=n,this.readyState=WebSocket.CONNECTING,this.URL=t,this.onopen=function(e){},this.onclose=function(e){},this.onconnecting=function(e){},this.onmessage=function(e){},this.onerror=function(e){},function s(u){o=new WebSocket(t,n),i.onconnecting(),(i.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",t);var l=o,d=setTimeout(function(){(i.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",t),a=!0,l.close(),a=!1},i.timeoutInterval);o.onopen=function(n){clearTimeout(d),(i.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onopen",t),i.readyState=WebSocket.OPEN,u=!1,i.reconnectAttempts=0,i.onopen(n)},o.onclose=function(n){clearTimeout(d),o=null,r?(i.readyState=WebSocket.CLOSED,i.onclose(n)):(i.readyState=WebSocket.CONNECTING,i.onconnecting(),u||a||((i.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onclose",t),i.onclose(n)),setTimeout(function(){i.reconnectAttempts++,s(!0)},i.reconnectInterval*Math.pow(i.reconnectDecay,i.reconnectAttempts)))},o.onmessage=function(n){(i.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",t,n.data),i.onmessage(n)},o.onerror=function(n){(i.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onerror",t,n),i.onerror(n)}}(!1),this.send=function(n){if(o)return(i.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","send",t,n),o.send(n);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(){r=!0,o&&o.close()},this.refresh=function(){o&&o.close()}}return e.debugAll=!1,e}),extend(Floatable,Block),Floatable.prototype.updateContainerSize=function(){this.pageDivWidth=$(this.pageDiv).width(),this.pageDivHeight=$(this.pageDiv).height()},Floatable.prototype.update=function(e){var t=e/50;this.x+=this.velocity.x*t,this.y+=this.velocity.y*t,this.velocity.x+=(.1*Math.random()-.05)*t,this.velocity.x>1?this.velocity.x=1:this.velocity.x<-1&&(this.velocity.x=-1),this.x<0?this.velocity.x+=.005*t:this.x>this.pageDivWidth-this.width&&(this.velocity.x-=.005*t),this.updateDiv(),this.y<-this.height&&this.removeSelf()},Floatable.prototype.updateDiv=function(){this.div.style["-webkit-transform"]="translate("+this.x+"px,"+this.y+"px)",this.div.style.transform="translate("+this.x+"px,"+this.y+"px)"},Floatable.prototype.removeSelf=function(){this.pageDiv.removeChild(this.div),updateTargets.splice(updateTargets.indexOf(this),1)},Floatable.prototype.addImage=function(e,t,n){this.canvas=document.createElement("div"),this.canvas.height=n,this.canvas.width=t,this.canvas.style.position="absolute",this.canvas.style.top="0px",this.canvas.style.left="0px",this.div.classList.add(e),this.div.appendChild(this.canvas)},Floatable.prototype.addText=function(e){this.innerDiv.innerHTML+=e},Floatable.prototype.initPosition=function(){this.x=Math.random()*(this.pageDivWidth-this.width),this.y=this.pageDivHeight,this.updateDiv(),this.div.style.width=this.width+"px",this.div.style.height=this.height+"px",this.innerDiv.style.top=this.height/2-this.innerDiv.offsetHeight/2+"px"};var easterSuccess=function(){var e=new Floatable;e.width=53,e.height=48,e.image=document.createElement("img"),e.image.src="images/easteregg.gif",e.image.height=e.height,e.image.width=e.width,e.image.style.position="absolute",e.image.style.top="0px",e.image.style.left="0px",e.div.appendChild(e.image),e.initPosition(),e.update=function(t){Floatable.prototype.update.call(e,t),e.velocity.x+=.3*Math.random()-.15,e.velocity.x>.1&&$(e.image).css({"-moz-transform":"scaleX(-1)","-o-transform":"scaleX(-1)","-webkit-transform":"scaleX(-1)",transform:"scaleX(-1)"}),e.velocity.x<-.1&&$(e.image).css({"-moz-transform":"scaleX(1)","-o-transform":"scaleX(1)","-webkit-transform":"scaleX(1)",transform:"scaleX(1)"})}};new Konami(easterSuccess);let DEBUG_MODE=!1;const COIN=1e8,provider_name="mypivxwallet.org";let DONATION_ADDRESS,globalMute=!1,last_update=0;const updateTargets=[],bubbleImage=new Image;bubbleImage.src="images/bubble.png";const blockImage=new Image;let debugSpawner;blockImage.src="images/block.png";const updateLayoutWidth=function(){$(".chartMask").css("visibility","visible")},updateLayoutHeight=function(){var e=window.innerHeight;"none"!=$("#header").css("display")&&(e-=$("#header").outerHeight()),$("#pageSplitter").height(e)};$(document).ready(function(){prevChartWidth=$("#pageSplitter").width()/2,$("#chartCell").hide(),DONATION_ADDRESS=$("#donationAddress").html(),$("#noJavascript").css("display","none"),updateLayoutHeight(),StatusBox.init(DEBUG_MODE),$(".clickSuppress").click(function(){$(".clickSuppress").parent().slideUp(300)}),debugSpawner=function(){if(Math.random()<=.1){var e,t=Math.random();e=t<.6?Math.random():t<.8?10*Math.random():t<.95?100*Math.random():1e3*Math.random(),Math.random()<.5?new Transaction(e,!1):new Transaction(e,!1,75*e,"USD")}},$("#donationAddress").qr()});var toggleInterface=function(){0===$(".interface:hidden").length?($(".interface").fadeOut(500,updateLayoutHeight),$("#hideInterface").html('<i class="fa-regular fa-eye hideInterfaceC" style="font-size:24px;"></i>'),$("#hideInterface").css("opacity","0.5")):($(".interface").fadeIn(500),$("#hideInterface").html('<i class="fa-regular fa-eye-slash" style="font-size:24px;"></i>'),$("#hideInterface").css("opacity","1"),updateLayoutHeight())},globalUpdate=function(e){window.requestAnimationFrame(globalUpdate);var t=e-last_update;last_update=e;for(var n=0;n<updateTargets.length;n++)updateTargets[n].update(t)};$(window).bind("load",function(){DEBUG_MODE?setInterval(debugSpawner,100):$("#blockchainCheckBox").prop("checked")&&TransactionSocket.init(),window.requestAnimationFrame(globalUpdate),Sound.loadup(),Sound.init()});var endResize=function(){$(".chartMask").css("visibility","hidden");for(var e=0;e<updateTargets.length;e++)updateTargets[e].updateContainerSize()},hideChart=function(){$("#chartElement").hide(),$("#showChart").show(),prevChartWidth=$("#chartCell").width(),$("#chartCell").width(0),$("#chartCell").hide(),$("#pageSplitter").colResizable({disable:!0})},showChart=function(){$("#chartElement").show(),$("#showChart").hide(),$("#chartCell").width(prevChartWidth),$("#chartCell").show(),$(window).trigger("resize"),0===$("#bitcoinChart").length&&$("#chartHolder").html('<iframe id="bitcoinChart" scrolling="no" frameBorder="0" src="http://bitcoin.clarkmoody.com/widget/chart/zeroblock/"></iframe>'),$("#pageSplitter").colResizable({liveDrag:!0,onDrag:updateLayoutWidth,onResize:endResize})};$(window).resize(function(){updateLayoutHeight()}),window.onbeforeunload=function(e){clearInterval(globalUpdate),TransactionSocket.close()};const COINBASE_OFFSET=2;function TransactionSocket(){}const arrFoundTXs=[];let strLastBlock="",checkInterval=null;function processTx(e){if(200==e.status){const t=JSON.parse(e.responseText);StatusBox.connected(),arrFoundTXs.push(t.txid);const n=t.vout.reduce((e,t)=>e+Number(t.value),0)/COIN;if(n){new Transaction(n,t.vout.some(e=>e.addresses.includes(DONATION_ADDRESS)))}}else console.error("Tx Error!"),console.error(e.responseText)}function processBlock(e){if(200===e.status){const t=JSON.parse(e.responseText);if(StatusBox.connected(),t.nextBlockHash)return checkForNewTxOrBlock(!0,t.nextBlockHash);if(t.hash===strLastBlock)return;strLastBlock=t.hash;const n=t.txs.slice(COINBASE_OFFSET,t.txCount).reduce((e,t)=>e+t.vout.reduce((e,t)=>e+Number(t.value),0),0)/COIN;new Block(t.height,t.txCount-COINBASE_OFFSET,n,t.size)}else console.error("Block Error!"),console.error(e.responseText)}function getTx(e){if(arrFoundTXs.includes(e))return;const t=new XMLHttpRequest;t.onload=function(){processTx(t)},t.open("GET","https://zkbitcoin.com/api/v2/tx/"+e),t.send()}function checkForNewTxOrBlock(e=!1,t=strLastBlock){if(!e){const e=new XMLHttpRequest;e.onload=function(){JSON.parse(e.responseText).mempool.forEach(e=>getTx(e.txid))},e.open("GET","https://zkbitcoin.com/api/v2/mempool/"),e.send()}if(strLastBlock){const e=new XMLHttpRequest;e.onload=function(){processBlock(e)},e.open("GET","https://zkbitcoin.com/api/v2/block/"+t),e.send()}else{const e=new XMLHttpRequest;e.onload=function(){strLastBlock=JSON.parse(e.responseText).backend.bestBlockHash,checkForNewTxOrBlock(!0)},e.open("GET","https://zkbitcoin.com/api/v2/api"),e.send()}}TransactionSocket.init=function(){clearInterval(checkInterval),StatusBox.reconnecting(),checkInterval=setInterval(checkForNewTxOrBlock,5e3)},TransactionSocket.close=function(){clearInterval(checkInterval),StatusBox.closed()};let globalScalePitch,globalVolume=50,globalAudioUnlocked=!0;function Sound(){}Howler.volume(.01*globalVolume),document.addEventListener("DOMContentLoaded",function(e){document.body.addEventListener("click",function(){document.getElementById("waitingForTransactions").style.opacity="0"},!0)});const soundBank=[];function zeroPad(e,t){const n=t-e.toString().length+1;return Array(+(n>0&&n)).join("0")+e}soundBank[0]=["celesta",22],soundBank[1]=["planet",33],soundBank[2]=["wikki",13],Sound.loadup=function(){sound0=[],sound1=[],sound2=[],swells0=[],swells1=[],swells2=[]},Sound.init=function(){$("#volumeControl").click(function(){globalMute?(globalMute=!1,Howler.mute(!1),$("#volumeControl").css("background-position","0 -46px")):(globalMute=!0,Howler.mute(),$("#volumeControl").css("background-position","0 0"))}),$("#volumeSlider").noUiSlider({range:{min:0,max:100},start:50,handles:1,step:1,orientation:"vertical"}).on("slide",function(){globalVolume=100-$(this).val(),Howler.volume(.01*globalVolume)}),globalScalePitch=$("#scalePitchCheckBox").attr("checked"),Sound.change(0)},Sound.change=function(e){var t;if(0===e){if(0===sound0.length){var n=!0;for(t=1;t<=22;t++)istring=zeroPad(t,3),newSound=new Howl({src:["sounds/celesta/celesta"+istring+".ogg","sounds/celesta/celesta"+istring+".mp3"],autoplay:!1}),n&&(n=!1,newSound.once("unlock",function(){globalAudioUnlocked=!0})),sound0.push(newSound)}if(0===swells0.length)for(t=1;t<=3;t++)newSound=new Howl({src:["sounds/swells0/swell"+t+".ogg","sounds/swells0/swell"+t+".mp3"],autoplay:!1}),swells0.push(newSound);currentSound=sound0,currentSwells=swells0}else if(1===e){if(0===sound1.length)for(t=1;t<=33;t++)istring=zeroPad(t,3),newSound=new Howl({src:["sounds/planet/planet"+istring+".ogg","sounds/planet/planet"+istring+".mp3"],autoplay:!1}),sound1.push(newSound);if(0===swells1.length)for(t=1;t<=3;t++)newSound=new Howl({urls:["sounds/swells1/planetswell"+t+".ogg","sounds/swells1/planetswell"+t+".mp3"],autoplay:!1}),swells1.push(newSound);currentSound=sound1,currentSwells=swells1}else if(2===e){if(0===sound2.length)for(t=1;t<=13;t++)istring=zeroPad(t,3),newSound=new Howl({src:["sounds/wikki/wikki"+istring+".ogg","sounds/wikki/wikki"+istring+".mp3"],autoplay:!1}),sound2.push(newSound);if(0===swells2.length)for(t=1;t<=3;t++)newSound=new Howl({src:["sounds/swells2/wikkiswell"+t+".ogg","sounds/swells2/wikkiswell"+t+".mp3"],autoplay:!1}),swells2.push(newSound);currentSound=sound2,currentSwells=swells2}};let currentNotes=0;const noteTimeout=500;Sound.playRandomAtVolume=function(e){if(globalMute)return;const t=Math.floor(100*Math.random());Sound.playPitchAtVolume(e,t)},Sound.playPitchAtVolume=function(e,t){if(globalMute)return;let n=Math.floor(t/100*currentSound.length);n+=Math.floor(4*Math.random())-2,n=Math.min(currentSound.length-1,n),n=Math.max(0,n),currentNotes<5&&(currentSound[n].volume(e),globalAudioUnlocked&¤tSound[n].play(),currentNotes++,setTimeout(function(){currentNotes--},500))};var lastBlockSound=-1;Sound.playRandomSwell=function(){if(!globalMute){var e;do{e=Math.floor(Math.random()*currentSwells.length)}while(e==lastBlockSound);lastBlockSound=e,globalAudioUnlocked&¤tSwells[e].play()}};const CONNECTED="Connected",CONNECTING="Connecting...",NO_SUPPORT="No browser support.",CLOSED="Click to connect";function StatusBox(){}function Transaction(e,t,n,o){Floatable.call(this),this.area=100*e+3e3,this.width=this.height=2*Math.sqrt(this.area/Math.PI),this.addImage("tx",this.width,this.height);const i=e.toFixed(2);let r="";r="0.00"===i?"<0.01<span class='bitcoinsymbol'>PIV</span>":i+"<span class='bitcoinsymbol'>PIV</span>",t?this.addText('<span style="color: yellow;">'+r+'</span><br /><span style="color: cyan;">Donation</span><br /><span style="color: lime;">Thanks!</span>'):this.addText(r),n&&o&&this.addText("<br />"+n.toFixed(2)+" "+o),this.initPosition();var a=e/2500+.3;a>.7&&(a=.7);let s=Math.min(100,Math.log(e+1.0715307808111487)/Math.log(1.0715307808111487));s=100-s,globalScalePitch?Sound.playPitchAtVolume(a,s):Sound.playRandomAtVolume(a)}StatusBox.init=function(e){StatusBox.blockchain=$("#blockchainStatus"),e&&StatusBox.blockchain.html(""),$("#blockchainCheckBox").is(":checked")?StatusBox.reconnecting():StatusBox.closed()},StatusBox.connected=function(){StatusBox.blockchain.html('<span class="badge rounded-pill text-bg-success" onclick="TransactionSocket.close();">Connected</span>')},StatusBox.reconnecting=function(){StatusBox.blockchain.html('<span class="badge rounded-pill text-bg-warning">Connecting...</span>')},StatusBox.closed=function(){StatusBox.blockchain.html('<span class="badge rounded-pill text-bg-danger" onclick="TransactionSocket.init();">'+CLOSED+"</span>")},extend(Floatable,Transaction);
//# sourceMappingURL=bitlisten.min.js.map