var VM=VM||{};VM.Mapping={$maps:null,init:function(){this.$maps=VM.$body.find(".widget-map-autoload");this.$maps.length>0&&(this.loadAllData(),this.loadMapApi())},loadAllData:function(){this.$maps.each(function(){var n=$(this),t=n.data("endpoint");t&&(n.data("endpoint-append")&&(t+=window.location.search),$.getJSON(t,function(t){n.data("data",t);n.data("data-loaded",!0)}))})},loadMapApi:function(n){if(VM.$body.append(''),typeof L=="object"){if(typeof n=="function")return n();VM.Mapping.onMapApiLoaded()}else $.getScript("/js/leaflet.js",function(){if(typeof n=="function")return n();VM.Mapping.onMapApiLoaded()})},onMapApiLoaded:function(){VM.Mapping.$maps.each(function(){var n=$(this).removeClass("hidden"),r=VM.Mapping.initializeMap(n),u,t,i;n.data("endpoint")&&(u=VM.Mapping.loadData(n,r),u||(t=0,i=window.setInterval(function(){t++;VM.Mapping.loadData(n,r,i);t===50&&window.clearInterval(i)},150)))})},initializeMap:function(n){var h=parseFloat(n.data("lat")||47.1563624),c=parseFloat(n.data("lng")||-97.8962156),t=parseInt(n.data("min-zoom")||3,10),i=parseInt(n.data("max-zoom")||15,10),r="https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}",u="Tiles © Esri",f=new L.TileLayer(r,{variant:"World_Street_Map",minZoom:t,maxZoom:i,attribution:u}),e=new L.TileLayer(r,{variant:"World_Imagery",minZoom:t,maxZoom:i,attribution:u}),o=new L.TileLayer(r,{variant:"World_Topo_Map",minZoom:t,maxZoom:i,attribution:u}),l={Satellite:e,Topographic:o,Street:f},s=new L.Map(n[0],{center:[h,c],layers:[e,o,f]});return L.control.layers(l,null,{position:"bottomleft"}).addTo(s),s},loadData:function(n,t,i){var r,f,u;if(n.data("data-loaded")){if(n.removeClass("map-loading"),i&&window.clearInterval(i),r=n.data("data"),r&&r.length>0){for(f=[],u=0;u'),t=[],n.title.trim()!==(n.description||"").trim()&&t.push(""+n.title+"<\/b>"),n.subtitle&&t.push(""+n.subtitle+"<\/i>"),n.description&&t.push(n.description),i+=t.join("
"),n.url){var r=n.url,u=n.url.substring(0,4)==="http",f="",e="",o,s="",h="",c="";return u&&(f=' target="_blank"',e=' rel="noopener"'),n.event_category?(o=' data-ga-category="'+n.event_category+'"',s=' data-ga-action="'+n.event_action+'"',h=' data-ga-label="'+n.event_label+'"',c=u?' class="ga ga-ext"':' class="ga"'):u&&(r=VM.Track.getExternalParams(r)),'"+i+"<\/a>"}return i}};$(function(){VM.Mapping.init()})