text: (this.webpackJsonpfront=this.webpackJsonpfront||[]).push([[0],[,,,,,,,,function(e,t,a){e.exports=a(38)},,,,,function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},,,,,,,,,,,,,,,,function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){"use strict";a.r(t);var n=a(0),l=a.n(n),c=a(4),o=a.n(c),r=(a(13),a(1)),i=(a(14),a(15),a(16),a(5)),s=Object(i.GoogleApiWrapper)({apiKey:"AIzaSyALfvSRLCN3dLyVvuuZaVgBxDj-YnEF7gc"})((function(e){var t=e.google,a=e.center,c=void 0===a?{lat:4.6032624,lng:-74.0652016}:a,o=e.onDragend,s=void 0===o?function(){}:o,u=Object(n.useState)(c),m=Object(r.a)(u,2),d=m[0],f=m[1];return Object(n.useEffect)((function(){f(c)}),[c,f]),l.a.createElement(i.Map,{google:t,zoom:15,initialCenter:d,center:d,onClick:function(e,t,a){var n={lat:a.latLng.lat(),lng:a.latLng.lng()};f(n),s(n)}},l.a.createElement(i.Marker,{position:c}))})),u=function(e){var t=e.currentLocation,a=e.changeLocation,c=e.cancel,o=Object(n.useState)({lat:t.latitude,lng:t.longitude}),i=Object(r.a)(o,2),u=i[0],m=i[1];return l.a.createElement("div",{id:"changelocation-container"},l.a.createElement("div",null,l.a.createElement("span",null,"Change Location"),l.a.createElement("span",null,u.lat,", ",u.lng),l.a.createElement("button",{title:"Your Location",onClick:function(){navigator.geolocation?navigator.geolocation.getCurrentPosition((function(e){m({lat:e.coords.latitude,lng:e.coords.longitude})})):console.error("No geolocation")}},l.a.createElement("i",{className:"fas fa-crosshairs"}))),l.a.createElement("div",null,l.a.createElement(s,{center:u,onDragend:function(e){var t=e.lat,a=e.lng;return m({lat:t,lng:a})}})),l.a.createElement("div",null,l.a.createElement("button",{onClick:function(){return c()}},"Cancel"),l.a.createElement("button",{onClick:function(){return a({latitude:u.lat,longitude:u.lng})}},"Change")))},m=(a(32),function(e){e.close;return l.a.createElement("div",{id:"about"},l.a.createElement("span",null,"Kyllur"),l.a.createElement("div",null,l.a.createElement("span",null,"Why Kyllur?"),l.a.createElement("span",null,"The name comes frome the sound of the Quechuan word for star: ",l.a.createElement("i",null,"quyllur"),".")),l.a.createElement("div",null,l.a.createElement("span",null,"The project"),l.a.createElement("span",null,"We want you to explore the sky above you, explore the stars and satellites above a location in real ",l.a.createElement("small",null,"ish")," time."),l.a.createElement("ul",{style:{listStyleType:"none"}},l.a.createElement("li",null,"Interact with the objects in the sky! Click on them for more details."),l.a.createElement("li",null,"Don't like your sky? Change the your location to see a new sky"))),l.a.createElement("div",null,l.a.createElement("span",null,"How do we do it?"),l.a.createElement("span",null,"We use ",l.a.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.n2yo.com/"},"N2YO")," to access satellite locations in real time. We also use data from the ",l.a.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"http://www.astronexus.com/hyg"},"HYG star database")," in conjunction with some maths in order to calculate your sky in real time.")),l.a.createElement("div",null,l.a.createElement("span",null,"Who are we?"),l.a.createElement("span",null,"We are ",l.a.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"http://pedrito.dev"},"Pedro Salazar")," & ",l.a.createElement("a",{target:"_blank",href:"https://dnarvaez27.github.io/",rel:"noopener noreferrer"},"David Narvaez"),l.a.createElement("span",null,". Two students that have been starting projects at the last possible minute since 90's"))))}),d=(a(33),function(e){var t=e.data,a=Object(n.useState)({state:0,view:t.satellites}),c=Object(r.a)(a,2),o=c[0],i=c[1];Object(n.useEffect)((function(){i((function(e){return{state:e.state,view:0===e.state?t.satellites:t.stars}}))}),[t]);var s=function(e,a){return function(){return i({state:e,view:t[a]})}};return l.a.createElement("div",{id:"datashow-container"},l.a.createElement("div",null,l.a.createElement("div",null,l.a.createElement("button",{className:0===o.state?"active":"",onClick:s(0,"satellites")},"Satellites"),l.a.createElement("button",{className:1===o.state?"active":"",onClick:s(1,"stars")},"Stars"))),l.a.createElement("div",null,o.view.map((function(e,t){return function(e,t){return 0===o.state?l.a.createElement("div",{key:"sat_".concat(t)},l.a.createElement("span",null,"Satelite ".concat(e.satname)),l.a.createElement("span",null,l.a.createElement("i",{className:"fas fa-globe-americas"}),l.a.createElement("span",null,e.intDesignator)),l.a.createElement("span",null,l.a.createElement("i",{className:"fas fa-rocket"}),l.a.createElement("span",null,e.launchDate))):l.a.createElement("div",{key:"star_".concat(t)},l.a.createElement("span",null,"Star ".concat(e.nombre)),l.a.createElement("span",null,"Mass ".concat(e.masa)),l.a.createElement("span",null,e.descubrimiento),l.a.createElement("span",null,e.tipo_deteccion),l.a.createElement("div",null,l.a.createElement("button",null,l.a.createElement("i",{className:"fas fa-heart"}),l.a.createElement("i",{className:"far fa-heart"}))))}(e,t)}))))}),f=(a(34),function(e){var t=e.queries;return l.a.createElement("div",{id:"queries-container"},t.reverse().map((function(e,t){return l.a.createElement("div",{key:"cord_".concat(t)},l.a.createElement("span",null,"(",e.latitude,", ",e.longitude,")"))})))}),E=function(e){var t,a,c=e.openModal,o=e.openFullModal,i=e.changeLocation,s=e.data,E=e.queries,p=Object(n.useState)({latitude:0,longitude:0,accuracy:0}),g=Object(r.a)(p,2),h=g[0],v=g[1],b=Object(n.useState)(-1),O=Object(r.a)(b,2),w=O[0],S=O[1],j=function(){S(1),o(!0,l.a.createElement(m,{close:function(){return c(!1,void 0)}}))};return Object(n.useEffect)((function(){j()}),[]),Object(n.useEffect)((function(){2===w&&o(!0,l.a.createElement(f,{queries:E}))}),[E]),Object(n.useEffect)((function(){i(h)}),[h]),Object(n.useEffect)((function(){navigator.geolocation?navigator.geolocation.getCurrentPosition((function(e){v({latitude:e.coords.latitude,longitude:e.coords.longitude})})):console.error("No geolocation")}),[]),Object(n.useEffect)((function(){3===w&&o(!0,l.a.createElement(d,{data:s}))}),[w,s]),l.a.createElement("div",{id:"nav-bar"},l.a.createElement("div",{id:"search-container"},l.a.createElement("button",{onClick:function(){c(!0,l.a.createElement(u,{currentLocation:h,changeLocation:function(e){v(e),c(!1,void 0)},cancel:function(){return c(!1,void 0)}}))}},l.a.createElement("i",{className:"fas fa-search"}),l.a.createElement("span",null,"Change Location")),l.a.createElement("button",{onClick:1!==w?j:function(){S(-1),o(!1,void 0)},className:1===w?"active":""},(t=1,a=l.a.createElement(l.a.Fragment,null,l.a.createElement("i",{className:"fas fa-question-circle"}),l.a.createElement("span",null,"About")),w!==t?a:l.a.createElement(l.a.Fragment,null,l.a.createElement("i",{className:"fas fa-times-circle"}),l.a.createElement("span",null,"Close"))))),l.a.createElement("div",{id:"footer-container"}))},p=(a(35),function(e){var t=e.open,a=e.content;return l.a.createElement("div",{id:"modal",className:t?"":"hidden"},l.a.createElement("div",{id:"modal-bg"}),l.a.createElement("div",{id:"modal-content"},a))}),g=(a(36),function(e){var t=e.refresh;Object(n.useEffect)((function(){}),[t]);var a=Object(n.useState)(!0),c=Object(r.a)(a,2),o=c[0],i=c[1];return l.a.createElement(l.a.Fragment,null,l.a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 384 512",id:"img-pin",onClick:function(e){return i(!1)},className:o?"unclicked":""},l.a.createElement("path",{fill:"#ea4335",fillRule:"evenodd",d:"M0,192C0,86,86,0,192,0S384,86,384,192c0,77.41-118.44,320-192,320S0,269.41,0,192Zm192,80a80,80,0,1,0-80-80A80,80,0,0,0,192,272Z"},l.a.createElement("animate",{id:"animation-to-check",repeatCount:"1",dur:"2.5s",attributeName:"d",fill:"freeze",begin:"click",calcMode:"spline",keySplines:"0.1 1 0.56 0.72; 0.1 1 0.56 0.72",values:"\r M0,192C0,86,86,0,192,0S384,86,384,192c0,77.41-118.44,320-192,320S0,269.41,0,192Zm192,80a80,80,0,1,0-80-80A80,80,0,0,0,192,272Z;\r M0,192C0,86,86,0,192,0S384,86,384,192c0,77.41-73.56,182.65-192,182.65S0,269.41,0,192Zm192,80a80,80,0,1,0-80-80A80,80,0,0,0,192,272Z;\r M0,336.12c0-106,86-192,192-192s192,86,192,192C384,413.54,310.44,512,192,512S0,413.54,0,336.12Zm192,80a80,80,0,1,0-80-80A80,80,0,0,0,192,416.12Z"}))),l.a.createElement("div",{id:"pin-bubble",className:o?"":"hide"},l.a.createElement("span",null,"Here you are!")))}),h={radius:3,color:"#06ABC2",size:25},v=function(e){var t=e.sat;return l.a.createElement("div",null,l.a.createElement("span",null,l.a.createElement("b",null,"Satellite")),l.a.createElement("span",null,l.a.createElement("b",null,"Name:")," ",t.satname),l.a.createElement("span",null,l.a.createElement("b",null,"Designator:")," ",t.intDesignator),l.a.createElement("span",null,l.a.createElement("b",null,"Launch:")," ",t.launchDate),l.a.createElement("span",null,l.a.createElement("b",null,"Altitude:")," ",t.satalt," km"))},b=function(e){var t=e.star;return l.a.createElement("div",null,l.a.createElement("span",null,l.a.createElement("b",null,"Star")),l.a.createElement("span",null,l.a.createElement("b",null,"Name:")," ",t.proper||"No commmon name"),l.a.createElement("span",null,l.a.createElement("b",null,"HD ID:")," ",t.hd||"No HD id"),l.a.createElement("span",null,l.a.createElement("b",null,"HR ID:")," ",t.hr||"No HR id"),l.a.createElement("span",null,l.a.createElement("b",null,"GL ID:")," ",t.gl||"No GL id"),l.a.createElement("span",null,l.a.createElement("b",null,"BF ID:")," ",t.bf||"No BF id"),l.a.createElement("span",null,l.a.createElement("b",null,"Constelation:")," ",t.con||"Not in a common constllation"),l.a.createElement("span",null,l.a.createElement("b",null,"Distance:")," ",t.dist.toFixed(4)," parsecs"),l.a.createElement("span",null,l.a.createElement("b",null,"Magnitude:")," ",t.mag),l.a.createElement("span",null,l.a.createElement("b",null,"Specturm:")," ",t.spect),l.a.createElement("span",null,l.a.createElement("b",null,"RA:")," ",t.ra.toFixed(4),"\xb0"),l.a.createElement("span",null,l.a.createElement("b",null,"DEC:")," ",t.dec.toFixed(4),"\xb0"))},O=function(e){var t=e.satelites,a=e.stars,c=Object(n.useRef)(null),o=Object(n.useState)(void 0),i=Object(r.a)(o,2),s=i[0],u=i[1],m=Object(n.useState)(void 0),d=Object(r.a)(m,2),f=d[0],E=d[1],p=Object(n.useState)([]),O=Object(r.a)(p,1)[0],w=Object(n.useState)([]),S=Object(r.a)(w,1)[0],j=function(e,t,a,n,l){var c=document.getElementById("img-sat");e.shadowColor="#FFF";var o=a+t,r=-n+t,i=h.size;f&&l.satname===f.satname&&(e.shadowBlur=8,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor="white"),S.push({x:o,y:r,w:i,h:i,data:l}),e.drawImage(c,o,r,i,i),e.globalAlpha=1,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor="white"},y=function(e,t,a,n,l,c,o){e.beginPath(),e.fillStyle=l;var r=a+t,i=-n+t,u=Math.ceil(6-c);o.con===s?(e.shadowBlur=8,e.shadowOffsetX=0,e.shadowOffsetY=0,f&&JSON.stringify(f)===JSON.stringify(o)?e.shadowColor="red":e.shadowColor="white"):e.globalAlpha=.5,O.push({x:r,y:i,r:u,data:o}),e.arc(r,i,u,0,2*Math.PI),e.fill(),e.globalAlpha=1,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor="white"};return Object(n.useEffect)((function(){!function(e,t){for(var a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];O.length>0;)O.pop();for(;S.length>0;)S.pop();var n=function(e,t){return e/70*t},l=c.current,o=l.getContext("2d"),r=(window.innerHeight-40)/2;o.clearRect(0,0,2*r,2*r),a&&(e.forEach((function(e){return y(o,r,n(e.canvasPosition.x,r),n(e.canvasPosition.y,r),e.ci,e.mag,e)})),t.forEach((function(e){return j(o,r,n(e.canvasPosition.x,r),n(e.canvasPosition.y,r),e)})))}(JSON.parse(JSON.stringify(a)),JSON.parse(JSON.stringify(t)))}),[t,a,s,f]),l.a.createElement(l.a.Fragment,null,l.a.createElement("img",{id:"img-sat",src:"./assets/images/Satelite.png",alt:"satellite-icon"}),l.a.createElement(g,null),l.a.createElement("canvas",{id:"star-canvas",ref:c,width:window.innerHeight-40,height:window.innerHeight-40,onClick:function(e){var t=e.pageX-e.target.offsetLeft,a=e.pageY-e.target.offsetTop,n=!1,l=S.filter((function(e){return t>=e.x&&t<=e.x+e.w&&a>=e.y&&a<=e.y+e.h}));0===l.length&&(n=(l=O.filter((function(e){return Math.sqrt(Math.pow(e.x-t,2)+Math.pow(e.y-a,2))<=2*e.r}))).length>0),l.length>0&&(n?JSON.stringify(f)===JSON.stringify(l[0].data)?(E(void 0),u(void 0)):(E(l[0].data),u(l[0].data.con)):(u(void 0),JSON.stringify(f)===JSON.stringify(l[0].data)?E(void 0):E(l[0].data)))}}),l.a.createElement("div",{className:0===a.length?"loader-on":"loader-off"},l.a.createElement("div",{className:"lds-ripple"},l.a.createElement("div",null),l.a.createElement("div",null))),l.a.createElement("div",{id:"info",className:f?"show":""},f&&(f.satname?l.a.createElement(v,{sat:f}):l.a.createElement(b,{star:f}))))},w=(a(37),function(e){var t=e.open,a=e.content;return l.a.createElement("div",{id:"fullmodal",className:t?"":"hidden"},a)}),S="wss://kyllur.herokuapp.com/ws";console.log("WSS URL ".concat(S));var j=function(){var e=Object(n.useState)({open:!1,content:void 0}),t=Object(r.a)(e,2),a=t[0],c=t[1],o=Object(n.useState)({open:!1,content:void 0}),i=Object(r.a)(o,2),s=i[0],u=i[1],m=Object(n.useState)({stars:[],satellites:[]}),d=Object(r.a)(m,2),f=d[0],g=d[1],h=Object(n.useState)({stars:[],satellites:[]}),v=Object(r.a)(h,2),b=v[0],j=v[1],y=Object(n.useState)(!1),N=Object(r.a)(y,2),C=N[0],k=N[1],L=Object(n.useState)(null),x=Object(r.a)(L,2),A=x[0],D=x[1],M=Object(n.useState)([]),I=Object(r.a)(M,2),F=I[0],B=I[1],J=null;Object(n.useEffect)((function(){var e=new WebSocket(S);D(e),window.particlesJS.load("particles-js","/assets/scripts/particles.json",(function(){}))}),[]),Object(n.useEffect)((function(){A&&(A.onopen=function(){k(!0),console.log("WS: Connected"),A.send("SUBSCRIBE;locations"),J&&J()},A.onclose=function(){return console.log("WS: Closed")},A.onerror=function(e){return console.log("WS: Error",e)},A.onmessage=function(e){var t=JSON.parse(e.data);"LIVE"in t?g(t.LIVE):"CH_LOCATIONS"in t?B(t.CH_LOCATIONS):console.log(t)})}),[A,J]);return l.a.createElement("div",{id:"main-container"},l.a.createElement(E,{openModal:function(e,t){c({open:e,content:t})},openFullModal:function(e,t){u({open:e,content:t})},changeLocation:function(e){C?(g({stars:[],satellites:[]}),j(e),A.send("LOCATION;".concat(e.latitude,";").concat(e.longitude))):J=function(){j(e),A.send("LOCATION;".concat(e.latitude,";").concat(e.longitude))}},data:f,queries:F}),l.a.createElement(O,{satelites:f.satellites,stars:f.stars,coordinates:b}),l.a.createElement(p,{open:a.open,content:a.content}),l.a.createElement(w,{open:s.open,content:s.content}))};Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));o.a.render(l.a.createElement(j,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))}],[[8,1,2]]]);
  //# sourceMappingURL=main.a9b54aa2.chunk.js.map