"use strict";function $(e){return 1<arguments.length&&void 0!==arguments[1]&&arguments[1]?document.querySelectorAll(e):document.querySelector(e)}var gameType="";function initGame(e){switch(gameType=e){case"topspeed":$(".topspeed-container").classList.remove("hide"),$(".classics-container").classList.add("hide");break;case"classics":$(".topspeed-container").classList.add("hide"),$(".classics-container").classList.remove("hide")}}var topspeed=new Topspeed({container:"#topspeed-container",scoreContainer:".score-container.topspeed",over:{modal:"#score-modal",score:"#score",historyScore:"#history-score"}}),classics=new Classics({container:"#classics-container",timeContainer:"#remaining-time",scoreContainer:"#classics-score",over:{modal:"#score-modal",score:"#score",historyScore:"#history-score"}}),topSpeedBtn=$("#topspeed-btn"),classicsBtn=$("#classics-btn"),disableBtns=$(".modal-btn.disable",!0),closeBtns=$(".modal-close-btn",!0),backBtns=$(".back-btn",!0),resetBtn=$("#topspeed-reset"),historyBtn=$("#history-btn"),initModal=$("#init-modal");disableBtns.forEach(function(e){e.addEventListener("click",function(){$("#coding-modal").style.display="flex"})}),closeBtns.forEach(function(e){e.addEventListener("click",function(){$(this.dataset.modal).style.display="none"})}),topSpeedBtn.addEventListener("click",function(){initGame("topspeed"),initModal.style.display="none",topspeed.start()}),classicsBtn.addEventListener("click",function(){initGame("classics"),initModal.style.display="none",classics.start()}),backBtns.forEach(function(e){e.addEventListener("click",function(){$(this.dataset.modal).style.display="none",initModal.style.display="flex"})}),resetBtn.addEventListener("click",function(){switch($(this.dataset.modal).style.display="none",gameType){case"topspeed":topspeed.start();break;case"classics":classics.start()}}),historyBtn.addEventListener("click",function(){$("#history-modal").style.display="flex",$("#history-topspeed-score").innerHTML=topspeed.historyScore,$("#history-classics-score").innerHTML=classics.historyScore});