text: !function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){/**
  	 * eVN - Everyone's Visual Novel (Development build)
  	 * @see {@link https://github.com/bytesizedpacket/eVN}
  	 * @fileOverview eVN core script
  	 * @author Jacob Pedersen <jacob@bytesizedpacket.com> & Byte-Sized Packet <contact@bytesizedpacket.com>
  	 * @copyright Byte-Sized Packet 2015
  	 * @license {@link https://github.com/bytesizedpacket/eVN/blob/master/LICENSE | Attribution Assurance License (BSP edit)}
  	 * @version: 0.0.1a Pre-development version */
  "use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(1),o=n(9),s=n(6),c=n(8),u=new o.Logger("eVN","0.1a",!0),l=function(){function e(){r(this,e),this.instances=[]}return a(e,[{key:"logger",get:function(){return u}}]),e}();t.Main=l,window.eVN?u["throw"]("`window.eVN` is already declared")():window.eVN=new l,document.addEventListener("DOMContentLoaded",function(){var e=Array.prototype.slice.call(document.getElementsByTagName("canvas")),t=!0,n=!1,r=void 0;try{for(var a,o=function(){var e=a.value;return(c=e.getAttribute("data-evn"))?(u=new XMLHttpRequest,u.open("GET",c,!0),u.onreadystatechange=function(){4===u.readyState&&200===u.status&&new i.Novel(e,u.responseText,c)},void u.send()):{v:void 0}},s=e[Symbol.iterator]();!(t=(a=s.next()).done);t=!0){var c,u,l=o();if("object"==typeof l)return l.v}}catch(h){n=!0,r=h}finally{try{!t&&s["return"]&&s["return"]()}finally{if(n)throw r}}}),setTimeout(function(){window.t=eVN.instances[0]},500),window.bga=s.BackgroundAudio,window.anim=c.Animator},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(2),o=n(5),s=n(6),c=n(7),u=null,l={options:{textbox:{font:{size:17,family:"Comic Neue",style:"normal",weight:"normal",color:"#EEE"},lines:3,lineHeight:22,bottom:95,left:40,maxWidth:750,speakerbox:{left:25,bottom:130,maxWidth:150}}},audio:{},images:{},characters:{},scenes:{start:["No scenes defined"]}},h=function(){function e(t,n){var a=this,l=arguments.length<=2||void 0===arguments[2]?"undefined":arguments[2];r(this,e),u=eVN.logger,this.file=l,this.canvas=t,this.context=t.getContext("2d"),this.sceneInstructor=new c.SceneInstructor(this),this.sceneCmd=this.sceneInstructor.execute,this.images={},this.audio={},this.characters={},this.eVNML=this.parse_eVNML(n),this.visuals=new i.Visuals(this),this.cdata={background:null,characters:[],collection:"start",collectionIndex:0,dialogue:"",dialogueLines:[],mouseX:-1,mouseY:-1,jobs:[],startLine:0,speaker:""},this.canvas.className=this.canvas.className+" eVN-canvas",this.eVNML.options.textbox.image&&(this.images.textbox=new Image,this.images.textbox.src=this.eVNML.options.textbox.image),this.eVNML.options.textbox.speakerbox.image&&(this.images.speakerbox=new Image,this.images.speakerbox.src=this.eVNML.options.textbox.speakerbox.image),this.canvas.addEventListener("click",function(){return a.parseScene.call(a)}),this.canvas.addEventListener("mousemove",function(e){var t=e.target||e.srcElement,n=t.getBoundingClientRect(),r=n.width/t.width,i=n.height/t.height;a.cdata.mouseX=Math.round((e.clientX-n.left)/r),a.cdata.mouseY=Math.round((e.clientY-n.top)/i)});for(var h in this.eVNML.images)this.images[h]=new Image,this.images[h].src=this.eVNML.images[h];for(var h in this.eVNML.audio)this.audio[h]=new s.BackgroundAudio(this.eVNML.audio[h]);for(var h in this.eVNML.characters)this.characters[h]=new o.Character(this.eVNML.characters[h]);this.parseScene(this.cdata.currentCollection,this.cdata.collectionIndex);var f=eVN.instances.push(this)-1;u.log("Created new eVN instance from file `"+this.file+"` under eVN.instances["+f+"]")()}return a(e,[{key:"parse_eVNML",value:function(e){var t=e,n=l;try{t=JSON.parse(e);var r=function i(e,t){var n=t;for(var r in e)r in t?e[r].constructor===Object&&t[r].constructor===Object?n[r]=i(e[r],t[r]):e[r].constructor!==t[r].constructor?(eVN.logger.warn('Possible type mismatch on property "'+r+'" while parsing eVNML.')(),n[r]=e[r]):n[r]=e[r]:n[r]=e[r];return n};n=r(t,l)}catch(a){eVN.logger["throw"](a)}return n}},{key:"parseScene",value:function(e,t){var n=this.cdata,r=this.eVNML,a=r.options.textbox;if(e=e||n.collection,t="undefined"!=typeof t?t:n.collectionIndex,n.startLine+a.lines<n.dialogueLines.length)return n.startLine+=a.lines;var i=this.eVNML.scenes[e][t];if(n.collection=e,n.collectionIndex=t+1,i||eVN.logger["throw"]('Undefined scene "'+e+"["+t+']"! Did we run out of scenes?')(),n.speakerColor=null,"string"==typeof i){var o=i.indexOf(": "),s=i.slice(0,o),c=i.slice(o+2),l=o<i.indexOf(" ")&&s in this.characters;i=l?["say",c,s]:["say",i]}var h=this.sceneInstructor.getMethod(i[0].toLowerCase(),i.slice(1));if(null!==h){var f=h()||!1;if(f)return}else u.warn('Unknown command "'+i[0]+'" at "'+e+"["+t+']"')();this.parseScene()}},{key:"processVariables",value:function(e){var t=e.indexOf("${"),n=e.indexOf("}",t),r="";if(-1!==t&&-1!==n){var a=e.slice(0,t),i=e.slice(t+2,n),o=e.slice(n+1);r=i;var s=i.split(".");this.cdata.characters.map(function(e){return e.character}).indexOf(s[0]);return s[0]in this.characters&&(r=this.characters[s[0]][s[1]]),r=a+r+o,-1!==r.indexOf("${")?this.processVariables(r):r}return e}}]),e}();t.Novel=h},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(3),s=r(o),c=n(4),u=r(c),l=null,h=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},f=function(){function e(t){var n=this;a(this,e),l=eVN.logger,this.novel=t,this.ctx=t.context,this.draw=u,this.text=s,h(function(e){return n.loop(e)})}return i(e,[{key:"loop",value:function(e){var t=this,n=this.novel,r=n.context,a=n.cdata,i=n.eVNML.options.textbox,o=a.background,s=null,c=n.characters;o?"#"===o[0]?s=o:o in n.images&&(s=n.images[o]):s=null,this.draw.background(r,s||"#FFF"),n.cdata.characters.sort(function(e,t){return null===e||null===t?-1:e.priority-t.priority});var u=!0,l=!1,f=void 0;try{for(var d,g=a.characters[Symbol.iterator]();!(u=(d=g.next()).done);u=!0){var v=d.value;if(null!==v){var m=v.character,p=c[m].images[v.mood],y=n.images[p],b=null,w=r.canvas.height-y.height;"number"==typeof v.position&&(b=v.position),r.drawImage(y,b,w,y.width,y.height)}}}catch(x){l=!0,f=x}finally{try{!u&&g["return"]&&g["return"]()}finally{if(l)throw f}}this.draw.dialogueBox(r,i,n.images.textbox);var k=this.text.CSS_string(i.font.size,i.font.family,i.font.style,i.font.weight);r.fillStyle=i.font.color,r.textBaseline="top",r.font=k;var N=(a.dialogue||"",a.dialogueLines.slice(a.startLine).slice(0,i.lines));this.draw.dialogueText(r,N,i,i.lines);var M=a.speaker||"",V=a.speakerColor||i.font.color;a.speaker in n.characters&&(M=n.characters[a.speaker].name,V=n.characters[a.speaker].color),this.draw.speakerText(r,M,i.speakerbox,V),h(function(e){return t.loop(e)})}}]),e}();t.Visuals=f},function(e,t){"use strict";function n(e,t,n,r){var a=arguments.length<=4||void 0===arguments[4]?!0:arguments[4],i=arguments.length<=5||void 0===arguments[5]?[]:arguments[5];if(a=a!==!1,-1!==t.indexOf("\n")){var o=t.indexOf("\n"),s=t.slice(0,o),c=t.slice(o+1);return this.split(e,s,n,r).concat(this.split(e,c,n,r))}if(e.measureText(t).width<=r)return[t];var u=t.split(" "),l=u.length;if(a){var h=r/(n/2.5),f=t.indexOf(" ",h);l=t.slice(0,f).split(" ").length,l>u.length&&(l=u.length)}for(var d=l;d>=1;d--){var s=u.slice(0,d).join(" "),c=u.slice(d,u.length).join(" "),g=e.measureText(s).width;if(a&&r>g&&d===l)return this.split(e,t,n,r,!1);if(r>g)return i.push(s),c?i.concat(this.split(e,c,n,r)):i}return eVN.logger.warn('Unable to split word "'+u[0]+'".')(),i.push(u.shift()),u.length>=1?i.concat(this.split(e,u.join(" "),n,r)):i}function r(){var e=arguments.length<=0||void 0===arguments[0]?18:arguments[0],t=arguments.length<=1||void 0===arguments[1]?"Comic Neue":arguments[1],n=arguments.length<=2||void 0===arguments[2]?"normal":arguments[2],r=arguments.length<=3||void 0===arguments[3]?"normal":arguments[3];return t="'"===t[0]?t:'"'===t[0]?t:"'"+t+"'",n+" "+r+" "+e+"px "+t}Object.defineProperty(t,"__esModule",{value:!0}),t.split=n,t.CSS_string=r},function(e,t){"use strict";function n(e,t){t instanceof Image?e.drawImage(t,0,0,e.canvas.width,e.canvas.height):(e.fillStyle=t,e.fillRect(0,0,e.canvas.width,e.canvas.height))}function r(e,t,n){if(n){var r=0,a=e.canvas.height-n.height,i=n.width,o=n.height;e.drawImage(n,r,a,i,o)}else{var r=0,a=e.canvas.height-t.speakerbox.bottom-5,i=e.canvas.width,o=e.canvas.height;e.fillStyle="rgba(0, 0, 0, .35)",e.fillRect(r,a,i,o)}}function a(e,t){var n=t.speakerbox,r=t.left,a=e.canvas.height-n.bottom-n.height,i=n.width,o=speakerboxOptionsbox.height;e.fillStyle=speakerboxOptionsbox.color||t.color,e.fillRect(r,a,i,o)}function i(e,t,n,r){var a=n,i=a.lineHeight,o=a.maxWidth,s=a.left,c=e.canvas.height-a.bottom;r=r||3;for(var u=0,l=t.length;(l>r?r:l)>u;u++){var h=c+i*u;e.fillText(t[u],s,h,o)}}function o(e,t,n,r){var a=n,i=a.left,o=e.canvas.height-a.bottom,s=a.maxWidth||e.canvas.width-i;e.fillStyle=r||e.fillStyle,e.fillText(t,i,o,s)}Object.defineProperty(t,"__esModule",{value:!0}),t.background=n,t.dialogueBox=r,t.speakerBox=a,t.dialogueText=i,t.speakerText=o},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t){n(this,e),this.name=t["first name"]||t.name,this.lname=t["last name"]||null,this.color=t.color||t.colour||"#FFF",this.images=t.images||{},this.mood="default"}return r(e,[{key:"cImage",get:function(){return this.images[this.mood]}}]),e}();t.Character=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r,a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r){n(this,e),this.audio=new Audio,this.audio.src=t}return a(e,[{key:"play",value:function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];this.audio.play.apply(this.audio,n),e.currentAudio=this.audio}}],[{key:"currentAudio",get:function(){return r},set:function(e){return r=e}}]),e}();t.BackgroundAudio=i},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(8),s=function(){function e(t){a(this,e),this.scope=t,this["goto"]=this.jump}return i(e,[{key:"getMethod",value:function(e,t){var n=this[e];return n instanceof Function?n.bind.apply(n,[this.scope].concat(r(t))):null}},{key:"background",value:function(e){return this.cdata.background=e,!1}},{key:"music",value:function(e){return e in this.audio&&this.audio[e].play(),!1}},{key:"say",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1],n=arguments.length<=2||void 0===arguments[2]?"#FFF":arguments[2],r=this.cdata,a=this.eVNML.options.textbox;e=this.processVariables(e),null!==t?(r.speaker=t,r.dialogue='"'+e+'"',r.speakerColor=n):r.dialogue=e;var i=a.maxWidth;return r.dialogueLines=this.visuals.text.split(this.context,r.dialogue,a.font.size,i),r.startLine=0,!0}},{key:"setmood",value:function(e,t){var n=null,r=!0,a=!1,i=void 0;try{for(var o,s=this.cdata.characters[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;if(c.character===e){n=c;break}}}catch(u){a=!0,i=u}finally{try{!r&&s["return"]&&s["return"]()}finally{if(a)throw i}}return null!==n&&(n.mood=t||"default"),!0}},{key:"hide",value:function(e){for(var t=null,n=0,r=this.cdata.characters.length;r>n;n++)if(null!==this.cdata.characters[n]&&this.cdata.characters[n].character===e){t=n;break}return null!==t&&(this.cdata.characters[t]=null),!1}},{key:"show",value:function(e,t,n,r){void 0===t&&(t="middle");for(var a=null,i=0,s=this.cdata.characters.length;s>i;i++)if(null!==this.cdata.characters[i]&&this.cdata.characters[i].character===e){a=i;break}var c=this.images[this.characters[e].images[null===a?"default":this.cdata.characters[a].mood]];if("string"==typeof t)switch(t){case"left":t=this.canvas.width/4-c.width/2;break;case"right":t=this.canvas.width/4*3-c.width/2;break;case"middle":default:t=this.canvas.width/2-c.width/2}if(null!==a){var u=this.cdata.characters[a],l=t-u.position;new o.Animator(function(e){return u.position=e},250,"ease-out",l,u.position).start(),u.character=u.character,u.mood=u.mood||"default",u.priority=r||u.priority||1}else this.cdata.characters.push({character:e,position:t,mood:"default"});return!0}},{key:"jump",value:function(e){return this.cdata.collection=e,this.cdata.collectionIndex=0,!1}}]),e}();t.SceneInstructor=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var r=[];if("string"==typeof e)switch(e){case"ease":e=[.25,.1,.25,1];break;case"ease-in-out":e=[.42,0,.58,1];break;case"ease-in":for(var a=0;t>a;a++)r.push(Math.pow(a/(t-1),1.685));return r;case"ease-out":for(var a=0;t>a;a++)r.push(1-Math.pow(1-a/(t-1),1.685));return r;case"linear":default:for(var a=0;t>a;a++)r.push(a/(t-1));return r}for(var i=3*e[0],o=3*(e[2]-e[0])-i,s=1-i-o,c=3*e[1],u=3*(e[3]-e[1])-c,l=1-c-u,t=t-1||99,a=0;t+1>a;a++){for(var h,f,d=a/t,g=0;6>g&&(h=((s*d+o)*d+i)*d-a/t,!(Math.abs(h)<1/(200*(n||50))))&&(f=(3*s*d+2*o)*d+i,!(Math.abs(f)<1e-6));g++)d-=h/f;r.push(((l*d+u)*d+c)*d)}return r}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,a,i,o){var s=arguments.length<=4||void 0===arguments[4]?0:arguments[4],c=arguments.length<=5||void 0===arguments[5]?20:arguments[5];n(this,e),this._stop=!1,this.func=t,this.time=Math.round(a/c),this.curve=r(i,this.time),this.to=o,this.offset=s,this.gran=c,this.steps=1,this.accu=Math.round(Date.now()/c)}return a(e,[{key:"start",value:function(){return this.step(),this}},{key:"step",value:function(){var e=this;if(!this._stop){this.func(Math.round(this.to*this.curve[this.steps]+this.offset));var t=Math.round(Date.now()/this.gran-this.accu-this.steps);++this.steps<this.time&&setTimeout(function(t){return e.step()},this.gran-t<0?0:this.gran-t)}}},{key:"stop",value:function(e){this._stop=!0,e&&this.func(this.to)}}]),e}();t.Animator=i},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?"Unnamedlogger":arguments[0],n=arguments.length<=1||void 0===arguments[1]?"NaN":arguments[1],a=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];r(this,e),this.name=t,this.version=n,this.verbose=a,this.logName=this.name+" v"+this.version,this.logPrefix="["+this.logName+" INFO]",this.warnPrefix="["+this.logName+" WARN]",this.errPrefix="["+this.logName+" ERR]"}return a(e,[{key:"log",value:function(){for(var e,t=[this.logPrefix],r=arguments.length,a=Array(r),i=0;r>i;i++)a[i]=arguments[i];return a.length<1||!this.verbose?function(){}:(1===a.length&&"string"==typeof a[0]?t[0]+=" "+a[0]:t=[t[0]].concat(a),console&&console.log?(e=console.log).bind.apply(e,[console].concat(n(t))):void 0)}},{key:"warn",value:function(){for(var e,t=[this.warnPrefix],r=arguments.length,a=Array(r),i=0;r>i;i++)a[i]=arguments[i];return a.length<1?function(){}:(1===a.length&&"string"==typeof a[0]?t[0]+=" "+a[0]:t=[t[0]].concat(a),console&&console.warn?(e=console.warn).bind.apply(e,[console].concat(n(t))):void 0)}},{key:"throw",value:function(e,t){var n=this;void 0===e&&(e="UnknownError");var r;return e instanceof Error?r=e:(r=new Error(e),t&&(r.stack=t)),r.name=this.errPrefix+" "+r.name,function(){throw console&&console.error?(t&&console.error(n.errPrefix+" "+r.message),console.error(r.stack),n.logName+" halted"):r}}}]),e}();t.Logger=i}]);