import{a as X}from"./axios-4a70c6fc.js";import{o as n,c as i,f as l,d as Y,u as k,y as ee,E as U,G as te,V as se,_ as oe,r as M,a as re,h as u,b as N,w as ae,F as R,k as ne,D as g,ap as x,g as q}from"./app-84040815.js";import{E as ie}from"./index-1dc6c986.js";const le={class:"icon icon-anchor",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:"16",height:"16","aria-label":"Icon anchor"},ce=l("path",{d:"m4.8,11.07l-.54-.54,1.33-1.33.54.54c.86.86,2.25.86,3.1,0l3.75-3.75c.86-.86.86-2.25,0-3.1-.75-.75-1.9-.86-2.75-.31-.61-.24-1.26-.36-1.94-.36h0c-.15,0-.29,0-.43.02l.69-.7c.79-.79,1.84-1.19,2.88-1.19s2.02.36,2.93,1.27c1.53,1.59,1.52,4.13-.05,5.7l-3.75,3.75c-.79.79-1.84,1.19-2.88,1.19s-2.08-.4-2.88-1.19h0Zm-3.17,3.01c.96.96,1.89,1.27,2.93,1.27,1.04,0,2.08-.4,2.88-1.19l.69-.7c-.14.01-.29.02-.43.02h0c-.67,0-1.33-.12-1.94-.36-.85.56-2,.44-2.75-.31-.86-.86-.86-2.25,0-3.1l3.75-3.75c.86-.86,2.25-.86,3.1,0l.54.54,1.33-1.33-.54-.54c-1.59-1.59-4.17-1.59-5.75,0l-3.75,3.75c-1.57,1.57-1.58,4.11-.05,5.7Z",style:{"stroke-width":"0px"}},null,-1),de=[ce];function he(a,c){return n(),i("svg",le,de)}const ue={render:he},me={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:"16",height:"16","aria-label":"Email icon",class:"icon icon-email"},pe=l("path",{d:"m6.67,8.35c.73.75,1.92.75,2.65,0l6.04-6.17c-.28-.73-.97-1.2-1.74-1.21H2.38c-.77,0-1.45.48-1.74,1.21l6.04,6.17Z",style:{"stroke-width":"0px"}},null,-1),ge=l("path",{id:"c",d:"m10.21,9.25c-1.22,1.25-3.2,1.25-4.42,0L.5,3.85v11.19h15V3.85l-5.29,5.41Z",style:{"stroke-width":"0px"}},null,-1),fe=[pe,ge];function _e(a,c){return n(),i("svg",me,fe)}const ve={render:_e},G=`<svg class="icon icon-marker" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"> <path d="m8,.5C4.92.5,2.42,3.04,2.42,6.17c0,4.44,5.06,9.02,5.27,9.22.09.08.2.12.31.12s.22-.04.31-.12c.22-.19,5.27-4.78,5.27-9.22,0-3.12-2.5-5.67-5.58-5.67Zm0,8.75c-1.71,0-3.1-1.4-3.1-3.13s1.39-3.13,3.1-3.13,3.1,1.4,3.1,3.13-1.39,3.13-3.1,3.13Z" style="fill:#0c9fda; stroke-width:0px;"/> </svg> `,be={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:"16",height:"16","aria-label":"Phone icon",class:"icon icon-phone"},we=l("path",{d:"m3,.5v13.12c0,1.04.84,1.88,1.88,1.88h6.25c1.04,0,1.88-.84,1.88-1.88V.5H3Zm5.63,13.76h-1.26v-1.26h1.26v1.26Zm-3.75-2.51V2.38h6.25v9.37h-6.25Z",style:{"stroke-width":"0px"}},null,-1),ke=[we];function ye(a,c){return n(),i("svg",be,ke)}const $e={render:ye},Se=Y({components:{Mail:ve,Anchor:ue,Phone:$e,ElScrollbar:ie,Marker:G},props:{getItemsUrl:{type:String,required:!0},linkToContactForm:{type:String,required:!0},translationDealerBtn:{type:String,required:!0},translationNoResults:{type:String,required:!0},googleMapApiKey:{type:String,required:!0}},setup(a){const c=k(null),y=k([]),m=k([]),f=k({handler:!1,service:!1,text:""});let _,v=[];const d=k({store:null,marker:null});ee(async()=>{if(a.googleMapApiKey){(t=>{var s,h,p,F="The Google Maps JavaScript API",S="google",I="importLibrary",D="__ib__",B=document,w=window;w=w[S]||(w[S]={});var L=w.maps||(w.maps={}),z=new Set,C=new URLSearchParams,O=()=>s||(s=new Promise(async(E,Z)=>{var K;await(h=B.createElement("script")),C.set("libraries",[...z]+"");for(p in t)C.set(p.replace(/[A-Z]/g,Q=>"_"+Q[0].toLowerCase()),t[p]);C.set("callback",S+".maps."+D),h.src=`https://maps.${S}apis.com/maps/api/js?`+C,L[D]=E,h.onerror=()=>s=Z(Error(F+" could not load.")),h.nonce=((K=B.querySelector("script[nonce]"))==null?void 0:K.nonce)||"",B.head.append(h)}));L[I]?console.warn(F+" only loads once. Ignoring:",t):L[I]=(E,...Z)=>z.add(E)&&O().then(()=>L[I](E,...Z))})({key:a.googleMapApiKey,v:"weekly"});const{Map:r}=await google.maps.importLibrary("maps");_=new r(document.getElementById("map"),{center:{lat:47.6964719,lng:13.3457347},zoom:7.5,mapId:"e2b6e7881656f20b",disableDefaultUI:!0,zoomControl:!0}),window.innerWidth<=991&&_.setZoom(6);const o=await X.get(a.getItemsUrl);m.value=o.data.sort((t,s)=>t.name.localeCompare(s.name))}});function b(r){const o=f.value,t=o.text.toLowerCase();m.value.forEach(s=>{if(t&&!s.name.toLowerCase().includes(t)&&!s.address.toLowerCase().includes(t)){s.hidden=!0;return}if(o.handler&&!s.handler||o.service&&!s.service){s.hidden=!0;return}s.hidden=!1}),r&&e()}function A(){f.value.text="",b()}function e(){window.innerWidth<=991&&setTimeout(()=>{se.scrollTo("#locator-sidebar",{offset:-50,easing:"linear",duration:0})},100)}function T(r){_.setZoom(11),_.panTo(r.position)}function $(r){const o=document.createElement("div");return o.classList.add("marker"),o.innerHTML=G,o.dataset.id=r.toString(),o}async function W(){v.forEach(t=>{t.setMap(null)}),v=[];const{PinElement:r,AdvancedMarkerElement:o}=await google.maps.importLibrary("marker");m.value.forEach(t=>{if(t.hidden)return;const s=new o({position:{lat:Number(t.latitude),lng:Number(t.longitude)},map:_,content:$(t.uid)});s.addListener("click",()=>{const h=y.value.find(p=>Number(p==null?void 0:p.getAttribute("data-id"))===t.uid);h&&(P(h,s),c.value.scrollTo({top:h.offsetTop,behavior:"smooth"}),e())}),v.push(s)})}function H(r,o,t){r.classList.add("highlight"),o.content.classList.add("highlight"),d.value={store:r,marker:o},t&&T(o)}function V(){d.value.store&&d.value.marker&&(d.value.store.classList.remove("highlight"),d.value.marker.content.classList.remove("highlight"))}function P(r,o,t=!1){if(d.value.store&&d.value.marker){const s=Number(d.value.store.getAttribute("data-id")),h=Number(r.getAttribute("data-id"));s===h?(V(),d.value={store:null,marker:null}):(V(),H(r,o,t))}else H(r,o,t)}function j(r){const o=v.find(s=>s.position.lat===Number(r.latitude)&&s.position.lng===Number(r.longitude)),t=y.value.find(s=>Number(s.getAttribute("data-id"))===r.uid);o&&t&&P(t,o,!0)}U(m,()=>{W()},{deep:!0}),U(()=>[f.value.handler,f.value.service],(r,o)=>{b(),V(),d.value={store:null,marker:null}});const J=te(()=>m.value.filter(r=>!r.hidden).length===0);return{stores:m,searchStores:b,highlightStore:j,searchReset:A,filters:f,scrollContainer:c,noFilterResults:J,storesRef:y,props:a}}}),Le={class:"container","data-aos":"fade-up"},Ce={class:"store-locator-box"},Ee={class:"store-locator-box-content"},Me={key:0,id:"map",class:"store-locator-box-content-map"},Ne={id:"locator-sidebar",class:"store-locator-sidebar"},xe=["onClick","data-id"],Ae={class:"store-locator-sidebar-item-header"},Te={key:0,class:"store-locator-sidebar-item-header-title"},Ve={key:1,class:"store-locator-sidebar-item-header-description"},Ie={class:"store-locator-sidebar-item-address"},Be=["innerHTML"],Ze=["href"],Re={class:"store-locator-sidebar-item-address-link-icon-wrapper"},qe=["href"],He={class:"store-locator-sidebar-item-address-link-icon-wrapper"},Pe=["href"],Fe={class:"store-locator-sidebar-item-address-link-icon-wrapper"},De=["href"],ze={key:0,class:"store-locator-sidebar-item no-results"},Ke={class:"store-locator-sidebar-item-header"},Ue={class:"store-locator-sidebar-item-header-title"};function Ge(a,c,y,m,f,_){const v=M("mail"),d=M("Anchor"),b=M("phone"),A=M("el-scrollbar");return n(),i(R,null,[re(a.$slots,"toolbar",{filters:a.filters,searchStores:a.searchStores,searchReset:a.searchReset}),l("div",Le,[l("div",Ce,[l("div",Ee,[a.props.googleMapApiKey?(n(),i("div",Me)):u("",!0),l("div",Ne,[N(A,{always:!0,ref:e=>a.scrollContainer=e},{default:ae(()=>[(n(!0),i(R,null,ne(a.stores,(e,T)=>(n(),i(R,null,[e.hidden?u("",!0):(n(),i("div",{key:0,onClick:$=>a.highlightStore(e),ref_for:!0,ref:$=>a.storesRef[T]=$,"data-id":e.uid,class:"store-locator-sidebar-item"},[l("div",Ae,[e.name?(n(),i("span",Te,g(e.name),1)):u("",!0),e.description?(n(),i("span",Ve,g(e.description),1)):u("",!0)]),l("address",Ie,[e.address?(n(),i("span",{key:0,class:"store-locator-sidebar-item-address-address",innerHTML:e.address},null,8,Be)):u("",!0),e.email?(n(),i("a",{key:1,onClick:c[0]||(c[0]=x(()=>{},["stop"])),href:"mailto:"+e.email,target:"_blank",class:"store-locator-sidebar-item-address-link"},[l("span",Re,[N(v)]),q(" "+g(e.email),1)],8,Ze)):u("",!0),e.link?(n(),i("a",{key:2,onClick:c[1]||(c[1]=x(()=>{},["stop"])),href:"https://"+e.link,target:"_blank",class:"store-locator-sidebar-item-address-link"},[l("span",He,[N(d)]),q(" "+g(e.link),1)],8,qe)):u("",!0),e.phoneNumber?(n(),i("a",{key:3,onClick:c[2]||(c[2]=x(()=>{},["stop"])),href:"tel:"+e.phoneNumber.replace(/\s/g,""),target:"_blank",class:"store-locator-sidebar-item-address-link"},[l("span",Fe,[N(b)]),q(" "+g(e.phoneNumber),1)],8,Pe)):u("",!0)]),e.handler?(n(),i("a",{key:0,onClick:c[3]||(c[3]=x(()=>{},["stop"])),href:`${a.props.linkToContactForm}?topic=eineProbefahrtBuchen&storeId=${e.uid}&state=${e.state}`,class:"btn btn-primary"},g(a.$props.translationDealerBtn),9,De)):u("",!0)],8,xe))],64))),256)),a.noFilterResults?(n(),i("div",ze,[l("div",Ke,[l("span",Ue,g(a.$props.translationNoResults),1)])])):u("",!0)]),_:1},512)])])])])],64)}const Oe=oe(Se,[["render",Ge]]);export{Oe as default}; //# sourceMappingURL=Locator-7ffebc88.js.map