'use strict';function onLoad(){new game.Main}var __extends=this&&this.__extends||function(){var a=function(b,c){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),utils;!function(a){var b=function(){function a(){this._enabled=!0,this.init()}return a.prototype.init=function(){try{this.localStorage=window.localStorage,this.localStorage.setItem("testKey","testData"),this.localStorage.removeItem("testKey")}catch(a){this._enabled=!1}},a.prototype.saveValue=function(a,b){if(this._enabled){JSON.stringify(b);if(_.isString(b)===!1)this.localStorage.setItem(a,b);else{var c=JSON.stringify(b);this.localStorage.setItem(a,c)}}},a.prototype.getValue=function(a){return this.localStorage.getItem(a)},a.prototype.remove=function(a){this._enabled&&this.localStorage.removeItem(a)},a.prototype.clear=function(){this._enabled&&this.localStorage.clear()},Object.defineProperty(a.prototype,"enabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),a}();a.LocalStorageWrapper=b}(utils||(utils={}));var game;!function(a){var b=function(){function a(){}return a.LANGUAGES=["en","es","fr","it","pt"],a.SOURCE_GAME_WIDTH=640,a.SOURCE_GAME_HEIGHT=780,a.GAME_WIDTH=a.SOURCE_GAME_WIDTH,a.GAME_HEIGHT=a.SOURCE_GAME_HEIGHT,a.HALF_GAME_WIDTH=.5*a.GAME_WIDTH,a.HALF_GAME_HEIGHT=.5*a.GAME_HEIGHT,a.WORLD_SCALE=1,a.ASPECT_RATIO=a.SOURCE_GAME_WIDTH/a.SOURCE_GAME_HEIGHT,a}();a.Config=b}(game||(game={}));var utils;!function(a){var b=function(a){function b(b){var c=a.call(this,b,b.stage,"FPS Meter")||this;return c.updateInterval=500,c.timer=0,c.initBackground(),c.initText(),c.setPosition(),c.game.time.advancedTiming=!0,c}return __extends(b,a),b.prototype.setPosition=function(){this.x=0,this.game.scale.scaleMode===Phaser.ScaleManager.SHOW_ALL?this.position.y=game.Config.GAME_HEIGHT-this.bg.height:this.position.y=game.Config.GAME_HEIGHT*game.Config.WORLD_SCALE-this.bg.height},b.prototype.initBackground=function(){var a=90,b=25,c=this.game.add.bitmapData(a,b);c.fill(0,0,0),c.rect(0,0,a,b),this.bg=new Phaser.Image(this.game,0,0,c),this.add(this.bg)},b.prototype.initText=function(){var a={font:"18px Consolas",fill:"#FFFFFF",align:"left"};this.statsText=this.game.add.text(6,3,"0 fps",a,this)},b.prototype.update=function(){this.timer+=this.game.time.elapsed,this.timer>=this.updateInterval&&(this.timer-=this.updateInterval,this.updateStats())},b.prototype.updateStats=function(){var a="FPS: "+this.game.time.fps;this.statsText.setText(a)},b.prototype.destroy=function(){this.game.time.advancedTiming=!1,a.prototype.destroy.call(this,!0,!1)},b}(Phaser.Group);a.FPSMeter=b}(utils||(utils={}));var utils;!function(a){var b=function(){function a(){this.intervalID=-1,this.counter=0,this.repeatTimes=0}return a.prototype.repeat=function(a,b,c,d){var e=this;this.intervalID>-1&&clearInterval(this.intervalID),this.func=a,this.context=b,this.repeatTimes=c,this.counter=0,this.intervalID=setInterval(function(){e.execute()},d)},a.prototype.execute=function(){this.func.apply(this.context),++this.counter===this.repeatTimes&&(clearInterval(this.intervalID),this.intervalID=-1)},a.prototype.stop=function(){this.intervalID>-1&&clearInterval(this.intervalID)},a}();a.Timer=b}(utils||(utils={}));var game;!function(a){var b=function(b){function c(){return null!==b&&b.apply(this,arguments)||this}return __extends(c,b),c.prototype.init=function(){Phaser.Device.isAndroidStockBrowser()&&(this.game.canvas.parentElement.style.overflow="visible")},c.prototype.preload=function(){this.load.crossOrigin="anonymous",this.load.useXDomainRequest=this.game.device.ie&&this.game.device.ieVersion<=9,this.load.atlasJSONHash("preloader","assets/graphics/preloader.png","assets/graphics/preloader.json"),this.load.image("azoomee_white","assets/graphics/azoomee_white.png")},c.prototype.create=function(){this.setupScale(),this.setupCanvasStyle(),this.setupCustomConsole(),this.addFPSMeter(),this.detectWeakDevice(),this.detectLanguage(),this.trackCssFontsLoading(),this.game.plugins.add(a.StateTransition),this.game.tweens.frameBased=!0,this.game.state.start("Preloader",!0,!1)},c.prototype.setupScale=function(){this.game.device.desktop?this.scaleForDesktop():(this.scaleForMobile(),this.scaleGame(),this.isLandscape()&&this.onEnterLandscape())},c.prototype.scaleForDesktop=function(){var b=this.game.scale;b.scaleMode=Phaser.ScaleManager.SHOW_ALL,b.aspectRatio=a.Config.SOURCE_GAME_WIDTH/a.Config.SOURCE_GAME_HEIGHT,b.pageAlignHorizontally=!0,b.pageAlignVertically=!0},c.prototype.scaleForMobile=function(){var a=this.game.scale;a.scaleMode=Phaser.ScaleManager.EXACT_FIT,a.forceOrientation(!1,!0),a.onSizeChange.add(this.onSizeChange,this)},c.prototype.onSizeChange=function(){this.isPortrait()?(this.scaleGame(),this.game.state.resize(a.Config.GAME_WIDTH,a.Config.GAME_HEIGHT),this.onEnterPortrait()):this.onEnterLandscape()},c.prototype.setupCanvasStyle=function(){this.game.device.desktop?this.game.canvas.parentElement.style.backgroundColor="#152E4D":this.game.canvas.style.backgroundColor="black"},c.prototype.setupCustomConsole=function(){if(a.Main.isDesktop){var b=document.getElementById("debug_console");b&&(b.style.display="none")}},c.prototype.addFPSMeter=function(){if(a.Main.development){var b=new utils.FPSMeter(this.game);this.stage.addChild(b)}},c.prototype.detectWeakDevice=function(){a.Main.weakDevice=this.game.renderType===Phaser.CANVAS},c.prototype.scaleGame=function(){var b=window.innerWidth,c=window.innerHeight,d=a.Config.SOURCE_GAME_WIDTH,e=b/d;this.world.scale.set(e,e),this.scale.setGameSize(b,c),a.Config.ASPECT_RATIO=b/c,a.Config.WORLD_SCALE=e,a.Config.GAME_WIDTH=this.game.canvas.width/e,a.Config.GAME_HEIGHT=this.game.canvas.height/e,a.Config.HALF_GAME_WIDTH=.5*a.Config.GAME_WIDTH,a.Config.HALF_GAME_HEIGHT=.5*a.Config.GAME_HEIGHT},c.prototype.onEnterLandscape=function(){document.getElementById("rotate").style.display="block",document.getElementById("rotate").style.width=window.innerWidth+"px",document.getElementById("rotate").style.height=window.innerHeight+"px"},c.prototype.onEnterPortrait=function(){document.getElementById("rotate").style.display="none"},c.prototype.isLandscape=function(){return window.innerWidth>window.innerHeight},c.prototype.isPortrait=function(){return window.innerHeight>window.innerWidth},c.prototype.detectLanguage=function(){var b=a.Main.storage.getValue("language");if(b)return b=b.slice(1,b.length-1),void(a.Main.language=b);for(var c=navigator.language,d="en",e=a.Config.LANGUAGES.length,f=0;f-1){d=g;break}}a.Main.language=d},c.prototype.getLangFromQuery=function(){var a=new Phaser.Net(this.game),b=a.getQueryString("lang");return _.isString(b)&&2===b.length?b:null},c.prototype.trackCssFontsLoading=function(){var b=this,c=new FontFaceObserver(a.Main.fontFamily,{weight:"bold"});Promise.all([c.load()]).then(function(a){b.recursiveUpdateText(b.game.stage)})},c.prototype.recursiveUpdateText=function(a){var b=this;a instanceof Phaser.Text&&(a.dirty=!0),a&&a.children&&a.children.length>0&&a.children.forEach(function(a){b.recursiveUpdateText(a)})},c}(Phaser.State);a.Boot=b}(game||(game={}));var utils;!function(a){var b=function(){function a(){}return a.createRectTexture=function(a,b,c,d,e){void 0===d&&(d="#000000");var f=Phaser.Color.hexToColor(d),g=!!e,h=a.add.bitmapData(b,c,e,g);return h.fill(f.r,f.g,f.b),h},a.createCircleTexture=function(a,b,c,d){void 0===c&&(c="#000000");var e=!!d,f=a.add.bitmapData(2*b,2*b,d,e);return f.context.fillStyle=c,f.circle(b,b,b),f},a.createColorImage=function(a,b,c){void 0===c&&(c="#ffffff");var d=b.anchor.x,e=b.anchor.y;b.anchor.set(0,0);var f=this.createRectTexture(a,b.width,b.height,c);return f.blendDestinationAtop(),f.draw(b,0,0,b.width,b.height),b.anchor.set(d,e),a.make.image(0,0,f)},a.createColorTexture=function(a,b,c){void 0===c&&(c="#ffffff");var d=this.createRectTexture(a,b.width,b.height,c);return d.blendDestinationAtop(),d.draw(b,0,0,b.width,b.height),d},a.createCircleImage=function(a,b,c,d){void 0===b&&(b=null),void 0===c&&(c=3),void 0===d&&(d="#ff0000");var e=this.createCircleTexture(a,c,d),f=a.make.image(0,0,e,null);return f.anchor.set(.5,.5),_.isNull(b)?a.world.add(f):b.add(f),f},a}();a.DrawUtil=b}(utils||(utils={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,c)||this;d.overlayDuration=400;var e=utils.DrawUtil.createRectTexture(d.game,2,2,"#000000","black_rect");return d.overlay=new Phaser.Image(a,0,0,e),d.overlay.visible=!1,d.game.stage.addChild(d.overlay),d}return __extends(c,b),c.prototype.fillStage=function(){var b=a.Config.GAME_WIDTH*a.Config.WORLD_SCALE,c=a.Config.GAME_HEIGHT*a.Config.WORLD_SCALE;this.overlay.scale.set(b,c)},c.prototype.changeState=function(a,b){this.fillStage(),this.showOverlay(a,b)},c.prototype.showOverlay=function(a,b){var c=this;this.overlay.visible=!0,this.overlay.alpha=0,this.overlayTween=this.game.add.tween(this.overlay).to({alpha:1},this.overlayDuration,Phaser.Easing.Cubic.Out,!0),this.overlayTween.onComplete.addOnce(function(){c.doChangeState(a,b)},this)},c.prototype.doChangeState=function(a,b){var c=this;this.game.state.start(a,!0,!1,b),setTimeout(function(){c.hideOverlay()},166),setTimeout(function(){c.overlay.visible=!1},166+this.overlayDuration)},c.prototype.hideOverlay=function(){this.overlayTween=this.game.add.tween(this.overlay).to({alpha:0},this.overlayDuration,Phaser.Easing.Cubic.Out,!0)},c}(Phaser.Plugin);a.StateTransition=b}(game||(game={}));var game;!function(a){var b=function(b){function c(){return null!==b&&b.apply(this,arguments)||this}return __extends(c,b),c.prototype.init=function(){this.addBackgound(),this.addPreloadBar(),this.addAzoomeeLogo(),this.addLoadingText(),this.addCopyright(),this.resize()},c.prototype.addBackgound=function(){this.bg=this.game.add.image(0,0,"preloader","BG0000"),this.bg.anchor.set(.5,.5),this.bgItems=this.game.add.image(0,0,"preloader","BG_Items0000"),this.bgItems.anchor.set(.5,.5),this.bgItems.scale.set(1.33,1.33)},c.prototype.addPreloadBar=function(){this.backPreloadSprite=this.game.add.image(0,0,"preloader","Preloader_Back0000"),this.backPreloadSprite.anchor.set(.5,.5),this.backPreloadSprite.x=a.Config.HALF_GAME_WIDTH,this.backPreloadSprite.y=a.Config.HALF_GAME_HEIGHT,this.frontPreloadSprite=this.game.add.sprite(0,0,"preloader","Preloader_Front0000"),this.frontPreloadSprite.x=.5*(a.Config.GAME_WIDTH-this.frontPreloadSprite.width)},c.prototype.addAzoomeeLogo=function(){this.logo=this.game.add.image(0,0,"azoomee_white"),this.logo.anchor.set(.5,.5)},c.prototype.addLoadingText=function(){var b={font:"58px "+a.Main.fontFamily,fill:"#ffffff",align:"center"};this.loadingText=this.game.add.text(0,0,"Loading...",b),this.loadingText.anchor.set(.5,.5),this.loadingText.position.set(a.Config.HALF_GAME_WIDTH,a.Config.HALF_GAME_HEIGHT+175),this.loadingText.setShadow(2,2,"#E54510",2),this.loadingText.visible=!1},c.prototype.addCopyright=function(){var b=(new Date).getUTCFullYear(),c="(C) RoboWhale, "+b+"\nUse with permission",d={font:"24px "+a.Main.fontFamily,fill:"#ffffff",align:"center"};this.copyright=this.game.add.text(0,0,c,d),this.copyright.anchor.set(.5,.5),this.copyright.position.set(a.Config.HALF_GAME_WIDTH,a.Config.HALF_GAME_HEIGHT+175),this.copyright.lineSpacing=-8,this.copyright.alpha=.8,this.copyright.visible=!1},c.prototype.isCopyrightVisible=function(){var a=utils.NetUtil.getCurrentHost();return["robowhale.com","192.168","localhost"].some(function(b){return a.indexOf(b)>-1})},c.prototype.preload=function(){this.loadLettersConfigs(),this.loadOtherAssets(),this.loadAudio(),this.loadGraphics(),this.load.setPreloadSprite(this.frontPreloadSprite)},c.prototype.loadLettersConfigs=function(){var b=a.Main.language+"_letters.json";this.load.json("letters","assets/letters/"+b)},c.prototype.loadOtherAssets=function(){this.load.json("texts","assets/texts.json")},c.prototype.loadAudio=function(){this.load.audio("main_loop",["assets/audio/MainLoop.ogg","assets/audio/MainLoop.m4a"],!0),this.game.sound.usingWebAudio&&(this.load.audio("tap","assets/audio/tap.wav",!0),this.load.audio("star_collect",["assets/audio/convert_item.ogg","assets/audio/convert_item.m4a"],!0),this.load.audio("show_picture",["assets/audio/achieved.ogg","assets/audio/achieved.m4a"],!0),this.load.audio("restart",["assets/audio/restart.ogg","assets/audio/restart.m4a"],!0),this.loadSound("star_arrive","Collect Item"),this.loadSound("stars_on_complete","Small Success"),this.loadSound("letter_show","Scoring a Point"),this.loadSound("win","Cartoon Big Win"),this.loadSound("error_1","App Error"),this.loadSound("tile_click_success_5","Correct Answer 3"),this.loadSound("tiles_collected_1","Collect Item"),this.loadSound("word_level_complete_1","Happy Win Game"),this.loadSound("cheers","kids_cheers"),this.loadSound("pop_2","Pop_B",["wav"]),this.loadSound("pop_4","Pop_D",["wav"]),this.loadSound("photo","photo"),this.loadSound("erase","erase_board"),this.loadSound("win_2","Game Award 3"),this.loadSound("win_3","Well done"));var b=a.Main.language+"_sounds";this.load.audio("words_sounds",["assets/audio/words/"+b+".ogg","assets/audio/words/"+b+".m4a"],!0),this.load.json("sounds_config","assets/audio/words/"+a.Main.language+"_sounds.json")},c.prototype.loadSound=function(a,b,c){void 0===c&&(c=["ogg","m4a"]);var d="assets/audio/",e=d+b+".",f=c.map(function(a){return e+a});this.load.audio(a,f,!0)},c.prototype.loadGraphics=function(){this.load.atlasJSONHash("backgrounds_1","assets/graphics/backgrounds_1.png","assets/graphics/backgrounds_1.json"),this.load.atlasJSONHash("letters_1","assets/graphics/letters_1.png","assets/graphics/letters_1.json"),this.load.atlasJSONHash("letters_2","assets/graphics/letters_2.png","assets/graphics/letters_2.json"),this.load.atlasJSONHash("pictures_1","assets/graphics/pictures_1.png","assets/graphics/pictures_1.json"),this.load.atlasJSONHash("pictures_2","assets/graphics/pictures_2.png","assets/graphics/pictures_2.json"),this.load.atlasJSONHash("choose_level","assets/graphics/choose_level.png","assets/graphics/choose_level.json"),this.load.atlasJSONHash("graphics_1","assets/graphics/graphics_1.png","assets/graphics/graphics_1.json"),this.load.atlasJSONHash("main_menu","assets/graphics/main_menu.png","assets/graphics/main_menu.json"),this.load.atlasJSONHash("languages_menu","assets/graphics/languages_menu.png","assets/graphics/languages_menu.json"),this.load.atlasJSONHash("word_level","assets/graphics/word_level.png","assets/graphics/word_level.json"),this.load.atlasJSONHash("free_zone","assets/graphics/free_zone.png","assets/graphics/free_zone.json"),this.load.atlasJSONHash("letters_complete","assets/graphics/letters_complete.png","assets/graphics/letters_complete.json")},c.prototype.loadUpdate=function(){this.loadingText.setText(this.load.progress+"%")},c.prototype.create=function(){this.initTexts(),this.initWordSounds(),this.initMainMusicLoop(),this.createCanvasLetterBMD(),this.initLettersConfig(),this.game.sound.play("main_loop",.25,!0),this.startGame()},c.prototype.startGame=function(){this.game.changeState("MainMenu",!0)},c.prototype.initTexts=function(){var b=this.game.cache.getJSON("texts");a.Main.texts=b[a.Main.language]},c.prototype.initWordSounds=function(){var b=this.game.cache.getJSON("sounds_config"),c=this.game.add.sound("words_sounds");c.allowMultiple=!0,Object.keys(b).sort().forEach(function(a){var d=b[a],e=d[0],f=d[1],g=f-e;c.addMarker(a,e,g)}),a.Main.wordsSounds=c},c.prototype.initMainMusicLoop=function(){a.Main.mainMusicLoop=this.sound.add("main_loop",a.Main.fullVolume,!0,!0)},c.prototype.createCanvasLetterBMD=function(){this.game.make.bitmapData(330,350,"canvas_letter",!0).smoothed=!0},c.prototype.initLettersConfig=function(){a.Main.lettersConfig=new a.LettersConfig(this.game),a.Main.lettersConfig.init()},c.prototype.resize=function(){this.resizeBackground(),this.alignSprites(),this.alignAzoomeeLogo()},c.prototype.resizeBackground=function(){this.bg.width=1.05*a.Config.GAME_WIDTH,this.bg.height=1.05*a.Config.GAME_HEIGHT,this.bg.x=a.Config.HALF_GAME_WIDTH,this.bg.y=a.Config.HALF_GAME_HEIGHT,this.bgItems.x=a.Config.HALF_GAME_WIDTH,this.bgItems.y=a.Config.HALF_GAME_HEIGHT},c.prototype.alignSprites=function(){this.backPreloadSprite.y=.66*a.Config.GAME_HEIGHT,this.frontPreloadSprite.y=this.backPreloadSprite.bottom-41,this.loadingText.y=this.backPreloadSprite.y+80,this.copyright.y=a.Config.GAME_HEIGHT-.5*this.copyright.height-8},c.prototype.alignAzoomeeLogo=function(){var b=0,c=this.backPreloadSprite.top,d=c-b;this.logo.x=a.Config.HALF_GAME_WIDTH,this.logo.y=b+d/2},c.prototype.shutdown=function(){this.cache.removeImage("preloader",!0)},c}(Phaser.State);a.Preloader=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,c,"background")||this;return d.addSky(),d.addSkyLines(),d.addClouds(),d.addBottom(),d}return __extends(c,b),c.prototype.addSky=function(){this.sky=this.game.add.image(0,-1,"main_menu","Sky0000",this)},c.prototype.addSkyLines=function(){this.topSkyline=this.game.add.image(0,0,"main_menu","Skyline_Top0000",this),this.topSkyline.anchor.set(.5,.5),this.topSkyline.x=a.Config.HALF_GAME_WIDTH,this.bottomSkyline=this.game.add.image(0,0,"main_menu","Skyline_Bottom0000",this),this.bottomSkyline.anchor.set(.5,.5),this.bottomSkyline.x=a.Config.HALF_GAME_WIDTH},c.prototype.addClouds=function(){var a=this.game.add.image(560,0,"main_menu","Cloud_10000",this),b=this.game.add.image(220,0,"main_menu","Cloud_20000",this),c=this.game.add.image(640,0,"main_menu","Cloud_30000",this),d=this.game.add.image(35,0,"main_menu","Cloud_10000",this),e=this.game.add.image(320,0,"main_menu","Cloud_10000",this);this.clouds=[a,b,c,d,e],this.clouds.forEach(function(a){a.anchor.set(.5,.5)})},c.prototype.addBottom=function(){this.bottomBG=this.game.add.image(0,0,"main_menu","BG_Bottom0000",this),this.bottomBG.anchor.set(.5,1),this.bottomBG.x=355},c.prototype.resize=function(){this.sky.width=a.Config.GAME_WIDTH,this.sky.height=.85*a.Config.GAME_HEIGHT,this.topSkyline.y=.22*a.Config.GAME_HEIGHT,this.bottomSkyline.y=.48*a.Config.GAME_HEIGHT,this.alignClouds(),this.alignBottom()},c.prototype.alignClouds=function(){this.clouds[0].y=.06*a.Config.GAME_HEIGHT,this.clouds[1].y=.11*a.Config.GAME_HEIGHT,this.clouds[2].y=.28*a.Config.GAME_HEIGHT,this.clouds[3].y=.3*a.Config.GAME_HEIGHT,this.clouds[4].y=.36*a.Config.GAME_HEIGHT},c.prototype.alignBottom=function(){this.bottomBG.y=a.Config.GAME_HEIGHT<850?a.Config.GAME_HEIGHT+20:a.Config.GAME_HEIGHT+1},c.prototype.destroy=function(){b.prototype.destroy.call(this,!0,!1),this.clouds=null},c}(Phaser.Group);a.MainMenuBackground=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,c,"LanguagesUI")||this;return d.languages=["en","es","pt","tr","it","fr","ru"],d.exists=!1,d.visible=!1,d._languageSelected=new Phaser.Signal,d.addBack(),d.addButtons(),d}return __extends(c,b),c.prototype.addBack=function(){this.back=this.game.add.image(62,0,"interface","Flags_Back0000",this),this.back.width=a.Config.GAME_WIDTH+100,this.back.anchor.set(1,.5)},c.prototype.addButtons=function(){var b=-104,c=0,d=0;this.buttons=[];for(var e=0;e<6;e++){var f="Flag_ES0000",g=new a.SimpleButton(this.game,c,d,"interface",f);g.callback.add(this.onButtonClick,this),this.add(g),this.buttons.push(g),c+=b}},c.prototype.onButtonClick=function(a){this._languageSelected.dispatch(a.userData)},c.prototype.updateButtons=function(a){var b=this,c=0;this.languages.forEach(function(d){if(d!==a){var e="Flag_"+d.toUpperCase()+"0000",f=b.buttons[c++];f.frameName=e,f.userData=d}})},c.prototype.show=function(){var a=this;this.exists=!0,this.visible=!0,this.alpha=1,this.back.alpha=0,this.game.add.tween(this.back).to({alpha:1},100,Phaser.Easing.Linear.None,!0);var b=100;this.buttons.forEach(function(c){c.scale.set(0),a.game.add.tween(c.scale).to({x:1,y:1},400,Phaser.Easing.Back.Out,!0,b),b+=100})},c.prototype.hide=function(){this.game.add.tween(this).to({alpha:0},100,Phaser.Easing.Linear.None,!0).onComplete.addOnce(this.onHideComplete,this)},c.prototype.onHideComplete=function(){this.exists=!1,this.visible=!1},c.prototype.destroy=function(){b.prototype.destroy.call(this,!0,!1),this.buttons=null,this._languageSelected.dispose(),this._languageSelected=null},Object.defineProperty(c.prototype,"languageSelected",{get:function(){return this._languageSelected},enumerable:!0,configurable:!0}),c}(Phaser.Group);a.LanguagesUI=b}(game||(game={}));var game;!function(a){var b=function(a){function b(b,c,d,e,f){var g=a.call(this,b,c,d,e,f)||this;return g.callbackDelay=0,g.enabled=!0,g.disableInput=!1,g.userData={},g._callback=new Phaser.Signal,g.anchor.set(.5,.5),g.inputEnabled=!0,g.events.onInputDown.add(g.onInputDown,g),g.events.onInputUp.add(g.onInputUp,g),g.game.device.desktop&&(g.input.useHandCursor=!0),g}return __extends(b,a),b.prototype.onInputDown=function(){this.disableInput||(this.game.device.webAudio&&this.game.sound.play("tap"),this.game.add.tween(this.scale).to({x:.9,y:.9},50,Phaser.Easing.Cubic.Out,!0))},b.prototype.onInputUp=function(a,b){this.disableInput||(this.isPointerOver(b)&&this.executeCallback(),this.game.tweens.removeFrom(this.scale),this.game.add.tween(this.scale).to({x:1,y:1},150,Phaser.Easing.Cubic.Out,!0))},b.prototype.isPointerOver=function(a){var b=this;return a.interactiveCandidates.some(function(a){return a.sprite===b})},b.prototype.executeCallback=function(){this.callbackDelay>0?this.game.time.events.add(this.callbackDelay,this._callback.dispatch,this._callback,this):this._callback.dispatch(this)},b.prototype.setCallbackDelay=function(a){this.callbackDelay=a},b.prototype.enable=function(){this.enabled===!1&&(this.enabled=!0,this.input.enabled=!0)},b.prototype.disable=function(){this.enabled&&(this.enabled=!1,this.input.enabled=!1)},b.prototype.destroy=function(){a.prototype.destroy.call(this),this._callback.dispose(),this._callback=null},Object.defineProperty(b.prototype,"callback",{get:function(){return this._callback},enumerable:!0,configurable:!0}),b}(Phaser.Image);a.SimpleButton=b}(game||(game={}));var game;!function(a){var b=function(a){function b(b,c,d,e,f,g){var h=a.call(this,b,c,d,e,f)||this;return h.spriteSheet=e,h.textureKey1=f,h.textureKey2=g,h.activeTextureKey=h.textureKey1,h._state=1,h.events.onInputUp.add(h.switchTextures,h,2),h}return __extends(b,a),b.prototype.switchTextures=function(){this.activeTextureKey=this.activeTextureKey===this.textureKey1?this.textureKey2:this.textureKey1,this.frameName=this.activeTextureKey,this._state=this.activeTextureKey===this.textureKey1?1:2},Object.defineProperty(b.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),b}(game.SimpleButton);a.ToggleButton=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,c,"talk_bubble")||this;return d.content=["Yay!","Let's learn\nalphabet!","My name is\nZebra.","Let's play!"],d.contentPointer=0,d.initContent(),d.addBack(),d.addText(),d}return __extends(c,b),c.prototype.initContent=function(){var b=Object.keys(a.Main.texts).filter(function(a){return a.indexOf("zebra_")>-1&&"zebra_0"!==a});this.content=b.map(function(b){return a.Main.texts[b]})},c.prototype.addBack=function(){this.back=this.game.add.image(0,0,"main_menu","TalkBubble0000",this),this.back.anchor.set(1,.33)},c.prototype.addText=function(){var b={font:"48px "+a.Main.fontFamily,fill:"#206B8C",align:"center"},c=a.Main.texts.zebra_0;this.text=this.game.add.text(0,0,c,b,this),this.text.anchor.set(.5,.5),this.text.x=this.back.left+107,this.text.y=this.back.top+.5*this.back.height-2,this.text.lineSpacing=-10,this.text.fontSize=35},c.prototype.updateContent=function(){var a=this.content[this.contentPointer++];if(this.contentPointer===this.content.length&&(this.contentPointer=0),this.text.setText(a),this.text.width>170){var b=170/this.text.width;this.text.scale.set(b,b)}else this.text.scale.set(1,1);this.game.tweens.removeFrom(this.scale),this.game.tweens.removeFrom(this),this.scale.set(1,1),this.angle=0,this.game.add.tween(this.scale).from({x:0,y:0},700,Phaser.Easing.Back.Out,!0),this.game.add.tween(this).from({angle:-50},700,Phaser.Easing.Back.Out,!0)},c}(Phaser.Group);a.TalkBubble=b}(game||(game={}));var game;!function(a){var b=function(b){function c(){var a=null!==b&&b.apply(this,arguments)||this;return a.titleClicks=0,a.talkBubbleClicks=0,a}return __extends(c,b),c.prototype.init=function(a){this.titleClicks=0},c.prototype.create=function(){this.addBackground(),this.addLetters(),this.addTitle(),this.addZebra(),this.addTalkBubble(),this.addButtons(),this.addCredits(),this.resize(),this.playAnimationOnStart()},c.prototype.addBackground=function(){this.background=this.game.add.image(0,0,"main_menu","BG0000"),this.background.anchor.set(.5,.5)},c.prototype.addLetters=function(){this.letters=this.game.add.image(0,0,"main_menu","Letters_BG0000"),this.letters.anchor.set(.5,.5),this.letters.x=a.Config.HALF_GAME_WIDTH},c.prototype.addTitle=function(){var b=this;this.title=this.add.image(0,0,"main_menu","Title0000"),this.title.anchor.set(.5,.5),this.title.x=a.Config.HALF_GAME_WIDTH-.5,this.title.y=.15*a.Config.GAME_HEIGHT,this.title.inputEnabled=!0,this.title.events.onInputDown.add(function(){b.titleClicks++>5&&(b.titleClicks=0,b.game.add.tween(b.title).to({alpha:0},300,Phaser.Easing.Sinusoidal.InOut,!0,0,0,!0),a.Main.storage.clear(),window.alert("Saved data was cleared!"))})},c.prototype.addZebra=function(){this.zebra=this.game.add.image(0,0,"main_menu","Zebra0000"),this.zebra.anchor.set(.5,1),this.zebra.x=a.Config.GAME_WIDTH-85,this.zebra.inputEnabled=!0,this.zebra.events.onInputDown.add(this.onZebraClick,this)},c.prototype.onZebraClick=function(){this.game.sound.play("pop_4",.5),this.tweens.removeFrom(this.zebra),this.zebra.y=a.Config.GAME_HEIGHT+137,this.game.add.tween(this.zebra).to({y:"-40"},200,Phaser.Easing.Sinusoidal.InOut,!0,0,0,!0),this.talkBubble.updateContent()},c.prototype.addTalkBubble=function(){this.talkBubble=new a.TalkBubble(this.game,this.world),this.talkBubble.position.x=this.zebra.left-10},c.prototype.onTalkBubbleClick=function(){this.talkBubbleClicks++,this.talkBubbleClicks},c.prototype.addButtons=function(){var b=this;this.soundButton=new a.ToggleButton(this.game,0,0,"main_menu","Button_Sound_On0000","Button_Sound_Off0000"),this.soundButton.callback.add(function(){b.game.sound.mute=!b.game.sound.mute}),this.game.sound.mute&&this.soundButton.switchTextures(),this.playButton=new a.SimpleButton(this.game,0,0,"main_menu","Button_Play0000"),this.playButton.setCallbackDelay(200),this.playButton.callback.addOnce(this.onPlayButtonClick,this);var c="Flag_"+a.Main.language.toUpperCase()+"_Round0000";this.languageButton=new a.SimpleButton(this.game,0,0,"main_menu",c),this.languageButton.x=a.Config.GAME_WIDTH-60,this.languageButton.callback.addOnce(this.gotoLanguagesMenu,this),this.creditsButton=new a.SimpleButton(this.game,0,0,"main_menu","Button_Credits0000"),this.creditsButton.callback.add(this.toggleCredits,this),this.buttons=[this.soundButton,this.creditsButton,this.playButton,this.languageButton],this.buttons.forEach(function(a){b.world.add(a)})},c.prototype.onPlayButtonClick=function(){this.game.changeState("ChooseLevelMenu")},c.prototype.gotoLanguagesMenu=function(){this.game.changeState("LanguagesMenu")},c.prototype.addCredits=function(){this.credits=this.game.add.image(0,0,"main_menu","CreditsBoard0000"),this.credits.position.set(Math.round(.5*(a.Config.GAME_WIDTH-this.credits.width)),Math.round(.5*(a.Config.GAME_HEIGHT-this.credits.height))),this.credits.visible=!1},c.prototype.toggleCredits=function(){this.credits.visible?this.hideCredits():this.showCredits()},c.prototype.hideCredits=function(){var a=this;this.game.add.tween(this.credits).to({alpha:0},500,Phaser.Easing.Linear.None,!0),this.game.add.tween(this.credits).to({y:this.credits.y+200},500,Phaser.Easing.Back.In,!0).onComplete.addOnce(function(){a.playButton.input.enabled=!0,a.creditsButton.input.enabled=!0,a.credits.visible=!1},this)},c.prototype.showCredits=function(){var b=this;this.credits.visible=!0,this.credits.alpha=0,this.credits.y=.5*(a.Config.GAME_HEIGHT-this.credits.height)+200,this.game.add.tween(this.credits).to({alpha:1},500,Phaser.Easing.Linear.None,!0),this.game.add.tween(this.credits).to({y:this.credits.y-200},500,Phaser.Easing.Back.Out,!0),this.playButton.input.enabled=!1,this.creditsButton.input.enabled=!1,this.game.input.onDown.addOnce(function(){b.hideCredits()},this)},c.prototype.startMusic=function(){a.Main.mainMusicLoop&&a.Main.mainMusicLoop.play(),this.soundButton.switchTextures(),this.soundButton.input.enabled=!0},c.prototype.playAnimationOnStart=function(){this.game.add.tween(this.letters.scale).from({x:1.5,y:1.5},600,Phaser.Easing.Back.Out,!0),this.game.add.tween(this.letters).from({alpha:0},600,Phaser.Easing.Cubic.Out,!0),this.animateTitle(),this.animateZebra(),this.animateButtons()},c.prototype.animateTitle=function(){var a=this,b=350;this.title.alpha=0,this.title.scale.set(1.3,1.3),this.game.add.tween(this.title).to({alpha:1},300,Phaser.Easing.Cubic.Out,!0,b),this.game.add.tween(this.title.scale).to({x:1,y:1},600,Phaser.Easing.Back.Out,!0,b).onComplete.addOnce(function(){a.game.add.tween(a.title.scale).to({y:.94,x:1.06},800,Phaser.Easing.Sinusoidal.InOut,!0,0,1e3,!0)})},c.prototype.animateZebra=function(){var a=this,b=700;this.zebra.scale.set(0),this.game.add.tween(this.zebra.scale).to({x:1,y:1},600,Phaser.Easing.Back.Out,!0,b).onComplete.addOnce(function(){a.game.add.tween(a.zebra.scale).to({y:.95},800,Phaser.Easing.Sinusoidal.Out,!0,0,1e4,!0)}),this.game.add.tween(this.talkBubble.scale).from({x:0,y:0},600,Phaser.Easing.Back.Out,!0,b+400),this.game.add.tween(this.talkBubble).from({angle:-40},600,Phaser.Easing.Back.Out,!0,b+400).onComplete.addOnce(function(){a.game.add.tween(a.talkBubble.position).to({y:"+10"},800,Phaser.Easing.Sinusoidal.InOut,!0,0,1e3,!0)})},c.prototype.animateButtons=function(){var a=this,b=1300;this.buttons.forEach(function(c){c.scale.set(0,0);var d=a.game.add.tween(c.scale).to({x:1,y:1},500,Phaser.Easing.Back.Out,!0,b);c===a.playButton&&d.onComplete.addOnce(a.shakePlayButton,a),b+=150})},c.prototype.shakePlayButton=function(){var a=this,b=-5;this.time.events.repeat(2200,Number.MAX_VALUE,function(){a.playButton.angle=b,a.game.add.tween(a.playButton).to({angle:Math.abs(b)},100,Phaser.Easing.Sinusoidal.InOut,!0,0,2,!0).onComplete.add(function(){a.game.add.tween(a.playButton).to({angle:0},100,Phaser.Easing.Linear.None,!0)})},this)},c.prototype.resize=function(){this.resizeBackground(),this.alingSprites(),this.alignButtons()},c.prototype.resizeBackground=function(){if(this.background.width=a.Config.GAME_WIDTH+2,this.background.height=a.Config.GAME_HEIGHT+2,this.background.x=a.Config.HALF_GAME_WIDTH,this.background.y=a.Config.HALF_GAME_HEIGHT,this.letters.y=a.Config.HALF_GAME_HEIGHT,this.letters.height3.14159265&&(a-=6.28318531),a<0?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a},a.DEG_TO_RAD=.017453292519943295,a.RAD_TO_DEG=57.29577951308232,a}();a.MathUtil=b}(utils||(utils={}));var game;!function(a){var b=function(a){function b(b){var c=a.call(this,b,0,0,"graphics_1","Spline_Marker0000")||this;return c._star=!1,c.anchor.set(.5,.5),c}return __extends(b,a),Object.defineProperty(b.prototype,"star",{get:function(){return this._star},set:function(a){this._star=a},enumerable:!0,configurable:!0}),b}(Phaser.Image);a.SplineMarker=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,c,"")||this;return d.color="#000000",d.thickness=10,d._active=!1,d._thick=!1,d.index=0,d.mediumPointIndex=0,d.exists=!1,d.visible=!1,d.markers=[],d}return __extends(c,b),Object.defineProperty(c.prototype,"thick",{set:function(a){this._thick=a,this._thick?(this._thick=!1,this.thickness=40):(this._thick=!0,this.thickness=10)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"active",{get:function(){return this._active},enumerable:!0,configurable:!0}),c.prototype.addMarker=function(b,c,d){void 0===d&&(d=!1);var e=new a.SplineMarker(this.game);return e.x=b,e.y=c,e.star=d,this.markers.push(e),this.add(e),1===this.markers.length&&(e.frameName="Spline_Marker_First0000"),e},c.prototype.createFromJSON=function(a,b,c){var d=this;a.forEach(function(a){var e=a.x+b,f=a.y+c,g=a.star;d.addMarker(e,f,g)}),this.initMediumPoints(),this.addDots()},c.prototype.initMediumPoints=function(){if(2===this.markers.length)this.initLinearMediumPoints();else{var a=this.calculateSplineLength(),b=a/25,c=1/b,d=_.map(this.markers,"x"),e=_.map(this.markers,"y");this.mediumPoints=[];for(var f=0;f<1;f+=c){var g=Phaser.Math.catmullRomInterpolation(d,f),h=Phaser.Math.catmullRomInterpolation(e,f);this.mediumPoints.push(new Phaser.Point(g,h))}this.mediumPoints.push(_.last(this.markers).position.clone())}},c.prototype.initLinearMediumPoints=function(){var a=this.calculateSplineLength(),b=a/25,c=1/b,d=_.map(this.markers,"x"),e=_.map(this.markers,"y");this.mediumPoints=[];for(var f=0;f<=1;f+=c){var g=Phaser.Math.linearInterpolation(d,f),h=Phaser.Math.linearInterpolation(e,f);this.mediumPoints.push(new Phaser.Point(g,h))}this.mediumPoints.push(_.last(this.markers).position.clone())},c.prototype.calculateSplineLength=function(){for(var a=0,b=this.markers.length,c=1;cb){var d=b/c;this.scale.set(d,d)}},c.prototype.playTweenOnClick=function(){for(var a=this.letters.length,b=.5*this.getWidth(),c=0;c0?this.game.time.events.add(this.callbackDelay,this._callback.dispatch,this._callback,this):this._callback.dispatch(this)},b.prototype.enable=function(){this._inputEnabled=!0,this.image.input.enabled=!0},b.prototype.disable=function(){this._inputEnabled=!1,this.image.input.enabled=!1},b.prototype.destroy=function(){a.prototype.destroy.call(this,!0,!1),this._callback.dispose(),this._callback=null,this.userData=null},Object.defineProperty(b.prototype,"callback",{get:function(){return this._callback},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"text",{get:function(){return this._text},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"inputEnabled",{get:function(){return this._inputEnabled},set:function(a){this._inputEnabled=a,this.image.input.enabled=this._inputEnabled},enumerable:!0,configurable:!0}),b}(Phaser.Group);a.ButtonWithText=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,c,"")||this;return d.addButtons(),d.addTexts(),d.game.time.events.add(100,function(){d.exists=!1,d.visible=!1},d),d}return __extends(c,b),c.prototype.addButtons=function(){var b=this,c=180;this.nextLevelButton=new a.SimpleButton(this.game,0,0,"graphics_1","Button_Next0000"),this.nextLevelButton.x=0,this.nextLevelButton.userData.textContent=a.Main.texts.next,this.restartButton=new a.SimpleButton(this.game,0,0,"graphics_1","Button_Restart0000"),this.restartButton.x=c,this.restartButton.userData.textContent=a.Main.texts.restart,this.menuButton=new a.SimpleButton(this.game,0,0,"graphics_1","Button_Menu0000"),this.menuButton.x=-c,this.menuButton.userData.textContent=a.Main.texts.menu,this.buttons=[this.menuButton,this.nextLevelButton,this.restartButton],this.buttons.forEach(function(a){b.add(a)})},c.prototype.addTexts=function(){var b=this,c={font:"33px "+a.Main.fontFamily,fill:"#ffffff",align:"center"};this.buttons.forEach(function(a){var d=b.game.add.text(a.position.x,a.position.y+.5*a.height+3,a.userData.textContent,c,b);d.anchor.set(.5,0),d.setShadow(0,4,"rgba(0,0,0,0.15)",0),d.lineSpacing=-10,a.userData.text=d})},c.prototype.show=function(){var a=this;this.exists=!0,this.visible=!0;var b=0;this.buttons.forEach(function(c){a.game.add.tween(c).from({y:"-20",alpha:0},400,Phaser.Easing.Cubic.Out,!0,b),a.game.add.tween(c.userData.text).from({y:"+20",alpha:0},400,Phaser.Easing.Cubic.Out,!0,b+200),b+=200}),this.game.time.events.add(1800,this.shakeNextButton,this)},c.prototype.shakeNextButton=function(){var a=this,b=-4;this.game.time.events.repeat(2200,Number.MAX_VALUE,function(){a.nextLevelButton.angle=b,a.game.add.tween(a.nextLevelButton).to({angle:Math.abs(b)},100,Phaser.Easing.Sinusoidal.InOut,!0,0,2,!0).onComplete.add(function(){a.game.add.tween(a.nextLevelButton).to({angle:0},100,Phaser.Easing.Linear.None,!0)})},this)},c.prototype.destroy=function(){b.prototype.destroy.call(this,!0,!1),this.buttons=null},c}(Phaser.Group);a.LevelCompleteGUI=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a){var d=b.call(this,a,0,0,c.createTexture(a))||this;return d.game.time.events.add(100,function(){d.exists=!1,d.visible=!1},d),d}return __extends(c,b),c.createTexture=function(a){return utils.DrawUtil.createRectTexture(a,2,2,"#ffffff","white_rect")},c.prototype.show=function(a,b){void 0===a&&(a=500),void 0===b&&(b=100),this.exists=!0,this.visible=!0,this.alpha=1,this.game.add.tween(this).to({alpha:0},a,Phaser.Easing.Cubic.In,!0,b).onComplete.addOnce(this.onHideComplete,this)},c.prototype.onHideComplete=function(){this.exists=!1,this.visible=!1},c.prototype.resize=function(){this.width=a.Config.GAME_WIDTH,this.height=a.Config.GAME_HEIGHT},c}(Phaser.Image);a.WhiteOverlay=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,a.world,"gui")||this;return d.level=c,d.addStarsGUI(),d.addLevelCompleteGUI(),d.addButtons(),d.addWhiteOverlay(),d}return __extends(c,b),c.prototype.addButtons=function(){var b=this,c=100;this.menuButton=new a.SimpleButton(this.game,0,c,"word_level","Button_Home0000"),this.menuButton.x=a.Config.GAME_WIDTH-60,this.menuButton.callback.add(this.gotoChooseLevelMenu,this),this.add(this.menuButton),this.soundButton=new a.ToggleButton(this.game,0,c,"word_level","Button_Sound_On0000","Button_Sound_Off0000"),this.soundButton.x=this.menuButton.x-84,this.soundButton.callback.add(function(){b.game.sound.mute=!b.game.sound.mute}),this.add(this.soundButton),this.buttons=[this.soundButton,this.menuButton]},c.prototype.addStarsGUI=function(){this.starsGUI=new a.StarsGUI(this.game,this.level.stars.length),this.starsGUI.position.x=.5*(a.Config.GAME_WIDTH-this.starsGUI.getWidth()),this.add(this.starsGUI)},c.prototype.addLevelCompleteGUI=function(){this.levelCompleteGUI=new a.LevelCompleteGUI(this.game,this),this.levelCompleteGUI.position.x=a.Config.HALF_GAME_WIDTH,this.levelCompleteGUI.nextLevelButton.callback.addOnce(this.gotoNextLevel,this),this.levelCompleteGUI.restartButton.callback.addOnce(this.restart,this),this.levelCompleteGUI.menuButton.callback.addOnce(this.gotoChooseLevelMenu,this)},c.prototype.gotoNextLevel=function(){var b=a.Main.lettersConfig.getNextLetter();b?this.game.changeState("Level",b):a.Main.stats.getBooleanValue("letters_complete_was_seen")===!1?this.game.changeState("LettersCompleteScreen"):this.gotoChooseLevelMenu()},c.prototype.restart=function(){this.game.changeState("Level",a.Main.lettersConfig.currentLetter)},c.prototype.gotoChooseLevelMenu=function(){this.game.changeState("ChooseLevelMenu")},c.prototype.gotoChooseWordMenu=function(){this.game.changeState("ChooseWordMenu")},c.prototype.addWhiteOverlay=function(){var a=this;this.whiteOverlayFX=this.game.add.image(0,0,"word_level","WhiteOverlay0000"),this.whiteOverlayFX.anchor.set(.5,.5),this.game.time.events.add(100,function(){a.whiteOverlayFX.exists=!1,a.whiteOverlayFX.visible=!1},this)},c.prototype.showWhiteOverlayFX=function(){this.whiteOverlayFX.exists=!0,this.whiteOverlayFX.visible=!0,this.whiteOverlayFX.alpha=.8,this.game.add.tween(this.whiteOverlayFX).to({alpha:.44},800,Phaser.Easing.Cubic.In,!0),this.game.add.tween(this.whiteOverlayFX.scale).to({x:1.5*this.whiteOverlayFX.scale.x,y:1.5*this.whiteOverlayFX.scale.y},800,Phaser.Easing.Back.Out,!0)},c.prototype.resize=function(){this.starsGUI.position.y=.82*a.Config.GAME_HEIGHT,this.levelCompleteGUI.position.y=.8*a.Config.GAME_HEIGHT,this.alignButtons(),this.resizeWhiteOverlay()},c.prototype.alignButtons=function(){var a=55;this.menuButton.y=a,this.soundButton.y=a},c.prototype.resizeWhiteOverlay=function(){this.whiteOverlayFX.width=1.4*a.Config.GAME_WIDTH,this.whiteOverlayFX.height=1.4*a.Config.GAME_HEIGHT,this.whiteOverlayFX.x=a.Config.HALF_GAME_WIDTH,this.whiteOverlayFX.y=a.Config.HALF_GAME_HEIGHT},c.prototype.hideButtons=function(){this.buttons.forEach(function(a){a.exists=!1,a.visible=!1})},c.prototype.onPause=function(){},c.prototype.onResume=function(){},c.prototype.destroy=function(){b.prototype.destroy.call(this,!0,!1)},c}(Phaser.Group);a.LevelGUI=b}(game||(game={}));var game;!function(a){var b=function(a){function b(b,c){var d=a.call(this,b,0,0,"word_level",c)||this;return d.sinAngle=0,d.sinAngleDelta=0,d.magnitude=1,d.anchor.set(.5,.5),d.velocity=new Phaser.Point,d.velocity.x=0,d.velocity.y=d.game.rnd.realInRange(3.33,4.33),d.angularVelocity=d.game.rnd.realInRange(1,2),d.angle=d.game.rnd.realInRange(0,180),d.magnitude=d.game.rnd.realInRange(.75,1.5),d.sinAngle=d.game.rnd.realInRange(0,Math.PI),d.sinAngleDelta=d.game.rnd.realInRange(.01,.017),c.indexOf("_5")>0||c.indexOf("_6")>0?(d.confettiType="Spiral",d.angle=d.game.rnd.realInRange(-20,20)):d.confettiType="Normal",d}return __extends(b,a),b.prototype.update=function(){"Spiral"===this.confettiType?this.simpleUpdate():this.complexUpdate(),this.visible=this.y>-10,this.visible&&(this.visible=this.x>-10&&this.xgame.Config.GAME_HEIGHT+10&&(this.exists=!1,this.visible=!1)},b.prototype.simpleUpdate=function(){this.x+=this.velocity.x,this.y+=this.velocity.y,this.velocity.x=Math.sin(this.sinAngle)*this.magnitude,this.sinAngle+=this.sinAngleDelta,this.angle+=this.angularVelocity},b.prototype.complexUpdate=function(){this.x+=this.velocity.x,this.y+=this.velocity.y,this.velocity.x=Math.sin(this.sinAngle)*this.magnitude,this.sinAngle+=this.sinAngleDelta,this.angle+=this.angularVelocity,this.scale.x=Math.sin(this.rotation),this.scale.y=Math.cos(this.rotation)},b.prototype.fastSin=function(a){return a<-3.14159265?a+=6.28318531:a>3.14159265&&(a-=6.28318531),a<0?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a},b.prototype.fastCos=function(a){return a<-3.14159265?a+=6.28318531:a>3.14159265&&(a-=6.28318531),a+=1.57079632,a>3.14159265&&(a-=6.28318531),a<0?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a},b.prototype.destroy=function(){a.prototype.destroy.call(this,!0)},b}(Phaser.Image);a.ConfettiParticle=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a){var c=b.call(this,a,null,"Confetti")||this;return c.running=!1,c.addParticles(),c.game.time.events.add(100,function(){c.exists=!1,c.visible=!1},c),c}return __extends(c,b),c.prototype.addParticles=function(){this.particles=[];for(var a=90,b=Math.round(a/7),c=a-b,d=0;d12100)return this.dragMarker=!1,void this.marker.scale.set(1,1);var c=this.projectionHelper.getProjection(this.marker.position,this.destination,this.pointerPosition);if(this.marker.position.copyFrom(c),this.marker.position.distance(this.destination)<1&&(this.checkStarsOverlap(this.destination),this.canvasLetter.drawSplineSegment(this.origin,this.destination),this.origin.copyFrom(this.destination),this.destination=this.currentSpline.getDestination(),this.destination&&(this.marker.angle=this.destination.angle(this.origin,!0)-90),!this.destination)){this.completeTutorial();var d=this.splines.indexOf(this.currentSpline);d===this.splines.length-1?(this.letter.frameName.indexOf("Upper")>0?this.upperLetterComplete=!0:this.lowerLetterComplete=!0,this.disableDraw=!0,this.onTracingComplete()):(this.currentSpline=this.splines[d+1],this.origin=this.currentSpline.getDestination(),this.destination=this.currentSpline.getDestination(),this.marker.position.copyFrom(this.origin),this.marker.angle=this.destination.angle(this.origin,!0)-90)}}},c.prototype.checkStarsOverlap=function(a){if(this.currentStar&&this.currentStar.collected===!1&&this.currentStar.splinePoint===a){var b=this.stars.indexOf(this.currentStar),c=this.gui.starsGUI.getStarPosition(b);this.currentStar.moveTo(c.x,c.y,this.gui.starsGUI,b),this.particlesBurst.show(this.currentStar.x,this.currentStar.y),this.game.sound.usingWebAudio&&this.sound.play("restart",.5);var d=this.stars[b+1];d&&(this.currentStar=d,this.currentStar.show())}},c.prototype.onTracingComplete=function(){this.marker.visible=!1,this.canvasLetter.visible=!1,this.letter.visible=!0,this.fadedLetter.anchor.set(.5,.5),this.fadedLetter.x=a.Config.HALF_GAME_WIDTH,this.fadedLetter.y=a.Config.HALF_GAME_HEIGHT,this.hideLetterOnComplete()},c.prototype.hideLetterOnComplete=function(){var b=this;this.letter.anchor.set(.5,.5),this.letter.x=a.Config.HALF_GAME_WIDTH,this.letter.y=a.Config.HALF_GAME_HEIGHT,this.fadedLetter.alpha=.33,this.showWhiteLetter(),this.game.add.tween(this.whiteLetter.scale).to({x:1.2,y:1.2},500,Phaser.Easing.Back.Out,!0,0,0,!0),this.game.add.tween(this.fadedLetter.scale).to({x:1.2,y:1.2},500,Phaser.Easing.Back.Out,!0,0,0,!0),this.game.add.tween(this.letter.scale).to({x:1.2,y:1.2},500,Phaser.Easing.Back.Out,!0,0,0,!0),this.game.add.tween(this.letter).to({y:"-12"},600,Phaser.Easing.Cubic.InOut,!0,100),this.game.add.tween(this.fadedLetter).to({y:"+12"},600,Phaser.Easing.Cubic.InOut,!0,100).onComplete.addOnce(function(){b.game.add.tween(b.letter.scale).to({x:1.2,y:1.2},400,Phaser.Easing.Sinusoidal.InOut,!0,500,1,!0),b.game.add.tween(b.fadedLetter.scale).to({x:1.2,y:1.2},400,Phaser.Easing.Sinusoidal.InOut,!0,500,1,!0).onComplete.addOnce(function(){b.game.add.tween(b.letter.scale).to({x:0,y:0},600,Phaser.Easing.Back.In,!0),b.game.add.tween(b.fadedLetter.scale).to({x:0,y:0},600,Phaser.Easing.Back.In,!0).onComplete.addOnce(b.onHideAnimationComplete,b)})})},c.prototype.showWhiteLetter=function(){var a=this;this.whiteLetter.visible=!0,this.whiteLetter.alpha=1,this.game.add.tween(this.whiteLetter).to({alpha:0},1e3,Phaser.Easing.Cubic.Out,!0).onComplete.addOnce(function(){a.whiteLetter.exists=!1,a.whiteLetter.visible=!1})},c.prototype.onHideAnimationComplete=function(){this.lowerLetterComplete?this.onLevelComplete():this.showLowerLetter()},c.prototype.showLowerLetter=function(){var a=this;this.game.time.events.add(100,function(){a.game.sound.play("letter_show",.33)},this),this.gui.starsGUI.hideActive(),this.currentLetterCase="Lower",this.setupLowerLetter(),this.setupWhiteLetter(),this.setFadedLetter(),this.setCanvasLetter(),this.setLowerSplines(),this.setStars(),this.setMarker(),this.game.add.tween(this.fadedLetter.scale).to({x:1,y:1},500,Phaser.Easing.Back.Out,!0),this.marker.scale.set(0,0),this.game.add.tween(this.marker.scale).to({x:1,y:1},500,Phaser.Easing.Back.Out,!0,500),this.currentStar=this.stars[0],this.game.time.events.add(750,function(){a.currentStar.show(),a.disableDraw=!1})},c.prototype.setupLowerLetter=function(){this.letter.frameName=this.letterConfig.lower.frame,this.letter.visible=!1,this.letter.anchor.set(0,0),this.letter.scale.set(1,1),this.letter.angle=0,this.letter.x=.5*(a.Config.GAME_WIDTH-this.letter.width),this.letter.y=.5*(a.Config.GAME_HEIGHT-this.letter.height)},c.prototype.setupWhiteLetter=function(){this.whiteLetter.frameName="Letter_"+this.letterKey.toUpperCase()+"_"+this.currentLetterCase+"_White0000"},c.prototype.setFadedLetter=function(){var b="Letter_"+this.letterKey.toUpperCase()+"_"+this.currentLetterCase+"_Back0000";this.fadedLetter.anchor.set(.5,.5),this.fadedLetter.x=a.Config.HALF_GAME_WIDTH,this.fadedLetter.y=a.Config.HALF_GAME_HEIGHT,this.fadedLetter.angle=0,this.fadedLetter.alpha=1,this.fadedLetter.frameName=b,this.fadedLetter.scale.set(0,0),this.fadedLetter.visible=!0},c.prototype.setCanvasLetter=function(){this.canvasLetter.visible=!0,this.canvasLetter.exists=!0,this.canvasLetter.setSourceImage(this.letter)},c.prototype.setLowerSplines=function(){var b=this;this.removeSplines(),this.letterConfig.lower.splines.forEach(function(c){var d=new a.Spline(b.game,b.world);d.createFromJSON(c,b.letter.x,b.letter.y),b.world.add(d),b.splines.push(d)}),this.currentSpline=this.splines[0],this.origin=this.currentSpline.getDestination(),this.destination=this.currentSpline.getDestination()},c.prototype.removeSplines=function(){this.splines.forEach(function(a){a.destroy()}),this.splines.length=0,this.currentSpline=null},c.prototype.setMarker=function(){this.marker.position.set(this.origin.x,this.origin.y),this.marker.angle=this.destination.angle(this.origin,!0)-90,this.marker.visible=!0},c.prototype.showPicture=function(){this.gui.starsGUI.hide(),this.letter.visible=!1,this.fadedLetter.visible=!1,this.marker.visible=!1,this.stars.forEach(function(a){a.visible=!1}),this.picture.show()},c.prototype.resize=function(){this.resizeBackground(),this.picture.resize(),this.gui.resize()},c.prototype.resizeBackground=function(){this.background.width=a.Config.GAME_WIDTH+2,this.background.height=a.Config.GAME_HEIGHT+2,this.background.x=a.Config.HALF_GAME_WIDTH,this.background.y=a.Config.HALF_GAME_HEIGHT,this.backgroundItems.x=a.Config.HALF_GAME_WIDTH,this.backgroundItems.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.x=a.Config.HALF_GAME_WIDTH,this.bgVignette.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.width=1.4*a.Config.GAME_WIDTH,this.bgVignette.height=1.4*a.Config.GAME_HEIGHT},c.prototype.pause=function(){},c.prototype.resume=function(){},c.prototype.onLevelComplete=function(){var a=this;this.game.sound.usingWebAudio&&(this.sound.play("show_picture",.5),this.game.time.events.add(100,function(){a.game.sound.play("cheers",.33)},this)),this.saveResult(),this.gui.hideButtons(),this.gui.showWhiteOverlayFX(),this.confetti&&this.confetti.show(),this.showPicture(),this.game.time.events.add(2500,this.gui.levelCompleteGUI.show,this.gui.levelCompleteGUI)},c.prototype.saveResult=function(){var b=a.Main.stats.getLetterSaveKey(a.Main.language,this.letterKey);a.Main.stats.saveValue(b,!0),a.Main.lettersConfig.keys.indexOf(this.letterKey)===a.Main.lettersConfig.keys.length-1&&a.Main.stats.saveValue("words_unlocked",!0)},c.prototype.shutdown=function(){this.projectionHelper.destroy(),this.projectionHelper=null,this.splines=null,this.currentSpline=null,this.pointerPosition=null,this.origin=null,this.destination=null},c.prototype.addPicture=function(){var b=this.letterConfig.picture;this.picture=new a.Picture(this.game,this.letterKey,b),this.world.add(this.picture)},c.prototype.addTutorial=function(){var b=this,c=0===a.Main.lettersConfig.keys.indexOf(this.letterKey);a.Main.stats.getBooleanValue("tutorial_letter");if(c&&this.currentSpline){var d=this.getTutorialPath(this.currentSpline);d&&d.length>1&&(this.tutorHand=new a.Hand(this.game),this.gui.add(this.tutorHand),this.game.time.events.add(1e3,function(){b.tutorHand.followPath(d)},this))}},c.prototype.getTutorialPath=function(a){var b=-20,c=-6;return 2===a.markers.length?a.markers.map(function(a){return new Phaser.Point(a.x+b,a.y+c)}):a.mediumPoints.map(function(a){return new Phaser.Point(a.x+b,a.y+c)})},c.prototype.completeTutorial=function(){this.tutorHand&&(a.Main.stats.saveValue("tutorial_letter",!0),this.tutorHand.destroy(),this.tutorHand=null)},c.prototype.addLevelGUI=function(){this.gui=new a.LevelGUI(this.game,this),this.world.add(this.gui)},c.prototype.addConfetti=function(){a.Main.weakDevice===!1&&(this.confetti=new a.Confetti(this.game))},c.prototype.addParticleBursts=function(){this.particlesBurst=new a.ConvertItemFX(this.game,this.world)},c.prototype.playLetterSound=function(){var b=this;this.game.time.events.add(800,function(){a.Main.wordsSounds.play(b.letterKey)},this)},c.prototype.addStars=function(){var b=this;this.stars=[],this.splines.forEach(function(c){c.markers.forEach(function(c){if(c.star){var d=new a.Star(b.game);d.position.copyFrom(c.position),d.position.x+=2,b.world.add(d),b.stars.push(d)}})}),this.currentStar=this.stars[0],this.currentStar.show(!0)},c.prototype.setStars=function(){var a=this,b=0;this.splines.forEach(function(c){c.markers.forEach(function(d){if(d.star){var e=a.stars[b++];e&&(e.position.copyFrom(d.position),e.splinePoint=a.getNearestSplinePoint(e,c))}})})},c.prototype.getNearestSplinePoint=function(a,b){var c=Number.MAX_VALUE,d=null;return b.mediumPoints.forEach(function(b){var e=Phaser.Math.distanceSq(b.x,b.y,a.position.x,a.position.y);e-1&&(a=!1)),a},b}();a.GameConfigCreator=b}(game||(game={}));var game;!function(a){var b=function(){function b(a){this.storage=a}return b.prototype.getValue=function(a){return this.storage.getValue(a)},b.prototype.getBooleanValue=function(a){return"true"===this.storage.getValue(a)},b.prototype.getNumericValue=function(a){var b=this.storage.getValue(a);return parseFloat(b)||0},b.prototype.saveValue=function(a,b){this.storage.saveValue(a,b)},b.prototype.increase=function(a,b){void 0===b&&(b=1);var c=parseInt(this.storage.getValue(a)),d=c+b;this.saveValue(a,d)},b.prototype.changeNumericValue=function(a,b){var c=this.getNumericValue(a),d=c+b;return this.saveValue(a,d),d},b.prototype.getLetterSaveKey=function(b,c){return a.Main.language+"_"+c},b.prototype.getWordSaveKey=function(a,b,c){return a+"_"+b+"_"+c},b.prototype.isLetterComplete=function(a){return this.getBooleanValue(a)},b.BOOSTERS_WAS_SEEN="Boosters_Was_Seen",b.TUTORIAL_COMPLETE="Tutorial",b.COINS="Coins",b.ALL_TIME_COINS="All_Time_Coins",b.LANGUAGE="Language",b}();a.GameStats=b}(game||(game={}));var utils;!function(a){var b=function(){function a(){}return a.getCurrentHost=function(){return window.location&&window.location.hostname?window.location.hostname:null},a.isHostAllowed=function(b){var c=a.getCurrentHost();return!!c&&b.some(function(a){return c.indexOf(atob(a))>-1})},a.inIFrame=function(){try{return window.self!==window.top}catch(a){return!0}},a.openWindowWithImage=function(a,b){void 0===b&&(b="");var c=window.open();if(c){var d=new Image;d.src=a,c.document.title=b,c.document.body.appendChild(d),c.document.body.style.backgroundColor="black"}return c},a.getParam=function(a){var b=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),c=new RegExp("[\\?&]"+b+"=([^&#]*)"),d=c.exec(location.search);return null===d?"":decodeURIComponent(d[1].replace(/\+/g," "))},a.getParamInt=function(b,c){void 0===c&&(c=0);var d=a.getParam(b);return parseInt(d)||c},a.getParamFloat=function(b,c){void 0===c&&(c=0);var d=a.getParam(b);return parseFloat(d)||c},a.getParamBool=function(b,c){void 0===c&&(c="1");var d=a.getParam(b);return d&&d===c},a}();a.NetUtil=b}(utils||(utils={}));var game;!function(a){var b=function(a){function b(b,c,d){var e=a.call(this,b,c,"level_icon")||this;return e._locked=!1,e.text=null,e._letterKey=d,e.addBack(),e.addStars(),e}return __extends(b,a),Object.defineProperty(b.prototype,"locked",{get:function(){return this._locked},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"letterKey",{get:function(){return this._letterKey},enumerable:!0,configurable:!0}),b.prototype.addBack=function(){this.back=this.game.add.image(0,9,"choose_level","LetterIcon_Back_Unlocked0000",this),this.back.anchor.set(.5,.5),this.back.inputEnabled=!0,this.back.events.onInputDown.add(this.onInputDown,this),this.back.events.onInputUp.add(this.onInputUp,this)},b.prototype.onInputDown=function(){this.game.add.tween(this.scale).to({x:.9,y:.9},50,Phaser.Easing.Cubic.Out,!0),this.text&&this.game.add.tween(this.text.scale).to({x:.9,y:.9},50,Phaser.Easing.Cubic.Out,!0)},b.prototype.onInputUp=function(){this.game.tweens.removeFrom(this.scale),this.game.add.tween(this.scale).to({x:1,y:1},150,Phaser.Easing.Cubic.Out,!0),this.text&&(this.game.tweens.removeFrom(this.text.scale),this.game.add.tween(this.text.scale).to({x:1,y:1},150,Phaser.Easing.Cubic.Out,!0))},b.prototype.addStars=function(){this.stars=this.game.add.image(0,8,"choose_level","Stars0000",this),this.stars.anchor.set(.5,.5),this.stars.x=this.back.right,this.stars.visible=!1},b.prototype.setLocked=function(a){a?(this.back.input.enabled=!1,this.back.input.useHandCursor=!1,this.back.frameName="LetterIcon_Back_Locked0000"):(this.back.input.enabled=!0,this.back.input.useHandCursor=!0,this.back.frameName="LetterIcon_Back_Unlocked0000"),this._locked=a},b.prototype.setComplete=function(a){this.stars.visible=a},b.prototype.getWidth=function(){return this.back.width},b.prototype.getHeight=function(){return this.back.height},b.prototype.destroy=function(){a.prototype.destroy.call(this,!0,!1)},b}(Phaser.Group);a.LetterIcon=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,null,"letter_icons")||this;return d.letterKeys=c,d._onIconSelected=new Phaser.Signal,d.addIcons(),d.addTexts(),d}return __extends(c,b),Object.defineProperty(c.prototype,"onIconSelected",{get:function(){return this._onIconSelected},enumerable:!0,configurable:!0}),c.prototype.addIcons=function(){this.icons=[];for(var b=0,c=b,d=170,e=0,f=e,g=130,h=this.letterKeys.length,i=0;i=65&&c<=90){var d=String.fromCharCode(c).toLowerCase();a.Main.lettersConfig.keys.indexOf(d)>-1&&this.game.changeState("Level",d)}},c.prototype.onInputDown=function(b){if(!this.ignoreClick(b)){this.inputDown=!0,this.wasDragged=!1,this.clickedIcon=null,this.startDragX=this.letterlIcons.position.x,this.currentGroupIndex=Math.abs(Math.round(this.letterlIcons.position.x/a.Config.GAME_WIDTH)),this.currentGroupIndex=Phaser.Math.clamp(this.currentGroupIndex,0,this.letterlIcons.groupsNum-1),this.game.tweens.removeFrom(this.letterlIcons.position),this.letterlIcons.showAllPages();var c=this.game.input.activePointer.position,d=this.letterlIcons.getLetterIconUnderPoint(c.x,c.y);d&&(this.clickedIcon=d)}},c.prototype.ignoreClick=function(a){var b=this;return a.interactiveCandidates.some(function(a){return b.ignoreClickItems.indexOf(a.sprite)>-1})},c.prototype.onInputUp=function(){if(this.inputDown){if(this.inputDown=!1,this.wasDragged===!1&&this.clickedIcon)return this.game.sound.usingWebAudio&&this.game.cache.checkSoundKey("tap")&&this.game.sound.play("tap"),void this.game.changeState("Level",this.clickedIcon.letterKey);this.wasDragged&&this.onDragStop()}},c.prototype.onDragStop=function(){var b=this,c=this.game.input.activePointer.x/a.Config.WORLD_SCALE,d=this.game.input.activePointer.positionDown.x/a.Config.WORLD_SCALE,e=this.currentGroupIndex;d-c>0?this.currentGroupIndex0&&(e=this.currentGroupIndex-1);var f=e*a.Config.GAME_WIDTH*-1,g=Math.abs(f-this.letterlIcons.position.x);g=Math.max(300,g),this.game.add.tween(this.letterlIcons.position).to({x:f},g,Phaser.Easing.Cubic.Out,!0).onComplete.addOnce(function(){b.updatePaginator(),b.letterlIcons.hideOutOfScreenPages()})},c.prototype.resize=function(){this.resizeBackground(),this.alignTopControls(),this.alignIcons(),this.paginator.position.y=this.letterlIcons.position.y+this.letterlIcons.getHeight()+54},c.prototype.alignTopControls=function(){var b=.08*a.Config.GAME_HEIGHT;this.backButton.x=a.Config.GAME_WIDTH-60,this.backButton.y=b,this.soundButton.x=this.backButton.x-84,this.soundButton.y=b,this.switch.position.x=a.Config.HALF_GAME_WIDTH,this.switch.y=b},c.prototype.resizeBackground=function(){this.background.width=a.Config.GAME_WIDTH+1,this.background.height=a.Config.GAME_HEIGHT+1,this.bgItems.x=a.Config.HALF_GAME_WIDTH,this.bgItems.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.x=a.Config.HALF_GAME_WIDTH,this.bgVignette.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.width=1.4*a.Config.GAME_WIDTH,this.bgVignette.height=1.4*a.Config.GAME_HEIGHT},c.prototype.alignIcons=function(){var b=this.switch.y+32,c=a.Config.GAME_HEIGHT-b;this.letterlIcons.y=b+.47*(c-this.letterlIcons.getHeight())},c.prototype.playAnimation=function(){this.game.add.tween(this.switch).from({y:-50},600,Phaser.Easing.Back.Out,!0,200),this.game.add.tween(this.soundButton).from({alpha:0},200,Phaser.Easing.Cubic.Out,!0,260),this.game.add.tween(this.soundButton).from({y:"-50"},600,Phaser.Easing.Back.Out,!0,260),this.game.add.tween(this.backButton).from({alpha:0},200,Phaser.Easing.Cubic.Out,!0,320),this.game.add.tween(this.backButton).from({y:"-50"},600,Phaser.Easing.Back.Out,!0,320)},c.prototype.update=function(){this.inputDown&&(this.dragIcons(),this.updatePaginator())},c.prototype.dragIcons=function(){var b=1,c=(this.game.input.activePointer.x-this.game.input.activePointer.positionDown.x)*b,d=this.startDragX+c,e=50,f=-1*((this.letterlIcons.groupsNum-1)*a.Config.GAME_WIDTH)-e,g=0+e;d=Phaser.Math.clamp(d,f,g),this.letterlIcons.position.x=d, this.wasDragged===!1&&Math.abs(c)>10&&(this.wasDragged=!0)},c.prototype.updatePaginator=function(){var b=Math.round(-1*this.letterlIcons.position.x/a.Config.GAME_WIDTH);this.paginator.showPage(b)},c.prototype.shutdown=function(){this.ignoreClickItems=null,this.game.input.keyboard.onDownCallback=null,this.game.input.keyboard.callbackContext=null},c}(Phaser.State);a.ChooseLevelMenu=b}(game||(game={}));var game;!function(a){var b=function(b){function c(){return null!==b&&b.apply(this,arguments)||this}return __extends(c,b),c.prototype.create=function(){this.addBackground(),this.addFlags(),this.addTexts(),this.alignFlags(),this.addSelection(),this.addBackButton(),this.setLanguage(a.Main.language,!0),this.resize(),this.playAnimation()},c.prototype.addBackground=function(){this.background=this.game.add.image(0,0,"main_menu","BG0000"),this.background.anchor.set(.5,.5)},c.prototype.addFlags=function(){this.flagsGroup=this.game.add.group(this.world),this.flags=[];for(var b=[{lang:"en",text:"English"},{lang:"fr",text:"French"},{lang:"it",text:"Italian"},{lang:"es",text:"Spanish"},{lang:"pt",text:"Portuguese"}],c=0,d=c,e=250,f=0,g=f,h=210,i=0;ic){var d=c/b;this.scale.set(d,d)}},c.prototype.advanceLetter=function(){this.currentLetterIndex++,this.currentLetterIndex===this.word.length?this._onWordComplete.dispatch():this.currentLetter=this.word[this.currentLetterIndex]},c.prototype.getWidth=function(){return(_.last(this.tiles).x-this.tiles[0].x)*this.scale.x},c.prototype.getBottom=function(){return this.position.y+this.tiles[0].height*this.scale.y},c.prototype.getCurrentLetter=function(){return this.word[this.currentLetterIndex]},c.prototype.playStartTweens=function(a){var b=this;this.tiles.forEach(function(c){b.game.add.tween(c.position).from({y:"+25"},600,Phaser.Easing.Back.Out,!0,a),b.game.add.tween(c.scale).from({x:.5,y:.5},600,Phaser.Easing.Back.Out,!0,a),b.game.add.tween(c).from({alpha:0},200,Phaser.Easing.Cubic.Out,!0,a),a+=66})},c.prototype.destroy=function(){b.prototype.destroy.call(this,!0,!1),this.tiles=null,this._onWordComplete.dispose(),this._onWordComplete=null},c}(Phaser.Group);a.WordPlaceholder=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a){var c=b.call(this,a,null,"WorldLevelGUI")||this;return c.addButtons(),c.addLevelCompleteGUI(),c.resize(),c}return __extends(c,b),c.prototype.addButtons=function(){var b=this,c=100;this.menuButton=new a.SimpleButton(this.game,0,c,"word_level","Button_Home0000"),this.menuButton.x=a.Config.GAME_WIDTH-60,this.menuButton.callback.add(this.gotoChooseWordMenu,this),this.add(this.menuButton),this.soundButton=new a.ToggleButton(this.game,0,c,"word_level","Button_Sound_On0000","Button_Sound_Off0000"),this.soundButton.x=this.menuButton.x-84,this.soundButton.callback.add(function(){b.game.sound.mute=!b.game.sound.mute}),this.add(this.soundButton),this.hintButton=new a.SimpleButton(this.game,0,c,"word_level","Button_Hint0000"),this.hintButton.x=60,this.add(this.hintButton),this.buttons=[this.hintButton,this.soundButton,this.menuButton]},c.prototype.addLevelCompleteGUI=function(){this.levelCompleteGUI=new a.LevelCompleteGUI(this.game,this),this.levelCompleteGUI.position.x=a.Config.HALF_GAME_WIDTH,this.levelCompleteGUI.nextLevelButton.callback.addOnce(this.gotoNextWord,this),this.levelCompleteGUI.restartButton.callback.addOnce(this.restart,this),this.levelCompleteGUI.menuButton.callback.addOnce(this.gotoChooseWordMenu,this)},c.prototype.gotoNextWord=function(){var b=a.Main.lettersConfig.getNextLetter();b?this.game.changeState("WordLevel",b):this.game.changeState("ChooseWordMenu")},c.prototype.restart=function(){this.game.changeState("WordLevel",a.Main.lettersConfig.currentLetter)},c.prototype.gotoChooseWordMenu=function(){this.game.changeState("ChooseWordMenu")},c.prototype.hideButtons=function(){var a=this;this.buttons.forEach(function(b){b.disable(),a.game.add.tween(b).to({alpha:0},200,Phaser.Easing.Cubic.Out,!0,0).onComplete.addOnce(function(){b.visible=!1,b.exists=!1})})},c.prototype.resize=function(){this.alignButtons(),this.levelCompleteGUI.position.y=.8*a.Config.GAME_HEIGHT},c.prototype.alignButtons=function(){var a=55;this.menuButton.y=a,this.soundButton.y=a,this.hintButton.x=this.menuButton.x+2,this.hintButton.y=this.menuButton.y+88},c.prototype.destroy=function(){b.prototype.destroy.call(this,!0,!1)},c}(Phaser.Group);a.WorldLevelGUI=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c,d){var e=b.call(this,a,c,"letters_group")||this;return e.initLetters(d),e.addTiles(),e.alignRows(),e}return __extends(c,b),c.prototype.initLetters=function(a){this.word=a,this.letters=_.shuffle(a);for(var b=0;b<3;b++)this.letters=_.shuffle(this.letters)},c.prototype.addTiles=function(){if(this.tiles=[],this.rows=[],this.word.length>6){var a=this.addTilesRow(this.letters.slice(0,6)),b=this.addTilesRow(this.letters.slice(6,this.letters.length));b.position.y=a.position.y+90,this.rows.push(a,b)}else{var c=this.addTilesRow(this.letters);this.rows.push(c)}},c.prototype.addTilesRow=function(b){for(var c=this.game.add.group(this),d=0,e=86,f=b.length,g=0;g.76&&b.game.add.tween(d.position).to({y:d.position.y+-35},1200,Phaser.Easing.Back.InOut,!0,c);var e=a.Config.ASPECT_RATIO>.76?1200+c:c;b.game.time.events.add(e,function(){b.game.add.tween(d.position).to({y:"-15"},700,Phaser.Easing.Sinusoidal.InOut,!0,0,1e3,!0),b.game.add.tween(d.scale).to({x:1.25*d.scale.x,y:1.25*d.scale.y},250,Phaser.Easing.Sinusoidal.InOut,!0,0,1e3,!0).repeatDelay(2e3)},b),c+=100})},c.prototype.highlightTiles=function(){var a=this;this.game.sound.play("tiles_collected_1",.5),this.sortTilesByX();var b=0;this.tiles.forEach(function(c){a.game.tweens.removeFrom(c.scale),a.game.tweens.removeFrom(c.position),a.game.add.tween(c.position).to({y:"-22"},350,Phaser.Easing.Sinusoidal.InOut,!0,b,0,!0),a.game.add.tween(c.scale).to({x:1.25*c.scale.x,y:1.25*c.scale.y},350,Phaser.Easing.Sinusoidal.InOut,!0,b,0,!0),a.game.time.events.add(b,c.showWhiteFX,c,1500),b+=50})},c.prototype.resize=function(b,c){var d=_.last(this.rows).position.y-this.rows[0].position.y,e=a.Config.GAME_HEIGHT-c.getBottom(),f=c.getBottom()+.5*(e-d);this.position.y=f-10;for(var g=this.tiles.length,h=0;h.76&&this.game.add.tween(this.position).to({y:this.position.y-35},800,Phaser.Easing.Back.InOut,!0,300)},c.prototype.getBottom=function(){return this.position.y+.5*this.picture.height},c.prototype.playStartTweens=function(){this.game.add.tween(this.position).from({y:"+50"},1e3,Phaser.Easing.Back.Out,!0),this.game.add.tween(this.scale).from({x:.5,y:.5},1e3,Phaser.Easing.Back.Out,!0),this.game.add.tween(this).from({alpha:0},200,Phaser.Easing.Cubic.Out,!0)},c.prototype.destroy=function(){b.prototype.destroy.call(this,!0,!1)},c}(Phaser.Group);a.WordPicture=b}(game||(game={}));var game;!function(a){var b=function(a){function b(b){var c=a.call(this,b,null,"Glow_Burst")||this;return c.initParticles(),c.calculateOffsets(),c}return __extends(b,a),b.prototype.initParticles=function(){this.particles=[];for(var a=0;a<66;a++){var b=this.game.add.image(0,0,"word_level","GlowParticle0000",this);b.anchor.set(.5,.5),this.particles.push(b)}},b.prototype.calculateOffsets=function(){this.offsets=[];for(var a=Phaser.ArrayUtils.numberArrayStep(0,2*Math.PI,2*Math.PI/this.particles.length),b=0;b-1?a.split(" ").join(""):a},c.prototype.create=function(){this.addBackground(),this.addParticleBurst(),this.addPicture(),this.addWordPlaceholder(),this.addLetters(),this.addGUI(),this.addTutorial(),this.addConfetti(),this.addWhiteOverlay(),this.playWordSound(),this.resize(),this.playStartTweens(),this.game.input.keyboard.addKey(Phaser.Keyboard.A).onDown.add(this.applyHint,this),a.Main.mainMusicLoop&&a.Main.mainMusicLoop.fadeTo(500,.15)},c.prototype.testConfetti=function(){this.confetti.show()},c.prototype.completeWord=function(){for(var a=0,b=this.word.length,c=0;c.5&&this.game.sound.play("cheers",.5)},c.prototype.showWhiteOverlay=function(){this.whiteOverlay.exists=!0,this.whiteOverlay.visible=!0,this.game.add.tween(this.whiteOverlay).to({alpha:.44},800,Phaser.Easing.Cubic.In,!0),this.game.add.tween(this.whiteOverlay.scale).to({x:1.5*this.whiteOverlay.scale.x,y:1.5*this.whiteOverlay.scale.y},800,Phaser.Easing.Back.Out,!0)},c.prototype.showConfetti=function(){this.confetti&&this.confetti.show(),this.particleBurst&&(this.particleBurst.position.x=this.picture.position.x+this.picture.raysOffset.x,this.particleBurst.position.y=this.picture.position.y+this.picture.raysOffset.y,this.particleBurst.show())},c.prototype.addGUI=function(){this.gui=new a.WorldLevelGUI(this.game),this.gui.hintButton.callback.add(this.onHintClick,this),this.world.add(this.gui)},c.prototype.onHintClick=function(a){a.disable(),this.game.time.events.add(1e3,function(){a.enable()},this),this.applyHint()},c.prototype.applyHint=function(){var a=this,b=_.find(this.letters.tiles,function(b){return b.inPlace===!1&&b.letter===a.wordPlaceholder.getCurrentLetter()});b&&(this.moveLetterToWord(b),this.wordPlaceholder.advanceLetter())},c.prototype.addTutorial=function(){var b=this,c=0===a.Main.lettersConfig.keys.indexOf(this.letterID);a.Main.stats.getBooleanValue("tutorial_word");c&&(this.tutorHand=new a.Hand(this.game),this.world.add(this.tutorHand),this.game.time.events.add(1e3,function(){var c=b.letters.getLetterTile(b.word[0]),d=c.worldPosition.clone();d.x/=a.Config.WORLD_SCALE,d.y/=a.Config.WORLD_SCALE,b.tutorHand.position.set(d.x-25,d.y-11),b.tutorHand.showTap()},this))},c.prototype.completeTutorial=function(){this.tutorHand&&(a.Main.stats.saveValue("tutorial_word",!0),this.tutorHand.destroy(),this.tutorHand=null)},c.prototype.addConfetti=function(){a.Main.weakDevice===!1&&(this.confetti=new a.Confetti(this.game),this.world.add(this.confetti))},c.prototype.addWhiteOverlay=function(){var a=this;this.whiteOverlay=this.game.add.image(0,0,"word_level","WhiteOverlay0000"),this.whiteOverlay.anchor.set(.5,.5),this.game.time.events.add(100,function(){a.whiteOverlay.exists=!1,a.whiteOverlay.visible=!1},this)},c.prototype.resize=function(){this.resizeBackground(),this.alignSprites(),this.gui.resize(),this.resizeWhiteOverlay()},c.prototype.resizeBackground=function(){this.bg.width=a.Config.GAME_WIDTH,this.bg.height=a.Config.GAME_HEIGHT,this.bgItems.x=a.Config.HALF_GAME_WIDTH,this.bgItems.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.x=a.Config.HALF_GAME_WIDTH,this.bgVignette.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.width=1.4*a.Config.GAME_WIDTH,this.bgVignette.height=1.4*a.Config.GAME_HEIGHT},c.prototype.alignSprites=function(){this.picture.y=.33*a.Config.GAME_HEIGHT,this.wordPlaceholder.position.y=this.picture.getBottom()+90,this.letters.resize(this.picture,this.wordPlaceholder)},c.prototype.resizeWhiteOverlay=function(){this.whiteOverlay.width=1.4*a.Config.GAME_WIDTH,this.whiteOverlay.height=1.4*a.Config.GAME_HEIGHT,this.whiteOverlay.x=a.Config.HALF_GAME_WIDTH,this.whiteOverlay.y=a.Config.HALF_GAME_HEIGHT},c.prototype.playStartTweens=function(){},c.prototype.shutdown=function(){},c.prototype.playWordSound=function(){var b=this;this.game.time.events.add(800,function(){a.Main.wordsSounds.play(b.letterID+"_word")},this)},c}(Phaser.State);a.WordLevel=b}(game||(game={}));var game;!function(a){var b=function(a){function b(b,c,d){var e=a.call(this,b,c,"letter_tile_"+d)||this;return e._onBoard=!1,e.dragging=!1,e._letter=d,e.onClick=new Phaser.Signal,e.onDragStart=new Phaser.Signal,e.onDragStop=new Phaser.Signal,e.addBack(),e.addLetterText(),e}return __extends(b,a),Object.defineProperty(b.prototype,"letter",{get:function(){return this._letter},enumerable:!0,configurable:!0}),b.prototype.addBack=function(){this.back=this.game.add.image(0,0,"free_zone","LetterTile_Back0000",this),this.back.anchor.set(.5,.5),this.back.inputEnabled=!0,this.back.input.useHandCursor=!0,this.back.events.onInputDown.add(this.onInputDown,this),this.back.events.onInputUp.add(this.onInputUp,this)},b.prototype.onInputDown=function(){this.onClick.dispatch(this)},b.prototype.onInputUp=function(){this._onBoard===!1&&(this.dragging=!1,this.onDragStop.dispatch(this))},b.prototype.addLetterText=function(){var a="Letter_"+this.letter.toUpperCase()+"0000";this.letterImage=this.game.add.image(0,0,"free_zone",a,this),this.letterImage.anchor.set(.5,.5),this.letterImage.x=-1.5,this.letterImage.y=-5.5},b.prototype.update=function(){if(a.prototype.update.call(this),this._onBoard===!1&&this.dragging){var b=this.game.input.activePointer.position;this.position.copyFrom(b)}},b.prototype.drop=function(a){void 0===a&&(a=!0),a&&(this.game.tweens.removeFrom(this.scale),this.game.add.tween(this.scale).to({x:1,y:1},150,Phaser.Easing.Cubic.Out,!0)),this.letterImage.frameName="Letter_"+this.letter.toUpperCase()+"0002"},b.prototype.showOnlyLetter=function(){this.back.alpha=0,this.letterImage.frameName="Letter_"+this.letter.toUpperCase()+"0001"},b.prototype.startDrag=function(){this.game.tweens.removeFrom(this.scale),this.game.add.tween(this.scale).to({x:1.2,y:1.2},400,Phaser.Easing.Back.Out,!0),this.letterImage.frameName="Letter_"+this.letter.toUpperCase()+"0001"},b.prototype.destroy=function(){a.prototype.destroy.call(this,!0,!1),this.onClick.dispose(),this.onClick=null,this.onDragStart.dispose(),this.onDragStart=null,this.onDragStop.dispose(),this.onDragStop=null},b}(Phaser.Group);a.FZLetterTile=b}(game||(game={}));var game;!function(a){var b=function(b){function c(a,c){var d=b.call(this,a,null,"letters_group")||this;return d.onTileClicked=new Phaser.Signal,d.alphabet=c,d.addLetters(),d.addArrowButtons(),d.updateArrows(),d}return __extends(c,b),c.prototype.addLetters=function(){this.tiles=[],this.groups=[];for(var a=15,b=Math.ceil(this.alphabet.length/a),c=0;c-1&&this.droppedTiles.splice(b,1),this.game.time.events.add(100,this.showBoardBorderFX,this),this.game.add.tween(this.draggedTile).to({y:"-20"},300,Phaser.Easing.Cubic.Out,!0),this.game.add.tween(this.draggedTile).to({alpha:0},300,Phaser.Easing.Linear.None,!0).onComplete.addOnce(function(a){a.destroy()})},c.prototype.startDrag=function(a){this.draggedTile=a,this.draggedTile.startDrag(),this.world.add(this.draggedTile)},c.prototype.initAlphabet=function(){this.alphabet=a.Main.lettersConfig.keys.slice(),this.alphabet.push(".",",","!","?")},c.prototype.addBackground=function(){this.background=this.game.add.image(-1,-1,"backgrounds_1","BG_Blue0000"),this.background.anchor.set(.5,.5),this.bgItems=this.game.add.image(0,0,"backgrounds_1","_Items0000"),this.bgItems.anchor.set(.5,.5),this.bgItems.x=a.Config.HALF_GAME_WIDTH},c.prototype.addBoard=function(){var b=this;this.board=this.game.add.image(0,0,"free_zone","Board0000"),this.board.anchor.set(.5,.5),this.board.x=a.Config.HALF_GAME_WIDTH,this.boardBorder=this.game.add.image(0,0,"free_zone","Board_Border0000"),this.boardBorder.anchor.set(.5,.5),this.boardBorder.x=a.Config.HALF_GAME_WIDTH-1,this.game.time.events.add(100,function(){b.boardBorder.visible=!1},this)},c.prototype.addDrawingBoard=function(){var b=this.getDrawingBoardTexture();this.drawingBoard=new a.DrawingBoard(this.game,b),this.drawingBoard.onFirstDraw.addOnce(this.completeTutorial,this),this.drawingBoard.drawingEnabled=a.Main.isAmazonFire()===!1,this.world.add(this.drawingBoard),this.drawingBoardBorder=this.game.add.image(0,0,"free_zone","Board_Border0000"),this.drawingBoardBorder.anchor.set(.5,.5),this.drawingBoardBorder.x=a.Config.HALF_GAME_WIDTH-1,this.drawingBoardBorder.tint=12574702},c.prototype.getDrawingBoardTexture=function(){var a=9,b=this.boardBorder.width-a,c=this.boardBorder.height-a,d="drawing_board",e=this.game.cache.checkBitmapDataKey(d)?this.game.cache.getBitmapData(d):utils.DrawUtil.createRectTexture(this.game,b,c,"#ff0000",d);return e.clear(),e},c.prototype.addDropZones=function(){this.dropZone_2=this.game.add.image(0,0,"free_zone","Dropzone_Outer0000"),this.dropZone_2.anchor.set(.5,.5),this.dropZone_2.x=a.Config.HALF_GAME_WIDTH,this.dropZone_2.width=560,this.dropZone_2.height=400,this.dropZone_2.alpha=.25,this.dropZone_2.alpha=0,this.dropZone_1=this.game.add.image(0,0,"free_zone","Dropzone_Inner0000"),this.dropZone_1.anchor.set(.5,.5),this.dropZone_1.x=a.Config.HALF_GAME_WIDTH,this.dropZone_1.width=470,this.dropZone_1.height=320,this.dropZone_1.alpha=.5,this.dropZone_1.alpha=0},c.prototype.addDropLayer=function(){this.droppedTilesLayer=this.game.add.group()},c.prototype.addBoardButtons=function(){var b=.15*this.board.width;this.clearButton=new a.SimpleButton(this.game,0,0,"free_zone","Clear_Button0000"),this.clearButton.x=this.board.left+b,this.clearButton.callback.add(this.clearBoard,this),this.world.add(this.clearButton),this.drawingModeButton=new a.ToggleButton(this.game,0,0,"free_zone","DrawingMode_Button0000","DrawingMode_Button0001"),this.drawingModeButton.anchor.set(.5,.5),this.drawingModeButton.x=this.board.right-2*b,this.drawingModeButton.callback.add(this.toggleDrawingMode,this),this.drawingModeButton.visible=this.drawingBoard.drawingEnabled,this.world.add(this.drawingModeButton),this.photoButton=this.game.add.image(0,0,"free_zone","Save_Button0000"),this.photoButton.anchor.set(.5,.5),this.photoButton.x=this.board.right-b,this.photoButton.inputEnabled=!0,this.photoButton.input.useHandCursor=!0,this.photoButton.events.onInputDown.add(this.onPhotoButtonClick,this)},c.prototype.clearBoard=function(){(this.droppedTiles.length>0||this.drawingBoard.isDirty())&&this.game.sound.play("erase",.25),this.drawingBoard.clear(),this.clearTiles()},c.prototype.clearTiles=function(){var a=this,b=0;this.droppedTiles.forEach(function(c){a.game.add.tween(c.scale).to({x:.5,y:.5},400,Phaser.Easing.Back.In,!0,b),a.game.add.tween(c).to({x:a.clearButton.x,y:a.clearButton.y},400,Phaser.Easing.Back.In,!0,b).onComplete.addOnce(function(a){a.destroy()}),b+=66}),this.droppedTiles.length=0},c.prototype.toggleDrawingMode=function(){this.drawingBoard.toggleModes()},c.prototype.addLetters=function(){this.letters=new a.FZLettersGroup(this.game,this.alphabet),this.letters.position.x=a.Config.HALF_GAME_WIDTH+2,this.letters.onTileClicked.add(this.onTileClick,this),this.world.add(this.letters)},c.prototype.onTileClick=function(b){this.game.sound.play("pop_2",.5);var c=this.game.input.activePointer.position.clone(),d=new a.FZLetterTile(this.game,this.world,b.letter);d.position.copyFrom(c),d.scale.set(0,0),d.showOnlyLetter(),this.game.add.tween(d.scale).to({x:1.2,y:1.2},400,Phaser.Easing.Back.Out,!0),this.draggedTile=d},c.prototype.addTutorial=function(){var b=this;a.Main.stats.getBooleanValue("tutorial_free_zone");this.tutorHand=new a.Hand(this.game),this.world.add(this.tutorHand),this.game.time.events.add(1e3,function(){if(b.tutorHand&&b.tutorHand.exists){var a=b.getTutorialPath();b.tutorHand.followPath(a)}},this)},c.prototype.getTutorialPath=function(){var b=this.letters.getFirstTile(),c=b.worldPosition.clone(),d=new Phaser.Point(c.x,c.y);d.x/=a.Config.WORLD_SCALE,d.y/=a.Config.WORLD_SCALE;var e=new Phaser.Point(this.board.x,this.board.y),f=[d,e];return f.forEach(function(a){a.x-=25,a.y-=11}),f},c.prototype.completeTutorial=function(){this.tutorHand&&(a.Main.stats.saveValue("tutorial_free_zone",!0),this.tutorHand.destroy(),this.tutorHand=null)},c.prototype.addPhoto=function(){this.photo=new a.Photo(this.game,this.world),this.photo.position.x=a.Config.HALF_GAME_WIDTH},c.prototype.addCompleteGUI=function(){this.completeGUI=new a.FZCompleteGUI(this.game,this.world),this.completeGUI.position.x=a.Config.HALF_GAME_WIDTH,this.completeGUI.saveButton.events.onInputDown.add(this.savePhoto,this),this.completeGUI.editButton.callback.add(this.edit,this)},c.prototype.savePhoto=function(){this.completeGUI.saveButton.disable(),this.completeGUI.saveButton.alpha=.6,this.photo.savePhoto(),this.photo.dataURL?(this.saveToAzoomee(this.photo.dataBase64),this.toast.show()):this.completeGUI.showHint()},c.prototype.saveToAzoomee=function(a){parent.postMessage({method:"saveImage",responseID:this.game.rnd.uuid().toString(),imageData:a},"*")},c.prototype.addToast=function(){this.toast=new a.Toast(this.game,this.world),this.toast.kill()},c.prototype.edit=function(){this.photo.hide(),this.completeGUI.hide(),this.toast.forceHide(),this.game.time.events.add(500,this.showAll,this),this.game.time.events.add(600,this.showLetters,this)},c.prototype.showAll=function(){var a=this;[this.slideMenu,this.board,this.clearButton,this.photoButton,this.letters,this.drawingBoard,this.drawingBoardBorder].forEach(function(b){b.visible=!0,a.game.add.tween(b).from({alpha:0},300,Phaser.Easing.Linear.None,!0,0)})},c.prototype.showLetters=function(){var a=this;this.droppedTiles.forEach(function(b){b.visible=!0,a.game.add.tween(b).from({alpha:0},100,Phaser.Easing.Linear.None,!0)})},c.prototype.addFlash=function(){var a=utils.DrawUtil.createRectTexture(this.game,2,2,"#FFFFFF","white_rect");this.flash=this.game.add.image(0,0,a,null,this.world),this.flash.exists=!1,this.flash.visible=!1},c.prototype.addSlideMenu=function(){this.slideMenu=new a.SlideMenu(this.game,this.world),this.slideMenu.position.x=a.Config.GAME_WIDTH-100,this.slideMenu.position.y=-246},c.prototype.initKeyCallbacks=function(){this.game.input.keyboard.addKey(Phaser.Keyboard.P).onDown.add(this.onPhotoButtonClick,this)},c.prototype.onPhotoButtonClick=function(){this.completeTutorial(),this.game.sound.play("photo",.75),this.showFlash(),this.game.time.events.add(1200,this.showPhoto,this),this.game.time.events.add(2400,this.showCompleteGUI,this)},c.prototype.showFlash=function(){var a=this;this.flash.exists=!0,this.flash.visible=!0,this.flash.alpha=0,this.game.add.tween(this.flash).to({alpha:1},66,Phaser.Easing.Linear.None,!0).onComplete.addOnce(function(){a.hideAll(),a.game.add.tween(a.flash).to({alpha:0},1e3,Phaser.Easing.Cubic.In,!0).onComplete.addOnce(function(){a.flash.exists=!1,a.flash.visible=!1})})},c.prototype.hideAll=function(){this.board.visible=!1,this.clearButton.visible=!1,this.photoButton.visible=!1,this.letters.visible=!1,this.slideMenu.visible=!1,this.drawingBoard.visible=!1,this.drawingBoardBorder.visible=!1,this.droppedTiles.forEach(function(a){a.visible=!1})},c.prototype.showPhoto=function(){this.photo.clear(),this.photo.addLetters(this.board,this.droppedTiles),this.photo.addDrawing(this.drawingBoard),this.photo.show()},c.prototype.showCompleteGUI=function(){this.completeGUI.saveButton.enable(),this.completeGUI.saveButton.alpha=1,this.completeGUI.show()},c.prototype.showBoardBorderFX=function(){var a=this;this.boardBorder.visible=!0,this.boardBorder.exists=!0,this.tweens.removeFrom(this.boardBorder.scale),this.tweens.removeFrom(this.boardBorder),this.boardBorder.scale.set(1.1,1.1),this.boardBorder.alpha=.33,this.game.add.tween(this.boardBorder.scale).to({x:1,y:1},400,Phaser.Easing.Cubic.Out,!0),this.game.add.tween(this.boardBorder).to({alpha:1},400,Phaser.Easing.Cubic.In,!0).onComplete.addOnce(function(){a.game.add.tween(a.boardBorder).to({alpha:0},200,Phaser.Easing.Linear.None,!0).onComplete.addOnce(function(){a.boardBorder.visible=!1,a.boardBorder.exists=!1})})},c.prototype.showBoardBorderFX2=function(){var a=this;this.boardBorder.visible=!0,this.boardBorder.exists=!0,this.tweens.removeFrom(this.boardBorder),this.boardBorder.alpha=0,this.boardBorder.scale.set(.9,.9),this.game.add.tween(this.boardBorder.scale).to({x:1,y:1},1e3,Phaser.Easing.Cubic.Out,!0),this.game.add.tween(this.boardBorder).to({alpha:.2},100,Phaser.Easing.Cubic.Out,!0).onComplete.addOnce(function(){a.game.add.tween(a.boardBorder).to({alpha:0},1e3,Phaser.Easing.Cubic.Out,!0).onComplete.addOnce(function(){a.boardBorder.visible=!1,a.boardBorder.exists=!1})})},c.prototype.update=function(){this.draggedTile&&(this.draggedTile.position.x=this.game.input.activePointer.x/a.Config.WORLD_SCALE+this.dragOffset.x,this.draggedTile.position.y=this.game.input.activePointer.y/a.Config.WORLD_SCALE+this.dragOffset.y)},c.prototype.resize=function(){this.resizeBackground(),this.flash.width=a.Config.GAME_WIDTH,this.flash.height=a.Config.GAME_HEIGHT,this.board.y=.3*a.Config.GAME_HEIGHT,this.boardBorder.y=this.board.y-7,this.dropZone_1.y=this.board.y-6,this.dropZone_2.y=this.board.y-6,this.drawingBoard.alignIn(this.boardBorder,Phaser.CENTER),this.drawingBoardBorder.y=this.boardBorder.y;var b=this.board.bottom-28;this.clearButton.y=b,this.drawingModeButton.y=b,this.photoButton.y=b;var c=this.board.bottom-8,d=a.Config.GAME_HEIGHT-c,e=c+.5*(d-this.letters.getHeight());this.letters.position.y=e,this.photo.position.y=.4*a.Config.GAME_HEIGHT,this.completeGUI.position.y=.84*a.Config.GAME_HEIGHT,this.toast.resize()},c.prototype.resizeBackground=function(){this.background.width=1.05*a.Config.GAME_WIDTH,this.background.height=1.05*a.Config.GAME_HEIGHT,this.background.x=a.Config.HALF_GAME_WIDTH,this.background.y=a.Config.HALF_GAME_HEIGHT,this.bgItems.y=a.Config.HALF_GAME_HEIGHT},c.prototype.addRandomLettersOnBoard=function(){var b=(this.board.getBounds(),new Phaser.Rectangle(this.board.left,this.board.top,this.board.width,this.board.height));b.inflate(-60,-60),b.y-=8;for(var c=10,d=0;d-1})},c.prototype.onInputUp=function(){if(this.inputDown){if(this.inputDown=!1,this.wasDragged===!1&&this.clickedPicture&&this.clickedPicture)return this.game.input.onDown.remove(this.onInputDown,this),this.game.input.onUp.remove(this.onInputUp,this),void this.onPictureClick(this.clickedPicture);this.onDragStop()}},c.prototype.getPictureUnderPoint=function(a,b){for(var c=this.pictures.length,d=0;d=65&&c<=90){var d=String.fromCharCode(c).toLowerCase();a.Main.lettersConfig.keys.indexOf(d)>-1&&this.game.changeState("WordLevel",d)}},c.prototype.update=function(){this.inputDown&&this.dragPictures(),this.updateView&&this.updatePicturesView()},c.prototype.dragPictures=function(){var b=this.game.input.activePointer,c=b.x/a.Config.WORLD_SCALE,d=b.positionDown.x/a.Config.WORLD_SCALE,e=1.66,f=(c-d)*e,g=this.startDragX+f,h=-1*((this.pictures.length-1)*a.Config.HALF_GAME_WIDTH)+.33*a.Config.GAME_WIDTH;g=Phaser.Math.clamp(g,h,.66*a.Config.GAME_WIDTH),this.picturesGroup.position.x=g,this.wasDragged===!1&&Math.abs(f)>10&&(this.wasDragged=!0)},c.prototype.updatePicturesView=function(){for(var b=this.picturesGroup.position.x,c=this.pictures.length,d=0;da.Config.HALF_GAME_WIDTH+100)e.visible=!1,e.lock&&(e.lock.visible=!1);else{e.visible=!0;var i=1-h/(a.Config.HALF_GAME_WIDTH+300);e.scale.set(i,i),e.position.y=h/(a.Config.HALF_GAME_WIDTH+300)*150,e.angle=g/(a.Config.HALF_GAME_WIDTH+300)*40*-1,e.lock&&(e.lock.visible=!0,e.lock.scale.set(i,i),e.lock.position.copyFrom(e.position),e.lock.angle=e.angle)}}},c.prototype.scrollToLastUnlocked=function(){var b=_.findLast(this.pictures,function(a){return a.locked===!1});if(b){var c=-b.position.x+a.Config.HALF_GAME_WIDTH;this.picturesGroup.position.x=c}},c.prototype.resize=function(){this.resizeBackground(),this.alignTopControls(),this.picturesGroup.y=.47*a.Config.GAME_HEIGHT,this.sandboxButton.position.y=.88*a.Config.GAME_HEIGHT},c.prototype.resizeBackground=function(){this.bg.width=1.05*a.Config.GAME_WIDTH,this.bg.height=1.05*a.Config.GAME_HEIGHT,this.bg.x=a.Config.HALF_GAME_WIDTH,this.bg.y=a.Config.HALF_GAME_HEIGHT,this.bgItems.x=a.Config.HALF_GAME_WIDTH,this.bgItems.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.x=a.Config.HALF_GAME_WIDTH,this.bgVignette.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.width=1.4*a.Config.GAME_WIDTH,this.bgVignette.height=1.4*a.Config.GAME_HEIGHT},c.prototype.alignTopControls=function(){var b=.08*a.Config.GAME_HEIGHT;this.backButton.x=a.Config.GAME_WIDTH-60,this.backButton.y=b,this.soundButton.x=this.backButton.x-84,this.soundButton.y=b,this.switch.position.x=a.Config.HALF_GAME_WIDTH,this.switch.y=b},c.prototype.playAnimation=function(){this.game.add.tween(this.switch).from({y:-50},600,Phaser.Easing.Back.Out,!0,200),this.game.add.tween(this.soundButton).from({alpha:0},200,Phaser.Easing.Cubic.Out,!0,260),this.game.add.tween(this.soundButton).from({y:"-50"},600,Phaser.Easing.Back.Out,!0,260),this.game.add.tween(this.backButton).from({alpha:0},200,Phaser.Easing.Cubic.Out,!0,320),this.game.add.tween(this.backButton).from({y:"-50"},600,Phaser.Easing.Back.Out,!0,320),this.game.add.tween(this.sandboxButton.position).from({y:"+60"},600,Phaser.Easing.Back.Out,!0,540),this.game.add.tween(this.sandboxButton).from({alpha:0},300,Phaser.Easing.Cubic.Out,!0,540)},c.prototype.shutdown=function(){this.pictures=null},c}(Phaser.State);a.ChooseWordMenu=b}(game||(game={}));var game;!function(a){var b=function(b){function c(){var a=null!==b&&b.apply(this,arguments)||this;return a.inputDown=!1,a.startDragX=0,a.wasDragged=!1,a.clickedIcon=null,a}return __extends(c,b),c.prototype.init=function(){this.inputDown=!1,this.startDragX=0,this.wasDragged=!1,this.clickedIcon=null},c.prototype.create=function(){this.addBackground(),this.addTitle(),this.addIcons(),this.addPaginator(),this.addButtons(),this.addSwitch(),this.initInput(),this.world.bringToTop(this.letterlIcons),this.resize()},c.prototype.onKeyDown=function(a){var b=a.keyCode;if(b>=65&&b<=90){var c=String.fromCharCode(b);this.game.changeState("Level",c.toLowerCase())}},c.prototype.addBackground=function(){this.background=this.game.add.image(0,0,"backgrounds_1","BG_Orange0000"),this.bgItems=this.game.add.image(0,0,"backgrounds_1","_Items0000"),this.bgItems.anchor.set(.5,.5),this.bgVignette=this.game.add.image(0,0,"backgrounds_1","_Vignette0000"),this.bgVignette.anchor.set(.5,.5)},c.prototype.addTitle=function(){var b={font:"66px "+a.Main.fontFamily,fill:"#FFFFFF",align:"center"},c="["+a.Main.language.toUpperCase()+"]";this.title=this.game.add.text(0,0,c,b),this.title.anchor.set(.5,.5),this.title.x=a.Config.HALF_GAME_WIDTH,this.title.setShadow(0,3,"rgba(0,0,0,0.15)",0),this.title.lineSpacing=-10},c.prototype.addIcons=function(){this.letterlIcons=new a.LetterIcons(this.game,this.world),this.letterlIcons.hideOutOfScreenPages()},c.prototype.addPaginator=function(){this.paginator=new a.Paginator(this.game,this.letterlIcons.groupsNum),this.paginator.x=.5*(a.Config.GAME_WIDTH-this.paginator.getWidth())+18,this.world.add(this.paginator)},c.prototype.addButtons=function(){this.backButton=new a.SimpleButton(this.game,0,0,"choose_level","Button_Home0000"),this.backButton.x=60,this.backButton.callback.addOnce(this.gotoMainMenu,this),this.world.add(this.backButton)},c.prototype.gotoMainMenu=function(){this.game.changeState("MainMenu",!1)},c.prototype.addSwitch=function(){this.switch=new a.Switch(this.game,""),this.switch.position.x=a.Config.GAME_WIDTH-.5*this.switch.width-40,this.switch.allowMultipleSwitches=!0,this.switch.switchTo("letter",!1,!1),this.world.add(this.switch),this.game.device.desktop&&(this.switch.visible=!1,this.switch.exists=!1)},c.prototype.initInput=function(){this.game.device.desktop&&(this.game.input.keyboard.onDownCallback=this.onKeyDown,this.game.input.keyboard.callbackContext=this),this.game.input.onDown.add(this.onInputDown,this),this.game.input.onUp.add(this.onInputUp,this)},c.prototype.onInputDown=function(a){if(!(a.interactiveCandidates.map(function(a){return a.sprite}).indexOf(this.backButton)>-1)){this.inputDown=!0,this.wasDragged=!1,this.clickedIcon=null,this.startDragX=this.letterlIcons.position.x,this.letterlIcons.showAllPages();var b=this.game.input.activePointer.position,c=this.letterlIcons.getLetterIconUnderPoint(b.x,b.y);c&&(this.clickedIcon=c)}},c.prototype.onInputUp=function(){this.inputDown=!1,this.onDragStop(),this.wasDragged===!1&&this.clickedIcon&&this.playSound(this.clickedIcon.letterKey)},c.prototype.onDragStop=function(){var b=this,c=Math.round(this.letterlIcons.position.x/a.Config.GAME_WIDTH);c=Phaser.Math.clamp(c,-this.letterlIcons.groupsNum,0);var d=c*a.Config.GAME_WIDTH;this.game.add.tween(this.letterlIcons.position).to({x:d},300,Phaser.Easing.Cubic.Out,!0).onComplete.addOnce(function(){b.letterlIcons.hideOutOfScreenPages()})},c.prototype.playSound=function(b){var c;if(c=this.game.device.desktop?this.game.input.keyboard.isDown(Phaser.Keyboard.SHIFT)?b+"_word":b:"letter"===this.switch.state?b:b+"_word",c&&a.Main.wordsSounds.markers.hasOwnProperty(c)){if(c.indexOf("_word")>-1){a.Main.lettersConfig.getLetterConfig(b).picture.word}a.Main.wordsSounds.play(c)}},c.prototype.resize=function(){this.resizeBackground(),this.backButton.y=.08*a.Config.GAME_HEIGHT,this.title.y=this.backButton.y,this.switch.position.y=this.backButton.y,this.alignIcons(),this.paginator.position.y=this.letterlIcons.position.y+this.letterlIcons.getHeight()+54},c.prototype.resizeBackground=function(){this.background.width=a.Config.GAME_WIDTH+1,this.background.height=a.Config.GAME_HEIGHT+1,this.bgItems.x=a.Config.HALF_GAME_WIDTH,this.bgItems.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.x=a.Config.HALF_GAME_WIDTH,this.bgVignette.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.width=1.4*a.Config.GAME_WIDTH,this.bgVignette.height=1.4*a.Config.GAME_HEIGHT},c.prototype.alignIcons=function(){var b=66,c=a.Config.GAME_HEIGHT-b;this.letterlIcons.y=b+.47*(c-this.letterlIcons.getHeight())},c.prototype.update=function(){this.inputDown&&(this.dragIcons(),this.updatePaginator())},c.prototype.dragIcons=function(){var b=1.4,c=(this.game.input.activePointer.x-this.game.input.activePointer.positionDown.x)*b,d=this.startDragX+c,e=50,f=-1*((this.letterlIcons.groupsNum-1)*a.Config.GAME_WIDTH)-e,g=0+e;d=Phaser.Math.clamp(d,f,g),this.letterlIcons.position.x=d,this.wasDragged===!1&&Math.abs(c)>10&&(this.wasDragged=!0)},c.prototype.updatePaginator=function(){var b=Math.round(-1*this.letterlIcons.position.x/a.Config.GAME_WIDTH);this.paginator.showPage(b)},c.prototype.shutdown=function(){this.game.input.keyboard.onDownCallback=null,this.game.input.keyboard.callbackContext=null},c}(Phaser.State);a.SoundsTest=b}(game||(game={}));var game;!function(a){var b=function(a){function b(b){var c=a.call(this,b,null,"present")||this;return c.onClick=new Phaser.Signal,c.onHide=new Phaser.Signal,c.addPicture(),c}return __extends(b,a),b.prototype.addPicture=function(){this.picture=this.game.add.image(0,0,"letters_complete","Present_Closed0000",this),this.picture.anchor.set(.5,.5),this.picture.inputEnabled=!0,this.picture.input.useHandCursor=!0,this.picture.events.onInputDown.addOnce(this.onPictureClick,this)},b.prototype.onPictureClick=function(){var a=this;this.game.sound.play("tap",1),this.picture.inputEnabled=!1,this.onClick.dispatch(),this.game.tweens.removeFrom(this.picture.scale),this.game.tweens.removeFrom(this.picture),this.picture.scale.set(1,1);var b=3;this.game.time.events.add(1500,function(){a.onHide.dispatch()},this),this.game.add.tween(this.position).to({y:"-40"},200,Phaser.Easing.Cubic.Out,!0),this.game.add.tween(this).to({angle:-b},50,Phaser.Easing.Linear.None,!0).onComplete.addOnce(function(){a.game.add.tween(a).to({angle:b},75,Phaser.Easing.Sinusoidal.InOut,!0,0,7,!0),a.game.add.tween(a.scale).to({x:.66,y:.66},1200,Phaser.Easing.Linear.None,!0).onComplete.addOnce(function(){a.game.add.tween(a).to({angle:0},200,Phaser.Easing.Back.Out,!0),a.game.add.tween(a.scale).to({x:1.33,y:1.33},300,Phaser.Easing.Back.Out,!0).onComplete.addOnce(function(){a.game.add.tween(a).to({alpha:0},166,Phaser.Easing.Linear.None,!0).onComplete.addOnce(function(){a.visible=!1,a.exists=!1})})})})},b.prototype.startIdleTween=function(){this.picture.angle=-5,this.game.add.tween(this.picture).to({angle:Math.abs(this.picture.angle)},1e3,Phaser.Easing.Sinusoidal.InOut,!0,0,1e3,!0),this.game.add.tween(this.picture).to({y:"+20"},1200,Phaser.Easing.Sinusoidal.InOut,!0,0,1e3,!0)},b}(Phaser.Group);a.Present=b}(game||(game={}));var game;!function(a){var b=function(b){function c(){return null!==b&&b.apply(this,arguments)||this}return __extends(c,b),c.prototype.create=function(){var b=this;this.addBackground(),this.addTitle(),this.addSubTitle(),this.addButton(),this.addPresent(),this.addInstructions(),this.addConfetti(),this.addWhiteOverlay(),this.resize(),a.Main.weakDevice===!1&&this.playTweensOnStart(),this.game.time.events.add(300,function(){b.game.sound.play("win_3",.66)},this),a.Main.stats.saveValue("letters_complete_was_seen",!0)},c.prototype.addBackground=function(){this.background=this.game.add.image(0,0,"backgrounds_1","BG_Red0000"),this.background.width=a.Config.GAME_WIDTH,this.background.height=a.Config.GAME_HEIGHT,this.bgItems=this.game.add.image(0,0,"backgrounds_1","_Items0000"),this.bgItems.anchor.set(.5,.5),this.bgVignette=this.game.add.image(0,0,"backgrounds_1","_Vignette0000"),this.bgVignette.anchor.set(.5,.5)},c.prototype.addTitle=function(){var b={font:"66px "+a.Main.fontFamily,fill:"#ffffff",align:"center"},c=a.Main.texts.letters_complete_title||"Congratulations!";this.titleText=this.game.add.text(0,0,c,b),this.titleText.anchor.set(.5,.5),this.titleText.x=a.Config.HALF_GAME_WIDTH,this.titleText.setShadow(0,7,"rgba(0,0,0,0.15)",0)},c.prototype.addSubTitle=function(){var b={font:"44px "+a.Main.fontFamily,fill:"#ffffff",align:"center"},c=a.Main.texts.letters_complete_subtitle||"You have learned all letters";this.subtitleText=this.game.add.text(0,0,c,b),this.subtitleText.anchor.set(.5,0),this.subtitleText.x=a.Config.HALF_GAME_WIDTH,this.subtitleText.setShadow(0,4,"rgba(0,0,0,0.15)",0)},c.prototype.addPresent=function(){this.present=new a.Present(this.game),this.present.position.x=a.Config.HALF_GAME_WIDTH,this.present.startIdleTween(),this.present.onClick.addOnce(this.hideTexts,this),this.present.onHide.addOnce(this.showWordsModeButton,this),this.world.add(this.present)},c.prototype.hideTexts=function(){var a=this;this.game.add.tween(this.titleText).to({y:"-10",alpha:0},500,Phaser.Easing.Cubic.Out,!0),this.game.add.tween(this.subtitleText).to({y:"-10",alpha:0},500,Phaser.Easing.Cubic.Out,!0).onComplete.addOnce(function(){a.subtitleText.visible=!1,a.subtitleText.exists=!1}),this.game.add.tween(this.hintText).to({y:"+10",alpha:0},500,Phaser.Easing.Cubic.Out,!0)},c.prototype.showWordsModeButton=function(){this.game.sound.play("win_2",.5),this.whiteOverlay.show(700,200),this.confetti&&this.confetti.show(),this.wordsModeButton.scale.set(.66,.66),this.wordsModeButton.visible=!0,this.game.add.tween(this.wordsModeButton.scale).to({x:1,y:1},500,Phaser.Easing.Back.Out,!0),this.game.time.events.add(500,this.showTextsForWordsMode,this)},c.prototype.showTextsForWordsMode=function(){this.titleText.setText(a.Main.texts.words_mode),this.titleText.lineSpacing=-10,this.game.add.tween(this.titleText).to({alpha:1},200,Phaser.Easing.Cubic.Out,!0),this.game.add.tween(this.titleText).to({y:"+50"},600,Phaser.Easing.Cubic.Out,!0),this.game.tweens.removeFrom(this.hintText.scale),this.hintText.scale.set(1,1),this.hintText.setText(a.Main.texts.letters_complete_hint_2),this.game.add.tween(this.hintText).to({alpha:1},200,Phaser.Easing.Cubic.Out,!0)},c.prototype.addButton=function(){this.wordsModeButton=new a.SimpleButton(this.game,0,0,"letters_complete","WordsMode_Button0000"),this.wordsModeButton.x=a.Config.HALF_GAME_WIDTH,this.wordsModeButton.visible=!1,this.wordsModeButton.callback.addOnce(this.gotoChooseWordMenu,this),this.world.add(this.wordsModeButton)},c.prototype.gotoChooseWordMenu=function(){this.game.changeState("ChooseWordMenu")},c.prototype.addInstructions=function(){var b={font:"60px "+a.Main.fontFamily,fill:"#ffffff",align:"center"},c=a.Main.texts.letters_complete_hint_1||"Tap to open";this.hintText=this.game.add.text(0,0,c,b),this.hintText.anchor.set(.5,.5),this.hintText.x=a.Config.HALF_GAME_WIDTH,this.hintText.setShadow(0,4,"rgba(0,0,0,0.15)",0),this.hintText.lineSpacing=-14,this.game.add.tween(this.hintText.scale).to({x:1.1,y:1.1},600,Phaser.Easing.Sinusoidal.InOut,!0,0,1e3,!0)},c.prototype.addConfetti=function(){a.Main.weakDevice===!1&&(this.confetti=new a.Confetti(this.game),this.world.add(this.confetti))},c.prototype.addWhiteOverlay=function(){this.whiteOverlay=new a.WhiteOverlay(this.game),this.world.add(this.whiteOverlay)},c.prototype.resize=function(){this.resizeBackground(),this.whiteOverlay.resize(),this.titleText.y=.13*a.Config.GAME_HEIGHT,this.subtitleText.y=this.titleText.bottom,this.present.position.y=.53*a.Config.GAME_HEIGHT,this.wordsModeButton.y=.53*a.Config.GAME_HEIGHT,this.hintText.y=.85*a.Config.GAME_HEIGHT},c.prototype.resizeBackground=function(){this.background.width=a.Config.GAME_WIDTH+1,this.background.height=a.Config.GAME_HEIGHT+1,this.bgItems.x=a.Config.HALF_GAME_WIDTH,this.bgItems.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.x=a.Config.HALF_GAME_WIDTH,this.bgVignette.y=a.Config.HALF_GAME_HEIGHT,this.bgVignette.width=1.4*a.Config.GAME_WIDTH,this.bgVignette.height=1.4*a.Config.GAME_HEIGHT},c.prototype.playTweensOnStart=function(){this.game.add.tween(this.titleText).from({alpha:0,y:"-20"},800,Phaser.Easing.Cubic.Out,!0,200),this.game.add.tween(this.subtitleText).from({alpha:0,y:"+20"},800,Phaser.Easing.Cubic.Out,!0,500),this.game.add.tween(this.present).from({alpha:0},300,Phaser.Easing.Linear.None,!0,1500),this.game.add.tween(this.present.scale).from({x:2.2,y:2.2},1e3,Phaser.Easing.Bounce.Out,!0,1500),this.game.add.tween(this.hintText).from({alpha:0,y:"+20"},800,Phaser.Easing.Cubic.Out,!0,2500)},c.prototype.shutdown=function(){},c}(Phaser.State);a.LettersCompleteScreen=b}(game||(game={}));var game;!function(a){var b=function(b){function c(){var d=b.call(this,{width:a.Config.SOURCE_GAME_WIDTH,height:a.Config.SOURCE_GAME_HEIGHT,antialias:!0,enableDebug:utils.NetUtil.getParamBool("debug"),clearBeforeRender:!1,disableVisibilityChange:!0,maxPointers:1,renderer:Phaser.AUTO,transparent:c.getTransparentCanvas()})||this;return c.development=d.checkDevMode(),c.storage=new utils.LocalStorageWrapper,c.stats=new a.GameStats(c.storage),d.addStates(),d}return __extends(c,b),c.prototype.checkDevMode=function(){var a=utils.NetUtil.getParamBool("dev");return a},c.getPreserveDrawingBuffer=function(){return!!c.isAmazonFire()},c.getTransparentCanvas=function(){return!!c.isAmazonFire()},c.isAmazonFire=function(){var a=navigator.userAgent;return["Silk","KFAUWI","KFFOWI","KFSUWI","KFARWI"].some(function(b){return a.indexOf(b)>-1})},c.prototype.addStates=function(){this.state.add("Boot",a.Boot,!0),this.state.add("Preloader",a.Preloader,!1),this.state.add("MainMenu",a.MainMenu,!1),this.state.add("LanguagesMenu",a.LanguagesMenu,!1),this.state.add("ChooseLevelMenu",a.ChooseLevelMenu,!1),this.state.add("ChooseWordMenu",a.ChooseWordMenu,!1),this.state.add("Level",a.Level,!1),this.state.add("WordLevel",a.WordLevel,!1),this.state.add("FreeZone",a.FreeZone,!1),this.state.add("LettersCompleteScreen",a.LettersCompleteScreen,!1)},c.prototype.changeState=function(a,b){this.plugins.plugins[0].changeState(a,b)},c.isDesktop=!0,c.weakDevice=!1,c.wasPaused=!1,c.wasMuted=!1,c.development=!1,c.language="en",c.fontFamily="bariol_boldbold",c.fullVolume=.25,c.reducedVolume=.15,c}(Phaser.Game);a.Main=b}(game||(game={})),window.addEventListener("load",onLoad,!1);