(this.webpackJsonpfacility=this.webpackJsonpfacility||[]).push([[0],{11:function(e,t,a){e.exports=a(19)},16:function(e,t,a){},18:function(e,t,a){},19:function(e,t,a){"use strict";a.r(t);var n=a(0),i=a.n(n),r=a(10),o=a.n(r),s=(a(16),a(1)),u=a.n(s),l=a(4),c=a(2),d=a(3),m=a(6),p=a(5),g=a(7),h=(a(9),function(e){function t(e){var a;return Object(c.a)(this,t),(a=Object(m.a)(this,Object(p.a)(t).call(this,e))).myRef=i.a.createRef(),a}return Object(g.a)(t,e),Object(d.a)(t,[{key:"render",value:function(){var e=this;return i.a.createElement("div",{className:"card two-column cityCard"},i.a.createElement("div",null,this.props.messages.CityCard.render.cityID),i.a.createElement("div",null,this.props.counter.substring(0,8)),i.a.createElement("div",null,this.props.messages.CityCard.render.cityName),i.a.createElement("div",null,this.props.cityName),i.a.createElement("div",null,this.props.messages.CityCard.render.population),i.a.createElement("div",null,this.props.cityPopulation),i.a.createElement("div",null,this.props.messages.CityCard.render.location),i.a.createElement("div",null,this.props.messages.pojoStrings[this.props.cityHemisphere]),i.a.createElement("div",null,this.props.messages.CityCard.render.size),i.a.createElement("div",null,this.props.messages.pojoStrings[this.props.cityHowBig]),i.a.createElement("div",{className:"centered"},i.a.createElement("input",{type:"number",ref:this.myRef})),i.a.createElement("div",{className:"centered"},i.a.createElement("button",{onClick:function(){e.props.moveInHandler(e.props.counter,Number(e.myRef.current.value))}},this.props.messages.CityCard.render.moveIn)),i.a.createElement("div",{className:"centered"},i.a.createElement("button",{onClick:function(){e.props.moveOutHandler(e.props.counter,Number(e.myRef.current.value))}},this.props.messages.CityCard.render.moveOut)),i.a.createElement("div",{className:"centered"},i.a.createElement("div",{className:"cityCardCell"},i.a.createElement("button",{onClick:function(){e.props.pandemizeHandler(e.props.counter)}},this.props.messages.CityCard.render.pandemize))))}}]),t}(i.a.Component)),y=function(e){function t(){return Object(c.a)(this,t),Object(m.a)(this,Object(p.a)(t).apply(this,arguments))}return Object(g.a)(t,e),Object(d.a)(t,[{key:"render",value:function(){return i.a.createElement("div",{className:"card two-column controllerCard"},i.a.createElement("div",null,this.props.messages.CityInfoDisplay.render.mostNorthernCity),i.a.createElement("div",null,this.props.mostNorthern),i.a.createElement("div",null,this.props.messages.CityInfoDisplay.render.mostSouthernCity),i.a.createElement("div",null,this.props.mostSouthern),i.a.createElement("div",null,this.props.messages.CityInfoDisplay.render.totalPopulation),i.a.createElement("div",null,this.props.totalPopulation),i.a.createElement("div",{className:"wideColumnCentered infoMessage"},this.props.message))}}]),t}(i.a.Component),f=function(e){function t(e){var a;return Object(c.a)(this,t),(a=Object(m.a)(this,Object(p.a)(t).call(this,e))).randomize=Object(l.a)(u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.props.randomCity();case 2:a.cityNameRef.current.value=e.sent,a.cityPopulationRef.current.value=a.superRandom(1,1e5),a.cityLongitudeRef.current.value=a.superRandom(-180,180),a.cityLatitudeRef.current.value=a.superRandom(-90,90);case 6:case"end":return e.stop()}}),e)}))),a.cityNameRef=i.a.createRef(),a.cityPopulationRef=i.a.createRef(),a.cityLongitudeRef=i.a.createRef(),a.cityLatitudeRef=i.a.createRef(),a}return Object(g.a)(t,e),Object(d.a)(t,[{key:"superRandom",value:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}},{key:"render",value:function(){var e=this;return i.a.createElement("div",{className:"card two-column controllerCard"},i.a.createElement("div",null,this.props.messages.CityController.render.name),i.a.createElement("div",null,i.a.createElement("input",{type:"text",ref:this.cityNameRef})),i.a.createElement("div",null,this.props.messages.CityController.render.population),i.a.createElement("div",null,i.a.createElement("input",{type:"text",ref:this.cityPopulationRef})),i.a.createElement("div",null,this.props.messages.CityController.render.longitude),i.a.createElement("div",null,i.a.createElement("input",{type:"text",ref:this.cityLongitudeRef})),i.a.createElement("div",null,this.props.messages.CityController.render.latitude),i.a.createElement("div",null,i.a.createElement("input",{type:"text",ref:this.cityLatitudeRef})),i.a.createElement("div",null,i.a.createElement("button",{onClick:function(){e.randomize()}},this.props.messages.CityController.render.randomize)),i.a.createElement("div",null,i.a.createElement("button",{onClick:function(){e.props.addCityHandler(e.cityNameRef.current.value,Number(e.cityPopulationRef.current.value),Number(e.cityLongitudeRef.current.value),Number(e.cityLatitudeRef.current.value))}},this.props.messages.CityController.render.genesize)))}}]),t}(i.a.Component),C=function(e){function t(){return Object(c.a)(this,t),Object(m.a)(this,Object(p.a)(t).apply(this,arguments))}return Object(g.a)(t,e),Object(d.a)(t,[{key:"render",value:function(){return i.a.createElement("div",null,i.a.createElement("input",{id:this.props.language,type:"radio",name:"language",value:this.props.language,onClick:this.props.languageHandler,defaultChecked:this.props.currentLanguage===this.props.language}),i.a.createElement("label",{htmlFor:this.props.language},this.props.languageLabel),i.a.createElement("br",null))}}]),t}(i.a.Component),v=function(e){function t(){return Object(c.a)(this,t),Object(m.a)(this,Object(p.a)(t).apply(this,arguments))}return Object(g.a)(t,e),Object(d.a)(t,[{key:"render",value:function(){var e=this;return i.a.createElement("div",{className:"card two-column controllerCard"},i.a.createElement("div",{className:"wideColumnCentered"},"Settings"),Object.keys(this.props.messages).map((function(t){return i.a.createElement(C,{language:t,languageLabel:e.props.messages[t].languageLabel,languageHandler:e.props.languageHandler,key:t,currentLanguage:e.props.currentLanguage})})))}}]),t}(i.a.Component),b=function(){function e(t,a,n,i){return Object(c.a)(this,e),this.name=t,this.population=a>0?a:0,this.longitude=n<-180?-180:n>180?180:n,this.latitude=i<-90?-90:i>90?90:i,0}return Object(d.a)(e,[{key:"getName",value:function(){return this.name}},{key:"getPopulation",value:function(){return this.population}},{key:"getLongitude",value:function(){return this.longitude}},{key:"getLatitude",value:function(){return this.latitude}},{key:"whichHemisphere",value:function(){var e="Equator";return this.latitude>0?e="Northern Hemisphere":this.latitude<0&&(e="Southern Hemisphere"),e}},{key:"moveIn",value:function(e){e>0&&(this.population=this.population+e)}},{key:"moveOut",value:function(e){e>0&&e<=this.population&&(this.population=this.population-e)}},{key:"howBig",value:function(){return this.population<=100?"Hamlet":this.population<=1e3?"Village":this.population<=2e4?"Town":this.population<=1e5?"Large town":"City"}}]),e}(),N=function(){function e(){Object(c.a)(this,e),this.cities=[]}return Object(d.a)(e,[{key:"flush",value:function(){this.cities=[]}},{key:"addCity",value:function(e,t,a,n,i){var r=new b(e,t,a,n);return this.cities.push({city:r,counter:i}),i}},{key:"deleteCity",value:function(e){var t=this.cities.findIndex((function(t){return t.counter===e}));-1!==t&&this.cities.splice(t,1)}},{key:"getCity",value:function(e){return this.cities.find((function(t){return t.counter===e})).city}},{key:"getCityList",value:function(){return this.cities.map((function(e){return e.counter}))}},{key:"getMostNorthern",value:function(){var e=this.howManyCities(),t=null;if(e>0){var a=this.cities[0].city.getLatitude();t=this.cities[0].counter;for(var n=1;na&&(a=i,t=this.cities[n].counter)}}return t}},{key:"getMostSouthern",value:function(){var e=this.howManyCities(),t=null;if(e>0){var a=this.cities[0].city.getLatitude();t=this.cities[0].counter;for(var n=1;n0)){e.next=16;break}if(!(n>0&&Math.round(n)===n)){e.next=13;break}if(!(i<=180&&i>=-180&&r<=90&&r>=-90)){e.next=10;break}return e.next=5,a.fetchAddCity(t,n,i,r);case 5:return e.next=7,a.fetchAll();case 7:a.messageBuilder=function(){return a.parser(a.state.messages[a.state.language].CityComponent.addCityHandler.cityHasBeenCreated,t)},e.next=11;break;case 10:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.addCityHandler.weNeedValidCoordinates};case 11:e.next=14;break;case 13:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.addCityHandler.weNeedValidPopulation};case 14:e.next=17;break;case 16:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.addCityHandler.weNeedCityName};case 17:a.update();case 18:case"end":return e.stop()}}),e)})));return function(t,a,n,i){return e.apply(this,arguments)}}(),a.moveInHandler=function(){var e=Object(l.a)(u.a.mark((function e(t,n){var i,r;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.state.cities.getName(t),!(n>0)){e.next=16;break}if(Math.round(n)!==n){e.next=13;break}return a.messageBuilder=function(){return a.parser(a.state.messages[a.state.language].CityComponent.moveInHandler.tryingToEmerge,n,r)},a.update(),e.next=7,a.fetchMoveIn(t,n);case 7:return i=e.sent,a.messageBuilder=0===i?function(){return a.parser(a.state.messages[a.state.language].CityComponent.moveInHandler.emerged,n,r)}:function(){return a.parser(a.state.messages[a.state.language].CityComponent.moveInHandler.couldNotEmerge,n,r)},e.next=11,a.fetchAll();case 11:e.next=14;break;case 13:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.moveInHandler.noFractions};case 14:e.next=17;break;case 16:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.moveInHandler.noNegatives};case 17:a.update();case 18:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}}(),a.moveOutHandler=function(){var e=Object(l.a)(u.a.mark((function e(t,n){var i,r;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.state.cities.getName(t),!(n>0)){e.next=20;break}if(Math.round(n)!==n){e.next=17;break}if(!(n<=a.state.cities.getPopulation(t))){e.next=14;break}return a.messageBuilder=function(){return a.parser(a.state.messages[a.state.language].CityComponent.moveOutHandler.tryingToVanish,n,r)},a.update(),e.next=8,a.fetchMoveOut(t,n);case 8:return i=e.sent,a.messageBuilder=0===i?function(){return a.parser(a.state.messages[a.state.language].CityComponent.moveOutHandler.vanished,n,r)}:function(){return a.parser(a.state.messages[a.state.language].CityComponent.moveOutHandler.couldNotVanish,n,r)},e.next=12,a.fetchAll();case 12:e.next=15;break;case 14:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.moveOutHandler.noGhostCities};case 15:e.next=18;break;case 17:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.moveOutHandler.noFractions};case 18:e.next=21;break;case 20:a.messageBuilder=function(){return a.state.messages[a.state.language].CityComponent.moveOutHandler.noNegatives};case 21:a.update();case 22:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}}(),a.pandemizeHandler=function(){var e=Object(l.a)(u.a.mark((function e(t){var n,i;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.state.cities.getName(t),a.messageBuilder=function(){return a.parser(a.state.messages[a.state.language].CityComponent.pandemizeHandler.tryingToPandemize,n)},a.update(),e.next=5,a.fetchDelete(t);case 5:return i=e.sent,a.messageBuilder=0===i?function(){return a.parser(a.state.messages[a.state.language].CityComponent.pandemizeHandler.pandemized,n)}:function(){return a.parser(a.state.messages[a.state.language].CityComponent.pandemizeHandler.couldNotPandemize,n)},e.next=9,a.fetchAll();case 9:a.update();case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.languageHandler=function(e){localStorage.setItem("language",e.currentTarget.value),a.setState({language:e.currentTarget.value})},a.parser=function(){for(var e=arguments.length,t=new Array(e),a=0;a