/*! YOOtheme Pro v4.3.13 | https://yootheme.com */

(function(W,m){"use strict";function N(o){m.$$(".el-item",o).forEach(n=>m.$$("script",n.parentNode).forEach(e=>{const i=m.$("<script>");i.textContent=e.textContent,e.replaceWith(i)}))}function O(o,{type:n,center:e,zoom:i,min_zoom:S,max_zoom:T,zooming:I,dragging:z,clustering:v,cluster_icons:t,controls:A,poi:b,markers:f,styler_invert_lightness:G,styler_hue:c,styler_saturation:y,styler_lightness:u,styler_gamma:M,popup_max_width:p}){const a=new google.maps.LatLng(e.lat,e.lng),s=new google.maps.Map(o,{zoom:Number(i),minZoom:Number(S),maxZoom:Number(T),center:a,mapTypeId:google.maps.MapTypeId[n.toUpperCase()],disableDefaultUI:!A,gestureHandling:z||I?"auto":"none",mapTypeControlOptions:{mapTypeIds:["styled_map","satellite"]}});let w;const g=new google.maps.InfoWindow({maxWidth:p?parseInt(p,10):300});g.addListener("domready",()=>N(o));let $;if(v){const h={map:s};Array.isArray(t)&&(h.renderer={render({count:l,position:x}){let r;return l<10?r=t[0]:l<100?r=t[1]||t[0]:r=t[2]||t[1]||t[0],new google.maps.Marker({position:x,icon:{url:r.url,scaledSize:r.size?new google.maps.Size(...r.size):null},label:{text:String(l),color:r.textColor?r.textColor:null,fontSize:"11px",fontWeight:"bold"},zIndex:Number(google.maps.Marker.MAX_ZINDEX)+l})}}),$=new markerClusterer.MarkerClusterer(h)}f==null||f.forEach(({lat:h,lng:l,content:x,show_popup:r,icon:E,iconSize:P,iconAnchor:Z,title:U})=>{const C=new google.maps.Marker({map:s,title:U,position:new google.maps.LatLng(h,l)});if(E&&C.setIcon({url:E,scaledSize:P?new google.maps.Size(...P):null,anchor:Z?new google.maps.Point(...Z):null}),$&&$.addMarker(C),x){const D=()=>{if(g.getMap()&&w===C){g.close();return}g.setContent(x),g.open(s,C),w=C};google.maps.event.addListener(C,"click",D),r&&D()}});const d=new google.maps.StyledMapType([{featureType:"all",elementType:"all",stylers:[{invert_lightness:G},{hue:c},{saturation:y},{lightness:u},{gamma:M}]},{featureType:"poi",stylers:[{visibility:b?"on":"off"}]}],{name:"Map"});s.mapTypes.set("styled_map",d),n.toUpperCase()==="ROADMAP"&&s.setMapTypeId("styled_map")}async function H(o,{type:n,center:e,zoom:i,min_zoom:S,max_zoom:T,zooming:I,dragging:z,clustering:v,cluster_icons:t,controls:A,markers:b,popup_max_width:f,baseUrl:G}){L.Icon.Default.imagePath=`${G}/images/`;const c=L.map(o,{zoom:i,minZoom:Number(S),maxZoom:Number(T),center:e,dragging:z,zoomControl:A,touchZoom:I,scrollWheelZoom:I,doubleClickZoom:I});c.on("popupopen",()=>N(o)),n==="satellite"?L.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(c):L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a>'}).addTo(c);let y;if(v){const u={showCoverageOnHover:!1};t&&(u.iconCreateFunction=M=>{const p=M.getChildCount();let a;p<10?a=t[0]:p<100?a=t[1]||t[0]:a=t[2]||t[1]||t[0];const s=a.textColor?`style="color: ${a.textColor}"`:"";return new L.DivIcon({html:`<img src="${a.url}" alt><span class="uk-position-center"${s}>${p}</span>`,iconSize:a.size?new L.Point(...a.size):null})}),y=L.markerClusterGroup(u),c.addLayer(y)}b==null||b.forEach(({lat:u,lng:M,content:p,show_popup:a,icon:s,iconSize:w,iconAnchor:g,title:$})=>{const d=L.marker({lat:u,lng:M},{title:$});if(s&&d.setIcon(L.icon({iconUrl:s,iconSize:w,iconAnchor:g})),y?y.addLayer(d):d.addTo(c),p){const h={maxWidth:f?parseInt(f,10):300};w&&(h.offset=new L.Point(0,-1*w[1]+7));const l=L.popup(h).setContent(p);d.bindPopup(l),a&&d.openPopup()}})}W.component("Map",{connected(){var n;if(this.script||(this.script=m.$("script",this.$el)),!this.script)return;this.map=JSON.parse(this.script.textContent);const o=m.$$("template",this.$el);(n=this.map.markers)==null||n.forEach((e,i)=>{e.content=m.html(o[i]).trim(),!e.icon&&this.map.icon&&(e.icon=this.map.icon,e.iconSize=this.map.iconSize,e.iconAnchor=this.map.iconAnchor)}),this.map.lazyload&&"IntersectionObserver"in window?m.observeIntersection(this.$el,(e,i)=>{this.load(),i.disconnect()},{rootMargin:`${window.innerHeight/2}px 0px`}):this.load()},methods:{load(){var o,n,e;((o=this.map)==null?void 0:o.library)==="google"&&((n=window.google)!=null&&n.maps)&&O(this.$el,this.map),((e=this.map)==null?void 0:e.library)==="leaflet"&&window.L&&H(this.$el,this.map)}}})})(UIkit,UIkit.util);
