1
0
forked from sent/waves
chunglloyd_unblocker/public/assets/g/flappycopter/js/main-built.js
2025-04-09 17:11:14 -05:00

4 lines
161 KiB
JavaScript

/*
(c) 2013-2022 GameMix Inc. All rights reserved.
*/
!function(){var t,u,a,o,c,p,g,f,m,y,i,s,v,e=document.getElementById("gameCanvas"),n=e.getContext("2d");function w(t,e){return i.call(t,e)}function r(t,e){var i,s,n,a,o,r,h,l,d,u,c=e&&e.split("/"),p=m.map,g=p&&p["*"]||{};if(t&&"."===t.charAt(0))if(e){for(c=c.slice(0,c.length-1),e=(t=t.split("/")).length-1,m.nodeIdCompat&&v.test(t[e])&&(t[e]=t[e].replace(v,"")),t=c.concat(t),l=0;l<t.length;l+=1)if("."===(u=t[l]))t.splice(l,1),--l;else if(".."===u){if(1===l&&(".."===t[2]||".."===t[0]))break;0<l&&(t.splice(l-1,2),l-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((c||g)&&p){for(l=(i=t.split("/")).length;0<l;--l){if(s=i.slice(0,l).join("/"),c)for(d=c.length;0<d;--d)if(n=(n=p[c.slice(0,d).join("/")])&&n[s]){a=n,o=l;break}if(a)break;!r&&g&&g[s]&&(r=g[s],h=l)}!a&&r&&(a=r,o=h),a&&(i.splice(0,o,a),t=i.join("/"))}return t}function b(t,e){return function(){return o.apply(u,s.call(arguments,0).concat([t,e]))}}function S(t){var e;if(w(f,t)&&(e=f[t],delete f[t],y[t]=!0,a.apply(u,e)),w(g,t)||w(y,t))return g[t];throw new Error("No "+t)}function h(t){var e,i=t?t.indexOf("!"):-1;return-1<i&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}n.save(),n.fillStyle="#000000",n.fillRect(0,0,e.width,e.height),n.restore(),n.save(),n.font="30px Arial",n.fillStyle="#ffffff",n.textAlign="center",n.textBaseline="middle",n.fillText("Loading",e.width/2,e.height/2),n.restore(),g={},f={},m={},y={},i=Object.prototype.hasOwnProperty,s=[].slice,v=/\.js$/,c=function(t,e){var i,s,n=h(t),a=n[0];return t=n[1],a&&(i=S(a=r(a,e))),a?t=i&&i.normalize?i.normalize(t,(s=e,function(t){return r(t,s)})):r(t,e):(a=(n=h(t=r(t,e)))[0],t=n[1],a&&(i=S(a))),{f:a?a+"!"+t:t,n:t,pr:a,p:i}},p={require:function(t){return b(t)},exports:function(t){var e=g[t];return void 0!==e?e:g[t]={}},module:function(t){return{id:t,uri:"",exports:g[t],config:(e=t,function(){return m&&m.config&&m.config[e]||{}})};var e}},a=function(t,e,i,s){var n,a,o,r,h,l=[],d=typeof i;if(s=s||t,"undefined"==d||"function"==d){for(e=!e.length&&i.length?["require","exports","module"]:e,r=0;r<e.length;r+=1)if("require"===(a=(o=c(e[r],s)).f))l[r]=p.require(t);else if("exports"===a)l[r]=p.exports(t),h=!0;else if("module"===a)n=l[r]=p.module(t);else if(w(g,a)||w(f,a)||w(y,a))l[r]=S(a);else{if(!o.p)throw new Error(t+" missing "+a);o.p.load(o.n,b(s,!0),function(e){return function(t){g[e]=t}}(a),{}),l[r]=g[a]}d=i?i.apply(g[t],l):void 0,t&&(n&&n.exports!==u&&n.exports!==g[t]?g[t]=n.exports:d===u&&h||(g[t]=d))}else t&&(g[t]=i)},e=t=o=function(t,e,i,s,n){if("string"==typeof t)return p[t]?p[t](e):S(c(t,e).f);if(!t.splice){if((m=t).deps&&o(m.deps,m.callback),!e)return;e.splice?(t=e,e=i,i=null):t=u}return e=e||function(){},"function"==typeof i&&(i=s,s=n),s?a(u,t,e,i):setTimeout(function(){a(u,t,e,i)},4),o},o.config=function(t){return o(t)},e._defined=g,(n=function(t,e,i){e.splice||(i=e,e=[]),w(g,t)||w(f,t)||(f[t]=[t,e,i])}).amd={jQuery:!0},n("requireLib",function(){}),n("j13e/utils/J13Polyfills",["require","exports","module"],function(t,e,i){"use strict";Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=this;return function(){return e.apply(t,arguments)}});for(var n,a,o,r,s,h=0,l=["webkit","moz"],d=0;d<l.length&&!window.requestAnimationFrame;++d)window.requestAnimationFrame=window[l[d]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[l[d]+"CancelAnimationFrame"]||window[l[d]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,e){var i=(new Date).getTime(),s=Math.max(0,16-(i-h)),n=window.setTimeout(function(){t(i+s)},s);return h=i+s,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){if(null==this)throw new TypeError;var i,s=this.length>>>0;if("function"!=typeof t)throw new TypeError;for(i=0;i<s;i++)void 0!==this[i]&&t.call(e,this[i],i,this)}),Array.prototype.every||(Array.prototype.every=function(t,e){if(null==this)throw new TypeError;var i,s=this.length>>>0;if("function"!=typeof t)throw new TypeError;for(i=0;i<s;i++)if(void 0!==this[i]&&!t.call(e,this[i],i,this))return!1;return!0}),Object.keys||(Object.keys=(n=Object.prototype.hasOwnProperty,a=!{toString:null}.propertyIsEnumerable("toString"),r=(o=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(t){if("object"!=typeof t&&("function"!=typeof t||null===t))throw new TypeError("Object.keys called on non-object");var e,i,s=[];for(e in t)n.call(t,e)&&s.push(e);if(a)for(i=0;i<r;i++)n.call(t,o[i])&&s.push(o[i]);return s})),"function"!=typeof Object.create&&(Object.create=function(t,e){function i(){}if(i.prototype=t,e&&"object"==typeof e)for(var s in e)e.hasOwnProperty(s)&&(i[s]=e[s]);return new i}),"function"!=typeof Object.getPrototypeOf&&(s="__proto__",Object.getPrototypeOf="object"==typeof"test"[s]?function(t){return t[s]}:function(t){return t.constructor.prototype})}),n("j13e/main",["./utils/J13Polyfills"],function(t){"use strict";return{status:"rawr"}}),n("j13e",["j13e/main"],function(t){return t}),n("cocoonjs/CocoonInclude",["require","exports","module"],function(t,e,i){"use strict";return null}),n("src/utils/Common",["require","exports","module"],function(t,e,i){"use strict";var s={clamp:function(t,e,i){return i<e?i:e<t?t:e},rangedRandom:function(t,e){var i,e=t<e?(i=t,e):(i=e,t);return i+Math.random()*(e-i)},objectToParamString:function(t){var e,i=[];for(e in t)t.hasOwnProperty(e)&&i.push(e+"="+t[e]);return i.join("&")},paramStringToObject:function(t){var e,i,s,n,a,o,r={};if(t&&"string"==typeof t&&1<t.length)for(i=(e="?"===(e=t)[0]?t.substr(1):e).split("&"),s=0;s<i.length;s+=1)2===(n=i[s].split("=",2)).length?(a=n[0],o=n[1],a&&o&&(r[a]=o)):1===n.length&&(r[n[0]]=null);return r}};return s}),n("src/Settings",["require","exports","module","cocoonjs/CocoonInclude","src/utils/Common"],function(t,e,i){"use strict";var s=t("cocoonjs/CocoonInclude"),t=t("src/utils/Common").paramStringToObject(window.location.search);return{ftaId:"flappycopter",ftaContainerId:"fta-ef",gmapiId:"flappycopter",cocoon:!!s,kik:!(!window.kik||!window.kik.enabled),inAppGames:t.hasOwnProperty("inappgames")||"ubersocialios"===t.utm_source&&"inapp"===t.utm_medium,width:480,height:690}}),n("src/gmapi",["require","exports","module","src/Settings"],function(t,e,i){"use strict";var s,n,a,o,r,t=t("src/Settings");return s=window,n=document,a="//gmapi.gamemix.com",o="gmapi",s.GameMixAPIName=o,s[o]=s[o]||function(t){s[o].q=s[o].q||[],s[o].q.push(t)},s[o]({apiDomain:a}),r=n.createElement("script"),n=n.getElementsByTagName("script")[0],r.type="text/javascript",r.async=!0,r.src=a+"/v1/gm.js",n.parentNode.insertBefore(r,n),window.gmapi&&window.gmapi(t.gmapiId),function(){window.gmapi&&window.gmapi.apply(window.gmapi,arguments)}}),n("src/fta",["require","exports","module","src/Settings"],function(t,e,i){"use strict";var t=t("src/Settings"),s=window,n=document,a="//demo.gamemix.com/flappytrilogy/fta.js",o="fta";return s["GM-FTA-Name"]=o,s.fta=s.fta||function(){s.fta.q=s.fta.q||[],s.fta.q.push(arguments)},s.fta({jsUrl:a}),o=n.createElement("script"),n=n.getElementsByTagName("script")[0],o.type="text/javascript",o.async=!0,o.src=a,n.parentNode.insertBefore(o,n),window.fta&&window.fta(t.ftaContainerId,t.ftaId),function(){window.fta&&window.fta.apply(window.fta,arguments)}}),n("j13e/math/J13Vec2",["require","exports","module"],function(t,e,i){"use strict";function s(t,e){this.x=t||0,this.y=e||0}return s.prototype={abs:function(){this.x<0&&(this.x=-this.x),this.y<0&&(this.y=-this.y)},add:function(t){this.x+=t.x,this.y+=t.y},subtract:function(t){this.x-=t.x,this.y-=t.y},multiply:function(t){this.x*=t,this.y*=t},mulM:function(t){var e=this.x;this.x=t.col1.x*e+t.col2.x*this.y,this.y=t.col1.y*e+t.col2.y*this.y},mulTM:function(t){},crossVF:function(t){var e=this.x;this.x=t*this.y,this.y=-t*e},crossFV:function(t){var e=this.x;this.x=-t*this.y,this.y=t*e},min:function(t){this.x=(this.x<t.x?this:t).x,this.y=(this.y<t.y?this:t).y},max:function(t){this.x=(this.x>t.x?this:t).x,this.y=(this.y>t.y?this:t).y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSquared:function(){return this.x*this.x+this.y*this.y},normalize:function(){var t,e=Math.sqrt(this.x*this.x+this.y*this.y);return e<Number.MIN_VALUE?0:(this.x*=t=1/e,this.y*=t,e)},copy:function(){return new s(this.x,this.y)},setZero:function(){this.x=0,this.y=0},getNegative:function(){return new s(-this.x,-this.y)},negativeSelf:function(){this.x=-this.x,this.y=-this.y},set:function(t,e){"number"==typeof t&&"number"==typeof e?(this.x=t,this.y=e):t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&(this.x=t.x,this.y=t.y)},setAngle:function(t){this.x=Math.cos(t),this.y=Math.sin(t)}},s}),n("j13e/math/J13Math",["require","exports","module","./J13Vec2"],function(t,e,i){"use strict";var s=t("./J13Vec2"),t={clamp:function(t,e,i){return e<t?t:i<e?i:e},dot:function(t,e){return t.x*e.x+t.y*e.y},crossVV:function(t,e){return t.x*e.y-t.y*e.x},crossVF:function(t,e){return new s(e*t.y,-e*t.x)},crossFV:function(t,e){return new s(-t*e.y,t*e.x)},mulMV:function(t,e){return new s(t.col1.x*e.x+t.col2.x*e.y,t.col1.y*e.x+t.col2.y*e.y)},distance:function(t,e){var i=t.x-e.x,t=t.y-e.y;return Math.sqrt(i*i+t*t)},distanceSquared:function(t,e){var i=t.x-e.x,t=t.y-e.y;return i*i+t*t},intersectCircCirc:function(t,e,i,s,n,a){return(t-s)*(t-s)+(e-n)*(e-n)<(i+a)*(i+a)},intersectRectCirc:function(t,e,i,s,n,a,o){n=Math.abs(n-t),t=Math.abs(a-e);return!(i/2+o<n)&&(!(i/2+o<t)&&(n<=i/2||(t<=s/2||(n-i/2)*(n-i/2)+(t-s/2)*(t-s/2)<=o*o)))},intersectRectRect:function(t,e,i,s,n,a,o,r){return 2*Math.abs(t-n)<i+o&&2*Math.abs(e-a)<s+r}};return t}),n("j13e/math/J13Rect",["require","exports","module","./J13Vec2","./J13Math"],function(t,e,i){"use strict";var s=t("./J13Vec2"),n=t("./J13Math");function a(t){t=t||{};this.left=t.left||0,this.top=t.top||0,this.right=t.right||0,this.bottom=t.bottom||0,t.hasOwnProperty("x")&&(this.left=t.x),t.hasOwnProperty("y")&&(this.top=t.y),t.hasOwnProperty("width")&&(this.right=this.left+t.width),t.hasOwnProperty("height")&&(this.bottom=this.top+t.height),this.checkDimensions()}return a.doRectsIntersect=function(t,e){return n.intersectRectRect(t.getCenterX(),t.getCenterY(),t.getWidth(),t.getHeight(),e.getCenterX(),e.getCenterY(),e.getWidth(),e.getHeight())},a.combine=function(t,e){var i=new a;return i.combine(t,e),i},a.isJ13Rect=function(t,e){if(!t)return!1;for(var i in a.IDENTITY)if(a.IDENTITY.hasOwnProperty(i)&&!t.hasOwnProperty(i))return!1;if(e)for(i in a.prototype)if(a.prototype.hasOwnProperty(i)&&!t.hasOwnProperty(i))return!1;return!0},a.canBeJ13Rect=function(t){t=t||{};return!(!t.hasOwnProperty("x")&&!t.hasOwnProperty("left")||!t.hasOwnProperty("y")&&!t.hasOwnProperty("top")||!t.hasOwnProperty("width")&&!t.hasOwnProperty("right")||!t.hasOwnProperty("height")&&!t.hasOwnProperty("bottom"))},a.prototype={getCenter:function(){return new s(this.getCenterX(),this.getCenterY())},getCenterX:function(){return(this.left+this.right)/2},getCenterY:function(){return(this.top+this.bottom)/2},setX:function(t){var e=this.getWidth();this.left=t,this.right=t+e},setY:function(t){var e=this.getHeight();this.top=t,this.bottom=t+e},setPosition:function(t,e){this.setX(t),this.setY(e)},checkDimensions:function(){var t;this.left>this.right&&(t=this.left,this.left=this.right,this.right=t),this.top>this.bottom&&(t=this.top,this.top=this.bottom,this.bottom=t)},translate:function(t,e){this.translateX(t),this.translateY(e)},translateX:function(t){this.left+=t,this.right+=t},translateY:function(t){this.top+=t,this.bottom+=t},getWidth:function(){return this.right-this.left},getHeight:function(){return this.bottom-this.top},setWidth:function(t){this.right=this.left+t},setHeight:function(t){this.bottom=this.top+t},containsPoint:function(t,e){return t>=this.left&&t<this.right&&e>=this.top&&e<this.bottom},intersectsRect:function(t){return a.doRectsIntersect(this,t)},copy:function(){return new a({left:this.left,top:this.top,right:this.right,bottom:this.bottom})},contains:function(t){return this.left<=t.left&&this.top<=t.top&&t.right<=this.right&&t.bottom<=this.bottom},combine:function(t,e){this.left=Math.min(t.left,e.left),this.top=Math.min(t.top,e.top),this.right=Math.max(t.right,e.right),this.bottom=Math.max(t.bottom,e.bottom)},addRect:function(t){this.left=Math.min(this.left,t.left),this.top=Math.min(this.top,t.top),this.right=Math.max(this.right,t.right),this.bottom=Math.max(this.bottom,t.bottom)}},a.IDENTITY=new a,a}),n("src/Resources",["require","exports","module","j13e/math/J13Rect"],function(t,e,i){"use strict";t=t("j13e/math/J13Rect");return{kikEnabled:!1,images:{flappy1:"imgs/Flappy1.png",flappy2:"imgs/Flappy2.png",bgDay:"imgs/bgDay.png",bgNight:"imgs/bgNight.png",stars:"imgs/stars.png",dayStars:"imgs/day-stars.png",bottomBar:"imgs/Bottom_fill.png",retryButton:"imgs/Button_retry.png",kikButton:"imgs/Button_kikit.png",rankButton:"imgs/Button_leaderboard.png",pipe:"imgs/Pipe.png",brick:"imgs/Brick.png",volumeSprite:"imgs/volumesprite.png",flappyGrey:"imgs/Flappy-grey.png",flappyMotion:"imgs/Flappy-motion.png",flappyArrow:"imgs/Flappy-arrow.png",arrow:"imgs/Arrow.png",hiScoreBg:"imgs/gameover.png",title:"imgs/title.png"},soundNames:{crash:"crash",fall:"fall",flap:"flap",menu:"menu",point:"point"},sounds:{crash:{urls:["sounds/s_crash.mp3","sounds/s_crash.ogg","sounds/s_crash.wav"],volume:1},fall:{urls:["sounds/s_fall.mp3","sounds/s_fall.ogg","sounds/s_fall.wav"],volume:1},flap:{urls:["sounds/s_flap.mp3","sounds/s_flap.ogg","sounds/s_flap.wav"],volume:1},menu:{urls:["sounds/s_menu.mp3","sounds/s_menu.ogg","sounds/s_menu.wav"],volume:1},point:{urls:["sounds/s_point.mp3","sounds/s_point.ogg","sounds/s_point.wav"],volume:1}},loadedImages:{},spriteMap:{volume:{main:{frameMap:{on:new t({x:0,y:0,width:100,height:90}),off:new t({x:110,y:0,width:100,height:90})},destRect:new t({x:0,y:0,width:50,height:45})}}},patterns:{},gameStates:{init:"init",preload:"preload",mainMenu:"mainmenu",intro:"intro",level:"level",paused:"paused",gameOver:"gameover",hiScore:"hiscore",appCache:"appcache"},anims:{},buttons:{start:"start",hiScore:"hiscore",kik:"kik",menu:"menu",retry:"retry",version:"version",rank:"rank",volume:"volume"},hitTypes:{tooLow:"toolow",pipe:"pipe",brick:"brick"},events:{gameInitted:"gameinitted"}}}),n("j13e/utils/J13Utils",["require","exports","module"],function(t,e,i){"use strict";var a={},s=window.Node,n=window.HTMLElement,o=window.navigator;a.nativeTypes=["Boolean","Number","String","Function","Array","Date","RegExp","Object"],a.class2type={};for(var r=0;r<a.nativeTypes.length;r+=1)a.class2type["[object "+a.nativeTypes[r]+"]"]=a.nativeTypes[r].toLowerCase();a.isNode=function(t){return"object"==typeof s?t instanceof s:t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},a.isElement=function(t){return"object"==typeof n?t instanceof n:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName},a.isArray=Array.isArray||function(t){return"array"===a.getType(t)},a.getType=function(t){return null===t?String(t):a.class2type[window.toString.call(t)]||"object"},a.isNativeObject=function(t){var e=t;return"object"==typeof t&&null!==t&&function(){for(;e=Object.getPrototypeOf(e););return Object.getPrototypeOf(t)===e}()},a.makeUnselectable=function(t,e){if(t&&(1===t.nodeType&&t.setAttribute("unselectable","on"),e))for(var i=t.firstChild;i;)a.makeUnselectable(i,e),i=i.nextSibling},a.addClass=function(t,e){var i,s,n=t.hasOwnProperty("className"),a=n?t.className:t.getAttribute("class"),o=[],r="object"==typeof e&&"number"==typeof e.length?e:[e];for("string"==typeof a&&0<a.length&&(o=a.split(" ")),s=0;s<r.length;s+=1)i=r[s],-1===o.indexOf(i)&&o.push(i);n?t.className=o.join(" "):t.setAttribute("class",o.join(" "))},a.removeClass=function(t,e){var i,s,n=t.hasOwnProperty("className"),a=n?t.className:t.getAttribute("class"),o=[],r="object"==typeof e&&"number"==typeof e.length?e:[e];for("string"==typeof a&&0<a.length&&(o=a.split(" ")),i=0;i<r.length;i+=1)s=r[i],-1!==(s=o.indexOf(s))&&o.splice(s,1);n?t.className=o.join(" "):t.setAttribute("class",o.join(" "))},a.hasClass=function(t,e){var i=[];return!!t.getAttribute&&-1!==(i="string"==typeof(t=t.hasOwnProperty("className")?t.className:t.getAttribute("class"))&&0<t.length?t.split(" "):i).indexOf(e)},a.extendObj=function(t,e,i){var s,n=a.cloneObject(e,i);for(s in t)t.hasOwnProperty(s)&&(i&&n.hasOwnProperty(s)&&"object"==typeof n[s]&&"object"==typeof t[s]&&(n[s]=a.extendObj(t[s],n[s],i)),n.hasOwnProperty(s)||(a.isNativeObject(t[s])?t[s]?n[s]=a.cloneObject(t[s],i):n[s]=null:n[s]=t[s]));return n},a.cloneObject=function(t,e){var i,s;if("string"==typeof t)i=t;else for(s in i={},t)t.hasOwnProperty(s)&&(e&&"object"==typeof t[s]?i[s]=a.cloneObject(t[s],e):i[s]=t[s]);return i},a.inherit=function(){for(var t,e,i=null,s=0;s<arguments.length;s+=1)if(e=null,arguments[s]&&("function"==typeof arguments[s]?e=new arguments[s]:"object"==typeof arguments[s]&&(e=arguments[s])),e)if(i)for(t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);else i=e;return i};var h={Android:function(){return o.userAgent.match(/Android/i)},FirefoxOS:function(){return-1===o.userAgent.indexOf("Android")&&0<=o.userAgent.indexOf("Firefox")&&0<=o.userAgent.indexOf("Mobile")},BlackBerry:function(){return o.userAgent.match(/BlackBerry/i)},iOS:function(){return o.userAgent.match(/iPhone|iPad|iPod/i)},iPod:function(){return o.userAgent.match(/iPod/i)},iPhone:function(){return o.userAgent.match(/iPhone/i)},iPad:function(){return o.userAgent.match(/iPad/i)},Opera:function(){return o.userAgent.match(/Opera Mini/i)},Windows:function(){return o.userAgent.match(/IEMobile/i)},any:function(){return h.Android()||h.BlackBerry()||h.iOS()||h.Opera()||h.Windows()||h.FirefoxOS()},Safari:function(){return h.iOS()&&!h.ChromeIOS()&&o.userAgent.match(/AppleWebKit/i)},iPhoneSafari:function(){return(h.iPhone()||h.iPod())&&!h.ChromeIOS()&&o.userAgent.match(/AppleWebKit/i)},ChromeIOS:function(){return h.iOS()&&o.userAgent.match("CriOS")},ChromeAndroid:function(){return o.userAgent.match(/Android.+Chrome|CrMo/i)}};return a.isMobile=h,a.addOnClick=function(t,e,i){t.onclick=e,i&&t.addEventListener("touchstart",function(t){return t.currentTarget.onclick(t),t.preventDefault(),t.stopPropagation(),!1},!1)},a.hexToRGB=function(t){t=t.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},a.rgbToHex=function(t,e,i){var s=-1,n=-1,a=-1;return"number"==typeof t&&"number"==typeof e&&"number"==typeof i?(s=t,n=e,a=i):t&&"object"==typeof t&&(t.hasOwnProperty("r")?s=t.r:t.hasOwnProperty("red")&&(s=t.red),t.hasOwnProperty("g")?n=t.g:t.hasOwnProperty("green")&&(n=t.green),t.hasOwnProperty("b")?a=t.b:t.hasOwnProperty("blue")&&(a=t.blue)),-1!==s&&-1!==n&&-1!==a?(e=(e=s.toString(16)).length<2?"0"+e:e)+(i=(i=n.toString(16)).length<2?"0"+i:i)+(t=(t=a.toString(16)).length<2?"0"+t:t):"000000"},a.getColorType=function(t){var e;return"#"===t[0]||6===t.length?"hex":-1!==(e=t.indexOf("("))?t.substring(0,e).trim().toLowerCase():null},a.getRGBFromRGBString=function(t){var e=t.indexOf("("),i=t.indexOf(")"),i=t.substring(e+1,i).split(","),t=t.substring(0,e).trim().toLowerCase();return"rgb"===t?{r:parseInt(i[0].trim(),10),g:parseInt(i[1].trim(),10),b:parseInt(i[2].trim(),10),type:t}:"rgba"===t?{r:parseInt(i[0].trim(),10),g:parseInt(i[1].trim(),10),b:parseInt(i[2].trim(),10),a:parseInt(i[3].trim(),10),type:t}:"argb"===t?{a:parseInt(i[0].trim(),10),r:parseInt(i[1].trim(),10),g:parseInt(i[2].trim(),10),b:parseInt(i[3].trim(),10),type:t}:null},a.getRGBFromColorString=function(t){var e,i=a.getColorType(t);return"hex"===i?((e=a.hexToRGB(t)).type=i,e):a.getRGBFromRGBString(t)},a.getColorStringFromRGB=function(t,e,i,s,n){return"hex"===n?"#"+a.rgbToHex(t,e,i):"rgb"===n?"rgb("+t+","+e+","+i+")":"rgba"===n?"rgba("+t+","+e+","+i+","+s+")":"argb"===n?"argb("+s+","+t+","+e+","+i+")":null},a}),n("j13e/utils/J13DOM",["require","exports","module","./J13Utils"],function(t,e,i){"use strict";var s=t("./J13Utils");return new function(){var e={};this.get=function(t){return e[t]||(e[t]=document.getElementById(t)),e[t]},this.create=function(t,e,i){t=document.createElement(t);return t.hasOwnProperty("id")?t.id=e:t.setAttribute("id",e),s.addClass(t,i),t}}}),n("src/efs/Ef",["require","exports","module","j13e/utils/J13Utils"],function(t,e,i){"use strict";var s=t("j13e/utils/J13Utils");function n(t){t=t||{};this.game=t.game||null,this.shouldShowFunction=t.shouldShowFunction||function(){return!1},this.enabled=!t.hasOwnProperty("enabled")||t.enabled,this.platforms=t.platforms||n.platforms.DESKTOP|n.platforms.MOBILE|n.platforms.TABLET,this.adInterval=t.adInterval||1,this.initted=!1,this.started=!1}return n.platforms={DESKTOP:1,MOBILE:2,TABLET:4},n.getCurrentPlatform=function(){return s.isMobile.any()?768<=(window.innerWidth||document.documentElement.clientWidth)?n.platforms.TABLET:n.platforms.MOBILE:n.platforms.DESKTOP},n.prototype={init:function(){this.enabled&&(this.initted=!0)},start:function(){this.enabled&&(this.started=!0)},rotate:function(){},show:function(){},hide:function(){},showContainer:function(){},hideContainer:function(){},shouldShow:function(t){return!(!this.initted||!this.enabled)&&this.shouldShowFunction(t||this.adInterval)}},n}),n("src/efs/EfInits",["require","exports","module"],function(t,e,i){"use strict";return[]}),n("src/efs/EfCocoon",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils","cocoonjs/CocoonInclude"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfInits"),a=(t("j13e/utils/J13DOM"),t("j13e/utils/J13Utils")),o=t("cocoonjs/CocoonInclude");function r(t){s.call(this,t),this.hasCocoonJS=!(!o||!o.Ad),this.hasCocoonJS||(this.enabled=!1),r.adsToInitialize.push(this)}return r.adsToInitialize=[],r.cocoonAdInit=function(t){var e;o&&o.Ad&&0<r.adsToInitialize.length&&(e=!1,r.adsToInitialize.forEach(function(t){t.enabled&&(e=!0),t.init()}),e&&(o.Ad.onFullScreenShown.addEventListener(function(){console.log("fullscreen shown"),o.Ad.refreshFullScreen()}),o.Ad.onFullScreenHidden.addEventListener(function(){console.log("fullscreen hidden"),t.hideInterstitial()}),o.Ad.onFullScreenReady.addEventListener(function(){console.log("fullscreen ready"),r.adsToInitialize.forEach(function(t){t.start()})}),setTimeout(function(){o.Ad.preloadFullScreen()},1e3)))},r.prototype=a.inherit(new s,{start:function(){this.initted&&!this.started&&this.canRun()&&s.prototype.start.call(this)},rotate:function(){},show:function(){this.initted&&this.canRun()&&o.Ad.showFullScreen()},hide:function(){},shouldShow:function(t){return!(!this.started||!this.canRun())&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.hasCocoonJS}}),n.push(r.cocoonAdInit),r}),n("src/efs/EfMopub",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils"],function(t,e,i){"use strict";var a=t("./Ef"),s=t("./EfInits"),n=t("j13e/utils/J13DOM"),o=t("j13e/utils/J13Utils");function r(t){var e=t||{};a.call(this,t),this.adUnitId=e.adUnitId||null,this.adContainerId=e.adContainerId||null,this.size=e.size||null,this.keywords=e.keywords||"",r.slotsToDefine.push(this)}return r.slotsToDefine=[],r.mopubInit=function(){if(0<r.slotsToDefine.length){window.mopub=[];for(var t,e,i,s=a.getCurrentPlatform(),n=0;n<r.slotsToDefine.length;n+=1)(t=r.slotsToDefine[n])&&0<(t.platforms&s)&&t.enabled&&t.adUnitId&&t.size&&t.adContainerId&&(window.mopub.push({ad_unit:t.adUnitId,ad_container_id:t.adContainerId,ad_width:t.size[0],ad_height:t.size[1],keywords:t.keywords}),t.init());0<window.mopub.length&&((e=document.createElement("script")).async=!0,e.type="text/javascript",e.src="//d1zg4cyg8u4pko.cloudfront.net/mweb/mobileweb.min.js",(i=document.getElementsByTagName("script")[0]).parentNode.insertBefore(e,i))}},r.prototype=o.inherit(new a,{start:function(){this.initted&&!this.started&&this.canRun()&&a.prototype.start.call(this)},rotate:function(){this.initted&&this.canRun()&&(this.started||this.start())},show:function(){this.initted&&this.canRun()&&o.addClass(n.get(this.adContainerId),"show")},hide:function(){this.initted&&this.canRun()&&o.removeClass(n.get(this.adContainerId),"show")},showContainer:function(){this.initted&&this.adContainerId&&n.get(this.adContainerId)&&this.canRun()&&o.addClass(n.get(this.adContainerId),"show")},hideContainer:function(){this.initted&&this.adContainerId&&n.get(this.adContainerId)&&this.canRun()&&o.removeClass(n.get(this.adContainerId),"show")},shouldShow:function(t){return!!this.canRun()&&a.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.adUnitId&&this.size&&this.adContainerId}}),s.push(r.mopubInit),r}),n("src/efs/EfLeadBolt",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfInits"),a=t("j13e/utils/J13DOM"),o=t("j13e/utils/J13Utils");function r(t){var e=t||{};s.call(this,t),this.url=e.url||null,this.divId=e.divId||null,this.size=e.size||null,this.type=e.type||null,r.adsToInitialize.push(this)}return r.types={banner:"banner",iframe:"iframe"},r.adsToInitialize=[],r.adsInit=function(t){r.adsToInitialize.forEach(function(t){t&&t.enabled&&t.divId&&t.type&&(t.type===r.types.iframe&&t.url&&t.size||t.type===r.types.banner)&&t.init()})},r.prototype=o.inherit(new s,{start:function(){var t,e;this.initted&&!this.started&&this.canRun()&&(this.type===r.types.iframe&&(t=a.get(this.divId))&&((e=a.create("iframe","meow")).src=this.url,e.style.width=this.size[0]+"px",e.style.height=this.size[1]+"px",e.style.margin="0 0",e.setAttribute("frameborder","0"),e.setAttribute("allowtransparency","true"),e.setAttribute("scrolling","no"),t.appendChild(e)),s.prototype.start.call(this))},rotate:function(){},show:function(){var t;this.initted&&this.canRun()&&((t=a.get(this.divId))&&(this.started||this.start(),o.addClass(t,"show")))},hide:function(){var t;this.initted&&this.canRun()&&((t=a.get(this.divId))&&o.removeClass(t,"show"))},shouldShow:function(t){return!(!this.initted||!this.canRun())&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.divId&&this.type}}),n.push(r.adsInit),r}),n("src/efs/EfInApp",["require","exports","module","./Ef","j13e/utils/J13DOM","j13e/utils/J13Utils","./EfInits"],function(t,e,i){"use strict";var s=t("./Ef"),n=(t("j13e/utils/J13DOM"),t("j13e/utils/J13Utils")),t=t("./EfInits");function a(t){s.call(this,t),a.adsToInitialize.push(this)}return a.adsToInitialize=[],a.inAppGamesInit=function(t){window.G=window.G||{},window.G.initAds&&(a.adsToInitialize.forEach(function(t){t.enabled,t.adInterval=window.G.adInterval||t.adInterval,t.init()}),window.G.initAds())},a.prototype=n.inherit(new s,{init:function(){s.prototype.init.call(this),this.start()},start:function(){this.initted&&!this.started&&this.canRun()&&s.prototype.start.call(this)},rotate:function(){},show:function(){this.initted&&this.canRun()&&window.G.showAd()},hide:function(){},shouldShow:function(t){return!(!this.started||!this.canRun())&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&window.G.hasOwnProperty("initAds")&&window.G.hasOwnProperty("showAd")}}),t.push(a.inAppGamesInit),a}),n("src/efs/InterstitialEfs",["require","exports","module","./Ef","./EfCocoon","./EfMopub","./EfLeadBolt","./EfInApp"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfCocoon"),a=t("./EfMopub"),o=(t("./EfLeadBolt"),t("./EfInApp"));return{getInAppAds:function(e){return[new o({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},enabled:!0})]},getNativeAds:function(e){return[new n({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},enabled:!0})]},getWebAds:function(e){return[new a({game:e,adInterval:2,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.MOBILE,adUnitId:"c275f124cf5b4cfabbb4f1f6748b0479",adContainerId:"div-mopub-ad",size:[300,250],keywords:"",enabled:!0}),new a({game:e,adInterval:2,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.TABLET,adUnitId:"5cc4fba531564913a118c67539ecdd3e",adContainerId:"div-mopub-ad",size:[300,250],keywords:"",enabled:!0})]}}}),n("src/efs/EfGoogleTag",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils","src/Settings"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfInits"),a=t("j13e/utils/J13DOM"),o=t("j13e/utils/J13Utils");t("src/Settings");function r(t){var e=t||{};s.call(this,t),this.adSlot=null,this.unitName=e.unitName||null,this.size=e.size||null,this.divId=e.divId||null,this.containerDivId=e.containerDivId||null,this.hasGoogleTag=!1,this.started=!1,window.googletag?this.hasGoogleTag=!0:this.enabled=!1,r.slotsToDefine.push(this)}return r.slotsToDefine=[],r.googletagInit=function(){window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],window.googletag.cmd.push(function(){for(var t,e=s.getCurrentPlatform(),i=0;i<r.slotsToDefine.length;i+=1)(t=r.slotsToDefine[i])&&0<(t.platforms&e)&&t.enabled&&t.unitName&&t.size&&t.divId&&(t.adSlot=window.googletag.defineSlot(t.unitName,t.size,t.divId).addService(window.googletag.pubads()),t.init());window.googletag.pubads().enableSingleRequest(),window.googletag.enableServices()})},r.prototype=o.inherit(new s,{start:function(){var t;this.initted&&!this.started&&this.canRun()&&(s.prototype.start.call(this),t=this.divId,window.googletag.cmd.push(function(){window.googletag.display(t)}))},rotate:function(){var t,e;this.initted&&this.canRun()&&(t=!1,this.started||(this.start(),t=!0),t||(e=this.adSlot,window.googletag.cmd.push(function(){window.googletag.pubads().refresh([e])})))},show:function(){this.initted&&this.canRun()&&(a.get(this.divId).style.width=this.size[0]+"px",a.get(this.divId).style.height=this.size[1]+"px",o.addClass(a.get(this.divId),"show"))},hide:function(){this.initted&&this.canRun()&&o.removeClass(a.get(this.divId),"show")},showContainer:function(){this.initted&&this.containerDivId&&a.get(this.containerDivId)&&this.canRun()&&o.addClass(a.get(this.containerDivId),"show")},hideContainer:function(){this.initted&&this.containerDivId&&a.get(this.containerDivId)&&this.canRun()&&o.removeClass(a.get(this.containerDivId),"show")},shouldShow:function(t){return!!this.canRun()&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.hasGoogleTag&&this.unitName&&this.size&&this.divId&&a.get(this.divId)}}),n.push(r.googletagInit),r}),n("j13e/utils/J13Event",["require","exports","module"],function(t,e,i){"use strict";return function(t){t=t||{},this.name=t.name,this.source=t.source,this.data=t.data}}),n("j13e/utils/J13EventDispatcher",["require","exports","module","./J13Event"],function(t,e,i){"use strict";var s=t("./J13Event");function n(t){this.eventMap={}}return n.prototype={addListener:function(t,e){return!(!t||!e||(this.eventMap[t]||(this.eventMap[t]=[]),-1!==this.eventMap[t].indexOf(e)))&&(this.eventMap[t].push(e),!0)},removeListener:function(t,e){if(t&&e&&this.eventMap[t]){e=this.eventMap[t].indexOf(e);if(-1!==e)return this.eventMap[t].splice(e,1),!0}return!1},removeAllListeners:function(t){if(t)for(;0<this.eventMap[t].length;)this.eventMap[t].pop();else this.eventMap={}},dispatch:function(t,e){if(t&&this.eventMap[t])for(var i=0;i<this.eventMap[t].length;i+=1)this.eventMap[t][i](new s({source:this,data:e,name:t}))}},n}),n("src/efs/EfManager",["require","exports","module","./Ef","./EfGoogleTag","./EfCocoon","./EfInApp","./EfInits","j13e/utils/J13Utils","j13e/utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("./Ef"),n=(t("./EfGoogleTag"),t("./EfCocoon"),t("./EfInApp"),t("./EfInits")),a=t("j13e/utils/J13Utils"),t=t("j13e/utils/J13EventDispatcher");function o(t){t=t||{};this.interstitialScreen=t.interstitialScreen,this.interstitialClose=t.interstitialClose,this.gameOverAdScreen=t.gameOverAdScreen,this.interstitialAds=t.interstitialAds||[],this.currentInterstitialAd=null,this.gameOverAds=t.gameOverAds||[],this.currentGameOverAd=null,this.lastGameOverAdRotate=0,this.enabled=!0,this.interestitialHideCallback=null,this.gameOverHideCallback=null,this.game=t.game||null,this.events=o.events,this.desktopPage=!1,this.init()}return o.GAMEOVERROTATEDELAY=3e4,o.events={INTERSTITIALREFRESHED:"interstitialrefreshed",INTERSTITIALSHOWN:"interstitialshown",INTERSTITIALHIDDEN:"interstitialhidden",GAMEOVERADREFRESHED:"gameoveradrefreshed",GAMEOVERADSHOWN:"gameoveradshown",GAMEOVERADHIDDEN:"gameoveradhidden"},o.prototype=a.inherit(new t,{init:function(){var i=this;this.interstitialScreen&&a.addOnClick(this.interstitialScreen,function(t){for(var e=t.target;e=t.currentTarget===e?(i.hideInterstitial(),null):a.hasClass(e,"dismissableArea")?e.parentNode:null;);},!0),this.interstitialClose&&a.addOnClick(this.interstitialClose,this.hideInterstitial.bind(this),!0),n.forEach(function(t){"function"==typeof t&&t(i)})},setGame:function(t){var e;for(this.game=t,e=0;e<this.interstitialAds.length;e+=1)this.interstitialAds[e].game=t;for(e=0;e<this.gameOverAds.length;e+=1)this.gameOverAds[e].game=t},isInterstitialShowing:function(){return!(!this.enabled||!this.interstitialScreen)&&a.hasClass(this.interstitialScreen,"show")},refreshInterstitial:function(){var t;this.enabled&&(t=this.getInterstitialAd())&&(t.rotate(),this.dispatch(o.events.INTERSTITIALREFRESHED,{ad:t}))},showInterstitial:function(t){this.enabled&&(this.interestitialHideCallback=t,this.currentInterstitialAd&&this.currentInterstitialAd.show(),this.interstitialScreen&&a.addClass(this.interstitialScreen,"show"),this.dispatch(o.events.INTERSTITIALSHOWN,{ad:this.currentInterstitialAd}))},hideInterstitial:function(){this.interstitialScreen&&a.removeClass(this.interstitialScreen,"show"),this.currentInterstitialAd&&this.currentInterstitialAd.hide(),this.interestitialHideCallback&&(this.interestitialHideCallback(),this.interestitialHideCallback=null),this.dispatch(o.events.INTERSTITIALHIDDEN,{ad:this.currentInterstitialAd})},shouldShowInterstitial:function(){var t;return!!this.enabled&&(!!(t=this.getInterstitialAd())&&t.shouldShow())},getInterstitialAd:function(){if(this.enabled&&!this.currentInterstitialAd)for(var t=s.getCurrentPlatform(),e=0;e<this.interstitialAds.length&&!this.currentInterstitialAd;e+=1)this.interstitialAds[e].shouldShow()&&0<(this.interstitialAds[e].platforms&t)&&(this.currentInterstitialAd=this.interstitialAds[e]);return this.currentInterstitialAd},isGameOverAdShowing:function(){return!(!this.enabled||!this.gameOverAdScreen)&&a.hasClass(this.gameOverAdScreen,"show")},refreshGameOverAd:function(){var t,e;this.enabled&&(t=(new Date).getTime(),(e=this.getGameOverAd())&&t-this.lastGameOverAdRotate>=o.GAMEOVERROTATEDELAY&&(e.rotate(),this.lastGameOverAdRotate=t,this.dispatch(o.events.GAMEOVERADREFRESHED,{ad:e})))},showGameOverAd:function(t){this.enabled&&this.gameOverAdScreen&&(this.gameOverHideCallback=t,a.addClass(this.gameOverAdScreen,"show"),this.dispatch(o.events.GAMEOVERADSHOWN,{ad:this.currentGameOverAd}))},hideGameOverAd:function(){this.gameOverAdScreen&&a.removeClass(this.gameOverAdScreen,"show"),this.gameOverHideCallback&&(this.gameOverHideCallback(),this.gameOverHideCallback=null),this.dispatch(o.events.GAMEOVERADHIDDEN,{ad:this.currentGameOverAd})},shouldShowGameOverAd:function(){var t;return!!this.enabled&&(!!(t=this.getGameOverAd())&&t.shouldShow())},getGameOverAd:function(){if(this.enabled&&!this.currentGameOverAd)for(var t=s.getCurrentPlatform(),e=0;e<this.gameOverAds.length&&!this.currentGameOverAd;e+=1)this.gameOverAds[e].shouldShow()&&0<(this.gameOverAds[e].platforms&t)&&(this.currentGameOverAd=this.gameOverAds[e],this.currentGameOverAd.show());return this.currentGameOverAd}}),o}),n("j13e/display/J13ButtonManager",["require","exports","module","../utils/J13Utils","../utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("../utils/J13EventDispatcher");function a(t){var e,i=t||{},s=(n.call(this,t),i.buttons||[]);for(this.buttons=[],this.downedButton=null,this.hoveredButton=null,e=0;e<s.length;e+=1)this.addButton(s[e])}return a.events={DOWN:"down",UP:"up",HOVERIN:"hoverin",HOVEROUT:"hoverout",MOVE:"move",CLICK:"click"},a.prototype=s.inherit(new n,{events:a.events,addButton:function(t){return-1===this.buttons.indexOf(t)&&(this.buttons.push(t),!0)},removeButton:function(t){t=this.buttons.indexOf(t);return-1!==t&&(this.buttons.splice(t,1),!0)},onDown:function(t){var e,i;this.downedButton||(e=t.data.scaledX,i=t.data.scaledY,this.downedButton=this.getButtonFromCoords(e,i),this.downedButton&&(this.hoveredButton=null,this.downedButton.down(t),this.dispatch(a.events.DOWN,{button:this.downedButton})))},onMove:function(t){var e=t.data.scaledX,i=t.data.scaledY;this.downedButton?this.downedButton.isUp()&&this.downedButton.contains(e,i)?this.downedButton.down(t):this.downedButton.isDown()&&!this.downedButton.contains(e,i)&&this.downedButton.up(t):this.hoveredButton?this.hoveredButton.contains(e,i)||(this.hoveredButton.hoverOut(t),this.dispatch(a.events.HOVEROUT,{button:this.hoveredButton}),this.hoveredButton=null):(e=this.getButtonFromCoords(e,i))&&((this.hoveredButton=e).hover(t),this.dispatch(a.events.HOVERIN,{button:this.hoveredButton}))},onUp:function(t){this.downedButton&&(this.downedButton.isDown()&&(this.downedButton.click(t),this.dispatch(a.events.CLICK,{button:this.downedButton})),this.downedButton.up(t),this.dispatch(a.events.UP,{button:this.downedButton}),this.downedButton=null)},getButtonFromCoords:function(t,e){for(var i=this.buttons.length-1;0<=i;--i)if(this.buttons[i].isEnabled()&&this.buttons[i].isButtonVisibleOnStage()&&this.buttons[i].contains(t,e))return this.buttons[i];return null}}),a}),n("j13e/anim/J13Anim",["require","exports","module"],function(t,e,i){"use strict";function s(t){t=t||{};this.id=t.id||"anim-"+s.IDPOOL++,this.manager=t.manager,this.startValue=t.startValue||0,this.endValue=t.endValue||0,this.timeFunction=t.timeFunction||s.easingFunctions.linear,this.startCallback=t.startCallback||null,this.stepCallback=t.stepCallback||null,this.endCallback=t.endCallback||null,this.duration=t.hasOwnProperty("duration")?t.duration:0,this.iterations=t.hasOwnProperty("iterations")?t.iterations:1,this.data=t.data||null,this.useLogicTime=t.useLogicTime||!1,this.restartRequested=!1,this.prepared=!1,this.startTime=-1,this.endTime=-1,this.iterationsPlayed=0}return s.IDPOOL=0,s.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},s.iterationConstants=s.iterationCount={one:1,infinite:0},s.prototype={recalculateDuration:function(){},requestRestart:function(){this.restartRequested=!0},preStart:function(){this.prepared=!1,this.startTime=-1,(this.endTime=-1)===this.iterationsPlayed&&(this.iterationsPlayed=0),this.restartRequested=!1,this.recalculateDuration()},start:function(t,e){this.prepared=!0,this.startTime=this.useLogicTime?e:t,this.endTime=this.startTime+this.duration,this.restartRequested=!1,this.iterationsPlayed+=1,this.startCallback&&this.startCallback(this.startValue,0,0,this.data)},step:function(t,e){var e=((this.useLogicTime?e:t)-this.startTime)/this.duration,t=(1<e?e=1:e<0&&(e=0),this.timeFunction(e)),i=this.startValue+(this.endValue-this.startValue)*t;this.stepCallback&&this.stepCallback(i,t,e,this.data)},end:function(){this.prepared=!1,this.startTime=-1,this.endTime=-1,this.endCallback&&this.endCallback(this.endValue,1,1,this.data)},stop:function(){this.prepared=!1,this.startTime=-1,this.endTime=-1,this.iterationsPlayed=-1},shouldBeAnimating:function(t,e){return this.useLogicTime?e>=this.startTime&&e<this.endTime:t>=this.startTime&&t<this.endTime},shouldBeDone:function(t,e){return this.useLogicTime?e>=this.endTime:t>=this.endTime}},s}),n("j13e/anim/J13AnimSequence",["require","exports","module","../utils/J13Utils","./J13Anim"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),o=t("./J13Anim");function n(t){var e=t||{};o.call(this,t),this.anims=e.anims||[],this.overrideUseLogicTime=e.overrideUseLogicTime||!1,this.recalculateDuration(),this.currentIndex=this.anims.length}return n.prototype=s.inherit(new o,{recalculateDuration:function(){for(var t=0,e=0;e<this.anims.length;e+=1)t+=this.anims[e].duration;this.duration=t},preStart:function(){for(var t=0;t<this.anims.length;t+=1)this.anims[t].data||(this.anims[t].data=this.data),this.anims[t].preStart();o.prototype.preStart.call(this)},start:function(t,e){var i,s=0;for(this.currentIndex=0,o.prototype.start.call(this,t,e),i=0;i<this.anims.length;i+=1){var n,a=this.anims[i];this.overrideUseLogicTime?(n=this.useLogicTime?e:t,a.useLogicTime=this.useLogicTime):n=a.useLogicTime?e:t,a.startTime=n+s,a.endTime=a.startTime+a.duration,s+=a.duration}},step:function(t,e){if(o.prototype.step.call(this,t,e),this.currentIndex<this.anims.length)for(var i,s;s=!1,(i=this.anims[this.currentIndex])&&(i.prepared||i.start(i.startTime,i.startTime),i.shouldBeAnimating(t,e)?(i.step(t,e),s=!1):i.shouldBeDone(t,e)&&(i.step(t,e),i.end(),this.currentIndex+=1,s=!0)),s;);},end:function(){o.prototype.end.call(this),this.currentIndex=this.anims.length},stop:function(){var t;for(o.prototype.stop.call(this),this.currentIndex=this.anims.length,t=0;t<this.anims.length;t+=1)this.anims[t].stop()}}),n}),n("src/utils/GameStateManager",["require","exports","module","j13e/utils/J13Utils","j13e/anim/J13Anim","j13e/anim/J13AnimSequence","j13e/utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("j13e/utils/J13Utils"),a=t("j13e/anim/J13Anim"),o=t("j13e/anim/J13AnimSequence"),t=t("j13e/utils/J13EventDispatcher");function r(t){var e=t||{};this.game=e.game||null,this.animManager=e.animManager||null,this.states={},this.currentState=null,this.oldState=null,this.newState=null,this.transitioning=!1,this.queue=[],e.states&&(Array.isArray(e.states)?e.states.forEach(function(t){this.states[t.id]=t},this):s.isNativeObject(e.states)&&Object.keys(e.states).forEach(function(t){this.states[t]=e.states[t]},this)),e.startState&&this.toState(e.startState)}return r.events={stateChanged:"statechanged",transitionStarted:"transitionstarted",transitionEnded:"transitionended"},r.prototype=s.inherit(new t,{events:r.events,getCurrentStateId:function(){return this.currentState?this.currentState.id:null},addState:function(t,e){e=e||t.id,this.states[e]=t},removeState:function(t){t="string"==typeof t?t:t.id;t&&delete this.states[t]},toState:function(t,e,i,s){var n;this.transitioning&&s?this.queue.push({stateOrId:t,data:e,noAnim:i}):(n="string"==typeof t?this.states[t]:t,s=[],this.transitioning=!0,this.dispatch(r.events.transitionStarted,{oldState:this.currentState,newState:n}),s.push(new a({duration:0,startCallback:function(){this.newState=n,this.newState&&this.newState.preStart(this.game,e),this.currentState&&this.currentState.preEnd(this.game,e)}.bind(this)})),this.currentState&&this.currentState.endAnim&&s.push(this.currentState.endAnim),s.push(new a({duration:0,startCallback:function(){this.oldState=this.currentState,this.currentState=this.newState,this.newState=null,this.dispatch(r.events.stateChanged,{newState:this.currentState,oldState:this.oldState,stateData:e}),this.oldState&&this.oldState.end(this.game,e),this.currentState&&this.currentState.start(this.game,e)}.bind(this)})),n&&n.startAnim&&s.push(n.startAnim),s.push(new a({duration:0,startCallback:function(){this.currentState&&this.currentState.postStart(this.game,e),this.oldState&&this.oldState.postEnd(this.game,e);var t=this.oldState;this.oldState=null,this.transitioning=!1,this.dispatch(r.events.transitionEnded,{oldState:t,newState:this.currentState}),0<this.queue.length&&(t=this.queue.shift(),this.toState(t.stateOrId,t.data,t.noAnim))}.bind(this)})),this.animManager&&!i?(t=new o({anims:s}),this.animManager.startAnim(t)):s.forEach(function(t){t.startCallback(t.startValue,0,0),t.stepCallback(t.startValue,0,0),t.stepCallback(t.endValue,1,1),t.endCallback(t.endValue,1,1)}))}}),r}),n("src/utils/Scouter",["require","exports","module","src/Resources","src/utils/Common","src/Settings","src/Game","src/efs/EfManager","j13e/utils/J13Utils","j13e/display/J13ButtonManager","src/utils/GameStateManager"],function(t,e,i){"use strict";var s=t("src/Resources"),o=t("src/utils/Common"),r=t("src/Settings"),n=(t("src/Game"),t("src/efs/EfManager")),a=t("j13e/utils/J13Utils"),h=t("j13e/display/J13ButtonManager"),l=t("src/utils/GameStateManager");function d(t){t=t||{};this.game=t.game||null,this.pageObj={page:r.cocoon?"/native":location.pathname,title:document.title},this.platform=d.web,this.debugTrace=t.debugTrace||!1,this.sendToGA=!t.hasOwnProperty("sendToGA")||t.sendToGA,this.init()}return d.platforms={kik:"kik",web:"web",native:"native"},d.prototype={init:function(){this.game.addListener(s.events.gameInitted,this.gameInitted.bind(this)),this.game.engine.buttonManager.addListener(h.events.CLICK,this.onButtonClick.bind(this)),s.adManager.addListener(n.events.INTERSTITIALSHOWN,this.onAdShow.bind(this)),s.adManager.addListener(n.events.INTERSTITIALHIDDEN,this.onAdClose.bind(this)),s.gsm.addListener(l.events.stateChanged,this.onStateChange.bind(this))},gameInitted:function(t){var e,i={},s=!1,n=this.game.initialUrlQuery,a=o.paramStringToObject(window.location.hash.replace("#",""));for(e in r.kik&&(s=i.kik=!0),n)n.hasOwnProperty(e)&&(i[e]=n[e],s=!0);for(e in a)if(a.hasOwnProperty(e))switch(e){case"utm_source":case"utm_medium":case"utm_term":case"utm_content":case"utm_campaign":i[e]=a[e],s=!0}s&&this.gaSetCurrentPage((r.cocoon?"/native?":"/?")+o.objectToParamString(i),document.title),this.gaPageView(),r.kik?this.platform=d.platforms.kik:"true"===n.native||"1"===n.native||r.cocoon?this.platform=d.platforms.native:this.platform=d.platforms.web},onButtonClick:function(t){if(t&&t.data&&t.data.button&&t.data.button.id){var e="button-clicked-"+this.platform,i=null;switch(t.data.button.id){case s.buttons.start:i="button-play";break;case s.buttons.retry:i="button-retry";break;case s.buttons.hiScore:i="button-hi-score";break;case s.buttons.menu:i="button-menu";break;case s.buttons.kik:i="button-kik-share";break;case s.buttons.version:i="button-version";break;case s.buttons.volume:i="button-volume";break;case s.buttons.rank:i="button-rank"}e&&i&&(i+="-"+this.platform,this.gaEvent("gameevent",e,i))}},onAdShow:function(t){var e;t.data&&t.data.ad&&(t="ad-"+this.platform,e="ad-show-"+this.platform,this.gaEvent("gameevent",t,e))},onAdClose:function(t){var e;t.data&&t.data.ad&&(t="ad-"+this.platform,e="ad-close-"+this.platform,this.gaEvent("gameevent",t,e))},onStateChange:function(t){var e,i;t&&t.data&&t.data.newState&&t.data.newState.id&&(i=e=null,t.data.newState.id===s.gameStates.hiScore&&(e="gameover-"+this.platform,i="gameover-score-"+this.game.playScreen.score+"-"+this.platform,window.gmga&&window.gmga("gamedone")),e&&this.gaEvent("gameevent",e,i,null))},sendGameOver:function(){var t="gameover-"+this.platform,e="gameover-bounces-"+this.game.playScreen.playScreen.score+"-"+this.platform;window.gmga&&window.gmga("gamedone"),t&&this.gaEvent("gameevent",t,e,null)},gaSend:function(t){window.ga&&(this.sendToGA&&window.ga("send",t),this.debugTrace&&console.log("gaevent:",t))},gaEvent:function(t,e,i,s){window.ga&&(this.sendToGA&&window.ga("send","event",t,e,i,s),this.debugTrace&&console.log("gaevent:","event",t,e,i,s))},gaNonInteractionEvent:function(t,e,i,s){this.gaSend({hitType:"event",eventCategory:t,eventAction:e,eventLabel:i,eventValue:s,nonInteraction:1})},gaPageView:function(t){window.ga&&(t=t?a.extendObj(this.pageObj,t):this.pageObj,this.sendToGA&&window.ga("send","pageview",t),this.debugTrace&&console.log("gaevent:","pageview",t))},gaSetCurrentPage:function(t,e){this.pageObj={page:t,title:e},this.gaSet(this.pageObj)},gaSet:function(t){window.ga&&(this.sendToGA&&window.ga("set",t),this.debugTrace&&console.log("gaevent:","set",t))}},d}),n("src/utils/GameState",["require","exports","module"],function(t,e,i){"use strict";return function(t){t=t||{},this.id=t.id||null,this.preStart=t.preStart||function(){},this.startAnim=t.startAnim||null,this.start=t.start||function(){},this.postStart=t.postStart||function(){},this.preEnd=t.preEnd||function(){},this.endAnim=t.endAnim||null,this.end=t.end||function(){},this.postEnd=t.postEnd||function(){}}}),n("src/utils/Updatable",["require","exports","module"],function(t,e,i){"use strict";function s(t){}return s.prototype={update:function(t,e,i,s){}},s}),n("j13e/display/J13DisplayItem",["require","exports","module","../utils/J13Utils","../utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("../utils/J13EventDispatcher"),a=2*Math.PI;function o(t){var e=t||{};n.call(this,t),this.parent=null,this.x=e.x||0,this.y=e.y||0,this.anchorX=e.anchorX||0,this.anchorY=e.anchorY||0,this.scaleX=e.hasOwnProperty("scaleX")?e.scaleX:1,this.scaleY=e.hasOwnProperty("scaleY")?e.scaleY:1,this.angle=e.angle||0,this.opacity=e.hasOwnProperty("opacity")?e.opacity:1,this.visible=!e.hasOwnProperty("visible")||e.visible,this.roundPosition=e.roundPosition||!1,e.hasOwnProperty("scale")&&this.setScale(e.scale),this.interpolated=e.interpolated||!1,this.interpolateFullAngle=!e.hasOwnProperty("interpolateFullAngle")||e.interpolateFullAngle,this.calculateInterpolation=e.calculateInterpolation||null,this.prevProps={},this.curProps={},this.propDeltas={},this.setInterpolated(this.interpolated),this.addListener(o.events.added,this.onSelfAdded)}return o.events={addedToStage:"addedtostage",removedFromStage:"removedfromstage",added:"added",removed:"removed"},o.prototype=s.inherit(Object.create(n.prototype),{events:o.events,onSelfAdded:function(t){t.source.interpolated&&t.source.updatePreviousProperties()},setInterpolated:function(t){this.interpolated=t,this.interpolated?(this.prevProps={x:this.x,y:this.y,anchorX:this.anchorX,anchorY:this.anchorY,scaleX:this.scaleX,scaleY:this.scaleY,angle:this.angle,opacity:this.opacity},this.curProps=s.cloneObject(this.prevProps),this.propDeltas=s.cloneObject(this.curProps)):(this.prevProps=null,this.curProps=null,this.propDeltas=null)},skipInterpolation:function(){this.updatePreviousProperties()},updatePreviousProperties:function(){var t=this.prevProps;if(this.prevProps=this.curProps,this.curProps=t,this.curProps.x=this.x,this.curProps.y=this.y,this.curProps.anchorX=this.anchorX,this.curProps.anchorY=this.anchorY,this.curProps.scaleX=this.scaleX,this.curProps.scaleY=this.scaleY,this.curProps.angle=this.angle,this.curProps.opacity=this.opacity,this.propDeltas.x=this.x-this.prevProps.x,this.propDeltas.y=this.y-this.prevProps.y,this.propDeltas.anchorX=this.anchorX-this.prevProps.anchorX,this.propDeltas.anchorY=this.anchorY-this.prevProps.anchorY,this.propDeltas.scaleX=this.scaleX-this.prevProps.scaleX,this.propDeltas.scaleY=this.scaleY-this.prevProps.scaleY,this.propDeltas.opacity=this.opacity-this.prevProps.opacity,this.interpolateFullAngle)this.propDeltas.angle=this.angle-this.prevProps.angle;else{for(var e=this.prevProps.angle,i=this.angle%a;i-e>Math.PI;)i-=a;for(;i-e<=-Math.PI;)i+=a;this.propDeltas.angle=i-e}},stageRender:function(t,e,i,s){this.interpolated&&0===s.interpolation&&this.updatePreviousProperties(),this.visible&&0<this.opacity&&(this.preRender(t,e,i,s),this.render(t,e,i,s),this.postRender(t,e,i,s))},preRender:function(t,e,i,s){var n,a,o,r,h,l,d,u=s.canvasContext;u.save(),s=this.interpolated?(i=this.calculateInterpolation?this.calculateInterpolation(i,s.lastLogicLoopTime,s.fixedLogicDTM):s.interpolation,n=this.prevProps.opacity+this.propDeltas.opacity*s.interpolation,a=this.prevProps.x+this.propDeltas.x*i,o=this.prevProps.y+this.propDeltas.y*i,r=this.prevProps.angle+this.propDeltas.angle*i,h=this.prevProps.scaleX+this.propDeltas.scaleX*i,l=this.prevProps.scaleY+this.propDeltas.scaleY*i,d=this.prevProps.anchorX+this.propDeltas.anchorX*i,this.prevProps.anchorY+this.propDeltas.anchorY*i):(n=this.opacity,a=this.x,o=this.y,r=this.angle,h=this.scaleX,l=this.scaleY,d=this.anchorX,this.anchorY),this.roundPosition&&(a=.5+a|0,o=.5+o|0,d=.5+d|0,s=.5+s|0),n<1&&(u.globalAlpha=u.globalAlpha*n),u.translate(a,o),u.rotate(r),u.scale(h,l),u.translate(-d,-s)},render:function(t,e,i,s){},postRender:function(t,e,i,s){s.canvasContext.restore()},dispatchAddedToStage:function(t){this.dispatch(o.events.addedToStage,{stage:t})},dispatchRemovedFromStage:function(t){this.dispatch(o.events.removedFromStage,{stage:t})},setScale:function(t){this.scaleX=this.scaleY=t},getStageX:function(){return this.parent?this.parent.getStageX()+this.x-this.anchorX:this.x-this.anchorX},getStageY:function(){return this.parent?this.parent.getStageY()+this.y-this.anchorY:this.y-this.anchorY},isOnStage:function(){return!!this.parent&&this.parent.isOnStage()},isVisibleOnStage:function(){return!!this.parent&&(this.visible&&this.parent.isVisibleOnStage())}}),o}),n("j13e/display/J13DisplayItemContainer",["require","exports","module","./J13DisplayItem","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItem"),t=t("../utils/J13Utils");function n(t){s.call(this,t),this.children=[]}return n.events={childAdded:"childadded",childRemoved:"childremoved",anyChildAdded:"anychildadded",anyChildRemoved:"anychildremoved"},n.prototype=t.inherit(new s,{events:t.extendObj(s.prototype.events,n.events),render:function(t,e,i,s){for(var n=-1;++n<this.children.length;)this.children[n].stageRender(t,e,i,s)},addChild:function(t){return-1===this.children.indexOf(t)&&((t.parent=this).children.push(t),t.dispatch(s.events.added,{parent:this}),this.dispatch(n.events.childAdded,{child:t}),this.dispatchAnyChildAdded(t),!0)},addChildAt:function(t,e){var i=this.children.indexOf(t);return-1!==i&&this.children.splice(i,1),e>=this.children.length?(t.parent=this).children.push(t):this.children.splice(e,0,t),-1===i&&(t.dispatch(s.events.added,{parent:this}),this.dispatch(n.events.childAdded,{child:t}),this.dispatchAnyChildAdded(t)),this.children.length},removeChild:function(t){var e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatch(s.events.removed,{parent:this}),this.dispatch(n.events.childRemoved,{child:t}),this.dispatchAnyChildRemoved(t),!0)},removeChildAt:function(t){var e;return t<this.children.length?((e=this.children[t]).parent=null,this.children.splice(t,1),e.dispatch(s.events.removed,{parent:this}),this.dispatch(n.events.childRemoved,{child:e}),this.dispatchAnyChildRemoved(e),e):null},getAllChildren:function(){for(var t=[],e=0;e<this.children.length;e+=1)t.push(this.children[e]),this.children[e].getAllChildren&&(t=t.concat(this.children[e].getAllChildren()));return t},dispatchAddedToStage:function(t){for(var e=0;e<this.children.length;e+=1)this.children[e].dispatchAddedToStage(t);s.prototype.dispatchAddedToStage.call(this,t)},dispatchRemovedFromStage:function(t){for(var e=0;e<this.children.length;e+=1)this.children[e].dispatchRemovedFromStage(t);s.prototype.dispatchRemovedFromStage.call(this,t)},dispatchAnyChildAdded:function(t){this.dispatch(n.events.anyChildAdded,{child:t}),this.parent&&this.parent.dispatchAnyChildAdded(t)},dispatchAnyChildRemoved:function(t){this.dispatch(n.events.anyChildRemoved,{child:t}),this.parent&&this.parent.dispatchAnyChildRemoved(t)}}),n}),n("j13e/display/J13DisplayLayer",["require","exports","module","./J13DisplayItemContainer","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItemContainer"),t=t("../utils/J13Utils");function n(t){s.call(this,t)}return n.prototype=t.inherit(new s,{preRender:function(t,e,i,s){},postRender:function(t,e,i,s){}}),n}),n("src/screens/Screen",["require","exports","module","src/utils/Updatable","j13e/utils/J13Utils","j13e/display/J13DisplayLayer"],function(t,e,i){"use strict";var s=t("src/utils/Updatable"),n=t("j13e/utils/J13Utils"),a=t("j13e/display/J13DisplayLayer");function o(t){var e=t||{};a.call(this,t),this.visible=e.visible||!1,this.game=e.game||null,this.width=e.width||0,this.height=e.height||0}return o.prototype=n.inherit(new a,s.prototype,{update:function(t,e,i,s){},show:function(t){this.visible=!0},hide:function(t){this.visible=!1}}),o}),n("j13e/display/J13DisplayDrawOptions",["require","exports","module","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("../utils/J13Utils");function n(t){t=t||{};this.fillStyle=t.fillStyle||null,this.strokeStyle=t.strokeStyle||null,this.lineCap=t.lineCap||null,this.lineJoin=t.lineJoin||null,this.lineWidth=t.hasOwnProperty("lineWidth")?t.lineWidth:null,this.shadowColor=t.shadowColor||null,this.shadowBlur=t.hasOwnProperty("shadowBlur")?t.shadowBlur:null,this.shadowOffsetX=t.hasOwnProperty("shadowOffsetX")?t.shadowOffsetX:null,this.shadowOffsetY=t.hasOwnProperty("shadowOffsetY")?t.shadowOffsetY:null,this.miterLimit=t.hasOwnProperty("miterLimit")?t.miterLimit:null,this.postPathOptions=s.extendObj({x:null,y:null,anchorX:null,anchorY:null,angle:null,scaleX:null,scaleY:null},t.postPathOptions||{}),t.postPathOptions&&t.postPathOptions.hasOwnProperty("scale")&&(this.postPathOptions.scaleX=this.postPathOptions.scaleY=t.postPathOptions.scale)}return n.prototype={drawFlags:n.drawFlags={OUTLINE_BEHIND:1,FILL:2,OUTLINE_FRONT:4},applyOptions:function(t){null!==this.fillStyle&&(t.fillStyle=this.fillStyle),null!==this.strokeStyle&&(t.strokeStyle=this.strokeStyle),null!==this.lineCap&&(t.lineCap=this.lineCap),null!==this.lineJoin&&(t.lineJoin=this.lineJoin),null!==this.lineWidth&&(t.lineWidth=this.lineWidth),null!==this.shadowColor&&(t.shadowColor=this.shadowColor),null!==this.shadowBlur&&(t.shadowBlur=this.shadowBlur),null!==this.shadowOffsetX&&(t.shadowOffsetX=this.shadowOffsetX),null!==this.shadowOffsetY&&(t.shadowOffsetY=this.shadowOffsetY),null!==this.miterLimit&&(t.miterLimit=this.miterLimit)},applyPostPathOptions:function(t){null!==this.postPathOptions.x&&t.translate(this.postPathOptions.x,0),null!==this.postPathOptions.y&&t.translate(0,this.postPathOptions.y),null!==this.postPathOptions.anchorX&&t.translate(this.postPathOptions.anchorX,0),null!==this.postPathOptions.anchorY&&t.translate(0,this.postPathOptions.anchorY),null!==this.postPathOptions.angle&&t.rotate(this.postPathOptions.angle),null!==this.postPathOptions.scaleX&&t.scale(this.postPathOptions.scaleX,1),null!==this.postPathOptions.scaleY&&t.scale(1,this.postPathOptions.scaleY),null!==this.postPathOptions.anchorX&&t.translate(-this.postPathOptions.anchorX,0),null!==this.postPathOptions.anchorY&&t.translate(0,-this.postPathOptions.anchorY)}},n}),n("j13e/display/J13DisplayRect",["require","exports","module","../math/J13Rect","./J13DisplayDrawOptions","./J13DisplayItem","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("../math/J13Rect"),n=t("./J13DisplayDrawOptions"),a=t("./J13DisplayItem"),t=t("../utils/J13Utils");function o(t){var e=t||{};a.call(this,t),this.rect=e.rect||new s(e),this.rect&&!s.isJ13Rect(this.rect,!0)&&s.canBeJ13Rect(this.rect)&&(this.rect=new s(this.rect)),this.drawOptions=e.drawOptions||new n(t),this.drawFlags=e.drawFlags||n.drawFlags.FILL}return o.prototype=t.inherit(new a,{render:function(t,e,i,s){s=s.canvasContext;this.drawOptions.applyOptions(s),s.beginPath(),s.rect(this.rect.left,this.rect.top,this.rect.getWidth(),this.rect.getHeight()),s.closePath(),this.drawOptions.applyPostPathOptions(s),0<(this.drawFlags&n.drawFlags.OUTLINE_BEHIND)&&s.stroke(),0<(this.drawFlags&n.drawFlags.FILL)&&s.fill(),0<(this.drawFlags&n.drawFlags.OUTLINE_FRONT)&&s.stroke()}}),o}),n("j13e/display/J13DisplayText",["require","exports","module","./J13DisplayDrawOptions","../utils/J13Utils","./J13DisplayItem","../utils/J13DOM"],function(t,e,i){"use strict";var n=t("./J13DisplayDrawOptions"),s=t("../utils/J13Utils"),a=t("./J13DisplayItem"),o=t("../utils/J13DOM");function r(t){var e=t||{};a.call(this,t),this.drawOptions=e.drawOptions||new n(t),this.drawFlags=e.drawFlags||n.drawFlags.FILL,this.textAlign=e.textAlign||"left",this.textBaseline=e.textBaseline||"top",this.text=e.text||"",this.font=e.font||null}return r.textMeasureCanvas=null,r.prototype=s.inherit(new a,{render:function(t,e,i,s){s=s.canvasContext;this.font&&(s.font=this.font),this.drawOptions.applyOptions(s),s.textAlign=this.textAlign,s.textBaseline=this.textBaseline,0<(this.drawFlags&n.drawFlags.OUTLINE_BEHIND)&&s.strokeText(this.text,0,0),0<(this.drawFlags&n.drawFlags.FILL)&&s.fillText(this.text,0,0),0<(this.drawFlags&n.drawFlags.OUTLINE_FRONT)&&s.strokeText(this.text,0,0)},getTextWidth:function(){null===r.textMeasureCanvas&&((r.textMeasureCanvas=o.create("canvas")).width=1,r.textMeasureCanvas.height=1);var t=r.textMeasureCanvas.getContext("2d");return t.font=this.font,t.measureText(this.text).width}}),r}),n("src/screens/PreloadScreen",["require","exports","module","src/Resources","./Screen","j13e/utils/J13Utils","j13e/math/J13Rect","j13e/display/J13DisplayRect","j13e/display/J13DisplayText"],function(t,e,i){"use strict";t("src/Resources");var s=t("./Screen"),n=t("j13e/utils/J13Utils"),a=t("j13e/math/J13Rect"),o=t("j13e/display/J13DisplayRect"),r=t("j13e/display/J13DisplayText");function h(t){var e=t||{};s.call(this,t),this.prefix=e.prefix||"",this.suffix=e.suffix||"",this.bg=new o({rect:new a({width:this.width,height:this.height}),fillStyle:"rgb("+h.bgColors.start.r+","+h.bgColors.start.g+","+h.bgColors.start.b+")",opacity:1}),this.addChild(this.bg),this.preloadText=new r({font:"30px Arial",fillStyle:"#ffffff",text:"Loading..",textBaseline:"middle",textAlign:"center",x:this.width/2,y:this.height/2}),this.addChild(this.preloadText)}return h.bgColors={start:{r:0,g:135,b:147},end:{r:78,g:192,b:202}},h.prototype=n.inherit(new s,{setBar:function(t){var e=h.bgColors.start,i=h.bgColors.end,s=Math.round((i.r-e.r)*t+e.r),n=Math.round((i.g-e.g)*t+e.g),i=Math.round((i.b-e.b)*t+e.b);this.bg.drawOptions.fillStyle="rgb("+s+","+n+","+i+")"},setText:function(t,e){this.preloadText.text=t},setPrefix:function(t){this.prefix=t},setSuffix:function(t){this.suffix=t},setPercent:function(t,e){this.preloadText.text=this.prefix+Math.floor(t)+"%"+this.suffix,this.setBar(t/100)}}),h}),n("src/utils/ActionObject",["require","exports","module","./Updatable","j13e/math/J13Rect","j13e/utils/J13Utils","j13e/display/J13DisplayItem","j13e/math/J13Vec2"],function(t,e,i){"use strict";var s=t("./Updatable"),n=t("j13e/math/J13Rect"),a=t("j13e/utils/J13Utils"),o=t("j13e/display/J13DisplayItem"),r=t("j13e/math/J13Vec2");function h(t){var e=t||{};o.call(this,t),s.call(this,t),this.autoUpdateHitRect=e.autoUpdateHitRect||!1,this.autoCalculateAngleVec=e.autoCalculateAngleVec||!1,this.velocity=e.velocity||new r,this.accel=e.accel||new r,this.angularVelocity=e.angularVelocity||0,this.prevAngle=this.angle,this.angleVec=new r(Math.cos(this.angle),Math.sin(this.angle)),this._hitRect=e.hitRect||new n,this.hitRect=new n(this._hitRect),this.displayItem=e.displayItem||null,this.autoUpdateHitRect&&this.updateHitRect(),this.autoCalculateAngleVec&&this.calculateAngleVec()}return h.prototype=a.inherit(new o,s.prototype,{maxAccel:Number.MAX_VALUE,maxSpeed:Number.MAX_VALUE,maxAngularSpeed:Number.MAX_VALUE,render:function(t,e,i,s){this.displayItem&&this.displayItem.render(t,e,i,s)},update:function(t,e,i,s){this.updatePosition(t,e,i,s),this.autoUpdateHitRect&&this.updateHitRect(),this.autoCalculateAngleVec&&this.calculateAngleVec()},calculateAngleVec:function(){this.angle!==this.prevAngle&&(this.angleVec.x=Math.cos(this.angle),this.angleVec.y=Math.sin(this.angle),this.prevAngle=this.angle)},limitVelocity:function(t){this.maxSpeed<Number.MAX_VALUE&&this.velocity.lengthSquared()>t*t&&(this.velocity.normalize(),this.velocity.multiply(t))},limitAccel:function(t){this.maxAccel<Number.MAX_VALUE&&this.accel.lengthSquared()>t*t&&(this.accel.normalize(),this.accel.multiply(t))},limitAngularVelocity:function(t){this.maxAngularSpeed<Number.MAX_VALUE&&Math.abs(this.angularVelocity)>t&&(this.angularVelocity=0<this.angularVelocity?t:-t)},updatePosition:function(t,e,i,s){this.limitAngularVelocity(this.maxAngularSpeed),this.angle+=this.angularVelocity*e,this.limitAccel(this.maxAccel),this.velocity.x+=this.accel.x*e,this.velocity.y+=this.accel.y*e,this.limitVelocity(this.maxSpeed),this.x+=this.velocity.x*e,this.y+=this.velocity.y*e},updateHitRect:function(){this.hitRect.setPosition(this.x+this._hitRect.left,this.y+this._hitRect.top),this.hitRect.setWidth(this._hitRect.getWidth()),this.hitRect.setHeight(this._hitRect.getHeight())}}),h}),n("j13e/display/J13DisplayImg",["require","exports","module","./J13DisplayItem","../math/J13Rect","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItem"),n=t("../math/J13Rect"),t=t("../utils/J13Utils");function a(t){var e=t||{};s.call(this,t),this.image=e.image||e.img||null,this.sourceRect=e.sourceRect||null,this.destRect=e.destRect||null,this.sourceRect&&!n.isJ13Rect(this.sourceRect,!0)&&n.canBeJ13Rect(this.sourceRect)&&(this.sourceRect=new n(this.sourceRect)),this.destRect&&!n.isJ13Rect(this.destRect,!0)&&n.canBeJ13Rect(this.destRect)&&(this.destRect=new n(this.destRect)),!this.sourceRect&&this.image&&(this.sourceRect=new n({left:0,top:0,right:this.image.width,bottom:this.image.height})),!this.destRect&&this.image&&(this.destRect=this.sourceRect.copy())}return a.prototype=t.inherit(new s,{render:function(t,e,i,s){s.canvasContext.drawImage(this.image,this.sourceRect.left,this.sourceRect.top,this.sourceRect.getWidth(),this.sourceRect.getHeight(),this.destRect.left,this.destRect.top,this.destRect.getWidth(),this.destRect.getHeight())},setSourceRectFromImage:function(t){this.sourceRect.setPosition(0,0),this.sourceRect.setWidth(t.width),this.sourceRect.setHeight(t.height)},setDestRectFromImage:function(t){this.destRect.setPosition(0,0),this.destRect.setWidth(t.width),this.destRect.setHeight(t.height)}}),a}),n("src/screens/playparts/Bird",["require","exports","module","src/utils/ActionObject","src/Resources","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayImg","j13e/math/J13Rect","j13e/utils/J13Utils"],function(t,e,i){"use strict";var a=t("src/utils/ActionObject"),s=t("src/Resources"),n=t("j13e/display/J13DisplayItemContainer"),o=t("j13e/display/J13DisplayImg"),r=t("j13e/math/J13Rect"),h=t("j13e/utils/J13Utils");function l(t){var e=t||{},t=(a.call(this,h.extendObj({autoUpdateHitRect:!0},t)),this.destRect=new r({width:44,height:25}),this.displayItem=new n);this.flappy1=new o({image:s.loadedImages[s.images.flappy1],destRect:this.destRect,anchorX:this.destRect.getWidth()/2,anchorY:this.destRect.getHeight()/2,angle:Math.PI/2,visible:!1}),t.addChild(this.flappy1),this.flappy2=new o({image:s.loadedImages[s.images.flappy2],destRect:this.destRect,anchorX:this.destRect.getWidth()/2,anchorY:this.destRect.getHeight()/2,angle:Math.PI/2,visible:!1}),t.addChild(this.flappy2),this.width=this.destRect.getWidth(),this.height=this.destRect.getHeight(),this._hitRect.setWidth(this.height),this._hitRect.setHeight(this.height),this._hitRect.setX(-this._hitRect.getWidth()/2),this._hitRect.setY(-this._hitRect.getHeight()/2),this.changeToState(l.states.idle),this.startingX=e.hasOwnProperty("startingX")?e.startingX:this.x,this.startingY=e.hasOwnProperty("startingY")?e.startingY:this.y,this.flapSpeedX=l.flapSpeedX,this.flapSpeedY=l.flapSpeedY}return l.frameDelay={flapping:100,idle:200},l.frameOrder=[0,1],l.states={idle:1,flapping:2,falling:3,dying:4,dead:5},l.idleAccelY=0,l.aliveAccelY=1400,l.flapSpeedX=100,l.flapSpeedY=700,l.directions={left:0,right:1},l.prototype=h.inherit(new a,{setFrame:function(t){0===t?(this.flappy1.visible=!0,this.flappy2.visible=!1):(this.flappy1.visible=!1,this.flappy2.visible=!0)},isIdle:function(){return this.state===l.states.idle},isAlive:function(){return this.state===l.states.flapping||this.state===l.states.falling},isDying:function(){return this.state===l.states.dying},isDead:function(){return this.state===l.states.dead},reset:function(){this.changeToState(l.states.idle),this.x=this.startingX,this.y=this.startingY,this.scaleX=1},changeToState:function(t){this.state;switch(t){case l.states.idle:this.angle=0,this.accel.y=l.idleAccelY;break;case l.states.flapping:this.accel.y=l.aliveAccelY,this.velocity.y=-this.flapSpeedY;break;case l.states.falling:this.setFrame(0);break;case l.states.dying:this.setFrame(0),this.velocity.x=0;break;case l.states.dead:this.setFrame(0),this.accel.y=l.idleAccelY,this.velocity.y=0}this.state=t},flap:function(t){(this.isAlive()||this.isIdle())&&(this.changeToState(l.states.flapping),t===l.directions.left?this.velocity.x=-this.flapSpeedX:this.velocity.x=this.flapSpeedX,s.soundManager.play(s.soundNames.flap))},kill:function(){this.changeToState(l.states.dying)},update:function(t,e,i,s){var n;this.state===l.states.idle?(n=Math.floor(i/l.frameDelay.idle)%l.frameOrder.length,this.setFrame(l.frameOrder[n]),this.angle=-Math.PI/2):this.state===l.states.flapping?(n=Math.floor(i/l.frameDelay.flapping)%l.frameOrder.length,this.setFrame(l.frameOrder[n]),this.angle=Math.atan2(this.velocity.y,this.velocity.x),0<this.velocity.y&&this.changeToState(l.states.falling)):this.state!==l.states.falling&&this.state!==l.states.dying&&this.state!==l.states.dead||(this.angle=Math.atan2(this.velocity.y,this.velocity.x)),a.prototype.update.call(this,t,e,i,s)}}),l}),n("src/screens/playparts/Pipe",["require","exports","module","src/Resources","j13e/math/J13Rect","j13e/display/J13DisplayImg","j13e/utils/J13Utils"],function(t,e,i){"use strict";var s=t("src/Resources"),n=t("j13e/math/J13Rect"),a=t("j13e/display/J13DisplayImg"),o=t("j13e/utils/J13Utils");function r(t){var t=t||{},e=(this.side=t.side||r.sides.left,this.leftWallX=t.leftWallX||0,this.rightWallX=t.rightWallX||0,this.gapRect=t.gapRect,s.loadedImages[s.images.pipe]);a.call(this,o.extendObj({img:e},t)),this.side===r.sides.left?(this.anchorX=0,this.scaleX=-1,this.x=this.gapRect.left,this.hitRect=new n({x:this.leftWallX,y:this.gapRect.top,width:this.gapRect.left-this.leftWallX,height:this.gapRect.getHeight()})):this.side===r.sides.right&&(this.anchorX=0,this.scaleX=1,this.x=this.gapRect.right,this.hitRect=new n({x:this.gapRect.right,y:this.gapRect.top,width:this.rightWallX-this.gapRect.right,height:this.gapRect.getHeight()}))}return r.sides={left:1,right:2},r.prototype=o.inherit(new a,{}),r}),n("src/screens/playparts/Brick",["require","exports","module","src/Resources","j13e/math/J13Rect","j13e/display/J13DisplayImg","j13e/utils/J13Utils"],function(t,e,i){"use strict";var s=t("src/Resources"),n=(t("j13e/math/J13Rect"),t("j13e/display/J13DisplayImg")),a=t("j13e/utils/J13Utils");function o(t){var e=s.loadedImages[s.images.brick];n.call(this,a.extendObj({img:e},t||{})),this.anchorX=this.destRect.getWidth()/2,this.anchorY=this.destRect.getHeight()/2}return o.prototype=a.inherit(new n,{}),o}),n("src/screens/playparts/Pipesticle",["require","exports","module","src/utils/Common","./Pipe","./Brick","j13e/utils/J13Utils","j13e/math/J13Rect","j13e/display/J13DisplayRect","j13e/display/J13DisplayDrawOptions","j13e/display/J13DisplayItemContainer"],function(t,e,i){"use strict";var s=t("src/utils/Common"),n=t("./Pipe"),a=t("./Brick"),o=t("j13e/utils/J13Utils"),r=t("j13e/math/J13Rect"),h=(t("j13e/display/J13DisplayRect"),t("j13e/display/J13DisplayDrawOptions"),t("j13e/display/J13DisplayItemContainer"));function l(t){var e=t||{};h.call(this,t),this.gapRect=e.gapRect,this.width=e.width,this.passed=!1,this.pipeHitRects=[],this.brickHitRects=[],this.y=this.gapRect.top,this.generateTopBrick=e.generateTopBrick||!1,this.generateBottomBrick=e.generateBottomBrick||!1,this.leftPipe=new n({leftWallX:0,rightWallX:this.width,side:n.sides.left,gapRect:this.gapRect}),this.pipeHitRects.push(this.leftPipe.hitRect),this.rightPipe=new n({leftWallX:0,rightWallX:this.width,side:n.sides.right,gapRect:this.gapRect}),this.pipeHitRects.push(this.rightPipe.hitRect),this.dismissY=this.gapRect.top,this.generateTopBrick&&(t=new r({left:this.gapRect.left-10,right:this.gapRect.right+10,top:-150,bottom:-50}),this.topBrick=new a({x:Math.round(s.rangedRandom(t.left,t.right)),y:Math.round(s.rangedRandom(t.top,t.bottom)),destRect:new r({width:40,height:40})}),this.topBrick.hitRect=new r({left:this.topBrick.x-this.topBrick.destRect.getWidth()/2,top:this.topBrick.y+this.y-this.topBrick.destRect.getHeight()/2,right:this.topBrick.x+this.topBrick.destRect.getWidth()/2,bottom:this.topBrick.y+this.y+this.topBrick.destRect.getHeight()/2}),this.brickHitRects.push(this.topBrick.hitRect),this.dismissY=this.topBrick.hitRect.top,this.addChild(this.topBrick)),this.generateBottomBrick&&(e=new r({left:this.gapRect.left-10,right:this.gapRect.right+10,top:this.gapRect.getHeight()+50,bottom:this.gapRect.getHeight()+150}),this.bottomBrick=new a({x:Math.round(s.rangedRandom(e.left,e.right)),y:Math.round(s.rangedRandom(e.top,e.bottom)),destRect:new r({width:40,height:40})}),this.bottomBrick.hitRect=new r({left:this.bottomBrick.x-this.bottomBrick.destRect.getWidth()/2,top:this.bottomBrick.y+this.y-this.bottomBrick.destRect.getHeight()/2,right:this.bottomBrick.x+this.bottomBrick.destRect.getWidth()/2,bottom:this.bottomBrick.y+this.y+this.bottomBrick.destRect.getHeight()/2}),this.brickHitRects.push(this.bottomBrick.hitRect),this.addChild(this.bottomBrick)),this.addChild(this.leftPipe),this.addChild(this.rightPipe)}return l.prototype=o.inherit(new h,{collidesWithPipes:function(t){for(var e=0;e<this.brickHitRects.length;e+=1)if(this.brickHitRects[e].intersectsRect(t))return!0;return!1},collidesWithBricks:function(t){for(var e=0;e<this.pipeHitRects.length;e+=1)if(this.pipeHitRects[e].intersectsRect(t))return!0;return!1},passes:function(t){return!this.passed&&t.top<this.gapRect.top&&(this.passed=!0)}}),l}),n("src/screens/playparts/Level",["require","exports","module","src/Resources","src/utils/Common","src/utils/Updatable","./Bird","./Pipesticle","j13e/utils/J13Utils","j13e/math/J13Rect","j13e/anim/J13Anim","j13e/utils/J13EventDispatcher","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayLayer","j13e/display/J13DisplayImg"],function(t,e,i){"use strict";var r=t("src/Resources"),n=t("src/utils/Common"),s=t("src/utils/Updatable"),h=t("./Bird"),a=t("./Pipesticle"),o=t("j13e/utils/J13Utils"),l=t("j13e/math/J13Rect"),d=t("j13e/anim/J13Anim"),u=t("j13e/utils/J13EventDispatcher"),c=t("j13e/display/J13DisplayItemContainer"),p=t("j13e/display/J13DisplayLayer"),g=t("j13e/display/J13DisplayImg");function f(t){var e=t||{};c.call(this,t),u.call(this,t),s.call(this,t),this.game=e.game||null,this.width=e.width||0,this.height=e.height||0,this.minimumBirdCameraY=3*this.height/5,e.bgImage&&(this.bg=new g({image:e.bgImage,x:0,y:this.height-e.bgImage.height}),this.addChild(this.bg)),this.ground=new g({image:r.loadedImages[r.images.bottomBar],x:0,y:this.height-35}),this.addChild(this.ground),this.pipeLayer=new p,this.addChild(this.pipeLayer),this.bird=new h({x:this.width/2,y:this.minimumBirdCameraY}),this.addChild(this.bird),this.hitType=null,this.pipesticles=[],this.bricks=[],this.state=f.states.waiting,this.deathTime=-1,this.minimumPipeCreateY=2*this.height}return f.states={waiting:1,playing:2,collided:3,finished:4},f.events={started:"started",pipeCleared:"pipecleared",collided:"collided",finished:"finished"},f.pipeThickness=52,f.pipeVariance=200,f.pipeGap=140,f.pipeDistance=450,f.prototype=o.inherit(new c,u.prototype,s.prototype,{flapLeft:function(){this.state!==f.states.waiting&&this.state!==f.states.playing||(this.state===f.states.waiting&&(this.state=f.states.playing,this.dispatch(f.events.started)),this.bird.flap(h.directions.left))},flapRight:function(){this.state!==f.states.waiting&&this.state!==f.states.playing||(this.state===f.states.waiting&&(this.state=f.states.playing,this.dispatch(f.events.started)),this.bird.flap(h.directions.right))},updatePipesticles:function(){for(var t=null,e=(0===this.pipesticles.length&&(t=this.createPipesticleAt(this.width/2,-this.y-f.pipeThickness,!0,!1),this.pipesticles.push(t),this.pipeLayer.addChild(t)),this.pipesticles[this.pipesticles.length-1]);e.y+this.y+this.height+this.minimumPipeCreateY>=f.pipeDistance;)t=this.createPipesticleAt(e.gapRect.getCenterX(),e.gapRect.top-f.pipeDistance-f.pipeThickness,!0,!0),this.pipesticles.push(t),this.pipeLayer.addChild(t),e=t;for(;0<this.pipesticles.length&&this.pipesticles[0].dismissY>-this.y+this.height;)this.pipeLayer.removeChild(this.pipesticles.shift())},createPipesticleAt:function(t,e,i,s){t=Math.floor(n.rangedRandom(n.clamp(f.pipeGap/2+30,t-f.pipeVariance,this.width-f.pipeGap/2-30),n.clamp(f.pipeGap/2+30,t+f.pipeVariance,this.width-f.pipeGap/2-30))),t=new l({left:t-f.pipeGap/2,right:t+f.pipeGap/2,top:e,bottom:e+f.pipeThickness});return new a({gapRect:t,width:this.width,generateTopBrick:i,generateBottomBrick:s})},shake:function(){r.animManager.startAnim(new d({duration:250,stepCallback:function(){this.anchorX=n.rangedRandom(-10,10),this.anchorY=n.rangedRandom(-10,10)}.bind(this)}))},update:function(t,e,i,s){if(this.state===f.states.collided&&(-1===this.deathTime?this.deathTime=i:-2!==this.deathTime&&100<i-this.deathTime&&(this.deathTime=-2,r.soundManager.play(r.soundNames.fall))),this.state!==f.states.finished){if(this.bird.update(t,e,i,s),this.bird.hitRect.left<0?(this.bird.x=this.bird.hitRect.getWidth()/2,this.bird.updateHitRect()):this.bird.hitRect.right>this.width&&(this.bird.x=this.width-this.bird.hitRect.getWidth()/2,this.bird.updateHitRect()),this.bird.y-this.minimumBirdCameraY<-this.y&&(this.y=-(this.bird.y-this.minimumBirdCameraY)),this.updatePipesticles(),this.state===f.states.playing)for(var n=0;n<this.pipesticles.length;n+=1){var a=this.pipesticles[n],o=!1;a.collidesWithPipes(this.bird.hitRect)?(o=!0,this.hitType=r.hitTypes.pipe):a.collidesWithBricks(this.bird.hitRect)&&(o=!0,this.hitType=r.hitTypes.brick),o?(this.shake(),this.bird.changeToState(h.states.dying),this.bird.velocity.y<0?this.bird.velocity.y=0:0<this.bird.velocity.y&&(this.bird.velocity.y=-200),r.soundManager.play(r.soundNames.crash),this.state=f.states.collided,this.dispatch(f.events.collided)):a.passes(this.bird.hitRect)&&(this.dispatch(f.events.pipeCleared),r.soundManager.play(r.soundNames.point))}this.bird.y-this.bird.hitRect.getHeight()/2>-this.y+this.height&&(this.hitType||(this.hitType=r.hitTypes.tooLow,this.shake(),r.soundManager.play(r.soundNames.crash)),this.bird.visible=!1,this.state=f.states.finished,this.dispatch(f.events.finished,{hitType:this.hitType})),this.ground.visible&&this.ground.y>-this.y+this.height&&(this.ground.visible=!1),this.bg&&this.bg.visible&&this.bg.y>-this.y+this.height&&(this.bg.visible=!1)}}}),f}),n("src/scenes/Scene",["require","exports","module","src/utils/Updatable","j13e/utils/J13Utils","j13e/display/J13DisplayItemContainer"],function(t,e,i){"use strict";var s=t("src/utils/Updatable"),n=t("j13e/utils/J13Utils"),a=t("j13e/display/J13DisplayItemContainer");function o(t){var e=t||{};a.call(this,t),this.game=e.game||null,this.width=e.width||0,this.height=e.height||0}return o.prototype=n.inherit(new a,s.prototype,{update:function(t,e,i,s){},show:function(t){this.visible=!0},hide:function(t){this.visible=!1}}),o}),n("j13e/anim/J13AnimGroup",["require","exports","module","./J13Anim","../utils/J13Utils"],function(t,e,i){"use strict";var n=t("./J13Anim"),t=t("../utils/J13Utils");function s(t){var e=t||{};n.call(this,t),this.anims=e.anims||[],this.applyDuration=e.hasOwnProperty("applyDuration")||-1,this.overrideUseLogicTime=e.overrideUseLogicTime||!1,this.recalculateDuration()}return s.prototype=t.inherit(new n,{recalculateDuration:function(){var t,e,i=0;if(-1!==this.applyDuration)for(this.duration=this.applyDuration,t=0;t<this.anims.length;t+=1)this.anims[t].duration=this.duration;else{for(t=0;t<this.anims.length;t+=1)(e=this.anims[t]).duration>i&&(i=e.duration);this.duration=i}},preStart:function(){for(var t=0;t<this.anims.length;t+=1)this.anims[t].data||(this.anims[t].data=this.data),this.anims[t].preStart();n.prototype.preStart.call(this)},start:function(t,e){var i;for(n.prototype.start.call(this,t,e),i=0;i<this.anims.length;i+=1)this.overrideUseLogicTime&&(this.anims[i].useLogicTime=this.useLogicTime),this.anims[i].start(t,e)},step:function(t,e){var i,s;for(n.prototype.step.call(this,t,e),i=0;i<this.anims.length;i+=1)this.anims[i].prepared&&((s=this.anims[i]).shouldBeAnimating(t,e)?s.step(t,e):s.shouldBeDone(t,e)&&(s.step(t,e),s.end()))},end:function(){var t;for(n.prototype.end.call(this),t=0;t<this.anims.length;t+=1)this.anims[t].prepared&&this.anims[t].end()},stop:function(){var t;for(n.prototype.stop.call(this),t=0;t<this.anims.length;t+=1)this.anims[t].stop()}}),s}),n("src/scenes/TutScene",["require","exports","module","src/Resources","./Scene","j13e/anim/J13Anim","j13e/anim/J13AnimSequence","j13e/anim/J13AnimGroup","j13e/display/J13DisplayImg","j13e/utils/J13Utils"],function(t,e,i){"use strict";var o=t("src/Resources"),r=t("./Scene"),h=t("j13e/anim/J13Anim"),l=t("j13e/anim/J13AnimSequence"),d=(t("j13e/anim/J13AnimGroup"),t("j13e/display/J13DisplayImg")),t=t("j13e/utils/J13Utils");function s(t){r.call(this,t);var t=o.loadedImages[o.images.arrow],e=o.loadedImages[o.images.flappyArrow],i=o.loadedImages[o.images.flappyGrey],s=o.loadedImages[o.images.flappyMotion],i=this.tutBird=new d({img:i,anchorX:i.width/2,anchorY:i.height/2,scale:.6,x:this.width/2,y:300}),i=(this.addChild(i),this.flappyArrowLeft=new d({img:e,scale:.75,anchorX:80,anchorY:0,x:this.width/2,y:210})),i=(this.addChild(i),this.flappyArrowRight=new d({img:e,scaleX:-.75,scaleY:.75,anchorX:80,anchorY:0,x:this.width/2,y:210})),n=(this.addChild(i),this.leftArrow=new d({img:t,scale:.15,x:this.width/2,y:304,anchorX:350,anchorY:t.height/2})),a=(this.addChild(n),this.rightArrow=new d({img:t,scaleX:-.15,scaleY:.15,x:this.width/2,y:304,anchorX:350,anchorY:t.height/2})),e=(this.addChild(a),this.flappyMotion=new d({img:s,scale:.6,x:this.width/2,y:330,anchorX:s.width/2,anchorY:0}));this.addChild(e),this.tutAnim=new l({iterations:h.iterationCount.infinite,anims:[new h({duration:250,startCallback:function(){n.anchorX=a.anchorX=370}}),new h({duration:250,startCallback:function(){n.anchorX=a.anchorX=350}})]})}return s.prototype=t.inherit(new r,{show:function(t){this.opacity=1,o.animManager.restartAnim(this.tutAnim),r.prototype.show.call(this,t)},hide:function(t){var e=this;o.animManager.startAnim(new h({startValue:1,endValue:0,duration:500,stepCallback:function(t){e.opacity=t},endCallback:function(){o.animManager.stopAnim(e.tutAnim),r.prototype.hide.call(e,t)}}))}}),s}),n("j13e/utils/J13CookieJar",["require","exports","module"],function(t,e,i){"use strict";function s(t){this.cookieMap=this.parseCookies()}return s.prototype={getCookie:function(t,e,i){return this.cookieMap[t]||(i&&this.setCookie(t,e,i),e)},setCookie:function(t,e,i){var s=new Date;s.setSeconds(s.getSeconds()+i),document.cookie=t+"="+e+"; expires="+s.toUTCString(),this.cookieMap[t]=e},parseCookies:function(){return document.cookie.split(";").map(function(t){return t.trim().split("=")}).reduce(function(t,e){return t[e[0]]=e[1],t},{})}},new s}),n("src/utils/PersistentStorage",["require","exports","module","j13e/utils/J13CookieJar"],function(t,e,i){"use strict";var a=t("j13e/utils/J13CookieJar");function s(t){t=t||{};this.defaultExpireSeconds=t.hasOwnProperty("defaultExpireSeconds")?t.defaultExpireSeconds:s.DEFAULT_EXPIRE_SECONDS}return s.DEFAULT_EXPIRE_SECONDS=86400,s.prototype={set:function(t,e,i){var s=!1;if(window.localStorage)try{window.localStorage.setItem(t,e)}catch(t){s=!0}else s=!0;s&&a.setCookie(t,e,i||this.defaultExpireSeconds)},get:function(t,e,i){var s=!1,n=null;if(window.localStorage)try{s=!(null==(n=window.localStorage.getItem(t)))}catch(t){s=!1}else s=!1;return s||(n=a.getCookie(t,e,i||this.defaultExpireSeconds),s=!0),n}},new s}),n("src/utils/HiScoreManager",["require","exports","module","./PersistentStorage"],function(t,e,i){"use strict";var h=t("./PersistentStorage");function l(t){var t=t||{},t=(this.cookieSettings={name:t.cookieSettings&&t.cookieSettings.name?t.cookieSettings.name:l.cookieSettings.NAME,expires:t.cookieSettings&&t.cookieSettings.hasOwnProperty("expires")?t.cookieSettings.expires:l.cookieSettings.EXPIRES},this.minScore=t.hasOwnProperty("minScore")?t.minScore:0,this.maxEntries=t.hasOwnProperty("maxEntries")?t.maxEntries:l.MAX_ENTRIES,this.order=t.order||l.DESC,h.get(this.cookieSettings.name,'{"entries":[]}',this.cookieSettings.expires)),e=null;try{e=JSON.parse(t)}catch(t){e=null}this.entries=e&&e.entries?e.entries:[]}return l.MAX_ENTRIES=10,l.cookieSettings={NAME:"gmendlessgunner_hsl",EXPIRES:63072e3},l.order={ASC:"asc",DESC:"desc"},l.prototype={addScore:function(s,n,t){var a=!1,o=!1,r=this.order;for(this.entries.every(function(t,e,i){return(r===l.order.DESC&&n>=t.score||r===l.order.ASC&&n<=t.score)&&(i.splice(e,0,{time:s,score:n}),0===e&&(o=!0),a=!0),!a}),!a&&this.entries.length<this.maxEntries&&this.entries.push({time:s,score:n});this.entries.length>this.maxEntries;)this.entries.pop();return t||(t=JSON.stringify({entries:this.entries}),h.set(this.cookieSettings.name,t,this.cookieSettings.expires)),o}},l}),n("j13e/display/J13Buttonable",["require","exports","module"],function(t,e,i){"use strict";function s(t){}return s.isButton=function(t){if(!t)return!1;for(var e in s.prototype)if(s.prototype.hasOwnProperty(e)&&!t[e])return!1;return!0},s.prototype={events:s.events={CLICK:"click",DOWN:"down",UP:"up",HOVER:"hover",HOVEROUT:"hoverout",STATECHANGE:"statechange"},getId:function(){throw new Error("getId function must be overridden")},setWidth:function(t){throw new Error("setWidth function must be overridden")},getWidth:function(){throw new Error("getWidth function must be overridden")},setHeight:function(t){throw new Error("setHeight function must be overridden")},getHeight:function(){throw new Error("getHeight function must be overridden")},click:function(t){throw new Error("click function must be overridden")},down:function(t){throw new Error("down function must be overridden")},up:function(t){throw new Error("up function must be overridden")},hover:function(t){throw new Error("hover function must be overridden")},hoverOut:function(t){throw new Error("hoverOut function must be overridden")},setEnabled:function(t){throw new Error("setEnabled function must be overridden")},isEnabled:function(){throw new Error("isEnabled function must be overridden")},isUp:function(){throw new Error("isUp function must be overridden")},isDown:function(){throw new Error("isDown function must be overridden")},contains:function(t,e){throw new Error("contains function must be overridden")},isButtonVisibleOnStage:function(){throw new Error("isButtonVisibleOnStage function must be overridden")}},s}),n("j13e/display/J13DisplayButton",["require","exports","module","../utils/J13Utils","./J13DisplayItem","./J13Buttonable"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("./J13DisplayItem"),a=t("./J13Buttonable");function o(t){var e=t||{};n.call(this,t),this.displayItem=e.displayItem||this,this.id=e.id||"button-"+o.IDPOOL++,this.state=o.states.UP,this.width=e.width||0,this.height=e.height||0,this._enabled=!e.hasOwnProperty("enabled")||e.enabled,e.clickFunction&&this.displayItem.addListener(a.events.CLICK,e.clickFunction)}return o.IDPOOL=0,o.states={UP:"up",DOWN:"down",HOVER:"hover",DISABLED:"disabled"},o.events=s.extendObj(a.prototype.events,{STATECHANGE:"statechange"}),o.prototype=s.inherit(new n,a.prototype,{events:s.extendObj(n.prototype.events,o.events),states:o.states,getId:function(){return this.id},click:function(t){this._enabled&&this.displayItem.dispatch(a.events.CLICK,{originalEvent:t})},down:function(t){this._enabled&&(this.setState(o.states.DOWN),this.displayItem.dispatch(a.events.DOWN,{originalEvent:t}))},up:function(t){this._enabled&&(this.setState(o.states.UP),this.displayItem.dispatch(a.events.UP,{originalEvent:t}))},hover:function(t){this._enabled&&(this.setState(o.states.HOVER),this.displayItem.dispatch(a.events.HOVER,{originalEvent:t}))},hoverOut:function(t){this._enabled&&(this.setState(o.states.UP),this.displayItem.dispatch(a.events.HOVEROUT,{originalEvent:t}))},setState:function(t){this.state=t,this.displayItem.dispatch(o.events.STATECHANGE,{state:this.state})},setEnabled:function(t){this._enabled=t,this._enabled?this.setState(o.states.UP):this.setState(o.states.DISABLED)},isEnabled:function(){return this._enabled},isUp:function(){return this.state===o.states.UP},isDown:function(){return this.state===o.states.DOWN},contains:function(t,e){var i=this.getStageX(),s=this.getStageY();return i<=t&&t<i+this.width&&s<=e&&e<s+this.height},isButtonVisibleOnStage:function(){return this.isVisibleOnStage()},setWidth:function(t){this.width=t},getWidth:function(){return this.width},setHeight:function(t){this.height=t},getHeight:function(){return this.height}}),o}),n("j13e/display/J13DisplayImgButton",["require","exports","module","./J13Buttonable","./J13DisplayButton","./J13DisplayImg","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13Buttonable"),n=t("./J13DisplayButton"),a=t("./J13DisplayImg"),o=t("../utils/J13Utils");function r(t){var e=t||{};a.call(this,t),this.button=new n(o.extendObj(e,{displayItem:this})),this.upImage=e.upImage||this.image||null,this.downImage=e.downImage||null,this.hoverImage=e.hoverImage||null,this.disabledImage=e.disabledImage||null,e.hasOwnProperty("width")?this.button.width=e.width:this.button.width=this.destRect.getWidth(),e.hasOwnProperty("height")?this.button.height=e.height:this.button.height=this.destRect.getHeight(),this.width=this.button.width,this.height=this.button.height,this.addListener(n.events.STATECHANGE,this.onStateChange.bind(this))}return r.prototype=o.inherit(Object.create(a.prototype),s.prototype,{events:o.extendObj(a.prototype.events,s.prototype.events),onStateChange:function(t){switch(t.data.state){case n.states.UP:this.upImage&&(this.image=this.upImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image));break;case n.states.DOWN:this.downImage&&(this.image=this.downImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image));break;case n.states.HOVER:this.hoverImage&&(this.image=this.hoverImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image));break;case n.states.DISABLED:this.disabledImage&&(this.image=this.disabledImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image))}},getId:function(){return this.button.id},click:function(t){this.button.click(t)},down:function(t){this.button.down(t)},up:function(t){this.button.up(t)},hover:function(t){this.button.hover(t)},hoverOut:function(t){this.button.hoverOut(t)},setEnabled:function(t){this.button.setEnabled(t)},isEnabled:function(){return this.button.isEnabled()},isUp:function(){return this.button.isUp()},isDown:function(){return this.button.isDown()},getWidth:function(){return this.button.getWidth()},setWidth:function(t){return this.button.setWidth(t)},getHeight:function(){return this.button.getHeight()},setHeight:function(t){return this.button.setHeight(t)},contains:function(t,e){var i=this.getStageX(),s=this.getStageY();return i<=t&&t<i+this.getWidth()&&s<=e&&e<s+this.getHeight()},isButtonVisibleOnStage:function(){return this.isVisibleOnStage()}}),r}),n("j13e/display/J13DisplaySprite",["require","exports","module","../utils/J13Utils","./J13DisplayImg","../math/J13Rect"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("./J13DisplayImg"),a=t("../math/J13Rect");function o(t){this.copyFromOptions(t)}return o.prototype=s.inherit(new n,{setFrameId:function(t){var e=this.frameMap[t];e?(this.currentFrameId=t,this.sourceRect=e):console.error("J13DisplaySprite: invalid frame ID.")},copy:function(){var t,e=s.cloneObject(this.options);if(e.frameMap)for(t in e.frameMap)e.frameMap.hasOwnProperty(t)&&(e.frameMap[t]=e.frameMap[t].copy());else e.rect&&(e.rect=e.rect.copy());return new o(e)},copyFromOptions:function(t){var e,i=t||{};if(n.call(this,t),this.options=t,this.frameMap=i.frameMap||null,this.currentFrameId=i.startFrameId||i.currentFrameId||null,this.frameMap){if(this.currentFrameId)this.setFrameId(this.currentFrameId);else for(e in this.frameMap)if(this.frameMap.hasOwnProperty(e)){this.setFrameId(e);break}}else i.rect&&(this.sourceRect=i.rect,this.sourceRect&&!a.isJ13Rect(this.sourceRect,!0)&&a.canBeJ13Rect(this.sourceRect)&&(this.sourceRect=new a(this.sourceRect)));i.destRect||(this.destRect=this.sourceRect.copy())}}),o}),n("j13e/display/J13DisplaySpriteButton",["require","exports","module","./J13DisplayButton","./J13Buttonable","./J13DisplaySprite","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayButton"),n=t("./J13Buttonable"),a=t("./J13DisplaySprite"),o=t("../utils/J13Utils");function r(t){var e=t||{};a.call(this,t),this.button=new s(o.extendObj(e,{displayItem:this})),e.hasOwnProperty("width")?this.button.width=e.width:this.button.width=this.destRect.getWidth(),e.hasOwnProperty("height")?this.button.height=e.height:this.button.height=this.destRect.getHeight(),this.width=this.button.width,this.height=this.button.height,this.addListener(s.events.STATECHANGE,this.onStateChange.bind(this))}return r.prototype=o.inherit(Object.create(a.prototype),n.prototype,{events:o.extendObj(a.prototype.events,n.prototype.events),onStateChange:function(t){if(this.frameMap)switch(t.data.state){case s.states.UP:this.frameMap.hasOwnProperty("up")&&this.setFrameId("up");break;case s.states.DOWN:this.frameMap.hasOwnProperty("down")&&this.setFrameId("down");break;case s.states.HOVER:this.frameMap.hasOwnProperty("hover")&&this.setFrameId("hover");break;case s.states.DISABLED:this.frameMap.hasOwnProperty("disabled")&&this.setFrameId("disabled")}},getId:function(){return this.button.id},click:function(t){this.button.click(t)},down:function(t){this.button.down(t)},up:function(t){this.button.up(t)},hover:function(t){this.button.hover(t)},hoverOut:function(t){this.button.hoverOut(t)},setEnabled:function(t){this.button.setEnabled(t)},isEnabled:function(){return this.button.isEnabled()},isUp:function(){return this.button.isUp()},isDown:function(){return this.button.isDown()},getWidth:function(){return this.button.getWidth()},setWidth:function(t){return this.button.setWidth(t)},getHeight:function(){return this.button.getHeight()},setHeight:function(t){return this.button.setHeight(t)},contains:function(t,e){var i=this.getStageX(),s=this.getStageY();return i<=t&&t<i+this.getWidth()&&s<=e&&e<s+this.getHeight()},isButtonVisibleOnStage:function(){return this.isVisibleOnStage()}}),r}),n("j13e/display/J13DisplayRoundedRect",["require","exports","module","./J13DisplayRect","../utils/J13Utils","./J13DisplayDrawOptions"],function(t,e,i){"use strict";var s=t("./J13DisplayRect"),n=t("../utils/J13Utils"),a=t("./J13DisplayDrawOptions");function o(t){var e=t||{};s.call(this,t),this.tlRadius=e.tlRadius||e.topLeftRadius||0,this.trRadius=e.trRadius||e.topRightRadius||0,this.blRadius=e.blRadius||e.bottomLeftRadius||0,this.brRadius=e.brRadius||e.bottomRightRadius||0,e.hasOwnProperty("r")?this.setRadius(e.r):e.hasOwnProperty("radius")&&this.setRadius(e.radius)}return o.prototype=n.inherit(new s,{setRadius:function(t){this.tlRadius=this.trRadius=this.blRadius=this.brRadius=t},render:function(t,e,i,s){s=s.canvasContext;this.drawOptions.applyOptions(s),s.beginPath(),s.moveTo(this.rect.left+this.tlRadius,this.rect.top),s.lineTo(this.rect.right-this.trRadius,this.rect.top),s.arc(this.rect.right-this.trRadius,this.rect.top+this.trRadius,this.trRadius,1.5*Math.PI,2*Math.PI),s.lineTo(this.rect.right,this.rect.bottom-this.brRadius),s.arc(this.rect.right-this.brRadius,this.rect.bottom-this.brRadius,this.brRadius,0,.5*Math.PI),s.lineTo(this.rect.left+this.blRadius,this.rect.bottom),s.arc(this.rect.left+this.blRadius,this.rect.bottom-this.blRadius,this.blRadius,.5*Math.PI,Math.PI),s.lineTo(this.rect.left,this.rect.top+this.tlRadius),s.arc(this.rect.left+this.tlRadius,this.rect.top+this.tlRadius,this.tlRadius,Math.PI,1.5*Math.PI),s.closePath(),this.drawOptions.applyPostPathOptions(s),0<(this.drawFlags&a.drawFlags.OUTLINE_BEHIND)&&s.stroke(),0<(this.drawFlags&a.drawFlags.FILL)&&s.fill(),0<(this.drawFlags&a.drawFlags.OUTLINE_FRONT)&&s.stroke()}}),o}),n("src/scenes/HiScoreScene",["require","exports","module","src/Resources","src/Settings","src/utils/HiScoreManager","./Scene","j13e/utils/J13Utils","j13e/display/J13DisplayText","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayDrawOptions","j13e/display/J13DisplayImg","j13e/display/J13DisplayImgButton","j13e/display/J13DisplaySpriteButton","j13e/math/J13Rect","j13e/display/J13DisplayRoundedRect","j13e/anim/J13Anim","j13e/display/J13DisplayRect"],function(t,e,i){"use strict";var n=t("src/Resources"),a=t("src/Settings"),o=t("src/utils/HiScoreManager"),r=t("./Scene"),s=t("j13e/utils/J13Utils"),h=t("j13e/display/J13DisplayText"),l=(t("j13e/display/J13DisplayItemContainer"),t("j13e/display/J13DisplayDrawOptions")),d=t("j13e/display/J13DisplayImg"),u=t("j13e/display/J13DisplayImgButton"),c=(t("j13e/display/J13DisplaySpriteButton"),t("j13e/math/J13Rect")),p=(t("j13e/display/J13DisplayRoundedRect"),t("j13e/anim/J13Anim"));t("j13e/display/J13DisplayRect");function g(t){var e=t||{},s=this;r.call(this,t),this.width=e.width||0,this.height=e.height||0,this.opacity=1,this.hiScoreManager=new o({cookieSettings:{name:"gmflappycopter_hsl",expires:63072e3},order:o.order.DESC,maxEntries:1,minScore:1}),this.bg=new d({img:n.loadedImages[n.images.hiScoreBg],x:this.width/2-157,y:130,destRect:new c({width:314,height:424})}),this.addChild(this.bg),this.youScoredText=new h({font:"30px Pixel5x5",x:this.width/2,y:a.kik?180:200,text:"YOU SCORED",textAlign:"center",textBaseline:"top",fillStyle:"#ffffff",strokeStyle:"#523842",lineWidth:5,drawFlags:l.drawFlags.FILL|l.drawFlags.OUTLINE_BEHIND}),this.addChild(this.youScoredText),this.scoreText=new h({font:"70px Pixel5x5",x:this.width/2,y:a.kik?230:250,text:"0",textAlign:"center",textBaseline:"top",fillStyle:"#fca048",strokeStyle:"#523842",lineWidth:6,drawFlags:l.drawFlags.FILL|l.drawFlags.OUTLINE_BEHIND}),this.addChild(this.scoreText),this.avoidThePipesText=new h({font:"30px Pixel5x5",x:this.width/2,y:120,text:"AVOID THE PIPES!",textAlign:"center",textBaseline:"top",fillStyle:"#ffffff",visible:!1}),this.addChild(this.avoidThePipesText),this.retryButton=new u({id:n.buttons.retry,img:n.loadedImages[n.images.retryButton],clickFunction:function(){n.gsm.transitioning||(n.gsm.toState(n.gameStates.level,{reset:!0}),n.soundManager.play(n.soundNames.menu))},visible:!0,y:a.kik?320:350,width:215,height:66}),this.retryButton.x=this.width/2-this.retryButton.image.width/2,this.addChild(this.retryButton),this.retryButton.addListener(this.retryButton.events.UP,this.onButtonUp.bind(this)),this.retryButton.addListener(this.retryButton.events.DOWN,this.onButtonDown.bind(this)),this.retryButton.addListener(this.retryButton.events.HOVER,this.onButtonHover.bind(this)),this.retryButton.addListener(this.retryButton.events.HOVEROUT,this.onButtonHoverOut.bind(this)),this.rankButton=new u({id:n.buttons.rank,img:n.loadedImages[n.images.rankButton],clickFunction:this.showGmapiLeaderboard.bind(this),y:a.kik?385:430,width:215,height:66}),this.rankButton.x=this.width/2-this.rankButton.image.width/2,this.addChild(this.rankButton),this.rankButton.addListener(this.rankButton.events.UP,this.onButtonUp.bind(this)),this.rankButton.addListener(this.rankButton.events.DOWN,this.onButtonDown.bind(this)),this.rankButton.addListener(this.rankButton.events.HOVER,this.onButtonHover.bind(this)),this.rankButton.addListener(this.rankButton.events.HOVEROUT,this.onButtonHoverOut.bind(this)),this.kikButton=new u({id:n.buttons.kik,img:n.loadedImages[n.images.kikButton],clickFunction:this.game.kikShare.bind(this.game),visible:a.kik,y:450,width:215,height:66}),this.kikButton.x=this.width/2-this.kikButton.image.width/2,this.addChild(this.kikButton),this.kikButton.addListener(this.kikButton.events.UP,this.onButtonUp.bind(this)),this.kikButton.addListener(this.kikButton.events.DOWN,this.onButtonDown.bind(this)),this.kikButton.addListener(this.kikButton.events.HOVER,this.onButtonHover.bind(this)),this.kikButton.addListener(this.kikButton.events.HOVEROUT,this.onButtonHoverOut.bind(this)),this.showAnimEndCallback=null,this.showAnim=new p({startValue:-this.height,endValue:0,duration:500,timeFunction:p.easingFunctions.easeOutCubic,startCallback:function(){s.visible=!0,s.retryButton.setEnabled(!1),n.soundManager.play(n.soundNames.menu)},stepCallback:function(t){s.y=t},endCallback:function(t,e,i){s.retryButton.setEnabled(!0),s.showAnimEndCallback&&s.showAnimEndCallback(t,e,i)}})}return g.DEFAULT_BUTTON_SPACING=50,g.MIN_SCORE=2,g.prototype=s.inherit(new r,{onButtonHover:function(t){t.source.anchorY=3},onButtonHoverOut:function(t){t.source.anchorY=0},onButtonDown:function(t){t.source.anchorY=-2},onButtonUp:function(t){t.source.anchorY=0},showGmapiLeaderboard:function(){window.gmapi&&window.gmapi(function(t){t.game.leaderboard.show()})},updateHiScoreList:function(e){var t=(new Date).getTime();e&&g.MIN_SCORE<=e&&(this.hiScoreManager.addScore(t,e),window.gmapi&&window.gmapi(function(t){t.game.leaderboard.sendScore(e)})),this.scoreText.text=e.toString()},show:function(t,e){if(t&&t.hasOwnProperty("score"))if(this.updateHiScoreList(t.score),t.score<5&&t.hasOwnProperty("hitType"))switch(this.avoidThePipesText.visible=!0,t.hitType){case n.hitTypes.ceiling:this.avoidThePipesText.text="AVOID THE CEILING!";break;case n.hitTypes.floor:this.avoidThePipesText.text="AVOID THE FLOOR!";break;case n.hitTypes.pipe:this.avoidThePipesText.text="AVOID THE PIPES!"}else this.avoidThePipesText.visible=!1;this.showAnimEndCallback=t&&t.callback?t.callback:null,n.animManager.restartAnim(this.showAnim)},hide:function(){this.visible=!1,this.y=-this.height}}),g}),n("j13e/display/J13DisplayContainerButton",["require","exports","module","./J13DisplayItemContainer","./J13DisplayButton","./J13Buttonable","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItemContainer"),n=t("./J13DisplayButton"),a=t("./J13Buttonable"),o=t("../utils/J13Utils");function r(t){var e=t||{};s.call(this,t),this.button=new n(o.extendObj(e,{displayItem:this})),this.width=this.button.getWidth(),this.height=this.button.getHeight()}return r.prototype=o.inherit(Object.create(s.prototype),a.prototype,{events:o.extendObj(s.prototype.events,a.prototype.events),getId:function(){return this.button.id},click:function(t){this.button.click(t)},down:function(t){this.button.down(t)},up:function(t){this.button.up(t)},hover:function(t){this.button.hover(t)},hoverOut:function(t){this.button.hoverOut(t)},setEnabled:function(t){this.button.setEnabled(t)},isEnabled:function(){return this.button.isEnabled()},isUp:function(){return this.button.isUp()},isDown:function(){return this.button.isDown()},getWidth:function(){return this.button.getWidth()},setWidth:function(t){return this.button.setWidth(t)},getHeight:function(){return this.button.getHeight()},setHeight:function(t){return this.button.setHeight(t)},contains:function(t,e){var i=this.getStageX(),s=this.getStageY();return i<=t&&t<i+this.getWidth()&&s<=e&&e<s+this.getHeight()},isButtonVisibleOnStage:function(){return this.isVisibleOnStage()}}),r}),n("src/screens/PlayScreen",["require","exports","module","src/Resources","./Screen","./playparts/Level","src/scenes/TutScene","src/scenes/HiScoreScene","j13e/math/J13Rect","j13e/utils/J13Utils","j13e/anim/J13Anim","j13e/display/J13DisplayImg","j13e/display/J13DisplayRect","j13e/display/J13DisplayText","j13e/display/J13DisplayLayer","j13e/display/J13DisplaySpriteButton","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayContainerButton"],function(t,e,i){"use strict";var n=t("src/Resources"),s=t("./Screen"),a=t("./playparts/Level"),o=t("src/scenes/TutScene"),r=t("src/scenes/HiScoreScene"),h=t("j13e/math/J13Rect"),l=t("j13e/utils/J13Utils"),d=t("j13e/anim/J13Anim"),u=t("j13e/display/J13DisplayImg"),c=t("j13e/display/J13DisplayRect"),p=t("j13e/display/J13DisplayText"),g=t("j13e/display/J13DisplayLayer"),f=t("j13e/display/J13DisplaySpriteButton"),m=t("j13e/display/J13DisplayItemContainer"),y=t("j13e/display/J13DisplayContainerButton");function v(t){var e=this,t=(s.call(this,t),this.numPlays=0,this.score=0,this.level=null,this.bg=new c({rect:new h({width:this.width,height:this.height}),fillStyle:"#000000"}),this.addChild(this.bg),this.parallax=new c({rect:new h({width:this.width,height:this.height}),visible:!1}),this.addChild(this.parallax),this.levelLayer=new g,this.addChild(this.levelLayer),this.title=new u({img:n.loadedImages[n.images.title],anchorX:169,anchorY:0,x:this.width/2,y:60,destRect:new h({width:338,height:150})}),this.addChild(this.title),this.scoreText=new p({font:"70px Pixel5x5",x:this.width/2,y:250,text:"0",textAlign:"center",textBaseline:"top",fillStyle:"#ffffff",opacity:.25}),this.addChild(this.scoreText),this.tutScene=new o({game:this,width:this.width,height:this.height,y:30}),this.addChild(this.tutScene),this.hiScoreScene=new r({game:this.game,width:this.width,height:this.height,visible:!1}),this.addChild(this.hiScoreScene),n.volumeSheet.getSprite("main")),i=(this.volumeButton=new f(l.extendObj(t.options,{id:n.buttons.volume,x:this.width-t.destRect.getWidth()-10,y:39,clickFunction:this.volumeButtonCallback.bind(this)})),this.addChild(this.volumeButton),this.volumeButton.addListener(this.volumeButton.events.UP,this.onButtonUp.bind(this)),this.volumeButton.addListener(this.volumeButton.events.DOWN,this.onButtonDown.bind(this)),this.volumeButton.addListener(this.volumeButton.events.HOVER,this.onButtonHover.bind(this)),this.volumeButton.addListener(this.volumeButton.events.HOVEROUT,this.onButtonHoverOut.bind(this)),this.version=new m({x:0,y:this.height-20,visible:!1,opacity:0})),t=(this.addChild(i),new c({rect:new h({width:this.width,height:20}),fillStyle:"#000000",opacity:.8})),t=(i.addChild(t),new p({text:"v"+window.gameVersion,textAlign:"left",textBaseline:"top",x:5,y:2,font:"14px Arial",fillStyle:"#ffffff"})),t=(i.addChild(t),new y({id:n.buttons.version,clickFunction:function(){n.animManager.startAnim(new d({duration:1e3,startValue:1,endValue:0,startCallback:function(){i.visible=!0},stepCallback:function(t){i.opacity=t},endCallback:function(){i.visible=!1}}))},width:this.volumeButton.x,height:this.volumeButton.y+this.volumeButton.height}));this.addChild(t),this.firstPlayButton=new y({id:n.buttons.start,clickFunction:this.onFirstPlayButtonClick.bind(this),y:this.volumeButton.y+this.volumeButton.height,width:this.width,height:this.height-this.volumeButton.y-this.volumeButton.height}),this.addChild(this.firstPlayButton),this.scoreAnim=new d({startValue:.8,endValue:this.scoreText.opacity,duration:500,stepCallback:function(t){e.scoreText.opacity=t}}),this.state=v.states.idle,n.gsm.addListener(n.gsm.events.stateChanged,this.onGameStateChange.bind(this)),n.mouseManager.addListener(n.mouseManager.events.DOWN,this.onMouseDown.bind(this)),n.keyboardManager.addListener(n.keyboardManager.events.DOWN,this.onKeyDown.bind(this))}return v.states={idle:1,tutorial:2,playing:3,levelFinished:4},v.bgSettings=[{image:n.images.bgDay,parallax:"dayStars"},{image:n.images.bgNight,parallax:"stars"}],v.prototype=l.inherit(new s,{onFirstPlayButtonClick:function(t){this.firstPlayButton&&(this.removeChild(this.firstPlayButton),this.firstPlayButton=null)},onButtonHover:function(t){t.source.anchorY=3},onButtonHoverOut:function(t){t.source.anchorY=0},onButtonDown:function(t){t.source.anchorY=-2},onButtonUp:function(t){t.source.anchorY=0},updateScoreText:function(t){this.scoreText.text=this.score.toString(),t||n.animManager.restartAnim(this.scoreAnim)},onGameStateChange:function(t){var e;t.data.newState.id===n.gameStates.hiScore&&(this.hiScoreScene.show(t.data.stateData),e=this.volumeButton,n.animManager.startAnim(new d({startValue:0,endValue:1,duration:500,startCallback:function(){e.visible=!0},stepCallback:function(t){e.opacity=t}})))},hideAfterFlap:function(){this.tutScene.hide();var e,i=this.scoreText,s=(n.animManager.startAnim(new d({startValue:0,endValue:.25,duration:500,stepCallback:function(t){i.opacity=t}})),this.title.visible&&(e=this.title,n.animManager.startAnim(new d({startValue:1,endValue:0,duration:500,stepCallback:function(t){e.opacity=t},endCallback:function(){e.visible=!1}}))),this.volumeButton);n.animManager.startAnim(new d({startValue:1,endValue:0,duration:500,stepCallback:function(t){s.opacity=t},endCallback:function(){s.visible=!1}}))},flapLeft:function(t){this.state===v.states.tutorial&&(this.hideAfterFlap(),this.state=v.states.playing),this.level&&this.level.flapLeft()},flapRight:function(t){this.state===v.states.tutorial&&(this.hideAfterFlap(),this.state=v.states.playing),this.level&&this.level.flapRight()},mainMenuButtonCallback:function(t){n.gsm.transitioning||(n.gsm.toState(n.gameStates.mainMenu),n.soundManager.play(n.soundNames.menu))},onPipeCleared:function(t){this.score+=1,this.updateScoreText()},onLevelFinished:function(t){this.state=v.states.levelFinished,n.gsm.toState(n.gameStates.gameOver,{score:this.score})},onMouseDown:function(t){n.gsm.getCurrentStateId()===n.gameStates.level&&t.data.scaledY>this.volumeButton.y+this.volumeButton.height&&(t.data.scaledX<this.width/2?this.flapLeft():this.flapRight())},onKeyDown:function(t){switch(t.data.keyCode){case n.keyboardManager.keys.A:case n.keyboardManager.keys.ARROWLEFT:this.flapLeft();break;case n.keyboardManager.keys.D:case n.keyboardManager.keys.ARROWRIGHT:this.flapRight()}},volumeButtonCallback:function(t){n.soundManager.toggleMute(),n.soundManager.isMuted()||n.soundManager.play(n.soundNames.flap),this.updateVolumeButton()},updateVolumeButton:function(){n.soundManager.isMuted()?this.volumeButton.setFrameId("off"):this.volumeButton.setFrameId("on")},update:function(t,e,i,s){this.level&&(this.level.update(t,e,i,s),this.parallax.drawOptions.postPathOptions.y=this.level.y/4)},show:function(t){t&&t.hasOwnProperty("reset")&&this.reset(),s.prototype.show.call(this,t)},reset:function(){this.updateVolumeButton(),this.numPlays+=1,this.hiScoreScene.hide(),this.score=0,this.tutScene.show(),this.updateScoreText(!0),this.scoreText.opacity=0,this.volumeButton.visible=!0,this.volumeButton.opacity=1,this.level&&(this.level.removeAllListeners(),this.levelLayer.removeChild(this.level));var t=Math.floor(Math.random()*v.bgSettings.length),t=v.bgSettings[t];t.color?(this.bg.drawOptions.fillStyle=t.color,this.bg.visible=!0):this.bg.visible=!1,t.parallax?(this.parallax.drawOptions.fillStyle=n.patterns[t.parallax],this.parallax.visible=!0):this.parallax.visible=!1,this.level=new a({game:this.game,width:this.width,height:this.height,bgImage:n.loadedImages[t.image]}),this.level.addListener(a.events.finished,this.onLevelFinished.bind(this)),this.level.addListener(a.events.pipeCleared,this.onPipeCleared.bind(this)),this.levelLayer.addChild(this.level),this.state=v.states.tutorial}}),v}),n("j13e/utils/J13Loader",["require","exports","module","./J13Utils","./J13EventDispatcher"],function(t,e,i){"use strict";var s=t("./J13Utils"),n=t("./J13EventDispatcher");function a(t){var e=t||{};n.call(this,t),this.loaded=0,this.total=0,this.errors=0,this.includeInPreload=!!e.hasOwnProperty("includeInPreload")&&e.includeInPreload,this.strictLoad=!e.hasOwnProperty("strictLoad")||e.strictLoad,this.state=a.states.idle}return a.states={idle:1,loading:2,loaded:3},a.events={load:"load",allLoad:"allload",error:"error"},a.prototype=s.inherit(new n,{states:a.states,events:a.events,startLoading:function(){this.changeToLoadingState()},onLoad:function(t){this.loaded+=1,this.dispatch(this.events.load,{loaded:this.strictLoad?this.loaded:this.loaded+this.errors,total:this.total,errors:this.errors,originalEvent:t}),(this.strictLoad&&this.loaded>=this.total||!this.strictLoad&&this.loaded+this.errors>=this.total)&&this.onAllLoad(t)},onError:function(t){this.dispatch(this.events.error,{loaded:this.strictLoad?this.loaded:this.loaded+this.errors,total:this.total,errors:this.errors,originalEvent:t})},onAllLoad:function(t){this.changeToLoadedState(),this.dispatch(this.events.allLoad,{loaded:this.strictLoad?this.loaded:this.loaded+this.errors,total:this.total,errors:this.errors,originalEvent:t})},changeToLoadingState:function(){this.state=a.states.loading},changeToLoadedState:function(){this.state=a.states.loaded},isFullyLoaded:function(){return this.state===a.states.loaded}}),a});var l,d={},C=null,A=!0,O=!1;try{"undefined"!=typeof AudioContext?C=new AudioContext:"undefined"!=typeof webkitAudioContext?C=new webkitAudioContext:A=!1}catch(t){A=!1}if(!A)if("undefined"!=typeof Audio)try{new Audio}catch(t){O=!0}else O=!0;function x(t){this._volume=1,this._muted=!1,this.usingWebAudio=A,this.ctx=C,this.noAudio=O,this._howls=[],this._codecs=t,this.iOSAutoEnable=!0}function I(t){var e=this;e._autoplay=t.autoplay||!1,e._buffer=t.buffer||!1,e._duration=t.duration||0,e._format=t.format||null,e._loop=t.loop||!1,e._loaded=!1,e._sprite=t.sprite||{},e._src=t.src||"",e._pos3d=t.pos3d||[0,0,-.5],e._volume=void 0!==t.volume?t.volume:1,e._urls=t.urls||[],e._rate=t.rate||1,e._model=t.model||null,e._onload=[t.onload||function(){}],e._onloaderror=[t.onloaderror||function(){}],e._onend=[t.onend||function(){}],e._onpause=[t.onpause||function(){}],e._onplay=[t.onplay||function(){}],e._onendTimer=[],e._webAudio=A&&!e._buffer,e._audioNode=[],e._webAudio&&e._setupAudioNode(),void 0!==C&&C&&P.iOSAutoEnable&&P._enableiOSAudio(),P._howls.push(e),e.load()}A&&((l=void 0===C.createGain?C.createGainNode():C.createGain()).gain.value=1,l.connect(C.destination)),x.prototype={volume:function(t){var e=this;if(0<=(t=parseFloat(t))&&t<=1){for(var i in e._volume=t,A&&(l.gain.value=t),e._howls)if(e._howls.hasOwnProperty(i)&&!1===e._howls[i]._webAudio)for(var s=0;s<e._howls[i]._audioNode.length;s++)e._howls[i]._audioNode[s].volume=e._howls[i]._volume*e._volume;return e}return A?l.gain.value:e._volume},mute:function(){return this._setMuted(!0),this},unmute:function(){return this._setMuted(!1),this},_setMuted:function(t){var e,i=this;for(e in i._muted=t,A&&(l.gain.value=t?0:i._volume),i._howls)if(i._howls.hasOwnProperty(e)&&!1===i._howls[e]._webAudio)for(var s=0;s<i._howls[e]._audioNode.length;s++)i._howls[e]._audioNode[s].muted=t},codecs:function(t){return this._codecs[t]},_enableiOSAudio:function(){var i,s=this;if(!C||!s._iOSEnabled&&/iPhone|iPad|iPod/i.test(navigator.userAgent))return s._iOSEnabled=!1,i=function(){var t=C.createBuffer(1,1,22050),e=C.createBufferSource();e.buffer=t,e.connect(C.destination),void 0===e.start?e.noteOn(0):e.start(0),setTimeout(function(){e.playbackState!==e.PLAYING_STATE&&e.playbackState!==e.FINISHED_STATE||(s._iOSEnabled=!0,s.iOSAutoEnable=!1,window.removeEventListener("touchstart",i,!1))},0)},window.addEventListener("touchstart",i,!1),s}};var T,R,E,M,e=null,D={},P=(O||(e=new Audio,D={mp3:!!e.canPlayType("audio/mpeg;").replace(/^no$/,""),opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")}),new x(D));I.prototype={load:function(){var t=this,e=null;if(!O){for(var i,s,n,a,o=0;o<t._urls.length;o++){if(t._format)i=t._format;else{if(s=t._urls[o],!(i=(i=/^data:audio\/([^;,]+);/i.exec(s))||/\.([^.]+)$/.exec(s.split("?",1)[0])))return void t.on("loaderror");i=i[1].toLowerCase()}if(D[i]){e=t._urls[o];break}}if(e)return t._src=e,t._webAudio?T(t,e):((n=new Audio).addEventListener("error",function(){n.error&&4===n.error.code&&(x.noAudio=!0),t.on("loaderror",{type:n.error?n.error.code:0})},!1),t._audioNode.push(n),n.src=e,n._pos=0,n.preload="auto",n.volume=P._muted?0:t._volume*P.volume(),a=function(){t._duration=Math.ceil(10*n.duration)/10,0===Object.getOwnPropertyNames(t._sprite).length&&(t._sprite={_default:[0,1e3*t._duration]}),t._loaded||(t._loaded=!0,t.on("load")),t._autoplay&&t.play(),n.removeEventListener("canplaythrough",a,!1)},n.addEventListener("canplaythrough",a,!1),n.load()),t}t.on("loaderror")},urls:function(t){var e=this;return t?(e.stop(),e._urls="string"==typeof t?[t]:t,e._loaded=!1,e.load(),e):e._urls},play:function(p,g){var f=this;return"function"==typeof p&&(g=p),p&&"function"!=typeof p||(p="_default"),f._loaded?f._sprite[p]?f._inactiveNode(function(t){t._sprite=p;var e,i,s,n,a,o=0<t._pos?t._pos:f._sprite[p][0]/1e3,r=0,h=(f._webAudio?(r=f._sprite[p][1]/1e3-t._pos,0<t._pos&&(o=f._sprite[p][0]/1e3+o)):r=f._sprite[p][1]/1e3-(o-f._sprite[p][0]/1e3),!(!f._loop&&!f._sprite[p][2])),l="string"==typeof g?g:Math.round(Date.now()*Math.random())+"";if(e={id:l,sprite:p,loop:h},d=setTimeout(function(){!f._webAudio&&h&&f.stop(e.id).play(p,e.id),f._webAudio&&!h&&(f._nodeById(e.id).paused=!0,f._nodeById(e.id)._pos=0,f._clearEndTimer(e.id)),f._webAudio||h||f.stop(e.id),f.on("end",l)},1e3*r),f._onendTimer.push({timer:d,id:e.id}),f._webAudio){var d=f._sprite[p][0]/1e3,u=f._sprite[p][1]/1e3;t.id=l,t.paused=!1,M(f,[h,d,u],l),f._playStart=C.currentTime,t.gain.value=f._volume,void 0===t.bufferSource.start?t.bufferSource.noteGrainOn(0,o,r):t.bufferSource.start(0,o,r)}else{if(4!==t.readyState&&(t.readyState||!navigator.isCocoonJS))return f._clearEndTimer(l),i=f,s=p,n=g,(a=t).addEventListener("canplaythrough",c,!1),f;t.readyState=4,t.id=l,t.currentTime=o,t.muted=P._muted||t.muted,t.volume=f._volume*P.volume(),setTimeout(function(){t.play()},0)}function c(){i.play(s,n),a.removeEventListener("canplaythrough",c,!1)}return f.on("play"),"function"==typeof g&&g(l),f}):"function"==typeof g&&g():f.on("load",function(){f.play(p,g)}),f},pause:function(t){var e=this;if(e._loaded){e._clearEndTimer(t);var i=t?e._nodeById(t):e._activeNode();if(i)if(i._pos=e.pos(null,t),e._webAudio){if(!i.bufferSource||i.paused)return e;i.paused=!0,void 0===i.bufferSource.stop?i.bufferSource.noteOff(0):i.bufferSource.stop(0)}else i.pause();e.on("pause")}else e.on("play",function(){e.pause(t)});return e},stop:function(t){var e=this;if(e._loaded){e._clearEndTimer(t);var i=t?e._nodeById(t):e._activeNode();if(i)if(i._pos=0,e._webAudio){if(!i.bufferSource||i.paused)return e;i.paused=!0,void 0===i.bufferSource.stop?i.bufferSource.noteOff(0):i.bufferSource.stop(0)}else isNaN(i.duration)||(i.pause(),i.currentTime=0)}else e.on("play",function(){e.stop(t)});return e},mute:function(t){var e,i=this;return i._loaded?(e=t?i._nodeById(t):i._activeNode())&&(i._webAudio?e.gain.value=0:e.muted=!0):i.on("play",function(){i.mute(t)}),i},unmute:function(t){var e,i=this;return i._loaded?(e=t?i._nodeById(t):i._activeNode())&&(i._webAudio?e.gain.value=i._volume:e.muted=!1):i.on("play",function(){i.unmute(t)}),i},volume:function(t,e){var i,s=this;return 0<=(t=parseFloat(t))&&t<=1?(s._volume=t,s._loaded?(i=e?s._nodeById(e):s._activeNode())&&(s._webAudio?i.gain.value=t:i.volume=t*P.volume()):s.on("play",function(){s.volume(t,e)}),s):s._volume},loop:function(t){return"boolean"==typeof t?(this._loop=t,this):this._loop},sprite:function(t){return"object"==typeof t?(this._sprite=t,this):this._sprite},pos:function(t,e){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 s=e?i._nodeById(e):i._activeNode();if(s)return 0<=t?(i.pause(e),s._pos=t,i.play(s._sprite,e),i):i._webAudio?s._pos+(C.currentTime-i._playStart):s.currentTime;if(0<=t)return i;for(var n=0;n<i._audioNode.length;n++)if(i._audioNode[n].paused&&4===i._audioNode[n].readyState)return i._webAudio?i._audioNode[n]._pos:i._audioNode[n].currentTime},pos3d:function(t,e,i,s){var n,a=this;if(e=void 0!==e&&e?e:0,i=void 0!==i&&i?i:-.5,a._loaded){if(!(0<=t||t<0))return a._pos3d;a._webAudio&&(n=s?a._nodeById(s):a._activeNode())&&(a._pos3d=[t,e,i],n.panner.setPosition(t,e,i),n.panner.panningModel=a._model||"HRTF")}else a.on("play",function(){a.pos3d(t,e,i,s)});return a},fade:function(t,s,e,n,a){var o=this,i=Math.abs(t-s),r=s<t?"down":"up",h=i/.01,l=e/h;if(!o._loaded)return o.on("load",function(){o.fade(t,s,e,n,a)}),o;o.volume(t,a);for(var d=1;d<=h;d++)!function(){var t=o._volume+("up"==r?.01:-.01)*d,e=Math.round(1e3*t)/1e3,i=s;setTimeout(function(){o.volume(e,a),e===i&&n&&n()},l*d)}()},fadeIn:function(t,e,i){return this.volume(0).play().fade(0,t,e,i)},fadeOut:function(t,e,i,s){var n=this;return n.fade(n._volume,t,e,function(){i&&i(),n.pause(s),n.on("end")},s)},_nodeById:function(t){for(var e=this._audioNode[0],i=0;i<this._audioNode.length;i++)if(this._audioNode[i].id===t){e=this._audioNode[i];break}return e},_activeNode:function(){for(var t=null,e=0;e<this._audioNode.length;e++)if(!this._audioNode[e].paused){t=this._audioNode[e];break}return this._drainPool(),t},_inactiveNode:function(t){for(var e,i,s,n=this,a=null,o=0;o<n._audioNode.length;o++)if(n._audioNode[o].paused&&4===n._audioNode[o].readyState){t(n._audioNode[o]),a=!0;break}n._drainPool(),a||(n._webAudio?(e=n._setupAudioNode(),t(e)):(n.load(),e=n._audioNode[n._audioNode.length-1],i=navigator.isCocoonJS?"canplaythrough":"loadedmetadata",s=function(){e.removeEventListener(i,s,!1),t(e)},e.addEventListener(i,s,!1)))},_drainPool:function(){for(var t=this,e=0,i=0;i<t._audioNode.length;i++)t._audioNode[i].paused&&e++;for(i=t._audioNode.length-1;0<=i&&!(e<=5);i--)t._audioNode[i].paused&&(t._webAudio&&t._audioNode[i].disconnect(0),e--,t._audioNode.splice(i,1))},_clearEndTimer:function(t){for(var e=0,i=0;i<this._onendTimer.length;i++)if(this._onendTimer[i].id===t){e=i;break}var s=this._onendTimer[e];s&&(clearTimeout(s.timer),this._onendTimer.splice(e,1))},_setupAudioNode:function(){var t=this,e=t._audioNode,i=t._audioNode.length;return e[i]=void 0===C.createGain?C.createGainNode():C.createGain(),e[i].gain.value=t._volume,e[i].paused=!0,e[i]._pos=0,e[i].readyState=4,e[i].connect(l),e[i].panner=C.createPanner(),e[i].panner.panningModel=t._model||"equalpower",e[i].panner.setPosition(t._pos3d[0],t._pos3d[1],t._pos3d[2]),e[i].panner.connect(e[i]),e[i]},on:function(t,e){var i=this["_on"+t];if("function"==typeof e)i.push(e);else for(var s=0;s<i.length;s++)e?i[s].call(this,e):i[s].call(this);return this},off:function(t,e){var i=this["_on"+t],s=e?e.toString():null;if(s){for(var n=0;n<i.length;n++)if(s===i[n].toString()){i.splice(n,1);break}}else this["_on"+t]=[];return this},unload:function(){for(var t=this,e=t._audioNode,i=0;i<t._audioNode.length;i++)e[i].paused||(t.stop(e[i].id),t.on("end",e[i].id)),t._webAudio?e[i].disconnect(0):e[i].src="";for(i=0;i<t._onendTimer.length;i++)clearTimeout(t._onendTimer[i].timer);var s=P._howls.indexOf(t);null!==s&&0<=s&&P._howls.splice(s,1),delete d[t._src]}},A&&(T=function(t,e){if(e in d)t._duration=d[e].duration,E(t);else if(/^data:[^;]+;base64,/.test(e)){for(var i=atob(e.split(",")[1]),s=new Uint8Array(i.length),n=0;n<i.length;++n)s[n]=i.charCodeAt(n);R(s.buffer,t,e)}else{var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){R(a.response,t,e)},a.onerror=function(){t._webAudio&&(t._buffer=!0,t._webAudio=!1,t._audioNode=[],delete t._gainNode,delete d[e],t.load())};try{a.send()}catch(t){a.onerror()}}},R=function(t,e,i){C.decodeAudioData(t,function(t){t&&E(e,d[i]=t)},function(t){e.on("loaderror")})},E=function(t,e){t._duration=e?e.duration:t._duration,0===Object.getOwnPropertyNames(t._sprite).length&&(t._sprite={_default:[0,1e3*t._duration]}),t._loaded||(t._loaded=!0,t.on("load")),t._autoplay&&t.play()},M=function(t,e,i){i=t._nodeById(i);i.bufferSource=C.createBufferSource(),i.bufferSource.buffer=d[t._src],i.bufferSource.connect(i.panner),i.bufferSource.loop=e[0],e[0]&&(i.bufferSource.loopStart=e[1],i.bufferSource.loopEnd=e[1]+e[2]),i.bufferSource.playbackRate.value=t._rate}),n.amd&&n("howler/howler",[],function(){return{Howler:P,Howl:I}}),"undefined"!=typeof exports&&(exports.Howler=P,exports.Howl=I),"undefined"!=typeof window&&(window.Howler=P,window.Howl=I),n("src/utils/SoundManager",["require","exports","module","j13e/utils/J13Loader","j13e/utils/J13Utils","howler/howler","src/utils/PersistentStorage"],function(t,e,i){"use strict";var s=t("j13e/utils/J13Loader"),n=t("j13e/utils/J13Utils"),a=t("howler/howler"),o=t("src/utils/PersistentStorage");function r(t){var e=t||{};s.call(this,t),this.soundsToLoad=e.sounds||{},this.sounds={},"on"===o.get("sounds","on",31536e3)?this.unmute():this.mute()}return r.prototype=n.inherit(new s,{startLoading:function(){var t,e=this.onLoad.bind(this),i=this.onError.bind(this);for(t in this.soundsToLoad)this.soundsToLoad.hasOwnProperty(t)&&(this.sounds[t]=new a.Howl({urls:this.soundsToLoad[t].urls,volume:this.soundsToLoad[t].hasOwnProperty("volume")?this.soundsToLoad[t].volume:1,onload:e,onloaderror:i}),this.total+=1);0===this.total&&this.onAllLoad()},get:function(t){return this.sounds[t]},play:function(t,e){t=this.sounds[t];return t&&t.play(e),t},replay:function(t,e){t=this.sounds[t];return t&&(t.stop(e),t.play()),t},stop:function(t,e){t=this.sounds[t];return t&&t.stop(e),t},mute:function(t){return t||o.set("sounds","off",31536e3),a.Howler.mute()},unmute:function(t){return t||o.set("sounds","on",31536e3),a.Howler.unmute()},isMuted:function(){return a.Howler._muted},toggleMute:function(t){return this.isMuted()?this.unmute(t):this.mute(t),this.isMuted()}}),r}),n("j13e/utils/J13DebugManager",["require","exports","module","./J13Utils"],function(t,e,i){"use strict";var s=t("./J13Utils");function n(t){t=t||{};this.debugContainer=t.debugContainer||document.body||document.getElementsByTagName("body")[0],this.lastFrameCapture=0,this.lastFrameCaptureTime=0,this.output=null,this.frameCounter=null,this.frameCount=0,this.renderFrameCount=0,this.lastRenderFrameCapture=0,this.logicFrameCount=0,this.lastLogicFrameCapture=0,this.setupDone=!1,this.enabled=!!t.hasOwnProperty("enabled")&&t.enabled}return n.prototype={setup:function(){this.setupDone||(this.output=document.createElement("div"),this.output.hasOwnProperty("id")?this.output.id="debugOutput":this.output.setAttribute("id","debugOutput"),s.addClass(this.output,"debugOutput"),this.output.style.position="absolute",this.output.style.top="0",this.output.style.left="0",this.output.style.backgroundColor="rgba(255, 255, 255, 0.8)",this.output.style.color="#000000",this.output.style.padding="3px",this.output.style.zIndex=Math.pow(2,32)-1,this.debugContainer.appendChild(this.output),this.frameCounter=document.createElement("div"),this.frameCounter.hasOwnProperty("id")?this.frameCounter.id="frameCounter":this.frameCounter.setAttribute("id","frameCounter"),s.addClass(this.frameCounter,"frameCounter"),this.frameCounter.style.position="absolute",this.frameCounter.style.bottom="0",this.frameCounter.style.left="0",this.frameCounter.style.backgroundColor="rgba(255, 255, 255, 0.8)",this.frameCounter.style.color="#000000",this.frameCounter.style.padding="3px",this.frameCounter.style.textAlign="left",this.frameCounter.style.zIndex=Math.pow(2,32)-1,this.debugContainer.appendChild(this.frameCounter),this.setupDone=!0)},update:function(t,e,i,s){var n,a,o,r;this.enabled&&(this.setupDone||this.setup(),1e3<=i-this.lastFrameCaptureTime&&(n=this.frameCount-this.lastFrameCapture,a=this.renderFrameCount-this.lastRenderFrameCapture,o=this.logicFrameCount-this.lastLogicFrameCapture,r=i-this.lastFrameCaptureTime,this.frameCounter.innerHTML="FPS-count: "+Math.round(n/(r/1e3))+"<br />FPS-time: "+Math.round(1e3/t)+"<br />FPS-render: "+Math.round(a/(r/1e3))+"<br />FPS-logic: "+Math.round(o/(r/1e3)),this.lastFrameCapture=this.frameCount,this.lastRenderFrameCapture=this.renderFrameCount,this.lastLogicFrameCapture=this.logicFrameCount,this.lastFrameCaptureTime=i)),this.frameCount+=1},updateRenderFrameCount:function(){this.renderFrameCount+=1},updateLogicFrameCount:function(){this.logicFrameCount+=1}},n}),n("j13e/anim/J13AnimManager",["require","exports","module","./J13Anim","../utils/J13Utils","../utils/J13EventDispatcher"],function(t,e,i){"use strict";var l=t("./J13Anim"),s=t("../utils/J13Utils"),n=t("../utils/J13EventDispatcher");function a(t){var e,i=t||{};if(n.call(this,t),this.anims={},i.anims)for(e in i.anims)i.anims.hasOwnProperty(e)&&(this.anims[e]=i.anims[e],this.anims[e].manager=this);this.activeAnims=[],this.animIndexesToRemove=[],this.animsToStart=[]}return a.prototype=s.inherit(new n,{addAnim:function(t){(this.anims[t.id]=t).manager=this},removeAnim:function(t){t=this.anims["string"==typeof t?t:t.id];t&&(this.anims[t.id]=void 0,t.manager=null)},update:function(t,e,i,s){if(1<this.animIndexesToRemove.length){this.animIndexesToRemove.sort(function(t,e){return t-e});for(var n=-1,a=this.animIndexesToRemove.length-1;0<=a;--a){var o=this.animIndexesToRemove[a];-1!==n&&n===o?this.animIndexesToRemove.splice(a,1):n=o}}for(;0<this.animIndexesToRemove.length;)this.activeAnims.splice(this.animIndexesToRemove.pop(),1);for(;0<this.animsToStart.length;)this.activeAnims.push(this.animsToStart.shift());if(0<this.activeAnims.length){var r,h=s.fixedLogicTime;for(a=0;a<this.activeAnims.length;a+=1)(r=this.activeAnims[a]).restartRequested&&r.preStart(),r.prepared||r.start(i,h),r.shouldBeAnimating(i,h)?r.step(i,h):r.shouldBeDone(i,h)&&(r.step(i,h),r.end(),r.iterations===l.iterationCount.infinite||r.iterationsPlayed<r.iterations?r.requestRestart():(r.iterationsPlayed=-1,this.animIndexesToRemove.push(a)))}},createAnim:function(t){new l(s.extendObj(t,{manager:this}))},getAnim:function(t){return this.anims[t]},startAnimById:function(t){this.startAnim(this.anims[t])},startAnim:function(t){t.manager=this,t.preStart(),this.animsToStart.push(t)},stopAnimById:function(t){this.stopAnim(this.anims[t])},stopAnim:function(t){var e=this.activeAnims.indexOf(t);t.stop(),-1!==e?this.animIndexesToRemove.push(e):-1!==(e=this.animsToStart.indexOf(t))&&this.animsToStart.splice(e,1)},restartAnimById:function(t){this.restartAnim(this.anims[t])},restartAnim:function(t){-1!==this.activeAnims.indexOf(t)?t.requestRestart():this.startAnim(t)}}),a}),n("j13e/utils/J13AppCacheManager",["require","exports","module","./J13Utils","./J13EventDispatcher"],function(t,e,i){"use strict";var s=t("./J13Utils"),n=t("./J13EventDispatcher");function a(t){var e=t||{};n.call(this,t),this.appCache=e.appCache,this.reloadOnNewUpdate=e.reloadOnNewUpdate,this.finished=!1}return a.events={CHECKING:"checking",LOADNORMALLY:"loadnormally",UPDATINGCACHE:"updatingcache",UPDATEPROGRESS:"updateprogress",UPDATEREADY:"updateready"},a.prototype=s.inherit(new n,{events:a.events,init:function(){if(this.appCache)if(this.appCache.status===this.appCache.UNCACHED)this.loadNormally();else switch(this.appCache.status){case this.appCache.IDLE:case this.appCache.DOWNLOADING:case this.appCache.CHECKING:this.appCache.addEventListener("checking",this.checking.bind(this),!1),this.appCache.addEventListener("noupdate",this.loadNormally.bind(this),!1),this.appCache.addEventListener("obsolete",this.loadNormally.bind(this),!1),this.appCache.addEventListener("error",this.loadNormally.bind(this),!1),this.appCache.addEventListener("cached",this.loadNormally.bind(this),!1),this.appCache.addEventListener("downloading",this.updatingCache.bind(this),!1),this.appCache.addEventListener("progress",this.updateProgress.bind(this),!1),this.appCache.addEventListener("updateready",this.updateReady.bind(this),!1);try{this.appCache.update()}catch(t){this.loadNormally()}break;case this.appCache.UPDATEREADY:this.updateReady();break;case this.appCache.OBSOLETE:this.loadNormally()}else this.loadNormally()},checking:function(t){this.finished||this.dispatch(this.events.CHECKING,{appCache:this.appCache,originalEvent:t})},loadNormally:function(t){this.finished||(this.finished=!0,this.dispatch(this.events.LOADNORMALLY,{appCache:this.appCache,originalEvent:t}))},updateProgress:function(t){this.finished||this.dispatch(this.events.UPDATEPROGRESS,{appCache:this.appCache,originalEvent:t,lengthComputable:t.lengthComputable,total:t.total,loaded:t.loaded})},updatingCache:function(t){this.finished||this.dispatch(this.events.UPDATINGCACHE,{appCache:this.appCache,originalEvent:t})},updateReady:function(t){if(!this.finished){this.finished=!0,this.dispatch(this.events.UPDATEREADY,{appCache:this.appCache,originalEvent:t});try{this.appCache.swapCache()}catch(t){}this.reloadOnNewUpdate&&location.reload()}}}),a}),n("j13e/display/J13DisplayStage",["require","exports","module","./J13DisplayItemContainer","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItemContainer"),t=t("../utils/J13Utils");function n(t){var e=t||{};s.call(this,t),this.engine=e.engine||null,this.mainStage=e.mainStage||!1,this.addListener(s.events.childAdded,this.onAnyChildAdded.bind(this)),this.addListener(s.events.childRemoved,this.onAnyChildRemoved.bind(this))}return n.events={},n.prototype=t.inherit(new s,{events:t.extendObj(s.prototype.events,n.events),onAnyChildAdded:function(t){t.data.child.dispatchAddedToStage(this)},onAnyChildRemoved:function(t){t.data.child.dispatchRemovedFromStage(this)},isOnStage:function(){return this.parent?this.parent.isOnStage():this.mainStage},isVisibleOnStage:function(){return this.parent?this.visible&&this.parent.isVisibleOnStage():this.mainStage}}),n}),n("j13e/input/J13KeyboardManager",["require","exports","module","../utils/J13EventDispatcher","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("../utils/J13EventDispatcher"),t=t("../utils/J13Utils");function n(t){this.keyMap={},this.keys=n.keys,window.addEventListener("keydown",this.keyDown.bind(this),!1),window.addEventListener("keyup",this.keyUp.bind(this),!1),window.addEventListener("keypress",this.keyPress.bind(this),!1)}return n.events={DOWN:"down",UP:"up",PRESS:"press"},n.keys={ENTER:8,SHIFT:16,CTRL:17,ALT:18,TAB:9,BACKSPACE:8,SPACE:32,CAPSLOCK:20,ESCAPE:27,";":186,SEMICOLON:186,"=":187,EQUALS:187,",":188,COMMA:188,"-":189,DASH:189,".":190,PERIOD:190,"/":191,FORWARDSLASH:191,"`":192,GRAVEACCENT:192,"[":219,OPENBRACKET:219,"\\":220,BACKSLASH:220,"]":221,CLOSEBRACKET:221,"'":222,SINGLEQUOTE:222,NUMPAD0:96,NUMPAD1:97,NUMPAD2:98,NUMPAD3:99,NUMPAD4:100,NUMPAD5:101,NUMPAD6:102,NUMPAD7:103,NUMPAD8:104,NUMPAD9:105,MULTIPLY:106,ADD:107,SUBTRACT:109,DECIMALPOINT:110,DIVIDE:111,0:48,ZERO:48,1:49,ONE:49,2:50,TWO:50,3:51,THREE:51,4:52,FOUR:52,5:53,FIVE:53,6:54,SIX:54,7:55,SEVEN:55,8:56,EIGHT:56,9:57,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40},n.prototype=t.inherit(new s,{events:n.events,keys:n.keys,keyDown:function(t){this.keyMap[t.keyCode]||(this.keyMap[t.keyCode]=!0,this.dispatch(this.events.DOWN,{keyCode:t.keyCode,keyMap:this.keyMap,originalEvent:t}))},keyUp:function(t){this.keyMap[t.keyCode]&&(this.keyMap[t.keyCode]=!1,this.dispatch(this.events.UP,{keyCode:t.keyCode,keyMap:this.keyMap,originalEvent:t}))},keyPress:function(t){this.dispatch(this.events.PRESS,{keyCode:t.keyCode,keyMap:this.keyMap,originalEvent:t})},isKeyDown:function(t){return this.keyMap[t]||!1},isKeyUp:function(t){return!this.keyMap[t]}}),n}),n("j13e/input/J13MouseManager",["require","exports","module","../utils/J13Utils","../utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),t=t("../utils/J13EventDispatcher");function n(t){t=t||{};this.element=t.element,this.element.addEventListener("mousedown",this.mouseDown.bind(this),!1),this.element.addEventListener("mousemove",this.mouseMove.bind(this),!1),this.element.addEventListener("mouseup",this.mouseUp.bind(this),!1),this.element.addEventListener("click",this.mouseClick.bind(this),!1),this.element.addEventListener("touchstart",this.touchStart.bind(this),!1),this.element.addEventListener("touchmove",this.touchMove.bind(this),!1),this.element.addEventListener("touchend",this.touchEnd.bind(this),!1),this.enableMouseInputs=!0,this.enableTouchInputs=!0,this.numTouch=0,this.skipMouseDown=0,this.skipMouseUp=0,this.skipMouseClicks=0,this.mouseX=0,this.mouseY=0,this.scaledMouseX=0,this.scaledMouseY=0,this.scaleX=1,this.scaleY=1,this.zealousTouchDetect=!!t.hasOwnProperty("zealousTouchDetect")&&t.zealousTouchDetect,this.touchDetected=!1}return n.events={DOWN:"down",MOVE:"move",UP:"up",CLICK:"click",MOUSEDOWN:"mousedown",MOUSEMOVE:"mousemove",MOUSEUP:"mouseup",MOUSECLICK:"mouseclick",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend"},n.prototype=s.inherit(new t,{events:n.events,resize:function(t){},resetSkips:function(){this.skipMouseDown=0,this.skipMouseUp=0},updateMousePos:function(t){var e=t.target.getBoundingClientRect(),i=e.left,e=e.top,s=0,n=0;switch(t.type){case"touchstart":case"touchmove":case"touchend":s=t.changedTouches[0].pageX,n=t.changedTouches[0].pageY;break;case"mousedown":case"mousemove":case"mouseup":case"click":s=t.pageX,n=t.pageY}n-=e,this.mouseX=s-=i,this.mouseY=n,this.scaledMouseX=Math.round(s*this.scaleX),this.scaledMouseY=Math.round(n*this.scaleY)},mouseDown:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSEDOWN,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0<this.skipMouseDown?--this.skipMouseDown:this.dispatch(this.events.DOWN,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},mouseMove:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSEMOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0===this.numTouch&&this.dispatch(this.events.MOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},mouseUp:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSEUP,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0<this.skipMouseUp?--this.skipMouseUp:this.dispatch(this.events.UP,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},mouseClick:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSECLICK,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0<this.skipMouseClicks?--this.skipMouseClicks:0===this.numTouch&&this.dispatch(this.events.CLICK,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},touchStart:function(t){t.preventDefault(),t.stopPropagation(),this.enableTouchInputs&&(this.updateMousePos(t),this.numTouch+=1,this.skipMouseDown+=1,this.touchDetected=!0,this.skipMouseClicks+=1,this.zealousTouchDetect&&(this.enableMouseInputs=!1),this.dispatch(this.events.TOUCHSTART,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),this.dispatch(this.events.DOWN,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},touchMove:function(t){t.preventDefault(),t.stopPropagation(),this.enableTouchInputs&&(this.updateMousePos(t),this.dispatch(this.events.TOUCHMOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),this.dispatch(this.events.MOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},touchEnd:function(t){t.preventDefault(),t.stopPropagation(),this.enableTouchInputs&&(this.updateMousePos(t),--this.numTouch,this.skipMouseUp+=1,this.dispatch(this.events.TOUCHEND,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),this.dispatch(this.events.UP,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))}}),n}),n("j13e/J13E",["require","exports","module","./utils/J13Polyfills","./utils/J13DebugManager","./anim/J13AnimManager","./utils/J13AppCacheManager","./utils/J13CookieJar","./display/J13DisplayStage","./display/J13ButtonManager","./input/J13KeyboardManager","./input/J13MouseManager","./utils/J13EventDispatcher","./display/J13DisplayItemContainer","./display/J13Buttonable","./math/J13Math","./utils/J13Utils"],function(t,e,i){"use strict";t("./utils/J13Polyfills");var s=t("./utils/J13DebugManager"),n=t("./anim/J13AnimManager"),a=t("./utils/J13AppCacheManager"),o=t("./utils/J13CookieJar"),r=t("./display/J13DisplayStage"),h=t("./display/J13ButtonManager"),l=t("./input/J13KeyboardManager"),d=t("./input/J13MouseManager"),u=t("./utils/J13EventDispatcher"),c=t("./display/J13DisplayItemContainer"),p=t("./display/J13Buttonable"),g=t("./math/J13Math"),t=t("./utils/J13Utils");function f(t){var e=t||{};if(u.call(this,t),this.initted=!1,this.started=!1,this.canvas=null,this.canvasContext=null,this.canvasContainer=null,this.looping=!1,this.logicLoopEnabled=!1,this.renderLoopEnabled=!1,this.animationFrameId=-1,this.lastMainLoopTime=0,this.lastLogicLoopTime=0,this.fixedAccumulator=0,this.frameCount=0,this.fixedLogicTime=0,this.globalFont=e.globalFont||"30px Arial",this.backgroundFillStyle=e.backgroundFillStyle||"#ffffff",this.minFrameDelay=e.minFrameDelay||f.DEFAULTS.MINFRAMEDELAY,this.maxFrameDelay=e.maxFrameDelay||f.DEFAULTS.MAXFRAMEDELAY,this.fixedLogicDTM=e.fixedLogicDTM||e.fixedDTM||f.DEFAULTS.FIXEDLOGICDTM,this.fixedLogicDTS=this.fixedLogicDTM/1e3,this.fixedDTM=e.fixedDTM||f.DEFAULTS.FIXEDDTM,this.fixedDTS=this.fixedDTM/1e3,this.maxCycles=e.maxCycles||f.DEFAULTS.MAXCYCLES,this.autoStartPreload=!!e.hasOwnProperty("autoStartPreload")&&e.autoStartPreload,this.loaders=[],e.canvas?this.canvas=e.canvas:e.canvasId&&(this.canvas=document.getElementById(e.canvasId)),e.canvasContainer?this.canvasContainer=e.canvasContainer:e.canvasContainerId&&(this.canvasContainer=document.getElementById(e.canvasContainerId)),this.debugManager=new s({debugContainer:e.debugContainer||e.canvasContainer||null,enabled:e.debug||!1}),this.animManager=new n({}),this.useAppCache=!!e.hasOwnProperty("useAppCache")&&e.useAppCache,this.appCacheManager=null,this.useAppCache&&(this.appCacheManager=new a({appCache:window.applicationCache,reloadOnNewUpdate:!!e.hasOwnProperty("reloadOnNewUpdate")&&e.reloadOnNewUpdate})),!this.canvas)throw new Error("canvas or canvasId needs to be defined.");this.canvasContext=this.canvas.getContext("2d"),this.cookieJar=o,this.bindedMainLoop=this.mainLoop.bind(this),this.requestMainLoop=function(){window.requestAnimationFrame(this.bindedMainLoop)}.bind(this),this.stage=new r({engine:this,mainStage:!0}),this.buttonManager=new h,this.keyboardManager=new l,this.mouseManager=new d({element:e.mouseManagerTarget||this.canvas}),this.engineContext={dtm:0,dts:0,time:0,fixedDTM:this.fixedDTM,fixedDTS:this.fixedDTS,fixedLogicDTM:this.fixedLogicDTM,fixedLogicDTS:this.fixedLogicDTS,fixedAccumulator:0,fixedLogicTime:this.fixedLogicTime,lastLogicLoopTime:this.lastLogicLoopTime,canvas:this.canvas,canvasContext:this.canvasContext,initted:!1,started:!1,stage:this.stage,engine:this,interpolation:0},this.init()}return f.DEFAULTS={MINFRAMEDELAY:Math.floor(1e3/60),MAXFRAMEDELAY:Math.floor(200),FIXEDDTM:Math.floor(1e3/60),MAXCYCLES:5,FIXEDLOGICDTM:Math.floor(1e3/60)},f.events={initted:"initted",preloadStarted:"preloadstarted",preloadProgress:"preloadprogress",preloadComplete:"preloadcomplete",started:"started",enterLogicLoop:"enterlogicloop",exitLogicLoop:"exitlogicloop",enterRenderLoop:"enterrenderloop",exitRenderLoop:"exitrenderloop",enterMainLoop:"entermainloop",exitMainLoop:"exitmainloop"},f.preloadType={assets:"assets",appCache:"appcache"},f.prototype=t.inherit(new u,{events:f.events,init:function(){this.initted||(this.initted=!0,this.engineContext.initted=this.initted,this.stage.addListener(c.events.anyChildAdded,function(t){t.data&&t.data.child&&this.checkToAddButtons(t.data.child)}.bind(this)),this.stage.addListener(c.events.anyChildRemoved,function(t){t.data&&t.data.child&&this.checkToRemoveButtons(t.data.child)}.bind(this)),this.mouseManager.addListener(d.events.DOWN,this.buttonManager.onDown.bind(this.buttonManager)),this.mouseManager.addListener(d.events.UP,this.buttonManager.onUp.bind(this.buttonManager)),this.mouseManager.addListener(d.events.MOVE,this.buttonManager.onMove.bind(this.buttonManager)),this.canvasContext.font=this.globalFont,this.dispatch(this.events.initted),this.preStart())},checkToAddButtons:function(t){if(p.isButton(t))this.buttonManager.addButton(t);else if(t.getAllChildren)for(var e=t.getAllChildren(),i=0;i<e.length;i+=1)p.isButton(e[i])&&this.buttonManager.addButton(e[i])},checkToRemoveButtons:function(t){if(p.isButton(t))this.buttonManager.removeButton(t);else if(t.getAllChildren)for(var e=t.getAllChildren(),i=0;i<e.length;i+=1)p.isButton(e[i])&&this.buttonManager.removeButton(e[i])},addLoader:function(t){this.loaders.push(t)},startPreload:function(){this.appCacheManager?this.startAppCachePreload():this.startAssetsPreload()},startAppCachePreload:function(){this.appCacheManager.addListener(this.appCacheManager.events.CHECKING,this.checkingAppCachePreload.bind(this)),this.appCacheManager.addListener(this.appCacheManager.events.LOADNORMALLY,this.startAssetsPreload.bind(this)),this.appCacheManager.addListener(this.appCacheManager.events.UPDATEPROGRESS,this.progressAppCachePreload.bind(this)),this.appCacheManager.addListener(this.appCacheManager.events.UPDATEREADY,this.completeAppCachePreload.bind(this)),this.dispatch(f.events.preloadStarted,{preloadType:f.preloadType.appCache}),this.appCacheManager.init()},checkingAppCachePreload:function(t){},progressAppCachePreload:function(t){this.dispatch(f.events.preloadProgress,{preloadType:f.preloadType.appCache,lengthComputable:t.data.lengthComputable,total:t.data.total,loaded:t.data.loaded})},completeAppCachePreload:function(t){this.dispatch(f.events.preloadComplete,{preloadType:f.preloadType.appCache})},startAssetsPreload:function(){for(var t=0,e=0;e<this.loaders.length;e+=1)this.loaders[e].includeInPreload&&(this.loaders[e].addListener(this.loaders[e].events.load,this.progressAssetsPreload.bind(this)),this.loaders[e].addListener(this.loaders[e].events.allLoad,this.checkLoaderAssetsPreload.bind(this)),t+=1);for(this.dispatch(this.events.preloadStarted,{preloadType:f.preloadType.assets}),e=0;e<this.loaders.length;e+=1)this.loaders[e].startLoading();0===t&&this.completeAssetsPreload()},progressAssetsPreload:function(t){for(var e=0,i=0,s=0,n=0;n<this.loaders.length;n+=1)this.loaders[n].includeInPreload&&(i+=this.loaders[n].total,e+=this.loaders[n].loaded,s+=this.loaders[n].errors);this.dispatch(this.events.preloadProgress,{total:i,loaded:e,errors:s,preloadType:f.preloadType.assets})},checkLoaderAssetsPreload:function(t){var e=0,i=0;this.loaders.forEach(function(t){t.includeInPreload&&(i+=1,t.isFullyLoaded()&&(e+=1))}),i<=e&&this.completeAssetsPreload()},completeAssetsPreload:function(){this.dispatch(this.events.preloadComplete,{preloadType:f.preloadType.assets}),this.start()},preStart:function(){this.logicLoopEnabled=!0,this.renderLoopEnabled=!0,this.startMainLoop(),this.autoStartPreload&&this.startPreload()},start:function(){this.started||(this.started=!0,this.engineContext.started=this.started,this.dispatch(this.events.started))},startMainLoop:function(){this.looping=!0,this.animationFrameId=window.requestAnimationFrame(this.bindedMainLoop)},stopMainLoop:function(){this.looping=!1,window.cancelAnimationFrame(this.animationFrameId)},restartMainLoop:function(){this.stopMainLoop(),this.startMainLoop()},calculateInterpolation:function(t,e,i){return g.clamp(0,(t-e)/i,1)},mainLoop:function(t){var e,i,s=t;if(this.dispatch(this.events.enterMainLoop),this.looping?this.animationFrameId=window.requestAnimationFrame(this.bindedMainLoop):window.cancelAnimationFrame(this.animationFrameId),e=(t=(t=(t=s-this.lastMainLoopTime)<this.minFrameDelay?this.minFrameDelay:t)>this.maxFrameDelay?this.maxFrameDelay:t)/1e3,this.engineContext.dtm=t,this.engineContext.dts=e,this.engineContext.time=s,this.logicLoopEnabled)for(this.fixedAccumulator+=t,i=0;this.fixedAccumulator>=this.fixedLogicDTM&&i<this.maxCycles;i+=1)this.engineContext.fixedAccumulator=this.fixedAccumulator,this.logicLoop(this.fixedLogicDTM,this.fixedLogicDTS,s,this.engineContext),this.fixedAccumulator-=this.fixedLogicDTM,this.lastLogicLoopTime=s,this.engineContext.lastLogicLoopTime=this.lastLogicLoopTime,this.fixedLogicTime+=this.fixedLogicDTM,this.engineContext.fixedLogicTime=this.fixedLogicTime;this.engineContext.interpolation=this.calculateInterpolation(s,this.lastLogicLoopTime,this.fixedLogicDTM),this.animManager.update(t,e,s,this.engineContext),this.renderLoopEnabled&&this.renderLoop(t,e,s,this.engineContext),this.debugManager.update(t,e,s,this.engineContext),this.frameCount+=1,this.lastMainLoopTime=s,this.dispatch(this.events.exitMainLoop)},logicLoop:function(t,e,i,s){this.dispatch(this.events.enterLogicLoop,s),this.dispatch(this.events.exitLogicLoop,s),this.debugManager.updateLogicFrameCount()},renderLoop:function(t,e,i,s){var n=s.canvas,a=s.canvasContext;this.dispatch(this.events.enterRenderLoop,s),a.save(),a.fillStyle=this.backgroundFillStyle,a.fillRect(0,0,n.width,n.height),a.restore(),this.stage.stageRender(t,e,i,s),this.dispatch(this.events.exitRenderLoop,s),this.debugManager.updateRenderFrameCount()}}),f}),n("j13e/display/J13SpriteSheet",["require","exports","module","../utils/J13Utils","../math/J13Rect","./J13DisplaySprite"],function(t,e,i){"use strict";var r=t("../utils/J13Utils"),h=t("../math/J13Rect"),l=t("./J13DisplaySprite");function d(t){t=t||{};if(this.image=t.image||null,!this.image)throw new Error("J13SpriteSheet: invalid image.");this.spriteMap=t.spriteMap||{},this.sprites={}}return d.createIdFromRect=function(t){t={left:t.left,top:t.top,right:t.right,bottom:t.bottom};return r.objectToParamString(t)},d.createIdFromFrameMap=function(t){var e,i=[];for(e in t)t.hasOwnProperty(e)&&i.push(e);return i.join(",")},d.isFrameMap=function(t){if(!t)return!1;for(var e in t)if(t.hasOwnProperty(e)&&!h.isJ13Rect(t[e]))return!1;return!0},d.prototype={getSprite:function(t,e){var i,s=null,n="string"==typeof t,a=h.isJ13Rect(t,!0),o=d.isFrameMap(t);return n?i=t:a?i=d.createIdFromRect(t):o&&(i=d.createIdFromFrameMap(t)),(s=this.sprites[i])||(n?(s=new l(r.inherit(this.spriteMap[i],{image:this.image})),this.sprites[i]=s):a?(s=new l({image:this.image,rect:t}),this.sprites[i]=s):o&&(s=new l({image:this.image,frameMap:t}),this.sprites[i]=s)),s=s&&!e?s.copy():s}},d}),n("j13e/utils/J13Img",["require","exports","module"],function(t,e,i){"use strict";function s(t){var e=new Image;return e.preSrc=t,e.onload=s.imgOnLoad,e.onerror=s.imgOnError,e.alreadyLoaded=!1,e.load=function(t,e){this.onLoadFunction=t,this.onErrorFunction=e,this.src=this.preSrc,this.complete&&!this.alreadyLoaded&&(this.alreadyLoaded=!0,this.onLoadFunction(this))},e}return s.imgOnLoad=function(t){!this.alreadyLoaded&&this.onLoadFunction&&(this.alreadyLoaded=!0,this.onLoadFunction(this))},s.imgOnError=function(t){this.onErrorFunction&&this.onErrorFunction(this)},s}),n("j13e/utils/J13ImageManager",["require","exports","module","./J13Loader","./J13Utils","./J13Img"],function(t,e,i){"use strict";var n=t("./J13Loader"),s=t("./J13Utils"),a=t("./J13Img");function o(t){var e=t||{};n.call(this,t),this.imgs={},this.imgListObj=e.images||e.imgs}return o.prototype=s.inherit(Object.create(n.prototype),{startLoading:function(){n.prototype.startLoading.call(this);var t,e=this.onLoad.bind(this),i=this.onError.bind(this),s=[];for(t in this.imgListObj)this.imgListObj.hasOwnProperty(t)&&(this.imgs[t]=this.imgs[this.imgListObj[t]]=new a(this.imgListObj[t]),this.total+=1,this.imgs[t].imgName=t,s.push(this.imgs[t].load.bind(this.imgs[t])));0===this.total?this.onAllLoad():s.forEach(function(t){t(e,i)})},get:function(t){return this.imgs[t]}}),o}),n("src/Game",["require","exports","module","./Resources","./utils/Common","./Settings","j13e/utils/J13DOM","cocoonjs/CocoonInclude","./efs/InterstitialEfs","./efs/EfManager","./utils/Scouter","./utils/GameState","./utils/GameStateManager","./screens/PreloadScreen","./screens/PlayScreen","./utils/SoundManager","j13e/J13E","j13e/anim/J13Anim","j13e/utils/J13AppCacheManager","j13e/display/J13SpriteSheet","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayLayer","j13e/display/J13DisplayText","j13e/display/J13DisplayRect","j13e/math/J13Rect","j13e/utils/J13ImageManager","j13e/utils/J13Utils","j13e/utils/J13EventDispatcher"],function(t,e,i){"use strict";var d=t("./Resources"),s=t("./utils/Common"),u=t("./Settings"),c=t("j13e/utils/J13DOM"),n=t("cocoonjs/CocoonInclude"),a=t("./efs/InterstitialEfs"),o=t("./efs/EfManager"),r=t("./utils/Scouter"),h=t("./utils/GameState"),l=t("./utils/GameStateManager"),p=t("./screens/PreloadScreen"),g=t("./screens/PlayScreen"),f=t("./utils/SoundManager"),m=t("j13e/J13E"),y=t("j13e/anim/J13Anim"),v=(t("j13e/utils/J13AppCacheManager"),t("j13e/display/J13SpriteSheet")),w=(t("j13e/display/J13DisplayItemContainer"),t("j13e/display/J13DisplayLayer")),b=t("j13e/display/J13DisplayText"),S=t("j13e/display/J13DisplayRect"),C=t("j13e/math/J13Rect"),A=t("j13e/utils/J13ImageManager"),O=t("j13e/utils/J13Utils"),x=t("j13e/utils/J13EventDispatcher");function I(t){x.call(this,t),this.initialUrlQuery=s.paramStringToObject(window.location.search),this.canvas=c.get("gameCanvas"),this.canvasCon=c.get("gameCanvasCon")||document.body||document.getElementsByTagName("body")[0],O.makeUnselectable(this.canvasCon,!0),this.canvas||(u.cocoon?(this.canvas=n.App.createScreenCanvas(),this.canvas.style.cssText="idtkscale:ScaleToFill;"):this.canvas=c.create("canvas","gameCanvas"),this.canvas.width=u.width,this.canvas.height=u.height,this.canvasCon&&this.canvasCon.appendChild(this.canvas)),this.engine=new m({canvas:this.canvas,canvasContainer:this.canvasCon,backgroundFillStyle:"#008793",debug:this.initialUrlQuery.hasOwnProperty("fps"),debugContainer:u.cocoon?null:c.get("centerDiv"),useAppCache:!0,reloadOnNewUpdate:!0}),(this.engine.engineContext.game=this).stage=this.engine.stage,this.lastLogicTime=0,d.soundManager=new f({sounds:d.sounds}),d.animManager=this.engine.animManager,d.imgManager=new A({images:d.images,includeInPreload:!0}),d.loadedImages=d.imgManager.imgs,d.mouseManager=this.engine.mouseManager,d.keyboardManager=this.engine.keyboardManager,d.mouseManager.zealousTouchDetect=!0,d.mouseManager.addListener(d.mouseManager.events.DOWN,function(t){1e3<=(new Date).getTime()-this.lastLogicTime&&this.engine.restartMainLoop()}.bind(this));window.addEventListener("resize",this.onResize.bind(this),!1),this.introPlayed=!1,u.cocoon&&(n.App.setAppShouldFinishCallback(function(){return!0}),n.App.setPreferredOrientation(n.App.Orientations.PORTRAIT)),u.kik&&((t=window.kik)&&t.browser&&t.browser.setOrientationLock&&t.browser.setOrientationLock("portrait"),t&&t.browser&&t.browser.on&&(t.browser.on("background",function(){this.engine.stopMainLoop()}.bind(this)),t.browser.on("foreground",function(){this.engine.restartMainLoop()}.bind(this))),t&&t.browser&&t.browser.statusBar&&t.browser.statusBar(!1));t=null,t=u.inAppGames?{interstitialAds:a.getInAppAds(this)}:u.cocoon?{interstitialAds:a.getNativeAds(this)}:{interstitialScreen:c.get("adInterstitialScreen"),interstitialClose:c.get("adInterstitialClose"),interstitialAds:a.getWebAds(this)};this.adManager=d.adManager=new o(t),this.init()}return I.prototype=O.inherit(new x,{init:function(){this.initScreen=new w({width:u.width,height:u.height,visible:!0}),this.stage.addChild(this.initScreen),this.initScreenText=new b({font:"30px Arial",fillStyle:"#ffffff",text:"Loading.",textBaseline:"middle",textAlign:"center",x:u.width/2,y:u.height/2}),this.initScreen.addChild(this.initScreenText),this.preloadScreen=new p({width:u.width,height:u.height,visible:!1}),this.stage.addChild(this.preloadScreen),this.copyrightText=new b({text:String.fromCharCode(169)+" 2013-2020 GameMix, Inc. All rights reserved.",font:"12px Arial",fillStyle:"#ffffff",opacity:1,textAlign:"center",textBaseline:"bottom",x:u.width/2,y:u.height-5}),this.stage.addChild(this.copyrightText);this.gsm=new l({game:this,animManager:d.animManager,states:[new h({id:d.gameStates.init,start:function(t,e){t.initScreen.visible=!0},end:function(t,e){t.initScreen.visible=!1}}),new h({id:d.gameStates.appCache,start:function(t,e){t.preloadScreen.show()},end:function(t,e){t.preloadScreen.hide()}}),new h({id:d.gameStates.preload,start:function(t,e){t.preloadScreen.show()},end:function(t,e){t.preloadScreen.hide()},endAnim:this.createFadeOutTransition()}),new h({id:d.gameStates.mainMenu,startAnim:this.createFadeInTransition(),start:function(t,e){t.mainMenuScreen.show()},end:function(t,e){t.mainMenuScreen.hide()},endAnim:this.createFadeOutTransition()}),new h({id:d.gameStates.level,startAnim:this.createFadeInTransition(),start:function(t,e){t.playScreen.show(e),t.copyrightText.opacity=.5,window.crossPromo&&window.crossPromo.hide&&window.crossPromo.hide(),window.fta&&window.fta(function(t){t.hide()})},end:function(t,e){}}),new h({id:d.gameStates.gameOver,start:function(t,e){t.copyrightText.opacity=1,t.adManager.shouldShowInterstitial()&&t.adManager.refreshInterstitial(),setTimeout(function(){d.gsm.toState(d.gameStates.hiScore,e)},500)},end:function(t,e){}}),new h({id:d.gameStates.hiScore,start:function(t,e){d.soundManager.play(d.soundNames.menu),t.adManager.shouldShowInterstitial()?setTimeout(function(){t.adManager.showInterstitial(function(){window.crossPromo&&window.crossPromo.show&&window.crossPromo.show(),window.fta&&window.fta(function(t){t.show()})})},500):(window.crossPromo&&window.crossPromo.show&&window.crossPromo.show(),window.fta&&window.fta(function(t){t.show()}))},end:function(t,e){t.playScreen.hide(e)},endAnim:this.createFadeOutTransition()})],startState:d.gameStates.init}),d.gsm=this.gsm,this.onResize(),this.engine.addLoader(d.imgManager),this.engine.addLoader(d.soundManager),this.engine.addListener(m.events.enterLogicLoop,this.logicLoop.bind(this)),this.engine.addListener(m.events.enterRenderLoop,this.enterRenderLoop.bind(this)),this.engine.addListener(m.events.exitRenderLoop,this.exitRenderLoop.bind(this)),this.engine.addListener(m.events.preloadStarted,this.preloadStarted.bind(this)),this.engine.addListener(m.events.preloadProgress,this.preloadProgress.bind(this)),this.engine.addListener(m.events.preloadComplete,this.preloadComplete.bind(this)),this.engine.addListener(m.events.started,this.start.bind(this)),d.scouter=new r({game:this,sendToGA:!0,debugTrace:!1}),this.onResize(),this.dispatch(d.events.gameInitted),this.engine.startPreload()},preloadStarted:function(t){t.data.preloadType===m.preloadType.appCache?(this.gsm.toState(d.gameStates.appCache),this.preloadScreen.setText("Checking...",!1)):(this.gsm.toState(d.gameStates.preload),this.preloadScreen.setText("Loading...",!1))},preloadProgress:function(t){var e=100*(t.data.loaded/t.data.total);this.preloadScreen.setPrefix((t.data.preloadType===m.preloadType.appCache?"Updating...":"Loading...")+"("),this.preloadScreen.setSuffix(")"),this.preloadScreen.setPercent(e,!0)},preloadComplete:function(t){t.data.preloadType===m.preloadType.appCache?this.preloadScreen.setText("Reloading...",!0):this.preloadScreen.setText("Launching...",!0)},onResize:function(t){this.autoResizeCanvas(),setTimeout(this.autoResizeCanvas.bind(this),500)},autoResizeCanvas:function(){var t,e,i,s,n,a,o,r,h,l;!u.cocoon&&this.canvasCon&&(a=window.getComputedStyle(c.get("mainCon")),n=parseInt(a.width,10),a=parseInt(a.height,10),o=u.width/u.height,r=n/a,h=u.width,l=u.height,O.isMobile.any()?(t=i=n,e=s=a):(i=n,e=t=0,s=a),o<r?(s<u.height||e>u.height)&&(l=a,h=Math.floor(o*l)):(i<u.width||t>u.width)&&(h=n,l=Math.floor(h/o)),this.canvasCon.style.width=h+"px",this.canvasCon.style.height=l+"px",d.mouseManager.scaleX=d.mouseManager.scaleY=u.width/h)},createFadeOutTransition:function(){var e=this;return new y({startValue:0,endValue:1,duration:500,startCallback:function(){e.transitionOverlay.visible=!0,e.transitionOverlay.opacity=0},stepCallback:function(t){e.transitionOverlay.opacity=t}})},createFadeInTransition:function(){var e=this;return new y({startValue:1,endValue:0,duration:500,startCallback:function(){e.transitionOverlay.visible=!0,e.transitionOverlay.opacity=1},stepCallback:function(t){e.transitionOverlay.opacity=t},endCallback:function(){e.transitionOverlay.visible=!1,e.transitionOverlay.opacity=0}})},start:function(t){d.volumeSheet=new v({image:d.loadedImages[d.images.volumeSprite],spriteMap:d.spriteMap.volume}),d.patterns.stars=this.engine.canvasContext.createPattern(d.loadedImages[d.images.stars],"repeat"),d.patterns.dayStars=this.engine.canvasContext.createPattern(d.loadedImages[d.images.dayStars],"repeat"),this.playScreen=new g({game:this,width:u.width,height:u.height}),this.stage.addChild(this.playScreen),this.stage.removeChild(this.copyrightText),this.stage.addChild(this.copyrightText),this.transitionOverlay=new S({rect:new C({width:u.width,height:u.height}),fillStyle:"#000000",visible:!1,opacity:0}),this.stage.addChild(this.transitionOverlay),this.gsm.toState(d.gameStates.level,{reset:!0})},openMenu:function(t){this.gsm.getCurrentStateId()!==d.gameStates.mainMenu&&this.gsm.toState(d.gameStates.mainMenu)},logicLoop:function(t){var t=t.data,e=t.fixedDTM,i=t.fixedDTS,s=t.time;(new Date).getTime();t.started&&this.playScreen.update(e,i,s,t);(new Date).getTime();this.lastLogicTime=(new Date).getTime()},enterRenderLoop:function(t){this.debugRenderStartTime=(new Date).getTime()},exitRenderLoop:function(t){this.debugRenderEndTime=(new Date).getTime();this.debugRenderEndTime,this.debugRenderEndTime},getNumPlays:function(){return this.playScreen.numPlays},kikShare:function(t){window.cards&&window.cards.kik&&window.kik.send({title:"I got "+this.playScreen.score+" on Flappy Copter!",text:"Do you think you can fly higher?",pic:"/imgs/favicon-96.png",data:{score:this.playScreen.score,date:Date.now()}})},trace:function(t){this.engine.debugManager&&this.engine.debugManager.output&&(this.engine.debugManager.output.innerHTML=t||"")}}),I}),n("src/analytics",["require","src/Settings","cocoonjs/CocoonInclude"],function(t){var i,s,n,e,a,o,r,h,l=t("src/Settings"),d=t("cocoonjs/CocoonInclude");return l.cocoon?window.cordova||(i=!1,s=[],n=function(){for(var t;t=s.shift();)t=t,console.log("Sending "+t+" to the Webview"),d.App.forwardAsync(t)},window.gaInterfaceIsReady=function(){d.App.forwardAsync("CocoonJS.App.show(0, 0, "+window.innerWidth*window.devicePixelRatio+","+window.innerHeight*window.devicePixelRatio+");",function(){i=!0,n()})},console.log("Creating GAI interface"),d.App.loadInTheWebView("https://more.gamemix.com/cocoonoverlay.html?currentGame=undeadescape"),window.ga=function(){for(var t="",e=0;e<arguments.length;e++)0<e&&(t+=","),t+=JSON.stringify(arguments[e]);s.push("window.ga("+t+")"),i&&n()}):(e=window,r=document,o="ga",e.GoogleAnalyticsObject=o,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=+new Date,o=r.createElement("script"),r=r.getElementsByTagName("script")[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",r.parentNode.insertBefore(o,r)),ga("require","displayfeatures"),ga("create","UA-55211826-1"),a=window,o=document,r="http://gmga.gamemix.com",h="gmga",a.GameMixGA=h,a[h]=a[h]||function(t){a[h].q=a[h].q||[],a[h].q.push(t)},a[h]({gmgaDomain:r}),t=o.createElement("script"),o=o.getElementsByTagName("script")[0],t.type="text/javascript",t.async=!0,t.src=r+"/client/gmga.js",o.parentNode.insertBefore(t,o),gmga("flappycopter"),!0}),function(){"use strict";t.config({baseUrl:"js/lib",packages:["j13e"],paths:{src:"../src",cocoonjs:"nococoonjs"},urlArgs:"t="+Date.now()}),t(["require","j13e","src/gmapi","src/fta","src/Game","cocoonjs/CocoonInclude","src/analytics"],function(t){new(t("src/Game"))})}(),n("../main",function(){})}();