"use strict";(()=>{var ct=Object.create;var V=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames,Be=Object.getOwnPropertySymbols,ht=Object.getPrototypeOf,$e=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable;var se=(s,e,t)=>e in s?V(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,L=(s,e)=>{for(var t in e||(e={}))$e.call(e,t)&&se(s,t,e[t]);if(Be)for(var t of Be(e))mt.call(e,t)&&se(s,t,e[t]);return s};var l=(s,e)=>V(s,"name",{value:e,configurable:!0});var ut=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var vt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pt(e))!$e.call(s,o)&&o!==t&&V(s,o,{get:()=>e[o],enumerable:!(i=dt(e,o))||i.enumerable});return s};var gt=(s,e,t)=>(t=s!=null?ct(ht(s)):{},vt(e||!s||!s.__esModule?V(t,"default",{value:s,enumerable:!0}):t,s));var p=(s,e,t)=>se(s,typeof e!="symbol"?e+"":e,t);var w=(s,e,t)=>new Promise((i,o)=>{var a=r=>{try{c(t.next(r))}catch(d){o(d)}},n=r=>{try{c(t.throw(r))}catch(d){o(d)}},c=r=>r.done?i(r.value):Promise.resolve(r.value).then(a,n);c((t=t.apply(s,e)).next())});var Qe=ut((gi,Xe)=>{"use strict";Xe.exports=l(function s(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var i,o,a;if(Array.isArray(e)){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!s(e[o],t[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(a=Object.keys(e),i=a.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[o]))return!1;for(o=i;o--!==0;){var n=a[o];if(!s(e[n],t[n]))return!1}return!0}return e!==e&&t!==t},"equal")});function ae(s){let e=[];for(let i=0;i<256;i++){let o=i;for(let a=0;a<8;a++)o&1?o=3988292384^o>>>1:o=o>>>1;e[i]=o}let t=-1;for(let i=0;i>>8^e[(t^s.charCodeAt(i))&255];return(t^-1)>>>0}l(ae,"crc32");function Y(s,e){let t="XvlojIHaIe"+(s||"")+(e||"");return ae(t).toString()}l(Y,"generateSignature");function Ze(){return w(this,null,function*(){let s="https://maps.develic.com",e=window.Shopify.shop,t="-",i=Y(e,t),o=yield fetch(s+`/api/shop_info?shop=${encodeURIComponent(e)}&handle=${encodeURIComponent(t)}&signature=${encodeURIComponent(i)}`);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return yield o.json()})}l(Ze,"loadShopInfo");function qe(s){return w(this,null,function*(){let e="https://maps.develic.com",t=window.Shopify.shop,i=Y(t,s),o=yield fetch(e+`/api/page_info?shop=${encodeURIComponent(t)}&handle=${encodeURIComponent(s)}&signature=${encodeURIComponent(i)}`);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return yield o.json()})}l(qe,"loadPageInfo");function Ge(){return w(this,null,function*(){if(!window.Shopify||!window.Shopify.shop)return;let s="https://maps.develic.com",e=window.Shopify.shop,t="-",i=Y(e,t),o=yield fetch(s+`/api/hit?shop=${encodeURIComponent(e)}&handle=${encodeURIComponent(t)}&signature=${encodeURIComponent(i)}`,{method:"post"});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`)})}l(Ge,"trackMapHit");function We(s,e,t,i){if(document.querySelector("#init-google-maps-script"))return;let a=location.href.indexOf("maps.develic.com")!=-1||location.href.indexOf("localhost")!=-1||location.href.indexOf("maps-devtest.herokuapp.com")!=-1||location.href.indexOf("omnium-maps.test")!=-1?"AIzaSyCEvVAll3-jVgwAqiIHWnE_Ue2qU2OFhAM":s,n=document.createElement("script"),r=`https://maps.googleapis.com/maps/api/js?loading=async&key=${a}&v=weekly`;r+="&loading=async",r+="&libraries="+e,t&&(r+="®ion="+t),i&&(r+="&language="+i),n.id="init-google-maps-script",n.src=r,document.getElementsByTagName("head")[0].appendChild(n)}l(We,"loadGoogleMapsSDK");function je(){if(document.querySelector("#develic_maps_base_styles")||document.querySelector('link[type="text/css"][data-app-id="15487172609"]')||document.querySelector('link[type="text/css"][data-app-id="1516075"]'))return;let s="https://maps.develic.com/packs/front.css",e=document.querySelector('meta[name="develic-maps-global-styles-url"]');e&&(s=e.getAttribute("content")||s);let t=document.createElement("link");t.id="develic_maps_base_styles",t.rel="stylesheet",t.href=s,t.onload=()=>{window.develic_maps_global_styles_loaded=!0},document.getElementsByTagName("head")[0].appendChild(t)}l(je,"loadGlobalMapsStyles");function Ke(){return Array.from(document.querySelectorAll('[develic-map-mode="standalone"]')).map(s=>{let e=JSON.parse(s.getAttribute("develic-map")),t=C(e.options.onload_hook);return{rootEl:s,data:e,extras:t,mode:"standalone"}})}l(Ke,"loadStandaloneMaps");function Ve(s){return w(this,null,function*(){let e=ft();return e&&s.pages_with_map.indexOf(e)!==-1?(yield qe(e)).map_data:null})}l(Ve,"loadCurrentPageMapIfExists");function ft(){let s=window.location.href.match(/\/pages\/([^\/\?#]*)+(\?.*)?/);if(s)return s[1];if(window.location.href.match(/admin\.shopify\.com/)){let e=window.location.search,t=new URLSearchParams(e);if(t.get("previewPath")&&(s=t.get("previewPath").match(/\/pages\/([^\/\?#]*)+(\?.*)?/),s))return s[1]}return null}l(ft,"loadCurrentPageHandle");function C(onload_hook_code){try{if((onload_hook_code==null?void 0:onload_hook_code.trim())!==""){let constructorFunc=l(function(){eval(onload_hook_code)},"constructorFunc"),extras=new constructorFunc;return extras}}catch(s){console.error(s)}return{}}l(C,"loadExtrasFromHookCode");function re(s){return w(this,null,function*(){return s&&window.google&&window.google.maps&&window.google.maps.Map&&window.google.maps.places&&window.google.maps.places.Autocomplete||!s&&window.google&&window.google.maps&&window.google.maps.Map?!0:(yield new Promise(e=>setTimeout(e,50)),yield re(s))})}l(re,"waitForGoogleMapsSDK");function ne(){return w(this,null,function*(){return document.querySelector('link[type="text/css"][data-app-id="15487172609"]')||document.querySelector('link[type="text/css"][data-app-id="1516075"]')||window.develic_maps_global_styles_loaded?!0:(yield new Promise(s=>setTimeout(s,50)),yield ne())})}l(ne,"waitForDevelicGlobalStyles");function Ye(){if(_t())return null;let s=null,e=null,t=[["inside",".page-content:last-of-type"],["inside",".main-content:last-of-type"],["inside",".site-content:last-of-type"],["inside",".main-page-wrapper:last-of-type"],["inside-end","main"],["inside-end",'[role="main"]:last-of-type'],["inside-end","#MainContent"],["after","h1"],["after","h2"],["after","h3"],["before","footer"],["before",".footer"]];return document.querySelector("[develic-map-container]")&&(s="inside",e="[develic-map-container]"),!e&&document.querySelector(".map-wrapper")&&(s="inside",e=".map-wrapper"),t.forEach(i=>{let o=document.querySelector(i[1]);!e&&o&&(bt(o)||(s=i[0],e=i[1]))}),e?le(s,e):null}l(Ye,"createMapElementForAutoPlacement");function le(s,e){let t=document.createElement("div");t.setAttribute("develic-map","");let i=document.querySelector(e);return i&&s=="inside"?i.firstChild?(i.insertBefore(t,i.firstChild),t):(i.appendChild(t),t):i&&s=="inside-end"?(i.appendChild(t),t):i&&s=="before"?(i.parentNode.insertBefore(t,i),t):i&&s=="after"?(i.parentNode.insertBefore(t,i.nextSibling),t):null}l(le,"createMapElementForCSSPlacement");function Je(s){let e={};[].forEach.call(document.querySelectorAll("[develic-map]"),t=>{var o;if(t.getAttribute("develic-map-mode")=="standalone")return;let i;try{let a=ae(t.getAttribute("develic-map")).toString();if(e[a]){(o=t.parentElement)==null||o.removeChild(t);return}e[a]=!0,document.querySelector("[develic-map-container]")&&(document.querySelector("[develic-map-container]").appendChild(t),t.getAttribute("style")&&t.setAttribute("style","")),i=JSON.parse(t.getAttribute("develic-map"));let n=C(i.options.onload_hook);s.push({rootEl:t,data:i,extras:n,mode:"shopify"})}catch(a){console.error(a)}})}l(Je,"addAllMapsElementForLiquidPlacementToDynamicMaps");function _t(){if(document&&document.readyState==="complete"){if(document.title.toLowerCase().includes("404")||document.title.toLowerCase().includes("not found"))return!0;if(document.getElementsByTagName("html")[0].className.includes("404"))return!0}return!1}l(_t,"checkIfOn404Page");function bt(s){let e=document.querySelector("footer")||document.querySelector(".footer"),t=s.parentNode;if(!e)return!1;for(;t!=null;){if(t===e)return!0;t=t.parentNode}return!1}l(bt,"checkIfInsideFooter");var ce=class ce{constructor(e){p(this,"develic_map");p(this,"ev_subscriptions");p(this,"ev_last_id");p(this,"itemsToRender");p(this,"itemsToHide");p(this,"i18n");p(this,"fullscreen_on");p(this,"show_hq_mode_active");p(this,"last_search_mode");p(this,"last_search_params");this.develic_map=e,this.fullscreen_on=!1,this.show_hq_mode_active=!1,this.last_search_mode="clear",this.last_search_params=null,this.ev_subscriptions={onBeforeSearch:new Map,onAfterSearch:new Map,onInfoWindowOpen:new Map,onInfoWindowClear:new Map,onBeforeFullscreenToggled:new Map,onAfterFullscreenToggled:new Map},this.ev_last_id=0,this.itemsToRender=[],this.itemsToHide=[],e.data.items.forEach((t,i)=>{this.itemsToRender.push(i)}),this.i18n={search_address:this.develic_map.data.options.i18n.search_address||"Search by address",filter_title_description:this.develic_map.data.options.i18n.filter_title_description||"Filter by title or description",left_panel_empty:this.develic_map.data.options.i18n.left_panel_empty||"There are no items created yet.",left_panel_empty_search:this.develic_map.data.options.i18n.left_panel_empty_search||"Can't find any item by this search phrase.",get_direction:this.develic_map.data.options.i18n.get_direction||"Get directions",by_address:this.develic_map.data.options.i18n.by_address,by_exact_text:this.develic_map.data.options.i18n.by_exact_text,no_results_autocomplete:this.develic_map.data.options.i18n.no_results_autocomplete},window.maemae_mode&&window.location.pathname=="/fr/pages/points-of-sale"&&(this.i18n.search_address="Recherche par adresse",this.i18n.get_direction="Obtenir un itin\xE9raire")}subscribe(e,t){this.ev_last_id+=1;let i="uuid_"+this.ev_last_id.toString();return this.ev_subscriptions[e].set(i,t),i}unsubscribe(e,t){this.ev_subscriptions[e].delete(t)}emit(e,t){this.ev_subscriptions[e].forEach(i=>{i(t)})}actionInitialSearch(){this.actionClearSearch()}actionRepeatLastSearch(){if(this.last_search_mode=="clear")this.actionClearSearch();else if(this.last_search_mode=="simple")this.actionSimpleSearch(this.last_search_params);else if(this.last_search_mode=="geocoding"){let e=this.last_search_params;this.actionGeocodingSearch(e[0],e[1],e[2])}}actionClearSearch(){this.last_search_mode="clear",this.last_search_params=null,this.emit("onBeforeSearch"),this.itemsToRender=[],this.itemsToHide=[],this.develic_map.data.items.forEach((e,t)=>{if(this.develic_map.extras.troyleedesigns_filters_enabled&&(this.develic_map.extras.troyleedesigns_categories.bike||this.develic_map.extras.troyleedesigns_categories.moto||this.develic_map.extras.troyleedesigns_categories.both)){this.develic_map.extras.troyleedesigns_categories[e.troylee_category]?this.itemsToRender.push(t):this.itemsToHide.push(t);return}this.itemsToRender.push(t)}),this.emit("onInfoWindowClear"),this.emit("onAfterSearch")}actionTriggerInfoWindow(e,t){this.emit("onInfoWindowOpen",{index:e,zoom:t})}actionSimpleSearch(e){this.last_search_mode="simple",this.last_search_params=e,this.emit("onBeforeSearch"),this.itemsToRender=[],this.itemsToHide=[],this.develic_map.data.items.forEach((t,i)=>{let o=xt(e,t,this.develic_map.data.options.simple_search_addr||!1),a=!0;this.develic_map.extras.troyleedesigns_filters_enabled&&(this.develic_map.extras.troyleedesigns_categories.bike||this.develic_map.extras.troyleedesigns_categories.moto||this.develic_map.extras.troyleedesigns_categories.both)&&(a=this.develic_map.extras.troyleedesigns_categories[t.troylee_category]),o&&a?this.itemsToRender.push(i):this.itemsToHide.push(i)}),this.processHqWhenNothingFoundIfNeeded(),this.emit("onInfoWindowClear"),this.emit("onAfterSearch")}actionGeocodingSearch(e,t,i){if(this.last_search_mode="geocoding",this.last_search_params=[e,t,i],this.emit("onBeforeSearch"),this.itemsToRender=[],this.itemsToHide=[],this.develic_map.data.items.forEach((o,a)=>{let n=wt(t,i,o,this.develic_map.data.options.geocoder_distance),c=!0;this.develic_map.extras.troyleedesigns_filters_enabled&&(this.develic_map.extras.troyleedesigns_categories.bike||this.develic_map.extras.troyleedesigns_categories.moto||this.develic_map.extras.troyleedesigns_categories.both)&&(c=this.develic_map.extras.troyleedesigns_categories[o.troylee_category]),n&&c?this.itemsToRender.push(a):this.itemsToHide.push(a)}),this.itemsToRender.length==0&&this.develic_map.data.options.geocoder_alt_empty){let o=yt(this.develic_map.data.items,t,i);o>=0&&this.itemsToRender.push(o)}this.develic_map.data.options.order_by_dist&&this.itemsToRender.sort((o,a)=>{let n=this.develic_map.data.items[o]._distance||0,c=this.develic_map.data.items[a]._distance||0,r=0;return n>c&&(r=1),c>n&&(r=-1),r}),this.processHqWhenNothingFoundIfNeeded(),this.emit("onInfoWindowClear"),this.emit("onAfterSearch")}processHqWhenNothingFoundIfNeeded(){this.show_hq_mode_active=!1,this.develic_map.extras.show_hq_when_nothing_found&&this.itemsToRender.length==0&&(this.show_hq_mode_active=!0,this.itemsToRender=[this.develic_map.data.items.findIndex(e=>e.featured)],this.itemsToHide=this.itemsToHide.filter(e=>!this.itemsToRender.includes(e)))}};l(ce,"DataService");var P=ce;function xt(s,e,t){let i=s.trim().toLowerCase();return i===""?!0:t?[e.t,e.b,e.addr].some(o=>o==null?void 0:o.toLowerCase().includes(i)):[e.t,e.b].some(o=>o.toLowerCase().includes(i))}l(xt,"simpleSearchMatch");function yt(s,e,t){let i=-1,o=Number.MAX_SAFE_INTEGER,a=new window.google.maps.LatLng(e,t);return s.forEach((n,c)=>{let r=new window.google.maps.LatLng(n.lt,n.lg),d=window.google.maps.geometry.spherical.computeDistanceBetween(r,a);d0&&(this.ui.empty_message.style.display="none"),this.ui.root.appendChild(this.ui.empty_message),this.develic_map.extras.custom_locations_list_protection&&(this.ui.root.classList.add("develic-custom-protection-wrapper"),this.ui.custom_protection_message=document.createElement("div"),this.ui.custom_protection_message.className="develic-items-empty develic-custom-protection-message",this.ui.custom_protection_message.innerHTML=this.develic_map.extras.custom_locations_list_protection_message,this.ui.root.appendChild(this.ui.custom_protection_message)),this.ui.empty_search=document.createElement("div"),this.ui.empty_search.className="develic-items-empty",this.ui.empty_search.innerHTML=this.develic_map.data_service.i18n.left_panel_empty_search,this.ui.empty_search.style.display="none",this.ui.root.appendChild(this.ui.empty_search),this.ui.items=[];let e=l(t=>{let i={alternative:{src:"star-alternative.svg",width:18},material:{src:"star-alternative.svg",width:18},simplistic:{src:"star-simplistic.svg",width:14},polaris:{src:"star-simplistic.svg",width:14}};return i[t]?``:""},"getStarImage");this.develic_map.data.items.forEach((t,i)=>{var c;let o=document.createElement("div");o.className=`develic-item ${t.featured?"develic-featured":""}`,o.dataset.index=i.toString();let a=t.lt&&t.lg?`https://www.google.com/maps/dir/?api=1&destination=${t.lt},${t.lg}`:"",n=this.develic_map.data.options.directions&&a?`${this.develic_map.data_service.i18n.get_direction}`:"";o.innerHTML=`${t.t} ${t.featured?e(this.develic_map.data.options.theme):""} ${this.develic_map.data.options.theme==="alternative"?'
':""}
${t.b}
${n}
`,(c=o.querySelector(".develic-heading"))==null||c.addEventListener("click",r=>{var d;r.preventDefault(),this.develic_map.data_service.actionTriggerInfoWindow(i,!0),this.develic_map.data.options.layout==="vertical"&&((d=document.querySelector(`.develic-map-${this.develic_map.uuid} .develic-map-placeholder`))==null||d.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}))}),this.ui.items.push(o),this.ui.root.appendChild(o)})}attachListeners(){this.develic_map.data_service.subscribe("onAfterSearch",()=>{if(this.develic_map.data_service.itemsToHide.forEach(e=>{this.ui.items[e].style.display="none"}),this.develic_map.data_service.itemsToRender.forEach(e=>{this.ui.items[e].style.display="block"}),this.develic_map.data_service.itemsToRender.length==0||this.develic_map.data_service.show_hq_mode_active?this.ui.empty_search.style.display="block":this.ui.empty_search.style.display="none",this.develic_map.extras.custom_locations_list_protection&&(this.develic_map.data_service.itemsToHide.length==0?this.ui.root.classList.remove("develic-custom-protection-active-search"):this.ui.root.classList.add("develic-custom-protection-active-search")),this.develic_map.data.options.order_by_dist){let e=this.ui.empty_search;this.develic_map.data_service.itemsToRender.forEach(t=>{let i=this.ui.root.querySelector('.develic-item[data-index="'+t+'"]');i&&(e.parentElement.removeChild(i),e.nextSibling?e.parentElement.insertBefore(i,e.nextSibling):e.parentElement.appendChild(i),e=i)})}this.develic_map.data_service.itemsToHide.length>0&&(this.ui.root.scrollTop=0)})}};l(de,"ItemsPanel");var A=de;var pe=class pe{constructor(e){p(this,"develic_map");p(this,"ui");this.develic_map=e,this.ui={},this.initUI(),this.develic_map.data.options.geocoder&&this.develic_map.data.options.detect_location&&navigator.geolocation.getCurrentPosition(t=>{let i={lat:parseFloat(t.coords.latitude),lng:parseFloat(t.coords.longitude)};new window.google.maps.Geocoder().geocode({location:i},(a,n)=>{n==="OK"&&a[1]&&(this.ui.root.value=a[1].formatted_address,this.develic_map.data_service.actionGeocodingSearch(a[1].formatted_address,i.lat,i.lng))})},t=>{console.error(`Geolocation error: ${t.message}`)},{timeout:1e4})}initUI(){var o;this.ui.root=document.createElement("input"),this.ui.root.className="develic-search-input",this.ui.root.setAttribute("type","search"),this.ui.root.setAttribute("placeholder",this.develic_map.data_service.i18n.search_address),this.ui.root.addEventListener("keyup",()=>{this.ui.root.value.trim()==""&&this.develic_map.data_service.actionClearSearch()});let e={fields:["formatted_address","geometry","name"],strictBounds:!1},t=(o=this.develic_map.data.options.geocoder_countries)==null?void 0:o.trim();t&&(e.componentRestrictions={country:t.split(",").map(a=>a.trim())});let i=new window.google.maps.places.Autocomplete(this.ui.root,e);i.addListener("place_changed",()=>{let a=i.getPlace();a&&this.develic_map.data_service.actionGeocodingSearch(a.formatted_address,a.geometry.location.lat(),a.geometry.location.lng())})}};l(pe,"GeocodingPlacesSearchInput");var D=pe;var he=class he{constructor(e){p(this,"develic_map");p(this,"ui");p(this,"geocoder");p(this,"geocoder_results");p(this,"_last_geocoder_search");this.develic_map=e,this.ui={},this.geocoder=new window.google.maps.Geocoder,this.geocoder_results=[],this._last_geocoder_search=0,this.initUI(),this.attachListeners(),this.develic_map.data.options.geocoder&&this.develic_map.data.options.detect_location&&navigator.geolocation.getCurrentPosition(t=>{let i={lat:parseFloat(t.coords.latitude),lng:parseFloat(t.coords.longitude)};this.geocoder.geocode({location:i},(o,a)=>{a==="OK"&&o[1]&&(this.ui.root.value=o[1].formatted_address,this.develic_map.data_service.actionGeocodingSearch(o[1].formatted_address,i.lat,i.lng))})},t=>{console.error(`Geolocation error: ${t.message}`)},{timeout:1e4})}initUI(){this.ui.root=document.createElement("input"),this.ui.root.className="develic-search-input",this.ui.root.setAttribute("type","search"),this.ui.root.setAttribute("placeholder",this.develic_map.data_service.i18n.search_address),this.ui.autocomplete=document.createElement("div"),this.ui.autocomplete.className="develic-search-autocomplete",this.ui.autocomplete.style.display="none",this.develic_map.data.options.enhance_geocoder&&(this.ui.enhance_geocoder_headline_a=document.createElement("div"),this.ui.enhance_geocoder_headline_a.className="develic-search-autocomplete-option develic-info-text",this.ui.enhance_geocoder_headline_a.innerHTML=this.develic_map.data.options.i18n.by_address||"search near the address:",this.ui.autocomplete.appendChild(this.ui.enhance_geocoder_headline_a)),this.ui.options_container=document.createElement("div"),this.ui.autocomplete.appendChild(this.ui.options_container),this.develic_map.data.options.enhance_geocoder&&(this.ui.enhance_geocoder_no_addresses=document.createElement("div"),this.ui.enhance_geocoder_no_addresses.className="develic-search-autocomplete-option develic-info-no-result",this.ui.enhance_geocoder_no_addresses.innerHTML=this.develic_map.data.options.i18n.no_results_autocomplete||"no addresses has been found",this.ui.enhance_geocoder_no_addresses.style.display="none",this.ui.autocomplete.appendChild(this.ui.enhance_geocoder_no_addresses),this.ui.enhance_geocoder_headline_b=document.createElement("div"),this.ui.enhance_geocoder_headline_b.className="develic-search-autocomplete-option develic-info-text",this.ui.enhance_geocoder_headline_b.innerHTML=this.develic_map.data.options.i18n.by_exact_text||"search by exact text match:",this.ui.autocomplete.appendChild(this.ui.enhance_geocoder_headline_b),this.ui.enhance_geocoder_simple_item=document.createElement("div"),this.ui.enhance_geocoder_simple_item.className="develic-search-autocomplete-option develic-hoverable",this.ui.enhance_geocoder_simple_item.innerHTML=this.ui.root.value,this.ui.enhance_geocoder_simple_item.addEventListener("click",e=>{this.develic_map.data_service.actionSimpleSearch(this.ui.root.value),this.clearAutocompleteOptions(!0)}),this.ui.autocomplete.appendChild(this.ui.enhance_geocoder_simple_item))}attachListeners(){this.ui.root.addEventListener("keydown",e=>{e.key=="Esc"?(this.develic_map.data_service.actionClearSearch(),this.clearAutocompleteOptions(!1)):e.key=="Enter"&&this.geocoder_results.length>0&&(this.develic_map.data_service.actionGeocodingSearch(this.geocoder_results[0].label,this.geocoder_results[0].lat,this.geocoder_results[0].lng),this.clearAutocompleteOptions(!0))}),this.ui.root.addEventListener("keyup",e=>{let t=this.ui.root.value.trim();if(this.develic_map.data.options.enhance_geocoder&&(this.ui.enhance_geocoder_simple_item.innerHTML=t),t==""){this.develic_map.data_service.actionClearSearch(),this.clearAutocompleteOptions(!1);return}e.key=="Esc"||e.key=="Enter"||(this.develic_map.extras.geocoding_search_query_chain&&(t=this.develic_map.extras.geocoding_search_query_chain(t)),this._last_geocoder_search=new Date().getTime(),setTimeout(()=>{new Date().getTime()-this._last_geocoder_search<500||this.geocoder.geocode({address:t},(i,o)=>{let a=this.ui.root.value.trim()!=="",n=this.filterGeocodingResults(i||[]);if(o==="OK"&&n.length>0&&a){let c=n.map(r=>({lat:r.geometry.location.lat(),lng:r.geometry.location.lng(),label:r.formatted_address}));this.geocoder_results=c,this.recreateAutocompleteOptions()}else this.develic_map.data_service.actionClearSearch(),this.clearAutocompleteOptions(!1)})},500))})}recreateAutocompleteOptions(){if(this.geocoder_results.length==0){this.clearAutocompleteOptions(!1);return}this.develic_map.data.options.enhance_geocoder&&(this.ui.enhance_geocoder_no_addresses.style.display="none"),this.ui.options_container.innerHTML="",this.geocoder_results.forEach(e=>{let t=document.createElement("div");t.className="develic-search-autocomplete-option develic-hoverable",t.innerHTML=e.label,t.addEventListener("click",i=>{this.develic_map.data_service.actionGeocodingSearch(e.label,e.lat,e.lng),this.ui.root.value=e.label,this.clearAutocompleteOptions(!0)}),this.ui.options_container.appendChild(t)}),this.ui.autocomplete.style.display="block"}clearAutocompleteOptions(e){this.ui.autocomplete.style.display="none",this.develic_map.data.options.enhance_geocoder&&!e&&(this.ui.root.value.trim()!==""&&(this.ui.autocomplete.style.display="block"),this.ui.enhance_geocoder_no_addresses.style.display="block"),this.ui.options_container.innerHTML="",this.geocoder_results=[]}filterGeocodingResults(e){var i;let t=(i=this.develic_map.data.options.geocoder_countries)==null?void 0:i.trim();if(t){let o=new Set(t.split(",").map(a=>a.trim().toUpperCase()));e=e.filter(a=>a.address_components.some(n=>o.has(n.short_name)))}return e.slice(0,6)}};l(he,"GeocodingSearchInput");var O=he;var me=class me{constructor(e){p(this,"develic_map");p(this,"ui");this.develic_map=e,this.ui={},this.initUI()}initUI(){this.ui.root=document.createElement("input"),this.ui.root.className="develic-search-input",this.ui.root.setAttribute("type","search"),this.ui.root.setAttribute("placeholder",this.develic_map.data_service.i18n.filter_title_description),this.ui.root.addEventListener("keydown",t=>{t.key=="Escape"&&(this.ui.root.value="",this.develic_map.data_service.actionClearSearch())});let e;this.ui.root.addEventListener("keyup",()=>{let t=this.ui.root.value;e=new Date().getTime(),setTimeout(()=>{new Date().getTime()-e<100||this.develic_map.data_service.actionSimpleSearch(t)},100)})}};l(me,"SimpleSearchInput");var N=me;var ue=class ue{constructor(e,t){p(this,"develic_map");p(this,"ui");p(this,"alternative_on_mobile");this.develic_map=e,this.alternative_on_mobile=t,this.ui={},this.initUI()}initUI(){this.ui.root=document.createElement("div"),this.ui.root.className="develic-search-wrapper",this.develic_map.extras.alternative_mobile_layout_enabled&&(this.ui.root.className+=this.alternative_on_mobile?" develic-search-alternative":" develic-search-main"),this.develic_map.data.options.geocoder&&this.develic_map.data.options.places_search?(this.ui.geocoding_places_input=new D(this.develic_map),this.ui.root.appendChild(this.ui.geocoding_places_input.ui.root)):this.develic_map.data.options.geocoder&&!this.develic_map.data.options.places_search?(this.ui.geocoding_search_input=new O(this.develic_map),this.ui.root.appendChild(this.ui.geocoding_search_input.ui.root),this.ui.root.appendChild(this.ui.geocoding_search_input.ui.autocomplete)):(this.ui.simple_input=new N(this.develic_map),this.ui.root.appendChild(this.ui.simple_input.ui.root))}};l(ue,"SearchPanel");var S=ue;var ve=class ve{constructor(e){p(this,"develic_map");p(this,"ui");this.develic_map=e,this.ui={},this.initUI()}initUI(){this.ui.root=document.createElement("div"),this.ui.root.className="develic-custom-filters-wrapper",this.ui.moto_label=document.createElement("label"),this.ui.moto_label.htmlFor="develic_filters_moto",this.ui.root.appendChild(this.ui.moto_label),this.ui.moto_checkbox=document.createElement("input"),this.ui.moto_checkbox.type="checkbox",this.ui.moto_checkbox.id="develic_filters_moto",this.ui.moto_checkbox.value="Moto",this.ui.moto_checkbox.addEventListener("change",()=>{this.develic_map.extras.troyleedesigns_categories.moto=this.ui.moto_checkbox.checked,this.develic_map.data_service.actionRepeatLastSearch()}),this.ui.moto_label.appendChild(this.ui.moto_checkbox),this.ui.moto_label.appendChild(document.createTextNode(" Moto")),this.ui.bike_label=document.createElement("label"),this.ui.bike_label.htmlFor="develic_filters_bike",this.ui.root.appendChild(this.ui.bike_label),this.ui.bike_checkbox=document.createElement("input"),this.ui.bike_checkbox.type="checkbox",this.ui.bike_checkbox.id="develic_filters_bike",this.ui.bike_checkbox.value="Bike",this.ui.bike_checkbox.addEventListener("change",()=>{this.develic_map.extras.troyleedesigns_categories.bike=this.ui.bike_checkbox.checked,this.develic_map.data_service.actionRepeatLastSearch()}),this.ui.bike_label.appendChild(this.ui.bike_checkbox),this.ui.bike_label.appendChild(document.createTextNode(" Bike")),this.ui.both_label=document.createElement("label"),this.ui.both_label.htmlFor="develic_filters_both",this.ui.root.appendChild(this.ui.both_label),this.ui.both_checkbox=document.createElement("input"),this.ui.both_checkbox.type="checkbox",this.ui.both_checkbox.id="develic_filters_both",this.ui.both_checkbox.value="Both",this.ui.both_checkbox.addEventListener("change",()=>{this.develic_map.extras.troyleedesigns_categories.both=this.ui.both_checkbox.checked,this.develic_map.data_service.actionRepeatLastSearch()}),this.ui.both_label.appendChild(this.ui.both_checkbox),this.ui.both_label.appendChild(document.createTextNode(" Both"))}};l(ve,"TroyleeDesignFilters");var U=ve;var ge=class ge{constructor(e){p(this,"develic_map");p(this,"ui");this.develic_map=e,this.ui={},this.initUI()}initUI(){this.ui.root=document.createElement("div"),this.ui.root.className="develic-left-panel",this.ui.searchPanel=new S(this.develic_map,!1),this.ui.root.appendChild(this.ui.searchPanel.ui.root),this.develic_map.extras.troyleedesigns_filters_enabled&&(this.ui.troyleeDesignFilters=new U(this.develic_map),this.ui.root.appendChild(this.ui.troyleeDesignFilters.ui.root)),this.ui.itemsPanel=new A(this.develic_map),this.ui.root.appendChild(this.ui.itemsPanel.ui.root)}};l(ge,"LeftPanel");var H=ge;var we=gt(Qe());var et=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],fe=1,R=8,J=class J{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,i]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");let o=i>>4;if(o!==fe)throw new Error(`Got v${o} data when expected v${fe}.`);let a=et[i&15];if(!a)throw new Error("Unrecognized array type.");let[n]=new Uint16Array(e,2,1),[c]=new Uint32Array(e,4,1);return new J(c,n,a,e)}constructor(e,t=64,i=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=et.indexOf(this.ArrayType),n=e*2*this.ArrayType.BYTES_PER_ELEMENT,c=e*this.IndexArrayType.BYTES_PER_ELEMENT,r=(8-c%8)%8;if(a<0)throw new Error(`Unexpected typed array class: ${i}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,R,e),this.coords=new this.ArrayType(this.data,R+c+r,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(R+n+c+r),this.ids=new this.IndexArrayType(this.data,R,e),this.coords=new this.ArrayType(this.data,R+c+r,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(fe<<4)+a]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return be(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:c}=this,r=[0,a.length-1,0],d=[];for(;r.length;){let m=r.pop()||0,h=r.pop()||0,u=r.pop()||0;if(h-u<=c){for(let g=u;g<=h;g++){let b=n[2*g],y=n[2*g+1];b>=e&&b<=i&&y>=t&&y<=o&&d.push(a[g])}continue}let v=u+h>>1,f=n[2*v],_=n[2*v+1];f>=e&&f<=i&&_>=t&&_<=o&&d.push(a[v]),(m===0?e<=f:t<=_)&&(r.push(u),r.push(v-1),r.push(1-m)),(m===0?i>=f:o>=_)&&(r.push(v+1),r.push(h),r.push(1-m))}return d}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:n}=this,c=[0,o.length-1,0],r=[],d=i*i;for(;c.length;){let m=c.pop()||0,h=c.pop()||0,u=c.pop()||0;if(h-u<=n){for(let g=u;g<=h;g++)tt(a[2*g],a[2*g+1],e,t)<=d&&r.push(o[g]);continue}let v=u+h>>1,f=a[2*v],_=a[2*v+1];tt(f,_,e,t)<=d&&r.push(o[v]),(m===0?e-i<=f:t-i<=_)&&(c.push(u),c.push(v-1),c.push(1-m)),(m===0?e+i>=f:t+i>=_)&&(c.push(v+1),c.push(h),c.push(1-m))}return r}};l(J,"KDBush");var F=J;function be(s,e,t,i,o,a){if(o-i<=t)return;let n=i+o>>1;it(s,e,n,i,o,a),be(s,e,t,i,n-1,1-a),be(s,e,t,n+1,o,1-a)}l(be,"sort");function it(s,e,t,i,o,a){for(;o>i;){if(o-i>600){let d=o-i+1,m=t-i+1,h=Math.log(d),u=.5*Math.exp(2*h/3),v=.5*Math.sqrt(h*u*(d-u)/d)*(m-d/2<0?-1:1),f=Math.max(i,Math.floor(t-m*u/d+v)),_=Math.min(o,Math.floor(t+(d-m)*u/d+v));it(s,e,t,f,_,a)}let n=e[2*t+a],c=i,r=o;for(z(s,e,i,t),e[2*o+a]>n&&z(s,e,i,o);cn;)r--}e[2*i+a]===n?z(s,e,i,r):(r++,z(s,e,r,o)),r<=t&&(i=r+1),t<=r&&(o=r-1)}}l(it,"select");function z(s,e,t,i){_e(s,t,i),_e(e,2*t,2*i),_e(e,2*t+1,2*i+1)}l(z,"swapItem");function _e(s,e,t){let i=s[e];s[e]=s[t],s[t]=i}l(_e,"swap");function tt(s,e,t,i){let o=s-t,a=e-i;return o*o+a*a}l(tt,"sqDist");var Mt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:l(s=>s,"map")},ot=Math.fround||(s=>e=>(s[0]=+e,s[0]))(new Float32Array(1)),T=2,k=3,xe=4,I=5,at=6,ye=class ye{constructor(e){this.options=Object.assign(Object.create(Mt),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:t,minZoom:i,maxZoom:o}=this.options;t&&console.time("total time");let a=`prepare ${e.length} points`;t&&console.time(a),this.points=e;let n=[];for(let r=0;r=i;r--){let d=+Date.now();c=this.trees[r]=this._createTree(this._cluster(c,r)),t&&console.log("z%d: %d clusters in %dms",r,c.numItems,+Date.now()-d)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,e[1])),a=e[2]===180?180:((e[2]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,a=180;else if(i>a){let h=this.getClusters([i,o,180,n],t),u=this.getClusters([-180,o,a,n],t);return h.concat(u)}let c=this.trees[this._limitZoom(t)],r=c.range(X(i),Q(n),X(a),Q(o)),d=c.data,m=[];for(let h of r){let u=this.stride*h;m.push(d[u+I]>1?st(d,u,this.clusterProps):this.points[d[u+k]])}return m}getChildren(e){let t=this._getOriginId(e),i=this._getOriginZoom(e),o="No cluster with the specified id.",a=this.trees[i];if(!a)throw new Error(o);let n=a.data;if(t*this.stride>=n.length)throw new Error(o);let c=this.options.radius/(this.options.extent*Math.pow(2,i-1)),r=n[t*this.stride],d=n[t*this.stride+1],m=a.within(r,d,c),h=[];for(let u of m){let v=u*this.stride;n[v+xe]===e&&h.push(n[v+I]>1?st(n,v,this.clusterProps):this.points[n[v+k]])}if(h.length===0)throw new Error(o);return h}getLeaves(e,t,i){t=t||10,i=i||0;let o=[];return this._appendLeaves(o,e,t,i,0),o}getTile(e,t,i){let o=this.trees[this._limitZoom(e)],a=Math.pow(2,e),{extent:n,radius:c}=this.options,r=c/n,d=(i-r)/a,m=(i+1+r)/a,h={features:[]};return this._addTileFeatures(o.range((t-r)/a,d,(t+1+r)/a,m),o.data,t,i,a,h),t===0&&this._addTileFeatures(o.range(1-r/a,d,1,m),o.data,a,i,a,h),t===a-1&&this._addTileFeatures(o.range(0,d,r/a,m),o.data,-1,i,a,h),h.features.length?h:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let i=this.getChildren(e);if(t++,i.length!==1)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,o,a){let n=this.getChildren(t);for(let c of n){let r=c.properties;if(r&&r.cluster?a+r.point_count<=o?a+=r.point_count:a=this._appendLeaves(e,r.cluster_id,i,o,a):a1,m,h,u;if(d)m=rt(t,r,this.clusterProps),h=t[r],u=t[r+1];else{let _=this.points[t[r+k]];m=_.properties;let[g,b]=_.geometry.coordinates;h=X(g),u=Q(b)}let v={type:1,geometry:[[Math.round(this.options.extent*(h*a-i)),Math.round(this.options.extent*(u*a-o))]],tags:m},f;d||this.options.generateId?f=t[r+k]:f=this.points[t[r+k]].id,f!==void 0&&(v.id=f),n.features.push(v)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:i,extent:o,reduce:a,minPoints:n}=this.options,c=i/(o*Math.pow(2,t)),r=e.data,d=[],m=this.stride;for(let h=0;ht&&(g+=r[y+I])}if(g>_&&g>=n){let b=u*_,y=v*_,M,ze=-1,oe=((h/m|0)<<5)+(t+1)+this.points.length;for(let lt of f){let E=lt*m;if(r[E+T]<=t)continue;r[E+T]=t;let Fe=r[E+I];b+=r[E]*Fe,y+=r[E+1]*Fe,r[E+xe]=oe,a&&(M||(M=this._map(r,h,!0),ze=this.clusterProps.length,this.clusterProps.push(M)),a(M,this._map(r,E)))}r[h+xe]=oe,d.push(b/g,y/g,1/0,oe,-1,g),a&&d.push(ze)}else{for(let b=0;b1)for(let b of f){let y=b*m;if(!(r[y+T]<=t)){r[y+T]=t;for(let M=0;M>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+I]>1){let n=this.clusterProps[e[t+at]];return i?Object.assign({},n):n}let o=this.points[e[t+k]].properties,a=this.options.map(o);return i&&a===o?Object.assign({},a):a}};l(ye,"Supercluster");var B=ye;function st(s,e,t){return{type:"Feature",id:s[e+k],properties:rt(s,e,t),geometry:{type:"Point",coordinates:[It(s[e]),kt(s[e+1])]}}}l(st,"getClusterJSON");function rt(s,e,t){let i=s[e+I],o=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=s[e+at],n=a===-1?{}:Object.assign({},t[a]);return Object.assign(n,{cluster:!0,cluster_id:s[e+k],point_count:i,point_count_abbreviated:o})}l(rt,"getClusterProperties");function X(s){return s/360+.5}l(X,"lngX");function Q(s){let e=Math.sin(s*Math.PI/180),t=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return t<0?0:t>1?1:t}l(Q,"latY");function It(s){return(s-.5)*360}l(It,"xLng");function kt(s){let e=(180-s*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}l(kt,"yLat");function Et(s,e){var t={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(s);ox.getVisible(e)).length}push(e){this.markers.push(e)}delete(){this.marker&&(x.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}};l(Te,"Cluster");var Z=Te;var Le=class Le{constructor({maxZoom:e=16}){this.maxZoom=e}noop({markers:e}){return St(e)}};l(Le,"AbstractAlgorithm");var Me=Le;var St=l(s=>s.map(t=>new Z({position:x.getPosition(t),markers:[t]})),"noop");var Ce=class Ce extends Me{constructor(e){var{maxZoom:t,radius:i=60}=e,o=Et(e,["maxZoom","radius"]);super({maxZoom:t}),this.state={zoom:-1},this.superCluster=new B(Object.assign({maxZoom:this.maxZoom,radius:i},o))}calculate(e){let t=!1,i={zoom:e.map.getZoom()};if(!(0,we.default)(e.markers,this.markers)){t=!0,this.markers=[...e.markers];let o=this.markers.map(a=>{let n=x.getPosition(a);return{type:"Feature",geometry:{type:"Point",coordinates:[n.lng(),n.lat()]},properties:{marker:a}}});this.superCluster.load(o)}return t||(this.state.zoom<=this.maxZoom||i.zoom<=this.maxZoom)&&(t=!(0,we.default)(this.state,i)),this.state=i,t&&(this.clusters=this.cluster(e)),{clusters:this.clusters,changed:t}}cluster({map:e}){return this.superCluster.getClusters([-180,-90,180,90],Math.round(e.getZoom())).map(t=>this.transformCluster(t))}transformCluster({geometry:{coordinates:[e,t]},properties:i}){if(i.cluster)return new Z({markers:this.superCluster.getLeaves(i.cluster_id,1/0).map(a=>a.properties.marker),position:{lat:t,lng:e}});let o=i.marker;return new Z({markers:[o],position:x.getPosition(o)})}};l(Ce,"SuperClusterAlgorithm");var Ie=Ce;var Pe=class Pe{constructor(e,t){this.markers={sum:e.length};let i=t.map(a=>a.count),o=i.reduce((a,n)=>a+n,0);this.clusters={count:t.length,markers:{mean:o/t.length,sum:o,min:Math.min(...i),max:Math.max(...i)}}}};l(Pe,"ClusterStats");var ke=Pe,Ae=class Ae{render({count:e,position:t},i,o){let n=` ${e} `,c=`Cluster of ${e} markers`,r=Number(google.maps.Marker.MAX_ZINDEX)+e;if(x.isAdvancedMarkerAvailable(o)){let h=new DOMParser().parseFromString(n,"image/svg+xml").documentElement;h.setAttribute("transform","translate(0 25)");let u={map:o,position:t,zIndex:r,title:c,content:h};return new google.maps.marker.AdvancedMarkerElement(u)}let d={position:t,zIndex:r,title:c,icon:{url:`data:image/svg+xml;base64,${btoa(n)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(d)}};l(Ae,"DefaultRenderer");var q=Ae;function Tt(s,e){for(let t in e.prototype)s.prototype[t]=e.prototype[t]}l(Tt,"extend");var ee=class ee{constructor(){Tt(ee,google.maps.OverlayView)}};l(ee,"OverlayViewSafe");var Ee=ee,$;(function(s){s.CLUSTERING_BEGIN="clusteringbegin",s.CLUSTERING_END="clusteringend",s.CLUSTER_CLICK="click"})($||($={}));var Lt=l((s,e,t)=>{t.fitBounds(e.bounds)},"defaultOnClusterClickHandler"),De=class De extends Ee{constructor({map:e,markers:t=[],algorithmOptions:i={},algorithm:o=new Ie(i),renderer:a=new q,onClusterClick:n=Lt}){super(),this.markers=[...t],this.clusters=[],this.algorithm=o,this.renderer=a,this.onClusterClick=n,e&&this.setMap(e)}addMarker(e,t){this.markers.includes(e)||(this.markers.push(e),t||this.render())}addMarkers(e,t){e.forEach(i=>{this.addMarker(i,!0)}),t||this.render()}removeMarker(e,t){let i=this.markers.indexOf(e);return i===-1?!1:(x.setMap(e,null),this.markers.splice(i,1),t||this.render(),!0)}removeMarkers(e,t){let i=!1;return e.forEach(o=>{i=this.removeMarker(o,!0)||i}),i&&!t&&this.render(),i}clearMarkers(e){this.markers.length=0,e||this.render()}render(){let e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,$.CLUSTERING_BEGIN,this);let{clusters:t,changed:i}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(i||i==null){let o=new Set;for(let n of t)n.markers.length==1&&o.add(n.markers[0]);let a=[];for(let n of this.clusters)n.marker!=null&&(n.markers.length==1?o.has(n.marker)||x.setMap(n.marker,null):a.push(n.marker));this.clusters=t,this.renderClusters(),requestAnimationFrame(()=>a.forEach(n=>x.setMap(n,null)))}google.maps.event.trigger(this,$.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(e=>x.setMap(e,null)),this.clusters.forEach(e=>e.delete()),this.clusters=[]}renderClusters(){let e=new ke(this.markers,this.clusters),t=this.getMap();this.clusters.forEach(i=>{i.markers.length===1?i.marker=i.markers[0]:(i.marker=this.renderer.render(i,e,t),i.markers.forEach(o=>x.setMap(o,null)),this.onClusterClick&&i.marker.addListener("click",o=>{google.maps.event.trigger(this,$.CLUSTER_CLICK,i),this.onClusterClick(o,i,t)})),x.setMap(i.marker,t)})}};l(De,"MarkerClusterer");var G=De;var Ct=4,Pt={lat:38.8870615,lng:-100.2866791};function nt(s,e){let t={center:Pt,zoom:Ct,fullscreenControl:!1};return e&&(t=L(L({},t),e)),new window.google.maps.Map(s,t)}l(nt,"createGoogleMap");function Oe(s,e,t){let i=[],o=[];if(e.forEach(a=>{let n=[a.getPosition().lat(),a.getPosition().lng()];a.getMap()!==null&&i.push(n),o.push(n)}),i.length==0&&o.length==0)s.setCenter({lat:38.8870615,lng:-100.2866791}),s.setZoom(4);else if(i.length==0&&o.length>0)s.setCenter({lat:o[0][0],lng:o[0][1]}),s.setZoom(6);else if(i.length==1)s.setCenter({lat:i[0][0],lng:i[0][1]}),s.setZoom(17);else{let a=t.baseline_bounds&&i.length===t.data.items.length?t.baseline_bounds:i.reduce((n,[c,r])=>(n.extend(new window.google.maps.LatLng(c,r)),n),new window.google.maps.LatLngBounds);i.length===t.data.items.length&&(t.baseline_bounds=a),s.fitBounds(a),At(s)}}l(Oe,"reFitMarkersOnMap");function At(s){if(!new window.google.maps.LatLngBounds(new window.google.maps.LatLng(-85,-180),new window.google.maps.LatLng(85,180)).contains(s.getCenter())){let t=s.getCenter(),i=Math.min(Math.max(t.lat(),-85),85);s.setCenter({lat:i,lng:t.lng()})}}l(At,"checkGlobalBounds");var Ne=class Ne{constructor(e,t){p(this,"colorA");p(this,"colorB");this.colorA=e,this.colorB=t}render({count:e,position:t},i,o){let n=` ${e} `,c=`Cluster of ${e} markers`,r=Number(window.google.maps.Marker.MAX_ZINDEX)+e,d={position:t,zIndex:r,title:c,icon:{url:`data:image/svg+xml;base64,${btoa(n)}`,anchor:new window.google.maps.Point(25,25)}};return new window.google.maps.Marker(d)}};l(Ne,"AdvancedClusterRenderer");var te=Ne;var Ue=class Ue{constructor(e){p(this,"develic_map");p(this,"ui");p(this,"map");p(this,"markers");p(this,"info_window");p(this,"map_styles");p(this,"clusterRenderer");p(this,"markersCluster");this.develic_map=e,this.markers=[],this.info_window=null,this.map_styles=[];try{this.map_styles=JSON.parse(e.data.options.gm_styles_array||"[]")}catch(t){console.error("Failed to parse map styles:",t),this.map_styles=[]}this.ui={},this.initUI(),this.initMap(),this.initMarkers(),this.initInfoWindow(),this.attachRestOfListeners(),this.initClusteringNeeded(),this.restoreInitialPositionIfNeeded()}initUI(){this.ui.root=document.createElement("div"),this.ui.root.className="develic-right-panel",this.ui.mapPlaceholder=document.createElement("div"),this.ui.mapPlaceholder.className="develic-map-placeholder",this.ui.root.appendChild(this.ui.mapPlaceholder)}initMap(){let e={styles:this.map_styles,clickableIcons:!!this.develic_map.data.options.clickable_icons,mapTypeControl:this.develic_map.data.options.map_type_control,scaleControl:this.develic_map.data.options.scale_control,rotateControl:!1,zoomControl:this.develic_map.data.options.zoom_control,cameraControl:this.develic_map.data.options.camera_control,gestureHandling:this.develic_map.extras.map_custom_gesture_handling||"greedy",streetViewControl:this.develic_map.data.options.street_view_control,fullscreenControl:this.develic_map.data.options.fullscreen};this.develic_map.extras.advanced_map_options&&(e=L(L({},e),this.develic_map.extras.advanced_map_options)),this.map=nt(this.ui.mapPlaceholder,e),this.develic_map.extras.map_close_infowindows_on_click_anywhere&&window.google.maps.event.addListener(this.map,"click",()=>{this.develic_map.data_service.emit("onInfoWindowClear")})}initMarkers(){this.markers=this.develic_map.data.items.map((e,t)=>{let i=new window.google.maps.Marker({position:{lat:e.lt,lng:e.lg},icon:e.marker_icon||this.develic_map.data.options.marker_icon||"",map:this.map});return i.addListener("click",()=>{this.develic_map.data_service.actionTriggerInfoWindow(t,!1)}),i})}initInfoWindow(){this.develic_map.data_service.subscribe("onInfoWindowOpen",({index:e,zoom:t})=>{this.info_window&&this.info_window.close();let i=this.develic_map.data.items[e],o=i.b;if(this.develic_map.extras.sildreklaam_gallery_enabled){let n=/data-lightbox="location-(\d+)"/g;o=o.replace(n,'data-lightbox="location-$1-map"')}let a=`

${i.t}

${o}
`;if(this.develic_map.data.options.directions){let n=`https://www.google.com/maps/dir/?api=1&destination=${i.lt},${i.lg}`;a+=` ${this.develic_map.data_service.i18n.get_direction} `}a+="
",this.info_window=new window.google.maps.InfoWindow({content:a}),this.info_window.open({anchor:this.markers[e],map:this.map}),this.map.panTo(this.markers[e].getPosition()),t&&this.map.setZoom(17)}),this.develic_map.data_service.subscribe("onInfoWindowClear",()=>{this.info_window&&this.info_window.close(),this.info_window=null})}attachRestOfListeners(){this.develic_map.data_service.subscribe("onBeforeSearch",()=>{var e;this.develic_map.data.options.clustering&&((e=this.markersCluster)==null||e.clearMarkers())}),this.develic_map.data_service.subscribe("onAfterSearch",()=>{this.develic_map.data_service.itemsToHide.forEach(e=>{this.markers[e].getMap()&&this.markers[e].setMap(null)}),this.develic_map.data_service.itemsToRender.forEach(e=>{this.markers[e].getMap()||this.markers[e].setMap(this.map)}),Oe(this.map,this.markers,this.develic_map),this.develic_map.data.options.clustering&&(this.markersCluster=new G({map:this.map,markers:this.markers.filter((e,t)=>this.develic_map.data_service.itemsToRender.indexOf(t)!==-1),renderer:this.clusterRenderer})),this.develic_map.data_service.show_hq_mode_active&&this.map.setZoom(this.develic_map.extras.show_hq_when_nothing_found_zoom_level)})}initClusteringNeeded(){this.develic_map.data.options.clustering&&(this.clusterRenderer=this.develic_map.extras.advanced_clustering_enabled?new te(this.develic_map.extras.advanced_clustering_colors[0],this.develic_map.extras.advanced_clustering_colors[1]):new q,this.markersCluster=new G({map:this.map,markers:this.markers.filter((e,t)=>this.develic_map.data_service.itemsToRender.includes(t)),renderer:this.clusterRenderer}))}restoreInitialPositionIfNeeded(){this.develic_map.data.options.initial_fixed_position&&this.develic_map.data.options.initial_position_zoom&&this.develic_map.data.options.initial_position_lat&&this.develic_map.data.options.initial_position_lng?(this.map.setZoom(parseInt(this.develic_map.data.options.initial_position_zoom.toString(),10)||5),this.map.setCenter({lat:parseFloat(this.develic_map.data.options.initial_position_lat.toString()),lng:parseFloat(this.develic_map.data.options.initial_position_lng.toString())})):Oe(this.map,this.markers,this.develic_map)}};l(Ue,"RightPanel");var W=Ue;var Re=class Re{constructor(e){p(this,"uuid");p(this,"rootEl");p(this,"data");p(this,"extras");p(this,"data_service");p(this,"ui");p(this,"baseline_bounds");this.uuid=He.getNextUUID(),this.rootEl=e.rootEl,this.data=e.data,this.extras=e.extras,this.initTroyleeCustomizationIfNeeded(),this.extras.custom_pre_handler&&this.extras.custom_pre_handler(this.data,this.rootEl),this.data_service=new P(this),this.ui={},!this.rootEl.classList.contains("develic-loaded")&&(this.rootEl.classList.add("develic-loaded"),this.initUI(),this.extras.on_after_ui_created&&setTimeout(this.extras.on_after_ui_created,80),this.data.options.protect_locations&&this.ui.rootWrapper.setAttribute("oncontextmenu","return false;"),this.data_service.subscribe("onAfterFullscreenToggled",t=>{let i=document.querySelector("body");t?(this.ui.rootWrapper.classList.add("develic-fullscreen"),i.classList.add("develic-no-scroll")):(i.classList.remove("develic-no-scroll"),this.ui.rootWrapper.classList.remove("develic-fullscreen"))}))}initUI(){var t;this.ui.rootWrapper=document.createElement("div"),this.ui.rootWrapper.className=Dt("develic-map",`develic-theme-${this.data.options.theme}`,`develic-layout-${this.data.options.layout}`,`develic-map-${this.uuid}`,this.extras.troyleedesigns_filters_enabled?"has-custom-filters":"",(t=window.Shopify)!=null&&t.shop?`develic-${window.Shopify.shop.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/,"")}`:"");let e=this.data.options.css_patch.trim();e!=""&&(this.ui.customStyles=document.createElement("style"),this.ui.customStyles.innerHTML=e,this.ui.rootWrapper.appendChild(this.ui.customStyles)),this.extras.alternative_mobile_layout_enabled&&(this.ui.alternativeOnMobileSearchPanel=new S(this,!0),this.ui.rootWrapper.appendChild(this.ui.alternativeOnMobileSearchPanel.ui.root)),this.ui.rightPanel=new W(this),this.ui.rootWrapper.appendChild(this.ui.rightPanel.ui.root),this.ui.leftPanel=new H(this),this.ui.rootWrapper.appendChild(this.ui.leftPanel.ui.root),this.rootEl.appendChild(this.ui.rootWrapper)}cleanUp(){this.rootEl.innerHTML=""}initTroyleeCustomizationIfNeeded(){var t;let e=["troy-lee-designs-de.myshopify.com","troy-lee-designs-uk.myshopify.com","troy-lee-designs-eu.myshopify.com"];if((t=window.Shopify)!=null&&t.shop&&e.includes(window.Shopify.shop)){this.extras.troyleedesigns_filters_enabled=!0,this.extras.troyleedesigns_categories={bike:!1,moto:!1,both:!1};let i={moto:/Moto$/,bike:/Bike$/,both:/Both$/};this.data.items=this.data.items.map(o=>{o.troylee_category="";for(let[a,n]of Object.entries(i))n.test(o.b)&&(o.troylee_category=a,o.b=o.b.replace(n,""));return o})}}};l(Re,"DevelicMap");var j=Re,ie=class ie{static getNextUUID(){return this.counter++}};l(ie,"UUIDGenerator"),p(ie,"counter",1);var He=ie;function Dt(...s){return s.filter(Boolean).join(" ")}l(Dt,"createClassName");function K(){return w(this,null,function*(){let s=Ke(),e=[],t="";if(window.Shopify&&window.Shopify.shop){let c=yield Ze();t=c.api_key,c.placement_mode=="liquid"&&Je(e);let r=yield Ve(c);if(r&&c.placement_mode!=="liquid"){let d=null;if(c.placement_mode=="auto"?d=Ye():c.placement_mode=="css"&&(d=le(c.css_placement_mode,c.css_placement_selector)),d){let m=C(r.options.onload_hook);e.push({rootEl:d,data:r,extras:m,mode:"shopify"})}}}if(s.length==0&&e.length==0)return;let i=s.concat(e),{libraries:o,region:a,language:n}=Ot(i);We(t,o.join(","),a,n),je(),yield re(o.indexOf("places")!==-1),yield ne(),window.omnium_maps=[],i.forEach(c=>{let r=new j(c);window.omnium_maps.push(r)}),e.length>0&&Ge()})}l(K,"launchOmniumMaps");function Ot(s){let e=["geometry"],t=null,i=null;return s.forEach(o=>{!t&&o.extras.map_custom_region&&(t=o.extras.map_custom_region),!i&&o.extras.map_custom_language&&(i=o.extras.map_custom_language),o.data.options.places_search&&e.push("places")}),e=e.filter((o,a,n)=>n.indexOf(o)===a),{libraries:e,region:t,language:i}}l(Ot,"extractGoogleMapsLoadOptions");window.launchOmniumMaps=K;window.develic_maps_injected||(document.addEventListener("shopify:section:load",K),document.addEventListener("turbo:render",K),window.Shopify&&window.Shopify.shop=="produits-maemae.myshopify.com"&&(window.maemae_mode=!0),document.readyState==="complete"||document.readyState==="interactive"?K():document.addEventListener("DOMContentLoaded",K));window.develic_maps_injected=!0;})(); /*! Bundled license information: @googlemaps/markerclusterer/dist/index.esm.js: (*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** *) */