!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Mus=i()}(this,function(){"use strict";function t(){void 0!==this?(this.frames=[],this.timeouts=[],this.pos=0,this.currPos=0,this.startedAt=0,this.finishedAt=0,this.recording=!1,this.playing=!1,this.playbackSpeed=this.speed.NORMAL,this.window={width:window.outerWidth,height:window.outerHeight},this.onmousemove=window.onmousemove,this.onmousedown=window.onmousedown,this.onscroll=window.onscroll):console.error('Have you initialized Mus with "new" statement? (i.e. var mus = new Mus())')}return t.prototype={moveListener:function(t){return function(i){t&&t(["m",i.clientX,i.clientY])}},clickListener:function(t){return function(i){t&&t(["c",i.clientX,i.clientY])}},scrollListener:function(t){return function(i){t&&t(["s",document.scrollingElement.scrollLeft,document.scrollingElement.scrollTop])}},record:function(t){if(!this.recording){var i=this;0==i.startedAt&&(i.startedAt=(new Date).getTime()/1e3),i.frames.push(["s",document.scrollingElement.scrollLeft,document.scrollingElement.scrollTop]),window.onmousemove=this.moveListener(function(e){i.frames.push(e),t instanceof Function&&t()}),window.onmousedown=this.clickListener(function(e){i.frames.push(e),t instanceof Function&&t()}),window.onscroll=this.scrollListener(function(e){i.frames.push(e),t instanceof Function&&t()}),i.recording=!0}},stop:function(){this.finishedAt=(new Date).getTime()/1e3,window.onmousemove=this.onmousemove,window.onmousedown=this.onmousedown,window.onscroll=this.onscroll,this.timeouts=[],this.recording=!1,this.playing=!1,this.pos=0},pause:function(){this.playing&&(this.pos=this.currPos,this.playing=!1,this.clearTimeouts())},play:function(t){if(!this.playing){var i=this;i.createCursor();for(var e=document.getElementById("musCursor");i.pos0;)t[0].remove()},getXCoordinate:function(t){return window.outerWidth>this.window.width?parseInt(this.window.width*t/window.outerWidth):parseInt(window.outerWidth*t/this.window.width)},getYCoordinate:function(t){return window.outerHeight>this.window.height?parseInt(this.window.height*t/window.outerHeight):parseInt(window.outerHeight*t/this.window.height)},getData:function(){return{frames:this.frames,timeElapsed:this.timeElapsed(),window:{width:window.outerWidth,height:window.outerHeight}}},setData:function(t){t.frames&&(this.frames=t.frames),t.window&&(this.window=t.window)},setFrames:function(t){this.frames=t},setWindowSize:function(t,i){this.window.width=t,this.window.height=i},setPlaybackSpeed:function(t){this.playbackSpeed=t},isRecording:function(){return this.recording},isPlaying:function(){return this.playing},speed:{SLOW:35,NORMAL:15,FAST:5}},t});