/*! YOOtheme Pro v5.0.37 | https://yootheme.com */

const L=window.UIkit&&Object.prototype.hasOwnProperty.call(window.UIkit,"default")?window.UIkit.default:window.UIkit,{$:O,trigger:D,$$:E,html:N,observeIntersection:Z}=window.UIkit.util;async function k(t,{type:n,center:a,zoom:i,fit_bounds:e,min_zoom:U,max_zoom:x,zooming:y,dragging:P,clustering:I,cluster_icons:p,controls:A,markers:h=[],popup_max_width:G}){const r=new URL(import.meta.url).pathname+"/../../../leaflet",S=[await import(`${r}/leaflet/dist/leaflet.js`),await C(`${r}/leaflet/dist/leaflet.css`)];I&&S.push(await import(`${r}/markercluster/dist/leaflet.markercluster.js`),await C(`${r}/markercluster/dist/MarkerCluster.css`),await C(`${r}/markercluster/dist/MarkerCluster.Default.css`)),await Promise.all(S);const{L:o}=window;o.Icon.Default.imagePath=`${r}/leaflet/dist/images/`;const d=o.map(t,{zoom:i,minZoom:Number(U),maxZoom:Number(x),center:a,dragging:P,zoomControl:A,touchZoom:y,scrollWheelZoom:y,doubleClickZoom:y});n==="satellite"?o.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",{attribution:'&copy; <a href="https://www.esri.com">Esri</a> | DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community'}).addTo(d):o.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a>'}).addTo(d);let w;if(I){const c={showCoverageOnHover:!1};Array.isArray(p)&&p.length&&(c.iconCreateFunction=m=>{const l=m.getChildCount(),s=l>=100&&p[2]||l>=10&&p[1]||p[0],u=s.textColor?`style="color: ${s.textColor}"`:"";return new o.DivIcon({html:`<img src="${s.url}" alt><span class="uk-position-center"${u}>${l}</span>`,iconSize:s.size?new o.Point(...s.size):null})}),w=o.markerClusterGroup(c),d.addLayer(w)}for(const{lat:c,lng:m,content:l,show_popup:s,icon:u,iconSize:g,iconAnchor:v,title:z}of h){const f=o.marker({lat:c,lng:m},{title:z});if(u&&f.setIcon(o.icon({iconUrl:u,iconSize:g,iconAnchor:v})),w?w.addLayer(f):f.addTo(d),l){const b={maxWidth:Number(G||300)};g&&(b.offset=new o.Point(0,-1*g[1]+7));const M=o.popup(b).setContent(l);f.bindPopup(M),s&&f.openPopup()}}e&&(h!=null&&h.length)&&d.fitBounds(h.map(({lat:c,lng:m})=>[c,m]),{padding:[50,50]})}let $={};function C(t){var n;return(n=$[t])!=null?n:$[t]=new window.Promise((a,i)=>{const e=document.createElement("link");e.onload=()=>a(t),e.onerror=()=>i(t),e.rel="stylesheet",e.href=t,document.head.appendChild(e)})}L.component("Map",{async connected(){var t,n,a;this.script||(this.script=O("script",this.$el)),this.script&&(D(document,"uikit:connected",this),(t=this.map)!=null||(this.map=JSON.parse(this.script.textContent)),(n=this.templates)!=null||(this.templates=E("template",this.$el)),(a=this.map.markers)==null||a.forEach((i,e)=>{i.content=N(this.templates[e]).trim(),!i.icon&&this.map.icon&&(i.icon=this.map.icon,i.iconSize=this.map.iconSize,i.iconAnchor=this.map.iconAnchor)}),this.map.lazyload&&"IntersectionObserver"in window?Z(this.$el,(i,e)=>{k(this.$el,this.map),e.disconnect()},{rootMargin:`${window.innerHeight/2}px 0px`}):k(this.$el,this.map))}});
