function ResizeMap(){var n=$(document.getElementById("map"));n.height(n.width()*.56);map.resize();map.fitBounds(MapFitBoundsCords)}function GetCenterCoords(n){var t=(n[0][0]+n[1][0])/2,i=(n[0][1]+n[1][1])/2;return[t,i]}function BuildMap(n,t,i){try{jQuery("#loading").removeClass("hidden");ResizeMap();var u=$.getJSON(n).done(function(n){console.log("%cMessage: Loading State Geometry - Success","color:green;");GetOutageInfo(n,t,i)}).fail(function(n,t,i){console.log("%cError: Loading State Geometry - Error: "+n.status+" - "+i,"color:red;");MapError("Failed to Load Geometry Data","Request Error Code: "+n.status+" - "+i)})}catch(r){console.log("%cError: Function BuildMap. Message: "+r.message,"color:red;");MapError("Failed to Load Geometry Data",r.message)}}function GetOutageInfo(n,t,i){try{var u=$.getJSON(t).done(function(t){console.log("%cMessage: Loading State Info - Success","color:green;");DrawMap(n,t,i)}).fail(function(n,t,i){console.log("%cError: Loading State Info - Error: "+n.status+" - "+i,"color:red;");MapError("Failed to Load Outage Data","Request Error Code: "+n.status+" - "+i)})}catch(r){console.log("%cError: Function GetOutageInfo. Message: "+r.message,"color:red;");MapError("Failed to Load Outage Data",r.message)}}function DrawMap(n,t,i){try{var r=[];$.each(n.CountyGeometry.Areas,function(n,u){var e="#3F3F3F",f="",o=0,s=0;$.each(t.WebCountyRecord,function(n,t){t.CountyName.toUpperCase()===u.NAME.toUpperCase()&&(f=t.CountyId.toString(),r.push(u.NAME),o=t.OutageCount,s=t.CustomerCount,e=t.CountyStatus)});f==""&&console.log("%cAlert: "+u.NAME+" not found in dataset","color:orange;");try{map.addLayer({id:u.NAME,type:"fill",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",properties:{Name:u.NAME,Id:f,OutageCount:o,CountomerCount:s,AreaType:i},geometry:u.geometry}]}},layout:{},paint:{"fill-color":e,"fill-opacity":1,"fill-outline-color":"#000"}})}catch(h){console.log("%cError: Function map.addLayer | For: "+u.NAME+" | Message: "+h.message,"color:red;")}});map.on("click",function(n){var i=map.queryRenderedFeatures(n.point,{layers:r}),u,t;i.length&&(u=i[0],t=u.properties.Id,t!=null&&(document.location.href="/area/county/"+t))});map.on("mousemove",function(n){var t=map.queryRenderedFeatures(n.point,{layers:r});map.getCanvas().style.cursor=t.length?"pointer":"";t.length!=0?(document.getElementById("CountyName").innerHTML=t[0].properties.AreaType+" Name: "+t[0].layer.id,document.getElementById("CountyTracked").innerHTML=t[0].properties.AreaType+" Tracked: "+t[0].properties.CountomerCount.toLocaleString(),document.getElementById("CountyOut").innerHTML=t[0].properties.AreaType+" Out: "+t[0].properties.OutageCount.toLocaleString(),document.getElementById("mappopup").style.left=n.originalEvent.clientX+"px",document.getElementById("mappopup").style.top=n.originalEvent.clientY+"px",document.getElementById("mappopup").style.display="block",document.getElementById("mappopup").style.marginLeft=document.documentElement.clientWidth/2>n.originalEvent.clientX?"20px":"-"+(document.getElementById("mappopup").clientWidth+10)+"px",document.getElementById("mappopup").style.marginTop=document.documentElement.clientHeight/4*3>n.originalEvent.clientY?"-10px":"-40px"):(document.getElementById("CountyName").innerHTML="",document.getElementById("CountyTracked").innerHTML="",document.getElementById("CountyOut").innerHTML="",document.getElementById("mappopup").style.display="none")});ResizeMap();jQuery("#loading").addClass("hidden")}catch(u){console.log("%cError: Function DrawMap. Message: "+u.message,"color:red;");MapError("Failed to Draw the Map",u.message)}}function MapError(n,t){jQuery("#loading").addClass("hidden");document.getElementById("map").outerHTML='<div class="AlertBox4" style="z-index: 1000">Outage Map Error - '+n+" <br /> "+t+"  <br />On desktop try pressing CTRL+Shift+R at the same time<br />On mobile clear your all time browser cache<br />If the error persists you can reach out to support@bluefirestudios.com<\/div> "}var map=new mapboxgl.Map({container:"map",center:GetCenterCoords(MapFitBoundsCords),zoom:5,style:{version:8,name:"Empty",metadata:{"mapbox:autocomposite":!0},sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(0,0,0,0)"}}]},interactive:!1,trackResize:!0});map.scrollZoom.disable();window.onresize=ResizeMap