var geoLoc={sessionKey:"highmark.location",locName:document.getElementById("location"),loclName:document.getElementById("l-location"),success:function(n){let i=n.coords;const r=new google.maps.Geocoder,t={lat:parseFloat(i.latitude),lng:parseFloat(i.longitude)};r.geocode({location:t}).then(n=>{if(n.results[0]){let i=n.results[0].address_components[2].short_name+", "+n.results[0].address_components[3].short_name;geoLoc.setUserLocation(t.lat,t.lng,i)}else console.log("no results found")}).catch(n=>window.alert("Geocoder failed due to: "+n))},setUserLocation:function(n,t,i){var r={name:i,lat:n,lng:t};geoLoc.locName&&(geoLoc.locName.value=r.name);geoLoc.loclName&&(geoLoc.loclName.value=r.name);geoLoc.storeLocation(r)},getLocationFromStore:function(){const n=sessionStorage.getItem(geoLoc.sessionKey);return n?JSON.parse(n):null},storeLocation:function(n){const t=JSON.stringify(n);sessionStorage.setItem(geoLoc.sessionKey,t)},error:function(n){console.warn(`ERROR(${n.code}): ${n.message}`)},getLocation:function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(this.success,this.error,{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},initLoc:function(){if(geoLoc.locName&&!geoLoc.locName.value){var n=geoLoc.getLocationFromStore();n&&(geoLoc.locName.value=n.name)}}};geoLoc.initLoc()