New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cdgplayer

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdgplayer - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

6

CHANGELOG.md
# Change Log
## Mar 6, 2019 - v0.1.1
* Update dependency libraries to account for security vulnerability
* Update play code for browser changes to autoplay policy (Thanks to Colin Hill for reporting)
* Update package bundling to Babel 7
## Sep 22, 2018 - v0.0.9

@@ -4,0 +10,0 @@

4

dist/cdgplayer.js
/**
* @package CDGPlayer
* @version 0.1.0
* @version 0.1.1
* @license GPLv3

@@ -28,3 +28,3 @@ * @copyright Copyright (c) 2018 Stephen G Blades, Jr (AKA 'Cutter')

*/
function styleInject(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}var css=".cdg-video-wrapper{position:relative;text-align:center;background-color:#000}.cdg-video-wrapper .cdg-video-player{position:relative;width:72%;margin:0 auto}.cdg-video-wrapper .titleImage{position:absolute;top:0;left:0;width:100%;height:100%;z-index:auto;background-color:transparent}.cdg-video-wrapper .titleImage.hide{display:none}";styleInject(css);var TILE_WIDTH=6,TILE_HEIGHT=12,TILES_X=50,TILES_Y=18,TILES_X_BORDER=1,TILES_Y_BORDER=1,WIDTH=TILE_WIDTH*TILES_X,HEIGHT=TILE_HEIGHT*TILES_Y,BORDER_WIDTH=TILE_WIDTH*TILES_X_BORDER,BORDER_HEIGHT=TILE_HEIGHT*TILES_Y_BORDER,DISPLAY_WIDTH=WIDTH-2*BORDER_WIDTH,DISPLAY_HEIGHT=HEIGHT-2*BORDER_HEIGHT,DISPLAY_BOUNDS=[BORDER_WIDTH,BORDER_HEIGHT,BORDER_WIDTH+DISPLAY_WIDTH,BORDER_HEIGHT+DISPLAY_HEIGHT],DISPLAY_PIXELS=WIDTH*HEIGHT,CDG_NOOP=0,CDG_MEMORY_PRESET=1,CDG_BORDER_PRESET=2,CDG_TILE_BLOCK=6,CDG_SCROLL_PRESET=20,CDG_SCROLL_COPY=24,CDG_SET_KEY_COLOR=28,CDG_LOAD_CLUT_LOW=30,CDG_LOAD_CLUT_HI=31,CDG_TILE_BLOCK_XOR=38,CDG_SCROLL_NONE=0,CDG_SCROLL_LEFT=1,CDG_SCROLL_RIGHT=2,CDG_SCROLL_UP=1,CDG_SCROLL_DOWN=2,CDG_DATA=4,COMMAND_MASK=63,CDG_COMMAND=9,SECTORS_PER_SECOND=75,PACKETS_PER_SECTOR=4,PACKET_SIZE=24,GAIN_DEFAULT=1,PITCH_DEFAULT=1,SCALE_DEFAULT=1,FILTER_PLAYBACK_OFFSET=800,START_TIME="0:00",PANEL_POSITION=["top","bottom"],_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},createClass=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),defineProperty=function(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t},inherits=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},possibleConstructorReturn=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},slicedToArray=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var i=[],n=!0,r=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){r=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}return i}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),CDGContext=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.width,n=void 0===i?WIDTH:i,r=e.height,o=void 0===r?HEIGHT:r,s=e.canvas,a=void 0===s?this.createCanvas(n,o):s,u=e.ctx,l=void 0===u?this.createCanvasContext(a):u,c=e.imageData,h=void 0===c?this.createImageData(a,l,n,o):c;classCallCheck(this,t),this.hOffset=0,this.vOffset=0,this.keyColor=null,this.backgroundContainer=null,this.borderColor=null,this.memoryColor=null,this.clut=new Array(16).fill([0,0,0]),this.pixels=new Array(DISPLAY_PIXELS).fill(0),this.buffer=new Array(DISPLAY_PIXELS).fill(0),this.canvas=a,this.ctx=l,this.imageData=h}return createClass(t,[{key:"createCanvas",value:function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i}},{key:"createCanvasContext",value:function(t){var e=t.getContext("2d");return e.mozImageSmoothingEnabled=!1,e.webkitImageSmoothingEnabled=!1,e.msImageSmoothingEnabled=!1,e.imageSmoothingEnabled=!1,e}},{key:"createImageData",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.width,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.height;return e.createImageData(i,n)}},{key:"reset",value:function(){this.hOffset=0,this.vOffset=0,this.keyColor=null,this.backgroundColor=null,this.borderColor=null,this.memoryColor=null,this.pixels.fill(0)}},{key:"setCLUTEntry",value:function(t,e,i,n){this.clut[t]=[e,i,n].map(function(t){return 17*t})}},{key:"setPixel",value:function(t,e,i){this.pixels[t+e*WIDTH]=i}},{key:"getPixel",value:function(t,e){return this.pixels[t+e*WIDTH]}},{key:"getBackground",value:function(){switch(!0){case null!=this.keyColor:return this.keyColor;case null!=this.backgroundColor:return this.backgroundColor;case null!=this.memoryColor:return this.memoryColor;case null!=this.borderColor:return this.borderColor;default:return 0}}},{key:"generateImageData",value:function(){for(var t=WIDTH,e=HEIGHT,i=0;i<t;i++)for(var n=0;n<e;n++){var r=4*(i+n*WIDTH),o=(i-this.hOffset+WIDTH)%WIDTH+(n-this.vOffset+HEIGHT)%HEIGHT*WIDTH,s=this.pixels[o],a=slicedToArray(this.clut[s],3),u=a[0],l=a[1],c=a[2];this.imageData.data[r]=u,this.imageData.data[r+1]=l,this.imageData.data[r+2]=c,this.imageData.data[r+3]=s===this.keyColor?0:255}return this.imageData}},{key:"renderFrame",value:function(){this.ctx.putImageData(this.generateImageData(),0,0)}}]),t}();function warn(){var t;console&&console.warn&&(t=console).warn.apply(t,arguments)}var CDGInstruction=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;classCallCheck(this,t),this.bytes=e.slice(i,i+PACKET_SIZE)}return createClass(t,[{key:"instruction",get:function(){return this.constructor.instruction}},{key:"opcode",get:function(){return this.constructor.opcode}}]),createClass(t,[{key:"execute",value:function(){}},{key:"bytecodeToString",value:function(){return this.bytes.map(function(t){return t.toString(16).padStart(2,"0")}).join("")}},{key:"detailsToString",value:function(){return""}},{key:"toString",value:function(){return this.instruction}}]),t}();CDGInstruction.instruction="",CDGInstruction.opcode=null;var CDGNoopInstruction=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return inherits(e,CDGInstruction),e}();CDGNoopInstruction.instruction="No-op",CDGNoopInstruction.opcode=CDG_NOOP;var CDGMemoryPresetInstruction=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;classCallCheck(this,e);var n=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=i+CDG_DATA;return n.color=15&t[r],n.repeat=15&t[r+1],n}return inherits(e,CDGInstruction),createClass(e,[{key:"execute",value:function(t){t.memoryColor=this.color,t.backgroundColor=this.color,t.pixels.fill(this.color)}},{key:"detailsToString",value:function(){return"color index: "+this.color}}]),e}();CDGMemoryPresetInstruction.instruction="Memory Preset",CDGMemoryPresetInstruction.opcode=CDG_MEMORY_PRESET;var CDGBorderPresetInstruction=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;classCallCheck(this,e);var n=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));return n.color=15&t[i+CDG_DATA],n}return inherits(e,CDGInstruction),createClass(e,[{key:"execute",value:function(t){t.borderColor=this.color,t.backgroundColor=this.color;for(var e=slicedToArray(DISPLAY_BOUNDS,4),i=e[0],n=e[1],r=e[2],o=e[3],s=0;s<WIDTH;s++){for(var a=0;a<n;a++)t.setPixel(s,a,this.color);for(var u=o+1;u<HEIGHT;u++)t.setPixel(s,u,this.color)}for(var l=n;l<=o;l++){for(var c=0;c<i;c++)t.setPixel(c,l,this.color);for(var h=r+1;h<WIDTH;h++)t.setPixel(h,l,this.color)}}},{key:"detailsToString",value:function(){return"color index: "+this.color}}]),e}();CDGBorderPresetInstruction.instruction="Border Preset",CDGBorderPresetInstruction.opcode=CDG_BORDER_PRESET;var CDGTileBlockInstruction=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;classCallCheck(this,e);var n=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=i+CDG_DATA;return n.colors=[15&t[r],15&t[r+1]],n.row=31&t[r+2],n.column=63&t[r+3],n.pixels=t.slice(r+4,r+16),n}return inherits(e,CDGInstruction),createClass(e,[{key:"execute",value:function(t){var e=this.column*TILE_WIDTH,i=this.row*TILE_HEIGHT;if(e+TILE_WIDTH>WIDTH||i+TILE_HEIGHT>HEIGHT)warn("TileBlock out of bounds ("+this.row+", "+this.column+")");else for(var n=0;n<TILE_HEIGHT;n++)for(var r=this.pixels[n],o=0;o<TILE_WIDTH;o++){var s=this.colors[r>>5-o&1];this.op(t,e+o,i+n,s)}}},{key:"op",value:function(t,e,i,n){t.setPixel(e,i,n)}},{key:"detailsToString",value:function(){return"row: "+this.row+", column: "+this.column+", color indexes: ["+this.colors.join(", ")+"]"}}]),e}();CDGTileBlockInstruction.instruction="Tile Block",CDGTileBlockInstruction.opcode=CDG_TILE_BLOCK;var CDGTileBlockXORInstruction=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return inherits(e,CDGTileBlockInstruction),createClass(e,[{key:"op",value:function(t,e,i,n){t.setPixel(e,i,t.getPixel(e,i)^n)}}]),e}();CDGTileBlockXORInstruction.instruction="Tile Block (XOR)",CDGTileBlockXORInstruction.opcode=CDG_TILE_BLOCK_XOR;var CDGScrollPresetInstruction=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;classCallCheck(this,e);var n=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=i+CDG_DATA;n.color=15&t[r];var o=63&t[r+1];n.hCmd=(48&o)>>4,n.hOffset=7&o;var s=63&t[r+2];return n.vCmd=(48&s)>>4,n.vOffset=15&s,n}return inherits(e,CDGInstruction),createClass(e,[{key:"execute",value:function(t){t.backgroundColor=this.color,t.hOffset=Math.min(this.hOffset,TILE_WIDTH-1),t.vOffset=Math.min(this.vOffset,TILE_HEIGHT-1);var e=0;switch(this.hCmd){case CDG_SCROLL_RIGHT:e=TILE_WIDTH;break;case CDG_SCROLL_LEFT:e=-TILE_WIDTH}var i=0;switch(this.hCmd){case CDG_SCROLL_DOWN:i=TILE_HEIGHT;break;case CDG_SCROLL_UP:i=-TILE_HEIGHT}if(e||i){for(var n=0;n<WIDTH;n++)for(var r=0;r<HEIGHT;r++)t.buffer[n+r*WIDTH]=this.getPixel(t,n+e,r+i);var o=[t.buffer,t.pixels];t.pixels=o[0],t.buffer=o[1]}}},{key:"getPixel",value:function(t,e,i){return e>0&&e<WIDTH&&i>0&&i<HEIGHT?t.pixels[e+i*WIDTH]:this.color}},{key:"detailsToString",value:function(){var t=!1,e=!1;return this.vCmd===CDG_SCROLL_UP?t="up":this.vCmd===CDG_SCROLL_DOWN&&(t="down"),this.vCmd===CDG_SCROLL_LEFT?e="left":this.vCmd===CDG_SCROLL_RIGHT&&(e="right"),[t,e,"vOffset: "+this.vOffset,"hOffset: "+this.hOffset].filter(function(t){return t}).join(" ")}}]),e}();CDGScrollPresetInstruction.instruction="Scroll Preset",CDGScrollPresetInstruction.opcode=CDG_SCROLL_PRESET;var CDGScrollCopyInstruction=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return inherits(e,CDGScrollPresetInstruction),createClass(e,[{key:"getPixel",value:function(t,e,i){return e=(e+WIDTH)%WIDTH,i=(i+HEIGHT)%HEIGHT,t.pixels[e+i*WIDTH]}}]),e}();CDGScrollCopyInstruction.instruction="Scroll Copy",CDGScrollCopyInstruction.opcode=CDG_SCROLL_COPY;var CDGSetKeyColorInstruction=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;classCallCheck(this,e);var n=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));return n.color=15&t[i+CDG_DATA],n}return inherits(e,CDGInstruction),createClass(e,[{key:"execute",value:function(t){t.keyColor=this.color}},{key:"detailsToString",value:function(){return"color index: "+this.color}}]),e}();CDGSetKeyColorInstruction.instruction="Set Key Color",CDGSetKeyColorInstruction.opcode=CDG_SET_KEY_COLOR;var CDGLoadCLUTLowInstruction=function(t){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;classCallCheck(this,e);var n=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=i+CDG_DATA;n.colors=[];for(var o=0;o<8;o++){var s=r+2*o,a=((63&t[s])<<6)+(63&t[s+1]);n.colors[o]=[a>>8,(240&a)>>4,15&a]}return n}return inherits(e,CDGInstruction),createClass(e,[{key:"clutOffset",get:function(){return 0}}]),createClass(e,[{key:"execute",value:function(t){for(var e=0;e<8;e++)t.setCLUTEntry(e+this.clutOffset,this.colors[e][0],this.colors[e][1],this.colors[e][2])}},{key:"detailsToString",value:function(){var t=this;return"colors: ["+this.colors.map(function(e,i){return i+t.clutOffset+": #"+e.map(function(t){return t.toString(16)}).join("")}).join(", ")+"]"}}]),e}();CDGLoadCLUTLowInstruction.instruction="Load CLUT (Low)",CDGLoadCLUTLowInstruction.opcode=CDG_LOAD_CLUT_LOW;var CDGLoadCLUTHighInstruction=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return inherits(e,CDGLoadCLUTLowInstruction),createClass(e,[{key:"clutOffset",get:function(){return 8}}]),e}();CDGLoadCLUTHighInstruction.instruction="Load CLUT (High)",CDGLoadCLUTHighInstruction.opcode=CDG_LOAD_CLUT_HI;var CDGParser=function(){function t(){classCallCheck(this,t),this.instructionClassByType=this.constructor.instructionClassByType}return createClass(t,[{key:"registerInstruction",value:function(t,e){this.instructionClassByType[t]=e}},{key:"createInstruction",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t in this.instructionClassByType||warn("Unknown CDG instruction (instruction = "+t+")"),new(this.instructionClassByType[t]||CDGNoopInstruction)(e,i)}},{key:"parseInstruction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if((t[e]&COMMAND_MASK)===CDG_COMMAND){var i=t[e+1]&COMMAND_MASK;return this.createInstruction(i,t,e)}return new CDGNoopInstruction(t,e)}},{key:"parseInstructions",value:function(t){for(var e=[],i=t.length,n=0;n<i;n+=PACKET_SIZE)e.push(this.parseInstruction(t,n));return e.filter(function(t){return t})}}],[{key:"instructionClassByType",get:function(){var t;return defineProperty(t={},CDG_NOOP,CDGNoopInstruction),defineProperty(t,CDG_MEMORY_PRESET,CDGMemoryPresetInstruction),defineProperty(t,CDG_BORDER_PRESET,CDGBorderPresetInstruction),defineProperty(t,CDG_TILE_BLOCK,CDGTileBlockInstruction),defineProperty(t,CDG_SCROLL_PRESET,CDGScrollPresetInstruction),defineProperty(t,CDG_SCROLL_COPY,CDGScrollCopyInstruction),defineProperty(t,CDG_SET_KEY_COLOR,CDGSetKeyColorInstruction),defineProperty(t,CDG_LOAD_CLUT_LOW,CDGLoadCLUTLowInstruction),defineProperty(t,CDG_LOAD_CLUT_HI,CDGLoadCLUTHighInstruction),defineProperty(t,CDG_TILE_BLOCK_XOR,CDGTileBlockXORInstruction),t}}]),t}();function now(){if("undefined"!=typeof performance&&"function"==typeof performance.now)return performance.now();if("undefined"!=typeof process&&"function"==typeof process.hrtime){var t=process.hrtime(),e=slicedToArray(t,2);return 1e3*e[0]+e[1]/1e6}return Date.now()}function requestFrame(t){return"function"==typeof requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,25)}function cancelFrame(t){return"function"==typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t)}var CDGPlayer=function(){function t(){var e=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=i.contextOptions,r=void 0===n?{}:n,o=i.context,s=void 0===o?this.createContext(r):o,a=i.afterRender;classCallCheck(this,t),this.instructions=[],this.pc=-1,this.frameId=null,this.pos=0,this.lastSyncPos=null,this.lastTimestamp=null,this.update=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:now();if(-1===e.pc)return e;e.frameId=requestFrame(e.update),e.lastSyncPos?e.pos=e.lastSyncPos+(t-e.lastTimestamp):(e.pos+=t-e.lastTimestamp,e.lastTimestamp=t);var i=Math.floor(SECTORS_PER_SECOND*PACKETS_PER_SECTOR*(e.pos/1e3))-e.pc;return i>0&&(e.fastForward(i),e.render()),e},this.context=s,this.afterRender=a}return createClass(t,[{key:"createContext",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new CDGContext(t)}},{key:"load",value:function(t){var e=new CDGParser;return this.instructions=e.parseInstructions(t),this.reset(),this}},{key:"reset",value:function(){return this.pc=0,this.pos=0,this.lastSyncPos=null,this.context.reset(),this}},{key:"render",value:function(){return this.context.renderFrame(),this.afterRender&&this.afterRender(this.context),this}},{key:"executeInstruction",value:function(t){return t&&"function"==typeof t.execute&&t.execute(this.context),this}},{key:"step",value:function(){return this.pc>=0&&this.pc<this.instructions.length?(this.executeInstruction(this.instructions[this.pc]),this.pc+=1):(this.pc=-1,this.stop()),this}},{key:"fastForward",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=this.pc+t;this.pc>=0&&this.pc<e;)this.step();return this}},{key:"play",value:function(){return this.frameId||(this.frameId=requestFrame(this.update),this.lastTimestamp=now()),this}},{key:"stop",value:function(){return cancelFrame(this.frameId),this.frameId=null,this.lastSyncPos=null,this}},{key:"sync",value:function(t){return this.lastSyncPos=t,this.lastTimestamp=now(),this}}]),t}(),Deferred=function(){return"undefined"!=typeof Promise&&Promise.defer?Promise.defer():"undefined"!=typeof PromiseUtils&&PromiseUtils.defer?PromiseUtils.defer():(this.resolve=null,this.reject=null,this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this)),void Object.freeze(this))},getDataFile=function(t){var e=new Deferred;return JSZipUtils.getBinaryContent(t,function(i,n){i?e.reject(new Error("There was an error retrieving "+t,i)):e.resolve(n)}),e.promise},loadZipBuffer=function(t){return JSZip.loadAsync(t).catch(function(t){return Promise.reject(new Error("There was an error reading the zip file.",t))})},loadAudio=function(t){return t.async("arraybuffer").catch(function(){return Promise.reject(new Error("Unable to load the audio file"))})},getFallbackTagData=function(t){var e=t.split(" - "),i={tags:{}};return i.tags.album=e[0].trim(),i.tags.artist=e[1]?e[1].trim():i.tags.album,i.tags.title=e[2]?e[2].trim():i.tags.artist,i},getTagData=function(t){return t.async("blob").then(function(e){return new Promise(function(i){new jsmediatags.Reader(e).setTagsToRead(["title","artist","album","track","year","genre","picture"]).read({onSuccess:function(t){return i(t)},onError:function(){return i(getFallbackTagData(t.name))}})})}).catch(function(){return Promise.reject(new Error("Unable to parse tag data"))})},loadVideo=function(t){return t.async("uint8array").catch(function(){return Promise.reject(new Error("Unable to load the video file"))})},getKaraokeFiles=function(t){var e=t.filter(function(t){return t.endsWith(".cdg")||t.endsWith(".mp3")});return 2===e.length?Promise.resolve(e):Promise.reject("The file is not a karaoke .zip file")},processZip=function(t){var e=t.filter(function(t){return t.name.endsWith(".mp3")}),i=t.filter(function(t){return t.name.endsWith(".cdg")}),n=[];if(e.length&&i.length)return n.push(loadAudio(e[0])),n.push(loadVideo(i[0])),n.push(getTagData(e[0])),Promise.all(n).catch(function(){return Promise.reject(new Error("Processing audio and video failed"))});var r=[];return e.length||r.push("No mp3 audio file present."),i.length||r.push("No cdg video file present."),Promise.reject(new Error(r.join(" ")))},CDGFileLoader=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"loadZipFile",value:function(t){return getDataFile(t).then(function(t){return loadZipBuffer(t)}).then(function(t){return getKaraokeFiles(t)}).then(function(t){return processZip(t)}).catch(function(t){return Promise.reject(t)})}},{key:"loadFileBuffer",value:function(t){return loadZipBuffer(t).then(function(t){return getKaraokeFiles(t)}).then(function(t){return processZip(t)}).catch(function(t){return Promise.reject(t)})}}]),t}(),classCallCheck$1=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},createClass$1=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),get$1=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0},inherits$1=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":_typeof(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},possibleConstructorReturn$1=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":_typeof(e))&&"function"!=typeof e?t:e},FifoSampleBuffer=function(){function t(){classCallCheck$1(this,t),this._vector=new Float32Array,this._position=0,this._frameCount=0}return createClass$1(t,[{key:"clear",value:function(){this.receive(this._frameCount),this.rewind()}},{key:"put",value:function(t){this._frameCount+=t}},{key:"putSamples",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=2*(e=e||0);i>=0||(i=(t.length-n)/2);var r=2*i;this.ensureCapacity(i+this._frameCount);var o=this.endIndex;this.vector.set(t.subarray(n,n+r),o),this._frameCount+=i}},{key:"putBuffer",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;e=e||0,i>=0||(i=t.frameCount-e),this.putSamples(t.vector,t.position+e,i)}},{key:"receive",value:function(t){t>=0&&!(t>this._frameCount)||(t=this.frameCount),this._frameCount-=t,this._position+=t}},{key:"receiveSamples",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=2*e,n=this.startIndex;t.set(this._vector.subarray(n,n+i)),this.receive(e)}},{key:"extract",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.startIndex+2*e,r=2*i;t.set(this._vector.subarray(n,n+r))}},{key:"ensureCapacity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=parseInt(2*t);if(this._vector.length<e){var i=new Float32Array(e);i.set(this._vector.subarray(this.startIndex,this.endIndex)),this._vector=i,this._position=0}else this.rewind()}},{key:"ensureAdditionalCapacity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+t)}},{key:"rewind",value:function(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}},{key:"vector",get:function(){return this._vector}},{key:"position",get:function(){return this._position}},{key:"startIndex",get:function(){return 2*this._position}},{key:"frameCount",get:function(){return this._frameCount}},{key:"endIndex",get:function(){return 2*(this._position+this._frameCount)}}]),t}(),AbstractFifoSamplePipe=function(){function t(e){classCallCheck$1(this,t),e?(this._inputBuffer=new FifoSampleBuffer,this._outputBuffer=new FifoSampleBuffer):this._inputBuffer=this._outputBuffer=null}return createClass$1(t,[{key:"clear",value:function(){this._inputBuffer.clear(),this._outputBuffer.clear()}},{key:"inputBuffer",get:function(){return this._inputBuffer},set:function(t){this._inputBuffer=t}},{key:"outputBuffer",get:function(){return this._outputBuffer},set:function(t){this._outputBuffer=t}}]),t}(),RateTransposer=function(t){function e(t){classCallCheck$1(this,e);var i=possibleConstructorReturn$1(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.reset(),i._rate=1,i}return inherits$1(e,AbstractFifoSamplePipe),createClass$1(e,[{key:"reset",value:function(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}},{key:"clone",value:function(){var t=new e;return t.rate=this._rate,t}},{key:"process",value:function(){var t=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(t/this._rate+1);var e=this.transpose(t);this._inputBuffer.receive(),this._outputBuffer.put(e)}},{key:"transpose",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===t)return 0;for(var e=this._inputBuffer.vector,i=this._inputBuffer.startIndex,n=this._outputBuffer.vector,r=this._outputBuffer.endIndex,o=0,s=0;this.slopeCount<1;)n[r+2*s]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*e[i],n[r+2*s+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*e[i+1],s+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==t)t:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,(o+=1)>=t-1)break t;var a=i+2*o;n[r+2*s]=(1-this.slopeCount)*e[a]+this.slopeCount*e[a+2],n[r+2*s+1]=(1-this.slopeCount)*e[a+1]+this.slopeCount*e[a+3],s+=1,this.slopeCount+=this._rate}return this.prevSampleL=e[i+2*t-2],this.prevSampleR=e[i+2*t-1],s}},{key:"rate",set:function(t){this._rate=t}}]),e}(),FilterSupport=function(){function t(e){classCallCheck$1(this,t),this._pipe=e}return createClass$1(t,[{key:"fillInputBuffer",value:function(){throw new Error("fillInputBuffer() not overridden")}},{key:"fillOutputBuffer",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.outputBuffer.frameCount<t;){var e=16384-this.inputBuffer.frameCount;if(this.fillInputBuffer(e),this.inputBuffer.frameCount<16384)break;this._pipe.process()}}},{key:"clear",value:function(){this._pipe.clear()}},{key:"pipe",get:function(){return this._pipe}},{key:"inputBuffer",get:function(){return this._pipe.inputBuffer}},{key:"outputBuffer",get:function(){return this._pipe.outputBuffer}}]),t}(),noop=function(){},SimpleFilter=function(t){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:noop;classCallCheck$1(this,e);var r=possibleConstructorReturn$1(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,i));return r.callback=n,r.sourceSound=t,r.historyBufferSize=22050,r._sourcePosition=0,r.outputBufferPosition=0,r._position=0,r}return inherits$1(e,FilterSupport),createClass$1(e,[{key:"onEnd",value:function(){this.callback()}},{key:"fillInputBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=new Float32Array(2*t),i=this.sourceSound.extract(e,t,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(e,0,i)}},{key:"extract",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+e);var i=Math.min(e,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(t,this.outputBufferPosition,i);var n=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,n),this.outputBuffer.receive(Math.max(n-this.historyBufferSize,0)),this._position+=i,i}},{key:"handleSampleData",value:function(t){this.extract(t.data,4096)}},{key:"clear",value:function(){get$1(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"clear",this).call(this),this.outputBufferPosition=0}},{key:"position",get:function(){return this._position},set:function(t){if(t>this._position)throw new RangeError("New position may not be greater than current position");var e=this.outputBufferPosition-(this._position-t);if(e<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=e,this._position=t}},{key:"sourcePosition",get:function(){return this._sourcePosition},set:function(t){this.clear(),this._sourcePosition=t}}]),e}(),USE_AUTO_SEQUENCE_LEN=0,DEFAULT_SEQUENCE_MS=USE_AUTO_SEQUENCE_LEN,USE_AUTO_SEEKWINDOW_LEN=0,DEFAULT_SEEKWINDOW_MS=USE_AUTO_SEEKWINDOW_LEN,DEFAULT_OVERLAP_MS=8,_SCAN_OFFSETS=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],AUTOSEQ_TEMPO_LOW=.5,AUTOSEQ_TEMPO_TOP=2,AUTOSEQ_AT_MIN=125,AUTOSEQ_AT_MAX=50,AUTOSEQ_K=(AUTOSEQ_AT_MAX-AUTOSEQ_AT_MIN)/(AUTOSEQ_TEMPO_TOP-AUTOSEQ_TEMPO_LOW),AUTOSEQ_C=AUTOSEQ_AT_MIN-AUTOSEQ_K*AUTOSEQ_TEMPO_LOW,AUTOSEEK_AT_MIN=25,AUTOSEEK_AT_MAX=15,AUTOSEEK_K=(AUTOSEEK_AT_MAX-AUTOSEEK_AT_MIN)/(AUTOSEQ_TEMPO_TOP-AUTOSEQ_TEMPO_LOW),AUTOSEEK_C=AUTOSEEK_AT_MIN-AUTOSEEK_K*AUTOSEQ_TEMPO_LOW,Stretch=function(t){function e(t){classCallCheck$1(this,e);var i=possibleConstructorReturn$1(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i._quickSeek=!0,i.midBufferDirty=!1,i.midBuffer=null,i.overlapLength=0,i.autoSeqSetting=!0,i.autoSeekSetting=!0,i._tempo=1,i.setParameters(44100,DEFAULT_SEQUENCE_MS,DEFAULT_SEEKWINDOW_MS,DEFAULT_OVERLAP_MS),i}return inherits$1(e,AbstractFifoSamplePipe),createClass$1(e,[{key:"clear",value:function(){get$1(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"clear",this).call(this),this.clearMidBuffer()}},{key:"clearMidBuffer",value:function(){this.midBufferDirty&&(this.midBufferDirty=!1,this.midBuffer=null)}},{key:"setParameters",value:function(t,e,i,n){t>0&&(this.sampleRate=t),n>0&&(this.overlapMs=n),e>0?(this.sequenceMs=e,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}},{key:"calculateOverlapLength",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=void 0;e=(e=this.sampleRate*t/1e3)<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}},{key:"checkLimits",value:function(t,e,i){return t<e?e:t>i?i:t}},{key:"calculateSequenceParameters",value:function(){var t=void 0,e=void 0;this.autoSeqSetting&&(t=AUTOSEQ_C+AUTOSEQ_K*this._tempo,t=this.checkLimits(t,AUTOSEQ_AT_MAX,AUTOSEQ_AT_MIN),this.sequenceMs=Math.floor(t+.5)),this.autoSeekSetting&&(e=AUTOSEEK_C+AUTOSEEK_K*this._tempo,e=this.checkLimits(e,AUTOSEEK_AT_MAX,AUTOSEEK_AT_MIN),this.seekWindowMs=Math.floor(e+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}},{key:"clone",value:function(){var t=new e;return t.tempo=this._tempo,t.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),t}},{key:"seekBestOverlapPosition",value:function(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}},{key:"seekBestOverlapPositionStereo",value:function(){var t=void 0,e=void 0,i=void 0,n=0;for(this.preCalculateCorrelationReferenceStereo(),t=0,e=Number.MIN_VALUE;n<this.seekLength;n+=1)(i=this.calculateCrossCorrelationStereo(2*n,this.refMidBuffer))>e&&(e=i,t=n);return t}},{key:"seekBestOverlapPositionStereoQuick",value:function(){var t=void 0,e=void 0,i=void 0,n=0,r=void 0,o=void 0;for(this.preCalculateCorrelationReferenceStereo(),e=Number.MIN_VALUE,t=0,r=0,o=0;n<4;n+=1){for(var s=0;_SCAN_OFFSETS[n][s]&&!((o=r+_SCAN_OFFSETS[n][s])>=this.seekLength);)(i=this.calculateCrossCorrelationStereo(2*o,this.refMidBuffer))>e&&(e=i,t=o),s+=1;r=t}return t}},{key:"preCalculateCorrelationReferenceStereo",value:function(){for(var t=0,e=void 0,i=void 0;t<this.overlapLength;t+=1)i=t*(this.overlapLength-t),e=2*t,this.refMidBuffer[e]=this.midBuffer[e]*i,this.refMidBuffer[e+1]=this.midBuffer[e+1]*i}},{key:"calculateCrossCorrelationStereo",value:function(t,e){var i=this._inputBuffer.vector;t+=this._inputBuffer.startIndex;for(var n=0,r=2,o=2*this.overlapLength,s=void 0;r<o;r+=2)n+=i[s=r+t]*e[r]+i[s+1]*e[r+1];return n}},{key:"overlap",value:function(t){this.overlapStereo(2*t)}},{key:"overlapStereo",value:function(t){var e=this._inputBuffer.vector;t+=this._inputBuffer.startIndex;for(var i=this._outputBuffer.vector,n=this._outputBuffer.endIndex,r=0,o=void 0,s=void 0,a=1/this.overlapLength,u=void 0,l=void 0,c=void 0;r<this.overlapLength;r+=1)s=(this.overlapLength-r)*a,u=r*a,l=(o=2*r)+t,i[(c=o+n)+0]=e[l+0]*u+this.midBuffer[o+0]*s,i[c+1]=e[l+1]*u+this.midBuffer[o+1]*s}},{key:"process",value:function(){var t=void 0,e=void 0,i=void 0;if(null===this.midBuffer){if(this._inputBuffer.frameCount<this.overlapLength)return;this.midBuffer=new Float32Array(2*this.overlapLength),this._inputBuffer.receiveSamples(this.midBuffer,this.overlapLength)}for(;this._inputBuffer.frameCount>=this.sampleReq;){t=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(t)),this._outputBuffer.put(this.overlapLength),(e=this.seekWindowLength-2*this.overlapLength)>0&&this._outputBuffer.putBuffer(this._inputBuffer,t+this.overlapLength,e);var n=this._inputBuffer.startIndex+2*(t+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(n,n+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}},{key:"tempo",set:function(t){var e;this._tempo=t,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,e=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(e+this.overlapLength,this.seekWindowLength)+this.seekLength},get:function(){return this._tempo}},{key:"inputChunkSize",get:function(){return this.sampleReq}},{key:"outputChunkSize",get:function(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}},{key:"quickSeek",set:function(t){this._quickSeek=t}}]),e}(),testFloatEqual=function(t,e){return(t>e?t-e:e-t)>1e-10},SoundTouch=function(){function t(){classCallCheck$1(this,t),this.transposer=new RateTransposer(!1),this.stretch=new Stretch(!1),this._inputBuffer=new FifoSampleBuffer,this._intermediateBuffer=new FifoSampleBuffer,this._outputBuffer=new FifoSampleBuffer,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}return createClass$1(t,[{key:"clear",value:function(){this.transposer.clear(),this.stretch.clear()}},{key:"clone",value:function(){var e=new t;return e.rate=this.rate,e.tempo=this.tempo,e}},{key:"calculateEffectiveRateAndTempo",value:function(){var t=this._tempo,e=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,testFloatEqual(this._tempo,t)&&(this.stretch.tempo=this._tempo),testFloatEqual(this._rate,e)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}},{key:"process",value:function(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}},{key:"rate",get:function(){return this._rate},set:function(t){this.virtualRate=t,this.calculateEffectiveRateAndTempo()}},{key:"rateChange",set:function(t){this._rate=1+.01*t}},{key:"tempo",get:function(){return this._tempo},set:function(t){this.virtualTempo=t,this.calculateEffectiveRateAndTempo()}},{key:"tempoChange",set:function(t){this.tempo=1+.01*t}},{key:"pitch",set:function(t){this.virtualPitch=t,this.calculateEffectiveRateAndTempo()}},{key:"pitchOctaves",set:function(t){this.pitch=Math.exp(.69314718056*t),this.calculateEffectiveRateAndTempo()}},{key:"pitchSemitones",set:function(t){this.pitchOctaves=t/12}},{key:"inputBuffer",get:function(){return this._inputBuffer}},{key:"outputBuffer",get:function(){return this._outputBuffer}}]),t}(),WebAudioBufferSource=function(){function t(e){classCallCheck$1(this,t),this.buffer=e,this._position=0}return createClass$1(t,[{key:"extract",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.position=i;for(var n=this.buffer.getChannelData(0),r=this.dualChannel?this.buffer.getChannelData(1):this.buffer.getChannelData(0),o=0;o<e;o++)t[2*o]=n[o+i],t[2*o+1]=r[o+i];return Math.min(e,n.length-i)}},{key:"dualChannel",get:function(){return this.buffer.numberOfChannels>1}},{key:"position",get:function(){return this._position},set:function(t){this._position=t}}]),t}(),getWebAudioNode=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:noop,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4096,r=t.createScriptProcessor(n,2,2),o=new Float32Array(2*n);return r.onaudioprocess=function(t){var r=t.outputBuffer.getChannelData(0),s=t.outputBuffer.getChannelData(1),a=e.extract(o,n);i(e.sourcePosition),0===a&&e.onEnd();for(var u=0;u<a;u++)r[u]=o[2*u],s[u]=o[2*u+1]},r},pad=function(t,e,i){return i=i||"0",(t+="").length>=e?t:new Array(e-t.length+1).join(i)+t},minsSecs=function(t){var e=Math.floor(t/60);return e+":"+pad(parseInt(t-60*e),2)},onUpdate=function(t){var e=this.timePlayed,i=this.sampleRate;if(this.sourcePosition=t,this.timePlayed=t/i,e!==this.timePlayed){var n=new CustomEvent("play",{detail:{timePlayed:this.timePlayed,formattedTimePlayed:this.formattedTimePlayed,percentagePlayed:this.percentagePlayed}});this._node.dispatchEvent(n)}},PitchShifter=function(){function t(e,i,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:noop;classCallCheck$1(this,t),this._soundtouch=new SoundTouch;var s=new WebAudioBufferSource(i);this.timePlayed=0,this.sourcePosition=0,this._filter=new SimpleFilter(s,this._soundtouch,o),this._node=getWebAudioNode(e,this._filter,function(t){return onUpdate.call(r,t)}),this.tempo=1,this.rate=1,this.duration=i.duration,this.sampleRate=e.sampleRate,this.listeners=[]}return createClass$1(t,[{key:"connect",value:function(t){this._node.connect(t)}},{key:"disconnect",value:function(){this._node.disconnect()}},{key:"on",value:function(t,e){this.listeners.push({name:t,cb:e}),this._node.addEventListener(t,function(t){return e(t.detail)})}},{key:"off",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=this.listeners;e&&(i=i.filter(function(t){return t.name===e})),i.forEach(function(e){t._node.removeEventListener(e.name,function(t){return e.cb(t.detail)})})}},{key:"formattedDuration",get:function(){return minsSecs(this.duration)}},{key:"formattedTimePlayed",get:function(){return minsSecs(this.timePlayed)}},{key:"percentagePlayed",get:function(){return 100*this._filter.sourcePosition/(this.duration*this.sampleRate)},set:function(t){this._filter.sourcePosition=parseInt(t*this.duration*this.sampleRate)}},{key:"node",get:function(){return this._node}},{key:"pitch",set:function(t){this._soundtouch.pitch=t}},{key:"pitchSemitones",set:function(t){this._soundtouch.pitchSemitones=t}},{key:"rate",set:function(t){this._soundtouch.rate=t}},{key:"tempo",set:function(t){this._soundtouch.tempo=t}}]),t}(),isString=function(t){return"string"==typeof t},PubSub=function(){function t(){classCallCheck(this,t),this.fns={any:[]}}return createClass(t,[{key:"has",value:function(t){return t in this.fns&&this.fns[t].length>0||this.fns.any.length>0}},{key:"on",value:function(t,e){return t in this.fns==!1&&(this.fns[t]=[]),this.fns[t].push(e),e}},{key:"fire",value:function(t,e,i){return this.fns.any.concat(t in this.fns?this.fns[t]:[]).forEach(function(n){return n(e,i,t)}),this}},{key:"off",value:function(t){for(var e in this.fns)for(var i=this.fns[e],n=0;n<i.length;n++)if(i[n]===t)return i.splice(n,1),!0;return!1}},{key:"once",value:function(t,e){var i=this;return this.on(t,function t(n,r,o){e(n,r,o),i.off(t)}),e}}]),t}(),observable=function(t){if(t.on&&t.off)return t;var e=new PubSub,i=new Proxy(t,{get:function(t,n){if(n in t){if(t.constructor===Array){var r=i;"pop"===n?r=t[t.length-1]:"shift"===n&&(r=t[0]),"push"!==n&&"length"!==n&&e.fire(n,r)}return t[n]}return"on"===n?e.on.bind(e):"once"===n?e.once.bind(e):"off"===n?e.off.bind(e):void 0},set:function(t,i,n){return t.constructor===Array?"length"!==i&&e.fire("change",n):e.has(i)&&e.fire(i,n,t[i]),t[i]=n,!0}});return i},createDisplayCanvas=function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i},createCanvasContext=function(t){var e=t.getContext("2d");return e.webkitImageSmoothingEnabled=!1,e.mozImageSmoothingEnabled=!1,e.msImageSmoothingEnabled=!1,e.imageSmoothingEnabled=!1,e},copyContextToCanvas=function(t){t.keyColor>=0&&this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.drawImage(t.canvas,0,0,t.canvas.width,t.canvas.height,0,0,this.canvas.width,this.canvas.height)},clearCanvas=function(t,e){t.clearRect(0,0,e.width,e.height)},loadAudio$1=function(t){var e=this;return this.shifter&&this.shifter.off(),this.audio.decodeAudioData(t).then(function(t){e.shifter=observable(new PitchShifter(e.audio,t,1024,function(){e.stop()})),e.shifter.on("play",function(t){e.props.timePlayed=t.formattedTimePlayed,e.props.percentagePlayed=t.percentagePlayed,e.player.sync(1e3*t.timePlayed-FILTER_PLAYBACK_OFFSET)}),e.shifter.pitch=PITCH_DEFAULT,e.props.trackLength=e.shifter.formattedDuration}).catch(function(t){return Promise.reject(new Error("There was an error decoding the audio file",t))})},loadVideo$1=function(t){var e=new Deferred;return t?(this.player.load(Array.from(t)),e.resolve()):e.reject(new Error("There was an error loading the video file")),e.promise},wrapText=function(t,e,i,n,r,o){for(var s=e.split(" "),a="",u=0;u<s.length;u++){var l=a+s[u]+" ";t.measureText(l).width>r&&u>0?(t.fillText(a.trim(),i,n),a=s[u]+" ",n+=o):a=l}t.fillText(a.trim(),i,n)},drawTag=function(){var t=this.ctx,e=this.canvas,i=e.width-10,n=i/2,r=60;t.font="30px sans-serif",t.fillStyle="#fff",t.textAlign="center",wrapText(t,this.tag.title,n,r,i,30),t.font="20px sans-serif",r=e.height-60,wrapText(t,"by "+this.tag.artist,n,r,i,30)},loadTag=function(t){if(this.tag=t&&t.tags,this.tag)return drawTag.call(this)},handleExtractedZip=function(t){var e=this,i=[];return i.push(loadAudio$1.call(this,t[0])),i.push(loadVideo$1.call(this,t[1])),Promise.all(i).then(function(){e.props.status="File Loaded",e.props.loaded=!0,loadTag.call(e,t[2])}).catch(function(t){return e.props.status="File Loading Failed",Promise.reject(t)}).then(function(){e.props.loading=!1})},setVolume=function(t){this.gainNode.gain.value=t},KaraokePlayer=function(){function t(e){var i=this;if(classCallCheck(this,t),this.audio=null,this.gainNode=null,this.shifter=null,this.wrapper=null,this.player=null,this.currentSize=SCALE_DEFAULT,this.canvas=null,this.ctx=null,this.props=observable({status:"",loaded:!1,loading:!1,isPlaying:!1,timePlayed:START_TIME,trackLength:START_TIME,percentagePlayed:0,songVolume:1,destroy:!1}),this.wrapper=document.querySelector(e),!this.wrapper)throw new Error('CDGPlayer: and element was not found with the "'+e+'" selector');this.wrapper.classList.add("cdg-video-wrapper"),this.canvas=createDisplayCanvas(WIDTH,HEIGHT),this.canvas.classList.add("cdg-video-player"),this.ctx=createCanvasContext(this.canvas),this.player=new CDGPlayer({afterRender:function(t){return copyContextToCanvas.call(i,t)}}),this.wrapper.appendChild(this.canvas);var n=document.createElement("div");n.classList.add("titleImage"),this.wrapper.appendChild(n),this.onloaded=this.props.on("loaded",function(t){t?n.classList.add("hide"):n.classList.remove("hide")}),this.audio=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audio.createGain(),this.onvolume=this.props.on("songVolume",function(t){setVolume.call(i,t)}),this.props.songVolume=GAIN_DEFAULT}return createClass(t,[{key:"destroy",value:function(){this.wrapper.classList.remove("cdg-video-wrapper"),this.stop(),this.gainNode.disconnect(),this.shifter&&this.shifter.off(),this.shifter=null,this.gainNode=null,this.audio=null,this.canvas.remove(),this.props.destroy=!0,this.props.off("onvolume")}},{key:"load",value:function(t){var e=this;this.stop(),clearCanvas(this.ctx,this.canvas),this.props.loading=!0;var i=void 0;if(isString(t)){if(!t.toLowerCase().endsWith(".zip"))return this.props.loading=!1,this.props.status=t+' doesn\'t appear to be a ".zip" file.',Promise.reject(this.props.status);this.props.status="Retrieving File...",i=CDGFileLoader.loadZipFile(t)}else this.props.status="Loading File...",i=CDGFileLoader.loadFileBuffer(t);return i.then(function(t){return handleExtractedZip.call(e,t)}).catch(function(t){return Promise.reject(t)})}},{key:"togglePlay",value:function(){this.props.isPlaying?this.pause():this.start()}},{key:"start",value:function(){clearCanvas.call(this,this.ctx,this.canvas),this.shifter.connect(this.gainNode),this.gainNode.connect(this.audio.destination),this.props.isPlaying=!0,this.player.play()}},{key:"pause",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.props.isPlaying=t,this.shifter.disconnect(),this.player.stop()}},{key:"stop",value:function(){this.shifter&&(this.pause(),this.changePlayerPosition(0),drawTag.call(this))}},{key:"changePlayerPosition",value:function(t){t=t<0?0:t>100?100:t,this.shifter.percentagePlayed=t,this.props.percentagePlayed=this.shifter.percentagePlayed,this.props.timePlayed=this.shifter.formattedTimePlayed,this.player.reset(),t||(this.props.isPlaying=!1,this.props.timePlayed=START_TIME)}},{key:"changeKey",value:function(t){t=t<-7?-7:t>7?7:t,this.shifter.pitchSemitones=t,this.shifter.tempo=1}},{key:"volume",value:function(t){var e=+(this.gainNode.gain.value+t).toFixed(2);this.props.songVolume=e<0?0:e>1?1:e}},{key:"toggleMute",value:function(){var t=this.gainNode.gain.value;this.props.songVolume=t?0:this.fallbackVolume,this.fallbackVolume=t}}]),t}(),ctrlTemplate='<cdg-controls> <span class="playControl"> <button class="playButton" disabled><i class="icofont-play-alt-1"></i></button> </span> <span class="timePlayed"></span> <div class="progress-container"> <progress class="progressMeter" ng-disabled="$ctrls.loading" value="0" max="100"></progress> </div> <span class="trackLength"></span> <span> <input type="number" class="pitch" step="1" min="-7" max="7" value="0" disabled> </span> <span class="volumeControl"> <div> <button class="volumeButton" id="song_volume_button" disabled><i class="icofont-audio"></i></button> <div class="volumeSlider"> <input type="range" min="0.00" max="1.00" step="0.01" class="volumeRange" id="song_volume"> </div> </div> </span> \x3c!-- <span class="volumeControl">\n <div>\n <button class="volumeButton" id="mic_volume_button"><i class="icofont-mic"></i></button>\n <div class="volumeSlider">\n <input type="range" min="0.0" max="1" step="0.1" class="volumeRange" id="mic_volume" />\n </div>\n </div>\n </span> --\x3e </cdg-controls>',css$1='@font-face{font-family:IcoFont;font-weight:400;font-style:normal;src:url("data:application/font-woff2;base64,d09GMgABAAAAAAXMAAsAAAAACvwAAAWAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGVgCDOAqJVIgXATYCJAMYCw4ABCAFhAoHVRtpCcgehXEsbKBS2ff0eD//bvrn5iZI8AbZnNUErxlUN8cqSmkqFgaZOO3UCHtqgjxR+3rwwHPL34lFvSywNDsu4naDTHgW0YYjGp7xP/z9TH/a1mBl6RiRb1HUZZE0HUfhgOLuLKK4wQ7wRPkUxHOgigy6cB9AAGgWDYilba0XlOcAPwdLkIJhBOpidJ4cD4BEtyAZVESiFxH2jb5DZ4ACxJV4DABO5BnoBdaAEEejIggutHFtHYWm//W/CtidOUJv5IH4ckEAAC0PMIDS49jQmegeg8tYKYx2IqQaIG+WIMBPN/xy069CRoKvR2KySwESdPgvD4BCwggIoBQCjVzC15ooN00aS2rtDSIHkOCXmzgAg19jJiBErSDKHo5BtOAuGoA2ACKHgFAKEKjwvQm47NAq9E61QafXiRardXL5+OXJZOWLaZT2zy+54plU4rWnll3mg0QwTtPHYgDRRZclEo7nUimE5rsHJJYnfW/7jgsgLIJojCchyBTHLxiqeH6xC4YX0+mcK/3jUZ0gGMYv6O9IOe5b1uV7MA39WtsdE3T3e7suXNBf4RY0C8fH51Hbpb1pN8+4Lj8e0zZxm6/P27RFxdRXI8ETJ6gWLhimL8R3xY9pC2NRXfJ9b7q5SDhuSHel/amRm7TeeQQJQSY7rvPpBIjS+zAoigrQu5aUl8CO6W6PlobuTKfmJoUxjvqSIUh2JZcTimE070+lopMmEt5EMOlbJ0S1w7EbLkF4/tIbdx3zEtQLoPqkYdrv1yL90ceOPUGbf/L448DW3zfYyitbvctuU1ZurIRzcGbZzjO/N+ldksNLEQkdK6zfdiO6lfQQZzSr2izO9sIQuGur2ypgD9VK+kgTrCmIfmfHjJfBHoImNWQrtZH0ky2eSsl0t1It7SeWUbbmS/tclaM1xeDT02rqmCaGPNZTVeI1f8Ns9PePm/+v2li5QBmZe1WM3tLxBhQPWVLm7Vx9h3WvMuL37AhppIe6Oa0StVlc7QXDb71nXWCmGIPlFQfhIVSrSB+1gWTJ1pyuoHzyYzAu63dVBH9g1lRgDTE/fpslsebbNuf88DUjBtvzMoei5Yhd4ZgIQ/mBd8gdR1wKu9u3bOvSzcvCy/g7mj/8aCd/gb5CqibjNHv9JYeyXeI1Ivd/6+1y15Ty5rWvONc45PbD9YnsT2b5NBuLrjqf71A4LrLLHff230s0HnXFzj91A+G1NuRLgahoGDwWDhR0t7tanfe1DcGg+1pbm1vC3jGKBqZPtEWapz/ftw+NoAfaTh/Un6V4ML5jqPpxfuN7Oe953hTcn8mvln/mhpWz+0jEFXI6Q66IOhJmy0POiEst1yRPGsDE0KSDUXljZ7sBAGRuxoDLfK0ULwYAwHfi6kxQOYe/w+sAMlOizvPvuBx81njLiSFV3d8SGf4OACD9VO9LogiXYlr4ikthyX8hA/A7A6nClYsqUb8PxOaMKIGYIkeB8hLgyy//FyQA1F5Yyo+Iv1yAIA6lNYxxJUziOjZFZhlbRKyATSthOliG0QNDsRQQpRkBJvCdMMaPwCQeZ1P0rmOLKD3Cpvm9dFKZ/GBFZ5Br4+Z4Nzu+ZSYQngxyY7os28vPhiOT3JzRarL0btHOzrHhAM+OGkd2GCNbx208P2YcC3Ozxhkuxs7McMZQmJtig7xpgudDNWbzGOkNTEFuFjoFcdpw5vDcWOO2mBEQNknGx+q0av1YYRGT+mpGViYWNtyumUNUARmwRkUwYkdaGbHVOBveAWOMcWkYZ5bxEIA1E8Y4RiHyTlNYQTyTiQmRkBpmqd8YqjFtrpt9zcYAoAUnEQUEwohEFBIhMeDLZFAS37JsdgvPUoEto5McHZoJ7CgLzPBlVioU2BJhAQA=") format("woff2"),url("data:application/font-woff;base64,d09GRgABAAAAAAeIAAsAAAAACvwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAQwAAAFZCxVENY21hcAAAAYgAAABzAAABuMwtHXxnbHlmAAAB/AAAA4cAAATU7U/mvGhlYWQAAAWEAAAAMwAAADYShvkyaGhlYQAABbgAAAAcAAAAJAc7A1lobXR4AAAF1AAAABIAAAAYF3D//2xvY2EAAAXoAAAADgAAAA4EygNsbWF4cAAABfgAAAAfAAAAIAEVAJVuYW1lAAAGGAAAASsAAAIKNKI0mnBvc3QAAAdEAAAAQgAAAFUugIA4eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR+wTiBgZWBgamKaQ8DA0MPhGZ8wGDIyAQUZWBlZsAKAtJcUxgc3ix9P5U56H8WQxRzMMM0oDAjSA4AI/QNWwB4nO2R0Q2AMAhED22NaRzFCZzBOfxynHYEjcMZO0I9wDG85jUHBD4AQATQk5kEQHYIVBuzYvkeyfIBC+ORrwPu87lqaY3uoMvqTMJ60g5ODuztdIoM+DXZv35R1M055k9Hb/Bcjt6lZkd3XosDeQH6PB94AHichZPPbxtFFMfnzbyZ8Tr+mWx2E7Dd2I133ToxsXHWaZNaJN4mqWgJaZRIQalbiYJEQEhtE4FASBUHVAkORfw6UCHlggTiwKFVhZD4A3KBExJXDlUlLj0gIQ5xeOPYauHC7mrmzdP3zex83nuMM3b4jWDCZQ5rMwY53mjCdODX/QpPcK3cYVX0ylBQWbC1cVTgDNR7HuU69NacYUcP26qncp7N14KexqM5aDR5I/DhKsysl6szAJHo1Hx4qgDmuQPRs6iErC6Xqms1JWkBXLQa60IBSPkiKoWQkLJrojy9NYMCoDm5mI0nVxuffJx5Ol9zrdJcoXju1ZX3OPLb6UG/dQKgslb9TFBI5bx36dwZG/nAcBqVxtDseFZKjZNS8Fj4ymx5g9EjuxwsMcqG2BgL2NvsFtGw3Rw0IPAroHsw3Gb3/loouromVr73Hx41qE/31lp1w3xPJUH1Uf0vqSHSa9IfAyegwz14CbnkIBUOrT9TOAL349Qpwe9yjsWfyxx4ok9ukmv4jVtmQfyqy34uhxb3SZi1uQIlV1ArCXGpVI/opQYRTR7HCO/YHJAMAX9wYpyOIyB8GLUmpjT2CH9L0N+XgJ1HqMGCeRHFwnif8wtzCHUAk4SBlPbDEoDFBc5iBAYk8lS+i743HPGPh1eJP8yP0MkHI8LirqDwBxgx+WBM/MD3qC7LbJ5tsC3Kh1cgkLbrDGplE55aIyBeXtHgLUPamYXaMe4E0+m65/altu6S7Eo9bbwJeMLbBK9oAtNiAuNyFPE12EYclXFcy2ay2c5qLvFuNPoVx8+j+mtLSPU3xoxsoUV0RjGOc0ODJz+l+SlaZzLGKWM45jgH3wPP8TuSxHF5o7O/K7txG29dv7G7kInvRjp/gfpSC9T8eSVW0GwmL+yfp5NHEJ/bWN3zj2LHt8al2R7H222fgiBq0PDDw8M3xUNxgY2wEmNpuqmpVaoYeqepe6kwE1SARXNNW0vqW8LShBOl5cV7Vy7fW1wunVxa+P3my/dvl8rwxZWfgkSi813USSYdaG+3N8PWEsDiQrjZfv2jnTducr70webld07v5q3j1i9KpGOwF0sLShH1zTb9xxqzqW8mKEcFqnqVMp0wZv4l5Xu+J2xV8Oj8gBoAnrT/vLVzrRWGrWs7kOpbv+YrefoAj2Zx0Tg7j/4tPLju5vMuBGbs7D+2Cc0/1+62WwB4nGNgZGBgAOIP9qt64vltvjJwM78AijBcPxB1Akb///8/i/kFczCQy8HABBIFAJztDyEAeJxjYGRgYA76nwUkX/z/DyIZgCIogA0Ai8sFm3icY37BwMCMgv//B9EAUrkHgQAAAAAAAACEAUwB3AIgAmoAAHicY2BkYGBgY+hkYGUAASYg5gJCBob/YD4DABbAAasAeJxdkE1qwzAQhZ/zS2MIhdKsStGqXRScn2UOkJBtFoYuHUd2HGzLyEogPUFP0BP0FD1A6bH6bKaLRkLSN2+epJEA3OIbHprmYdjOTeuQh8Jd0li4R74X7sPHg/CA+rPwCC8IhH3c4ZUneL0bKmPkwh3ym3CX/C7cI38I9zHBp/CA+pfwCCF+hH08eY+b2KxM6bY6PeWRzWKTMJIl1LbOTKnmwUyUtS61jZzeq91F1ed04VyiEmsK1Ryi89yoypqjjl1wcK5aTqeJ6EFsCmwQw2DFUcJhC40UJ74rgkXW5hLJ/Y9COi1qqk2sMOcfza48a3rK1hcx0tjTt8OFc40z71lQdXQrDss9BemvEs0acrJC1eaOVGLqAQ7trgpLTNmTK3/QVlD8AsE9WlYAeJxjYGKAAC4G7ICNkYmRmZGFkZWRjZGdgTk3M5kDiHVzS0tSWRNLUzLzuQpyEit1E3NKdA1ZCxJLi1MZGAD/FgxfAAA=") format("woff")}[class*=" icofont-"],[class^=icofont-]{font-family:IcoFont!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;white-space:nowrap;word-wrap:normal;direction:ltr;line-height:1;-webkit-font-feature-settings:"liga";-webkit-font-smoothing:antialiased}.icofont-mic:before{content:"\\ef95"}.icofont-mic-mute:before{content:"\\ef94"}.icofont-audio:before{content:"\\eea8"}.icofont-play-alt-1:before{content:"\\eca6"}.icofont-pause:before{content:"\\eca5"}.icofont-md,cdg-controls .playButton>i,cdg-controls .volumeButton>i{font-size:2em}.icofont-fw,cdg-controls .playButton>i,cdg-controls .volumeButton>i{text-align:center;width:1.25em}.mute,cdg-controls .pitch[disabled],cdg-controls .playButton[disabled],cdg-controls .volumeButton[disabled]{color:#a9a9a9}cdg-controls{position:relative;display:-ms-flexbox;display:-webkit-flex;display:-webkit-box;display:flex;height:40px;-webkit-flex-direction:row;-ms-flex-direction:row;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:100%;font-size:1.25em}cdg-controls>div,cdg-controls>span{margin:3px 5px}cdg-controls>div:first-child,cdg-controls>span:first-child{margin-left:0}cdg-controls>div:last-child,cdg-controls>span:last-child{margin-right:0}cdg-controls .playButton,cdg-controls .volumeButton{outline:none;border:none;border-radius:3px;padding:5px;width:34px;height:34px}cdg-controls .playButton[disabled],cdg-controls .volumeButton[disabled]{cursor:not-allowed}cdg-controls .volumeControl>div{position:relative;width:100%;height:100%}cdg-controls .volumeControl>div:hover .volumeSlider{display:block}cdg-controls .volumeControl>div .volumeSlider{display:none;position:absolute;top:-75px;left:-55px;z-index:1;width:100px;-webkit-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg);padding:10px 20px}cdg-controls .volumeControl>div .volumeSlider.under{top:75px;-webkit-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}cdg-controls .volumeControl>div .volumeSlider:hover{display:block}cdg-controls .volumeControl>div .volumeSlider .volumeRange{-webkit-appearance:none;width:100%;height:5px;background:#d3d3d3;border:1px solid;border-radius:2.5px;outline:none;opacity:.7;-webkit-transition:.2s;-webkit-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}cdg-controls .volumeControl>div .volumeSlider .volumeRange:hover{opacity:1}cdg-controls .volumeControl>div .volumeSlider .volumeRange::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:15px;height:15px;border-radius:50%;border:1px solid blue;background:#fff;cursor:pointer}cdg-controls .pitch{height:28px;font-size:.8em;text-align:right}cdg-controls .pitch[disabled]{cursor:not-allowed}cdg-controls .progress-container{position:relative;-webkit-box-flex:0;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto;width:100%;display:inline-block}cdg-controls .progress-container progress{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:1em}cdg-controls .progress-container progress::-webkit-progress-bar{background-color:#eee;border-radius:.5em;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25) inset;box-shadow:inset 0 2px 5px rgba(0,0,0,.25)}cdg-controls .progress-container progress::-webkit-progress-value{background-image:-webkit-linear-gradient(-45deg,transparent 33%,transparent 0,rgba(0,0,0,.1) 66%,transparent 0),-webkit-linear-gradient(top,hsla(0,0%,100%,.25),rgba(0,0,0,.25)),-webkit-linear-gradient(left,#09c,#f44);border-radius:.5em;-webkit-background-size:35px 20px,100% 100%,100% 100%;background-size:35px 20px,100% 100%,100% 100%}';styleInject(css$1);var playIcon="icofont-play-alt-1",pauseIcon="icofont-pause",htmlToElement=function(t){var e=document.createElement("template");return t=t.trim(),e.innerHTML=t,e.content.firstChild},setupListeners=function(){var t=this,e=this.player.props;this.onloaded=e.on("loaded",function(e){e?(t.playBtn.removeAttribute("disabled"),t.pitch.removeAttribute("disabled"),t.volumeBtn.removeAttribute("disabled")):(t.playBtn.setAttribute("disabled","disabled"),t.pitch.setAttribute("disabled","disabled"),t.volumeBtn.setAttribute("disabled","disabled"))}),this.ontimeplayed=e.on("timePlayed",function(e,i){e!==i&&(t.timePlayed.innerHTML=e)}),this.onpercentageplayed=e.on("percentagePlayed",function(e,i){e!==i&&(t.progress.value=e)}),this.ontracklength=e.on("trackLength",function(e,i){e!==i&&(t.trackLength.innerHTML=e)}),this.ondestroy=e.on("destroy",function(e){e&&removeListeners.call(t)}),this.onplay=e.on("isPlaying",function(e){t.playIcn.classList.remove(playIcon,pauseIcon),t.playIcn.classList.add(e?pauseIcon:playIcon)}),this.onvolume=e.on("songVolume",function(e){var i=t.volumeIcn;if(t.volumeSlider.value=e,e)return i.classList.contains("mute")?void i.classList.remove("mute"):void 0;i.classList.add("mute")}),this.playBtn.addEventListener("click",function(){return t.player.togglePlay()}),this.progress.addEventListener("click",function(e){return changePosition.call(t,e)}),this.pitch.addEventListener("change",function(){return changeKey.call(t)}),this.volumeSlider.addEventListener("change",function(){return changeVolume.call(t)})},removeListeners=function(){var t=this,e=this.player.props;e.off(this.onloaded),e.off(this.ontimeplayed),e.off(this.onpercentageplayed),e.off(this.ontracklength),e.off(this.ondestroy),e.off(this.onplay),e.off(this.onvolume),this.playBtn.removeEventListener("click",function(){return t.player.togglePlay()}),this.progress.removeEventListener("click",function(e){return changePosition.call(t,e)}),this.pitch.removeEventListener("change",function(){return changeKey.call(t)}),this.volumeSlider.removeEventListener("change",function(){return changeVolume.call(t)})},changePosition=function(t){var e=t.target.getBoundingClientRect(),i=(t.pageX-e.x)/t.target.offsetWidth;this.player.changePlayerPosition(i)},changeKey=function(){var t=this.pitch.value;isNaN(t)?this.pitch.value=this.fallbackPitch:(this.fallbackPitch=t<-7?-7:t>7?7:t,this.player.changeKey(this.fallbackPitch))},changeVolume=function(){this.player.props.songVolume=+(parseFloat(this.volumeSlider.value)+0).toFixed(2)},CDGControls=function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{position:"bottom"};classCallCheck(this,t),this.controls=htmlToElement(ctrlTemplate),this.player=null,this.playBtn=null,this.playIcn=null,this.timePlayed=null,this.progress=null,this.trackLength=null,this.pitch=null,document.querySelector(e).appendChild(this.controls),this.player=i;var r=this.player.props;if(this.playBtn=this.controls.querySelector(".playButton"),this.playIcn=this.playBtn.querySelector("i"),this.timePlayed=this.controls.querySelector(".timePlayed"),this.timePlayed.innerHTML=r.timePlayed,this.progress=this.controls.querySelector(".progressMeter"),this.progress.value=r.percentagePlayed,this.trackLength=this.controls.querySelector(".trackLength"),this.trackLength.innerHTML=r.trackLength,this.pitch=this.controls.querySelector(".pitch"),this.fallbackPitch=0,!PANEL_POSITION.includes(n.position))throw new Error("Panel Position must be either 'top' or 'bottom'.");(this.volumeBtn=this.controls.querySelector("#song_volume_button"),this.volumeIcn=this.volumeBtn.querySelector("i"),this.volumeSlider=this.controls.querySelector("#song_volume"),this.volumeSlider.value=r.songVolume,"top"===n.position)&&this.controls.querySelector(".volumeSlider").classList.add("under");setupListeners.call(this)};export{KaraokePlayer as CDGPlayer,CDGControls};
function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=[],n=!0,r=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){r=!0,o=t}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return i}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function l(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}l(".cdg-video-wrapper{position:relative;text-align:center;background-color:#000}.cdg-video-wrapper .cdg-video-player{position:relative;width:72%;margin:0 auto}.cdg-video-wrapper .titleImage{position:absolute;top:0;left:0;width:100%;height:100%;z-index:auto;background-color:transparent}.cdg-video-wrapper .titleImage.hide{display:none}");var c=300,h=216,f=[6,12,6+(c-12),12+(h-24)],p=c*h,d=4,v=75,g=4,m=24,y=1,A=1,k="0:00",b=["top","bottom"],w=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.width,o=void 0===r?c:r,s=i.height,a=void 0===s?h:s,u=i.canvas,l=void 0===u?this.createCanvas(o,a):u,f=i.ctx,d=void 0===f?this.createCanvasContext(l):f,v=i.imageData,g=void 0===v?this.createImageData(l,d,o,a):v;t(this,e),n(this,"hOffset",0),n(this,"vOffset",0),n(this,"keyColor",null),n(this,"backgroundContainer",null),n(this,"borderColor",null),n(this,"memoryColor",null),n(this,"clut",new Array(16).fill([0,0,0])),n(this,"pixels",new Array(p).fill(0)),n(this,"buffer",new Array(p).fill(0)),this.canvas=l,this.ctx=d,this.imageData=g}return i(e,[{key:"createCanvas",value:function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i}},{key:"createCanvasContext",value:function(t){var e=t.getContext("2d");return e.mozImageSmoothingEnabled=!1,e.webkitImageSmoothingEnabled=!1,e.msImageSmoothingEnabled=!1,e.imageSmoothingEnabled=!1,e}},{key:"createImageData",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.width,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.height;return e.createImageData(i,n)}},{key:"reset",value:function(){this.hOffset=0,this.vOffset=0,this.keyColor=null,this.backgroundColor=null,this.borderColor=null,this.memoryColor=null,this.pixels.fill(0)}},{key:"setCLUTEntry",value:function(t,e,i,n){this.clut[t]=[e,i,n].map(function(t){return 17*t})}},{key:"setPixel",value:function(t,e,i){this.pixels[t+e*c]=i}},{key:"getPixel",value:function(t,e){return this.pixels[t+e*c]}},{key:"getBackground",value:function(){switch(!0){case null!=this.keyColor:return this.keyColor;case null!=this.backgroundColor:return this.backgroundColor;case null!=this.memoryColor:return this.memoryColor;case null!=this.borderColor:return this.borderColor;default:return 0}}},{key:"generateImageData",value:function(){for(var t=c,e=h,i=0;i<t;i++)for(var n=0;n<e;n++){var r=4*(i+n*c),o=(i-this.hOffset+c)%c+(n-this.vOffset+h)%h*c,s=this.pixels[o],a=u(this.clut[s],3),l=a[0],f=a[1],p=a[2];this.imageData.data[r]=l,this.imageData.data[r+1]=f,this.imageData.data[r+2]=p,this.imageData.data[r+3]=s===this.keyColor?0:255}return this.imageData}},{key:"renderFrame",value:function(){this.ctx.putImageData(this.generateImageData(),0,0)}}]),e}();function B(){var t;console&&console.warn&&(t=console).warn.apply(t,arguments)}var x=function(){function e(i){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t(this,e),this.bytes=i.slice(n,n+m)}return i(e,[{key:"instruction",get:function(){return this.constructor.instruction}},{key:"opcode",get:function(){return this.constructor.opcode}}]),i(e,[{key:"execute",value:function(){}},{key:"bytecodeToString",value:function(){return this.bytes.map(function(t){return t.toString(16).padStart(2,"0")}).join("")}},{key:"detailsToString",value:function(){return""}},{key:"toString",value:function(){return this.instruction}}]),e}();n(x,"instruction",""),n(x,"opcode",null);var C=function(e){function i(){return t(this,i),a(this,o(i).apply(this,arguments))}return r(i,x),i}();n(C,"instruction","No-op"),n(C,"opcode",0);var P=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t(this,n),i=a(this,o(n).call(this,e,r));var s=r+d;return i.color=15&e[s],i.repeat=15&e[s+1],i}return r(n,x),i(n,[{key:"execute",value:function(t){t.memoryColor=this.color,t.backgroundColor=this.color,t.pixels.fill(this.color)}},{key:"detailsToString",value:function(){return"color index: ".concat(this.color)}}]),n}();n(P,"instruction","Memory Preset"),n(P,"opcode",1);var S=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t(this,n),(i=a(this,o(n).call(this,e,r))).color=15&e[r+d],i}return r(n,x),i(n,[{key:"execute",value:function(t){t.borderColor=this.color,t.backgroundColor=this.color;for(var e=u(f,4),i=e[0],n=e[1],r=e[2],o=e[3],s=0;s<c;s++){for(var a=0;a<n;a++)t.setPixel(s,a,this.color);for(var l=o+1;l<h;l++)t.setPixel(s,l,this.color)}for(var p=n;p<=o;p++){for(var d=0;d<i;d++)t.setPixel(d,p,this.color);for(var v=r+1;v<c;v++)t.setPixel(v,p,this.color)}}},{key:"detailsToString",value:function(){return"color index: ".concat(this.color)}}]),n}();n(S,"instruction","Border Preset"),n(S,"opcode",2);var _=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t(this,n),i=a(this,o(n).call(this,e,r));var s=r+d;return i.colors=[15&e[s],15&e[s+1]],i.row=31&e[s+2],i.column=63&e[s+3],i.pixels=e.slice(s+4,s+16),i}return r(n,x),i(n,[{key:"execute",value:function(t){var e=6*this.column,i=12*this.row;if(e+6>c||i+12>h)B("TileBlock out of bounds (".concat(this.row,", ").concat(this.column,")"));else for(var n=0;n<12;n++)for(var r=this.pixels[n],o=0;o<6;o++){var s=this.colors[r>>5-o&1];this.op(t,e+o,i+n,s)}}},{key:"op",value:function(t,e,i,n){t.setPixel(e,i,n)}},{key:"detailsToString",value:function(){return"row: ".concat(this.row,", column: ").concat(this.column,", color indexes: [").concat(this.colors.join(", "),"]")}}]),n}();n(_,"instruction","Tile Block"),n(_,"opcode",6);var L=function(e){function n(){return t(this,n),a(this,o(n).apply(this,arguments))}return r(n,_),i(n,[{key:"op",value:function(t,e,i,n){t.setPixel(e,i,t.getPixel(e,i)^n)}}]),n}();n(L,"instruction","Tile Block (XOR)"),n(L,"opcode",38);var I=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t(this,n),i=a(this,o(n).call(this,e,r));var s=r+d;i.color=15&e[s];var u=63&e[s+1];i.hCmd=(48&u)>>4,i.hOffset=7&u;var l=63&e[s+2];return i.vCmd=(48&l)>>4,i.vOffset=15&l,i}return r(n,x),i(n,[{key:"execute",value:function(t){t.backgroundColor=this.color,t.hOffset=Math.min(this.hOffset,5),t.vOffset=Math.min(this.vOffset,11);var e=0;switch(this.hCmd){case 2:e=6;break;case 1:e=-6}var i=0;switch(this.hCmd){case 2:i=12;break;case 1:i=-12}if(e||i){for(var n=0;n<c;n++)for(var r=0;r<h;r++)t.buffer[n+r*c]=this.getPixel(t,n+e,r+i);var o=[t.buffer,t.pixels];t.pixels=o[0],t.buffer=o[1]}}},{key:"getPixel",value:function(t,e,i){return e>0&&e<c&&i>0&&i<h?t.pixels[e+i*c]:this.color}},{key:"detailsToString",value:function(){var t=!1,e=!1;return 1===this.vCmd?t="up":2===this.vCmd&&(t="down"),1===this.vCmd?e="left":2===this.vCmd&&(e="right"),[t,e,"vOffset: ".concat(this.vOffset),"hOffset: ".concat(this.hOffset)].filter(function(t){return t}).join(" ")}}]),n}();n(I,"instruction","Scroll Preset"),n(I,"opcode",20);var E=function(e){function n(){return t(this,n),a(this,o(n).apply(this,arguments))}return r(n,I),i(n,[{key:"getPixel",value:function(t,e,i){return e=(e+c)%c,i=(i+h)%h,t.pixels[e+i*c]}}]),n}();n(E,"instruction","Scroll Copy"),n(E,"opcode",24);var O=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t(this,n),(i=a(this,o(n).call(this,e,r))).color=15&e[r+d],i}return r(n,x),i(n,[{key:"execute",value:function(t){t.keyColor=this.color}},{key:"detailsToString",value:function(){return"color index: ".concat(this.color)}}]),n}();n(O,"instruction","Set Key Color"),n(O,"opcode",28);var T=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t(this,n),i=a(this,o(n).call(this,e,r));var s=r+d;i.colors=[];for(var u=0;u<8;u++){var l=s+2*u,c=((63&e[l])<<6)+(63&e[l+1]);i.colors[u]=[c>>8,(240&c)>>4,15&c]}return i}return r(n,x),i(n,[{key:"clutOffset",get:function(){return 0}}]),i(n,[{key:"execute",value:function(t){for(var e=0;e<8;e++)t.setCLUTEntry(e+this.clutOffset,this.colors[e][0],this.colors[e][1],this.colors[e][2])}},{key:"detailsToString",value:function(){var t=this;return"colors: [".concat(this.colors.map(function(e,i){return"".concat(i+t.clutOffset,": #").concat(e.map(function(t){return t.toString(16)}).join(""))}).join(", "),"]")}}]),n}();n(T,"instruction","Load CLUT (Low)"),n(T,"opcode",30);var R=function(e){function n(){return t(this,n),a(this,o(n).apply(this,arguments))}return r(n,T),i(n,[{key:"clutOffset",get:function(){return 8}}]),n}();n(R,"instruction","Load CLUT (High)"),n(R,"opcode",31);var M=function(){function e(){t(this,e),n(this,"instructionClassByType",this.constructor.instructionClassByType)}return i(e,[{key:"registerInstruction",value:function(t,e){this.instructionClassByType[t]=e}},{key:"createInstruction",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t in this.instructionClassByType||B("Unknown CDG instruction (instruction = ".concat(t,")")),new(this.instructionClassByType[t]||C)(e,i)}},{key:"parseInstruction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(9===(63&t[e])){var i=63&t[e+1];return this.createInstruction(i,t,e)}return new C(t,e)}},{key:"parseInstructions",value:function(t){for(var e=[],i=t.length,n=0;n<i;n+=m)e.push(this.parseInstruction(t,n));return e.filter(function(t){return t})}}],[{key:"instructionClassByType",get:function(){var t;return n(t={},0,C),n(t,1,P),n(t,2,S),n(t,6,_),n(t,20,I),n(t,24,E),n(t,28,O),n(t,30,T),n(t,31,R),n(t,38,L),t}}]),e}();function j(){if("undefined"!=typeof performance&&"function"==typeof performance.now)return performance.now();if("undefined"!=typeof process&&"function"==typeof process.hrtime){var t=u(process.hrtime(),2);return 1e3*t[0]+t[1]/1e6}return Date.now()}function D(t){return"function"==typeof requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,25)}var Y=function(){function e(){var i=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=r.contextOptions,s=void 0===o?{}:o,a=r.context,u=void 0===a?this.createContext(s):a,l=r.afterRender;t(this,e),n(this,"instructions",[]),n(this,"pc",-1),n(this,"frameId",null),n(this,"pos",0),n(this,"lastSyncPos",null),n(this,"lastTimestamp",null),n(this,"update",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j();if(-1===i.pc)return i;i.frameId=D(i.update),i.lastSyncPos?i.pos=i.lastSyncPos+(t-i.lastTimestamp):(i.pos+=t-i.lastTimestamp,i.lastTimestamp=t);var e=Math.floor(v*g*(i.pos/1e3))-i.pc;return e>0&&(i.fastForward(e),i.render()),i}),this.context=u,this.afterRender=l}return i(e,[{key:"createContext",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new w(t)}},{key:"load",value:function(t){var e=new M;return this.instructions=e.parseInstructions(t),this.reset(),this}},{key:"reset",value:function(){return this.pc=0,this.pos=0,this.lastSyncPos=null,this.context.reset(),this}},{key:"render",value:function(){return this.context.renderFrame(),this.afterRender&&this.afterRender(this.context),this}},{key:"executeInstruction",value:function(t){return t&&"function"==typeof t.execute&&t.execute(this.context),this}},{key:"step",value:function(){return this.pc>=0&&this.pc<this.instructions.length?(this.executeInstruction(this.instructions[this.pc]),this.pc+=1):(this.pc=-1,this.stop()),this}},{key:"fastForward",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=this.pc+t;this.pc>=0&&this.pc<e;)this.step();return this}},{key:"play",value:function(){return this.frameId||(this.frameId=D(this.update),this.lastTimestamp=j()),this}},{key:"stop",value:function(){var t;return t=this.frameId,"function"==typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t),this.frameId=null,this.lastSyncPos=null,this}},{key:"sync",value:function(t){return this.lastSyncPos=t,this.lastTimestamp=j(),this}}]),e}(),F=function(){return"undefined"!=typeof Promise&&Promise.defer?Promise.defer():"undefined"!=typeof PromiseUtils&&PromiseUtils.defer?PromiseUtils.defer():(this.resolve=null,this.reject=null,this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this)),void Object.freeze(this))},H=function(t){return JSZip.loadAsync(t).catch(function(t){return Promise.reject(new Error("There was an error reading the zip file.",t))})},z=function(t){var e=t.filter(function(t){return t.endsWith(".cdg")||t.endsWith(".mp3")});return 2===e.length?Promise.resolve(e):Promise.reject("The file is not a karaoke .zip file")},q=function(t){var e=t.filter(function(t){return t.name.endsWith(".mp3")}),i=t.filter(function(t){return t.name.endsWith(".cdg")}),n=[];if(e.length&&i.length)return n.push(e[0].async("arraybuffer").catch(function(){return Promise.reject(new Error("Unable to load the audio file"))})),n.push(function(t){return t.async("uint8array").catch(function(){return Promise.reject(new Error("Unable to load the video file"))})}(i[0])),n.push(function(t){return t.async("blob").then(function(e){return new Promise(function(i){new jsmediatags.Reader(e).setTagsToRead(["title","artist","album","track","year","genre","picture"]).read({onSuccess:function(t){return i(t)},onError:function(){return i((e=t.name,n=e.split(" - "),(r={tags:{}}).tags.album=n[0].trim(),r.tags.artist=n[1]?n[1].trim():r.tags.album,r.tags.title=n[2]?n[2].trim():r.tags.artist,r));var e,n,r}})})}).catch(function(){return Promise.reject(new Error("Unable to parse tag data"))})}(e[0])),Promise.all(n).catch(function(){return Promise.reject(new Error("Processing audio and video failed"))});var r=[];return e.length||r.push("No mp3 audio file present."),i.length||r.push("No cdg video file present."),Promise.reject(new Error(r.join(" ")))},N=function(){function e(){t(this,e)}return i(e,null,[{key:"loadZipFile",value:function(t){return function(t){var e=new F;return JSZipUtils.getBinaryContent(t,function(i,n){i?e.reject(new Error("There was an error retrieving ".concat(t),i)):e.resolve(n)}),e.promise}(t).then(function(t){return H(t)}).then(function(t){return z(t)}).then(function(t){return q(t)}).catch(function(t){return Promise.reject(t)})}},{key:"loadFileBuffer",value:function(t){return H(t).then(function(t){return z(t)}).then(function(t){return q(t)}).catch(function(t){return Promise.reject(t)})}}]),e}();function U(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Q(t,e,i){return e&&W(t.prototype,e),i&&W(t,i),t}function G(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Z(t,e)}function J(t){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Z(t,e){return(Z=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function V(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function K(t,e,i){return(K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=J(t)););return t}(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(i):r.value}})(t,e,i||t)}var X=function(){function t(){U(this,t),this._vector=new Float32Array,this._position=0,this._frameCount=0}return Q(t,[{key:"clear",value:function(){this.receive(this._frameCount),this.rewind()}},{key:"put",value:function(t){this._frameCount+=t}},{key:"putSamples",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=2*(e=e||0);i>=0||(i=(t.length-n)/2);var r=2*i;this.ensureCapacity(i+this._frameCount);var o=this.endIndex;this.vector.set(t.subarray(n,n+r),o),this._frameCount+=i}},{key:"putBuffer",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;e=e||0,i>=0||(i=t.frameCount-e),this.putSamples(t.vector,t.position+e,i)}},{key:"receive",value:function(t){t>=0&&!(t>this._frameCount)||(t=this.frameCount),this._frameCount-=t,this._position+=t}},{key:"receiveSamples",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=2*e,n=this.startIndex;t.set(this._vector.subarray(n,n+i)),this.receive(e)}},{key:"extract",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.startIndex+2*e,r=2*i;t.set(this._vector.subarray(n,n+r))}},{key:"ensureCapacity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=parseInt(2*t);if(this._vector.length<e){var i=new Float32Array(e);i.set(this._vector.subarray(this.startIndex,this.endIndex)),this._vector=i,this._position=0}else this.rewind()}},{key:"ensureAdditionalCapacity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+t)}},{key:"rewind",value:function(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}},{key:"vector",get:function(){return this._vector}},{key:"position",get:function(){return this._position}},{key:"startIndex",get:function(){return 2*this._position}},{key:"frameCount",get:function(){return this._frameCount}},{key:"endIndex",get:function(){return 2*(this._position+this._frameCount)}}]),t}(),$=function(){function t(e){U(this,t),e?(this._inputBuffer=new X,this._outputBuffer=new X):this._inputBuffer=this._outputBuffer=null}return Q(t,[{key:"clear",value:function(){this._inputBuffer.clear(),this._outputBuffer.clear()}},{key:"inputBuffer",get:function(){return this._inputBuffer},set:function(t){this._inputBuffer=t}},{key:"outputBuffer",get:function(){return this._outputBuffer},set:function(t){this._outputBuffer=t}}]),t}(),tt=function(t){function e(t){var i;return U(this,e),(i=V(this,J(e).call(this,t))).reset(),i._rate=1,i}return G(e,$),Q(e,[{key:"reset",value:function(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}},{key:"clone",value:function(){var t=new e;return t.rate=this._rate,t}},{key:"process",value:function(){var t=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(t/this._rate+1);var e=this.transpose(t);this._inputBuffer.receive(),this._outputBuffer.put(e)}},{key:"transpose",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===t)return 0;for(var e=this._inputBuffer.vector,i=this._inputBuffer.startIndex,n=this._outputBuffer.vector,r=this._outputBuffer.endIndex,o=0,s=0;this.slopeCount<1;)n[r+2*s]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*e[i],n[r+2*s+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*e[i+1],s+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==t)t:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,(o+=1)>=t-1)break t;var a=i+2*o;n[r+2*s]=(1-this.slopeCount)*e[a]+this.slopeCount*e[a+2],n[r+2*s+1]=(1-this.slopeCount)*e[a+1]+this.slopeCount*e[a+3],s+=1,this.slopeCount+=this._rate}return this.prevSampleL=e[i+2*t-2],this.prevSampleR=e[i+2*t-1],s}},{key:"rate",set:function(t){this._rate=t}}]),e}(),et=function(){function t(e){U(this,t),this._pipe=e}return Q(t,[{key:"fillInputBuffer",value:function(){throw new Error("fillInputBuffer() not overridden")}},{key:"fillOutputBuffer",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.outputBuffer.frameCount<t;){var e=16384-this.inputBuffer.frameCount;if(this.fillInputBuffer(e),this.inputBuffer.frameCount<16384)break;this._pipe.process()}}},{key:"clear",value:function(){this._pipe.clear()}},{key:"pipe",get:function(){return this._pipe}},{key:"inputBuffer",get:function(){return this._pipe.inputBuffer}},{key:"outputBuffer",get:function(){return this._pipe.outputBuffer}}]),t}(),it=function(){},nt=function(t){function e(t,i){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;return U(this,e),(n=V(this,J(e).call(this,i))).callback=r,n.sourceSound=t,n.historyBufferSize=22050,n._sourcePosition=0,n.outputBufferPosition=0,n._position=0,n}return G(e,et),Q(e,[{key:"onEnd",value:function(){this.callback()}},{key:"fillInputBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=new Float32Array(2*t),i=this.sourceSound.extract(e,t,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(e,0,i)}},{key:"extract",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+e);var i=Math.min(e,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(t,this.outputBufferPosition,i);var n=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,n),this.outputBuffer.receive(Math.max(n-this.historyBufferSize,0)),this._position+=i,i}},{key:"handleSampleData",value:function(t){this.extract(t.data,4096)}},{key:"clear",value:function(){K(J(e.prototype),"clear",this).call(this),this.outputBufferPosition=0}},{key:"position",get:function(){return this._position},set:function(t){if(t>this._position)throw new RangeError("New position may not be greater than current position");var e=this.outputBufferPosition-(this._position-t);if(e<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=e,this._position=t}},{key:"sourcePosition",get:function(){return this._sourcePosition},set:function(t){this.clear(),this._sourcePosition=t}}]),e}(),rt=0,ot=0,st=8,at=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],ut=function(t){function e(t){var i;return U(this,e),(i=V(this,J(e).call(this,t)))._quickSeek=!0,i.midBufferDirty=!1,i.midBuffer=null,i.overlapLength=0,i.autoSeqSetting=!0,i.autoSeekSetting=!0,i._tempo=1,i.setParameters(44100,rt,ot,st),i}return G(e,$),Q(e,[{key:"clear",value:function(){K(J(e.prototype),"clear",this).call(this),this.clearMidBuffer()}},{key:"clearMidBuffer",value:function(){this.midBufferDirty&&(this.midBufferDirty=!1,this.midBuffer=null)}},{key:"setParameters",value:function(t,e,i,n){t>0&&(this.sampleRate=t),n>0&&(this.overlapMs=n),e>0?(this.sequenceMs=e,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}},{key:"calculateOverlapLength",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;t=(t=this.sampleRate*e/1e3)<16?16:t,t-=t%8,this.overlapLength=t,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}},{key:"checkLimits",value:function(t,e,i){return t<e?e:t>i?i:t}},{key:"calculateSequenceParameters",value:function(){var t,e;this.autoSeqSetting&&(t=150+-50*this._tempo,t=this.checkLimits(t,50,125),this.sequenceMs=Math.floor(t+.5)),this.autoSeekSetting&&(e=25- -10/1.5*.5+-10/1.5*this._tempo,e=this.checkLimits(e,15,25),this.seekWindowMs=Math.floor(e+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}},{key:"clone",value:function(){var t=new e;return t.tempo=this._tempo,t.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),t}},{key:"seekBestOverlapPosition",value:function(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}},{key:"seekBestOverlapPositionStereo",value:function(){var t,e,i,n=0;for(this.preCalculateCorrelationReferenceStereo(),t=0,e=Number.MIN_VALUE;n<this.seekLength;n+=1)(i=this.calculateCrossCorrelationStereo(2*n,this.refMidBuffer))>e&&(e=i,t=n);return t}},{key:"seekBestOverlapPositionStereoQuick",value:function(){var t,e,i,n,r,o=0;for(this.preCalculateCorrelationReferenceStereo(),e=Number.MIN_VALUE,t=0,n=0,r=0;o<4;o+=1){for(var s=0;at[o][s]&&!((r=n+at[o][s])>=this.seekLength);)(i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer))>e&&(e=i,t=r),s+=1;n=t}return t}},{key:"preCalculateCorrelationReferenceStereo",value:function(){for(var t,e,i=0;i<this.overlapLength;i+=1)e=i*(this.overlapLength-i),t=2*i,this.refMidBuffer[t]=this.midBuffer[t]*e,this.refMidBuffer[t+1]=this.midBuffer[t+1]*e}},{key:"calculateCrossCorrelationStereo",value:function(t,e){var i=this._inputBuffer.vector;t+=this._inputBuffer.startIndex;for(var n,r=0,o=2,s=2*this.overlapLength;o<s;o+=2)r+=i[n=o+t]*e[o]+i[n+1]*e[o+1];return r}},{key:"overlap",value:function(t){this.overlapStereo(2*t)}},{key:"overlapStereo",value:function(t){var e=this._inputBuffer.vector;t+=this._inputBuffer.startIndex;for(var i,n,r,o,s,a=this._outputBuffer.vector,u=this._outputBuffer.endIndex,l=0,c=1/this.overlapLength;l<this.overlapLength;l+=1)n=(this.overlapLength-l)*c,r=l*c,o=(i=2*l)+t,a[(s=i+u)+0]=e[o+0]*r+this.midBuffer[i+0]*n,a[s+1]=e[o+1]*r+this.midBuffer[i+1]*n}},{key:"process",value:function(){var t,e,i;if(null===this.midBuffer){if(this._inputBuffer.frameCount<this.overlapLength)return;this.midBuffer=new Float32Array(2*this.overlapLength),this._inputBuffer.receiveSamples(this.midBuffer,this.overlapLength)}for(;this._inputBuffer.frameCount>=this.sampleReq;){t=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(t)),this._outputBuffer.put(this.overlapLength),(e=this.seekWindowLength-2*this.overlapLength)>0&&this._outputBuffer.putBuffer(this._inputBuffer,t+this.overlapLength,e);var n=this._inputBuffer.startIndex+2*(t+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(n,n+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}},{key:"tempo",set:function(t){var e;this._tempo=t,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,e=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(e+this.overlapLength,this.seekWindowLength)+this.seekLength},get:function(){return this._tempo}},{key:"inputChunkSize",get:function(){return this.sampleReq}},{key:"outputChunkSize",get:function(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}},{key:"quickSeek",set:function(t){this._quickSeek=t}}]),e}(),lt=function(t,e){return(t>e?t-e:e-t)>1e-10},ct=function(){function t(){U(this,t),this.transposer=new tt(!1),this.stretch=new ut(!1),this._inputBuffer=new X,this._intermediateBuffer=new X,this._outputBuffer=new X,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}return Q(t,[{key:"clear",value:function(){this.transposer.clear(),this.stretch.clear()}},{key:"clone",value:function(){var e=new t;return e.rate=this.rate,e.tempo=this.tempo,e}},{key:"calculateEffectiveRateAndTempo",value:function(){var t=this._tempo,e=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,lt(this._tempo,t)&&(this.stretch.tempo=this._tempo),lt(this._rate,e)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}},{key:"process",value:function(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}},{key:"rate",get:function(){return this._rate},set:function(t){this.virtualRate=t,this.calculateEffectiveRateAndTempo()}},{key:"rateChange",set:function(t){this._rate=1+.01*t}},{key:"tempo",get:function(){return this._tempo},set:function(t){this.virtualTempo=t,this.calculateEffectiveRateAndTempo()}},{key:"tempoChange",set:function(t){this.tempo=1+.01*t}},{key:"pitch",set:function(t){this.virtualPitch=t,this.calculateEffectiveRateAndTempo()}},{key:"pitchOctaves",set:function(t){this.pitch=Math.exp(.69314718056*t),this.calculateEffectiveRateAndTempo()}},{key:"pitchSemitones",set:function(t){this.pitchOctaves=t/12}},{key:"inputBuffer",get:function(){return this._inputBuffer}},{key:"outputBuffer",get:function(){return this._outputBuffer}}]),t}(),ht=function(){function t(e){U(this,t),this.buffer=e,this._position=0}return Q(t,[{key:"extract",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.position=i;for(var n=this.buffer.getChannelData(0),r=this.dualChannel?this.buffer.getChannelData(1):this.buffer.getChannelData(0),o=0;o<e;o++)t[2*o]=n[o+i],t[2*o+1]=r[o+i];return Math.min(e,n.length-i)}},{key:"dualChannel",get:function(){return this.buffer.numberOfChannels>1}},{key:"position",get:function(){return this._position},set:function(t){this._position=t}}]),t}(),ft=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4096,r=t.createScriptProcessor(n,2,2),o=new Float32Array(2*n);return r.onaudioprocess=function(t){var r=t.outputBuffer.getChannelData(0),s=t.outputBuffer.getChannelData(1),a=e.extract(o,n);i(e.sourcePosition),0===a&&e.onEnd();for(var u=0;u<a;u++)r[u]=o[2*u],s[u]=o[2*u+1]},r},pt=function(t){var e,i,n,r=Math.floor(t/60),o=t-60*r;return"".concat(r,":").concat((e=parseInt(o),n=n||"0",(e+="").length>=(i=2)?e:new Array(i-e.length+1).join(n)+e))},dt=function(t){var e=this.timePlayed,i=this.sampleRate;if(this.sourcePosition=t,this.timePlayed=t/i,e!==this.timePlayed){var n=new CustomEvent("play",{detail:{timePlayed:this.timePlayed,formattedTimePlayed:this.formattedTimePlayed,percentagePlayed:this.percentagePlayed}});this._node.dispatchEvent(n)}},vt=function(){function t(e,i,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:it;U(this,t),this._soundtouch=new ct;var s=new ht(i);this.timePlayed=0,this.sourcePosition=0,this._filter=new nt(s,this._soundtouch,o),this._node=ft(e,this._filter,function(t){return dt.call(r,t)}),this.tempo=1,this.rate=1,this.duration=i.duration,this.sampleRate=e.sampleRate,this.listeners=[]}return Q(t,[{key:"connect",value:function(t){this._node.connect(t)}},{key:"disconnect",value:function(){this._node.disconnect()}},{key:"on",value:function(t,e){this.listeners.push({name:t,cb:e}),this._node.addEventListener(t,function(t){return e(t.detail)})}},{key:"off",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=this.listeners;e&&(i=i.filter(function(t){return t.name===e})),i.forEach(function(e){t._node.removeEventListener(e.name,function(t){return e.cb(t.detail)})})}},{key:"formattedDuration",get:function(){return pt(this.duration)}},{key:"formattedTimePlayed",get:function(){return pt(this.timePlayed)}},{key:"percentagePlayed",get:function(){return 100*this._filter.sourcePosition/(this.duration*this.sampleRate)},set:function(t){this._filter.sourcePosition=parseInt(t*this.duration*this.sampleRate)}},{key:"node",get:function(){return this._node}},{key:"pitch",set:function(t){this._soundtouch.pitch=t}},{key:"pitchSemitones",set:function(t){this._soundtouch.pitchSemitones=t}},{key:"rate",set:function(t){this._soundtouch.rate=t}},{key:"tempo",set:function(t){this._soundtouch.tempo=t}}]),t}(),gt=function(){function e(){t(this,e),this.fns={any:[]}}return i(e,[{key:"has",value:function(t){return t in this.fns&&this.fns[t].length>0||this.fns.any.length>0}},{key:"on",value:function(t,e){return t in this.fns==!1&&(this.fns[t]=[]),this.fns[t].push(e),e}},{key:"fire",value:function(t,e,i){return this.fns.any.concat(t in this.fns?this.fns[t]:[]).forEach(function(n){return n(e,i,t)}),this}},{key:"off",value:function(t){for(var e in this.fns)for(var i=this.fns[e],n=0;n<i.length;n++)if(i[n]===t)return i.splice(n,1),!0;return!1}},{key:"once",value:function(t,e){var i=this;return this.on(t,function t(n,r,o){e(n,r,o),i.off(t)}),e}}]),e}(),mt=function(t){if(t.on&&t.off)return t;var e=new gt,i=new Proxy(t,{get:function(t,n){if(n in t){if(t.constructor===Array){var r=i;"pop"===n?r=t[t.length-1]:"shift"===n&&(r=t[0]),"push"!==n&&"length"!==n&&e.fire(n,r)}return t[n]}return"on"===n?e.on.bind(e):"once"===n?e.once.bind(e):"off"===n?e.off.bind(e):void 0},set:function(t,i,n){return t.constructor===Array?"length"!==i&&e.fire("change",n):e.has(i)&&e.fire(i,n,t[i]),t[i]=n,!0}});return i},yt=function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i},At=function(t){var e=t.getContext("2d");return e.webkitImageSmoothingEnabled=!1,e.mozImageSmoothingEnabled=!1,e.msImageSmoothingEnabled=!1,e.imageSmoothingEnabled=!1,e},kt=function(t){t.keyColor>=0&&this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.drawImage(t.canvas,0,0,t.canvas.width,t.canvas.height,0,0,this.canvas.width,this.canvas.height)},bt=function(t,e){t.clearRect(0,0,e.width,e.height)},wt=function(t,e,i,n,r,o){for(var s=e.split(" "),a="",u=0;u<s.length;u++){var l=a+s[u]+" ";t.measureText(l).width>r&&u>0?(t.fillText(a.trim(),i,n),a=s[u]+" ",n+=o):a=l}t.fillText(a.trim(),i,n)},Bt=function(){var t=this.ctx,e=this.canvas,i=e.width-10,n=i/2,r=60;t.font="30px sans-serif",t.fillStyle="#fff",t.textAlign="center",wt(t,this.tag.title,n,r,i,30),t.font="20px sans-serif",r=e.height-60,wt(t,"by ".concat(this.tag.artist),n,r,i,30)},xt=function(t){var e=this,i=[];return i.push(function(t){var e=this;return this.shifter&&this.shifter.off(),this.audio.decodeAudioData(t).then(function(t){e.shifter=mt(new vt(e.audio,t,1024,function(){e.stop()})),e.shifter.on("play",function(t){e.props.timePlayed=t.formattedTimePlayed,e.props.percentagePlayed=t.percentagePlayed,e.player.sync(1e3*t.timePlayed-800)}),e.shifter.pitch=1,e.props.trackLength=e.shifter.formattedDuration}).catch(function(t){return Promise.reject(new Error("There was an error decoding the audio file",t))})}.call(this,t[0])),i.push(function(t){var e=new F;return t?(this.player.load(Array.from(t)),e.resolve()):e.reject(new Error("There was an error loading the video file")),e.promise}.call(this,t[1])),Promise.all(i).then(function(){e.props.status="File Loaded",e.props.loaded=!0,function(t){if(this.tag=t&&t.tags,this.tag)return Bt.call(this)}.call(e,t[2])}).catch(function(t){return e.props.status="File Loading Failed",Promise.reject(t)}).then(function(){e.props.loading=!1})},Ct=function(t){this.gainNode.gain.value=t},Pt=function(){function e(i){var r=this;if(t(this,e),n(this,"audio",null),n(this,"gainNode",null),n(this,"shifter",null),n(this,"wrapper",null),n(this,"player",null),n(this,"currentSize",A),n(this,"canvas",null),n(this,"ctx",null),n(this,"props",mt({status:"",loaded:!1,loading:!1,isPlaying:!1,timePlayed:k,trackLength:k,percentagePlayed:0,songVolume:1,destroy:!1})),this.wrapper=document.querySelector(i),!this.wrapper)throw new Error('CDGPlayer: and element was not found with the "'.concat(i,'" selector'));this.wrapper.classList.add("cdg-video-wrapper"),this.canvas=yt(c,h),this.canvas.classList.add("cdg-video-player"),this.ctx=At(this.canvas),this.player=new Y({afterRender:function(t){return kt.call(r,t)}}),this.wrapper.appendChild(this.canvas);var o=document.createElement("div");o.classList.add("titleImage"),this.wrapper.appendChild(o),this.onloaded=this.props.on("loaded",function(t){t?o.classList.add("hide"):o.classList.remove("hide")}),this.audio=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audio.createGain(),this.onvolume=this.props.on("songVolume",function(t){Ct.call(r,t)}),this.props.songVolume=y}return i(e,[{key:"destroy",value:function(){this.wrapper.classList.remove("cdg-video-wrapper"),this.stop(),this.gainNode.disconnect(),this.shifter&&this.shifter.off(),this.shifter=null,this.gainNode=null,this.audio=null,this.canvas.remove(),this.props.destroy=!0,this.props.off("onvolume")}},{key:"load",value:function(t){var e,i=this;if(this.stop(),bt(this.ctx,this.canvas),this.props.loading=!0,"string"==typeof t){if(!t.toLowerCase().endsWith(".zip"))return this.props.loading=!1,this.props.status="".concat(t,' doesn\'t appear to be a ".zip" file.'),Promise.reject(this.props.status);this.props.status="Retrieving File...",e=N.loadZipFile(t)}else this.props.status="Loading File...",e=N.loadFileBuffer(t);return e.then(function(t){return xt.call(i,t)}).catch(function(t){return Promise.reject(t)})}},{key:"togglePlay",value:function(){this.props.isPlaying?this.pause():this.start()}},{key:"start",value:function(){var t=this;bt.call(this,this.ctx,this.canvas),this.shifter.connect(this.gainNode),this.gainNode.connect(this.audio.destination),this.audio.resume().then(function(){t.props.isPlaying=!0,t.player.play()})}},{key:"pause",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.props.isPlaying=t,this.shifter.disconnect(),this.player.stop()}},{key:"stop",value:function(){this.shifter&&(this.pause(),this.changePlayerPosition(0),Bt.call(this))}},{key:"changePlayerPosition",value:function(t){t=t<0?0:t>100?100:t,this.shifter.percentagePlayed=t,this.props.percentagePlayed=this.shifter.percentagePlayed,this.props.timePlayed=this.shifter.formattedTimePlayed,this.player.reset(),t||(this.props.isPlaying=!1,this.props.timePlayed=k)}},{key:"changeKey",value:function(t){t=t<-7?-7:t>7?7:t,this.shifter.pitchSemitones=t,this.shifter.tempo=1}},{key:"volume",value:function(t){var e=+(this.gainNode.gain.value+t).toFixed(2);this.props.songVolume=e<0?0:e>1?1:e}},{key:"toggleMute",value:function(){var t=this.gainNode.gain.value;this.props.songVolume=t?0:this.fallbackVolume,this.fallbackVolume=t}}]),e}();l('@font-face{font-family:IcoFont;font-weight:400;font-style:normal;src:url("data:font/woff2;base64,d09GMgABAAAAAAXMAAsAAAAACvwAAAWAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGVgCDOAqJVIgXATYCJAMYCw4ABCAFhAoHVRtpCcgehXEsbKBS2ff0eD//bvrn5iZI8AbZnNUErxlUN8cqSmkqFgaZOO3UCHtqgjxR+3rwwHPL34lFvSywNDsu4naDTHgW0YYjGp7xP/z9TH/a1mBl6RiRb1HUZZE0HUfhgOLuLKK4wQ7wRPkUxHOgigy6cB9AAGgWDYilba0XlOcAPwdLkIJhBOpidJ4cD4BEtyAZVESiFxH2jb5DZ4ACxJV4DABO5BnoBdaAEEejIggutHFtHYWm//W/CtidOUJv5IH4ckEAAC0PMIDS49jQmegeg8tYKYx2IqQaIG+WIMBPN/xy069CRoKvR2KySwESdPgvD4BCwggIoBQCjVzC15ooN00aS2rtDSIHkOCXmzgAg19jJiBErSDKHo5BtOAuGoA2ACKHgFAKEKjwvQm47NAq9E61QafXiRardXL5+OXJZOWLaZT2zy+54plU4rWnll3mg0QwTtPHYgDRRZclEo7nUimE5rsHJJYnfW/7jgsgLIJojCchyBTHLxiqeH6xC4YX0+mcK/3jUZ0gGMYv6O9IOe5b1uV7MA39WtsdE3T3e7suXNBf4RY0C8fH51Hbpb1pN8+4Lj8e0zZxm6/P27RFxdRXI8ETJ6gWLhimL8R3xY9pC2NRXfJ9b7q5SDhuSHel/amRm7TeeQQJQSY7rvPpBIjS+zAoigrQu5aUl8CO6W6PlobuTKfmJoUxjvqSIUh2JZcTimE070+lopMmEt5EMOlbJ0S1w7EbLkF4/tIbdx3zEtQLoPqkYdrv1yL90ceOPUGbf/L448DW3zfYyitbvctuU1ZurIRzcGbZzjO/N+ldksNLEQkdK6zfdiO6lfQQZzSr2izO9sIQuGur2ypgD9VK+kgTrCmIfmfHjJfBHoImNWQrtZH0ky2eSsl0t1It7SeWUbbmS/tclaM1xeDT02rqmCaGPNZTVeI1f8Ns9PePm/+v2li5QBmZe1WM3tLxBhQPWVLm7Vx9h3WvMuL37AhppIe6Oa0StVlc7QXDb71nXWCmGIPlFQfhIVSrSB+1gWTJ1pyuoHzyYzAu63dVBH9g1lRgDTE/fpslsebbNuf88DUjBtvzMoei5Yhd4ZgIQ/mBd8gdR1wKu9u3bOvSzcvCy/g7mj/8aCd/gb5CqibjNHv9JYeyXeI1Ivd/6+1y15Ty5rWvONc45PbD9YnsT2b5NBuLrjqf71A4LrLLHff230s0HnXFzj91A+G1NuRLgahoGDwWDhR0t7tanfe1DcGg+1pbm1vC3jGKBqZPtEWapz/ftw+NoAfaTh/Un6V4ML5jqPpxfuN7Oe953hTcn8mvln/mhpWz+0jEFXI6Q66IOhJmy0POiEst1yRPGsDE0KSDUXljZ7sBAGRuxoDLfK0ULwYAwHfi6kxQOYe/w+sAMlOizvPvuBx81njLiSFV3d8SGf4OACD9VO9LogiXYlr4ikthyX8hA/A7A6nClYsqUb8PxOaMKIGYIkeB8hLgyy//FyQA1F5Yyo+Iv1yAIA6lNYxxJUziOjZFZhlbRKyATSthOliG0QNDsRQQpRkBJvCdMMaPwCQeZ1P0rmOLKD3Cpvm9dFKZ/GBFZ5Br4+Z4Nzu+ZSYQngxyY7os28vPhiOT3JzRarL0btHOzrHhAM+OGkd2GCNbx208P2YcC3Ozxhkuxs7McMZQmJtig7xpgudDNWbzGOkNTEFuFjoFcdpw5vDcWOO2mBEQNknGx+q0av1YYRGT+mpGViYWNtyumUNUARmwRkUwYkdaGbHVOBveAWOMcWkYZ5bxEIA1E8Y4RiHyTlNYQTyTiQmRkBpmqd8YqjFtrpt9zcYAoAUnEQUEwohEFBIhMeDLZFAS37JsdgvPUoEto5McHZoJ7CgLzPBlVioU2BJhAQA=") format("woff2"),url("data:font/woff;base64,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") format("woff")}[class*=" icofont-"],[class^=icofont-]{font-family:IcoFont!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;white-space:nowrap;word-wrap:normal;direction:ltr;line-height:1;-webkit-font-feature-settings:"liga";-webkit-font-smoothing:antialiased}.icofont-mic:before{content:"\\ef95"}.icofont-mic-mute:before{content:"\\ef94"}.icofont-audio:before{content:"\\eea8"}.icofont-play-alt-1:before{content:"\\eca6"}.icofont-pause:before{content:"\\eca5"}.icofont-md,cdg-controls .playButton>i,cdg-controls .volumeButton>i{font-size:2em}.icofont-fw,cdg-controls .playButton>i,cdg-controls .volumeButton>i{text-align:center;width:1.25em}.mute,cdg-controls .pitch[disabled],cdg-controls .playButton[disabled],cdg-controls .volumeButton[disabled]{color:#a9a9a9}cdg-controls{position:relative;display:-ms-flexbox;display:-webkit-flex;display:-webkit-box;display:flex;height:40px;-webkit-flex-direction:row;-ms-flex-direction:row;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:100%;font-size:1.25em}cdg-controls>div,cdg-controls>span{margin:3px 5px}cdg-controls>div:first-child,cdg-controls>span:first-child{margin-left:0}cdg-controls>div:last-child,cdg-controls>span:last-child{margin-right:0}cdg-controls .playButton,cdg-controls .volumeButton{outline:none;border:none;border-radius:3px;padding:5px;width:34px;height:34px}cdg-controls .playButton[disabled],cdg-controls .volumeButton[disabled]{cursor:not-allowed}cdg-controls .volumeControl>div{position:relative;width:100%;height:100%}cdg-controls .volumeControl>div:hover .volumeSlider{display:block}cdg-controls .volumeControl>div .volumeSlider{display:none;position:absolute;top:-75px;left:-55px;z-index:100;width:100px;-webkit-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg);padding:10px 20px}cdg-controls .volumeControl>div .volumeSlider.under{top:75px;-webkit-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}cdg-controls .volumeControl>div .volumeSlider:hover{display:block}cdg-controls .volumeControl>div .volumeSlider .volumeRange{-webkit-appearance:none;width:100%;height:5px;background:#d3d3d3;border:1px solid;border-radius:2.5px;outline:none;opacity:.7;-webkit-transition:.2s;-webkit-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}cdg-controls .volumeControl>div .volumeSlider .volumeRange:hover{opacity:1}cdg-controls .volumeControl>div .volumeSlider .volumeRange::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:15px;height:15px;border-radius:50%;border:1px solid #00f;background:#fff;cursor:pointer}cdg-controls .pitch{height:28px;font-size:.8em;text-align:right}cdg-controls .pitch[disabled]{cursor:not-allowed}cdg-controls .progress-container{position:relative;-webkit-box-flex:0;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto;width:100%;display:inline-block}cdg-controls .progress-container progress{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:1em}cdg-controls .progress-container progress::-webkit-progress-bar{background-color:#eee;border-radius:.5em;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25) inset;box-shadow:inset 0 2px 5px rgba(0,0,0,.25)}cdg-controls .progress-container progress::-webkit-progress-value{background-image:-webkit-linear-gradient(-45deg,transparent 33%,transparent 0,rgba(0,0,0,.1) 66%,transparent 0),-webkit-linear-gradient(top,hsla(0,0%,100%,.25),rgba(0,0,0,.25)),-webkit-linear-gradient(left,#09c,#f44);border-radius:.5em;-webkit-background-size:35px 20px,100% 100%,100% 100%;background-size:35px 20px,100% 100%,100% 100%}');var St=function(){var t=this,e=this.player.props;e.off(this.onloaded),e.off(this.ontimeplayed),e.off(this.onpercentageplayed),e.off(this.ontracklength),e.off(this.ondestroy),e.off(this.onplay),e.off(this.onvolume),this.playBtn.removeEventListener("click",function(){return t.player.togglePlay()}),this.progress.removeEventListener("click",function(e){return _t.call(t,e)}),this.pitch.removeEventListener("change",function(){return Lt.call(t)}),this.volumeSlider.removeEventListener("change",function(){return It.call(t)})},_t=function(t){var e=t.target.getBoundingClientRect(),i=(t.pageX-e.x)/t.target.offsetWidth;this.player.changePlayerPosition(i)},Lt=function(){var t=this.pitch.value;isNaN(t)?this.pitch.value=this.fallbackPitch:(this.fallbackPitch=t<-7?-7:t>7?7:t,this.player.changeKey(this.fallbackPitch))},It=function(){this.player.props.songVolume=+(parseFloat(this.volumeSlider.value)+0).toFixed(2)},Et=function e(i,r){var o,s,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{position:"bottom"};t(this,e),n(this,"controls",(o='<cdg-controls> <span class="playControl"> <button class="playButton" disabled><i class="icofont-play-alt-1"></i></button> </span> <span class="timePlayed"></span> <div class="progress-container"> <progress class="progressMeter" ng-disabled="$ctrls.loading" value="0" max="100"></progress> </div> <span class="trackLength"></span> <span> <input type="number" class="pitch" step="1" min="-7" max="7" value="0" disabled> </span> <span class="volumeControl"> <div> <button class="volumeButton" id="song_volume_button" disabled><i class="icofont-audio"></i></button> <div class="volumeSlider"> <input type="range" min="0.00" max="1.00" step="0.01" class="volumeRange" id="song_volume"> </div> </div> </span> \x3c!-- <span class="volumeControl">\n <div>\n <button class="volumeButton" id="mic_volume_button"><i class="icofont-mic"></i></button>\n <div class="volumeSlider">\n <input type="range" min="0.0" max="1" step="0.1" class="volumeRange" id="mic_volume" />\n </div>\n </div>\n </span> --\x3e </cdg-controls>',s=document.createElement("template"),o=o.trim(),s.innerHTML=o,s.content.firstChild)),n(this,"player",null),n(this,"playBtn",null),n(this,"playIcn",null),n(this,"timePlayed",null),n(this,"progress",null),n(this,"trackLength",null),n(this,"pitch",null),document.querySelector(i).appendChild(this.controls),this.player=r;var u=this.player.props;if(this.playBtn=this.controls.querySelector(".playButton"),this.playIcn=this.playBtn.querySelector("i"),this.timePlayed=this.controls.querySelector(".timePlayed"),this.timePlayed.innerHTML=u.timePlayed,this.progress=this.controls.querySelector(".progressMeter"),this.progress.value=u.percentagePlayed,this.trackLength=this.controls.querySelector(".trackLength"),this.trackLength.innerHTML=u.trackLength,this.pitch=this.controls.querySelector(".pitch"),this.fallbackPitch=0,!b.includes(a.position))throw new Error("Panel Position must be either 'top' or 'bottom'.");(this.volumeBtn=this.controls.querySelector("#song_volume_button"),this.volumeIcn=this.volumeBtn.querySelector("i"),this.volumeSlider=this.controls.querySelector("#song_volume"),this.volumeSlider.value=u.songVolume,"top"===a.position)&&this.controls.querySelector(".volumeSlider").classList.add("under");(function(){var t=this,e=this.player.props;this.onloaded=e.on("loaded",function(e){e?(t.playBtn.removeAttribute("disabled"),t.pitch.removeAttribute("disabled"),t.volumeBtn.removeAttribute("disabled")):(t.playBtn.setAttribute("disabled","disabled"),t.pitch.setAttribute("disabled","disabled"),t.volumeBtn.setAttribute("disabled","disabled"))}),this.ontimeplayed=e.on("timePlayed",function(e,i){e!==i&&(t.timePlayed.innerHTML=e)}),this.onpercentageplayed=e.on("percentagePlayed",function(e,i){e!==i&&(t.progress.value=e)}),this.ontracklength=e.on("trackLength",function(e,i){e!==i&&(t.trackLength.innerHTML=e)}),this.ondestroy=e.on("destroy",function(e){e&&St.call(t)}),this.onplay=e.on("isPlaying",function(e){t.playIcn.classList.remove("icofont-play-alt-1","icofont-pause"),t.playIcn.classList.add(e?"icofont-pause":"icofont-play-alt-1")}),this.onvolume=e.on("songVolume",function(e){var i=t.volumeIcn;if(t.volumeSlider.value=e,e)return i.classList.contains("mute")?void i.classList.remove("mute"):void 0;i.classList.add("mute")}),this.playBtn.addEventListener("click",function(){return t.player.togglePlay()}),this.progress.addEventListener("click",function(e){return _t.call(t,e)}),this.pitch.addEventListener("change",function(){return Lt.call(t)}),this.volumeSlider.addEventListener("change",function(){return It.call(t)})}).call(this)};export{Pt as CDGPlayer,Et as CDGControls};
//# sourceMappingURL=cdgplayer.js.map
{
"name": "cdgplayer",
"version": "0.1.0",
"version": "0.1.1",
"description": "A browser based HTML5/JS karaoke 'Player', that takes a zip file containing an mp3 and cdg file, allowing the user to render and play directly in the browser.",

@@ -34,39 +34,37 @@ "main": "dist/cdgplayer.js",

"devDependencies": {
"@fortawesome/fontawesome-free": "^5.2.0",
"@fortawesome/fontawesome-svg-core": "^1.2.2",
"@fortawesome/free-regular-svg-icons": "^5.2.0",
"autoprefixer": "^9.1.3",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"@babel/core": "7.3.4",
"@babel/preset-env": "7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@fortawesome/fontawesome-free": "^5.7.2",
"@fortawesome/fontawesome-svg-core": "^1.2.15",
"@fortawesome/free-regular-svg-icons": "^5.7.2",
"autoprefixer": "^9.4.10",
"babel-eslint": "^10.0.1",
"connect": "^3.6.6",
"eslint": "^5.4.0",
"node-sass": "^4.9.3",
"eslint": "^5.15.1",
"node-sass": "^4.11.0",
"postcss-assets": "^5.0.0",
"prettier": "^1.14.2",
"regenerator-runtime": "^0.12.1",
"rollup": "^0.64.1",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-cleanup": "^3.0.0",
"prettier": "^1.16.4",
"regenerator-runtime": "^0.13.1",
"rollup": "^1.4.1",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-clear": "^2.0.7",
"rollup-plugin-commonjs": "^9.1.5",
"rollup-plugin-embed-css": "^0.1.21",
"rollup-plugin-commonjs": "^9.2.1",
"rollup-plugin-embed-css": "^0.4.0",
"rollup-plugin-eslint": "^5.0.0",
"rollup-plugin-html": "^0.2.1",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-terser": "^1.0.1",
"sass": "^1.13.0",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-terser": "^4.0.4",
"sass": "^1.17.2",
"serve-static": "^1.13.2",
"soundtouchjs": "0.1.4"
"soundtouchjs": "^0.1.5"
},
"dependencies": {
"jsmediatags": "^3.8.1",
"jszip": "^3.1.5",
"jszip": "^3.2.0",
"jszip-utils": "0.0.2"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc