(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{15:function(t,e,n){},16:function(t,e,n){},17:function(t,e,n){},18:function(t,e,n){"use strict";n.r(e);var a=n(0),i=n.n(a),o=n(8),c=n.n(o),r=(n(15),n(1)),s=n(2),u=n(5),l=n(4),h=n(3),d=n(6);n(16),n(17);var v=function(t){function e(t){var n;Object(r.a)(this,e),(n=Object(u.a)(this,Object(l.a)(e).call(this,t))).state={xivapi_data:[]};var a="https://xivapi.com/Action/"+t.action_id;return console.log(a),fetch(a,{mode:"cors"}).then(function(t){return t.json()}).then(function(t){n.setState({xivapi_data:t})}),n}return Object(d.a)(e,t),Object(s.a)(e,[{key:"shouldComponentUpdate",value:function(){return 0!==Object.getOwnPropertyNames(this.state.xivapi_data).length}},{key:"isGCD",value:function(){return 4!==this.state.xivapi_data.ActionCategory.ID}},{key:"render",value:function(){if(this.state.xivapi_data.Icon){var t=this.isGCD()?"action-icon gcd":"action-icon ogcd",e="https://xivapi.com"+this.state.xivapi_data.Icon;return i.a.createElement("img",{className:t,src:e,alt:""})}return null}}]),e}(i.a.Component),f=function(t){function e(t){var n;return Object(r.a)(this,e),(n=Object(u.a)(this,Object(l.a)(e).call(this,t))).state={me:0,actionlist:[],actionindex:1},function t(e){var n=new URLSearchParams(window.location.search),a="".concat(n.get("HOST_PORT"),"BeforeLogLineRead")||!1,i=new WebSocket(a);i.onerror=function(){return t()},i.onmessage=function(t,n){if("."===t.data)return i.send(".");var a=JSON.parse(t.data);if("SendCharName"===a.msgtype)return console.log(a.msg.charID),console.log(a.msg.charName),e(a.msg);if("Chat"===a.msgtype){var o=a.msg.substring(0,2);if("21"===o||"22"===o)return e(a.msg)}}}(n.handleLogEvent.bind(Object(h.a)(n))),n}return Object(d.a)(e,t),Object(s.a)(e,[{key:"addActionToOverlay",value:function(t){this.setState(function(e){return{actionlist:e.actionlist.concat(t)}})}},{key:"handleLogEvent",value:function(t){if(t.charID)return this.setState({me:t.charID}),void console.log(t.charID);var e=this.state.me;if(0!==e){var n=t.split("|");if(parseInt(n[2],16)===e){var a=parseInt(n[4],16);if(7!==a){var i=this.state.actionindex;this.addActionToOverlay({index:i,action:a}),this.setState(function(t){return{actionindex:t.actionindex>=32?1:t.actionindex+1}}),setTimeout(this.purgeAction.bind(this),1e4)}}}}},{key:"purgeAction",value:function(){this.setState(function(t){return{actionlist:t.actionlist.slice(1)}})}},{key:"render",value:function(){var t=[];for(var e in console.log(this.state.actionlist),this.state.actionlist){var n=this.state.actionlist[e];t.push(i.a.createElement(v,{key:n.index,action_id:n.action}))}return i.a.createElement("div",{className:"actions"},t)}}]),e}(i.a.Component);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}$/));c.a.render(i.a.createElement(f,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(t){t.unregister()})},9:function(t,e,n){t.exports=n(18)}},[[9,1,2]]]); //# sourceMappingURL=main.2e1acc3f.chunk.js.map