text: !function(e){function t(r){if(a[r])return a[r].exports;var n=a[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var a={};return t.m=e,t.c=a,t.p="",t(0)}([function(e,t,a){e.exports=a(1)},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=a(2),s=r(i),o=a(28),u=function e(){function t(){var e=Math.floor(r.clientWidth*u),t=Math.floor(r.clientHeight*u);r.width===e&&r.height===t||(r.width=e,r.height=t,i.setSize(r.clientWidth,r.clientHeight,!1),l.resize(e,t))}function a(){t(),l.update(c.getDelta()),requestAnimationFrame(a)}if(n(this,e),!o())return void(document.body.innerHTML="Unable to initialize WebGL. Your browser may not support it.");var r=document.getElementById("canvas"),i=new THREE.WebGLRenderer({antialias:!0,alpha:!1,canvas:r}),u=window.devicePixelRatio||1;i.setPixelRatio(u);var l=new s.default(i);this.appViewer=l;var c=new THREE.Clock;a()};window.app=new u},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),s=a(3),o=r(s),u=a(5),l=r(u),c=a(6),h=r(c),d=a(19),f=r(d),p=a(20),m=r(p),v=a(21),y=r(v),w=a(25),T=r(w),g=a(26),_=r(g),E=a(27),b=new THREE.Raycaster,x=new THREE.Vector2,P=void 0,k=1,R=function(e){return Math.min(o.default.game.maxT,Math.max(-o.default.game.maxT,e))},C=function(){function e(t){n(this,e),this.renderer=t,this.renderer.setClearColor(o.default.renderer.clearColor,o.default.renderer.clearAlpha),this.renderer.setPixelRatio(o.default.renderer.devicePixelRatio),this.sceneManager=new h.default;var a=this.renderer.getContext();P=a.canvas.clientWidth/a.canvas.clientHeight;var r=o.default.camera.frustumSize*P/2,i=o.default.camera.frustumSize/2;this.camera=new THREE.OrthographicCamera(-r,r,i,-i,o.default.camera.near,o.default.camera.far),this.camera.position.fromArray(o.default.camera.pos),this.camera.lookAt((new THREE.Vector3).fromArray(o.default.camera.target)),this.camera.near=o.default.camera.near,this.camera.far=o.default.camera.far,this.camera.updateProjectionMatrix(),this.sceneReady=!1,document.addEventListener("sceneReady",this.onSceneReady.bind(this)),o.default.isMobile?(document.addEventListener("touchstart",this.onMouseDownTouchStart.bind(this)),document.addEventListener("touchmove",this.onMouseMoveTouchMove.bind(this)),document.addEventListener("touchend",this.onMouseUpTouchEnd.bind(this)),document.addEventListener("touchcancel",this.onMouseUpTouchEnd.bind(this))):(document.addEventListener("mousedown",this.onMouseDownTouchStart.bind(this)),document.addEventListener("mouseup",this.onMouseUpTouchEnd.bind(this)),document.addEventListener("mousemove",this.onMouseMoveTouchMove.bind(this)))}return i(e,[{key:"onSceneReady",value:function(){l.default.phasesSeq=[l.default.phases.PLAYER_ATTACK,l.default.phases.ENEMY_DEFENCE,l.default.phases.APPLY,l.default.phases.RESET,l.default.phases.ENEMY_ATTACK,l.default.phases.PLAYER_DEFENCE,l.default.phases.APPLY,l.default.phases.RESET],l.default.activePhaseIndex=6,l.default.activePhase=l.default.phasesSeq[l.default.activePhaseIndex],this.env=new f.default(this.sceneManager.assetsLoader.assets),this.sceneManager.scene.add(this.env.mesh),this.tracks=new m.default(this.sceneManager.assetsLoader.assets),this.sceneManager.scene.add(this.tracks.mesh),this.towers=new y.default(this.sceneManager.assetsLoader.assets),this.sceneManager.scene.add(this.towers.mesh),this.cards=new T.default(this.tracks,this.sceneManager.assetsLoader.assets),this.sceneManager.scene.add(this.cards.mesh),this.botLogic=new _.default(this),this.sceneReady=!0,this.nextPhase()}},{key:"update",value:function(e){this.sceneReady&&(o.default.time+=e,this.towers.update(),this.renderer.render(this.sceneManager.scene,this.camera))}},{key:"_playerActive",value:function(){return l.default.activePhase===l.default.phases.PLAYER_ATTACK||l.default.activePhase===l.default.phases.PLAYER_DEFENCE}},{key:"_giveCardsToPlayer",value:function(e){for(var t=e?l.default.playerHand:l.default.enemyHand,a=0;a<4;++a)t[a]||this._giveCardToPlayer(e,a)}},{key:"_giveCardToPlayer",value:function(e,t){var a=e?l.default.playerHand:l.default.enemyHand;a[t]=(0,E.generateCard)(),e&&this.cards.updatePlayerCard(t,a[t])}},{key:"shuffleRemainingCards",value:function(e){for(var t=e?l.default.playerHand:l.default.enemyHand,a=0;a<4;++a)t[a]&&this._giveCardToPlayer(e,a)}},{key:"playCard",value:function(e,t,a){e&&this.cards.hideCard(t);var r=e?l.default.playerHand:l.default.enemyHand;this.tracks.spawnUnitOnTrack(e,a,r[t]);var n=e?0:1;l.default.towersT[n][a]=l.default.towersT[n][a]+r[t].price,this.towers.setTowerTemperature(e,a,l.default.towersT[n][a]),this.updateTemperatures(),r[t]=null}},{key:"nextPhase",value:function(){var e=this;l.default.activePhaseIndex+=1,l.default.activePhaseIndex===l.default.phasesSeq.length&&(l.default.activePhaseIndex=0),l.default.activePhase=l.default.phasesSeq[l.default.activePhaseIndex],l.default.activePhase===l.default.phases.ENEMY_ATTACK||l.default.activePhase===l.default.phases.ENEMY_DEFENCE?this.botLogic.makeTurn(l.default.activePhase===l.default.phases.ENEMY_ATTACK):l.default.activePhase===l.default.phases.RESET?(this.tracks.clearTracks(),this._giveCardsToPlayer(!0),this._giveCardsToPlayer(!1),this.nextPhase()):l.default.activePhase===l.default.phases.APPLY?(this._applyUnitsDamage(),setTimeout(function(){e._applyTowersBurn()},1700),setTimeout(function(){e._checkWinLose()||e.nextPhase()},2e3)):this._playerActive()&&(l.default.usedShuffleThisTurn=!1,this.env.endButton.material.color=this.env.endButton.userData.defaultColor,this.env.shuffleButton.material.color=this.env.endButton.userData.defaultColor)}},{key:"_applyUnitsDamage",value:function(){for(var e=this,t=function(t){setTimeout(function(){e._applyUnitsDamageOnTrack(t)},500*t)},a=0;a<3;++a)t(a)}},{key:"_applyUnitsDamageOnTrack",value:function(e){var t=this.tracks.applyDamageOnTrack(e);if(t){var a=t.playerWon?1:0;l.default.towersT[a][e]=l.default.towersT[a][e]+t.damage,this.towers.setTowerTemperature(!t.playerWon,e,l.default.towersT[a][e]),this.towers.showFadingDamage(!t.playerWon,e,t.damage),this.updateTemperatures()}}},{key:"_applyTowersBurn",value:function(){for(var e=0;e<3;++e){for(var t=Math.abs(l.default.towersT[0][e]),a=Math.abs(l.default.towersT[1][e]),r=0,n=0,i=0;i<o.default.game.burn.length;++i)t>o.default.game.burn[i].t&&(r=o.default.game.burn[i].damage*Math.sign(l.default.towersT[0][e])),a>o.default.game.burn[i].t&&(n=o.default.game.burn[i].damage*Math.sign(l.default.towersT[1][e]));0!==r&&this.towers.showFadingDamage(!0,e,r),0!==n&&this.towers.showFadingDamage(!1,e,n),l.default.playerAdditiveT+=r,l.default.enemyAdditiveT+=n,this.updateTemperatures()}}},{key:"_createGameOverScreen",value:function(e){var t=document.createElement("div");t.style.position="absolute",t.style.backgroundColor="white",t.style.opacity=.8,t.style.left=0,t.style.right=0,t.style.top=0,t.style.bottom=0,t.style.fontSize="140px",t.style.textAlign="center";var a=document.createTextNode(e);t.appendChild(a),document.body.appendChild(t)}},{key:"_checkWinLose",value:function(){var e=Math.abs(l.default.enemyT)>=o.default.game.maxT,t=Math.abs(l.default.playerT)>=o.default.game.maxT;return e?(this._createGameOverScreen("WIN!"),!0):!!t&&(this._createGameOverScreen("LOSE!"),!0)}},{key:"updateTemperatures",value:function(){var e=l.default.towersT;l.default.playerT=R((e[0][0]+e[0][1]+e[0][2])/3+l.default.playerAdditiveT),l.default.enemyT=R((e[1][0]+e[1][1]+e[1][2])/3+l.default.enemyAdditiveT),this.towers.updatePlayerTemperatures()}},{key:"onMouseDownTouchStart",value:function(e){e.preventDefault();var t=e.clientX,a=e.clientY;e.changedTouches&&e.changedTouches[0]&&(t=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY),x.x=t/window.innerWidth*2-1,x.y=2*-(a/window.innerHeight)+1,b.setFromCamera(x,this.camera),l.default.isMouseDown=!0;var r=b.intersectObjects(this.cards.mesh.children);l.default.activeCard=r[0]?r[0].object:null,r=b.intersectObjects(this.env.mesh.children),r[0]&&this._playerActive()&&("shuffle_button"!==r[0].object.name||l.default.usedShuffleThisTurn?"end_button"===r[0].object.name&&(this.env.endButton.material.color=this.env.endButton.userData.inactiveColor,this.env.shuffleButton.material.color=this.env.endButton.userData.inactiveColor,this.nextPhase()):(l.default.usedShuffleThisTurn=!0,this.env.shuffleButton.material.color=this.env.endButton.userData.inactiveColor,this.shuffleRemainingCards(!0)))}},{key:"onMouseUpTouchEnd",value:function(e){e.preventDefault(),l.default.isMouseDown=!1,l.default.activeCard&&(l.default.activeCard.position.x=l.default.activeCard.userData.initPosX,l.default.activeCard.position.y=l.default.activeCard.userData.initPosY),l.default.activeTrack&&(l.default.activeTrack.material.color=l.default.activeTrack.userData.defaultColor),l.default.activeCard&&l.default.activeTrack&&!this.tracks.hasUnitOnTrack(!0,l.default.activeTrack.userData.index)&&this.playCard(!0,l.default.activeCard.userData.index,l.default.activeTrack.userData.index),l.default.activeCard=void 0}},{key:"onMouseMoveTouchMove",value:function(e){e.preventDefault();var t=e.clientX,a=e.clientY;e.changedTouches&&e.changedTouches[0]&&(t=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY),x.x=t/window.innerWidth*2-1,x.y=2*-(a/window.innerHeight)+1,b.setFromCamera(x,this.camera),this._playerActive()&&this._updatePlayerControls()}},{key:"_updatePlayerControls",value:function(){this._processCardMovementIfNeeded();var e=b.intersectObjects(this.env.mesh.children),t=e[0]?e[0].object:null;l.default.usedShuffleThisTurn||(t&&"shuffle_button"===t.name?this.env.shuffleButton.material.color=this.env.shuffleButton.userData.selectedColor:this.env.shuffleButton.material.color=this.env.shuffleButton.userData.defaultColor),t&&"end_button"===t.name?this.env.endButton.material.color=this.env.endButton.userData.selectedColor:this.env.endButton.material.color=this.env.endButton.userData.defaultColor}},{key:"_processCardMovementIfNeeded",value:function(){if(l.default.activeCard){l.default.activeCard.position.x=x.x*k*P*.5,l.default.activeCard.position.y=x.y*k*.5;var e=b.intersectObjects(this.tracks.mesh.children),t=e[0]?e[0].object:null;t?l.default.activeTrack?l.default.activeTrack.uuid!==t.uuid&&(l.default.activeTrack.material.color=l.default.activeTrack.userData.defaultColor,l.default.activeTrack=t,l.default.activeTrack.material.color=l.default.activeTrack.userData.selectedColor):(l.default.activeTrack=t,l.default.activeTrack.material.color=l.default.activeTrack.userData.selectedColor):l.default.activeTrack&&(l.default.activeTrack.material.color=l.default.activeTrack.userData.defaultColor,l.default.activeTrack=null)}}},{key:"resize",value:function(e,t){P=e/t,P<.563&&(k=.563/P),this.camera.aspect!==P&&(this.camera.left=-k*o.default.camera.frustumSize*P/2,this.camera.right=k*o.default.camera.frustumSize*P/2,this.camera.top=k*o.default.camera.frustumSize/2,this.camera.bottom=-k*o.default.camera.frustumSize/2,this.camera.updateProjectionMatrix())}},{key:"dispose",value:function(){}}]),e}();t.default=C},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(4)(),n={isMobile:!r.desktop(),isDebug:"debug"===window.location.hash.substr(1),useDDSTextures:!0,usePVRTextures:!0,time:0,fadeDuration:1.3,renderer:{clearColor:1315876,clearAlpha:!0,devicePixelRatio:window.devicePixelRatio||1},camera:{pos:[0,0,5],target:[0,0,0],frustumSize:1,near:.5,far:10},game:{maxT:10,burn:[{t:5,damage:2},{t:11,damage:3},{t:17,damage:5}]}};t.default=n},function(e,t,a){var r,n;!function(t){"use strict";var a=function(e,t){function a(t){return e.indexOf(t)!==-1}function r(e){var t;return t=new RegExp(e,"i"),u.className.match(t)}function n(e){r(e)||(u.className+=" "+e)}function i(e){r(e)&&(u.className=u.className.replace(e,""))}function s(t){var a=e.match(t);return a&&a.length>1&&a[1]||""}var o={},u=t||window.document.documentElement;e=(e||window.navigator.userAgent).toLowerCase(),o.ios=function(){return o.iphone()||o.ipod()||o.ipad()},o.iphone=function(){return a("iphone")},o.ipod=function(){return a("ipod")},o.ipad=function(){return a("ipad")},o.android=function(){return a("android")},o.androidPhone=function(){return o.android()&&a("mobile")},o.androidTablet=function(){return o.android()&&!a("mobile")},o.blackberry=function(){return a("blackberry")||a("bb10")||a("rim")},o.blackberryPhone=function(){return o.blackberry()&&!a("tablet")},o.blackberryTablet=function(){return o.blackberry()&&a("tablet")},o.windows=function(){return a("windows")},o.windowsPhone=function(){return o.windows()&&a("phone")},o.windowsTablet=function(){return o.windows()&&a("touch")&&!o.windowsPhone()},o.fxos=function(){return(a("(mobile;")||a("(tablet;"))&&a("; rv:")},o.fxosPhone=function(){return o.fxos()&&a("mobile")},o.fxosTablet=function(){return o.fxos()&&a("tablet")},o.meego=function(){return a("meego")},o.cordova=function(){return window.cordova&&"file:"===location.protocol},o.nodeWebkit=function(){return"object"==typeof window.process},o.bada=function(){return a("bada")},o.mobile=function(){return o.androidPhone()||o.iphone()||o.ipod()||o.windowsPhone()||o.blackberryPhone()||o.fxosPhone()||o.meego()},o.tablet=function(){return o.ipad()||o.androidTablet()||o.blackberryTablet()||o.windowsTablet()||o.fxosTablet()},o.desktop=function(){return!o.tablet()&&!o.mobile()},o.portrait=function(){return window.innerHeight/window.innerWidth>1},o.landscape=function(){return window.innerHeight/window.innerWidth<1},o.standAlone=function(){return window.navigator.standalone===!0},o.addClasses=function(){o._hasAddClasses||(o._hasAddClasses=!0,o.ios()?o.ipad()?n("ios ipad tablet"):o.iphone()?n("ios iphone mobile"):o.ipod()&&n("ios ipod mobile"):n(o.android()?o.androidTablet()?"android tablet":"android mobile":o.blackberry()?o.blackberryTablet()?"blackberry tablet":"blackberry mobile":o.windows()?o.windowsTablet()?"windows tablet":o.windowsPhone()?"windows mobile":"desktop":o.fxos()?o.fxosTablet()?"fxos tablet":"fxos mobile":o.meego()?"meego mobile":o.nodeWebkit()?"node-webkit":"desktop"),o.cordova()&&n("cordova"),o.standAlone()&&n("standalone"))};var l="";return o.ios()?(l=s(/os (\d+([_\s]\d+)*) like mac os x/i),l=l.replace(/[_\s]/g,".")):o.android()?l=s(/android[ \/-](\d+(\.\d+)*)/i):o.windowsPhone()?l=s(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):o.blackberry()?l=s(/rim\stablet\sos\s(\d+(\.\d+)*)/i):o.bada()&&(l=s(/bada\/(\d+(\.\d+)*)/i)),l&&(o.osversion=l),o.addOrientationClasses=function(){if(!o.hasOrientationListener){o.hasOrientationListener=!0;var e=function(){return o.landscape()?(i("portrait"),n("landscape")):(i("landscape"),n("portrait"))},t="onorientationchange"in window?"orientationchange":"resize";window.addEventListener?window.addEventListener(t,e,!1):window.attachEvent?window.attachEvent(t,e):window[t]=e,e()}},o};"undefined"!=typeof e&&e.exports?e.exports=a:(r=[],n=function(){return a}.apply(t,r),!(void 0!==n&&(e.exports=n)))}(this)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={isMouseDown:!1,activeCard:void 0,activeTrack:void 0,phases:{RESET:0,PLAYER_ATTACK:1,ENEMY_ATTACK:2,PLAYER_DEFENCE:3,ENEMY_DEFENCE:4,APPLY:5},phasesSeq:[],activePhaseIndex:0,activePhase:null,usedShuffleThisTurn:!1,playerHand:{0:null,1:null,2:null,3:null},enemyHand:{0:null,1:null,2:null,3:null},playerAdditiveT:0,enemyAdditiveT:0,playerT:0,enemyY:0,towersT:[[0,0,0],[0,0,0]]};t.default=a},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),o=a(7),u=r(o),l=a(18),c=r(l),h=new Event("sceneReady"),d=function(){function e(){i(this,e),this.scene=new THREE.Scene,this.assetsLoader=new u.default(this.scene),document.addEventListener("assetsLoaded",this.onAssetsLoaded.bind(this)),this.assetsLoader.loadAssets(c.default.assets)}return s(e,[{key:"onAssetsLoaded",value:function(){this.createSceneFromDescription(this.scene),this.scene.updateMatrixWorld(),document.dispatchEvent(h)}},{key:"createSceneFromDescription",value:function(e){this.addChildrenFromDescription(e,c.default.model.children)}},{key:"addChildrenFromDescription",value:function(e,t){var a=this,r=void 0;t.forEach(function(t){r=a.createObjectFromDescription(t),e.add(r),t.children&&t.children.length>0&&a.addChildrenFromDescription(r,t.children)})}},{key:"createObjectFromDescription",value:function(e){var t=null,a=null,r="Object3D";e.object&&e.object.type?r=e.object.type:e.type&&(r=e.type),e.object&&e.object.args?a=e.object.args:e.args&&(a=e.args);for(var i in a)a.hasOwnProperty(i)&&a[i].type&&"asset/texture"===a[i].type&&(a[i]=this.assetsLoader.assets.textures[a[i].name]);if("asset/json"===r)t=this.assetsLoader.assets.objects[e.name];else if("Mesh"===r||e.object&&e.object.geometry){var s=this.createObjectFromDescription(e.object.geometry),o=null;e.object.material&&(o=this.createObjectFromDescription(e.object.material)),t=new THREE.Mesh(s,o)}else t=a instanceof Array?new(Function.prototype.bind.apply(THREE[r],[null].concat(n(a)))):new THREE[r](a);return t||(t=new THREE.Object3D),e.properties&&this.addObjectProperties(t,e.properties),t}},{key:"addObjectProperties",value:function(e,t){var a=void 0,r=void 0;for(a in t)if(t.hasOwnProperty(a))if(t[a]instanceof Object){e[a]||(e[a]={});for(r in t[a])t[a].hasOwnProperty(r)&&(e[a][r]=t[a][r])}else e[a]=t[a]}}]),e}();t.default=d},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),s=a(3),o=r(s),u=a(8),l=new Event("assetsLoaded");window.THREE=window.THREE||THREE,a(16),a(17);var c=0,h=0,d=function(){function e(t){n(this,e),this.scene=t,this.assets={objects:{},textures:{}},this.objectLoader=new THREE.ObjectLoader,this.textureLoader=new THREE.TextureLoader,this.useDDS=!o.default.isIOS&&o.default.useDDSTextures,this.usePVR=o.default.isIOS&&o.default.usePVRTextures,this.DDSLoader=new THREE.DDSLoader,this.PVRLoader=new THREE.PVRLoader}return i(e,[{key:"loadAssets",value:function(e){var t=this,a=[],r=void 0,n=void 0,i=void 0,s=void 0,o=void 0;this.initProgressBar(),e.forEach(function(e){switch(e.type){case"json":n=e.path,s=t.objectLoader,o=t.assets.objects,i=e.name;break;case"texture":if(n=e.path,s=t.textureLoader,o=t.assets.textures,i=e.name,e.path instanceof Array)for(var u=0;u<e.path.length;u++){if(n=e.path[u],t.useDDS&&e.path[u].includes(".dds")){s=t.DDSLoader;break}if(t.usePVR&&e.path[u].includes(".pvr")){s=t.PVRLoader;break}}break;default:throw new Error("unknow asset type in sceneDescription: "+e.type)}r=t.loadEntry(n,o,i,s),a.push(r)}),Promise.all(a).then(function(){t.loadingFinished()})}},{key:"loadEntry",value:function(e,t,a,r){var n=this;return new Promise(function(i,s){r.load(e,function(e){t[a]=e,i()},function(e){o.default.isDebug&&console.log(e.loaded/e.total*100+"% loaded"),n.updateProgressBar(e.loaded,e.total,a)},function(e){console.log("error while loading model",e),s(e)})})}},{key:"initProgressBar",value:function(){this.progress=-1,this.assetsSizes={};var e=document.getElementById("progressBar");this.progressbar=new u.Line(e,{from:{color:"#557788"},to:{color:"#224455"},easing:"easeInOut",duration:1400,svgStyle:{display:"block",width:"100%",height:"100%",boxSizing:"border-box",borderRadius:"37px"},text:{value:"loading",style:{color:"#000",position:"absolute",left:"50%",top:"50%",padding:0,margin:0,fontWeight:"bold",fontSize:"6vh",transform:{prefix:!0,value:"translate(-50%, -50%)"}}},step:function(e,t){t.path.setAttribute("stroke",e.color)}})}},{key:"loadingFinished",value:function(){var e=document.getElementById("loadingScreen");e.className="loadingScreen-hidden",setTimeout(function(){e.style.display="none"},700),document.dispatchEvent(l)}},{key:"updateProgressBar",value:function(e,t,a){if(!this.assetsSizes[a]&&!isNaN(t)&&t>0&&(this.assetsSizes[a]={},this.assetsSizes[a].loaded=e,this.assetsSizes[a].size=t),this.assetsSizes[a]&&!isNaN(t)&&!isNaN(e)){c=0,h=0,this.assetsSizes[a].loaded=e;for(var r in this.assetsSizes)this.assetsSizes.hasOwnProperty(r)&&(c+=this.assetsSizes[r].loaded,h+=this.assetsSizes[r].size);this.progress=Math.max(c/h,this.progress),this.progressbar.set(this.progress)}}}]),e}();t.default=d},function(e,t,a){e.exports={Line:a(9),Circle:a(14),SemiCircle:a(15),Path:a(11),Shape:a(10),utils:a(13)}},function(e,t,a){var r=a(10),n=a(13),i=function(e,t){this._pathTemplate="M 0,{center} L 100,{center}",r.apply(this,arguments)};i.prototype=new r,i.prototype.constructor=i,i.prototype._initializeSvg=function(e,t){e.setAttribute("viewBox","0 0 100 "+t.strokeWidth),e.setAttribute("preserveAspectRatio","none")},i.prototype._pathString=function(e){return n.render(this._pathTemplate,{center:e.strokeWidth/2})},i.prototype._trailString=function(e){return this._pathString(e)},e.exports=i},function(e,t,a){var r=a(11),n=a(13),i="Object is destroyed",s=function e(t,a){if(!(this instanceof e))throw new Error("Constructor was called without new keyword");if(0!==arguments.length){this._opts=n.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},a,!0),n.isObject(a)&&void 0!==a.svgStyle&&(this._opts.svgStyle=a.svgStyle),n.isObject(a)&&n.isObject(a.text)&&void 0!==a.text.style&&(this._opts.text.style=a.text.style);var i,s=this._createSvgView(this._opts);if(i=n.isString(t)?document.querySelector(t):t,!i)throw new Error("Container does not exist: "+t);this._container=i,this._container.appendChild(s.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&n.setStyles(s.svg,this._opts.svgStyle),this.svg=s.svg,this.path=s.path,this.trail=s.trail,this.text=null;var o=n.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new r(s.path,o),n.isObject(this._opts.text)&&null!==this._opts.text.value&&this.setText(this._opts.text.value)}};s.prototype.animate=function(e,t,a){if(null===this._progressPath)throw new Error(i);this._progressPath.animate(e,t,a)},s.prototype.stop=function(){if(null===this._progressPath)throw new Error(i);void 0!==this._progressPath&&this._progressPath.stop()},s.prototype.destroy=function(){if(null===this._progressPath)throw new Error(i);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,this._progressPath=null,null!==this.text&&(this.text.parentNode.removeChild(this.text),this.text=null)},s.prototype.set=function(e){if(null===this._progressPath)throw new Error(i);this._progressPath.set(e)},s.prototype.value=function(){if(null===this._progressPath)throw new Error(i);return void 0===this._progressPath?0:this._progressPath.value()},s.prototype.setText=function(e){if(null===this._progressPath)throw new Error(i);null===this.text&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),n.isObject(e)?(n.removeChildren(this.text),this.text.appendChild(e)):this.text.innerHTML=e},s.prototype._createSvgView=function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(t,e);var a=null;(e.trailColor||e.trailWidth)&&(a=this._createTrail(e),t.appendChild(a));var r=this._createPath(e);return t.appendChild(r),{svg:t,path:r,trail:a}},s.prototype._initializeSvg=function(e,t){e.setAttribute("viewBox","0 0 100 100")},s.prototype._createPath=function(e){var t=this._pathString(e);return this._createPathElement(t,e)},s.prototype._createTrail=function(e){var t=this._trailString(e),a=n.extend({},e);return a.trailColor||(a.trailColor="#eee"),a.trailWidth||(a.trailWidth=a.strokeWidth),a.color=a.trailColor,a.strokeWidth=a.trailWidth,a.fill=null,this._createPathElement(t,a)},s.prototype._createPathElement=function(e,t){var a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",e),a.setAttribute("stroke",t.color),a.setAttribute("stroke-width",t.strokeWidth),t.fill?a.setAttribute("fill",t.fill):a.setAttribute("fill-opacity","0"),a},s.prototype._createTextContainer=function(e,t){var a=document.createElement("div");a.className=e.text.className;var r=e.text.style;return r&&(e.text.autoStyleContainer&&(t.style.position="relative"),n.setStyles(a,r),r.color||(a.style.color=e.color)),this._initializeTextContainer(e,t,a),a},s.prototype._initializeTextContainer=function(e,t,a){},s.prototype._pathString=function(e){throw new Error("Override this function for each progress bar")},s.prototype._trailString=function(e){throw new Error("Override this function for each progress bar")},s.prototype._warnContainerAspectRatio=function(e){if(this.containerAspectRatio){var t=window.getComputedStyle(e,null),a=parseFloat(t.getPropertyValue("width"),10),r=parseFloat(t.getPropertyValue("height"),10);n.floatEquals(this.containerAspectRatio,a/r)||(console.warn("Incorrect aspect ratio of container","#"+e.id,"detected:",t.getPropertyValue("width")+"(width)","/",t.getPropertyValue("height")+"(height)","=",a/r),console.warn("Aspect ratio of should be",this.containerAspectRatio))}},e.exports=s},function(e,t,a){var r=a(12),n=a(13),i={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},s=function e(t,a){if(!(this instanceof e))throw new Error("Constructor was called without new keyword");a=n.extend({duration:800,easing:"linear",from:{},to:{},step:function(){}},a);var r;r=n.isString(t)?document.querySelector(t):t,this.path=r,this._opts=a,this._tweenable=null;var i=this.path.getTotalLength();this.path.style.strokeDasharray=i+" "+i,this.set(0)};s.prototype.value=function(){var e=this._getComputedDashOffset(),t=this.path.getTotalLength(),a=1-e/t;return parseFloat(a.toFixed(6),10)},s.prototype.set=function(e){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(e);var t=this._opts.step;if(n.isFunction(t)){var a=this._easing(this._opts.easing),r=this._calculateTo(e,a),i=this._opts.shape||this;t(r,i,this._opts.attachment)}},s.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},s.prototype.animate=function(e,t,a){t=t||{},n.isFunction(t)&&(a=t,t={});var i=n.extend({},t),s=n.extend({},this._opts);t=n.extend(s,t);var o=this._easing(t.easing),u=this._resolveFromAndTo(e,o,i);this.stop(),this.path.getBoundingClientRect();var l=this._getComputedDashOffset(),c=this._progressToOffset(e),h=this;this._tweenable=new r,this._tweenable.tween({from:n.extend({offset:l},u.from),to:n.extend({offset:c},u.to),duration:t.duration,easing:o,step:function(e){h.path.style.strokeDashoffset=e.offset;var a=t.shape||h;t.step(e,a,t.attachment)},finish:function(e){n.isFunction(a)&&a()}})},s.prototype._getComputedDashOffset=function(){var e=window.getComputedStyle(this.path,null);return parseFloat(e.getPropertyValue("stroke-dashoffset"),10)},s.prototype._progressToOffset=function(e){var t=this.path.getTotalLength();return t-e*t},s.prototype._resolveFromAndTo=function(e,t,a){return a.from&&a.to?{from:a.from,to:a.to}:{from:this._calculateFrom(t),to:this._calculateTo(e,t)}},s.prototype._calculateFrom=function(e){return r.interpolate(this._opts.from,this._opts.to,this.value(),e)},s.prototype._calculateTo=function(e,t){return r.interpolate(this._opts.from,this._opts.to,e,t)},s.prototype._stopTween=function(){null!==this._tweenable&&(this._tweenable.stop(),this._tweenable=null)},s.prototype._easing=function(e){return i.hasOwnProperty(e)?i[e]:e},e.exports=s},function(e,t,a){(function(){var t=this||Function("return this")(),a=function(){"use strict";function a(){}function r(e,t){var a;for(a in e)Object.hasOwnProperty.call(e,a)&&t(a)}function n(e,t){return r(t,function(a){e[a]=t[a]}),e}function i(e,t){r(t,function(a){"undefined"==typeof e[a]&&(e[a]=t[a])})}function s(e,t,a,r,n,i,s){var u,l,c,h=e<i?0:(e-i)/n;for(u in t)t.hasOwnProperty(u)&&(l=s[u],c="function"==typeof l?l:d[l],t[u]=o(a[u],r[u],c,h));return t}function o(e,t,a,r){return e+(t-e)*a(r)}function u(e,t){var a=h.prototype.filter,n=e._filterArgs;r(a,function(r){"undefined"!=typeof a[r][t]&&a[r][t].apply(e,n)})}function l(e,t,a,r,n,i,o,l,c,h,d){T=t+a+r,g=Math.min(d||w(),T),_=g>=T,E=r-(T-g),e.isPlaying()&&(_?(c(o,e._attachment,E),e.stop(!0)):(e._scheduleId=h(e._timeoutHandler,v),u(e,"beforeTween"),g<t+a?s(1,n,i,o,1,1,l):s(g,n,i,o,r,t+a,l),u(e,"afterTween"),c(n,e._attachment,E)))}function c(e,t){var a={},n=typeof t;return"string"===n||"function"===n?r(e,function(e){a[e]=t}):r(e,function(e){a[e]||(a[e]=t[e]||p)}),a}function h(e,t){this._currentState=e||{},this._configured=!1,this._scheduleFunction=f,"undefined"!=typeof t&&this.setConfig(t)}var d,f,p="linear",m=500,v=1e3/60,y=Date.now?Date.now:function(){return+new Date},w="undefined"!=typeof SHIFTY_DEBUG_NOW?SHIFTY_DEBUG_NOW:y;f="undefined"!=typeof window?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||window.mozCancelRequestAnimationFrame&&window.mozRequestAnimationFrame||setTimeout:setTimeout;var T,g,_,E;return h.prototype.tween=function(e){return this._isTweening?this:(void 0===e&&this._configured||this.setConfig(e),this._timestamp=w(),this._start(this.get(),this._attachment),this.resume())},h.prototype.setConfig=function(e){e=e||{},this._configured=!0,this._attachment=e.attachment,this._pausedAtTime=null,this._scheduleId=null,this._delay=e.delay||0,this._start=e.start||a,this._step=e.step||a,this._finish=e.finish||a,this._duration=e.duration||m,this._currentState=n({},e.from||this.get()),this._originalState=this.get(),this._targetState=n({},e.to||this.get());var t=this;this._timeoutHandler=function(){l(t,t._timestamp,t._delay,t._duration,t._currentState,t._originalState,t._targetState,t._easing,t._step,t._scheduleFunction)};var r=this._currentState,s=this._targetState;return i(s,r),this._easing=c(r,e.easing||p),this._filterArgs=[r,this._originalState,s,this._easing],u(this,"tweenCreated"),this},h.prototype.get=function(){return n({},this._currentState)},h.prototype.set=function(e){this._currentState=e},h.prototype.pause=function(){return this._pausedAtTime=w(),this._isPaused=!0,this},h.prototype.resume=function(){return this._isPaused&&(this._timestamp+=w()-this._pausedAtTime),this._isPaused=!1,this._isTweening=!0,this._timeoutHandler(),this},h.prototype.seek=function(e){e=Math.max(e,0);var t=w();return this._timestamp+e===0?this:(this._timestamp=t-e,this.isPlaying()||(this._isTweening=!0,this._isPaused=!1,l(this,this._timestamp,this._delay,this._duration,this._currentState,this._originalState,this._targetState,this._easing,this._step,this._scheduleFunction,t),this.pause()),this)},h.prototype.stop=function(e){
  return this._isTweening=!1,this._isPaused=!1,this._timeoutHandler=a,(t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.oCancelAnimationFrame||t.msCancelAnimationFrame||t.mozCancelRequestAnimationFrame||t.clearTimeout)(this._scheduleId),e&&(u(this,"beforeTween"),s(1,this._currentState,this._originalState,this._targetState,1,0,this._easing),u(this,"afterTween"),u(this,"afterTweenEnd"),this._finish.call(this,this._currentState,this._attachment)),this},h.prototype.isPlaying=function(){return this._isTweening&&!this._isPaused},h.prototype.setScheduleFunction=function(e){this._scheduleFunction=e},h.prototype.dispose=function(){var e;for(e in this)this.hasOwnProperty(e)&&delete this[e]},h.prototype.filter={},h.prototype.formula={linear:function(e){return e}},d=h.prototype.formula,n(h,{now:w,each:r,tweenProps:s,tweenProp:o,applyFilter:u,shallowCopy:n,defaults:i,composeEasingObject:c}),"function"==typeof SHIFTY_DEBUG_NOW&&(t.timeoutHandler=l),e.exports=h,h}();!function(){a.shallowCopy(a.prototype.formula,{easeInQuad:function(e){return Math.pow(e,2)},easeOutQuad:function(e){return-(Math.pow(e-1,2)-1)},easeInOutQuad:function(e){return(e/=.5)<1?.5*Math.pow(e,2):-.5*((e-=2)*e-2)},easeInCubic:function(e){return Math.pow(e,3)},easeOutCubic:function(e){return Math.pow(e-1,3)+1},easeInOutCubic:function(e){return(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2)},easeInQuart:function(e){return Math.pow(e,4)},easeOutQuart:function(e){return-(Math.pow(e-1,4)-1)},easeInOutQuart:function(e){return(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2)},easeInQuint:function(e){return Math.pow(e,5)},easeOutQuint:function(e){return Math.pow(e-1,5)+1},easeInOutQuint:function(e){return(e/=.5)<1?.5*Math.pow(e,5):.5*(Math.pow(e-2,5)+2)},easeInSine:function(e){return-Math.cos(e*(Math.PI/2))+1},easeOutSine:function(e){return Math.sin(e*(Math.PI/2))},easeInOutSine:function(e){return-.5*(Math.cos(Math.PI*e)-1)},easeInExpo:function(e){return 0===e?0:Math.pow(2,10*(e-1))},easeOutExpo:function(e){return 1===e?1:-Math.pow(2,-10*e)+1},easeInOutExpo:function(e){return 0===e?0:1===e?1:(e/=.5)<1?.5*Math.pow(2,10*(e-1)):.5*(-Math.pow(2,-10*--e)+2)},easeInCirc:function(e){return-(Math.sqrt(1-e*e)-1)},easeOutCirc:function(e){return Math.sqrt(1-Math.pow(e-1,2))},easeInOutCirc:function(e){return(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},easeOutBounce:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInBack:function(e){var t=1.70158;return e*e*((t+1)*e-t)},easeOutBack:function(e){var t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},easeInOutBack:function(e){var t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},elastic:function(e){return-1*Math.pow(4,-8*e)*Math.sin((6*e-1)*(2*Math.PI)/2)+1},swingFromTo:function(e){var t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},swingFrom:function(e){var t=1.70158;return e*e*((t+1)*e-t)},swingTo:function(e){var t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},bounce:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bouncePast:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?2-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?2-(7.5625*(e-=2.25/2.75)*e+.9375):2-(7.5625*(e-=2.625/2.75)*e+.984375)},easeFromTo:function(e){return(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2)},easeFrom:function(e){return Math.pow(e,4)},easeTo:function(e){return Math.pow(e,.25)}})}(),function(){function e(e,t,a,r,n,i){function s(e){return((f*e+p)*e+m)*e}function o(e){return((v*e+y)*e+w)*e}function u(e){return(3*f*e+2*p)*e+m}function l(e){return 1/(200*e)}function c(e,t){return o(d(e,t))}function h(e){return e>=0?e:0-e}function d(e,t){var a,r,n,i,o,l;for(n=e,l=0;l<8;l++){if(i=s(n)-e,h(i)<t)return n;if(o=u(n),h(o)<1e-6)break;n-=i/o}if(a=0,r=1,n=e,n<a)return a;if(n>r)return r;for(;a<r;){if(i=s(n),h(i-e)<t)return n;e>i?a=n:r=n,n=.5*(r-a)+a}return n}var f=0,p=0,m=0,v=0,y=0,w=0;return m=3*t,p=3*(r-t)-m,f=1-m-p,w=3*a,y=3*(n-a)-w,v=1-w-y,c(e,l(i))}function t(t,a,r,n){return function(i){return e(i,t,a,r,n,1)}}a.setBezierFunction=function(e,r,n,i,s){var o=t(r,n,i,s);return o.displayName=e,o.x1=r,o.y1=n,o.x2=i,o.y2=s,a.prototype.formula[e]=o},a.unsetBezierFunction=function(e){delete a.prototype.formula[e]}}(),function(){function e(e,t,r,n,i,s){return a.tweenProps(n,t,e,r,1,s,i)}var t=new a;t._filterArgs=[],a.interpolate=function(r,n,i,s,o){var u=a.shallowCopy({},r),l=o||0,c=a.composeEasingObject(r,s||"linear");t.set({});var h=t._filterArgs;h.length=0,h[0]=u,h[1]=r,h[2]=n,h[3]=c,a.applyFilter(t,"tweenCreated"),a.applyFilter(t,"beforeTween");var d=e(r,u,n,i,c,l);return a.applyFilter(t,"afterTween"),d}}(),function(e){function t(e,t){var a,r=[],n=e.length;for(a=0;a<n;a++)r.push("_"+t+"_"+a);return r}function a(e){var t=e.match(_);return t?(1===t.length||e.charAt(0).match(g))&&t.unshift(""):t=["",""],t.join(k)}function r(t){e.each(t,function(e){var a=t[e];"string"==typeof a&&a.match(P)&&(t[e]=n(a))})}function n(e){return u(P,e,i)}function i(e){var t=s(e);return"rgb("+t[0]+","+t[1]+","+t[2]+")"}function s(e){return e=e.replace(/#/,""),3===e.length&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),R[0]=o(e.substr(0,2)),R[1]=o(e.substr(2,2)),R[2]=o(e.substr(4,2)),R}function o(e){return parseInt(e,16)}function u(e,t,a){var r=t.match(e),n=t.replace(e,k);if(r)for(var i,s=r.length,o=0;o<s;o++)i=r.shift(),n=n.replace(k,a(i));return n}function l(e){return u(b,e,c)}function c(e){for(var t=e.match(E),a=t.length,r=e.match(x)[0],n=0;n<a;n++)r+=parseInt(t[n],10)+",";return r=r.slice(0,-1)+")"}function h(r){var n={};return e.each(r,function(e){var i=r[e];if("string"==typeof i){var s=y(i);n[e]={formatString:a(i),chunkNames:t(s,e)}}}),n}function d(t,a){e.each(a,function(e){for(var r=t[e],n=y(r),i=n.length,s=0;s<i;s++)t[a[e].chunkNames[s]]=+n[s];delete t[e]})}function f(t,a){e.each(a,function(e){var r=t[e],n=p(t,a[e].chunkNames),i=m(n,a[e].chunkNames);r=v(a[e].formatString,i),t[e]=l(r)})}function p(e,t){for(var a,r={},n=t.length,i=0;i<n;i++)a=t[i],r[a]=e[a],delete e[a];return r}function m(e,t){C.length=0;for(var a=t.length,r=0;r<a;r++)C.push(e[t[r]]);return C}function v(e,t){for(var a=e,r=t.length,n=0;n<r;n++)a=a.replace(k,+t[n].toFixed(4));return a}function y(e){return e.match(E)}function w(t,a){e.each(a,function(e){var r,n=a[e],i=n.chunkNames,s=i.length,o=t[e];if("string"==typeof o){var u=o.split(" "),l=u[u.length-1];for(r=0;r<s;r++)t[i[r]]=u[r]||l}else for(r=0;r<s;r++)t[i[r]]=o;delete t[e]})}function T(t,a){e.each(a,function(e){var r=a[e],n=r.chunkNames,i=n.length,s=t[n[0]],o=typeof s;if("string"===o){for(var u="",l=0;l<i;l++)u+=" "+t[n[l]],delete t[n[l]];t[e]=u.substr(1)}else t[e]=s})}var g=/(\d|\-|\.)/,_=/([^\-0-9\.]+)/g,E=/[0-9.\-]+/g,b=new RegExp("rgb\\("+E.source+/,\s*/.source+E.source+/,\s*/.source+E.source+"\\)","g"),x=/^.*\(/,P=/#([0-9]|[a-f]){3,6}/gi,k="VAL",R=[],C=[];e.prototype.filter.token={tweenCreated:function(e,t,a,n){r(e),r(t),r(a),this._tokenData=h(e)},beforeTween:function(e,t,a,r){w(r,this._tokenData),d(e,this._tokenData),d(t,this._tokenData),d(a,this._tokenData)},afterTween:function(e,t,a,r){f(e,this._tokenData),f(t,this._tokenData),f(a,this._tokenData),T(r,this._tokenData)}}}(a)}).call(null)},function(e,t){function a(e,t,r){e=e||{},t=t||{},r=r||!1;for(var n in t)if(t.hasOwnProperty(n)){var i=e[n],s=t[n];r&&c(i)&&c(s)?e[n]=a(i,s,r):e[n]=s}return e}function r(e,t){var a=e;for(var r in t)if(t.hasOwnProperty(r)){var n=t[r],i="\\{"+r+"\\}",s=new RegExp(i,"g");a=a.replace(s,n)}return a}function n(e,t,a){for(var r=e.style,n=0;n<p.length;++n){var i=p[n];r[i+s(t)]=a}r[t]=a}function i(e,t){h(t,function(t,a){null!==t&&void 0!==t&&(c(t)&&t.prefix===!0?n(e,a,t.value):e.style[a]=t)})}function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function o(e){return"string"==typeof e||e instanceof String}function u(e){return"function"==typeof e}function l(e){return"[object Array]"===Object.prototype.toString.call(e)}function c(e){if(l(e))return!1;var t=typeof e;return"object"===t&&!!e}function h(e,t){for(var a in e)if(e.hasOwnProperty(a)){var r=e[a];t(r,a)}}function d(e,t){return Math.abs(e-t)<m}function f(e){for(;e.firstChild;)e.removeChild(e.firstChild)}var p="Webkit Moz O ms".split(" "),m=.001;e.exports={extend:a,render:r,setStyle:n,setStyles:i,capitalize:s,isString:o,isFunction:u,isObject:c,forEachObject:h,floatEquals:d,removeChildren:f}},function(e,t,a){var r=a(10),n=a(13),i=function(e,t){this._pathTemplate="M 50,50 m 0,-{radius} a {radius},{radius} 0 1 1 0,{2radius} a {radius},{radius} 0 1 1 0,-{2radius}",this.containerAspectRatio=1,r.apply(this,arguments)};i.prototype=new r,i.prototype.constructor=i,i.prototype._pathString=function(e){var t=e.strokeWidth;e.trailWidth&&e.trailWidth>e.strokeWidth&&(t=e.trailWidth);var a=50-t/2;return n.render(this._pathTemplate,{radius:a,"2radius":2*a})},i.prototype._trailString=function(e){return this._pathString(e)},e.exports=i},function(e,t,a){var r=a(10),n=a(14),i=a(13),s=function(e,t){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius} 0 1 1 {2radius},0",this.containerAspectRatio=2,r.apply(this,arguments)};s.prototype=new r,s.prototype.constructor=s,s.prototype._initializeSvg=function(e,t){e.setAttribute("viewBox","0 0 100 50")},s.prototype._initializeTextContainer=function(e,t,a){e.text.style&&(a.style.top="auto",a.style.bottom="0",e.text.alignToBottom?i.setStyle(a,"transform","translate(-50%, 0)"):i.setStyle(a,"transform","translate(-50%, 50%)"))},s.prototype._pathString=n.prototype._pathString,s.prototype._trailString=n.prototype._trailString,e.exports=s},function(e,t){THREE.DDSLoader=function(){this._parser=THREE.DDSLoader.parse},THREE.DDSLoader.prototype=Object.create(THREE.CompressedTextureLoader.prototype),THREE.DDSLoader.prototype.constructor=THREE.DDSLoader,THREE.DDSLoader.parse=function(e,t){function a(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function r(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}function n(e,t,a,r){for(var n=a*r*4,i=new Uint8Array(e,t,n),s=new Uint8Array(n),o=0,u=0,l=0;l<r;l++)for(var c=0;c<a;c++){var h=i[u];u++;var d=i[u];u++;var f=i[u];u++;var p=i[u];u++,s[o]=f,o++,s[o]=d,o++,s[o]=h,o++,s[o]=p,o++}return s}var i={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},s=542327876,o=131072,u=512,l=1024,c=2048,h=4096,d=8192,f=16384,p=32768,m=4,v=a("DXT1"),y=a("DXT3"),w=a("DXT5"),T=a("ETC1"),g=31,_=0,E=1,b=2,x=3,P=4,k=7,R=20,C=21,D=22,M=23,S=24,H=25,B=26,O=28,A=new Int32Array(e,0,g);if(A[_]!==s)return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),i;if(!A[R]&m)return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),i;var F,L=A[C],j=!1;switch(L){case v:F=8,i.format=THREE.RGB_S3TC_DXT1_Format;break;case y:F=16,i.format=THREE.RGBA_S3TC_DXT3_Format;break;case w:F=16,i.format=THREE.RGBA_S3TC_DXT5_Format;break;case T:F=8,i.format=THREE.RGB_ETC1_Format;break;default:if(!(32===A[D]&&16711680&A[M]&&65280&A[S]&&255&A[H]&&4278190080&A[B]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",r(L)),i;j=!0,F=64,i.format=THREE.RGBAFormat}i.mipmapCount=1,A[b]&o&&t!==!1&&(i.mipmapCount=Math.max(1,A[k]));var V=A[O];if(i.isCubemap=!!(V&u),i.isCubemap&&(!(V&l)||!(V&c)||!(V&h)||!(V&d)||!(V&f)||!(V&p)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),i;i.width=A[P],i.height=A[x];for(var N=A[E]+4,z=i.isCubemap?6:1,I=0;I<z;I++)for(var U=i.width,W=i.height,Y=0;Y<i.mipmapCount;Y++){if(j)var q=n(e,N,U,W),G=q.length;else var G=Math.max(4,U)/4*Math.max(4,W)/4*F,q=new Uint8Array(e,N,G);var X={data:q,width:U,height:W};i.mipmaps.push(X),N+=G,U=Math.max(U>>1,1),W=Math.max(W>>1,1)}return i}},function(e,t){THREE.PVRLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this._parser=THREE.PVRLoader.parse},THREE.PVRLoader.prototype=Object.create(THREE.CompressedTextureLoader.prototype),THREE.PVRLoader.prototype.constructor=THREE.PVRLoader,THREE.PVRLoader.parse=function(e,t){var a=13,r=new Uint32Array(e,0,a),n={buffer:e,header:r,loadMipmaps:t};if(55727696===r[0])return THREE.PVRLoader._parseV3(n);if(559044176===r[11])return THREE.PVRLoader._parseV2(n);throw new Error("[THREE.PVRLoader] Unknown PVR format")},THREE.PVRLoader._parseV3=function(e){var t,a,r=e.header,n=r[12],i=r[2],s=r[6],o=r[7],u=(r[9],r[10]),l=r[11];switch(i){case 0:t=2,a=THREE.RGB_PVRTC_2BPPV1_Format;break;case 1:t=2,a=THREE.RGBA_PVRTC_2BPPV1_Format;break;case 2:t=4,a=THREE.RGB_PVRTC_4BPPV1_Format;break;case 3:t=4,a=THREE.RGBA_PVRTC_4BPPV1_Format;break;default:throw new Error("pvrtc - unsupported PVR format "+i)}return e.dataPtr=52+n,e.bpp=t,e.format=a,e.width=o,e.height=s,e.numSurfaces=u,e.numMipmaps=l,e.isCubemap=6===u,THREE.PVRLoader._extract(e)},THREE.PVRLoader._parseV2=function(e){var t,a,r=e.header,n=r[0],i=r[1],s=r[2],o=r[3],u=r[4],t=(r[5],r[6]),l=(r[7],r[8],r[9],r[10]),c=(r[11],r[12]),h=255,d=24,f=25,p=u&h,m=l>0;if(p===f)a=m?THREE.RGBA_PVRTC_4BPPV1_Format:THREE.RGB_PVRTC_4BPPV1_Format,t=4;else{if(p!==d)throw new Error("pvrtc - unknown format "+p);a=m?THREE.RGBA_PVRTC_2BPPV1_Format:THREE.RGB_PVRTC_2BPPV1_Format,t=2}return e.dataPtr=n,e.bpp=t,e.format=a,e.width=s,e.height=i,e.numSurfaces=c,e.numMipmaps=o+1,e.isCubemap=6===c,THREE.PVRLoader._extract(e)},THREE.PVRLoader._extract=function(e){var t={mipmaps:[],width:e.width,height:e.height,format:e.format,mipmapCount:e.numMipmaps,isCubemap:e.isCubemap},a=e.buffer,r=e.dataPtr,n=e.bpp,i=e.numSurfaces,s=0,o=0,u=0,l=0,c=0,h=0;2===n?(u=8,l=4):(u=4,l=4),o=u*l*n/8,t.mipmaps.length=e.numMipmaps*i;for(var d=0;d<e.numMipmaps;){var f=e.width>>d,p=e.height>>d;c=f/u,h=p/l,c<2&&(c=2),h<2&&(h=2),s=c*h*o;for(var m=0;m<i;m++){var v=new Uint8Array(a,r,s),y={data:v,width:f,height:p};t.mipmaps[m*e.numMipmaps+d]=y,r+=s}d++}return t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={assets:[{name:"backTex",type:"texture",path:"assets/textures/background.png"},{name:"trackTex",type:"texture",path:"assets/textures/road.png"},{name:"numbersTex",type:"texture",path:"assets/textures/numbers.png"},{name:"iconAttackTex",type:"texture",path:"assets/textures/icon_attack.png"},{name:"iconBlueTex",type:"texture",path:"assets/textures/icon_blue.png"},{name:"iconRedTex",type:"texture",path:"assets/textures/icon_red.png"},{name:"towerTex",type:"texture",path:"assets/textures/tower.png"},{name:"towerRedTex",type:"texture",path:"assets/textures/tower_fire.png"},{name:"towerBlueTex",type:"texture",path:"assets/textures/tower_ice.png"},{name:"castleProgressTex",type:"texture",path:"assets/textures/castle_progress.png"},{name:"castleProgressHandlerTex",type:"texture",path:"assets/textures/castle_progress_handler.png"},{name:"cardBackTex",type:"texture",path:"assets/textures/card_back.png"},{name:"endButtonTex",type:"texture",path:"assets/textures/button_end.png"},{name:"randomButtonTex",type:"texture",path:"assets/textures/button_change.png"},{name:"redUnitTex",type:"texture",path:"assets/textures/soldier_red.png"},{name:"blueUnitTex",type:"texture",path:"assets/textures/soldier_blue.png"}],model:{children:[]}};t.default=a},function(e,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),n=function(){function e(t){a(this,e),this.mesh=new THREE.Object3D,this.mesh.name="env_root",this.mesh.add(this._createBack(t.textures.backTex)),this.mesh.add(this._createShuffleButton(t.textures.randomButtonTex)),this.mesh.add(this._createEndButton(t.textures.endButtonTex))}return r(e,[{key:"_createBack",value:function(e){var t=new THREE.PlaneBufferGeometry(.563,1),a=new THREE.MeshBasicMaterial({map:e}),r=new THREE.Mesh(t,a);return r}},{key:"_createShuffleButton",value:function(e){var t=new THREE.PlaneBufferGeometry(.11,.11),a=new THREE.MeshBasicMaterial({map:e,transparent:!0});return this.shuffleButton=new THREE.Mesh(t,a),this.shuffleButton.name="shuffle_button",this.shuffleButton.userData.defaultColor=new THREE.Color(16777215),this.shuffleButton.userData.selectedColor=new THREE.Color(13434828),this.shuffleButton.userData.inactiveColor=new THREE.Color(7829367),this.shuffleButton.position.x=-.228,this.shuffleButton.position.y=-.25,this.shuffleButton.position.z=1.8,this.shuffleButton}},{key:"_createEndButton",value:function(e){var t=new THREE.PlaneBufferGeometry(.11,.11),a=new THREE.MeshBasicMaterial({map:e,transparent:!0});return this.endButton=new THREE.Mesh(t,a),this.endButton.name="end_button",this.endButton.userData.defaultColor=new THREE.Color(16777215),this.endButton.userData.selectedColor=new THREE.Color(13434828),this.endButton.userData.inactiveColor=new THREE.Color(7829367),this.endButton.position.x=.228,this.endButton.position.y=-.25,this.endButton.position.z=1.8,this.endButton}}]),e}();t.default=n},function(e,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),n=.02,i=.04,s=.06,o=[[[0,0]],[[-n,0],[n,0]],[[-n,-n],[n,-n],[0,n]],[[-n,-n],[n,-n],[-n,n],[n,n]],[[-i,-n],[0,-n],[i,-n],[-n,n],[n,n]],[[-i,-n],[0,-n],[i,-n],[-i,n],[0,n],[i,n]],[[-i,-i],[0,-i],[i,-i],[-i,0],[0,0],[i,0],[0,i]],[[-i,-i],[0,-i],[i,-i],[-i,0],[0,0],[i,0],[-n,i],[n,i]],[[-i,-i],[0,-i],[i,-i],[-i,0],[0,0],[i,0],[-i,i],[0,i],[i,i]],[[-s,-i],[-n,-i],[n,-i],[s,-i],[-s,0],[-n,0],[n,0],[s,0],[-n,i],[n,i]]],u=function(){function e(t){a(this,e),this.mesh=new THREE.Object3D,this.mesh.name="tracks_root",t.textures.trackTex.minFilter=THREE.NearestFilter,t.textures.trackTex.magFilter=THREE.NearestFilter;for(var r=0;r<3;++r){var n=this._createTrack(t.textures.trackTex);n.position.x=.184*r-.184,n.position.y=.1,n.userData.index=r,this.mesh.add(n)}this._assets=t}return r(e,[{key:"_createTrack",value:function(e){var t=new THREE.PlaneBufferGeometry(.175,.46),a=new THREE.MeshBasicMaterial({map:e,transparent:!0}),r=new THREE.Mesh(t,a);return r.userData.defaultColor=new THREE.Color(16777215),r.userData.selectedColor=new THREE.Color(11162965),r.position.z=.1,r}},{key:"clearTracks",value:function(){this.mesh.children.forEach(function(e){for(var t=e.children.length-1;t>=0;--t)e.remove(e.children[t])})}},{key:"_createUnitSoldier",value:function(e){var t="red"===e?"redUnitTex":"blueUnitTex",a=this._assets.textures[t],r=new THREE.PlaneBufferGeometry(.04,.04),n=new THREE.MeshBasicMaterial({map:a,transparent:!0});return new THREE.Mesh(r,n)}},{key:"createUnit",value:function(e,t){for(var a=new THREE.Object3D,r=0;r<e;++r){var n=this._createUnitSoldier(t);n.position.x=o[e-1][r][0],n.position.y=o[e-1][r][1],a.add(n)}return a}},{key:"spawnUnitOnTrack",value:function(e,t,a){var r=this.mesh.children[t],n=this.createUnit(a.damage,a.color);n.userData.friendly=e;var i="red"===a.color?1:-1;n.userData.damage=a.damage*i,n.position.y=n.userData.friendly?-.093:.093,r.add(n)}},{key:"hasUnitOnTrack",value:function(e,t){return!!this.getUnitOnTrack(e,t)}},{key:"getUnitOnTrack",value:function(e,t){for(var a=this.mesh.children[t],r=0;r<a.children.length;++r)if(a.children[r].userData.friendly===e)return a.children[r];return null}},{key:"_spawnResolvedUnit",value:function(e,t,a){var r=a>0?"red":"blue",n=this.createUnit(Math.abs(a),r);n.userData.friendly=e,n.position.y=n.userData.friendly?.09:-.09,this.mesh.children[t].add(n)}},{key:"applyDamageOnTrack",value:function(e){var t=this.getUnitOnTrack(!0,e),a=this.getUnitOnTrack(!1,e),r=t?t.userData.damage:0,n=a?a.userData.damage:0;t&&t.parent.remove(t),a&&a.parent.remove(a);var i=null,s=Math.abs(r)-Math.abs(n);if(0!==s)if(s>0){var o=s*Math.sign(r);this._spawnResolvedUnit(!0,e,o),i={playerWon:!0,damage:o}}else{var u=-s*Math.sign(n);this._spawnResolvedUnit(!1,e,u),i={playerWon:!1,damage:u}}return i}}]),e}();t.default=u},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),s=a(5),o=r(s),u=a(3),l=r(u),c=a(22),h=r(c),d=a(23),f=r(d),p=a(24),m=r(p),v=[[-.188,-.12],[0,-.12],[.188,-.12]],y=[[-.188,.35],[0,.35],[.188,.35]],w=.32,T=.032,g=.1,_=.2,E=function(){function e(t){n(this,e),this._assets=t,t.textures.towerTex.minFilter=THREE.NearestFilter,t.textures.towerTex.magFilter=THREE.NearestFilter,t.textures.towerRedTex.minFilter=THREE.NearestFilter,t.textures.towerRedTex.magFilter=THREE.NearestFilter,t.textures.towerBlueTex.minFilter=THREE.NearestFilter,t.textures.towerBlueTex.magFilter=THREE.NearestFilter,this.mesh=new THREE.Object3D,this.mesh.name="towers_root",this._friendlyTemperatures=[],this._enemyTemperatures=[],this._friendlyTowers=[],this._enemyTowers=[],this._fadingDamageArr=[];for(var a=0;a<v.length;++a){var r=this._createTower();r.position.x=v[a][0],r.position.y=v[a][1],this.mesh.add(r),this._friendlyTowers.push(r),this._friendlyTemperatures[a]=new h.default(this._assets).setSize(.05).setValue(0),this._friendlyTemperatures[a].mesh.position.x=-.002,this._friendlyTemperatures[a].mesh.position.y=-.044,r.add(this._friendlyTemperatures[a].mesh)}for(var i=0;i<y.length;++i){var s=this._createTower();s.position.x=y[i][0],s.position.y=y[i][1],this.mesh.add(s),this._enemyTowers.push(s),this._enemyTemperatures[i]=new h.default(this._assets).setSize(.05).setValue(0),this._enemyTemperatures[i].mesh.position.x=-.002,this._enemyTemperatures[i].mesh.position.y=-.044,s.add(this._enemyTemperatures[i].mesh)}var o=this._createTermometer(t.textures.castleProgressTex,w,T);o.position.y=-.26,this.mesh.add(o),this._friendlyT=this._createTermometerHandler(),this._friendlyT.position.y=-.245,this.mesh.add(this._friendlyT);var u=this._createTermometer(t.textures.castleProgressTex,w,T);u.position.y=.45,this.mesh.add(u),this._enemyT=this._createTermometerHandler(),this._enemyT.position.y=.465,this.mesh.add(this._enemyT)}return i(e,[{key:"setTowerTemperature",value:function(e,t,a){var r=e?this._friendlyTemperatures:this._enemyTemperatures;r[t].setValue(a);for(var n=e?this._friendlyTowers:this._enemyTowers,i=n[t],s=0,o=0;o<l.default.game.burn.length;++o)Math.abs(a)>l.default.game.burn[o].t&&(s=o+1);s*=Math.sign(a),s!==i.userData.lastBurnStage&&this._setTowerBurnStage(i,s)}},{key:"_setTowerBurnStage",value:function(e,t){0===t?(e.material.uniforms.map.value=this._assets.textures.towerTex,e.material.uniforms.scaleX.value=1,e.material.uniforms.scaleY.value=1,e.material.uniforms.quadNumber.value=0):(e.material.uniforms.map.value=t>0?this._assets.textures.towerRedTex:this._assets.textures.towerBlueTex,e.material.uniforms.scaleX.value=3,e.material.uniforms.scaleY.value=3,e.userData.startQuadNumber=3*(Math.abs(t)-1),e.userData.quadOffset=0,e.userData.lastAnimUpdateTime=l.default.time,e.material.uniforms.quadNumber.value=e.userData.startQuadNumber+e.userData.quadOffset),e.userData.lastBurnStage=t}},{key:"updatePlayerTemperatures",value:function(){this._friendlyT.position.x=o.default.playerT/l.default.game.maxT*w/2,this._enemyT.position.x=o.default.enemyT/l.default.game.maxT*w/2}},{key:"showFadingDamage",value:function(e,t,a){var r=new h.default(this._assets).setSize(.03).setUseBrightColor(!0).setValue(a),n=e?this._friendlyTemperatures:this._enemyTemperatures;r.mesh.userData.startTime=l.default.time,r.mesh.userData.endTime=l.default.time+l.default.fadeDuration,r.mesh.userData.startY=.004,r.mesh.userData.endY=.06,r.mesh.position.x=.072,r.mesh.position.y=r.mesh.userData.startY,n[t].mesh.parent.add(r.mesh),this._fadingDamageArr.push(r)}},{key:"update",value:function(){for(var e=this._fadingDamageArr.length-1;e>=0;--e){var t=this._fadingDamageArr[e];if(l.default.time>t.mesh.userData.endTime)t.mesh.parent.remove(t.mesh),this._fadingDamageArr.splice(e,1);else{var a=(l.default.time-t.mesh.userData.startTime)/(t.mesh.userData.endTime-t.mesh.userData.startTime);t.setOpacity(1-a*a*a),t.mesh.position.y=t.mesh.userData.startY+a*(t.mesh.userData.endY-t.mesh.userData.startY)}}for(var r=0;r<3;++r)this._updateBurnAnim(this._friendlyTowers[r]),this._updateBurnAnim(this._enemyTowers[r])}},{key:"_updateBurnAnim",value:function(e){if(0!==e.userData.lastBurnStage){var t=e.userData.lastBurnStage>0?g:_;l.default.time-e.userData.lastAnimUpdateTime<t||(e.userData.quadOffset+=1,e.userData.quadOffset>2&&(e.userData.quadOffset=0),e.material.uniforms.quadNumber.value=e.userData.startQuadNumber+e.userData.quadOffset,e.userData.lastAnimUpdateTime=l.default.time)}}},{key:"_createTower",value:function(){var e={scaleX:{value:1},scaleY:{value:1},quadNumber:{value:0},color:{value:new THREE.Vector3(1,1,1)},opacity:{value:1},map:{value:this._assets.textures.towerTex}},t=new THREE.RawShaderMaterial({vertexShader:f.default,fragmentShader:m.default,uniforms:e,transparent:!0}),a=new THREE.Mesh(new THREE.PlaneBufferGeometry(.188,.188),t);return a.position.z=1,a.userData.lastBurnStage=0,a}},{key:"_createTermometer",value:function(e,t,a){var r=new THREE.Mesh(new THREE.PlaneBufferGeometry(t,a),new THREE.MeshBasicMaterial({map:e,transparent:!0}));return r.position.z=.2,r}},{key:"_createTermometerHandler",value:function(){var e=new THREE.Mesh(new THREE.PlaneBufferGeometry(.04,.04),new THREE.MeshBasicMaterial({map:this._assets.textures.castleProgressHandlerTex,transparent:!0}));return e.position.z=.3,e}}]),e}();t.default=E},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),s=a(23),o=r(s),u=a(24),l=r(u),c=new THREE.Vector3(.8,.2,.2),h=new THREE.Vector3(.3,.3,.9),d=new THREE.Vector3(.9,.9,.9),f=new THREE.Vector3(.9,0,0),p=new THREE.Vector3(0,0,.9),m=function(){function e(t){n(this,e),this._assets=t,this.useBrightColor=!1,this.mesh=new THREE.Object3D,this.mesh.position.z=.3}return i(e,[{key:"setSize",value:function(e){return this.mesh.scale.x=e,this.mesh.scale.y=e,this}},{key:"setOpacity",value:function(e){return this.mesh.children.forEach(function(t){t.material.uniforms.opacity.value=e}),this}},{key:"setUseBrightColor",value:function(e){return this.useBrightColor=e,this}},{key:"setValue",value:function(e){for(var t=this.mesh.children.length-1;t>=0;--t)this.mesh.remove(this.mesh.children[t]);var a=e>0?c:e<0?h:d;this.useBrightColor&&(e>0?a=f:e<0&&(a=p));var r=Math.abs(e),n=r<10;if(n){var i=this._createVisual(r,a);this.mesh.add(i)}else{var s=Math.floor(r/10),o=r-10*s,u=this._createVisual(s,a);u.position.x=-.3,this.mesh.add(u);var l=this._createVisual(o,a);l.position.x=.3,this.mesh.add(l)}return this}},{key:"_createVisual",value:function(e,t){var a=new THREE.PlaneBufferGeometry(1,1),r={scaleX:{value:5},scaleY:{value:2},quadNumber:{value:e},color:{value:t},opacity:{value:1},map:{value:this._assets.textures.numbersTex}},n=new THREE.RawShaderMaterial({vertexShader:o.default,fragmentShader:l.default,uniforms:r,transparent:!0}),i=new THREE.Mesh(a,n);return i}}]),e}();t.default=m},function(e,t){e.exports="precision highp float;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nuniform float scaleX;\nuniform float scaleY;\nuniform float quadNumber;\n\nvarying vec2 vUv;\n\nvoid main() {\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n    float y = floor(quadNumber / scaleX + 0.1);\n    float x = quadNumber - scaleX * y;\n    vUv = (uv + vec2(x, y)) / vec2(scaleX, scaleY);\n}\n"},function(e,t){e.exports="precision highp float;\n\nvarying vec2 vUv;\nuniform sampler2D map;\nuniform vec3 color;\nuniform float opacity;\n\nvoid main() {\n    gl_FragColor = texture2D(map, vUv);\n    gl_FragColor.rgb *= color;\n    gl_FragColor.a *= opacity;\n}\n"},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),s=a(22),o=r(s),u=[[-.21,-.395],[-.21+.14,-.395],[-.21+.28,-.395],[.21,-.395]],l=function(){function e(t,a){n(this,e),this.mesh=new THREE.Object3D,this.mesh.name="cards_root";for(var r=0;r<u.length;++r){var i=this._createCard(a.textures.cardBackTex);i.position.x=u[r][0],i.position.y=u[r][1],i.userData.friendly=!0,i.userData.index=r,i.userData.initPosX=i.position.x,i.userData.initPosY=i.position.y,i.position.z=2,this.mesh.add(i)}this._tracks=t,this._assets=a}return i(e,[{key:"_createCard",value:function(e){var t=new THREE.PlaneBufferGeometry(.124,.17),a=new THREE.MeshBasicMaterial({map:e,transparent:!0}),r=new THREE.Mesh(t,a);return r}},{key:"_createIcon",value:function(e){var t=new THREE.PlaneBufferGeometry(.02,.02),a=new THREE.MeshBasicMaterial({map:e,transparent:!0}),r=new THREE.Mesh(t,a);return r}},{key:"updatePlayerCard",value:function(e,t){var a=this;this.mesh.children.forEach(function(r){if(r.userData.index===e){for(var n=r.children.length-1;n>=0;--n)r.remove(r.children[n]);var i="red"===t.color?1:-1,s=new o.default(a._assets).setSize(.07).setValue(t.damage*i);s.mesh.position.y=.015,r.add(s.mesh);var u=a._createIcon("red"===t.color?a._assets.textures.iconRedTex:a._assets.textures.iconBlueTex);u.position.x=-.016,u.position.y=-.058,r.add(u);var l=new o.default(a._assets).setSize(.023).setValue(t.price);l.mesh.position.x=.014,l.mesh.position.y=-.058,r.add(l.mesh),r.visible=!0}})}},{key:"hideCard",value:function(e){this.mesh.children.forEach(function(t){t.userData.index===e&&(t.visible=!1)})}}]),e}();t.default=l},function(e,t,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),s=a(5),o=r(s),u=function(){function e(t){n(this,e),this.context=t}return i(e,[{key:"makeTurn",value:function(){for(var e=this,t=o.default.enemyHand,a=o.default.towersT[1],r=this.sortedTowersIndexes(a),n=function(n){var i=r[n];setTimeout(function(){var r=e.chooseCard(a[i],t);e.context.playCard(!1,r,i)},500*(n+1))},i=0;i<3;++i)n(i);setTimeout(function(){e.context.nextPhase()},2e3)}},{key:"sortedTowersIndexes",value:function(e){var t=e.slice(),a=[];return t.forEach(function(e,t){a[t]={index:t,value:e}}),a.sort(function(e,t){return Math.abs(t.value)-Math.abs(e.value)}),[a[0].index,a[1].index,a[2].index]}},{key:"chooseCard",value:function(e,t){for(var a=[],r=0;r<Object.keys(t).length;r++)null!==t[r]?a[r]=Math.abs(e+t[r].price):a[r]=1e3;
  return a.indexOf(Math.min.apply(Math,a))}}]),e}();t.default=u},function(e,t){"use strict";function a(){return r[Math.floor(Math.random()*r.length)]}Object.defineProperty(t,"__esModule",{value:!0}),t.generateCard=a;var r=[{id:0,color:"red",damage:2,price:1},{id:1,color:"red",damage:4,price:2},{id:2,color:"red",damage:6,price:3},{id:3,color:"red",damage:8,price:4},{id:4,color:"red",damage:10,price:5},{id:5,color:"blue",damage:2,price:-1},{id:6,color:"blue",damage:4,price:-2},{id:7,color:"blue",damage:6,price:-3},{id:8,color:"blue",damage:8,price:-4},{id:9,color:"blue",damage:10,price:-5}]},function(e,t){"use strict";e.exports=function(){if(window.WebGLRenderingContext){for(var e=document.createElement("canvas"),t=["webgl","experimental-webgl","moz-webgl"],a=!1,r=0;r<t.length;r++)try{if(a=e.getContext(t[r]),a&&"function"==typeof a.getParameter)return!0}catch(e){console.log("Unable to initialize WebGL. Your browser may not support it.")}return!1}return!1}}]);