"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e,a){var s="https://maps.monomaps.com/styles/{style}/{z}/{x}/{y}.png",o=function(s,o){var n={address:"New York, NY, USA",extraAddress:[],zoom:12,disableDirections:!1,clickEvent:"click"},r=this;e.touchevents&&(n.clickEvent=a.navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?n.clickEvent+" touchstart":n.clickEvent+" tap"),this.el=s,this.$element=t(s),this.$window=t(a),this.isInTool=document.body.hasAttribute("data-istool"),this.options=t.extend({},n,o),this.markers=[],this.getModuleAddress(function(t){r.geometry="object"==("undefined"==typeof t?"undefined":_typeof(t))?t:JSON.parse(t),r.init()})};o.prototype={init:function(){if(this.isWebGlSupported=this.detectWebGl(),navigator.userAgent.match(/(iPad|iPhone|iPod|Firefox)/g)&&(this.isWebGlSupported=!1),this.isWebGlSupported){var e="https://maps.monomaps.com/styles/"+this.getStyle(t(this.el).attr("data-mapstyle"))+"/style.json";this.instance=new mapboxgl.Map({container:this.el,style:e,hash:!1,zoom:this.options.zoom,dragPan:!1,scrollZoom:!1}),this.instance.addControl(new mapboxgl.NavigationControl,"top-left"),t(".mapboxgl-ctrl-compass").css("display","none"),this.initMapboxgl()}else this.initLeaflet()},initMapboxgl:function(){var t=this;a._monoLoader.utils.waitFor(function(){return!jQuery.isEmptyObject(a._monoLang.langObj)},function(){t.afterInit()},2e4)},initLeaflet:function(){var t=this;a._monoLoader.utils.waitFor(function(){return"undefined"!=typeof L},function(){t.loadLeaflet(),t.afterInit()},2e4,500)},afterInit:function(){var e=this;this.setEvents(),this.setMapCenter(),this.addMarker(this.options.address),t(this.options.extraAddress).each(function(t,a){e.addMarker(a)}),t(".mapboxgl-marker").attr("role","button"),t(".mapboxgl-marker").attr("tabindex","0")},loadLeaflet:function(){this.instance=L.map(this.el,{zoom:this.options.zoom,scrollWheelZoom:!1,dragging:!1}),this.layer=L.tileLayer(s,{attribution:'© OpenStreetMap contributors',style:this.getStyle(t(this.el).attr("data-mapstyle"))}).addTo(this.instance)},getStyle:function(t){switch(t){case"bw":return"mono_bw";case"bluewater":return"mono_blw";case"neutralblue":return"mono_blue";case"lightmonochrome":return"mono_chrome";default:return"mono"}},setMapCenter:function(){var t=this.options.address.replace(/\s+/g,"");if(this.geometry&&this.geometry.hasOwnProperty(t)&&this.geometry[t]!==!1){var e=this.geometry[t],a={lng:e.lon,lat:e.lat};this.instance.panTo(a)}else this.instance.panTo({lat:40.7128,lng:-74.0059})},addMarker:function(e){var s=this,o=e.replace(/\s+/g,""),n=void 0;if(this.geometry&&this.geometry.hasOwnProperty(o)&&this.geometry[o]!==!1){var r=this.geometry[o],i={lng:r.lon,lat:r.lat},d=t.extend({},r.address,{location:i.lat+","+i.lng,formatted_address:r.formatted_address,companyAddress:r.lookup}),l=s.addMarkerEvents(d);if(s.isWebGlSupported){var c=new Image;c.src=a._monoLoader.ASSETSURL+"/css/images/marker-icon-2x.png",c.style.width="25px",c.style.height="41px",c.alt=_monoLang.get("##MODULE_MAP_CURRENT_LOCATION##")+": "+e;var m=new mapboxgl.Popup({offset:[0,1.1*-parseInt(c.style.height)]}).setHTML(l.outerHTML);m._closeButton.setAttribute("aria-label","Close"),m._content.setAttribute("role","dialog"),m._content.setAttribute("aria-label",_monoLang.get("##MODULE_MAP_ADDRESS##")+": "+e),n=new mapboxgl.Marker(c,{offset:[-parseInt(c.style.width)/2,-parseInt(c.style.height)]}).setLngLat([r.lon,r.lat]).setPopup(m).addTo(s.instance)}else n=L.marker(i,{alt:_monoLang.get("##MODULE_MAP_CURRENT_LOCATION##")+": "+e}).bindPopup(l).addTo(s.instance);s.markers.push(n)}else console.warn('Address: "'+e+'" is not a valid address')},addMarkerEvents:function(e){var s=this,o=e.companyAddress,n=e.formatted_address?e.formatted_address.replace(/<(?:.|\n)*?>/gm,""):"",r=o;o.match(/[a-zA-Z]+/)&&(n=o,r=n+" "+e.city+" "+e.country_code);var i=''+n+"
",d=_monoLang.get("##MODULE_MAP_DIRECTIONS_LINK##")+" "+n,l=''+_monoLang.get("##MODULE_MAP_DIRECTIONS_LINK##")+"",c=t('