(()=>{function t(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var o,i,r,a,s=[],u=!0,p=!1;try{if(r=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;u=!1}else for(;!(u=(o=r.call(e)).done)&&(s.push(o.value),s.length!==n);u=!0);}catch(t){p=!0,i=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(p)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,o=Array(n);e<n;e++)o[e]=t[e];return o}var e=function(t){return this.popup=t.popup,this.popupContent=null,this.map=t.map||null,this.contentIsSet=function(){return null!==this.popupContent},this.close=function(){},this.setMap=function(t){this.map=t},this.draw=function(){},this.open=function(t,n){},this.setContent=function(t){if(void 0===t.nodeType){var n=document.createElement("div");n.innerHTML=t,t=n}this.popupContent=t,this.popup.setContent(t)},this};window.JetEngineMapsProvider=function(){this.getId=function(){return"leaflet"},this.getContainer=function(t){return t.getContainer()},this.getBoundsJSON=function(t){var n=t.getBounds();if(n)return{east:n.getEast(),north:n.getNorth(),south:n.getSouth(),west:n.getWest()}},this.updateSyncBounds=function(){var t=this.getBounds();t&&window.JetEngineMaps.dispatchMapSyncEvent(this,{east:t.getEast(),north:t.getNorth(),south:t.getSouth(),west:t.getWest()})},this.initSync=function(t){null!=t&&t.isJetEngineSyncInited||!window.JetEngineMaps||!window.JetSmartFilters||(t.on("zoomend",this.updateSyncBounds),t.on("moveend",this.updateSyncBounds),t.on("resize",this.updateSyncBounds),t.whenReady(function(){window.JetEngineMaps.dispatchMapSyncInitEvent(t)}),t.isJetEngineSyncInited=!0)},this.initMap=function(n,e){e=e||{};for(var o={},i=0,r=Object.entries({zoom:"zoom",center:"center",scrollWheelZoom:"scrollwheel",zoomControl:"zoomControl",maxZoom:"maxZoom",minZoom:"minZoom"});i<r.length;i++){var a=t(r[i],2),s=a[0],u=a[1];void 0!==e[u]&&(o[s]=e[u])}o.center&&(o.center=JetEngineLeaflet.latLng(o.center.lat,o.center.lng));var p=JetEngineLeaflet.map(n,o),l=window.JetPlugins.hooks.applyFilters("jet-engine.maps-listings.leaflet.tileURL","https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"),c=window.JetPlugins.hooks.applyFilters("jet-engine.maps-listings.leaflet.tileOptions",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'});return JetEngineLeaflet.tileLayer(l,c).addTo(p),this.initSync(p),p},this.initBounds=function(){return JetEngineLeaflet.latLngBounds([])},this.getMarkerPosition=function(t){return t.getLatLng()},this.fitMapBounds=function(t){var n=null;try{n=t.bounds.getCenter()}catch(t){console.log("Can`t define new map center without markers.")}return!!n&&(t.map.fitBounds(t.bounds),!0)},this.addMarker=function(t){var n=JetEngineLeaflet.divIcon({html:t.content,iconSize:[32,32]}),e=JetEngineLeaflet.marker([t.position.lat,t.position.lng],{icon:n});return t.markerClustering||e.addTo(t.map),e},this.removeMarker=function(t){t.remove()},this.closePopup=function(t,n,e){e.on("popupclose",function(e){e.popup===t.popup&&n()})},this.openPopup=function(t,n,e,o,i){o.on("popupopen",function(t){o.isInternalInteraction=!0,t.popup===e.popup&&n()}),t.bindPopup(e.popup),"hover"===i&&t.on("mouseover",function(){t.isPopupOpen()||(o.isInternalInteraction=!0,t.openPopup())})},this.triggerOpenPopup=function(t){t.openPopup()},this.setAutocenterBlock=function(t){if(!t.target._map.jetPlugins.autoCenterBlock){var n=t.target._spiderfied||!1,e=t.layer;t.target._map.jetPlugins.autoCenterBlock=n&&n.getAllChildMarkers().includes(e)}},this.getMarkerCluster=function(n){for(var e,o={},i=0,r=Object.entries({disableClusteringAtZoom:"clusterMaxZoom",maxClusterRadius:"clusterRadius"});i<r.length;i++){var a=t(r[i],2),s=a[0],u=a[1];void 0!==n[u]&&""!==n[u]&&(o[s]=n[u])}null!==(e=n.customClusterImg)&&void 0!==e&&e.length&&(o.iconCreateFunction=function(t){for(var e=t.getChildCount(),o=n.customClusterImg,i=0,r=e;0!==r;)r=Math.floor(r/10),i++;var a=o[i=Math.min(i,o.length)-1],s=a.width||40,u=a.url,p='\n\t\t\t\t\t<img src="'.concat(u,'" style="position: absolute; height: 100%; width: 100%; object-fit: cover;">\n\t\t\t\t\t<div style="position: absolute;font-size: 18px;">\n\t\t\t\t\t\t<span style="line-height: 80px; ">').concat(e,"</span>\n\t\t\t\t\t</div>\n\t\t\t\t");return new JetEngineLeaflet.DivIcon({html:p,className:"cluster custom-cluster custom-cluster-"+i,iconSize:new JetEngineLeaflet.Point(s,s)})});var p=JetEngineLeaflet.markerClusterGroup(o);return p.addLayers(n.markers),n.map.addLayer(p),p.on("click mouseover",this.setAutocenterBlock),p},this.addMarkers=function(t,n){t.addLayers(n)},this.removeMarkers=function(t,n){t.removeLayers(n)},this.markerOnClick=function(t,n,e){var o=this;(n=n||{}).map=t,n.shadow=!1,t.on("click",function(t){n.position={lat:t.latlng.lat,lng:t.latlng.lng},e&&e(o.addMarker(n))})},this.setCenterByPosition=function(t){t.map.setView(t.position,t.zoom)},this.setAutoCenter=function(t){t.map.isInternalInteraction=!0,this.fitMapBounds(t)||(window.JetEngineMapData&&window.JetEngineMapData.mapCenter?t.map.setView(window.JetEngineMapData.mapCenter,10):t.map.fitWorld())},this.addPopup=function(t){var n=JetEngineLeaflet.popup({maxWidth:t.width,minWidth:t.width,keepInView:!0,className:"jet-map-box"});return new e({popup:n})},this.getMarkerMap=function(t){return t._map},this.isMarkerClusterOpen=function(t,n){return!(null==n||!n._spiderfied||!t._spiderLeg)},this.fitMapToMarker=function(t,n,e){var o=this,i=n._map;i.jetPlugins.autoCenterBlock=!0,n.zoomToShowLayer(t,function(){var n;null!=t&&null!==(n=t.__parent)&&void 0!==n&&n._icon||o.panTo({map:i,position:o.getMarkerPosition(t),zoom:e}),o.triggerOpenPopup(t),i.jetPlugins.autoCenterBlock=!1})},this.panTo=function(t){var n=t.zoom&&t.zoom>t.map.getZoom()?t.zoom:t.map.getZoom();t.map.flyTo(t.position,n)}}})();