document.addEventListener(window.aioseoMapOptions.mapLoadEvent,function(e){if(e.detail===null||!e.detail||!e.detail.element||!e.detail.mapOptions)return;const n=document.querySelector(e.detail.element);if(!n||n.className.match(/map-loaded/))return;if(e.detail.placeId){const a=document.createElement("iframe");a.style.width=e.detail.instance.width,a.style.height=e.detail.instance.height,a.style.border="0",a.frameborder="0",a.src="https://www.google.com/maps/embed/v1/place?key="+window.aioseoMapOptions.apiKey+"&q=place_id:"+e.detail.placeId,n.replaceChildren(a),n.className+=" map-loaded";return}new google.maps.plugins.loader.Loader({apiKey:window.aioseoMapOptions.apiKey,libraries:["places"]}).load().then(a=>{const t=new a.maps.Map(n,e.detail.mapOptions),i=new a.maps.Marker({map:t,position:e.detail.mapOptions.center,icon:e.detail.customMarker?{url:e.detail.customMarker,origin:new a.maps.Point(0,0),anchor:new a.maps.Point(17,34),scaledSize:new a.maps.Size(25,25)}:null});if(e.detail.infoWindowContent){const o=new a.maps.InfoWindow({content:e.detail.infoWindowContent});o.open(t,i),i.addListener("click",()=>{o.open({anchor:i,map:t,shouldFocus:!1})})}n.className+=" map-loaded"}).catch(a=>{console.error(a)})});
