document.addEventListener("DOMContentLoaded",function(){if(window?.ABlocksGlobal&&window?.ABlocksGlobal?.is_gutenberg_editor)return;const o=document.querySelectorAll(".ablocks-map-block");o.length&&o.forEach(o=>{((o,e)=>{const t=e.iconHeight,n=e.iconWidth,r=L.layerGroup();e.mapMarkerList.forEach(function(o){let i="";if(""!==o.title&&(i+="<h6>"+o.title+"</h6>"),""!==o.content&&(i+="<p>"+o.content+"</p>"),"custom"===o.iconType){const e=new(L.Icon.extend({options:{iconSize:[o.customIconWidth,o.customIconHeight],popupAnchor:[0,-15]}}))({iconUrl:o.customIconUrl});""!==o.title||""!==o.content?L.marker([o.lat,o.lng],{icon:e}).bindPopup(i).addTo(r):L.marker([o.lat,o.lng],{icon:e}).addTo(r)}else""!==o.title||""!==o.content?L.marker([o.lat,o.lng],{icon:new L.Icon({iconUrl:e?.defaultMarkerIcon,iconSize:[n,t],popupAnchor:[0,-15]})}).bindPopup(i).addTo(r):L.marker([o.lat,o.lng],{icon:new L.Icon({iconUrl:e?.defaultMarkerIcon,iconSize:[n,t],popupAnchor:[0,-15]})}).addTo(r)});const i="OSM"===e.mapType?"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png":"https://maps.googleapis.com/maps/vt?pb=!1m5!1m4!1i{z}!2i{x}!3i{y}!4i256!2m3!1e0!2sm!3i349018013!3m9!2sen-US!3sUS!5e18!12m1!1e47!12m3!1e37!2m1!1ssmartmaps!4e0",a="GM_SATELLITE"===e.mapType?"https://maps.googleapis.com/maps/vt?lyrs=s&x={x}&y={y}&z={z}&key=YOUR_API_KEY":i,c=L.tileLayer(a,{id:"mapbox/light-v9"}),l={zoom:e.mapZoom,zoomControl:!1,layers:[c,r],scrollWheelZoom:e.scrollWheelZoom,dragging:!L.Browser.mobile,tap:!L.Browser.mobile};e.mapMarkerList.length&&e.mapMarkerList[e.centerIndex]&&(l.center=[e.mapMarkerList[e.centerIndex].lat,e.mapMarkerList[e.centerIndex].lng]);const p=L.map(o,l);p.addControl(new L.Control.Fullscreen({position:"topleft"})),L.control.zoom({position:"topright"}).addTo(p)})(o,JSON.parse(o.getAttribute("data-settings")))})});