diff --git a/CHANGELOG.md b/CHANGELOG.md index 2297c13..8a53195 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Version 2017.1.1 * Fix italic text (GitHub issue [#28](https://github.com/iiyo/WebStory-Engine/issues/28)) + * Fix shake effect (GitHub issue [#29](https://github.com/iiyo/WebStory-Engine/issues/29)) * `yes` and `true` are now both considered truthy attribute values and can be used interchangeably * Fix wrong attribute values in audio tests diff --git a/build/WebStoryEngine.js b/build/WebStoryEngine.js index 17ee713..6c91e4d 100644 --- a/build/WebStoryEngine.js +++ b/build/WebStoryEngine.js @@ -451,7 +451,7 @@ using.ajax = (function () { /* WebStory Engine dependencies (v2017.1.1) - Build time: Sun, 19 Mar 2017 11:52:12 GMT + Build time: Wed, 29 Mar 2017 20:07:16 GMT */ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 2.0) { - x -= 2.0; - } - - if (x > 1.0) { - x = 2.0 - x; - } - - return x; + function easing (distance) { + return function (x) { + return distance * Math.sin(x * (times * 2) * Math.PI); + }; } if (dx !== null) { @@ -14648,20 +14639,20 @@ define("WSE.DisplayObject", function ( self.interpreter.waitCounter += 1; transform( - ox - dx, - ox + dx, + 0, + 1, function (v) { element.style.left = v + xUnit; }, { duration: duration, - easing: easing + easing: easing(dx) + }, + function () { + element.style.left = ox + xUnit; + self.interpreter.waitCounter -= 1; } - ). - then(function () { - element.style.left = ox + xUnit; - self.interpreter.waitCounter -= 1; - }); + ); } if (dy !== null) { @@ -14676,14 +14667,14 @@ define("WSE.DisplayObject", function ( self.interpreter.waitCounter += 1; transform( - oy - dy, - oy + dy, + 0, + 1, function (v) { element.style.top = v + yUnit; }, { duration: duration, - easing: easing + easing: easing(dy) }, function () { element.style.top = oy + yUnit; @@ -14925,7 +14916,6 @@ define("WSE.DisplayObject", function ( }); - /* global using */ using( diff --git a/build/WebStoryEngine.min.js b/build/WebStoryEngine.min.js index ba996a9..34ecb6d 100644 --- a/build/WebStoryEngine.min.js +++ b/build/WebStoryEngine.min.js @@ -2,5 +2,5 @@ var using=function(){"use strict";function t(n){var s,o=[],u=d[n],a=m[n];c[n]||( e._webAudio){if(!n.bufferSource||n.paused)return e;n.paused=!0,"undefined"==typeof n.bufferSource.stop?n.bufferSource.noteOff(0):n.bufferSource.stop(0)}else n.pause();return e.on("pause"),e},stop:function(t){var e=this;if(!e._loaded)return e.on("play",function(){e.stop(t)}),e;e._clearEndTimer(t);var n=t?e._nodeById(t):e._activeNode();if(n)if(n._pos=0,e._webAudio){if(!n.bufferSource||n.paused)return e;n.paused=!0,"undefined"==typeof n.bufferSource.stop?n.bufferSource.noteOff(0):n.bufferSource.stop(0)}else isNaN(n.duration)||(n.pause(),n.currentTime=0);return e},mute:function(t){var e=this;if(!e._loaded)return e.on("play",function(){e.mute(t)}),e;var n=t?e._nodeById(t):e._activeNode();return n&&(e._webAudio?n.gain.value=0:n.muted=!0),e},unmute:function(t){var e=this;if(!e._loaded)return e.on("play",function(){e.unmute(t)}),e;var n=t?e._nodeById(t):e._activeNode();return n&&(e._webAudio?n.gain.value=e._volume:n.muted=!1),e},volume:function(t,e){var n=this;if(t=parseFloat(t),t>=0&&1>=t){if(n._volume=t,!n._loaded)return n.on("play",function(){n.volume(t,e)}),n;var i=e?n._nodeById(e):n._activeNode();return i&&(n._webAudio?i.gain.value=t:i.volume=t*l.volume()),n}return n._volume},loop:function(t){var e=this;return"boolean"==typeof t?(e._loop=t,e):e._loop},sprite:function(t){var e=this;return"object"==typeof t?(e._sprite=t,e):e._sprite},pos:function(t,n){var i=this;if(!i._loaded)return i.on("load",function(){i.pos(t)}),"number"==typeof t?i:i._pos||0;t=parseFloat(t);var r=n?i._nodeById(n):i._activeNode();if(r)return t>=0?(i.pause(n),r._pos=t,i.play(r._sprite,n),i):i._webAudio?r._pos+(e.currentTime-i._playStart):r.currentTime;if(t>=0)return i;for(var s=0;s=0||0>t))return r._pos3d;if(r._webAudio){var s=i?r._nodeById(i):r._activeNode();s&&(r._pos3d=[t,e,n],s.panner.setPosition(t,e,n),s.panner.panningModel=r._model||"HRTF")}return r},fade:function(t,e,n,i,r){var s=this,o=Math.abs(t-e),u=t>e?"down":"up",a=o/.01,c=n/a;if(!s._loaded)return s.on("load",function(){s.fade(t,e,n,i,r)}),s;s.volume(t,r);for(var l=1;a>=l;l++)!function(){var t=s._volume+("up"===u?.01:-.01)*l,n=Math.round(1e3*t)/1e3,o=e;setTimeout(function(){s.volume(n,r),n===o&&i&&i()},c*l)}()},fadeIn:function(t,e,n){return this.volume(0).play().fade(0,t,e,n)},fadeOut:function(t,e,n,i){var r=this;return r.fade(r._volume,t,e,function(){n&&n(),r.pause(i),r.on("end")},i)},_nodeById:function(t){for(var e=this,n=e._audioNode[0],i=0;i=0&&!(5>=n);t--)e._audioNode[t].paused&&(e._webAudio&&e._audioNode[t].disconnect(0),n--,e._audioNode.splice(t,1))},_clearEndTimer:function(t){for(var e=this,n=-1,i=0;i=0&&l._howls.splice(r,1),delete t[e._src],e=null}},i)var f=function(e,n){if(n in t)return e._duration=t[n].duration,void h(e);if(/^data:[^;]+;base64,/.test(n)){for(var i=atob(n.split(",")[1]),r=new Uint8Array(i.length),s=0;s=0?i.duration:500,b=t,v=e-t,w=0,E=0,S=i.fps||60,_=!1,A=!1,x=!1,k=!1,T=0,O=0,W=0,M=0,y=s.linear,i.easing&&(y="function"==typeof i.easing?i.easing:s[i.easing])}function a(){var e,i;if(x){if(Date.now()-E>1e3/S){if(_||A)return;if(w+=1,i=c(),i>g||k)return b=t+v,void(k||d());b=y(i/g)*v+t,n(b),e=c()-i,E=Date.now()}o(a)}}function c(){return x&&!A&&(T=+new Date-O-W),T}function l(){m(),O=+new Date,M=O,x=!0,o(a)}function d(){x=!1,A=!1,n(e),r()}function f(){A&&(A=!1,W+=+new Date-M,o(a))}function p(){A=!0,M=+new Date}function h(){x&&(c(),_=!0,x=!1,A=!1,r())}function m(){x&&h(),u()}var g,y,b,v,w,E,S,_,A,x,k,T,O,W,M;if(i=i||{},"function"!=typeof i||r||(r=i,i={}),r="function"==typeof r?r:function(){},"undefined"==typeof n||!n)throw new Error("Argument callback must be a function.");return u(),{start:l,stop:d,pause:p,resume:f,cancel:h,elapsed:c,reset:m}}function r(){var t=i.apply(void 0,arguments);return t.start(),t}var s=t("eases");if("undefined"==typeof o)var o=function(t){setTimeout(t,1e3/60)};e.exports={transformation:i,transform:r}},{eases:107}],89:[function(t,e,n){arguments[4][5][0].apply(n,arguments)},{dup:5}],90:[function(t,e,n){arguments[4][6][0].apply(n,arguments)},{dup:6}],91:[function(t,e,n){arguments[4][7][0].apply(n,arguments)},{dup:7}],92:[function(t,e,n){arguments[4][8][0].apply(n,arguments)},{"./bounce-out":94,dup:8}],93:[function(t,e,n){arguments[4][9][0].apply(n,arguments)},{"./bounce-out":94,dup:9}],94:[function(t,e,n){arguments[4][10][0].apply(n,arguments)},{dup:10}],95:[function(t,e,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],96:[function(t,e,n){arguments[4][12][0].apply(n,arguments)},{dup:12}],97:[function(t,e,n){arguments[4][13][0].apply(n,arguments)},{dup:13}],98:[function(t,e,n){arguments[4][14][0].apply(n,arguments)},{dup:14}],99:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],100:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],101:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],102:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],103:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{dup:19}],104:[function(t,e,n){arguments[4][20][0].apply(n,arguments)},{dup:20}],105:[function(t,e,n){arguments[4][21][0].apply(n,arguments)},{dup:21}],106:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],107:[function(t,e,n){arguments[4][23][0].apply(n,arguments)},{"./back-in":90,"./back-in-out":89,"./back-out":91,"./bounce-in":93,"./bounce-in-out":92,"./bounce-out":94,"./circ-in":96,"./circ-in-out":95,"./circ-out":97,"./cubic-in":99,"./cubic-in-out":98,"./cubic-out":100,"./elastic-in":102,"./elastic-in-out":101,"./elastic-out":103,"./expo-in":105,"./expo-in-out":104,"./expo-out":106,"./linear":108,"./quad-in":110,"./quad-in-out":109,"./quad-out":111,"./quart-in":113,"./quart-in-out":112,"./quart-out":114,"./quint-in":116,"./quint-in-out":115,"./quint-out":117,"./sine-in":119,"./sine-in-out":118,"./sine-out":120,dup:23}],108:[function(t,e,n){arguments[4][24][0].apply(n,arguments)},{dup:24}],109:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{dup:25}],110:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{dup:26}],111:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],112:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],113:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{dup:29}],114:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{dup:30}],115:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],116:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],117:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],118:[function(t,e,n){arguments[4][34][0].apply(n,arguments)},{dup:34}],119:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],120:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],121:[function(t,e,n){e.exports=t("./src/xmugly.js")},{"./src/xmugly.js":122}],122:[function(t,e,n){!function(){function t(t,e){var r=[],c=n(t),l=s(c);return Array.isArray(e)&&e.forEach(function(t){l.push(t)}),c=u(c),c=c.map(function(t,e){var n,i,s,u,c,d,f,p,h;if(u=t.trim(),f=[],d=t.replace(/^([\s]*).*$/,"$1"),"--"===u){if(!r.length)throw new SyntaxError("Closing '--' without matching opening tag on line "+(e+1));return d+""}return"."!==u[0]?t:(u=u.replace(/"([^"]+)"/g,function(t,e){return f.push(e),"{{"+f.length+"}}"}),":"===u[u.length-1]&&(h=!0,u=u.replace(/:$/,"")),s=u.split(","),c=s[0].split(" "),c.shift(),n=c[0],h&&r.push(n),c.shift(),s[0]=c.join(" "),i=[],s.forEach(function(t){var e,n,r,s;e=a(t).split(" "),n=e[0].trim(),n&&(s=o(n,l),s?(r=s.value,n=s.name):(e.shift(),r=e.join(" ")),i.push(n+'="'+r+'"'))}),p=d+"<"+n+(i.length?" ":"")+i.join(" ")+(h?">":" />"),f.forEach(function(t,e){p=p.replace("{{"+(e+1)+"}}",t)}),p)}),i(c)}function n(t){return t.split("\n")}function i(t){return t.join("\n")}function r(t){var e=a(t).split(" ");return e.shift(),{identifier:e[0],attribute:e[1],value:e[2]}}function s(t){var e=[];return t.forEach(function(t){"~"===t.trim()[0]&&e.push(r(t))}),e}function o(t,e){var n,i;return e.some(function(e){var r;return t[0]!==e.identifier?!1:(r=t.replace(e.identifier,""),n="_"===e.attribute?r:e.attribute,i="_"===e.value?r:e.value,!0)}),n?{name:n,value:i}:null}function u(t){return t.filter(function(t){return"~"!==t.trim()[0]})}function a(t){return t.trim().replace(/[\s]+/g," ")}"undefined"!=typeof e?e.exports={compile:t}:window.xmugly={compile:t}}()},{}]},{},[1]),"undefined"!=typeof window&&(window.requestAnimationFrame=function(){"use strict";return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}()),function(){Array.prototype.forEach||(Array.prototype.forEach=function(t){for(var e=0,n=this.length;n>e;e+=1)t(this[e],e,this)})}(),function(){Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var n;if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),r=i.length>>>0;if(0===r)return-1;var s=+e||0;if(Math.abs(s)===1/0&&(s=0),s>=r)return-1;for(n=Math.max(s>=0?s:r-Math.abs(s),0);r>n;){if(n in i&&i[n]===t)return n;n++}return-1})}(),"undefined"==typeof console&&(this.console={}),console.log||(console.log=function(){}),console.dir||(console.dir=console.log),console.error||(console.error=console.log),console.warn||(console.warn=console.log),function(){var t=document.getElementsByTagName("script"),e=t[t.length-1].src.replace(/MO5\.js$/,"");using.modules={"MO5.ajax":e+"ajax.js","MO5.assert":e+"assert.js","MO5.Exception":e+"Exception.js","MO5.fail":e+"fail.js","MO5.EventBus":e+"EventBus.js","MO5.CoreObject":e+"CoreObject.js","MO5.List":e+"List.js","MO5.Queue":e+"Queue.js","MO5.Map":e+"Map.js","MO5.Set":e+"Set.js","MO5.Result":e+"Result.js","MO5.Promise":e+"Promise.js","MO5.Timer":e+"Timer.js","MO5.TimerWatcher":e+"TimerWatcher.js","MO5.easing":e+"easing.js","MO5.transform":e+"transform.js","MO5.range":e+"range.js","MO5.tools":e+"tools.js","MO5.Point":e+"Point.js","MO5.Size":e+"Size.js","MO5.Animation":e+"Animation.js","MO5.dom.effects.typewriter":e+"dom.effects.typewriter.js","MO5.dom.Element":e+"dom.Element.js","MO5.dom.escape":e+"dom.escape.js","MO5.globals.document":e+"globals.document.js","MO5.globals.window":e+"globals.window.js","MO5.types":e+"types.js"}}();var $__WSEScripts=document.getElementsByTagName("script");WSEPath=$__WSEScripts[$__WSEScripts.length-1].src,using.modules["MO5.ajax"]=WSEPath,using.modules["MO5.Animation"]=WSEPath,using.modules["MO5.assert"]=WSEPath,using.modules["MO5.CoreObject"]=WSEPath,using.modules["MO5.dom.effects.typewriter"]=WSEPath,using.modules["MO5.dom.Element"]=WSEPath,using.modules["MO5.dom.escape"]=WSEPath,using.modules["MO5.easing"]=WSEPath,using.modules["MO5.EventBus"]=WSEPath,using.modules["MO5.Exception"]=WSEPath,using.modules["MO5.fail"]=WSEPath,using.modules["MO5.globals.document"]=WSEPath,using.modules["MO5.globals.window"]=WSEPath,using.modules["MO5.List"]=WSEPath,using.modules["MO5.Map"]=WSEPath,using.modules["MO5.Point"]=WSEPath,using.modules["MO5.Promise"]=WSEPath,using.modules["MO5.Queue"]=WSEPath,using.modules["MO5.range"]=WSEPath,using.modules["MO5.Result"]=WSEPath,using.modules["MO5.Set"]=WSEPath,using.modules["MO5.Size"]=WSEPath,using.modules["MO5.Timer"]=WSEPath,using.modules["MO5.TimerWatcher"]=WSEPath,using.modules["MO5.tools"]=WSEPath,using.modules["MO5.transform"]=WSEPath,using.modules["MO5.types"]=WSEPath,using.modules["WSE.assets"]=WSEPath,using.modules["WSE.commands"]=WSEPath,using.modules["WSE.functions"]=WSEPath,using.modules["WSE.dataSources"]=WSEPath,using.modules.WSE=WSEPath,using.modules["WSE.Keys"]=WSEPath,using.modules["WSE.tools"]=WSEPath,using.modules["WSE.loader"]=WSEPath,using.modules["WSE.dataSources.LocalStorage"]=WSEPath,using.modules["WSE.Trigger"]=WSEPath,using.modules["WSE.Game"]=WSEPath,using.modules["WSE.Interpreter"]=WSEPath,using.modules["WSE.LoadingScreen"]=WSEPath,using.modules["WSE.tools.ui"]=WSEPath,using.modules["WSE.tools.reveal"]=WSEPath,using.modules["WSE.tools.compile"]=WSEPath,using.modules["WSE.savegames"]=WSEPath,using.modules["WSE.DisplayObject"]=WSEPath,using.modules["WSE.assets.Animation"]=WSEPath,using.modules["WSE.assets.Audio"]=WSEPath,using.modules["WSE.assets.Character"]=WSEPath,using.modules["WSE.assets.Curtain"]=WSEPath,using.modules["WSE.assets.Imagepack"]=WSEPath,using.modules["WSE.assets.Textbox"]=WSEPath,using.modules["WSE.assets.Background"]=WSEPath,using.modules["WSE.assets.Composite"]=WSEPath,using.modules["WSE.commands.alert"]=WSEPath,using.modules["WSE.commands.break"]=WSEPath,using.modules["WSE.commands.choice"]=WSEPath,using.modules["WSE.commands.confirm"]=WSEPath,using.modules["WSE.commands.do"]=WSEPath,using.modules["WSE.commands.fn"]=WSEPath,using.modules["WSE.commands.global"]=WSEPath,using.modules["WSE.commands.globalize"]=WSEPath,using.modules["WSE.commands.goto"]=WSEPath,using.modules["WSE.commands.line"]=WSEPath,using.modules["WSE.commands.localize"]=WSEPath,using.modules["WSE.commands.prompt"]=WSEPath,using.modules["WSE.commands.restart"]=WSEPath,using.modules["WSE.commands.sub"]=WSEPath,using.modules["WSE.commands.trigger"]=WSEPath,using.modules["WSE.commands.var"]=WSEPath,using.modules["WSE.commands.set_vars"]=WSEPath,using.modules["WSE.commands.wait"]=WSEPath,using.modules["WSE.commands.with"]=WSEPath,using.modules["WSE.commands.while"]=WSEPath,using().define("MO5.ajax",function(){return using.ajax}),function(){function t(t,e,n,i,r){function s(t){if(e.call(this),this.callbacks=new n,this.queue=new n,this.running=!1,this.canceled=!1,this.paused=!1,this.limit=0,this.count=0,this.currentWatcher=null,t&&t instanceof n)this.callbacks=t;else if(t&&t instanceof Array)this.callbacks.replace(t.slice());else if(t)throw new Error("Parameter 1 is expected to be of type Array or MO5.Queue.")}return s.prototype=new e,s.prototype.constructor=s,s.prototype.addStep=function(t){if(this.running)throw new Error("Cannot add steps to a running animation.");return this.callbacks.add(t),this.trigger("updated",null,!1),this},s.prototype.isRunning=function(){return this.running},s.prototype.isCanceled=function(){return this.canceled},s.prototype.isPaused=function(){return this.paused},s.prototype.start=function(){var t,e,n=this;if(this.running)throw new Error("Animation is already running.");return e=this.callbacks.clone(),this.queue=e,this.running=!0,this.canceled=!1,t=function(){var i,s;return e.hasNext()?(i=e.next(),s=i(),void(s&&s instanceof r?(n.currentWatcher=s,s.once(t,"stopped")):setTimeout(t,0))):(n.count+=1,n.isRunning()?n.limit&&n.count==n.limit?(n.running=!1,n.trigger("stopped",null,!1),n.count=0,void(n.limit=0)):(e=n.callbacks.clone(),this.queue=e,void setTimeout(t,0)):void n.trigger("stopped",null,!1))},setTimeout(t,0),this},s.prototype.pause=function(){if(this.paused)throw new Error("Trying to pause an already paused animation.");return this.paused=!0,this.currentWatcher&&this.currentWatcher.pause(),this.trigger("paused",null,!1),this},s.prototype.resume=function(){if(!this.paused)throw new Error("Trying to resume an animation that isn't paused.");return this.paused=!1,this.currentWatcher&&this.currentWatcher.resume(),this.trigger("resumed",null,!1),this},s.prototype.cancel=function(){if(this.canceled)throw new Error("Trying to cancel an already canceled animation.");return this.canceled=!0,this.running=!1,this.count=0,this.limit=0,this.currentWatcher&&this.currentWatcher.cancel(),this.trigger("canceled",null,!1),this},s.prototype.stop=function(){if(!this.running)throw new Error("Trying to stop an animation that isn't running. Check isRunning() beforehand.");return this.running=!1,this.count=0,this.limit=0,this},s.prototype.loop=function(t){if(1>t)throw new Error("Parameter 1 is expected to be greater than zero.");return this.count=0,this.limit=t,this.start()},s.prototype.promise=function(){return i.prototype.promise.call(this)},s}"function"==typeof using?using("MO5.Exception","MO5.CoreObject","MO5.Queue","MO5.Timer","MO5.TimerWatcher").define("MO5.Animation",t):"undefined"!=typeof window?window.MO5.Animation=t(MO5.Exception,MO5.CoreObject,MO5.Queue,MO5.Timer,MO5.TimerWatcher):module.exports=t(require("./Exception.js"),require("./CoreObject.js"),require("./Queue.js"),require("./Timer.js"),require("./TimerWatcher.js"))}(),using("MO5.Exception").define("MO5.assert",function(t){function e(){t.apply(this,arguments),this.name="AssertionException"}function n(t,n){if(!t)throw new e(n)}return e.prototype=new t,n}),function(){function t(t,e,n){function i(t){t=t||{},t.bus=t.bus||{},a+=1,Object.defineProperty?Object.defineProperty(this,"id",{value:a,configurable:!1,enumerable:!1,writable:!1}):this.id=a,this.destroyed=!1,n.inject(this,t.bus),o[this.id]={},this.$children=[],this.$parent=null}function r(t){return u+t}function s(t){return t.replace(new RegExp(u),"")}var o={},u="CoreObject",a=0;return i.hasId=function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.id},i.isCoreObject=function(t){return t instanceof i},i.prototype.addChild=function(t){this.$children.indexOf(t)>=0||(t.$parent=this,this.$children.push(t))},i.prototype.removeChild=function(t){var e=this.$children.indexOf(t);0>e||(t.$parent=null,this.$children.splice(e,1))},i.prototype.hasChild=function(t){return this.$children.indexOf(t)>=0},i.prototype.setFlag=function(t){var e=r(t);if(o[this.id])return o[this.id][e]=!0,this.trigger("flag_set",t),this},i.prototype.removeFlag=function(t){return this.hasFlag(t)?(delete o[this.id][r(t)],this.trigger("flag_removed",t),this):void 0},i.prototype.hasFlag=function(t){var e=r(t);return o[this.id]&&o[this.id].hasOwnProperty(e)},i.prototype.getFlags=function(){var t=[];for(var e in o[this.id])t.push(s(e));return t},i.prototype.connect=function(e,n,r,s){function o(t){t=t||null,"undefined"==typeof s||s!==!0&&s!==!1?n.trigger(r,t):n.trigger(r,t,s)}var u=this;if(e=e||"*",r=r||"*",!(n&&n instanceof i))throw new t("Cannot connect events: Parameter 3 is expected to be of type CoreObject.");return this.subscribe(o,e),n.once(function(){u.unsubscribe(o,e)},"destroyed"),this},i.prototype["implements"]=function(t){for(var e in t)if(typeof this[e]!=typeof t[e])return!1;return!0},i.prototype.toString=function(){return""+this.id},i.prototype.valueOf=function(){return this.id},i.prototype.destroy=function(){var t=this.id;this.$parent&&this.$parent.removeChild(this),this.$children.forEach(function(t){"object"==typeof t&&"function"==typeof t.destroy&&t.destroy()}),this.destroyed=!0,this.trigger("destroyed",null,!1);for(var e in this)this[e]=null;delete o[t],this.destroyed=!0,this.id=t,delete this.toString,delete this.valueOf},i.prototype.subscribeTo=function(e,n,i){function r(){e.unsubscribe(n,i),o.unsubscribe("destroyed",r),e.unsubscribe("destroyed",s)}function s(){e.unsubscribe("destroyed",s),o.unsubscribe("destroyed",r)}var o=this;if("function"!=typeof e.subscribe||"function"!=typeof e.unsubscribe)throw new t("Cannot subscribe: Parameter 1 is expected to be of type CoreObject or EventBus.");if("string"!=typeof n)throw new t("Cannot subscribe: Parameter 2 is expected to be of type String.");if("function"!=typeof i)throw new t("Cannot subscribe: Parameter 3 is expected to be of type Function.");return i=i.bind(this),e.subscribe(n,i),this.subscribe("destroyed",r),e.subscribe("destroyed",s),this},i}"function"==typeof using?using("MO5.Exception","MO5.fail","MO5.EventBus").define("MO5.CoreObject",t):"undefined"!=typeof window?window.MO5.CoreObject=t(MO5.Exception,MO5.fail,MO5.EventBus):module.exports=t(require("./Exception.js"),require("./fail.js"),require("./EventBus.js"))}(),using().define("MO5.dom.effects.typewriter",function(){function t(t,e){function n(t){var e,i,r=t.childNodes;if(t.nodeType===o)for(t.style.display="none",e=0,i=r.length;i>e;e+=1)n(r[e])}function i(t,e){t.nodeType===o?!function(){for(var n=[];t.hasChildNodes();)n.push(t.removeChild(t.firstChild));t.style.display="",function r(){n.length>0?(i(n[0],r),t.appendChild(n.shift())):e&&setTimeout(e,0)}()}():t.nodeType===u&&!function(){function n(){t.data+=o[i],i+=1,s>i?setTimeout(n,1e3/r):e&&setTimeout(e,0)}var i,s,o=t.data.replace(/ +/g," ");t.data="",i=0,s=o.length,n()}()}var r,s,o=1,u=3;e=e||{},r=e.speed||50,s=e.onFinish||null,n(t),i(t,s)}return t}),using("MO5.CoreObject","MO5.transform","MO5.TimerWatcher","MO5.dom.effects.typewriter","MO5.types","MO5.Point","MO5.Size").define("MO5.dom.Element",function(t,e,n,i,r,s,o){function u(e){var n=this;e=e||{},t.call(this),this.parent=e.parent||document.body,this.nodeType=e.nodeType||"div",this.element=e.element||document.createElement(this.nodeType),a(this,this.element),u.propertiesToExclude.forEach(function(t){delete n[t]})}function a(t,e){for(var n in e)!function(n,i){"id"!==i&&("function"==typeof n?t[i]=function(){return e[i].apply(e,arguments)}:t[i]=function(n){return arguments.length?(e[i]=n,t):e[i]})}(e[n],n)}function c(t,e){return-1!==t.indexOf(e)}return u.propertiesToExclude=["appendChild","removeChild"],u.fromDomElement=function(t){return new u({element:t,nodeType:t.nodeName})},u.prototype=new t,u.prototype.constructor=u,u.prototype.appendTo=function(t){return t.appendChild(this.element)},u.prototype.remove=function(){return this.element.parentNode.removeChild(this.element)},u.prototype.appendChild=function(t){var e=t instanceof u?t.element:t;return this.element.appendChild(e)},u.prototype.addAsFirstChild=function(t){var e=t instanceof u?t.element:t;return this.element.childElementCount>0?this.element.insertBefore(e,this.element.childNodes[0]):this.element.appendChild(e)},u.prototype.fadeIn=function(t){t=t||{};var n=this.element;return this._lastFadeTimer&&this._lastFadeTimer.isRunning()&&this._lastFadeTimer.cancel(),this.show(),this._lastFadeTimer=e(function(t){n.style.opacity=t},parseInt(n.style.opacity,10)||0,1,t),this._lastFadeTimer},u.prototype.fadeOut=function(t){t=t||{};var n=this.element;return this._lastFadeTimer&&this._lastFadeTimer.isRunning()&&this._lastFadeTimer.cancel(),this._lastFadeTimer=e(function(t){n.style.opacity=t},parseInt(n.style.opacity,10)||1,0,t),this._lastFadeTimer.once("stopped",this.hide.bind(this)),this._lastFadeTimer},u.prototype.opacity=function(t){return"number"==typeof t&&(this.element.style.opacity=t),this.element.style.opacity},u.prototype.position=function(t){var e,n,i=this.element,o={};return r.isObject(t)&&(i.style.left=""+ +t.x+"px",i.style.top=""+ +t.y+"px"),o.left=i.offsetLeft,o.top=i.offsetTop,i.getBoundingClientRect&&(o=i.getBoundingClientRect()),e=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),n=Math.max(document.documentElement.scrollTop,document.body.scrollTop),new s(e+o.left,n+o.top)},u.prototype.size=function(t){return r.isObject(t)&&(this.element.style.width=""+t.width+"px",this.element.style.height=""+t.height+"px"),new o(this.element.offsetWidth,this.element.offsetHeight)},u.prototype.width=function(t){return r.isNumber(t)&&(this.element.style.width=""+t+"px"),this.element.offsetWidth},u.prototype.height=function(t){return r.isNumber(t)&&(this.element.style.height=""+t+"px"),this.element.offsetHeight},u.prototype.moveTo=function(t,i,r){r=r||{};var s,o,u=this.element,a=u.offsetLeft,c=u.offsetTop;return s=e(function(t){u.style.left=t+"px"},a,t,r),o=e(function(t){u.style.top=t+"px"},c,i,r),(new n).addTimer(s).addTimer(o)},u.prototype.move=function(t,e,n){n=n||{};var i=this.element,r=i.offsetLeft+t,s=i.offsetTop+e;return this.moveTo(r,s,n)},u.prototype.display=function(){this.element.style.visibility=""},u.prototype.show=u.prototype.display,u.prototype.hide=function(){this.element.style.visibility="hidden"},u.prototype.typewriter=function(t){t=t||{},i(this.element,t)},u.prototype.addCssClass=function(t){var e;return this.element.classList?(this.element.classList.add(t),this):(e=this.getCssClasses(),c(e,t)||(e.push(t),this.element.setAttribute("class",e.join(" "))),this)},u.prototype.removeCssClass=function(t){var e;return this.element.classList&&this.element.classList.remove(t),e=this.getCssClasses(),c(e,t)&&this.element.setAttribute("class",e.filter(function(e){return e!==t}).join(" ")),this},u.prototype.getCssClasses=function(){return(this.element.getAttribute("class")||"").split(" ")},u.prototype.hasCssClass=function(t){return this.element.classList?this.element.classList.contains(t):c(this.getCssClasses(),t)},u.prototype.clearCssClasses=function(){return this.element.setAttribute("class",""),this},u.prototype.setCssId=function(t){return this.element.setAttribute("id",t),this},u.prototype.destroy=function(){try{this.element.parentNode.removeChild(this.element)}catch(e){console.log(e)}t.prototype.destroy.call(this)},u}),using().define("MO5.dom.escape",function(){function t(t){var e="";return e=t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}return t}),using().define("MO5.easing",function(){function t(t){return function(e){return function(n,i){return r[t](e,n,i)}}}function e(e){return t("easeIn")(e)}function n(e){return t("easeOut")(e)}function i(e){return t("easeInOut")(e)}var r=function(t){"use asm";function e(t,e){t=t|0;e=e|0;return+(e/t)}function n(e,n){e=e|0;n=n|0;var i=+(t.Math.PI/(2*e));var r=+t.Math.abs(t.Math.sin(n*i));return+r}function i(e,n){e=e|0;n=n|0;var i=+(t.Math.PI/(2*e));var r=+t.Math.abs(-t.Math.cos(n*i)+1);return+r}function r(t,e){t=t|0;e=e|0;if(+(e/(t/2)<1)){return+i(t,e)}else{return+n(t,e)}}function s(t,e){t=t|0;e=e|0;var n=0,i=1,r=0.0;if((e/=t)<1/2.75){r=+(i*(7.5625*e*e)+n)}else if(e<2/2.75){r=+(i*(7.5625*(e-=1.5/2.75)*e+0.75)+n)}else if(e<2.5/2.75){r=+(i*(7.5625*(e-=2.25/2.75)*e+0.9375)+n)}else{r=+(i*(7.5625*(e-=2.625/2.75)*e+0.984375)+n)}return+r}function o(e,n,i){n=n|0;i=i|0;return+(1-t.Math.pow(1-i/n,e))}function u(e,n,i){n=n|0;i=i|0;return+t.Math.pow(i/n,e)}function a(t,e,n){e=e|0;n=n|0;var i=0.0;if(n>e/2){i=+o(t,e,n)}else{i=+u(t,e,n)}return+i}return{linear:e,sineEaseOut:n,sineEaseIn:i,sineEaseInOut:r,easeOutBounce:s,easeIn:u,easeOut:o,easeInOut:a}}(window);return r.easingFunctionGenerator=t,r.createEaseInFunction=e,r.createEaseOutFunction=n,r.createEaseInOutFunction=i,r.easeInQuad=e(2),r.easeInCubic=e(3),r.easeInQuart=e(4),r.easeInQuint=e(5),r.easeOutQuad=n(2),r.easeOutCubic=n(3),r.easeOutQuart=n(4),r.easeOutQuint=n(5),r.easeInOutQuad=i(2),r.easeInOutCubic=i(3),r.easeInOutQuart=i(4),r.easeInOutQuint=i(5),r}),function(){function t(){"use strict";function t(e){function n(t){var e;i.debug===!0&&(e=t.error.name||"Error", console.log(e+" in listener; Event: "+t.info.event+"; Message: "+t.error.message))}var i=this;e=e||{},this.debug=e.debug||!1,this.interceptErrors=e.interceptErrors||!1,this.log=e.log||!1,this.logData=e.logData||!1,this.defaults=e.defaults||{},this.defaults.flowType=this.defaults.flowType||t.FLOW_TYPE_ASYNCHRONOUS,this.callbacks={"*":[]},this.subscribe(n,"EventBus.error")}return t.FLOW_TYPE_ASYNCHRONOUS=0,t.FLOW_TYPE_SYNCHRONOUS=1,t.create=function(e){return e=e||{},new t(e)},t.prototype.subscribe=function(t,e){var n,i,r=this;if(void 0===e?(i="*",n=t):"string"==typeof t||"number"==typeof t?(i=t,n=e):("string"==typeof e||"number"==typeof e)&&(i=e,n=t),"string"!=typeof i&&"number"!=typeof i)throw new Error("Event names can only be strings or numbers! event: ",i);if("function"!=typeof n)throw new Error("Only functions may be used as listeners!");return i=i||"*",this.callbacks[i]=this.callbacks[i]||[],this.callbacks[i].push(n),this.trigger("EventBus.subscribe",{listener:n,event:i,bus:this}),function(){r.unsubscribe(n,i)}},t.prototype.unsubscribe=function(t,e){var n,i,r,s,o;if(void 0===e?(o="*",s=t):"string"==typeof t||"number"==typeof t?(o=t,s=e):("string"==typeof e||"number"==typeof e)&&(o=e,s=t),"string"!=typeof o&&"number"!=typeof o)throw new Error("Event names can only be strings or numbers! event: ",o);if("function"!=typeof s)throw new Error("Only functions may be used as listeners!");for(o=o||"*",n=this.callbacks[o]||[],i=n.length,r=0;i>r;++r)n[r]===s&&this.callbacks[o].splice(r,1);this.trigger("EventBus.unsubscribe",{listener:s,event:o,bus:this})},t.prototype.once=function(t,e){var n,i,r,s,o,u=this,a=!1;if(s="function"==typeof t,o="function"==typeof e,s&&o||!s&&!o)throw new Error("Parameter mismatch; one parameter needs to be a function, the other one must be a string.");s?(r=t,i=e):(r=e,i=t),i=i||"*",n=function(t,e){a||(a=!0,u.unsubscribe(n,i),r(t,e))},this.subscribe(n,i)},t.prototype.trigger=function(e,n,i){function r(t){setTimeout(function(){throw t},0)}var s,o,u,a,c,l,d,f;if("undefined"!=typeof e&&"string"!=typeof e&&"number"!=typeof e)throw new Error("Event names can only be strings or numbers! event: ",e);d=this,e=arguments.length?e:"*",f="undefined"!=typeof i&&i===!1?t.FLOW_TYPE_SYNCHRONOUS:this.defaults.flowType,s=function(){var t,n,i,r,s,o,u="",a=[];for(n=e.split("."),t=0,i=n.length;i>t;++t)for(u=u+(t>0?".":"")+n[t],r=d.callbacks[u]||[],s=0,o=r.length;o>s;++s)a.push(r[s]);if("*"===e)return a;for(r=d.callbacks["*"]||[],s=0,o=r.length;o>s;++s)a.push(r[s]);return a}(),o=s.length,u={event:e,subscribers:o,async:f===t.FLOW_TYPE_ASYNCHRONOUS?!0:!1,getQueueLength:function(){return 0===o?0:o-(a+1)}},c=function(){for(d.log===!0&&console.log("EventBus event triggered: "+e+"; Subscribers: "+o,d.logData===!0?"; Data: "+n:""),a=0;o>a;++a){l=s[a];try{l(n,u)}catch(t){console.log(t),d.trigger("EventBus.error",{error:t,info:u}),d.interceptErrors!==!0&&r(t)}}},f===t.FLOW_TYPE_ASYNCHRONOUS?setTimeout(c,0):c()},t.prototype.triggerSync=function(t,e){return this.trigger(t,e,!1)},t.prototype.triggerAsync=function(t,e){return this.trigger(t,e,!0)},t.inject=function(e,n){n=n||{};var i=new t(n);e.subscribe=function(t,e){i.subscribe(t,e)},e.unsubscribe=function(t,e){i.unsubscribe(t,e)},e.once=function(t,e){i.once(t,e)},e.trigger=function(t,e,n){n="undefined"!=typeof n&&n===!1?!1:!0,i.trigger(t,e,n)},e.triggerSync=i.triggerSync.bind(i),e.triggerAsync=i.triggerAsync.bind(i),e.subscribe("destroyed",function(){i.callbacks=[]})},t}"function"==typeof using?using().define("MO5.EventBus",t):"undefined"!=typeof window?(window.MO5=MO5||{},window.MO5.EventBus=t()):module.exports=t()}(),function(){function t(){function t(t){var e,n=Error.apply(null,arguments);for(e in n)this[e]=n[e];this.message=t,this.name="MO5.Exception"}return t.prototype=new Error,t.prototype.constructor=t,t}"function"==typeof using?using().define("MO5.Exception",t):"undefined"!=typeof window?(window.MO5=window.MO5||{},window.MO5.Exception=t()):module.exports=t()}(),function(){function t(){function t(t){console.error?console.error(t.toString()):console.log(t.toString()),t.stack&&console.log(t.stack)}return t}"function"==typeof using?using().define("MO5.fail",t):"undefined"!=typeof window?window.MO5.fail=t():module.exports=t()}(),using().define("MO5.globals.document",function(){return document}),using().define("MO5.globals.window",function(){return window}),function(){function t(t,e,n){function i(e){t.call(this),this.unsubscribers={},this.items=n.isArray(e)?e:[]}return i.prototype=new t,i.prototype.length=function(){return this.items.length},i.prototype.append=function(e){function n(){var t,n;for(t=0,n=r.items.length;n>t;t+=1)r.items[t]===e&&r.items.splice(t,1);delete r.unsubscribers[e.id]}function i(){e.unsubscribe(n,"destroyed")}var r=this;return t.isCoreObject(e)&&(this.unsubscribers[e.id]=i,e.subscribe(n,"destroyed"),e.subscribe("destroyed",function(){e=null})),this.items.push(e),this},i.prototype.remove=function(e){var n=this.items[e];return t.isCoreObject(n)&&(this.unsubscribers[n.id](),delete this.unsubscribers[n.id]),this.items.splice(e,1),this},i.prototype.clear=function(){var t=this;this.forEach(function(e,n){t.remove(n)})},i.prototype.at=function(t){return this.items[+t]},i.prototype.indexOf=function(t){return this.items.indexOf(t)},i.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),t},i.prototype.toQueue=function(){var t=new e;return this.items.forEach(function(e){t.add(e)}),t},i.prototype.forEach=function(t){this.items.forEach(t)},i.prototype.filter=function(t){return this.items.filter(t)},i.prototype.map=function(t){return this.items.map(t)},i.prototype.reduce=function(t){return this.items.reduce(t)},i.prototype.every=function(t){return this.items.every(t)},i.prototype.some=function(t){return this.items.some(t)},i.prototype.find=function(t){var e,n=this.items.length;for(e=0;n>e;e+=1)if(t(this.items[e]))return this.items[e];return void 0},i.prototype.combine=function(t){return new i(this.items.slice().concat(t.items))},i.prototype.clone=function(){return new i(this.items.slice())},i.prototype.destroy=function(){if(!this.destroyed){for(var e=0;er;r++){var o=n[r];if(".."===o)i.pop();else{if("."===o)continue;i.push(o)}}return i.join("/")}if(i._eak_seen=r,s[t])return s[t];if(s[t]={},!r[t])throw new Error("Could not find module "+t);for(var o,u=r[t],a=u.deps,c=u.callback,l=[],d=0,f=a.length;f>d;d++)"exports"===a[d]?l.push(o={}):l.push(e(n(a[d])));var p=c.apply(this,l);return s[t]=o||p}}(),t("promise/all",["./utils","exports"],function(t,e){"use strict";function n(t){var e=this;if(!i(t))throw new TypeError("You must pass an array to all.");return new e(function(e,n){function i(t){return function(e){s(t,e)}}function s(t,n){u[t]=n,0===--a&&e(u)}var o,u=[],a=t.length;0===a&&e([]);for(var c=0;c0},n.prototype.clear=function(){return this.arr=[],this.trigger("updated"),this.trigger("cleared"),this},n.prototype.reverse=function(){for(var t=new n,e=this.length(),i=e-1;i>=0;)t.add(this.arr[i]),i-=1;return t},n.prototype.clone=function(){return new n(this.arr.slice())},n}"function"==typeof using?using("MO5.Exception","MO5.CoreObject").define("MO5.Queue",t):"undefined"!=typeof window?window.MO5.Queue=t(MO5.Exception,MO5.CoreObject):module.exports=t(require("./Exception.js"),require("./CoreObject.js"))}(),function(){function t(){function t(t,e){var n,i=[];for(n=t;e>=n;n+=1)i.push(n);return i}return t}"function"==typeof using?using().define("MO5.range",t):"undefined"!=typeof window?window.MO5.range=t():module.exports=t()}(),function(){function t(t,e,n,i){function r(t,e){for(;t.hasNext();)a(function(t){return function(){t(e)}}(t.next()))}function s(t,e,n,i){"function"==typeof n?e.add(function(t){var e;try{e=n(t),e&&e instanceof u?e.then(i.success,i.failure):i.success(e)}catch(r){i.failure(r)}return e}):e.add(function(e){i[t](e)})}function o(){t.call(this),this.successQueue=new e,this.failureQueue=new e,this.value=void 0,this.status=o.STATUS_PENDING,this.promise=new u(this)}function u(e){t.call(this),this.then=function(t,n){var i=new o;switch(e.status){case o.STATUS_PENDING:o.addToQueue("success",e.successQueue,t,i),o.addToQueue("failure",e.failureQueue,n,i);break;case o.STATUS_SUCCESS:o.addToQueue("success",e.successQueue,t,i),o.resolve(e.successQueue,e.value);break;case o.STATUS_FAILURE:o.addToQueue("failure",e.failureQueue,n,i),o.resolve(e.failureQueue,e.value)}return i.promise}}var a;return a="undefined"!=typeof window&&window.setImmediate?window.setImmediate:"undefined"!=typeof process?function(t){process.nextTick(t)}:function(t){setTimeout(t,0)},o.STATUS_PENDING=1,o.STATUS_FAILURE=2,o.STATUS_SUCCESS=3,o.getFulfilledPromise=function(){return(new o).success().promise},o.getBrokenPromise=function(){return(new o).failure().promise},o.prototype=new t,o.prototype.isPending=function(){return this.status===o.STATUS_PENDING},o.prototype.failure=function(t){return this.status!==o.STATUS_PENDING?void i(new n("The result of the action has already been determined.")):(this.value=t,this.status=o.STATUS_FAILURE,r(this.failureQueue,t),this.successQueue.clear(),this.failureQueue.clear(),this)},o.prototype.success=function(t){return this.status!==o.STATUS_PENDING?void i(new n("The result of the action has already been determined.")):(this.value=t,this.status=o.STATUS_SUCCESS,r(this.successQueue,t),this.successQueue.clear(),this.failureQueue.clear(),this)},o.addToQueue=s,o.resolve=r,u.prototype=new t,o}console.warn("MO5.Result is deprecated - use MO5.Promise instead!"),"function"==typeof using?using("MO5.CoreObject","MO5.Queue","MO5.Exception","MO5.fail").define("MO5.Result",t):"undefined"!=typeof window?window.MO5.CoreObject=t(MO5.CoreObject,MO5.Queue,MO5.Exception,MO5.fail):module.exports=t(require("./CoreObject.js"),require("./Queue.js"),require("./Exception.js"),require("./fail.js"))}(),function(){function t(t,e){function n(n){t.call(this),this._unsubscribers={},this._stringItems={},this._items=[],n&&e.hasForEach(n)&&this.addMany(n)}function i(t){return e.isObject(t)?e.isNumber(t.id)?!0:!1:!0}function r(t){return e.isObject(t)?s+"MO5CoreObject_"+t.id:s+"SimpleValue_"+JSON.stringify(t)}var s="MO5Set_";return n.fromRange=function(t,e){var i,r=new n;for(i=t;e>=i;i+=1)r.add(i);return r},n.prototype=new t,n.prototype.has=function(t){var e,n;if(i(t))return r(t)in this._stringItems;for(e=0,n=this._items.length;n>e;e+=1)if(this._items[e]===t)return!0;return!1},n.prototype.add=function(e){var n;return this.has(e)?this:(i(e)?(n=r(e),this._stringItems[n]=e,t.isCoreObject(e)&&(this._unsubscribers[n]=this["delete"].bind(this,e),e.subscribe("destroyed",this._unsubscribers[n]))):this._items.push(e),this)},n.prototype["delete"]=function(e){var n;return this.has(e)?(i(e)?(n=r(e),delete this._stringItems[n],t.isCoreObject(e)&&(e.unsubscribe("destroyed",this._unsubscribers[n]),delete this._unsubscribers[n])):this._items.splice(this._items.indexOf(e),1),!0):!1},n.prototype.clear=function(){this._items.forEach(this["delete"].bind(this)),this._items=[],this._stringItems={},this._unsubscribers={}},n.prototype.forEach=function(t){var e,n=0;for(e in this._stringItems)t(this._stringItems[e],n,this),n+=1;this._items.forEach(function(e){t(e,n,this),n+=1}.bind(this))},n.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),t},n.prototype.keys=n.prototype.values,n.prototype.addMany=function(t){return t.forEach(this.add.bind(this)),this},n.prototype.intersection=function(t){var e=new n;return t.forEach(function(t){this.has(t)&&e.add(t)}.bind(this)),e},n.prototype.difference=function(t){var e=new n(this.values());return t.forEach(function(t){e.has(t)?e["delete"](t):e.add(t)}),e},n.prototype.size=function(){var t,e=this._items.length;for(t in this._stringItems)e+=1;return e},n}"function"==typeof using?using("MO5.CoreObject","MO5.types").define("MO5.Set",t):"undefined"!=typeof window?window.MO5.Set=t(MO5.CoreObject,MO5.types):module.exports=t(require("./CoreObject.js"),require("./types.js"))}(),using().define("MO5.Size",function(){function t(t,e){this.width=t||0,this.height=e||0}return t}),function(){function t(t,e,n,i){function r(e){t.call(this),this.message=e,this.name="MO5.TimerError"}function s(){e.call(this),this.running=!1,this.paused=!1,this.canceled=!1,this.startTime=+new Date,this.timeElapsed=0,this.pauseTimeElapsed=0,this.pauseStartTime=this.startTime}return r.prototype=new t,s.prototype=new e,s.prototype.constructor=s,s.prototype.start=function(){return this.startTime=+new Date,this.running=!0,this.trigger("started",null,!1),this},s.prototype.stop=function(){return this.running=!1,this.paused=!1,this.trigger("stopped",null,!1),this},s.prototype.cancel=function(){return this.running||n(new r("Trying to cancel a Timer that isn't running.")),this.elapsed(),this.canceled=!0,this.running=!1,this.paused=!1,this.trigger("canceled",null,!1),this},s.prototype.isRunning=function(){return this.running},s.prototype.isCanceled=function(){return this.canceled},s.prototype.isPaused=function(){return this.paused},s.prototype.pause=function(){this.paused=!0,this.pauseStartTime=+new Date,this.trigger("paused",null,!1)},s.prototype.resume=function(){this.paused||n(new r("Trying to resume a timer that isn't paused.")),this.paused=!1,this.pauseTimeElapsed+=+new Date-this.pauseStartTime,this.trigger("resumed",null,!1)},s.prototype.elapsed=function(){return this.running&&!this.paused&&(this.timeElapsed=+new Date-this.startTime-this.pauseTimeElapsed),this.timeElapsed},s.prototype.getReadOnlyCapability=function(){var t=this;return{isRunning:function(){return t.running},isCanceled:function(){return t.canceled},isPaused:function(){return t.paused},elapsed:function(){return t.elapsed()}}},s.prototype.promise=function(){var t=new i,e=this;return this.once(function(){t.resolve(e)},"stopped"),this.once(function(){t.reject(e)},"canceled"),this.once(function(){t.reject(e)},"destroyed"),t},s}"function"==typeof using?using("MO5.Exception","MO5.CoreObject","MO5.fail","MO5.Promise").define("MO5.Timer",t):"undefined"!=typeof window?window.MO5.Timer=t(MO5.Exception,MO5.CoreObject,MO5.fail,MO5.Promise):module.exports=t(require("./Exception.js"),require("./CoreObject.js"),require("./fail.js"),require("./Promise.js"))}(),function(){function t(t,e,n,i){function r(n){var i;if(e.call(this),n&&!(n instanceof Array))throw new t("Parameter 1 is expected to be of type Array.").log();n=n||[],i=this,this.timers={},this.count=0,n.forEach(function(t){i.addTimer(t)})}return r.prototype=new e,r.prototype.constructor=r,r.prototype.addTimer=function(e){var n,i=this;if(this.timers[+e])throw new t("A timer with ID '"+e+"' has already been added to the watcher.");return this.count+=1,n=function(){i.count-=1,i.count<1&&i.trigger("stopped",null,!1)},this.timers[+e]={timer:e,unsubscribe:function(){e.unsubscribe(n,"stopped")}},e.subscribe(n,"stopped"),this.trigger("added",e,!1),this},r.prototype.createTimer=function(){var t=new i;return this.trigger("created",t,!1),this.addTimer(t),t},r.prototype.removeTimer=function(e){return this.timers[+e]?(this.timers[+e].unsubscribe(),delete this.timers[+e],this.trigger("removed",e,!1),this):(n(new t("Trying to remove a timer that is unknown to the watcher.")),this)},r.prototype.forAll=function(t){var e,n;for(e in this.timers)this.timers.hasOwnProperty(e)&&(n=this.timers[e].timer,n instanceof r?this.timers[e].timer.forAll(t):this.timers[e].timer[t]());return this},r.prototype.cancel=function(){return this.forAll("cancel"),this.trigger("canceled",null,!1),this},r.prototype.pause=function(){return this.forAll("pause"),this.trigger("paused",null,!1),this},r.prototype.resume=function(){return this.forAll("resume"),this.trigger("resumed",null,!1),this},r.prototype.stop=function(){return this.forAll("stop")},r.prototype.start=function(){return this.forAll("start"),this.trigger("started",null,!1),this},r.prototype.promise=function(){return i.prototype.promise.call(this)},r}"function"==typeof using?using("MO5.Exception","MO5.CoreObject","MO5.fail","MO5.Timer").define("MO5.TimerWatcher",t):"undefined"!=typeof window?window.MO5.TimerWatcher=t(MO5.Exception,MO5.CoreObject,MO5.fail,MO5.Timer):module.exports=t(require("./Exception.js"),require("./CoreObject.js"),require("./fail.js"),require("./Timer.js"))}(),using().define("MO5.tools",function(){var t={};return t.getUniqueId=function(){var t=0;return function(){return t++}}(),t.getWindowDimensions=function(){var t=window,e="inner";return"innerWidth"in t||(e="client",t=document.documentElement||document.body),{width:t[e+"Width"],height:t[e+"Height"]}},t.fitToWindow=function(e,n,i){var r,s,o,u,a,c;r=t.getWindowDimensions(),o=r.width,u=r.height,a=o/n,c=u/i,s=a>c?c:a,e.setAttribute("style",e.getAttribute("style")+" -moz-transform: scale("+s+","+s+") rotate(0.01deg); -ms-transform: scale("+s+","+s+"); -o-transform: scale("+s+","+s+"); -webkit-transform: scale("+s+","+s+"); transform: scale("+s+","+s+");")},t.timeoutInspector=function(){var t,e,n,i,r,s={},o=0,u=0,a=0;return t=window.setTimeout,e=window.setInterval,n=window.clearTimeout,i=window.clearInterval,r=window.requestAnimationFrame,{logAnimationFrameRequests:!1,logTimeouts:!1,logIntervals:!1,enable:function(){window.setTimeout=function(e,n){var i=t(e,n);return o+=1,this.logTimeouts&&console.log("Setting timeout: ",{callback:e.toString(),time:n},i),i},window.setInterval=function(t,n){var i=e(t,n);return u+=1,s[i]=!0,this.logIntervals&&console.log("Setting interval: ",{callback:t.toString(),time:n},i),i},window.clearTimeout=function(t){return console.log("Clearing timeout: ",t),n(t)},window.clearInterval=function(t){return console.log("Clearing interval: ",t),t in s?delete s[t]:console.log("Warning: Interval "+t+" doesn't exist."),i(t)},window.requestAnimationFrame=function(t){return a+=1,this.logAnimationFrameRequests&&console.log("Requesting animation frame: ",{callback:t.toString()}),r(t)}},disable:function(){window.setTimeout=t,window.setInterval=e,window.clearTimeout=n,window.clearInterval=i,window.requestAnimationFrame=r},getActiveIntervals:function(){var t,e=[];for(t in this.activeIntervals)e.push(t);return e},totalTimeoutCalls:function(){return o},totalIntervalCalls:function(){return u},totalRequestAnimationFrameCalls:function(){return a}}}(),t}),using("MO5.Exception","MO5.Timer","MO5.easing").define("MO5.transform",function(t,e,n){function i(i,r,s,o){if(o=o||{},"undefined"==typeof i||!i)throw new t("MO5.transform expects parameter callback to be a function.");var u,a,c="undefined"!=typeof o.duration&&o.duration>=0?o.duration:500,l=r,d=o.timer||new e,f=s-r,p=o.log||!1,h=0,m=0,g=o.fps||60;return u=o.easing||n.sineEaseOut,a=function(){var t,e;if(Date.now()-m>1e3/g){if(d.canceled)return;if(d.paused)return void d.once(a,"resumed");if(h+=1,e=d.elapsed(),e>c||d.stopped)return l=r+f,i(s),void(d.stopped||d.stop());l=u(c,e)*f+r,i(l),t=d.elapsed()-e,p===!0&&console.log("Current value: "+l+"; c: "+h+"; Exec time: "+t),m=Date.now()}requestAnimationFrame(a)},d.start(),requestAnimationFrame(a),d}return i}),function(){function t(){var t={};return t.isObject=function(t){return"object"==typeof t&&null!==t},t.isString=function(t){return"string"==typeof t},t.isNumber=function(t){return"number"==typeof t},t.isFunction=function(t){return"function"==typeof t},t.isArray=function(e){return Array.isArray?Array.isArray(e):t.isObject(e)?e instanceof Array:!1},t.hasForEach=function(e){return t.isObject(e)&&t.isFunction(e.forEach)},t}"function"==typeof using?using().define("MO5.types",t):"undefined"!=typeof window?window.MO5.types=t():module.exports=t()}(),using("WSE.assets.Animation","WSE.assets.Audio","WSE.assets.Background","WSE.assets.Character","WSE.assets.Curtain","WSE.assets.Imagepack","WSE.assets.Textbox","WSE.assets.Composite").define("WSE.assets",function(t,e,n,i,r,s,o,u){var a={Animation:t,Audio:e,Background:n,Character:i,Curtain:r,Imagepack:s,Textbox:o,Composite:u};return a}),using("WSE.commands.alert","WSE.commands.break","WSE.commands.choice","WSE.commands.confirm","WSE.commands.do","WSE.commands.fn","WSE.commands.global","WSE.commands.globalize","WSE.commands.goto","WSE.commands.line","WSE.commands.localize","WSE.commands.prompt","WSE.commands.restart","WSE.commands.set_vars","WSE.commands.sub","WSE.commands.trigger","WSE.commands.var","WSE.commands.wait","WSE.commands.while","WSE.commands.with").define("WSE.commands",function(t,e,n,i,r,s,o,u,a,c,l,d,f,p,h,m,g,y,b,v){"use strict";var w={alert:t,"break":e,choice:n,confirm:i,"do":r,fn:s,global:o,globalize:u,"goto":a,line:c,localize:l,prompt:d,restart:f,set_vars:p,sub:h,trigger:m,"var":g,wait:y,"while":b,"with":v};return w}),using().define("WSE.functions",function(){"use strict";var t={savegames:function(t){t.toggleSavegameMenu()},stageclick_disable:function(t){t.game.unsubscribeListeners()},stageclick_enable:function(t){t.game.subscribeListeners()}};return t}),using("WSE.dataSources.LocalStorage").define("WSE.dataSources",function(t){var e={LocalStorage:t};return e}),using("databus","WSE.assets","WSE.commands","WSE.dataSources","WSE.functions").define("WSE",function(t,e,n,i,r){"use strict";var s={},o="2017.1.1";return t.inject(s),s.instances=[],s.dataSources=i,s.assets=e,s.commands=n,s.functions=r,s.getVersion=function(){return o},s}),using().define("WSE.Keys",function(){function t(t){t=t||{},this.keys={},this.keys.BACKSPACE={kc:8},this.keys.TAB={kc:9},this.keys.ENTER={kc:13,which:13},this.keys.SHIFT={kc:16},this.keys.CTRL={kc:17},this.keys.ALT={kc:18},this.keys.PAUSE={kc:19},this.keys.CAPS_LOCK={kc:20},this.keys.ESCAPE={kc:27},this.keys.SPACE={kc:32},this.keys.PAGE_UP={kc:33},this.keys.PAGE_DOWN={kc:20},this.keys.END={kc:20},this.keys.HOME={kc:20},this.keys.LEFT_ARROW={kc:37},this.keys.UP_ARROW={kc:38},this.keys.RIGHT_ARROW={kc:39},this.keys.DOWN_ARROW={kc:40},this.keys.INSERT={kc:45},this.keys.DELETE={kc:46},this.keys.NUM_0={ kc:48},this.keys.NUM_1={kc:49},this.keys.NUM_2={kc:50},this.keys.NUM_3={kc:51},this.keys.NUM_4={kc:52},this.keys.NUM_5={kc:53},this.keys.NUM_6={kc:54},this.keys.NUM_7={kc:55},this.keys.NUM_8={kc:56},this.keys.NUM_9={kc:57},this.keys.A={kc:65},this.keys.B={kc:66},this.keys.C={kc:67},this.keys.D={kc:68},this.keys.E={kc:69},this.keys.F={kc:70},this.keys.G={kc:71},this.keys.H={kc:72},this.keys.I={kc:73},this.keys.J={kc:74},this.keys.K={kc:75},this.keys.L={kc:76},this.keys.M={kc:77},this.keys.N={kc:78},this.keys.O={kc:79},this.keys.P={kc:80},this.keys.Q={kc:81},this.keys.R={kc:82},this.keys.S={kc:83},this.keys.T={kc:84},this.keys.U={kc:85},this.keys.V={kc:86},this.keys.W={kc:87},this.keys.X={kc:88},this.keys.Y={kc:89},this.keys.Z={kc:90},this.keys.LEFT_WIN={kc:91},this.keys.RIGHT_WIN={kc:92},this.keys.SELECT={kc:93},this.keys.NUMPAD_0={kc:96},this.keys.NUMPAD_1={kc:97},this.keys.NUMPAD_2={kc:98},this.keys.NUMPAD_3={kc:99},this.keys.NUMPAD_4={kc:100},this.keys.NUMPAD_5={kc:101},this.keys.NUMPAD_6={kc:102},this.keys.NUMPAD_7={kc:103},this.keys.NUMPAD_8={kc:104},this.keys.NUMPAD_9={kc:105},this.keys.MULTIPLY={kc:106},this.keys.ADD={kc:107},this.keys.SUBSTRACT={kc:109},this.keys.DECIMAL_POINT={kc:110},this.keys.DIVIDE={kc:111},this.keys.F1={kc:112},this.keys.F2={kc:113},this.keys.F3={kc:114},this.keys.F4={kc:115},this.keys.F5={kc:116},this.keys.F6={kc:117},this.keys.F7={kc:118},this.keys.F8={kc:119},this.keys.F9={kc:120},this.keys.F10={kc:121},this.keys.F11={kc:122},this.keys.F12={kc:123},this.keys.NUM_LOCK={kc:144},this.keys.SCROLL_LOCK={kc:145},this.keys.SEMI_COLON={kc:186},this.keys.EQUALS={kc:187},this.keys.COMMA={kc:188},this.keys.DASH={kc:189},this.keys.PERIOD={kc:190},this.keys.SLASH={kc:191},this.keys.GRAVE={kc:192},this.keys.OPEN_BRACKET={kc:219},this.keys.BACK_SLASH={kc:220},this.keys.CLOSE_BRACKET={kc:221},this.keys.SINGLE_QUOTE={kc:222},this.listeners=[];var e,n,i,r,s,o,u=t.log||!1,a=t.element||window,c=this;e=function(t){null!=t&&"undefined"!=typeof t&&(t.addEventListener?(t.addEventListener("keyup",i,!1),t.addEventListener("keydown",r,!1),t.addEventListener("keypress",s,!1),u===!0&&(t.addEventListener("keyup",o,!1),t.addEventListener("keydown",o,!1),t.addEventListener("keypress",o,!1))):t.attachEvent&&(t.attachEvent("onkeyup",i),t.attachEvent("onkeydown",r),t.attachEvent("onkeypress",s),u===!0&&(t.attachEvent("onkeyup",o),t.attachEvent("onkeydown",o),t.attachEvent("onkeypress",o))))},n=function(t,e){var n,i,r,s,o=c.listeners.length;for(i=0;o>i;++i)n=c.listeners[i],"undefined"!=typeof n&&n.type==e&&(n.key=n.key||{},r=n.key.kc||null,s=n.key.which||null,(t.which==s||t.keyCode==r)&&n.callback(t))},i=function(t){n(t,"up")},r=function(t){n(t,"down")},s=function(t){n(t,"press")},o=function(t){console.log(t)},e(a)}return t.prototype.addListener=function(t,e,n){if(n=n||"up","up"!==n&&"down"!==n&&"press"!==n)throw new Error("Event type not recognized.");this.listeners.push({key:t,callback:e,type:n})},t.prototype.removeListener=function(t,e,n){var i,r=this.listeners.length;n=n||null;for(var s=0;r>s;++s)i=this.listeners[s],(null===n||i.type==n)&&"undefined"!=typeof i&&i.key===t&&i.callback===e&&delete this.listeners[s]},t.prototype.forAll=function(t,e){if(e=e||"up","up"!==e&&"down"!==e&&"press"!==e)throw new Error("Event type not recognized.");for(var n in this.keys)this.keys.hasOwnProperty(n)&&this.addListener(this.keys[n],t,e)},t}),using("MO5.Timer").define("WSE.tools",function(t){"use strict";var e={};return e.applyAssetUnits=function(t,e){var n,i;n=e.getAttribute("x")||"",i=e.getAttribute("y")||"",t.xUnit=n.replace(/^.*(px|%)$/,"$1"),t.xUnit=t.xUnit||"px",t.yUnit=i.replace(/^.*(px|%)$/,"$1"),t.yUnit=t.yUnit||"px","px"!==t.xUnit&&"%"!==t.xUnit&&(t.xUnit="px"),"px"!==t.yUnit&&"%"!==t.yUnit&&(t.yUnit="px")},e.removeEventListener=function(t,e,n){"undefined"!=typeof t&&null!==t&&t.removeEventListener(e,n,!1)},e.replaceVariables=function(t,e){var n,i;return null===t?t:("string"!=typeof t&&(e.bus.trigger("wse.interpreter.error",{message:"Argument supplied to the replaceVariables function must be a string."}),t=""),n=function(){var t=arguments[1];return e.globalVars.has(t)?""+e.globalVars.get(t):""},i=function(){var t=arguments[1];return t in e.runVars?""+e.runVars[t]:""},t=t.replace(/\{\$\$([a-zA-Z0-9_]+)\}/g,n),t=t.replace(/\{\$([a-zA-Z0-9_]+)\}/g,i))},e.getSerializedNodes=function(t){var e,n,i=new XMLSerializer,r=t.childNodes,s="";for(e=0,n=r.length;n>e;e+=1)s+=i.serializeToString(r[e]);return s},e.getParsedAttribute=function(t,n,i,r){var s;return arguments.length<3&&(r=""),s=t.getAttribute(n)||""+r,e.replaceVariables(s,i)},e.textToHtml=function(t,e){return e=e||!1,String.prototype.trim?t=t.trim():(t=t.replace(/^\n/,""),t=t.replace(/\n$/,"")),t=e===!0?t.replace(/\n/g,"
"):t,t=t.replace(/\{/g,"<"),t=t.replace(/\}/g,">")},e.getUniqueId=function(){var t=0;return function(){return t+=1}}(),e.firstLetterUppercase=function(t){return t.length<1?"":""+t.charAt(0).toUpperCase()+t.replace(/^.{1}/,"")},e.mixin=function(t,e){var n;for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e.extractUnit=function(t){return"string"!=typeof t?"":t.replace(/^(-){0,1}[0-9]*/,"")},e.calculateValueWithAnchor=function(t,n,i){var r=0,s="px";return n?(s=e.extractUnit(n),n=parseInt(n,10),r="%"===s?t-i/100*n:t-n):t},e.createTimer=function(e){var n=new t;return e=e||0,e=0>e?0:e,n.start(),setTimeout(n.stop.bind(n),e),n},e.getWindowDimensions=function(){var t=window,e="inner";return"innerWidth"in t||(e="client",t=document.documentElement||document.body),{width:t[e+"Width"],height:t[e+"Height"]}},e.fitToWindow=function(t,n,i){var r,s,o,u,a,c;r=e.getWindowDimensions(),o=r.width,u=r.height,a=o/n,c=u/i,s=a>c?c:a,t.setAttribute("style",t.getAttribute("style")+" -moz-transform: scale("+s+","+s+") rotate(0.01deg); -ms-transform: scale("+s+","+s+"); -o-transform: scale("+s+","+s+"); -webkit-transform: scale("+s+","+s+"); transform: scale("+s+","+s+");")},e.log=function(t,n){e.trigger(t,"wse.interpreter.message",n)},e.warn=function(t,n,i){e.trigger(t,"wse.interpreter.warning",n,i)},e.logError=function(t,n,i){e.trigger(t,"wse.interpreter.error",n,i)},e.trigger=function(t,e,n,i){t.trigger(e,{element:i||null,message:n})},e.truthy=function(t){return["true","yes"].indexOf(t)>=0},e}),using("easy-ajax","WSE.tools.compile::compile").define("WSE.loader",function(t,e){function n(t,e){o(t,function(t){i(t,e)})}function i(t,e){var n=u(t),i=a(n);s(i,function(t){t.forEach(function(t,e){var r=i[e].type,s=n.getElementsByTagName(r)[0];s||(s=n.createElement(r),n.documentElement.appendChild(s)),s.innerHTML+="\n"+t+"\n"}),e(n)})}function r(t,n){i(e(t),n)}function s(t,e){var n=0,i=t.length,r=[];t.forEach(function(t,s){o(t.url,function(t){r[s]=t,n+=1,n>=i&&e(r)})}),1>i&&e(r)}function o(n,i){t.get(n+"?random="+Math.random(),function(t,n){return t?void console.error(t):void i(e(n.responseText))})}function u(t){return(new DOMParser).parseFromString(t,"application/xml")}function a(t){var e=t.getElementsByTagName("file");return[].map.call(e,function(t){return{type:t.getAttribute("type"),url:t.getAttribute("url")}})}return{generateGameFile:n,generateFromString:r}}),using("string-dict").define("WSE.dataSources.LocalStorage",function(t){"use strict";function e(){}var n,i="___wse_storage_test",r=!1;try{localStorage.setItem(i,"works"),"works"===localStorage.getItem(i)&&(r=!0)}catch(s){console.error("LocalStorage not available, using JS object as fallback."),n=new t}return e.prototype.set=function(t,e){r?localStorage.setItem(t,e):n.set(t,e)},e.prototype.get=function(t){return r?localStorage.getItem(t):n.has(t)?n.get(t):null},e.prototype.remove=function(t){if(!r){if(!n.has(t))return;return n.remove(t)}return localStorage.removeItem(t)},e}),using("WSE.commands","WSE.functions","WSE.tools::warn").define("WSE.Trigger",function(t,e,n){"use strict";function i(i,r){var s,o=this;if(this.name=i.getAttribute("name")||null,this.event=i.getAttribute("event")||null,this.special=i.getAttribute("special")||null,this.fnName=i.getAttribute("function")||null,this.scene=i.getAttribute("scene")||null,this.interpreter=r,this.isSubscribed=!1,null===this.name)return void n(r.bus,"No 'name' attribute specified on 'trigger' element.",i);if(null===this.event)return void n(r.bus,"No 'event' attribute specified on 'trigger' element '"+this.name+"'.",i);if(null===this.special&&null===this.fnName&&null===this.scene)return void n(r.bus,"No suitable action or function found for trigger element '"+this.name+"'.",i);if(this.scene&&(s=function(){t.sub(i,r),r.index=0,r.currentElement=0,r.next()}),this.isKeyEvent=!1,this.key=null,null!==this.special&&"next"!==this.special)return void n(r.bus,"Unknown special specified on trigger element '"+this.name+"'.",i);if("next"===this.special&&(s=function(){"pause"===o.interpreter.state||o.interpreter.waitCounter>0||o.interpreter.next()}),null!==this.fnName){if("function"!=typeof e[this.fnName])return void n(r.bus,"Unknown function specified on trigger element '"+this.name+"'.",i);s=function(){e[o.fnName](o.interpreter,i)}}switch(this.event){case"keyup":case"keydown":case"keypress":return this.isKeyEvent=!0,this.key=i.getAttribute("key")||null,null===this.key?void n(r.bus,"No 'key' attribute specified on trigger element '"+this.name+"'.",i):"undefined"==typeof r.game.keys.keys[this.key]||null===r.game.keys.keys[this.key]?void n(r.bus,"Unknown key '"+this.key+"' specified on trigger element '"+this.name+"'.",i):void(this.fn=function(t){t.keys[o.key].kc===t.event.keyCode&&(r.keysDisabled>0||s())});default:this.fn=s}}return i.prototype.activate=function(){this.isSubscribed!==!0&&(this.interpreter.bus.subscribe(this.fn,this.event),this.isSubscribed=!0)},i.prototype.deactivate=function(){this.isSubscribed!==!1&&(this.interpreter.bus.unsubscribe(this.fn,this.event),this.isSubscribed=!1)},i}),using("databus","easy-ajax","WSE.Keys","WSE.Interpreter","WSE.tools","WSE","WSE.loader","WSE.tools::truthy").define("WSE.Game",function(t,e,n,i,r,s,o,u){"use strict";function a(e){var r;s.instances.push(this),s.trigger("wse.game.constructor",{args:e,game:this}),e=e||{},this.bus=new t,this.url=e.url||"game.xml",this.gameId=e.gameId||null,this.ws=null,this.debug=e.debug===!0?!0:!1,r=e.host||!1,this.host=r,this.gameId?o.generateFromString(document.getElementById(this.gameId).innerHTML,this.load.bind(this)):r?o.generateFromString(r.get(this.url),this.load.bind(this)):o.generateGameFile(this.url,this.load.bind(this)),this.interpreter=new i(this,{datasource:e.datasource}),this.keys=new n,this.listenersSubscribed=!1,this.bus.subscribe(function(t){console.log("Message: "+t)},"wse.interpreter.message"),this.bus.subscribe(function(t){console.log("Error: "+t.message)},"wse.interpreter.error"),this.bus.subscribe(function(t){console.log("Warning: "+t.message,t.element)},"wse.interpreter.warning")}return a.prototype.load=function(t){this.ws=t,this.init()},a.prototype.loadFromUrl=function(t){var n,i;this.url=t||this.url,i=this,n=function(t){i.ws=t.responseXML,i.init()},e.get(this.url,null,n)},a.prototype.init=function(){var t,e,n,i,s,o,a,c,l;t=this.ws,function(){var e=t.getElementsByTagName("parsererror");if(console.log("parsererror:",e),e.length)throw document.body.innerHTML='

Cannot parse WebStory file!

Your WebStory file is mal-formed XML and contains these errors:

'+e[0].innerHTML+"
",new Error("Can't parse game file, not well-formed XML:",e[0])}();try{n=t.getElementsByTagName("stage")}catch(d){console.log(d)}if(s="800px",o="480px",a="Stage",!n||n.length<1)throw new Error("No stage definition found!");i=n[0],s=i.getAttribute("width")||s,o=i.getAttribute("height")||o,a=i.getAttribute("id")||a,"yes"===i.getAttribute("create")?(e=document.createElement("div"),e.setAttribute("id",a),document.body.appendChild(e)):e=document.getElementById(a),e.setAttribute("class","WSEStage"),e.style.width=s,e.style.height=o,c=function(){var t=r.getWindowDimensions();e.style.left=t.width/2-parseInt(s,10)/2+"px",e.style.top=t.height/2-parseInt(o,10)/2+"px"},"yes"===i.getAttribute("center")&&(window.addEventListener("resize",c),c()),l=function(){console.log("Resizing..."),r.fitToWindow(e,parseInt(s,10),parseInt(o,10))},"yes"===i.getAttribute("resize")&&(window.addEventListener("resize",l),l()),this.stage=e,this.applySettings(),this.host&&(this.host.window.width=parseInt(s,10),this.host.window.height=parseInt(o,10),function(t){var n=u(t.getSetting("host.stage.resize"));n&&window.addEventListener("resize",function(){console.log("Resizing..."),r.fitToWindow(e,parseInt(s,10),parseInt(o,10))})}(this))},a.prototype.getSetting=function(t){var e,n,i,r,s,o;for(n=this.ws.getElementsByTagName("setting"),i=0,r=n.length;r>i;i+=1)if(s=n[i],o=s.getAttribute("name")||null,null!==o&&o===t)return e=s.getAttribute("value")||null;return null},a.prototype.applySettings=function(){this.webInspectorEnabled=u(this.getSetting("host.inspector.enable")),this.host&&this.webInspectorEnabled===!0&&this.host.inspector.show()},a.prototype.start=function(){var t,e,n;return n=this,null===this.ws?setTimeout(function(){n.start()}):(t=function(){"pause"===n.interpreter.state||n.interpreter.waitCounter>0||n.interpreter.next(!0)},e=function(t){return n.bus.trigger("contextmenu",{}),t&&"function"==typeof t.preventDefault&&t.preventDefault(),!1},this.subscribeListeners=function(){this.stage.addEventListener("contextmenu",e),this.stage.addEventListener("click",t),this.listenersSubscribed=!0},this.unsubscribeListeners=function(){this.stage.removeEventListener("contextmenu",e),this.stage.removeEventListener("click",t),this.listenersSubscribed=!1},void this.interpreter.start())},a}),using("WSE.dataSources.LocalStorage","WSE.Trigger","WSE.tools","WSE.tools.ui","WSE","WSE.tools::logError","WSE.tools::warn","WSE.LoadingScreen","WSE.tools::getSerializedNodes","enjoy-core::each","enjoy-core::find","enjoy-typechecks::isUndefined","enjoy-typechecks::isNull","WSE.savegames","WSE.tools::truthy").define("WSE.Interpreter",function(t,e,n,i,r,s,o,u,a,c,l,d,f,p,h){"use strict";function m(e,n){var i,s;r.trigger("wse.interpreter.constructor",{game:e,interpreter:this}),this.game=e,this.assets={},this.index=0,this.visitedScenes=[],this.log=[],this.waitForTimer=!1,this.assetsLoading=0,this.assetsLoadingMax=0,this.assetsLoaded=0,this.startTime=0,this.runVars={},this.callStack=[],this.keysDisabled=0,this.state="listen",this.waitCounter=0,this.debug=e.debug===!0?!0:!1,i=n.datasource||new t,this.datasource=i,s="wse_globals_"+location.pathname+"_"+this.game.url+"_",this.globalVars={set:function(t,e){i.set(s+t,e)},get:function(t){return i.get(s+t)},has:function(t){return f(i.get(s+t))?!1:!0}},this._loadingScreen=new u,this.debug===!0&&(this.game.bus.debug=!0)}return m.prototype.start=function(){var t,e,n,i,r=Date.now();this.story=this.game.ws,this.stage=this.game.stage,this.bus=this.game.bus,this.index=0,this.currentElement=0,this.sceneId=null,this.scenePath=[],this.currentCommands=[],this.wait=!1,this.startTime=Math.round(+new Date/1e3),this.stopped=!1,t=this,i=this.bus,this._startLoadingScreen(),e=function(e){var n,i,r;if(e=e||{},i=e.element||null,n=null,null!==i)try{n="asset"===e.element.tagName?"assets":null,n="settings"===e.element.parent.tagName?"settings":null}catch(s){}switch(n=n||"scenes"){case"assets":r=" Encountered in section 'assets'.";break;case"settings":r=" Encountered in section 'settings'.";break;default:r=" Encountered in scene '"+t.sceneId+"', element "+t.currentElement+"."}console.log(r)},i.subscribe(e,"wse.interpreter.error"),i.subscribe(e,"wse.interpreter.warning"),i.subscribe(e,"wse.interpreter.message"),i.subscribe(function(){console.log("Game over.")},"wse.interpreter.end"),i.subscribe(function(){t.numberOfFunctionsToWaitFor+=1},"wse.interpreter.numberOfFunctionsToWaitFor.increase"),i.subscribe(function(){t.numberOfFunctionsToWaitFor-=1},"wse.interpreter.numberOfFunctionsToWaitFor.decrease"),i.subscribe(this._loadingScreen.addItem.bind(this._loadingScreen),"wse.assets.loading.increase"),i.subscribe(this._loadingScreen.itemLoaded.bind(this._loadingScreen),"wse.assets.loading.decrease"),this.buildAssets(),this.createTriggers(),n=function(e){return function(n){i.trigger(e,{event:n,keys:t.game.keys.keys})}},this.game.keys.forAll(n("keyup"),"up"),this.game.keys.forAll(n("keydown"),"down"),this.game.keys.forAll(n("keypress"),"press"),this.game.subscribeListeners(),this._assetsLoaded=!1,this._loadingScreen.subscribe("finished",function(){var e=Date.now()-r;t._assetsLoaded||(t._assetsLoaded=!0,t.callOnLoad(),1e3>e?setTimeout(t.runStory.bind(t),1e3-e):t.runStory())}),this._loadingScreen.count()<1&&(this._assetsLoaded=!0,this.runStory())},m.prototype.callOnLoad=function(){c(function(t){"function"==typeof t.onLoad&&t.onLoad()},this.assets)},m.prototype.runStory=function(){return this.assetsLoading>0?void setTimeout(this.runStory.bind(this),100):(this.bus.trigger("wse.assets.loading.finished"),this._loadingScreen.hide(),this.startTime=Math.round(+new Date/1e3),void this.changeScene(this.getFirstScene()))},m.prototype.getFirstScene=function(){var t,e,n;return t=this.story.getElementsByTagName("scene"),this.scenes=t,e=t.length,n=this.getSceneById("start"),null!==n?n:1>e?(s(this.bus,"No scenes found!"),null):t[0]},m.prototype.changeScene=function(t){this.changeSceneNoNext(t),this.next()},m.prototype.changeSceneNoNext=function(t){var e,n,i=this.bus;if(i.trigger("wse.interpreter.changescene.before",{scene:t,interpreter:this},!1),d(t)||f(t))return void s(i,"Scene does not exist.");if(n=t.getAttribute("id"),this.visitedScenes.push(n),f(n))return void s(i,"Encountered scene without id attribute.");for(i.trigger("wse.interpreter.message","Entering scene '"+n+"'.");this.scenePath.length>0;)this.popFromCallStack();return this.currentCommands=t.childNodes,e=this.currentCommands.length,this.index=0,this.sceneId=n,this.scenePath=[],this.currentElement=0,1>e?void o(i,"Scene '"+n+"' is empty.",t):(this.numberOfFunctionsToWaitFor=0,void i.trigger("wse.interpreter.changescene.after",{scene:t,interpreter:this},!1))},m.prototype.pushToCallStack=function(){var t={};t.index=this.index,t.sceneId=this.sceneId,t.scenePath=this.scenePath.slice(),t.currentElement=this.currentElement,this.callStack.push(t)},m.prototype.popFromCallStack=function(){var t=this.callStack.pop(),e=t.scenePath.slice();for(this.bus.trigger("wse.interpreter.message","Returning from sub scene '"+this.sceneId+"' to scene '"+t.sceneId+"'...",!1),this.index=t.index+1,this.sceneId=t.sceneId,this.scenePath=t.scenePath,this.currentScene=this.getSceneById(t.sceneId),this.currentElement=t.currentElement,this.currentCommands=this.currentScene.childNodes;e.length>0;)this.currentCommands=this.currentCommands[e.shift()].childNodes},m.prototype.getSceneById=function(t){var e=l(function(e){return e.getAttribute("id")===t},this.scenes);return f(e)&&o(this.bus,"Scene '"+t+"' not found!"),e},m.prototype.next=function(t){var e,n,i,r,s,o=this.bus;if(s={stop:!1},t=t===!0?!0:!1,o.trigger("wse.interpreter.next.before",this,!1),t===!0&&o.trigger("wse.interpreter.next.user",s,!1),s.stop!==!0&&(r=this,"pause"!==this.state)){if(this.waitForTimer===!0||this.wait===!0&&this.waitCounter>0)return void setTimeout(function(){r.next()},0);if(this.wait===!0&&this.numberOfFunctionsToWaitFor<1&&(this.wait=!1),this.stopped=!1,this.cancelCharAnimation)return this.cancelCharAnimation(),void(this.cancelCharAnimation=null);if(this.index>=this.currentCommands.length)return this.callStack.length>0?(this.popFromCallStack(),void setTimeout(function(){r.next()},0)):(o.trigger("wse.interpreter.next.after.end",this,!1),void o.trigger("wse.interpreter.end",this));if(n=this.currentCommands[this.index],e=n.nodeName,"#text"===e||"#comment"===e)return this.index+=1,setTimeout(function(){r.next()},0),void o.trigger("wse.interpreter.next.ignore",this,!1);if(o.trigger("wse.interpreter.next.command",n),this.currentElement+=1,i=this.runCommand(this.currentCommands[this.index]),i=i||{},i.doNext=i.doNext===!1?!1:!0,i.wait=i.wait===!0?!0:!1,i.changeScene=i.changeScene||null,i.wait===!0&&(this.wait=!0),this.index+=1,null!==i.changeScene)return void this.changeScene(i.changeScene);if(i.doNext===!0)return setTimeout(function(){r.next()},0),void o.trigger("wse.interpreter.next.after.donext",this,!1);this.stopped=!0,o.trigger("wse.interpreter.next.after.nonext",this,!1)}},m.prototype.checkIfvar=function(t){var e,n,i,r,s=this.bus;if(e=t.getAttribute("ifvar")||null,n=t.getAttribute("ifvalue"),i=t.getAttribute("ifnot"),null!==e||null!==n||null!==i){if(r=this.runVars,!(e in r))return o(s,"Unknown variable '"+e+"' used in condition. Ignoring command.",t),s.trigger("wse.interpreter.runcommand.after.condition.error.key",{interpreter:this,command:t},!1),!1;if(null!==i&&""+r[e]==""+i)return s.trigger("wse.interpreter.message","Conidition not met. "+e+"=="+i),s.trigger("wse.interpreter.runcommand.after.condition.false",{interpreter:this,command:t},!1),!1;if(null!==n&&""+r[e]!=""+n)return s.trigger("wse.interpreter.message","Conidition not met."),s.trigger("wse.interpreter.runcommand.after.condition.false",{interpreter:this,command:t},!1),!1;s.trigger("wse.interpreter.runcommand.condition.met",{interpreter:this,command:t},!1),s.trigger("wse.interpreter.message","Conidition met.")}return!0},m.prototype.runCommand=function(t){var e,n,i=this.bus;return this.bus.trigger("wse.interpreter.runcommand.before",{interpreter:this,command:t},!1),e=t.tagName,n=t.getAttribute("asset")||null,this.checkIfvar(t)?e in r.commands?(i.trigger("wse.interpreter.runcommand.after.command",{interpreter:this,command:t},!1),i.trigger("game.commands."+e),r.commands[e](t,this)):null!==n&&n in this.assets&&"function"==typeof this.assets[n][e]&&e.match(/(show|hide|clear|flicker|flash|play|start|stop|pause|move|shake|set|tag)/)?(i.trigger("game.assets."+n+"."+e),this.assets[n][e](t,this)):(o(i,"Unknown element '"+e+"'.",t),i.trigger("wse.interpreter.runcommand.after.error",{interpreter:this,command:t},!1),{doNext:!0}):{doNext:!0}},m.prototype.createTriggers=function(){var t,n,i,r=this.bus,s=this;r.trigger("wse.interpreter.triggers.create",this,!1),this.triggers={};try{t=this.game.ws.getElementsByTagName("triggers")[0].getElementsByTagName("trigger")}catch(u){return void console.log(u)}c(function(t){return n=t.getAttribute("name")||null,null===n?void o(r,"No name specified for trigger.",t):"undefined"!=typeof s.triggers[n]&&null!==s.triggers[n]?void o(r,"A trigger with the name '"+n+"' already exists.",t):(i=new e(t,s),void("function"==typeof i.fn&&(s.triggers[n]=i)))},t)},m.prototype.buildAssets=function(){var t,e=this.bus;e.trigger("wse.assets.loading.started");try{t=this.story.getElementsByTagName("assets")[0].childNodes}catch(n){s(e,"Error while creating assets: "+n.getMessage())}c(function(t){1===t.nodeType&&this.createAsset(t)}.bind(this),t)},m.prototype.createAsset=function(t){var e,i,u=this.bus;return u.trigger("wse.interpreter.createasset",{interpreter:this,asset:t},!1),e=t.getAttribute("name"),i=t.tagName,null===e?void s(u,"Expected attribute 'name'.",t):null===i?void o(u,"Expected attribute 'type' on asset '"+e+"'.",t):("undefined"!=typeof this.assets[e]&&o(u,"Trying to override existing asset '"+e+"'.",t),i=n.firstLetterUppercase(i),i in r.assets?void(this.assets[e]=new r.assets[i](t,this)):void o(u,"Unknown asset type '"+i+"'.",t))},m.prototype.toggleSavegameMenu=function(){function t(t){return function(e){var n;e.stopPropagation(),e.preventDefault();try{n=f.querySelector(".active")||null,null!==n&&n.setAttribute("class",n.getAttribute("class").replace(/active/,""))}catch(i){console.log(i)}t.setAttribute("class",t.getAttribute("class")+" active"),r.focus()}}var e,n,r,s,o,u,a,l,d,f,m,g,y,b;if(o=this,d="WSESaveGameMenu_"+this.game.url,g=this.game.listenersSubscribed,e=document.getElementById(d)||null,null!==e){try{g=h(e.getAttribute("data-wse-listener-status")),this.stage.removeChild(e)}catch(v){console.log(v)}return g===!0&&(this.savegameMenuVisible=!1),this.state=this.oldStateInSavegameMenu,void(this.waitCounter-=1)}return this.stopped!==!0?void setTimeout(function(){o.toggleSavegameMenu()},20):(b=this.state,this.oldStateInSavegameMenu=b,this.state="pause",this.waitCounter+=1,this.savegameMenuVisible=!0,e=document.createElement("div"),e.innerHTML="",e.setAttribute("id",d),e.setAttribute("class","WSESavegameMenu"),e.setAttribute("data-wse-remove","true"),e.setAttribute("data-wse-listener-status",g),e.style.zIndex=1e5,e.style.position="absolute",u=p.getSavegameList(this,!0),n=document.createElement("input"),n.setAttribute("class","button delete"),n.setAttribute("type","button"),n.value="Delete",n.addEventListener("click",function(t){function n(t){t!==!1&&(p.remove(o,s),o.toggleSavegameMenu(),o.toggleSavegameMenu())}var r,s;t.stopPropagation(),t.preventDefault(),r=e.querySelector(".active")||null,null!==r&&(s=r.getAttribute("data-wse-savegame-name"),i.confirm(o,{title:"Delete game?",message:"Do you really want to delete savegame '"+s+"'?",callback:n}))},!1),s=document.createElement("input"),s.setAttribute("class","button save"),s.setAttribute("type","button"),s.value="Save",s.addEventListener("click",function(t){var n,r;return t.stopPropagation(),t.preventDefault(),n=e.querySelector(".active")||null,null===n?void i.prompt(o,{title:"New savegame",message:"Please enter a name for the savegame:",callback:function(t){if(null!==t){if(!t)return void i.alert(o,{title:"Error",message:"The savegame name cannot be empty!"});o.toggleSavegameMenu(),o.game.listenersSubscribed=g,p.save(o,t),o.toggleSavegameMenu(),o.game.listenersSubscribed=!1,i.alert(o,{title:"Game saved",message:"Your game has been saved."})}}}):(r=n.getAttribute("data-wse-savegame-name"),void i.confirm(o,{title:"Overwrite savegame?",message:"You are about to overwrite an old savegame. Are you sure?",trueText:"Yes",falseText:"No",callback:function(t){t!==!1&&(o.toggleSavegameMenu(),p.save(o,r),o.toggleSavegameMenu(),i.alert(o,{title:"Game saved",message:"Your game has been saved."}))}}))},!1),r=document.createElement("input"),r.setAttribute("class","button load"),r.setAttribute("type","button"),r.setAttribute("tabindex",1),r.value="Load",r.addEventListener("click",function(t){var n,r,s;t.stopPropagation(),t.preventDefault(),n=e.querySelector(".active")||null,null!==n&&(r=n.getAttribute("data-wse-savegame-name"),s=function(t){t!==!1&&(o.stage.removeChild(document.getElementById(d)),o.savegameMenuVisible=!1,o.waitCounter-=1,o.state=b,p.load(o,r))},i.confirm(o,{title:"Load game?",message:"Loading a savegame will discard all unsaved progress. Continue?",callback:s}))},!1),a=document.createElement("div"),a.setAttribute("class","panel"),l=document.createElement("input"),l.setAttribute("class","button resume"),l.setAttribute("type","button"),l.value="Resume",l.addEventListener("click",function(t){t.stopPropagation(),t.preventDefault(),o.stage.removeChild(document.getElementById(d)),o.bus.trigger("wse.interpreter.numberOfFunctionsToWaitFor.decrease",null,!1),o.savegameMenuVisible=!1,o.waitCounter-=1,o.state=b},!1),f=document.createElement("div"),f.setAttribute("class","list"),a.appendChild(r),a.appendChild(s),a.appendChild(n),a.appendChild(l),e.appendChild(a),m=document.createElement("div"),m.setAttribute("class","button"),c(function(e){m=document.createElement("div"),y=e.saveTime-e.startTime,m.setAttribute("class","button"),m.setAttribute("data-wse-savegame-name",e.name),m.innerHTML='

'+e.name+'

'+parseInt(y/60/60,10)+"h "+parseInt(y/60%60,10)+"m "+parseInt(y%60,10)+'s'+new Date(1e3*e.saveTime).toUTCString()+"

",m.addEventListener("click",t(m,e),!1),f.appendChild(m)},u),e.addEventListener("click",function(t){var n;t.stopPropagation(),t.preventDefault(),n=e.querySelector(".active")||null,null!==n&&n.setAttribute("class",n.getAttribute("class").replace(/active/,""))},!1),e.appendChild(f),void this.stage.appendChild(e))},m.prototype._startLoadingScreen=function(){var t=this.story.querySelector("loadingScreen");t&&this._loadingScreen.setTemplate(a(t)),this._loadingScreen.show(this.stage)},m}),using("transform-js::transform","databus").define("WSE.LoadingScreen",function(t,e){function n(){e.inject(this),this._loading=0,this._loaded=0,this._max=0,this._finished=!1,this._template='
{$progress}%Loading...
',this._container=document.createElement("div"),this._container.setAttribute("id","WSELoadingScreen"),this._container.style.zIndex=1e4,this._container.style.width="100%",this._container.style.height="100%"}function i(t,e){for(var n in e)t=r(t,n,e[n]);return t}function r(t,e,n){return(""+t).split("{$"+e+"}").join(""+n)}return n.prototype.setTemplate=function(t){this._template=t},n.prototype.addItem=function(){this._finished||(this._loading+=1,this._max+=1,this.update())},n.prototype.count=function(){return this._max},n.prototype.itemLoaded=function(){this._finished||this._loaded!==this._max&&(this._loading-=1,this._loaded+=1,this._loaded===this._max&&(this._finished=!0,this.trigger("finished")),this.update())},n.prototype.update=function(){var t;this._loaded>this._max&&(this._loaded=this._max),t=parseInt(this._loaded/this._max*100,10),this._max<1&&(t=0),this._container.innerHTML=i(this._template,{all:this._max,remaining:this._max-this._loaded,loaded:this._loaded,progress:t})},n.prototype.show=function(t){this._container.style.display="",t.appendChild(this._container),this.update()},n.prototype.hide=function(){function e(t){i._container.style.opacity=t}function n(){i._container.style.display="none",i._container.parentNode.removeChild(i._container)}var i=this;t(1,0,e,{duration:500,onFinish:n}),this._container.style.display="none"},n}),using("WSE.tools::warn","WSE.tools::replaceVariables").define("WSE.tools.ui",function(t,e){"use strict";var n=13,i=27,r={confirm:function(t,e){var n,i,r,s,o,u,a,c,l,d,f,p,h,m,g;t.waitCounter+=1,e=e||{},n=e.title||"Confirm?",i=e.message||"Do you want to proceed?",r=e.trueText||"Yes",s=e.falseText||"No",o="function"==typeof e.callback?e.callback:function(){},u=e.parent||t.stage,h=e.pause===!0?!0:!1,m=t.state,g=e.doNext===!0?!0:!1,h===!0&&(t.state="pause"),p=document.createElement("div"),p.setAttribute("class","WSEUIContainer"),p.setAttribute("data-wse-remove","true"),a=document.createElement("div"),a.setAttribute("class","WSEUIDialog WSEUIConfirm"),c=document.createElement("div"),c.innerHTML=n,c.setAttribute("class","title"),l=document.createElement("div"),l.innerHTML=i,l.setAttribute("class","message"),d=document.createElement("input"),d.setAttribute("value",r),d.value=r,d.setAttribute("class","true button"),d.setAttribute("type","button"),d.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),u.removeChild(p),t.waitCounter-=1,h===!0&&(t.state=m),o(!0),g===!0&&setTimeout(function(){t.next()},0)}),f=document.createElement("input"),f.setAttribute("value",s),f.value=s,f.setAttribute("class","false button"),f.setAttribute("type","button"),f.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),u.removeChild(p),t.waitCounter-=1,h===!0&&(t.state=m),o(!1),g===!0&&setTimeout(function(){t.next()},0)}),a.appendChild(c),a.appendChild(l),a.appendChild(d),a.appendChild(f),p.appendChild(a),u.appendChild(p),d.focus()},alert:function(t,e){var n,i,r,s,o,u,a,c,l,d,f,p,h;t.waitCounter+=1,e=e||{},n=e.title||"Alert!",i=e.message||"Please take notice of this!",r=e.okText||"OK",s="function"==typeof e.callback?e.callback:function(){},o=e.parent||t.stage,f=e.pause===!0?!0:!1,p=t.state,h=e.doNext===!0?!0:!1,f===!0&&(t.state="pause"),d=document.createElement("div"),d.setAttribute("class","WSEUIContainer"),d.setAttribute("data-wse-remove","true"), -u=document.createElement("div"),u.setAttribute("class","WSEUIDialog WSEUIConfirm"),a=document.createElement("div"),a.innerHTML=n,a.setAttribute("class","title"),c=document.createElement("div"),c.innerHTML=i,c.setAttribute("class","message"),l=document.createElement("input"),l.setAttribute("value",r),l.value=r,l.setAttribute("class","true button"),l.setAttribute("type","button"),l.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),o.removeChild(d),t.waitCounter-=1,f===!0&&(t.state=p),s(!0),h===!0&&setTimeout(function(){t.next()},0)}),u.appendChild(a),u.appendChild(c),u.appendChild(l),d.appendChild(u),o.appendChild(d),l.focus()},prompt:function(t,e){var r,s,o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S;t.waitCounter+=1,e=e||{},r=e.title||"Input required",s=e.message||"Please enter something:",o=e.submitText||"Submit",u=e.cancelText||"Cancel",a="function"==typeof e.callback?e.callback:function(){},c=e.parent||t.stage,b=e.pause===!0?!0:!1,d=t.state,v=e.doNext===!0?!0:!1,w=e.allowEmptyInput,E=e.hideCancelButton,S=e.prefill||"",b===!0&&(t.state="pause"),y=document.createElement("div"),y.setAttribute("class","WSEUIContainer"),y.setAttribute("data-wse-remove","true"),l=document.createElement("div"),l.setAttribute("class","WSEUIDialog WSEUIPrompt"),f=document.createElement("div"),f.innerHTML=r,f.setAttribute("class","title"),p=document.createElement("div"),p.innerHTML=s,p.setAttribute("class","message"),g=document.createElement("input"),g.setAttribute("value",S),g.value=S,g.setAttribute("class","input text"),g.setAttribute("type","text"),g.addEventListener("keyup",function(t){function e(){t.keyCode===n&&h.click()}function r(){return t.keyCode!==i||E?!1:(m.click(),!0)}if(!r())return w?void e():void(g.value?(h.disabled=!1,e()):h.disabled=!0)}),h=document.createElement("input"),h.setAttribute("value",o),h.value=o,h.setAttribute("class","submit button"),h.setAttribute("type","button"),w||S||(h.disabled=!0),h.addEventListener("click",function(e){var n=g.value;(w||n)&&(e.stopPropagation(),e.preventDefault(),c.removeChild(y),t.waitCounter-=1,b===!0&&(t.state=d),a(n),v===!0&&setTimeout(function(){t.next()},0))}),m=document.createElement("input"),m.setAttribute("value",u),m.value=u,m.setAttribute("class","cancel button"),m.setAttribute("type","button"),m.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),c.removeChild(y),t.waitCounter-=1,b===!0&&(t.state=d),a(null),v===!0&&setTimeout(function(){t.next()},0)}),l.appendChild(f),l.appendChild(p),l.appendChild(g),l.appendChild(h),E||l.appendChild(m),y.appendChild(l),c.appendChild(y),g.focus()}};return r.makeInputFn=function(n){return function(i,s){var o,u,a,c,l,d,f,p,h,m;return o=i.getAttribute("title")||"Input required...",u=i.getAttribute("message")||"Your input is required:",c=i.getAttribute("var")||null,p=i.getAttribute("submitText")||"",h=i.getAttribute("cancelText")||"",m=i.getAttribute("prefill")||"",f="no"===e(i.getAttribute("allowEmptyInput")||"",s)?!1:!0,d="yes"===e(i.getAttribute("hideCancelButton")||"",s)?!0:!1,l="false"===e(i.getAttribute("next")||"",s)?!1:!0,null!==c&&(c=e(c,s)),o=e(o,s),u=e(u,s),h=e(h,s),p=e(p,s),m=e(m,s),s.bus.trigger("wse.interpreter.commands."+n,i),null===c?(t(s.bus,"No 'var' attribute defined on "+n+" command. Command ignored.",i),{doNext:!0}):(a=s.runVars,r[n](s,{title:o,message:u,pause:!0,doNext:l,callback:function(t){a[c]=""+t},allowEmptyInput:f,hideCancelButton:d,submitText:p,cancelText:h,prefill:m}),{doNext:!0})}},r}),using("transform-js::transform").define("WSE.tools.reveal",function(t){function e(t,e){return e=e||{},r(t),i(t),n(t,e.speed||50,e.onFinish||null)}function n(e,n,i){function r(){return u||0>=c?!1:(u=!0,a.forEach(function(t){clearTimeout(t)}),[].forEach.call(s,function(t){t.style.opacity="1"}),i(),!0)}var s=e.querySelectorAll(".Char"),o=1e3/(n||40),u=!1,a=[],c=s.length;return i=i||function(){},[].forEach.call(s,function(e,n){var r=setTimeout(function(){function n(t){e.style.opacity=t}function r(){s||(s=!0,c-=1,u||0>=c&&i())}var s=!1,a=10*o;u||(t(0,1,n,{duration:a},r),setTimeout(r,a+2e3))},n*o);a.push(r)}),{cancel:r}}function i(t){var e=t.querySelectorAll(".Char");[].forEach.call(e,function(t){t.style.opacity=0})}function r(t,e){var n=3,i=1;return e=e||0,[].forEach.call(t.childNodes,function(t){var s,o="";t.nodeType===n?([].forEach.call(t.textContent,function(t){o+=''+t+"",e+=1}),s=document.createElement("span"),s.setAttribute("class","CharContainer"),s.innerHTML=o,t.parentNode.replaceChild(s,t)):t.nodeType===i&&(e=r(t,e))}),e}return e}),using("xmugly").define("WSE.tools.compile",function(t){function e(e){return e=t.compile(e,[{identifier:"@",attribute:"asset",value:"_"},{identifier:":",attribute:"duration",value:"_"},{identifier:"+",attribute:"_",value:"yes"},{identifier:"-",attribute:"_",value:"no"},{identifier:"#",attribute:"id",value:"_"},{identifier:"~",attribute:"name",value:"_"}]),e=n(e)}function n(t){return t.replace(/([\s]*)\(\([\s]*([a-zA-Z0-9_-]+):[\s]*((.|[\s])*?)([\s]*)\)\)/g,'$1$3$5')}return{compile:e}}),using("enjoy-core::each","WSE.tools::warn","enjoy-typechecks::isNull","enjoy-typechecks::isUndefined","WSE","WSE.tools::truthy").define("WSE.savegames",function(t,e,n,i,r,s){function o(o,u){var a,d,f,p,h,m,g,y=o.bus;if(g=l(o,u),a=o.datasource,d=a.get(g),y.trigger("wse.interpreter.load.before",{interpreter:o,savegame:d},!1),!d)return e(y,"Could not load savegame '"+g+"'!"),!1;if(d=JSON.parse(d),o.stage.innerHTML=d.screenContents,c(o,d.saves),o.startTime=d.startTime,o.runVars=d.runVars,o.log=d.log,o.visitedScenes=d.visitedScenes,o.index=d.index,o.wait=d.wait,o.waitForTimer=d.waitForTimer,o.currentElement=d.currentElement,o.callStack=d.callStack,o.waitCounter=d.waitCounter,o.state="listen",p=d.sceneId,o.sceneId=p,m=o.story.getElementsByTagName("scene"),o.scenes=m,f=find(function(t){return t.getAttribute("id")===p},o.scenes),!f)return y.trigger("wse.interpreter.error",{message:"Loading savegame '"+g+"' failed: Scene not found!"}),!1;for(h=d.scenePath,o.scenePath=h.slice(),o.currentCommands=f.childNodes;h.length>0;)o.currentCommands=o.currentCommands[h.shift()].childNodes;return function(o){var u,a,c,l;t(function(t){if(!i(t)&&!n(t)&&(a=t.getAttribute("data-wse-type")||"",l=s(t.getAttribute("data-wse-remove")),l===!0&&o.stage.removeChild(t),"choice"===a)){if(u=parseInt(t.getAttribute("data-wse-index"),10)||null,null===u)return void e(o.bus,"No data-wse-index found on element.");c=o.currentCommands[u],"#text"!==c.nodeName&&"#comment"!==c.nodeName&&(o.stage.removeChild(t),r.commands.choice(c,o),o.waitCounter-=1)}},o.stage.getElementsByTagName("*"))}(o),y.trigger("wse.interpreter.load.after",{interpreter:o,savegame:d},!1),!0}function u(t,n){n=n||"no name";var i,r,s,o,u,c,d=t.bus;i={},d.trigger("wse.interpreter.save.before",{interpreter:t,savegame:i},!1),i.saves=a(t),i.startTime=t.startTime,i.saveTime=Math.round(Date.now()/1e3),i.screenContents=t.stage.innerHTML,i.runVars=t.runVars,i.name=n,i.log=t.log,i.visitedScenes=t.visitedScenes,i.gameUrl=t.game.url,i.index=t.index,i.wait=t.wait,i.waitForTimer=t.waitForTimer,i.currentElement=t.currentElement,i.sceneId=t.sceneId,i.scenePath=t.scenePath,i.listenersSubscribed=t.game.listenersSubscribed,i.callStack=t.callStack,i.waitCounter=t.waitCounter,i.pathname=location.pathname,s=l(t,n),r=JSON.stringify(i),u="wse_"+i.pathname+"_"+i.gameUrl+"_savegames_list",o=JSON.parse(t.datasource.get(u)),o=o||[],c=o.indexOf(s),c>=0&&o.splice(c,1),o.push(s);try{t.datasource.set(s,r),t.datasource.set(u,JSON.stringify(o))}catch(f){return e(d,"Savegame could not be created!"),d.trigger("wse.interpreter.save.after.error",{interpreter:t,savegame:i},!1),!1}return d.trigger("wse.interpreter.save.after.success",{interpreter:t,savegame:i}),!0}function a(e){var n={};return t(function(t,e){try{n[e]=t.save()}catch(i){console.error("WSE Internal Error: Asset '"+e+"' does not have a 'save' method!")}},e.assets),n}function c(n,i){t(function(t,r){try{t.restore(i[r])}catch(s){console.error(s),e(n.bus,"Could not restore asset state for asset '"+r+"'!")}},n.assets)}function l(t,e){var n={};return n.name=e,n.id="wse_"+location.pathname+"_"+t.game.url+"_savegame_"+e,t.bus.trigger("wse.interpreter.save.before",{interpreter:t,vars:n},!1),n.id}function d(e,n){var i,r=[],s="wse_"+location.pathname+"_"+e.game.url+"_savegames_list",o=e.datasource.get(s);return null===o?r:(i=JSON.parse(o),r=[],t(function(t){n===!0?r.unshift(JSON.parse(e.datasource.get(t))):r.push(JSON.parse(e.datasource.get(t)))},i),e.bus.trigger("wse.interpreter.getsavegamelist",{interpreter:e,list:r,names:i},!1),r)}function f(t,e){var n,i,r,s,o;return i="wse_"+location.pathname+"_"+t.game.url+"_savegames_list",s=t.datasource.get(i),null===s?!1:(n=JSON.parse(s),o=l(t,e),r=n.indexOf(o),r>=0?(n.splice(r,1),t.datasource.set("wse_"+location.pathname+"_"+t.game.url+"_savegames_list",JSON.stringify(n)),t.datasource.remove(o),!0):!1)}return{save:u,load:o,remove:f,getSavegameList:d}}),using("transform-js::transform","eases","WSE.tools","WSE.tools::warn","WSE.tools::applyAssetUnits","WSE.tools::extractUnit","WSE.tools::calculateValueWithAnchor").define("WSE.DisplayObject",function(t,e,n,i,r,s,o){function u(t,e){this.stage=e.stage,this.bus=e.bus,this.name=t.getAttribute("name"),this.cssid=t.getAttribute("cssid")||"wse_imagepack_"+this.name,this.interpreter=e,this.x=t.getAttribute("x")||0,this.y=t.getAttribute("y")||0,this.z=t.getAttribute("z")||this.z||0,this.xAnchor=t.getAttribute("xAnchor"),this.yAnchor=t.getAttribute("yAnchor"),this.width=t.getAttribute("width")||this.width,this.height=t.getAttribute("height")||this.height,this._createElement(),r(this,t)}return u.prototype.onLoad=function(){this._calculateBoxSize(),this._moveToPosition()},u.prototype.flash=function(r,s){var o,u,a,c,l,d,f=n.getParsedAttribute;return s=s||{},o=this,u=+f(r,"duration",this.interpreter,500),l=+f(r,"opacity",this.interpreter,1),(a=s.element||document.getElementById(this.cssid))?(c=s.animation===!0?!0:!1,d=+a.style.opacity.replace(/[^0-9\.]/,"")>0?!0:!1,c||(o.interpreter.waitCounter+=1),t(d?l:0,d?0:l,function(t){a.style.opacity=t},{duration:u/3,easing:e.cubicIn},function(){function n(t){a.style.opacity=t}function i(){c||(o.interpreter.waitCounter-=1)}var r;r={duration:u/3*2,easing:e.cubicOut},t(d?0:l,d?l:0,n,r,i)}),{doNext:!0}):void i(this.bus,"DOM Element for asset is missing!",r)},u.prototype.flicker=function(n,r){var s,o,u,a,c,l,d,f,p,h,m,g,y;return r=r||{},s=this,o=n.getAttribute("duration")||500,u=n.getAttribute("times")||10,p=n.getAttribute("opacity")||1,c=r.element||document.getElementById(this.cssid),a=o/u,f=0,c?(parseInt(c.style.opacity,10)?(m=0,h=p,y=a/3,g=2*y):(h=0,m=p,g=a/3,y=2*g),l=r.animation===!0?!0:!1,l||(s.interpreter.waitCounter+=1),d=function(){f+=1,t(h,m,function(t){c.style.opacity=t},{duration:g,easing:e.quadIn},function(){t(m,h,function(t){c.style.opacity=t},{duration:y,easing:e.quadIn},function(){return u>=f?void setTimeout(d,0):void(l||(s.interpreter.waitCounter-=1))})})},d(),{doNext:!0}):void i(this.bus,"DOM Element for asset is missing!",n)},u.prototype.hide=function(i,r){var s,o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S=n.getParsedAttribute;if(r=r||{},s=this,o=S(i,"duration",this.interpreter,500),u=S(i,"effect",this.interpreter,"fade"),a=S(i,"direction",this.interpreter,"left"),m=r.animation===!0?!0:!1,g=document.getElementById(this.cssid),y=S(i,"easing",this.interpreter,"sineEaseOut"),b=e[y]?e[y]:e.sineOut,v=this.stage,w=this.xUnit||"px",E=this.yUnit||"px","slide"===u){switch(g.style.opacity=1,"%"===w?(d=g.offsetLeft/(v.offsetWidth/100),c=100):(d=g.offsetLeft,c=v.offsetWidth),"%"===E?(f=g.offsetTop/(v.offsetHeight/100),l=100):(f=g.offsetTop,l=v.offsetHeight),a){case"left":p=d-c,h="left";break;case"right":p=d+c,h="left";break;case"top":p=f-l,h="top";break;case"bottom":p=f+l,h="top";break;default:p=d-c,h="left"}m||(s.interpreter.waitCounter+=1),function(){var e,n,i,r;e=function(t){g.style[h]=t+("left"===h?w:E)},n="left"===h?d:f,i=function(){switch(m||(s.interpreter.waitCounter-=1),g.style.opacity=0,a){case"left":case"right":g.style.left=d+w,h="left";break;case"top":case"bottom":g.style.top=f+E,h="top";break;default:g.style.left=d+w,h="left"}},r={duration:o,easing:b},t(n,p,e,r,i)}()}else m||(s.interpreter.waitCounter+=1),function(){var e,n,i;e=function(t){g.style.opacity=t},i=function(){m||(s.interpreter.waitCounter-=1),g.style.opacity=0},n={duration:o,easing:b},t(1,0,e,n,i)}();return{doNext:!0}},u.prototype.move=function(r,s){var o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S,_,A,x=this.interpreter;return s=s||{},l=this,c=document.getElementById(this.cssid),o=r.getAttribute("x"),u=r.getAttribute("y"),a=r.getAttribute("z"),w=r.getAttribute("xAnchor")||"0",E=r.getAttribute("yAnchor")||"0",null===w&&null!==this.xAnchor&&(w=this.xAnchor),null===E&&null!==this.yAnchor&&(E=this.yAnchor),o=n.replaceVariables(o,this.interpreter),u=n.replaceVariables(u,this.interpreter),a=n.replaceVariables(a,this.interpreter),w=n.replaceVariables(w,this.interpreter),E=n.replaceVariables(E,this.interpreter),p=n.getParsedAttribute(r,"duration",x,500),h=n.getParsedAttribute(r,"easing",x,"sineEaseOut"),m=e[h]?e[h]:e.sineOut,g=s.animation===!0?!0:!1,v=this.interpreter.stage,S=c.offsetLeft,_=c.offsetTop,null!==o&&(d=n.extractUnit(o)||"px",o=parseInt(o,10)),null!==u&&(f=n.extractUnit(u)||"px",u=parseInt(u,10)),A=c.style.display,c.style.display="","%"===d&&(o=v.offsetWidth/100*o,d="px"),"%"===f&&(u=v.offsetHeight/100*u,f="px"),o=n.calculateValueWithAnchor(o,w,c.offsetWidth),u=n.calculateValueWithAnchor(u,E,c.offsetHeight),c.style.display=A,null===o&&null===u&&null===a&&i(this.bus,"Can't apply command 'move' to asset '"+this.name+"' because no x, y or z position has been supplied.",r),null!==o&&(y="%"===d?S/(v.offsetWidth/100):S,g||(l.interpreter.waitCounter+=1),t(y,o,function(t){c.style.left=t+d},{duration:p,easing:m},function(){g||(l.interpreter.waitCounter-=1)})),null!==u&&(b="%"===f?_/(v.offsetHeight/100):_,g||(l.interpreter.waitCounter+=1),t(b,u,function(t){c.style.top=t+f},{duration:p,easing:m},function(){g||(l.interpreter.waitCounter-=1)})),null!==a&&(g||(l.interpreter.waitCounter+=1),t(c.style.zIndex||0,parseInt(a,10),function(t){c.style.zIndex=t},{duration:p,easing:m},function(){g||(l.interpreter.waitCounter-=1)})),this.bus.trigger("wse.assets.mixins.move",this),{doNext:!0}},u.prototype.shake=function(e){function i(t,e){for(var n=e/d;n>2;)n-=2;return n>1&&(n=2-n),n}var r,s,o,u,a,c,l,d,f,p,h;return u=this,o=document.getElementById(this.cssid),r=e.getAttribute("dx"),s=e.getAttribute("dy"),d=e.getAttribute("period")||50,l=e.getAttribute("duration")||275,h=this.interpreter.stage,null===r&&null===s&&(s="-10px"),null!==r&&(a=n.extractUnit(r),r=parseInt(r,10)),null!==s&&(c=n.extractUnit(s),s=parseInt(s,10)),null!==r&&(f="%"===a?o.offsetLeft/(h.offsetWidth/100):o.offsetLeft,u.interpreter.waitCounter+=1,t(f-r,f+r,function(t){o.style.left=t+a},{duration:l,easing:i}).then(function(){o.style.left=f+a,u.interpreter.waitCounter-=1})),null!==s&&(p="%"===c?o.offsetTop/(h.offsetHeight/100):o.offsetTop,u.interpreter.waitCounter+=1,t(p-s,p+s,function(t){o.style.top=t+c},{duration:l,easing:i},function(){o.style.top=p+c,u.interpreter.waitCounter-=1})),this.bus.trigger("wse.assets.mixins.shake",this),{doNext:!0}},u.prototype.show=function(r,s){var o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S,_,A=n.getParsedAttribute;if(s=s||{},o=A(r,"duration",this.interpreter,500),u=A(r,"effect",this.interpreter,"fade"),a=A(r,"direction",this.interpreter,"right"),m=s.element||document.getElementById(this.cssid),f=this.xUnit||"px",p=this.yUnit||"px",!m)return void i(this.bus,"DOM Element for asset is missing!",r);if(v=s.interpreter||this.interpreter,h=s.stage||this.stage,b=A(r,"easing",this.interpreter,"sineOut"),y=e[b]?e[b]:e.sineOut,g=s.animation===!0?!0:!1,"slide"===u){switch("%"===f?(c=m.offsetLeft/(h.offsetWidth/100),w=100):(c=m.offsetLeft,w=h.offsetWidth),"%"===p?(l=m.offsetTop/(h.offsetHeight/100),E=100):(l=m.offsetTop,E=h.offsetHeight),a){case"left":m.style.left=c+w+f,d="left";break;case"right":m.style.left=c-w+f,d="left";break;case"top":m.style.top=l+E+p,d="top";break;case"bottom":m.style.top=l-E+p,d="top";break;default:m.style.left=c-w+f,d="left"}m.style.opacity=1,g||(v.waitCounter+=1),S="%"===f?m.offsetLeft/(h.offsetWidth/100):m.offsetLeft,_="%"===p?m.offsetTop/(h.offsetHeight/100):m.offsetTop,t("left"===d?S:_,"left"===d?c:l,function(t){m.style[d]=t+("left"===d?f:p)},{duration:o,easing:y},function(){g||(v.waitCounter-=1)})}else g||(v.waitCounter+=1),t(0,1,function(t){m.style.opacity=t},{duration:o,easing:y},function(){g||(v.waitCounter-=1)});return{doNext:!0}},u.prototype._createElement=function(){this.element=document.createElement(this.elementType||"div"),this.element.style.opacity=0,this.element.draggable=!1,this.element.setAttribute("class","asset"),this.element.setAttribute("id",this.cssid),this.element.setAttribute("data-wse-asset-name",this.name),this.element.style.position="absolute",this.element.style.zIndex=this.z,this.element.style.width=this.width,this.element.style.height=this.height,this.stage.appendChild(this.element)},u.prototype._moveToPosition=function(){var t,e,n,i,r=this.element;t=parseInt(this.x,10),e=parseInt(this.y,10),n=s(this.x)||"px",i=s(this.y)||"px","%"===n&&(t=this.stage.offsetWidth/100*t),"%"===i&&(e=this.stage.offsetHeight/100*e),t=o(t,this.xAnchor,this.boxWidth||this.element.offsetWidth),e=o(e,this.yAnchor,this.boxHeight||this.element.offsetHeight),"%"===n&&(t/=this.stage.offsetWidth/100),"%"===i&&(e/=this.stage.offsetHeight/100),r.style.left=""+t+n,r.style.top=""+e+i},u.prototype._calculateBoxSize=function(){var t=0,e=0,n=this.element;Array.isArray(this._boxSizeSelectors)&&(this._boxSizeSelectors.forEach(function(i){[].forEach.call(n.querySelectorAll(i),function(n){n.offsetWidth>t&&(t=n.offsetWidth),n.offsetHeight>e&&(e=n.offsetHeight)})}),this.boxWidth=t,this.boxHeight=e)},u}),using("transform-js::transform","eases","MO5.Animation","MO5.TimerWatcher","WSE.commands","WSE.tools::createTimer","WSE.tools::warn").define("WSE.assets.Animation",function(t,e,n,i,r,s,o){"use strict";function u(u,a){function c(e,n,i,r,s,o){return t(n,i,function(t){e.style[r]=t+s},o)}function l(t,e){var n,i;i=t,n=i.getAttribute("duration"),r["do"](i,a,{animation:!0}),null!==n&&e.addTimer(s(n))}function d(t,n){var r;r=n.length,y=g.length,b.cbs.push(function(){var s,o,u,a,d,f,p,h,m,g,v,w,E;for(E=new i,m=0;y>m;m+=1)if(a=t[m],"undefined"!=typeof a&&null!==a){f=a.getAttribute("asset");try{d=document.getElementById(b.assets[f].cssid)||b.stage}catch(S){continue}g=a.getAttribute("easing"),s=parseInt(a.getAttribute("from"),10),o=parseInt(a.getAttribute("to"),10),u=a.getAttribute("unit")||"",p=a.getAttribute("duration")||500,h=a.getAttribute("property"),v={},v.duration=p,null!==g&&"undefined"!=typeof e[g]&&null!==e[g]&&(v.easing=e[g]),E.addTimer(c(d,s,o,h,u,v))}for(w=0;r>w;w+=1)l(n[w],E);return E})}var f,p,h,m,g,y,b,v;if(this.stage=a.stage,this.bus=a.bus,this.asset=u,this.name=u.getAttribute("name"),this.cbs=[],this.assets=a.assets,this.isRunning=!1,b=this,f=this.asset.getElementsByTagName("group"),h=f.length,1>h)return o(this.bus,"Animation asset '"+this.name+"' is empty.",u),{doNext:!0};for(p=0;h>p;p+=1)m=f[p],g=m.getElementsByTagName("transform"),v=m.getElementsByTagName("do"),d(g,v);this.anim=new n,this.cbs.forEach(function(t){this.anim.addStep(t)}.bind(this)),this.bus.trigger("wse.assets.animation.constructor",this),function(){function t(){b.stop()}b.bus.subscribe(t,"wse.interpreter.restart"),b.bus.subscribe(t,"wse.interpreter.end"),b.bus.subscribe(t,"wse.interpreter.load.before")}()}return u.prototype.start=function(){this.anim.start(),this.isRunning=!0,this.bus.trigger("wse.assets.animation.started",this)},u.prototype.stop=function(){this.anim.isRunning()&&this.anim.stop(),this.isRunning=!1,this.bus.trigger("wse.assets.animation.stopped",this)},u.prototype.save=function(){var t={assetType:"Animation",isRunning:this.isRunning,index:this.anim.index};return this.bus.trigger("wse.assets.animation.save",{subject:this,saves:t}),t},u.prototype.restore=function(t){this.isRunning=t.isRunning,this.isRunning===!0&&(this.anim.index=t.index,this.start()),this.bus.trigger("wse.assets.animation.restore",{subject:this,saves:t})},u}),using("WSE.tools::warn","howler::Howl","WSE.tools::truthy").define("WSE.assets.Audio",function(t,e,n){"use strict";function i(i,r){var s,o,u,a,c,l,d,f,p,h,m,g,y,b,v;if(b=r.bus,this.interpreter=r,this.bus=b,this.name=i.getAttribute("name"),this.tracks={},this.autopause=n(i.getAttribute("autopause")),this.loop=n(i.getAttribute("loop")),this.fade=n(i.getAttribute("fade")),this.fadeinDuration=parseInt(i.getAttribute("fadein"))||1e3,this.fadeoutDuration=parseInt(i.getAttribute("fadeout"))||1e3,this._playing=!1,y=i.getElementsByTagName("track"),u=y.length,1>u)return t(this.bus,"No tracks defined for audio element '"+this.name+"'.",i),{doNext:!0};for(o=0;u>o;o+=1)if(l=y[o],f=l.getAttribute("title"),null!==f)if(s=l.getElementsByTagName("source"),c=s.length,1>c)t(this.bus,"No sources defined for track '"+f+"' in audio element '"+this.name+"'.",i);else{for(v={urls:[],autoplay:!1,loop:this.loop||!1,onload:this.bus.trigger.bind(this.bus,"wse.assets.loading.decrease")},p={},a=0;c>a;a+=1)g=s[a],h=g.getAttribute("href"),m=g.getAttribute("type"),null!==h?null!==m?(p[m]=h,v.urls.push(h)):t(this.bus,"No type defined for source in track '"+f+"' in audio element '"+this.name+"'.",i):t(this.bus,"No href defined for source in track '"+f+"' in audio element '"+this.name+"'.",i);this.bus.trigger("wse.assets.loading.increase"),d=new e(v),this.tracks[f]=d}else t(this.bus,"No title defined for track '"+f+"' in audio element '"+this.name+"'.",i);this.play=function(t){var e;return this._playing?{doNext:!0}:(this._playing=!0,this._paused=!1,t.getAttribute("fadein")?(this.interpreter.waitCounter+=1,e=+t.getAttribute("fadein"),this.tracks[this._currentTrack].volume(0),this.tracks[this._currentTrack].play(),this.tracks[this._currentTrack].fade(0,1,e,function(){this.interpreter.waitCounter-=1}.bind(this))):this.tracks[this._currentTrack].play(),{doNext:!0})},this.stop=function(t){var e;return this._currentTrack?(this._playing=!1,this._paused=!1,t&&t.getAttribute("fadeout")?(this.interpreter.waitCounter+=1,e=+t.getAttribute("fadeout"),this.tracks[this._currentTrack].fade(1,0,e,function(){this.tracks[this._currentTrack].stop(),this.interpreter.waitCounter-=1}.bind(this))):this.tracks[this._currentTrack].stop(),this.bus.trigger("wse.assets.audio.stop",this),{doNext:!0}):{doNext:!0}},this.pause=function(){return this._currentTrack&&this._playing?(this._paused=!0,this.tracks[this._currentTrack].pause(),{doNext:!0}):{doNext:!0}},this.bus.trigger("wse.assets.audio.constructor",this),this.bus.subscribe("wse.interpreter.restart",function(){this.stop()}.bind(this)),window.addEventListener("blur",function(){this._playing&&this.tracks[this._currentTrack].fade(1,0,200)}.bind(this)),window.addEventListener("focus",function(){this._playing&&this.tracks[this._currentTrack].fade(0,1,200)}.bind(this))}return i.prototype.set=function(t){var e=!1;return this._playing&&(e=!0),this.stop(),this._currentTrack=t.getAttribute("track"),e&&this.play(t),{doNext:!0}},i.prototype.save=function(){var t={currentTrack:this._currentTrack,playing:this._playing,paused:this._paused};return this.bus.trigger("wse.assets.audio.save",this),t},i.prototype.restore=function(t){var e;this._playing=t.playing,this._paused=t.paused,this._currentTrack=t.currentTrack;for(e in this.tracks)this.tracks[e].stop();this._playing&&!this._paused&&this.tracks[this._currentTrack].play(),this.bus.trigger("wse.assets.audio.restore",this)},i}),using().define("WSE.assets.Character",function(){"use strict";function t(t,e){this.asset=t,this.stage=e.stage,this.bus=e.bus,this.name=t.getAttribute("name"),this.bus.trigger("wse.assets.character.constructor",this)}return t.prototype.setTextbox=function(t){this.asset.setAttribute("textbox",t.getAttribute("textbox")),this.bus.trigger("wse.assets.character.settextbox",this)},t.prototype.save=function(){var t={assetType:"Character",textboxName:this.asset.getAttribute("textbox")};return this.bus.trigger("wse.assets.character.save",{subject:this,saves:t}),t},t.prototype.restore=function(t){this.asset.setAttribute("textbox",t.textboxName),this.bus.trigger("wse.assets.character.restore",{subject:this,saves:t})},t}),using("WSE.DisplayObject","WSE.tools::warn").define("WSE.assets.Curtain",function(t,e){"use strict";function n(e){t.apply(this,arguments),this.asset=e,this.color=e.getAttribute("color")||"black",this.z=e.getAttribute("z")||2e4,this.cssid=this.cssid||"WSECurtain_"+this.id,this.element.setAttribute("class","asset WSECurtain"),this.element.style.left=0,this.element.style.top=0,this.element.style.width=this.stage.offsetWidth+"px",this.element.style.height=this.stage.offsetHeight+"px",this.element.style.opacity=0,this.element.style.backgroundColor=this.color}return n.prototype=Object.create(t.prototype),n.prototype.set=function(t){this.color=t.getAttribute("color")||"black",this.element.style.backgroundColor=this.color},n.prototype.save=function(){return{color:this.color,cssid:this.cssid,z:this.z}},n.prototype.restore=function(t){this.color=t.color,this.cssid=t.cssid,this.z=t.z;try{this.element=document.getElementById(this.cssid)}catch(n){return void e(this.bus,"Element with CSS ID '"+this.cssid+"' could not be found.")}this.element.style.backgroundColor=this.color,this.element.style.zIndex=this.z},n}),using("transform-js::transform","eases","WSE.DisplayObject","WSE.tools::applyAssetUnits","WSE.tools::extractUnit","WSE.tools::calculateValueWithAnchor","WSE.tools::warn").define("WSE.assets.Imagepack",function(t,e,n,i,r,s,o){"use strict";function u(t){var e,i,r,s,u,a,c,l,d,f,p,h;for(this._boxSizeSelectors=["img"],n.apply(this,arguments),this.cssid=this.cssid||"wse_imagepack_"+this.name,d=this,e={},p=t.getAttribute("width"),h=t.getAttribute("height"),this.element.setAttribute("class","asset imagepack"),i=t.getElementsByTagName("image"),f=d.bus.trigger.bind(d.bus,"wse.assets.loading.decrease",null,!1),r=0,s=i.length;s>r;r+=1)u=i[r],a=u.getAttribute("name"),c=u.getAttribute("src"),null!==a?null!==c?(l=new Image,this.bus.trigger("wse.assets.loading.increase",null,!1),l.addEventListener("load",f),l.src=c,l.style.opacity=0,l.style.position="absolute",l.draggable=!1,l.setAttribute("data-wse-asset-image-name",a),null!==p&&l.setAttribute("width",p),null!==h&&l.setAttribute("height",h),e[a]=this.cssid+"_"+a,l.setAttribute("id",e[a]),this.element.appendChild(l)):o(this.bus,"Image without src in imagepack '"+this.name+"'.",t):o(this.bus,"Image without name in imagepack '"+this.name+"'.",t);this.images=e,this.current=null}return u.prototype=Object.create(n.prototype),u.prototype.set=function(n,i){var r,s,u,a,c,l,d,f=this.bus;if(i=i||{},u=this,s=n.getAttribute("image"),c=n.getAttribute("duration")||400,l=i.animation===!0?!0:!1,null===s)return o(f,"Missing attribute 'image' on 'do' element referencing imagepack '"+this.name+"'.",n),{doNext:!0};try{r=document.getElementById(this.images[s])}catch(p){console.error("DOM Element for Image "+s+" on Imagepack "+this.name+" not found!",p)}if("undefined"==typeof r||null===r)return o(f,"Unknown image name on 'do' element referencing imagepack '"+this.name+"'.",n),{doNext:!0};a=this.current;for(var h in this.images)if(this.images.hasOwnProperty(h)){if(h!==s)continue;if(h===a)return o(f,"Trying to set the image that is already set on imagepack '"+this.name+"'.",n),{doNext:!0}}return l||(u.interpreter.waitCounter+=1),d=document.getElementById(this.cssid),d.style.width=r.offsetWidth+"px",d.style.height=r.offsetHeight+"px",function(){var n,i,s;n=function(t){r.style.opacity=t},i=function(){l||(u.interpreter.waitCounter-=1)},s={duration:c,easing:e.cubicOut},t(0,1,n,s,i)}(),null!==this.current&&(l||(u.interpreter.waitCounter+=1),function(){var n;(n=function(){var n,i,r,s;n=document.getElementById(u.images[a]),i=function(t){n.style.opacity=t},r=function(){l||(u.interpreter.waitCounter-=1)},s={duration:c,easing:e.cubicIn},t(1,0,i,s,r)})()}()),this.current=s,{doNext:!0}},u.prototype.save=function(){var t,e,n;return e=this.images,t=this.current||null,n={assetType:"Imagepack",current:t,cssid:this.cssid,images:e,xAnchor:this.xAnchor,yAnchor:this.yAnchor,z:this.z},this.bus.trigger("wse.assets.imagepack.save",{subject:this,saves:n}),n},u.prototype.restore=function(t){var e;e=t.current,this.cssid=t.cssid,this.z=t.z,this.current=e,this.xAnchor=t.xAnchor,this.yAnchor=t.yAnchor,document.getElementById(this.cssid).style.zIndex=this.z,this.bus.trigger("wse.assets.imagepack.restore",{subject:this,saves:t})},u}),using("transform-js::transform","WSE.tools.reveal","class-manipulator::list","WSE.DisplayObject","WSE.tools::applyAssetUnits","WSE.tools::replaceVariables","WSE.tools::truthy").define("WSE.assets.Textbox",function(t,e,n,i,r,s,o){"use strict";function u(t){this.z=1e3,i.apply(this,arguments);var e,n,r;this.type=t.getAttribute("behaviour")||"adv",this.showNames=o(t.getAttribute("namebox")),this.nltobr=o(t.getAttribute("nltobr")),this.cssid=this.cssid||"wse_textbox_"+this.name,this.effectType=t.getAttribute("effect")||"typewriter",this.speed=t.getAttribute("speed")||0,this.speed=parseInt(this.speed,10),this.fadeDuration=t.getAttribute("fadeDuration")||0,function(e){var n,i,r,s;try{for(s=t.childNodes,i=0,r=s.length;r>i;i+=1)if(1===s[i].nodeType&&"nameTemplate"===s[i].tagName){n=s[i];break}if(!n)throw new Error("No nameTemplate found.");e.nameTemplate=(new XMLSerializer).serializeToString(n)}catch(o){e.nameTemplate="{name}: "}}(this),"nvl"===this.type&&(this.showNames=!1),e=this.element,n=document.createElement("div"),r=document.createElement("div"),e.setAttribute("class","asset textbox"),r.setAttribute("class","text"),n.setAttribute("class","name"),e.appendChild(n),e.appendChild(r),this.showNames===!1&&(n.style.display="none"),n.setAttribute("id",this.cssid+"_name"),r.setAttribute("id",this.cssid+"_text"),this.nameElement=this.cssid+"_name",this.textElement=this.cssid+"_text",e.style.opacity=0,this.bus.trigger("wse.assets.textbox.constructor",this)}return u.prototype=Object.create(i.prototype),u.prototype.put=function(i,r,o){function u(){"adv"===d.type&&(a.innerHTML=""),a.innerHTML+=l+i,c.innerHTML=d.nameTemplate.replace(/\{name\}/g,r)}var a,c,l,d,f,p="wse_no_character";return r=r||null,o=o||"_no_one",d=this,a=document.getElementById(this.textElement),c=document.getElementById(this.nameElement),f=document.getElementById(this.cssid),i=s(i,this.interpreter),d.interpreter.waitCounter+=1,l="",this.showNames===!1&&r&&(l=this.nameTemplate.replace(/\{name\}/g,r)),null===r?(this.showNames&&(c.style.display="none"),r=""):(this.showNames&&(c.style.display=""),p="wse_character_"+o.split(" ").join("_")),this._lastCssClass&&n(f).remove(this._lastCssClass).apply(),this._lastCssClass=p,n(f).add(p).apply(),this.speed<1&&(this.fadeDuration>0?(d.interpreter.waitCounter+=1,function(){var e,n,i;e=function(t){a.style.opacity=t},n=function(){d.interpreter.waitCounter-=1},i={duration:d.fadeDuration},t(1,0,e,i,n)}()):u()),this.speed>0?("adv"===d.type&&(a.innerHTML=""),function(){var t;t=document.createElement("div"),t.setAttribute("class","line"),a.appendChild(t),t.innerHTML=l+i,c.innerHTML=d.nameTemplate.replace(/\{name\}/g,r),d.interpreter.cancelCharAnimation=e(t,{speed:d.speed,onFinish:function(){d.interpreter.cancelCharAnimation=null}}).cancel}()):this.fadeDuration>0&&(d.interpreter.waitCounter+=1,setTimeout(function(){u(),"nvl"===d.type&&(a.innerHTML="
"+a.innerHTML+"
"),t(0,1,function(t){a.style.opacity=t},{duration:d.fadeDuration,onFinish:function(){d.interpreter.waitCounter-=1}})},d.fadeDuration)),this.bus.trigger("wse.assets.textbox.put",this,!1),d.interpreter.waitCounter-=1,{doNext:!1}},u.prototype.clear=function(){return document.getElementById(this.textElement).innerHTML="",document.getElementById(this.nameElement).innerHTML="",this.bus.trigger("wse.assets.textbox.clear",this), +u=document.createElement("div"),u.setAttribute("class","WSEUIDialog WSEUIConfirm"),a=document.createElement("div"),a.innerHTML=n,a.setAttribute("class","title"),c=document.createElement("div"),c.innerHTML=i,c.setAttribute("class","message"),l=document.createElement("input"),l.setAttribute("value",r),l.value=r,l.setAttribute("class","true button"),l.setAttribute("type","button"),l.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),o.removeChild(d),t.waitCounter-=1,f===!0&&(t.state=p),s(!0),h===!0&&setTimeout(function(){t.next()},0)}),u.appendChild(a),u.appendChild(c),u.appendChild(l),d.appendChild(u),o.appendChild(d),l.focus()},prompt:function(t,e){var r,s,o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S;t.waitCounter+=1,e=e||{},r=e.title||"Input required",s=e.message||"Please enter something:",o=e.submitText||"Submit",u=e.cancelText||"Cancel",a="function"==typeof e.callback?e.callback:function(){},c=e.parent||t.stage,b=e.pause===!0?!0:!1,d=t.state,v=e.doNext===!0?!0:!1,w=e.allowEmptyInput,E=e.hideCancelButton,S=e.prefill||"",b===!0&&(t.state="pause"),y=document.createElement("div"),y.setAttribute("class","WSEUIContainer"),y.setAttribute("data-wse-remove","true"),l=document.createElement("div"),l.setAttribute("class","WSEUIDialog WSEUIPrompt"),f=document.createElement("div"),f.innerHTML=r,f.setAttribute("class","title"),p=document.createElement("div"),p.innerHTML=s,p.setAttribute("class","message"),g=document.createElement("input"),g.setAttribute("value",S),g.value=S,g.setAttribute("class","input text"),g.setAttribute("type","text"),g.addEventListener("keyup",function(t){function e(){t.keyCode===n&&h.click()}function r(){return t.keyCode!==i||E?!1:(m.click(),!0)}if(!r())return w?void e():void(g.value?(h.disabled=!1,e()):h.disabled=!0)}),h=document.createElement("input"),h.setAttribute("value",o),h.value=o,h.setAttribute("class","submit button"),h.setAttribute("type","button"),w||S||(h.disabled=!0),h.addEventListener("click",function(e){var n=g.value;(w||n)&&(e.stopPropagation(),e.preventDefault(),c.removeChild(y),t.waitCounter-=1,b===!0&&(t.state=d),a(n),v===!0&&setTimeout(function(){t.next()},0))}),m=document.createElement("input"),m.setAttribute("value",u),m.value=u,m.setAttribute("class","cancel button"),m.setAttribute("type","button"),m.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault(),c.removeChild(y),t.waitCounter-=1,b===!0&&(t.state=d),a(null),v===!0&&setTimeout(function(){t.next()},0)}),l.appendChild(f),l.appendChild(p),l.appendChild(g),l.appendChild(h),E||l.appendChild(m),y.appendChild(l),c.appendChild(y),g.focus()}};return r.makeInputFn=function(n){return function(i,s){var o,u,a,c,l,d,f,p,h,m;return o=i.getAttribute("title")||"Input required...",u=i.getAttribute("message")||"Your input is required:",c=i.getAttribute("var")||null,p=i.getAttribute("submitText")||"",h=i.getAttribute("cancelText")||"",m=i.getAttribute("prefill")||"",f="no"===e(i.getAttribute("allowEmptyInput")||"",s)?!1:!0,d="yes"===e(i.getAttribute("hideCancelButton")||"",s)?!0:!1,l="false"===e(i.getAttribute("next")||"",s)?!1:!0,null!==c&&(c=e(c,s)),o=e(o,s),u=e(u,s),h=e(h,s),p=e(p,s),m=e(m,s),s.bus.trigger("wse.interpreter.commands."+n,i),null===c?(t(s.bus,"No 'var' attribute defined on "+n+" command. Command ignored.",i),{doNext:!0}):(a=s.runVars,r[n](s,{title:o,message:u,pause:!0,doNext:l,callback:function(t){a[c]=""+t},allowEmptyInput:f,hideCancelButton:d,submitText:p,cancelText:h,prefill:m}),{doNext:!0})}},r}),using("transform-js::transform").define("WSE.tools.reveal",function(t){function e(t,e){return e=e||{},r(t),i(t),n(t,e.speed||50,e.onFinish||null)}function n(e,n,i){function r(){return u||0>=c?!1:(u=!0,a.forEach(function(t){clearTimeout(t)}),[].forEach.call(s,function(t){t.style.opacity="1"}),i(),!0)}var s=e.querySelectorAll(".Char"),o=1e3/(n||40),u=!1,a=[],c=s.length;return i=i||function(){},[].forEach.call(s,function(e,n){var r=setTimeout(function(){function n(t){e.style.opacity=t}function r(){s||(s=!0,c-=1,u||0>=c&&i())}var s=!1,a=10*o;u||(t(0,1,n,{duration:a},r),setTimeout(r,a+2e3))},n*o);a.push(r)}),{cancel:r}}function i(t){var e=t.querySelectorAll(".Char");[].forEach.call(e,function(t){t.style.opacity=0})}function r(t,e){var n=3,i=1;return e=e||0,[].forEach.call(t.childNodes,function(t){var s,o="";t.nodeType===n?([].forEach.call(t.textContent,function(t){o+=''+t+"",e+=1}),s=document.createElement("span"),s.setAttribute("class","CharContainer"),s.innerHTML=o,t.parentNode.replaceChild(s,t)):t.nodeType===i&&(e=r(t,e))}),e}return e}),using("xmugly").define("WSE.tools.compile",function(t){function e(e){return e=t.compile(e,[{identifier:"@",attribute:"asset",value:"_"},{identifier:":",attribute:"duration",value:"_"},{identifier:"+",attribute:"_",value:"yes"},{identifier:"-",attribute:"_",value:"no"},{identifier:"#",attribute:"id",value:"_"},{identifier:"~",attribute:"name",value:"_"}]),e=n(e)}function n(t){return t.replace(/([\s]*)\(\([\s]*([a-zA-Z0-9_-]+):[\s]*((.|[\s])*?)([\s]*)\)\)/g,'$1$3$5')}return{compile:e}}),using("enjoy-core::each","WSE.tools::warn","enjoy-typechecks::isNull","enjoy-typechecks::isUndefined","WSE","WSE.tools::truthy").define("WSE.savegames",function(t,e,n,i,r,s){function o(o,u){var a,d,f,p,h,m,g,y=o.bus;if(g=l(o,u),a=o.datasource,d=a.get(g),y.trigger("wse.interpreter.load.before",{interpreter:o,savegame:d},!1),!d)return e(y,"Could not load savegame '"+g+"'!"),!1;if(d=JSON.parse(d),o.stage.innerHTML=d.screenContents,c(o,d.saves),o.startTime=d.startTime,o.runVars=d.runVars,o.log=d.log,o.visitedScenes=d.visitedScenes,o.index=d.index,o.wait=d.wait,o.waitForTimer=d.waitForTimer,o.currentElement=d.currentElement,o.callStack=d.callStack,o.waitCounter=d.waitCounter,o.state="listen",p=d.sceneId,o.sceneId=p,m=o.story.getElementsByTagName("scene"),o.scenes=m,f=find(function(t){return t.getAttribute("id")===p},o.scenes),!f)return y.trigger("wse.interpreter.error",{message:"Loading savegame '"+g+"' failed: Scene not found!"}),!1;for(h=d.scenePath,o.scenePath=h.slice(),o.currentCommands=f.childNodes;h.length>0;)o.currentCommands=o.currentCommands[h.shift()].childNodes;return function(o){var u,a,c,l;t(function(t){if(!i(t)&&!n(t)&&(a=t.getAttribute("data-wse-type")||"",l=s(t.getAttribute("data-wse-remove")),l===!0&&o.stage.removeChild(t),"choice"===a)){if(u=parseInt(t.getAttribute("data-wse-index"),10)||null,null===u)return void e(o.bus,"No data-wse-index found on element.");c=o.currentCommands[u],"#text"!==c.nodeName&&"#comment"!==c.nodeName&&(o.stage.removeChild(t),r.commands.choice(c,o),o.waitCounter-=1)}},o.stage.getElementsByTagName("*"))}(o),y.trigger("wse.interpreter.load.after",{interpreter:o,savegame:d},!1),!0}function u(t,n){n=n||"no name";var i,r,s,o,u,c,d=t.bus;i={},d.trigger("wse.interpreter.save.before",{interpreter:t,savegame:i},!1),i.saves=a(t),i.startTime=t.startTime,i.saveTime=Math.round(Date.now()/1e3),i.screenContents=t.stage.innerHTML,i.runVars=t.runVars,i.name=n,i.log=t.log,i.visitedScenes=t.visitedScenes,i.gameUrl=t.game.url,i.index=t.index,i.wait=t.wait,i.waitForTimer=t.waitForTimer,i.currentElement=t.currentElement,i.sceneId=t.sceneId,i.scenePath=t.scenePath,i.listenersSubscribed=t.game.listenersSubscribed,i.callStack=t.callStack,i.waitCounter=t.waitCounter,i.pathname=location.pathname,s=l(t,n),r=JSON.stringify(i),u="wse_"+i.pathname+"_"+i.gameUrl+"_savegames_list",o=JSON.parse(t.datasource.get(u)),o=o||[],c=o.indexOf(s),c>=0&&o.splice(c,1),o.push(s);try{t.datasource.set(s,r),t.datasource.set(u,JSON.stringify(o))}catch(f){return e(d,"Savegame could not be created!"),d.trigger("wse.interpreter.save.after.error",{interpreter:t,savegame:i},!1),!1}return d.trigger("wse.interpreter.save.after.success",{interpreter:t,savegame:i}),!0}function a(e){var n={};return t(function(t,e){try{n[e]=t.save()}catch(i){console.error("WSE Internal Error: Asset '"+e+"' does not have a 'save' method!")}},e.assets),n}function c(n,i){t(function(t,r){try{t.restore(i[r])}catch(s){console.error(s),e(n.bus,"Could not restore asset state for asset '"+r+"'!")}},n.assets)}function l(t,e){var n={};return n.name=e,n.id="wse_"+location.pathname+"_"+t.game.url+"_savegame_"+e,t.bus.trigger("wse.interpreter.save.before",{interpreter:t,vars:n},!1),n.id}function d(e,n){var i,r=[],s="wse_"+location.pathname+"_"+e.game.url+"_savegames_list",o=e.datasource.get(s);return null===o?r:(i=JSON.parse(o),r=[],t(function(t){n===!0?r.unshift(JSON.parse(e.datasource.get(t))):r.push(JSON.parse(e.datasource.get(t)))},i),e.bus.trigger("wse.interpreter.getsavegamelist",{interpreter:e,list:r,names:i},!1),r)}function f(t,e){var n,i,r,s,o;return i="wse_"+location.pathname+"_"+t.game.url+"_savegames_list",s=t.datasource.get(i),null===s?!1:(n=JSON.parse(s),o=l(t,e),r=n.indexOf(o),r>=0?(n.splice(r,1),t.datasource.set("wse_"+location.pathname+"_"+t.game.url+"_savegames_list",JSON.stringify(n)),t.datasource.remove(o),!0):!1)}return{save:u,load:o,remove:f,getSavegameList:d}}),using("transform-js::transform","eases","WSE.tools","WSE.tools::warn","WSE.tools::applyAssetUnits","WSE.tools::extractUnit","WSE.tools::calculateValueWithAnchor").define("WSE.DisplayObject",function(t,e,n,i,r,s,o){function u(t,e){this.stage=e.stage,this.bus=e.bus,this.name=t.getAttribute("name"),this.cssid=t.getAttribute("cssid")||"wse_imagepack_"+this.name,this.interpreter=e,this.x=t.getAttribute("x")||0,this.y=t.getAttribute("y")||0,this.z=t.getAttribute("z")||this.z||0,this.xAnchor=t.getAttribute("xAnchor"),this.yAnchor=t.getAttribute("yAnchor"),this.width=t.getAttribute("width")||this.width,this.height=t.getAttribute("height")||this.height,this._createElement(),r(this,t)}return u.prototype.onLoad=function(){this._calculateBoxSize(),this._moveToPosition()},u.prototype.flash=function(r,s){var o,u,a,c,l,d,f=n.getParsedAttribute;return s=s||{},o=this,u=+f(r,"duration",this.interpreter,500),l=+f(r,"opacity",this.interpreter,1),(a=s.element||document.getElementById(this.cssid))?(c=s.animation===!0?!0:!1,d=+a.style.opacity.replace(/[^0-9\.]/,"")>0?!0:!1,c||(o.interpreter.waitCounter+=1),t(d?l:0,d?0:l,function(t){a.style.opacity=t},{duration:u/3,easing:e.cubicIn},function(){function n(t){a.style.opacity=t}function i(){c||(o.interpreter.waitCounter-=1)}var r;r={duration:u/3*2,easing:e.cubicOut},t(d?0:l,d?l:0,n,r,i)}),{doNext:!0}):void i(this.bus,"DOM Element for asset is missing!",r)},u.prototype.flicker=function(n,r){var s,o,u,a,c,l,d,f,p,h,m,g,y;return r=r||{},s=this,o=n.getAttribute("duration")||500,u=n.getAttribute("times")||10,p=n.getAttribute("opacity")||1,c=r.element||document.getElementById(this.cssid),a=o/u,f=0,c?(parseInt(c.style.opacity,10)?(m=0,h=p,y=a/3,g=2*y):(h=0,m=p,g=a/3,y=2*g),l=r.animation===!0?!0:!1,l||(s.interpreter.waitCounter+=1),d=function(){f+=1,t(h,m,function(t){c.style.opacity=t},{duration:g,easing:e.quadIn},function(){t(m,h,function(t){c.style.opacity=t},{duration:y,easing:e.quadIn},function(){return u>=f?void setTimeout(d,0):void(l||(s.interpreter.waitCounter-=1))})})},d(),{doNext:!0}):void i(this.bus,"DOM Element for asset is missing!",n)},u.prototype.hide=function(i,r){var s,o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S=n.getParsedAttribute;if(r=r||{},s=this,o=S(i,"duration",this.interpreter,500),u=S(i,"effect",this.interpreter,"fade"),a=S(i,"direction",this.interpreter,"left"),m=r.animation===!0?!0:!1,g=document.getElementById(this.cssid),y=S(i,"easing",this.interpreter,"sineEaseOut"),b=e[y]?e[y]:e.sineOut,v=this.stage,w=this.xUnit||"px",E=this.yUnit||"px","slide"===u){switch(g.style.opacity=1,"%"===w?(d=g.offsetLeft/(v.offsetWidth/100),c=100):(d=g.offsetLeft,c=v.offsetWidth),"%"===E?(f=g.offsetTop/(v.offsetHeight/100),l=100):(f=g.offsetTop,l=v.offsetHeight),a){case"left":p=d-c,h="left";break;case"right":p=d+c,h="left";break;case"top":p=f-l,h="top";break;case"bottom":p=f+l,h="top";break;default:p=d-c,h="left"}m||(s.interpreter.waitCounter+=1),function(){var e,n,i,r;e=function(t){g.style[h]=t+("left"===h?w:E)},n="left"===h?d:f,i=function(){switch(m||(s.interpreter.waitCounter-=1),g.style.opacity=0,a){case"left":case"right":g.style.left=d+w,h="left";break;case"top":case"bottom":g.style.top=f+E,h="top";break;default:g.style.left=d+w,h="left"}},r={duration:o,easing:b},t(n,p,e,r,i)}()}else m||(s.interpreter.waitCounter+=1),function(){var e,n,i;e=function(t){g.style.opacity=t},i=function(){m||(s.interpreter.waitCounter-=1),g.style.opacity=0},n={duration:o,easing:b},t(1,0,e,n,i)}();return{doNext:!0}},u.prototype.move=function(r,s){var o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S,_,A,x=this.interpreter;return s=s||{},l=this,c=document.getElementById(this.cssid),o=r.getAttribute("x"),u=r.getAttribute("y"),a=r.getAttribute("z"),w=r.getAttribute("xAnchor")||"0",E=r.getAttribute("yAnchor")||"0",null===w&&null!==this.xAnchor&&(w=this.xAnchor),null===E&&null!==this.yAnchor&&(E=this.yAnchor),o=n.replaceVariables(o,this.interpreter),u=n.replaceVariables(u,this.interpreter),a=n.replaceVariables(a,this.interpreter),w=n.replaceVariables(w,this.interpreter),E=n.replaceVariables(E,this.interpreter),p=n.getParsedAttribute(r,"duration",x,500),h=n.getParsedAttribute(r,"easing",x,"sineEaseOut"),m=e[h]?e[h]:e.sineOut,g=s.animation===!0?!0:!1,v=this.interpreter.stage,S=c.offsetLeft,_=c.offsetTop,null!==o&&(d=n.extractUnit(o)||"px",o=parseInt(o,10)),null!==u&&(f=n.extractUnit(u)||"px",u=parseInt(u,10)),A=c.style.display,c.style.display="","%"===d&&(o=v.offsetWidth/100*o,d="px"),"%"===f&&(u=v.offsetHeight/100*u,f="px"),o=n.calculateValueWithAnchor(o,w,c.offsetWidth),u=n.calculateValueWithAnchor(u,E,c.offsetHeight),c.style.display=A,null===o&&null===u&&null===a&&i(this.bus,"Can't apply command 'move' to asset '"+this.name+"' because no x, y or z position has been supplied.",r),null!==o&&(y="%"===d?S/(v.offsetWidth/100):S,g||(l.interpreter.waitCounter+=1),t(y,o,function(t){c.style.left=t+d},{duration:p,easing:m},function(){g||(l.interpreter.waitCounter-=1)})),null!==u&&(b="%"===f?_/(v.offsetHeight/100):_,g||(l.interpreter.waitCounter+=1),t(b,u,function(t){c.style.top=t+f},{duration:p,easing:m},function(){g||(l.interpreter.waitCounter-=1)})),null!==a&&(g||(l.interpreter.waitCounter+=1),t(c.style.zIndex||0,parseInt(a,10),function(t){c.style.zIndex=t},{duration:p,easing:m},function(){g||(l.interpreter.waitCounter-=1)})),this.bus.trigger("wse.assets.mixins.move",this),{doNext:!0}},u.prototype.shake=function(e){function i(t){return function(e){return t*Math.sin(e*(2*d)*Math.PI)}}var r,s,o,u,a,c,l,d,f,p,h;return u=this,o=document.getElementById(this.cssid),r=e.getAttribute("dx"),s=e.getAttribute("dy"),d=e.getAttribute("times")||2,l=e.getAttribute("duration")||275,h=this.interpreter.stage,null===r&&null===s&&(s="-10px"),null!==r&&(a=n.extractUnit(r),r=parseInt(r,10)),null!==s&&(c=n.extractUnit(s),s=parseInt(s,10)),null!==r&&(f="%"===a?o.offsetLeft/(h.offsetWidth/100):o.offsetLeft,u.interpreter.waitCounter+=1,t(0,1,function(t){o.style.left=t+a},{duration:l,easing:i(r)},function(){o.style.left=f+a,u.interpreter.waitCounter-=1})),null!==s&&(p="%"===c?o.offsetTop/(h.offsetHeight/100):o.offsetTop,u.interpreter.waitCounter+=1,t(0,1,function(t){o.style.top=t+c},{duration:l,easing:i(s)},function(){o.style.top=p+c,u.interpreter.waitCounter-=1})),this.bus.trigger("wse.assets.mixins.shake",this),{doNext:!0}},u.prototype.show=function(r,s){var o,u,a,c,l,d,f,p,h,m,g,y,b,v,w,E,S,_,A=n.getParsedAttribute;if(s=s||{},o=A(r,"duration",this.interpreter,500),u=A(r,"effect",this.interpreter,"fade"),a=A(r,"direction",this.interpreter,"right"),m=s.element||document.getElementById(this.cssid),f=this.xUnit||"px",p=this.yUnit||"px",!m)return void i(this.bus,"DOM Element for asset is missing!",r);if(v=s.interpreter||this.interpreter,h=s.stage||this.stage,b=A(r,"easing",this.interpreter,"sineOut"),y=e[b]?e[b]:e.sineOut,g=s.animation===!0?!0:!1,"slide"===u){switch("%"===f?(c=m.offsetLeft/(h.offsetWidth/100),w=100):(c=m.offsetLeft,w=h.offsetWidth),"%"===p?(l=m.offsetTop/(h.offsetHeight/100),E=100):(l=m.offsetTop,E=h.offsetHeight),a){case"left":m.style.left=c+w+f,d="left";break;case"right":m.style.left=c-w+f,d="left";break;case"top":m.style.top=l+E+p,d="top";break;case"bottom":m.style.top=l-E+p,d="top";break;default:m.style.left=c-w+f,d="left"}m.style.opacity=1,g||(v.waitCounter+=1),S="%"===f?m.offsetLeft/(h.offsetWidth/100):m.offsetLeft,_="%"===p?m.offsetTop/(h.offsetHeight/100):m.offsetTop,t("left"===d?S:_,"left"===d?c:l,function(t){m.style[d]=t+("left"===d?f:p)},{duration:o,easing:y},function(){g||(v.waitCounter-=1)})}else g||(v.waitCounter+=1),t(0,1,function(t){m.style.opacity=t},{duration:o,easing:y},function(){g||(v.waitCounter-=1)});return{doNext:!0}},u.prototype._createElement=function(){this.element=document.createElement(this.elementType||"div"),this.element.style.opacity=0,this.element.draggable=!1,this.element.setAttribute("class","asset"),this.element.setAttribute("id",this.cssid),this.element.setAttribute("data-wse-asset-name",this.name),this.element.style.position="absolute",this.element.style.zIndex=this.z,this.element.style.width=this.width,this.element.style.height=this.height,this.stage.appendChild(this.element)},u.prototype._moveToPosition=function(){var t,e,n,i,r=this.element;t=parseInt(this.x,10),e=parseInt(this.y,10),n=s(this.x)||"px",i=s(this.y)||"px","%"===n&&(t=this.stage.offsetWidth/100*t),"%"===i&&(e=this.stage.offsetHeight/100*e),t=o(t,this.xAnchor,this.boxWidth||this.element.offsetWidth),e=o(e,this.yAnchor,this.boxHeight||this.element.offsetHeight),"%"===n&&(t/=this.stage.offsetWidth/100),"%"===i&&(e/=this.stage.offsetHeight/100),r.style.left=""+t+n,r.style.top=""+e+i},u.prototype._calculateBoxSize=function(){var t=0,e=0,n=this.element;Array.isArray(this._boxSizeSelectors)&&(this._boxSizeSelectors.forEach(function(i){[].forEach.call(n.querySelectorAll(i),function(n){n.offsetWidth>t&&(t=n.offsetWidth),n.offsetHeight>e&&(e=n.offsetHeight)})}),this.boxWidth=t,this.boxHeight=e)},u}),using("transform-js::transform","eases","MO5.Animation","MO5.TimerWatcher","WSE.commands","WSE.tools::createTimer","WSE.tools::warn").define("WSE.assets.Animation",function(t,e,n,i,r,s,o){"use strict";function u(u,a){function c(e,n,i,r,s,o){return t(n,i,function(t){e.style[r]=t+s},o)}function l(t,e){var n,i;i=t,n=i.getAttribute("duration"),r["do"](i,a,{animation:!0}),null!==n&&e.addTimer(s(n))}function d(t,n){var r;r=n.length,y=g.length,b.cbs.push(function(){var s,o,u,a,d,f,p,h,m,g,v,w,E;for(E=new i,m=0;y>m;m+=1)if(a=t[m],"undefined"!=typeof a&&null!==a){f=a.getAttribute("asset");try{d=document.getElementById(b.assets[f].cssid)||b.stage}catch(S){continue}g=a.getAttribute("easing"),s=parseInt(a.getAttribute("from"),10),o=parseInt(a.getAttribute("to"),10),u=a.getAttribute("unit")||"",p=a.getAttribute("duration")||500,h=a.getAttribute("property"),v={},v.duration=p,null!==g&&"undefined"!=typeof e[g]&&null!==e[g]&&(v.easing=e[g]),E.addTimer(c(d,s,o,h,u,v))}for(w=0;r>w;w+=1)l(n[w],E);return E})}var f,p,h,m,g,y,b,v;if(this.stage=a.stage,this.bus=a.bus,this.asset=u,this.name=u.getAttribute("name"),this.cbs=[],this.assets=a.assets,this.isRunning=!1,b=this,f=this.asset.getElementsByTagName("group"),h=f.length,1>h)return o(this.bus,"Animation asset '"+this.name+"' is empty.",u),{doNext:!0};for(p=0;h>p;p+=1)m=f[p],g=m.getElementsByTagName("transform"),v=m.getElementsByTagName("do"),d(g,v);this.anim=new n,this.cbs.forEach(function(t){this.anim.addStep(t)}.bind(this)),this.bus.trigger("wse.assets.animation.constructor",this),function(){function t(){b.stop()}b.bus.subscribe(t,"wse.interpreter.restart"),b.bus.subscribe(t,"wse.interpreter.end"),b.bus.subscribe(t,"wse.interpreter.load.before")}()}return u.prototype.start=function(){this.anim.start(),this.isRunning=!0,this.bus.trigger("wse.assets.animation.started",this)},u.prototype.stop=function(){this.anim.isRunning()&&this.anim.stop(),this.isRunning=!1,this.bus.trigger("wse.assets.animation.stopped",this)},u.prototype.save=function(){var t={assetType:"Animation",isRunning:this.isRunning,index:this.anim.index};return this.bus.trigger("wse.assets.animation.save",{subject:this,saves:t}),t},u.prototype.restore=function(t){this.isRunning=t.isRunning,this.isRunning===!0&&(this.anim.index=t.index,this.start()),this.bus.trigger("wse.assets.animation.restore",{subject:this,saves:t})},u}),using("WSE.tools::warn","howler::Howl","WSE.tools::truthy").define("WSE.assets.Audio",function(t,e,n){"use strict";function i(i,r){var s,o,u,a,c,l,d,f,p,h,m,g,y,b,v;if(b=r.bus,this.interpreter=r,this.bus=b,this.name=i.getAttribute("name"),this.tracks={},this.autopause=n(i.getAttribute("autopause")),this.loop=n(i.getAttribute("loop")),this.fade=n(i.getAttribute("fade")),this.fadeinDuration=parseInt(i.getAttribute("fadein"))||1e3,this.fadeoutDuration=parseInt(i.getAttribute("fadeout"))||1e3,this._playing=!1,y=i.getElementsByTagName("track"),u=y.length,1>u)return t(this.bus,"No tracks defined for audio element '"+this.name+"'.",i),{doNext:!0};for(o=0;u>o;o+=1)if(l=y[o],f=l.getAttribute("title"),null!==f)if(s=l.getElementsByTagName("source"),c=s.length,1>c)t(this.bus,"No sources defined for track '"+f+"' in audio element '"+this.name+"'.",i);else{for(v={urls:[],autoplay:!1,loop:this.loop||!1,onload:this.bus.trigger.bind(this.bus,"wse.assets.loading.decrease")},p={},a=0;c>a;a+=1)g=s[a],h=g.getAttribute("href"),m=g.getAttribute("type"),null!==h?null!==m?(p[m]=h,v.urls.push(h)):t(this.bus,"No type defined for source in track '"+f+"' in audio element '"+this.name+"'.",i):t(this.bus,"No href defined for source in track '"+f+"' in audio element '"+this.name+"'.",i);this.bus.trigger("wse.assets.loading.increase"),d=new e(v),this.tracks[f]=d}else t(this.bus,"No title defined for track '"+f+"' in audio element '"+this.name+"'.",i);this.play=function(t){var e;return this._playing?{doNext:!0}:(this._playing=!0,this._paused=!1,t.getAttribute("fadein")?(this.interpreter.waitCounter+=1,e=+t.getAttribute("fadein"),this.tracks[this._currentTrack].volume(0),this.tracks[this._currentTrack].play(),this.tracks[this._currentTrack].fade(0,1,e,function(){this.interpreter.waitCounter-=1}.bind(this))):this.tracks[this._currentTrack].play(),{doNext:!0})},this.stop=function(t){var e;return this._currentTrack?(this._playing=!1,this._paused=!1,t&&t.getAttribute("fadeout")?(this.interpreter.waitCounter+=1,e=+t.getAttribute("fadeout"),this.tracks[this._currentTrack].fade(1,0,e,function(){this.tracks[this._currentTrack].stop(),this.interpreter.waitCounter-=1}.bind(this))):this.tracks[this._currentTrack].stop(),this.bus.trigger("wse.assets.audio.stop",this),{doNext:!0}):{doNext:!0}},this.pause=function(){return this._currentTrack&&this._playing?(this._paused=!0,this.tracks[this._currentTrack].pause(),{doNext:!0}):{doNext:!0}},this.bus.trigger("wse.assets.audio.constructor",this),this.bus.subscribe("wse.interpreter.restart",function(){this.stop()}.bind(this)),window.addEventListener("blur",function(){this._playing&&this.tracks[this._currentTrack].fade(1,0,200)}.bind(this)),window.addEventListener("focus",function(){this._playing&&this.tracks[this._currentTrack].fade(0,1,200)}.bind(this))}return i.prototype.set=function(t){var e=!1;return this._playing&&(e=!0),this.stop(),this._currentTrack=t.getAttribute("track"),e&&this.play(t),{doNext:!0}},i.prototype.save=function(){var t={currentTrack:this._currentTrack,playing:this._playing,paused:this._paused};return this.bus.trigger("wse.assets.audio.save",this),t},i.prototype.restore=function(t){var e;this._playing=t.playing,this._paused=t.paused,this._currentTrack=t.currentTrack;for(e in this.tracks)this.tracks[e].stop();this._playing&&!this._paused&&this.tracks[this._currentTrack].play(),this.bus.trigger("wse.assets.audio.restore",this)},i}),using().define("WSE.assets.Character",function(){"use strict";function t(t,e){this.asset=t,this.stage=e.stage,this.bus=e.bus,this.name=t.getAttribute("name"),this.bus.trigger("wse.assets.character.constructor",this)}return t.prototype.setTextbox=function(t){this.asset.setAttribute("textbox",t.getAttribute("textbox")),this.bus.trigger("wse.assets.character.settextbox",this)},t.prototype.save=function(){var t={assetType:"Character",textboxName:this.asset.getAttribute("textbox")};return this.bus.trigger("wse.assets.character.save",{subject:this,saves:t}),t},t.prototype.restore=function(t){this.asset.setAttribute("textbox",t.textboxName),this.bus.trigger("wse.assets.character.restore",{subject:this,saves:t})},t}),using("WSE.DisplayObject","WSE.tools::warn").define("WSE.assets.Curtain",function(t,e){"use strict";function n(e){t.apply(this,arguments),this.asset=e,this.color=e.getAttribute("color")||"black",this.z=e.getAttribute("z")||2e4,this.cssid=this.cssid||"WSECurtain_"+this.id,this.element.setAttribute("class","asset WSECurtain"),this.element.style.left=0,this.element.style.top=0,this.element.style.width=this.stage.offsetWidth+"px",this.element.style.height=this.stage.offsetHeight+"px",this.element.style.opacity=0,this.element.style.backgroundColor=this.color}return n.prototype=Object.create(t.prototype),n.prototype.set=function(t){this.color=t.getAttribute("color")||"black",this.element.style.backgroundColor=this.color},n.prototype.save=function(){return{color:this.color,cssid:this.cssid,z:this.z}},n.prototype.restore=function(t){this.color=t.color,this.cssid=t.cssid,this.z=t.z;try{this.element=document.getElementById(this.cssid)}catch(n){return void e(this.bus,"Element with CSS ID '"+this.cssid+"' could not be found.")}this.element.style.backgroundColor=this.color,this.element.style.zIndex=this.z},n}),using("transform-js::transform","eases","WSE.DisplayObject","WSE.tools::applyAssetUnits","WSE.tools::extractUnit","WSE.tools::calculateValueWithAnchor","WSE.tools::warn").define("WSE.assets.Imagepack",function(t,e,n,i,r,s,o){"use strict";function u(t){var e,i,r,s,u,a,c,l,d,f,p,h;for(this._boxSizeSelectors=["img"],n.apply(this,arguments),this.cssid=this.cssid||"wse_imagepack_"+this.name,d=this,e={},p=t.getAttribute("width"),h=t.getAttribute("height"),this.element.setAttribute("class","asset imagepack"),i=t.getElementsByTagName("image"),f=d.bus.trigger.bind(d.bus,"wse.assets.loading.decrease",null,!1),r=0,s=i.length;s>r;r+=1)u=i[r],a=u.getAttribute("name"),c=u.getAttribute("src"),null!==a?null!==c?(l=new Image,this.bus.trigger("wse.assets.loading.increase",null,!1),l.addEventListener("load",f),l.src=c,l.style.opacity=0,l.style.position="absolute",l.draggable=!1,l.setAttribute("data-wse-asset-image-name",a),null!==p&&l.setAttribute("width",p),null!==h&&l.setAttribute("height",h),e[a]=this.cssid+"_"+a,l.setAttribute("id",e[a]),this.element.appendChild(l)):o(this.bus,"Image without src in imagepack '"+this.name+"'.",t):o(this.bus,"Image without name in imagepack '"+this.name+"'.",t);this.images=e,this.current=null}return u.prototype=Object.create(n.prototype),u.prototype.set=function(n,i){var r,s,u,a,c,l,d,f=this.bus;if(i=i||{},u=this,s=n.getAttribute("image"),c=n.getAttribute("duration")||400,l=i.animation===!0?!0:!1,null===s)return o(f,"Missing attribute 'image' on 'do' element referencing imagepack '"+this.name+"'.",n),{doNext:!0};try{r=document.getElementById(this.images[s])}catch(p){console.error("DOM Element for Image "+s+" on Imagepack "+this.name+" not found!",p)}if("undefined"==typeof r||null===r)return o(f,"Unknown image name on 'do' element referencing imagepack '"+this.name+"'.",n),{doNext:!0};a=this.current;for(var h in this.images)if(this.images.hasOwnProperty(h)){if(h!==s)continue;if(h===a)return o(f,"Trying to set the image that is already set on imagepack '"+this.name+"'.",n),{doNext:!0}}return l||(u.interpreter.waitCounter+=1),d=document.getElementById(this.cssid),d.style.width=r.offsetWidth+"px",d.style.height=r.offsetHeight+"px",function(){var n,i,s;n=function(t){r.style.opacity=t},i=function(){l||(u.interpreter.waitCounter-=1)},s={duration:c,easing:e.cubicOut},t(0,1,n,s,i)}(),null!==this.current&&(l||(u.interpreter.waitCounter+=1),function(){var n;(n=function(){var n,i,r,s;n=document.getElementById(u.images[a]),i=function(t){n.style.opacity=t},r=function(){l||(u.interpreter.waitCounter-=1)},s={duration:c,easing:e.cubicIn},t(1,0,i,s,r)})()}()),this.current=s,{doNext:!0}},u.prototype.save=function(){var t,e,n;return e=this.images,t=this.current||null,n={assetType:"Imagepack",current:t,cssid:this.cssid,images:e,xAnchor:this.xAnchor,yAnchor:this.yAnchor,z:this.z},this.bus.trigger("wse.assets.imagepack.save",{subject:this,saves:n}),n},u.prototype.restore=function(t){var e;e=t.current,this.cssid=t.cssid,this.z=t.z,this.current=e,this.xAnchor=t.xAnchor,this.yAnchor=t.yAnchor,document.getElementById(this.cssid).style.zIndex=this.z,this.bus.trigger("wse.assets.imagepack.restore",{subject:this,saves:t})},u}),using("transform-js::transform","WSE.tools.reveal","class-manipulator::list","WSE.DisplayObject","WSE.tools::applyAssetUnits","WSE.tools::replaceVariables","WSE.tools::truthy").define("WSE.assets.Textbox",function(t,e,n,i,r,s,o){"use strict";function u(t){this.z=1e3,i.apply(this,arguments);var e,n,r;this.type=t.getAttribute("behaviour")||"adv",this.showNames=o(t.getAttribute("namebox")),this.nltobr=o(t.getAttribute("nltobr")),this.cssid=this.cssid||"wse_textbox_"+this.name,this.effectType=t.getAttribute("effect")||"typewriter",this.speed=t.getAttribute("speed")||0,this.speed=parseInt(this.speed,10),this.fadeDuration=t.getAttribute("fadeDuration")||0,function(e){var n,i,r,s;try{for(s=t.childNodes,i=0,r=s.length;r>i;i+=1)if(1===s[i].nodeType&&"nameTemplate"===s[i].tagName){n=s[i];break}if(!n)throw new Error("No nameTemplate found.");e.nameTemplate=(new XMLSerializer).serializeToString(n)}catch(o){e.nameTemplate="{name}: "}}(this),"nvl"===this.type&&(this.showNames=!1),e=this.element,n=document.createElement("div"),r=document.createElement("div"),e.setAttribute("class","asset textbox"),r.setAttribute("class","text"),n.setAttribute("class","name"),e.appendChild(n),e.appendChild(r),this.showNames===!1&&(n.style.display="none"),n.setAttribute("id",this.cssid+"_name"),r.setAttribute("id",this.cssid+"_text"),this.nameElement=this.cssid+"_name",this.textElement=this.cssid+"_text",e.style.opacity=0,this.bus.trigger("wse.assets.textbox.constructor",this)}return u.prototype=Object.create(i.prototype),u.prototype.put=function(i,r,o){function u(){"adv"===d.type&&(a.innerHTML=""),a.innerHTML+=l+i,c.innerHTML=d.nameTemplate.replace(/\{name\}/g,r)}var a,c,l,d,f,p="wse_no_character";return r=r||null,o=o||"_no_one",d=this,a=document.getElementById(this.textElement),c=document.getElementById(this.nameElement),f=document.getElementById(this.cssid),i=s(i,this.interpreter),d.interpreter.waitCounter+=1,l="",this.showNames===!1&&r&&(l=this.nameTemplate.replace(/\{name\}/g,r)),null===r?(this.showNames&&(c.style.display="none"),r=""):(this.showNames&&(c.style.display=""),p="wse_character_"+o.split(" ").join("_")),this._lastCssClass&&n(f).remove(this._lastCssClass).apply(),this._lastCssClass=p,n(f).add(p).apply(),this.speed<1&&(this.fadeDuration>0?(d.interpreter.waitCounter+=1,function(){var e,n,i;e=function(t){a.style.opacity=t},n=function(){d.interpreter.waitCounter-=1},i={duration:d.fadeDuration},t(1,0,e,i,n)}()):u()),this.speed>0?("adv"===d.type&&(a.innerHTML=""),function(){var t;t=document.createElement("div"),t.setAttribute("class","line"),a.appendChild(t),t.innerHTML=l+i,c.innerHTML=d.nameTemplate.replace(/\{name\}/g,r),d.interpreter.cancelCharAnimation=e(t,{speed:d.speed,onFinish:function(){d.interpreter.cancelCharAnimation=null}}).cancel}()):this.fadeDuration>0&&(d.interpreter.waitCounter+=1,setTimeout(function(){u(),"nvl"===d.type&&(a.innerHTML="
"+a.innerHTML+"
"),t(0,1,function(t){a.style.opacity=t},{duration:d.fadeDuration,onFinish:function(){d.interpreter.waitCounter-=1}})},d.fadeDuration)),this.bus.trigger("wse.assets.textbox.put",this,!1),d.interpreter.waitCounter-=1,{doNext:!1}},u.prototype.clear=function(){return document.getElementById(this.textElement).innerHTML="",document.getElementById(this.nameElement).innerHTML="",this.bus.trigger("wse.assets.textbox.clear",this), {doNext:!0}},u.prototype.save=function(){return{assetType:"Textbox",type:this.type,showNames:this.showNames,nltobr:this.nltobr,cssid:this.cssid,nameElement:this.nameElement,textElement:this.textElement,z:this.z}},u.prototype.restore=function(t){this.type=t.type,this.showNames=t.showNames,this.nltobr=t.nltobr,this.cssid=t.cssid,this.nameElement=t.nameElement,this.textElement=t.textElement,this.z=t.z,document.getElementById(this.cssid).style.zIndex=this.z},u}),using("WSE.tools::applyAssetUnits","WSE.DisplayObject","WSE.tools::warn").define("WSE.assets.Background",function(t,e,n){"use strict";function i(t){t.element.setAttribute("width",t.stage.offsetWidth),t.element.setAttribute("height",t.stage.offsetHeight)}function r(t){var e=t.element.style;t.element.setAttribute("id",t.cssid),t.element.setAttribute("class","WSEBackground"),t.element.style.position="absolute",t.element.draggable=!1,e.left=0,e.top=0,e.opacity=0,e.zIndex=t.z}function s(t){this.elementType="img",e.apply(this,arguments);var s=this;return this.asset=t,this.cssid=this.cssid||"WSEBackground_"+this.id,this.src=t.getAttribute("src"),this.src?(this.element.setAttribute("src",this.src),r(this),i(this),void window.addEventListener("resize",function(){i(s)})):void n(this.bus,"No source defined on background asset.",t)}return s.prototype=Object.create(e.prototype),s.prototype.save=function(){return{cssid:this.cssid,z:this.z}},s.prototype.restore=function(t){this.cssid=t.cssid,this.z=t.z;try{this.element=document.getElementById(this.cssid)}catch(e){return void n(this.bus,"Element with CSS ID '"+this.cssid+"' could not be found.")}},s}),using("transform-js::transform","eases","WSE.DisplayObject","WSE.tools::applyAssetUnits","WSE.tools::extractUnit","WSE.tools::calculateValueWithAnchor","WSE.tools::warn").define("WSE.assets.Composite",function(t,e,n,i,r,s,o){"use strict";function u(t){var e,i,r,s,u,a;this._boxSizeSelectors=["img"],n.apply(this,arguments),this.cssid=this.cssid||"wse_composite_"+this.name,r=this,e=this.element,u=this.width,a=this.height,e.setAttribute("class","asset composite"),i=t.getElementsByTagName("image"),s=r.bus.trigger.bind(r.bus,"wse.assets.loading.decrease",null,!1),[].forEach.call(i,function(n){var i,c,l;return i=n.getAttribute("tags"),c=n.getAttribute("src"),null===i?void o(r.bus,"Image without tags in composite '"+r.name+"'.",t):null===c?void o(r.bus,"Image without src in composite '"+r.name+"'.",t):(l=new Image,r.bus.trigger("wse.assets.loading.increase",null,!1),l.addEventListener("load",s),l.src=c,l.style.opacity=0,l.style.position="absolute",l.draggable=!1,l.setAttribute("data-wse-tags",i),null!==u&&l.setAttribute("width",u),null!==a&&l.setAttribute("height",a),void e.appendChild(l))}),this.current=[]}function a(t){var e,n;return e=document.getElementById(t.cssid).getElementsByTagName("img"),n={},[].forEach.call(e,function(t){var e=c(t.getAttribute("data-wse-tags")||"");e.forEach(function(e){Array.isArray(n[e])||(n[e]=[]),n[e].push(t)})}),n}function c(t){return t.split(",").map(function(t){return t.trim()})}function l(t,e){var n=0;return t.forEach(function(t){t[e]>n&&(n=t[e])}),n}return u.prototype=Object.create(n.prototype),u.prototype.tag=function(n,i){var r,s,u,d,f,p,h,m,g,y,b=this.bus;return i=i||{},r=this,p=c(n.getAttribute("add")||""),h=c(n.getAttribute("remove")||""),u=n.getAttribute("duration")||400,d=i.animation===!0?!0:!1,p.length||h.length?(s=this.current,h.length&&"*"===h[0]?this.current=p.slice():(this.current=s.filter(function(t){return h.indexOf(t)<0}),p.forEach(function(t){r.current.indexOf(t)<0&&r.current.push(t)})),m=a(this),g=[],y=[],s.forEach(function(t){m[t]&&m[t].forEach(function(t){g.indexOf(t)<0&&g.push(t)})}),this.current.forEach(function(t){m[t]&&m[t].forEach(function(t){y.indexOf(t)<0&&y.push(t)})}),y=y.filter(function(t){return g.indexOf(t)>=0?(g.splice(g.indexOf(t),1),!1):!0}),d||(r.interpreter.waitCounter+=1),f=document.getElementById(this.cssid),f.style.width=l(y,"offsetWidth")+"px",f.style.height=l(y,"offsetHeight")+"px",function(){var n,i,s;n=function(t){y.forEach(function(e){e.style.opacity=t})},i=function(){d||(r.interpreter.waitCounter-=1)},s={duration:u,easing:e.cubicOut},t(0,1,n,s,i)}(),null!==this.current&&(d||(r.interpreter.waitCounter+=1),function(){function n(){function n(t){g.forEach(function(e){e.style.opacity=t})}function i(){d||(r.interpreter.waitCounter-=1)}var s;s={duration:u,easing:e.cubicIn},t(1,0,n,s,i)}n()}()),{doNext:!0}):(o(b,"No attribute 'add' or 'remove' on element referencing composite '"+this.name+"'. Expected at least one.",n),{doNext:!0})},u.prototype.save=function(){var t,e;return t=this.current||[],e={assetType:"Composite",current:t,cssid:this.cssid,xAnchor:this.xAnchor,yAnchor:this.yAnchor,z:this.z},this.bus.trigger("wse.assets.composite.save",{subject:this,saves:e}),e},u.prototype.restore=function(t){this.cssid=t.cssid,this.z=t.z,this.current=t.current.slice(),this.xAnchor=t.xAnchor,this.yAnchor=t.yAnchor,this.element=document.getElementById(this.cssid),this.element.style.zIndex=this.z,this.bus.trigger("wse.assets.composite.restore",{subject:this,saves:t})},u}),using("WSE.tools.ui","WSE.tools","WSE.tools::replaceVariables").define("WSE.commands.alert",function(t,e,n){function i(i,r){var s,o,u;return s=i.getAttribute("title")||"Alert!",o=i.getAttribute("message")||"Alert!",u="false"===n(i.getAttribute("next")||"",r)?!1:!0,o=n(o,r),s=n(s,r),o=e.textToHtml(o),r.bus.trigger("wse.interpreter.commands.alert",i),t.alert(r,{title:s,message:o,pause:!0,doNext:u}),{doNext:!0}}return i}),using().define("WSE.commands.break",function(){"use strict";function t(t,e){return e.bus.trigger("wse.interpreter.commands.break",{interpreter:e,command:t},!1),{doNext:!1,wait:!0}}return t}),using("WSE.tools","WSE.DisplayObject").define("WSE.commands.choice",function(t,e){"use strict";function n(n,i){var r,s,o,u,a,c,l,d,f,p,h,m,g;for(i.bus.trigger("wse.interpreter.commands.choice",{interpreter:i,command:n},!1),m=i.state,i.state="pause",s=[],d=[],f=i,o=n.childNodes,u=o.length,g=n.getAttribute("cssid")||"WSEChoiceMenu",h=function(t,e,n,r){return n=n||null,function(s){s.stopPropagation(),s.preventDefault(),setTimeout(function(){var e=t.childNodes?t.childNodes.length:0,s=i.index,o=i.sceneId,u=i.scenePath.slice(),a=i.currentScene;null!==n&&f.changeSceneNoNext(n),e>0&&(i.pushToCallStack(),i.currentCommands=t.childNodes,i.sceneId=o,i.scenePath=u,i.scenePath.push(s-1),i.scenePath.push(r),i.index=0,i.currentScene=a,i.currentElement=0),f.next()},0),f.stage.removeChild(e),i.waitCounter-=1,i.state=m}},1>u&&i.bus.trigger("wse.interpreter.warning",{element:n,message:"Element 'choice' is empty. Expected at least one 'option' element."}),r=document.createElement("div"),r.setAttribute("class","menu"),r.setAttribute("id",g),r.setAttribute("data-wse-index",i.index),r.setAttribute("data-wse-scene-id",i.sceneId),r.setAttribute("data-wse-game",i.game.url),r.setAttribute("data-wse-type","choice"),a=0;u>a;a+=1)c=o[a],c.tagName&&"option"===c.tagName&&i.checkIfvar(c)&&(l=document.createElement("input"),l.setAttribute("class","button"),l.setAttribute("type","button"),l.setAttribute("tabindex",a+1),l.setAttribute("value",c.getAttribute("label")),l.value=t.replaceVariables(c.getAttribute("label"),i),p=c.getAttribute("scene")||null,d[a]=p?i.getSceneById(p):null,l.addEventListener("click",h(c,r,d[a],a)),s.push(l),r.appendChild(l));return r.style.opacity=0,i.stage.appendChild(r),e.prototype.show.call(void 0,n,{element:r,bus:i.bus,stage:i.stage,interpreter:i}),i.waitCounter+=1,{doNext:!1,wait:!0}}return n}),using("WSE.tools.ui").define("WSE.commands.confirm",function(t){return t.makeInputFn("confirm")}),using("WSE.tools::warn").define("WSE.commands.do",function(t){"use strict";function e(e,n,i){var r,s,o=n.bus,u=n.assets;return i=i||{},o.trigger("wse.interpreter.commands.do",{interpreter:n,command:e},!1),r=e.getAttribute("asset"),s=e.getAttribute("action"),null===r?void t(o,"Element of type 'do' must have an attribute 'asset'. Element ignored.",e):null===s?void t(o,"Element of type 'do' must have an attribute 'action'. Element ignored.",e):"undefined"==typeof u[r]||null===u[r]?(t(o,"Reference to unknown asset '"+r+"'.",e),{doNext:!0}):"undefined"==typeof u[r][s]?(t(o,"Action '"+s+"' is not defined for asset '"+r+"'.",e),{doNext:!0}):u[r][s](e,i)}return e}),using("WSE.functions","WSE.tools::warn").define("WSE.commands.fn",function(t,e){"use strict";function n(n,i){var r,s,o;return r=n.getAttribute("name")||null,s=n.getAttribute("tovar")||null,"string"!=typeof r?(e(i.bus,"No name supplied on fn element.",n),{doNext:!0}):"function"!=typeof t[r]?(e(i.bus,"Unknown function '"+r+"'.",n),{doNext:!0}):(o=t[r](i),null!==s&&(i.runVars[s]=""+o),{doNext:!0})}return n}),using("WSE.tools::warn").define("WSE.commands.global",function(t){"use strict";function e(e,n){var i,r,s;return i=e.getAttribute("name")||null,r=e.getAttribute("value")||null,s={doNext:!0},null===i?(t(n.bus,"No name defined on element 'global'.",e),s):null===r?(t(n.bus,"No value defined on element 'global'.",e),s):(n.globalVars.set(i,r),s)}return e}),using("WSE.tools::warn").define("WSE.commands.globalize",function(t){"use strict";function e(e,n){var i,r;return i=e.getAttribute("name")||null,r={doNext:!0},null===i?(t(n.bus,"No variable name defined on globalize element.",e),r):"undefined"==typeof n.runVars[i]||null===n.runVars[i]?(t(n.bus,"Undefined local variable.",e),r):(n.globalVars.set(i,n.runVars[i]),r)}return e}),using("WSE.tools::replaceVariables","WSE.tools::logError").define("WSE.commands.goto",function(t,e){"use strict";function n(n,i){var r,s,o=i.bus;return o.trigger("wse.interpreter.commands.goto",{interpreter:i,command:n},!1),s=n.getAttribute("scene"),null===s&&e(o,"Element 'goto' misses attribute 'scene'."),s=t(s,i),r=i.getSceneById(s),null===r?void e(o,"Unknown scene '"+s+"'."):{changeScene:r}}return n}),using("WSE.tools::getSerializedNodes","WSE.tools::warn").define("WSE.commands.line",function(t,e){"use strict";function n(n,i){var r,s,o,u,a,c,l,d,f,p,h=i.bus;if(p={doNext:!0},h.trigger("wse.interpreter.commands.line",{interpreter:i,command:n},!1),r=n.getAttribute("s"),f="false"===n.getAttribute("stop")?!0:!1,null===r)return e(h,"Element 'line' requires attribute 's'.",n),p;for(l=i.story.getElementsByTagName("character"),a=l.length,u=0;a>u;u+=1)if(c=l[u],c.getAttribute("name")===r){if(o=c.getAttribute("textbox"),"undefined"==typeof o||null===o)return e(h,"No textbox defined for character '"+r+"'.",n),p;try{s=t(c.getElementsByTagName("displayname")[0]).trim()}catch(m){}break}return"undefined"==typeof i.assets[o]?(e(h,"Trying to use an unknown textbox or character.",n),p):(d=t(n),i.log.push({speaker:r,text:d}),i.assets[o].put(d,s,r),{doNext:f,wait:!0})}return n}),using("WSE.tools::warn").define("WSE.commands.localize",function(t){"use strict";function e(e,n){var i,r;return r={doNext:!0},i=e.getAttribute("name")||null,null===i?(t(n.bus,"No variable name defined on localize element.",e),r):n.globalVars.has(i)?(n.runVars[i]=n.globalVars.get(i),r):(t(n.bus,"Undefined global variable.",e),r)}return e}),using("WSE.tools.ui").define("WSE.commands.prompt",function(t){return t.makeInputFn("prompt")}),using().define("WSE.commands.restart",function(){"use strict";function t(t,e){for(e.bus.trigger("wse.interpreter.commands.restart",{interpreter:e,command:t},!1),e.bus.trigger("wse.interpreter.message","Restarting game...",!1),e.bus.trigger("wse.interpreter.restart",e,!1),e.runVars={},e.log=[],e.visitedScenes=[],e.startTime=Math.round(+new Date/1e3),e.waitCounter=0,e.state="listen",e.stage.innerHTML="",e.assets={},e.buildAssets(),e.callOnLoad();e.callStack.length>0;)e.callStack.shift();return{doNext:!0,changeScene:e.getFirstScene()}}return t}),using("WSE.tools::replaceVariables","WSE.commands.set_vars","WSE.tools::warn","WSE.tools::logError","WSE.tools::log").define("WSE.commands.sub",function(t,e,n,i,r){"use strict";function s(s,o){var u,a,c,l;return o.bus.trigger("wse.interpreter.commands.sub",{interpreter:o,command:s},!1),l={doNext:!0},u=s.getAttribute("scene")||null,c=s.getAttribute("next")===!1?!1:!0,null===u?(n(o.bus,"Missing 'scene' attribute on 'sub' command!",s),l):(u=t(u,o),(a=o.getSceneById(u))?(r(o.bus,"Entering sub scene '"+u+"'..."),o.pushToCallStack(),o.currentCommands=a.childNodes,o.index=-1,o.sceneId=u,o.scenePath=[],o.currentElement=-1,s.getAttribute("names")&&e(s,o),{doNext:c}):(i(o.bus,"No such scene '"+u+"'!",s),l))}return s}),using("WSE.tools::warn").define("WSE.commands.trigger",function(t){"use strict";function e(e,n){var i,r,s;return s={doNext:!0},n.bus.trigger("wse.interpreter.commands.trigger",{interpreter:n,command:e},!1),i=e.getAttribute("name")||null,r=e.getAttribute("action")||null,null===i?(t(n.bus,"No name specified on trigger command.",e),s):null===r?(t(n.bus,"No action specified on trigger command referencing trigger '"+i+"'.",e),s):"undefined"==typeof n.triggers[i]||null===n.triggers[i]?(t(n.bus,"Reference to unknown trigger '"+i+"'.",e),s):"function"!=typeof n.triggers[i][r]?(t(n.bus,"Unknown action '"+r+"' on trigger command referencing trigger '"+i+"'.",e),s):(n.triggers[i][r](e),s)}return e}),using("WSE.tools::replaceVariables","WSE.tools::warn","WSE.tools::log").define("WSE.commands.var",function(t,e,n){"use strict";function i(i,r){var s,o,u,a,c,l;if(l={doNext:!0},r.bus.trigger("wse.interpreter.commands.var",{interpreter:r,command:i},!1),s=i.getAttribute("name")||null,o=i.getAttribute("value")||"1",a=i.getAttribute("action")||"set",null===s)return e(r.bus,"Command 'var' must have a 'name' attribute.",i),l;if(c=r.runVars,"set"!==a&&!(s in c||i.getAttribute("lvalue")))return e(r.bus,"Undefined variable.",i),l;if(o=t(o,r),"set"===a)return c[s]=""+o,l;switch(u=i.getAttribute("lvalue")||c[s],u=t(u,r),a){case"delete":delete c[s];break;case"increase":c[s]=""+(parseFloat(u)+parseFloat(o));break;case"decrease":c[s]=""+(parseFloat(u)-parseFloat(o));break;case"multiply":c[s]=""+parseFloat(u)*parseFloat(o);break;case"divide":c[s]=""+parseFloat(u)/parseFloat(o);break;case"modulus":c[s]=""+parseFloat(u)%parseFloat(o);break;case"and":c[s]=""+(parseFloat(u)&&parseFloat(o));break;case"or":c[s]=""+(parseFloat(u)||parseFloat(o));break;case"not":c[s]=parseFloat(u)?"0":"1";break;case"is_greater":c[s]=parseFloat(u)>parseFloat(o)?"1":"0";break;case"is_less":c[s]=parseFloat(u)=parseFloat(o)?"1":"0";break;case"not_equal":c[s]=parseFloat(u)!==parseFloat(o)?"1":"0";break;case"print":n(r.bus,"Variable '"+s+"' is: "+c[s]);break;default:e(r.bus,"Unknown action '"+a+"' defined on 'var' command.",i)}return l}return i}),using("WSE.tools::logError").define("WSE.commands.set_vars",function(t){"use strict";function e(e,n){var i,r,s,o=n.runVars;return s={doNext:!0},i=(e.getAttribute("names")||"").split(","),r=(e.getAttribute("values")||"").split(","),i.length!==r.length?(t(n.bus,"Number of names does not match number of values in command."),s):(i.forEach(function(t,e){o[t.trim()]=""+r[e].trim()}),s)}return e}),using().define("WSE.commands.wait",function(){"use strict";function t(t,e){var n,i;return e.bus.trigger("wse.interpreter.commands.wait",{interpreter:e,command:t},!1),i=e,n=t.getAttribute("duration"),null!==n?(n=parseInt(n,10),e.waitForTimer=!0,setTimeout(function(){i.waitForTimer=!1},n),{doNext:!0,wait:!1}):{doNext:!0,wait:!0}}return t}),using("WSE.tools::getParsedAttribute","WSE.tools::warn").define("WSE.commands.with",function(t,e){"use strict";function n(n,o){var a,c,l=o.runVars,d=n.childNodes,f=t(n,"var",o),p=d.length;for(a=0;p>a;a+=1)if(c=d[a],!i(c,o)&&(r(c)&&!u(c)&&e(o.bus,"Element 'when' without a condition. Ignored.",n),s(c)&&u(c)&&e(o.bus,"Element 'else' with a condition. Ignored.",n),s(c)||r(c)&&u(c)&&t(c,"is")===l[f])){o.pushToCallStack(),o.currentCommands=c.childNodes,o.scenePath.push(o.index),o.scenePath.push(a),o.index=-1,o.currentElement=-1;break}return{doNext:!0}}function i(t,e){return!t.tagName||!e.checkIfvar(t)||"when"!==t.tagName&&"else"!==t.tagName}function r(t){return o(t,"when")}function s(t){return o(t,"else")}function o(t,e){return t.tagName===e}function u(t){return t.hasAttribute("is")}return n}),using().define("WSE.commands.while",function(){"use strict";function t(t,e){return e.index-=1,e.currentElement-=1,e.pushToCallStack(),e.currentCommands=t.childNodes,e.scenePath.push(e.index+1),e.index=-1,e.currentElement=-1,{doNext:!0}}return t}); \ No newline at end of file