!function(){"use strict";var e="ajax-load",t="load-ready",r="map-loaded",o="map-api-loaded",s="map-marker-click",n="map-popup-close",i=function extendStatics(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var a=function __assign(){return(a=Object.assign||function __assign(e){for(var t,r=1,o=arguments.length;r=332&&google.maps.event.addDomListener(this.div_,"touchstart",(function(e){e.stopPropagation()})),google.maps.event.addDomListener(this.div_,"click",(function(s){if(e=!1,!t){if(google.maps.event.trigger(o,"click",r.cluster_),google.maps.event.trigger(o,"clusterclick",r.cluster_),o.getZoomOnClick()){var n=o.getMaxZoom(),i=r.cluster_.getBounds();o.getMap().fitBounds(i),setTimeout((function(){o.getMap().fitBounds(i),null!==n&&o.getMap().getZoom()>n&&o.getMap().setZoom(n+1)}),100)}s.cancelBubble=!0,s.stopPropagation&&s.stopPropagation()}})),google.maps.event.addDomListener(this.div_,"mouseover",(function(){google.maps.event.trigger(o,"mouseover",r.cluster_)})),google.maps.event.addDomListener(this.div_,"mouseout",(function(){google.maps.event.trigger(o,"mouseout",r.cluster_)}))},ClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),google.maps.event.removeListener(this.boundsChangedListener_),google.maps.event.clearInstanceListeners(this.div_),this.div_.parentNode.removeChild(this.div_),this.div_=null)},ClusterIcon.prototype.draw=function(){if(this.visible_){var e=this.getPosFromLatLng_(this.center_);this.div_.style.top=e.y+"px",this.div_.style.left=e.x+"px"}},ClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none"),this.visible_=!1},ClusterIcon.prototype.show=function(){this.div_&&(this.div_.className=this.className_,this.div_.style.cssText=this.createCss_(this.getPosFromLatLng_(this.center_)),this.div_.innerHTML=(this.style.url?this.getImageElementHtml():"")+this.getLabelDivHtml(),"undefined"===typeof this.sums_.title||""===this.sums_.title?this.div_.title=this.cluster_.getMarkerClusterer().getTitle():this.div_.title=this.sums_.title,this.div_.style.display=""),this.visible_=!0},ClusterIcon.prototype.getLabelDivHtml=function(){return'\n
\n \n
\n"},ClusterIcon.prototype.getImageElementHtml=function(){var e=(this.style.backgroundPosition||"0 0").split(" "),t=parseInt(e[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(e[1].replace(/^\s+|\s+$/g,""),10),o={};if(this.cluster_.getMarkerClusterer().getEnableRetinaIcons())o={width:coercePixels(this.style.width),height:coercePixels(this.style.height)};else{var s=[-1*r,-1*t+this.style.width,-1*r+this.style.height,-1*t];o={clip:"rect("+s[0]+"px, "+s[1]+"px, "+s[2]+"px, "+s[3]+"px)"}}var n=this.sums_.url?{width:"100%",height:"100%"}:{},i=toCssText(a(a({position:"absolute",top:coercePixels(r),left:coercePixels(t)},o),n));return''},ClusterIcon.prototype.useStyle=function(e){this.sums_=e;var t=Math.max(0,e.index-1);t=Math.min(this.styles_.length-1,t),this.style=this.sums_.url?a(a({},this.styles_[t]),{url:this.sums_.url}):this.styles_[t],this.anchorText_=this.style.anchorText||[0,0],this.anchorIcon_=this.style.anchorIcon||[Math.floor(this.style.height/2),Math.floor(this.style.width/2)],this.className_=this.cluster_.getMarkerClusterer().getClusterClass()+" "+(this.style.className||"cluster-"+t)},ClusterIcon.prototype.setCenter=function(e){this.center_=e},ClusterIcon.prototype.createCss_=function(e){return toCssText({"z-index":""+this.cluster_.getMarkerClusterer().getZIndex(),top:coercePixels(e.y),left:coercePixels(e.x),width:coercePixels(this.style.width),height:coercePixels(this.style.height),cursor:"pointer",position:"absolute","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-o-user-select":"none","user-select":"none"})},ClusterIcon.prototype.getPosFromLatLng_=function(e){var t=this.getProjection().fromLatLngToDivPixel(e);return t.x=Math.floor(t.x-this.anchorIcon_[1]),t.y=Math.floor(t.y-this.anchorIcon_[0]),t},ClusterIcon}(l),c=function(){function Cluster(e){this.markerClusterer_=e,this.map_=this.markerClusterer_.getMap(),this.minClusterSize_=this.markerClusterer_.getMinimumClusterSize(),this.averageCenter_=this.markerClusterer_.getAverageCenter(),this.markers_=[],this.center_=null,this.bounds_=null,this.clusterIcon_=new u(this,this.markerClusterer_.getStyles())}return Cluster.prototype.getSize=function(){return this.markers_.length},Cluster.prototype.getMarkers=function(){return this.markers_},Cluster.prototype.getCenter=function(){return this.center_},Cluster.prototype.getMap=function(){return this.map_},Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_},Cluster.prototype.getBounds=function(){for(var e=new google.maps.LatLngBounds(this.center_,this.center_),t=this.getMarkers(),r=0;rn)e.getMap()!==this.map_&&e.setMap(this.map_);else if(st)this.clusterIcon_.hide();else if(e0))for(var e=0;e3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625));for(var o=this.getExtendedBounds(r),s=Math.min(e+this.batchSize_,this.markers_.length),n=e;n',o.divClass=e.divClass,o.align=e.align,o.isDebugMode=e.debug,o.onClick=e.onClick,o.onMouseOver=e.onMouseOver,o.isBoolean=function(e){return"boolean"===typeof e},o.isNotUndefined=function(e){return"undefined"!==typeof e},o.hasContent=function(e){return e.length>0},o.isString=function(e){return"string"===typeof e},o.isFunction=function(e){return"function"===typeof e},r}return function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}(GoogleMapsHtmlOverlay,[{key:"onAdd",value:function onAdd(){var e=this;e.div=document.createElement("div"),e.div.style.position="absolute",e.isNotUndefined(e.divClass)&&e.hasContent(e.divClass)&&(e.div.className=e.divClass),e.isNotUndefined(e.html)&&e.hasContent(e.html)&&e.isString(e.html)&&(e.div.innerHTML=e.html),e.isBoolean(e.isDebugMode)&&e.isDebugMode&&(e.div.className="debug-mode",e.div.innerHTML='
Debug mode
',e.div.setAttribute("style","position: absolute;border: 5px dashed red;height: 150px;width: 150px;display: flex;justify-content: center;align-items: center;")),e.getPanes().overlayMouseTarget.appendChild(e.div),google.maps.event.addDomListener(e.div,"click",(function(t){google.maps.event.trigger(e,"click"),e.isFunction(e.onClick)&&e.onClick(),t.stopPropagation()})),google.maps.event.addDomListener(e.div,"mouseover",(function(t){google.maps.event.trigger(e,"mouseover"),e.isFunction(e.onMouseOver)&&e.onMouseOver(),t.stopPropagation()}))}},{key:"draw",value:function draw(){var e=this,t=document.querySelector(".popup");t.length||(t=e.div);var r=e.getProjection();if(!r)return console.log("GoogleMapsHtmlOverlay: current map is missing"),null;var o=r.fromLatLngToDivPixel(e.getPosition()),s={y:void 0,x:void 0},n=t.offsetWidth,i=t.offsetHeight;switch(Array.isArray(e.align)?e.align.join(" "):""){case"left top":s.y=i,s.x=n;break;case"left center":s.y=i/2,s.x=n;break;case"left bottom":s.y=0,s.x=n;break;case"center top":s.y=i,s.x=n/2;break;case"center center":s.y=i/2,s.x=n/2;break;case"center bottom":s.y=0,s.x=n/2;break;case"right top":s.y=i,s.x=0;break;case"right center":s.y=i/2,s.x=0;break;case"right bottom":s.y=0,s.x=0;break;default:s.y=i/2,s.x=n/2}e.div.style.top="".concat(o.y-s.y,"px"),e.div.style.left="".concat(o.x-s.x,"px")}},{key:"getPosition",value:function getPosition(){return new google.maps.LatLng(this.position)}},{key:"getDiv",value:function getDiv(){return this.div}},{key:"setPosition",value:function setPosition(e,t){var r=this;r.position=e,r.align=t,r.draw()}},{key:"remove",value:function remove(){this.setMap(null),this.div.remove()}},{key:"getDraggable",value:function getDraggable(){return!1}}]),GoogleMapsHtmlOverlay}()}};function map_google_defineProperties(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:[],o=this;o.el=t,o.config=r,o.markers=[],e["init".concat(o.getName())]=function(){o.googleApiLoaded()};var s=document.createElement("script");s.src="https://maps.googleapis.com/maps/api/js?key=".concat(r.key,"&callback=init").concat(o.getName()),s.async=!0,s.defer=!0,document.head.appendChild(s)}},{key:"googleApiLoaded",value:function googleApiLoaded(){var e=this,t=e.el,r=e.config,s=t.querySelector(".mapAPI-map"),n=r.mapZoom&&"0"!==r.mapZoom?parseInt(r.mapZoom):10,i=r.center&&","!==r.center?{lat:r.center[1],lng:r.center[0]}:{lat:0,lng:0},a=r.style?r.style:null;console.log("".concat(e.getName(),": API is loaded")),e.MarkerUI=g.init(),e.map=new google.maps.Map(s,{zoom:n,center:i,fullscreenControl:!0,styles:a}),e.default_zoom=n,s.classList.add("mapboxgl-map"),e.popup=new e.MarkerUI({map:e.map,align:["center","top"],divClass:"mapboxgl-popup popup mapboxgl-popup-anchor-bottom d-none",html:'
\xd7
'}),e.popup.setMap(e.map),e.geocoder=new google.maps.Geocoder,e.cluster=new h(e.map,null,{styles:[{width:30,height:30,className:"mapboxgl-cluster"}]}),t.dispatchEvent(new Event(o))}},{key:"addMarker",value:function addMarker(e,t){var r=this,o={lat:e[1],lng:e[0]},n=new r.MarkerUI({position:o,map:r.map,align:["center","top"],html:'
').concat(t.icon,"
"),onClick:function onClick(){var e=document.querySelector("#Marker".concat(t.id));r.showPopup(o,t.content),e.dispatchEvent(new Event(s))}});return r.markers.push(n),r.cluster.addMarker(n),n}},{key:"showPopup",value:function showPopup(e,t){var r=this,o=r.popup.getDiv();r.config.flyToMarker&&(r.map.setCenter(e),r.config.noZoom||r.map.setZoom(18)),o.style.opacity="0",o.classList.remove("d-none"),o.querySelector(".mapboxgl-popup-content .html").innerHTML=t,o.querySelector(".mapboxgl-popup-close-button").addEventListener("click",(function(e){e.preventDefault(),r.hidePopup()})),r.popup.setPosition(e,["center","top"]),o.style.opacity="1",o.style["margin-top"]="-1rem"}},{key:"hidePopup",value:function hidePopup(){var e=this;e.popup.getDiv().classList.add("d-none"),e.config.noRestoreBounds&&!e.config.flyToBounds||e.restoreBounds(),e.el.dispatchEvent(new Event(n))}},{key:"geocode",value:function geocode(e,t){var r=this;r.geocoder.geocode({address:e},(function(e,o){if("OK"===o)return"function"===typeof t&&t(e),e;console.error("".concat(r.getName(),": Geocode was not successful for the following reason: ").concat(o))}))}},{key:"reverseGeocode",value:function reverseGeocode(e,t){var r=this;r.geocoder.geocode({location:latlng},(function(e,o){if("OK"===o)return"function"===typeof t&&t(e),e;console.error("".concat(r.getName(),": Reverse Geocoding was not successful for the following reason: ").concat(o))}))}},{key:"addGeoJson",value:function addGeoJson(e){var t=this,r=JSON.parse(e.geojson),o=(r.features[0].geometry.coordinates,new google.maps.LatLngBounds);r.features.forEach((function(r){var s=r.id,n=r.geometry.coordinates,i=r.properties.content;t.addMarker(n,{id:s,content:i,icon:r.icon,flyToMarker:e.flyToMarker}),o.extend({lat:n[1],lng:n[0]})})),t.markers.length>1?t.map.fitBounds(o,{padding:30}):t.markers[0]&&t.map.setCenter(t.markers[0].getPosition()),t.default_bounds=o,t.default_zoom=t.map.getZoom()}},{key:"getMap",value:function getMap(){return this.map}},{key:"getPopup",value:function getPopup(){return this.popup}},{key:"restoreBounds",value:function restoreBounds(){var e=this;e.default_bounds&&e.markers.length>1?e.map.fitBounds(e.default_bounds,{padding:30}):(e.markers[0]&&e.map.setCenter(e.markers[0].getPosition()),e.restoreZoom())}},{key:"restoreZoom",value:function restoreZoom(){this.map.setZoom(this.default_zoom)}}]),GoogleMapsDriver}()}(window)};function map_api_defineProperties(e,t){for(var r=0;r'),console.log("".concat(n,": init ").concat(r.getName(),"...")),t.drv=r,t.el=e,t.config=a,r.init(e,a),e.addEventListener(o,(function(){t.addMarkers()}))}return function map_api_createClass(e,t,r){return t&&map_api_defineProperties(e.prototype,t),r&&map_api_defineProperties(e,r),e}(MapAPI,[{key:"getMap",value:function getMap(){return ui.map}},{key:"dispose",value:function dispose(){this.el=null,this.el.classList.remove("".concat(n,"-active"))}},{key:"addMarkers",value:function addMarkers(){console.log("".concat(n,": addMarkers"));var e=this,t=e.el,o=e.drv,s=e.config;if(e.map=o.getMap(),s.geojson)console.log("".concat(n,": setting up geocode data")),o.addGeoJson(s);else if(s.address)console.log(s.address),console.log("".concat(n,": setting up address marker")),o.geocode(s.address,(function(t){console.log(t);var r=t[0].geometry.location.lat(),i=t[0].geometry.location.lng();console.log("".concat(n,": setting up single lat/lng marker lat: ").concat(r," lng: ").concat(i)),o.addMarker([i,r],s),e.map.setCenter({lat:r,lng:i})}));else if(s.lat&&s.lng){var i=s.lat,a=s.lng;console.log("".concat(n,": setting up single lat/lng marker lat: ").concat(i," lng: ").concat(a)),o.addMarker([a,i],s)}t.classList.add("".concat(n,"-active")),t.dispatchEvent(new Event(r)),console.log("".concat(n,": Map is loaded"))}}]),MapAPI}(),l=function init(){console.log("".concat(n,": init")),document.querySelectorAll(".".concat(n)).forEach((function(e,t){new a(e)}))};s.addEventListener("".concat(t),l),s.addEventListener("".concat(e),l)}(window)}();