var placeSearch,autocompleteAddress,locationSet=0,addressLocationInit=!1,componentForm={street_number:"short_name",route:"long_name",locality:"long_name",administrative_area_level_1:"short_name",country:"long_name",postal_code:"short_name"},autoCompleteAddressListener=null,autocompleteAddressInputTimeout=null,pacElementAddress=null,pendingGeoData=null;function createOrAttachPlaceAutocomplete(e,t){var o=document.getElementById(e);if(!(o&&window.google&&google.maps&&google.maps.places&&google.maps.places.PlaceAutocompleteElement))return null;var n=document.getElementById(e+"-pac");n&&n.remove();var a=new google.maps.places.PlaceAutocompleteElement;a.id=e+"-pac",a.setAttribute("for",e);try{a.types=["address"]}catch(e){}try{a.fields=["addressComponents","location"]}catch(e){}try{o.setAttribute("aria-hidden","true"),o.style.display="none";var r=window.getComputedStyle(o);a.style.display="block",a.style.width="100%",a.style.boxSizing="border-box",r&&r.height&&(a.style.height=r.height),r&&r.fontSize&&(a.style.fontSize=r.fontSize),r&&r.padding&&(a.style.padding=r.padding),r&&r.borderRadius&&(a.style.borderRadius=r.borderRadius),r&&r.border&&(a.style.border=r.border),o.className&&(a.className=o.className),a.style.outline="none",a.style.boxShadow="none",a.addEventListener("focus",function(){this.style.outline="none",this.style.boxShadow="none"}),a.addEventListener("focusin",function(){this.style.outline="none",this.style.boxShadow="none"}),a.addEventListener("blur",function(){this.style.outline="none",this.style.boxShadow="none"})}catch(e){}return o.insertAdjacentElement("afterend",a),a.addEventListener("gmp-select",async({placePrediction:e})=>{const o=e.toPlace();await o.fetchFields({fields:["addressComponents","formattedAddress","location"]}),"function"==typeof t&&t(o)}),{mode:"element",control:a}}async function checkPlacesEnabled({apiKey:e}){const t={"Content-Type":"application/json","X-Goog-Api-Key":e,"X-Goog-FieldMask":"suggestions.placePrediction.placeId"},o=await fetch("https://places.googleapis.com/v1/places:autocomplete",{method:"POST",headers:t,body:JSON.stringify({input:"a"})});if(!o.ok){const e=await o.json().catch(()=>({})),t=e?.error?.message||`HTTP ${o.status}`;throw new Error(t)}}function initAutocomplete(){var e=createOrAttachPlaceAutocomplete("autocompleteAddress",fillInAddress);if(e&&"element"===e.mode&&(pacElementAddress=e.control,pendingGeoData&&window.google&&google.maps&&google.maps.Circle))try{var t=new google.maps.Circle({center:{lat:pendingGeoData.lat,lng:pendingGeoData.lng},radius:pendingGeoData.accuracy});pacElementAddress.locationBias=t.getBounds()}catch(e){}}function fillInAddress(e){var t=e&&(e.address_components||e.addressComponents)?e:null;for(var o in t||(pacElementAddress&&pacElementAddress.value?t=pacElementAddress.value:autocompleteAddress&&"function"==typeof autocompleteAddress.getPlace&&(t=autocompleteAddress.getPlace())),$("#contactFormFieldset #address").show(),$("#shippingForm #address").show(),$("#shippingAddressForm #address").show(),$("#newShippingAddressForm #address").show(),$(".editShippingTable").show(),combineAddress(),setTimeout(function(){combineAddress()},100),componentForm)document.getElementById(o).value="",document.getElementById(o).disabled=!1;if(t&&(t.address_components||t.addressComponents)){for(var n=t&&(t.address_components||t.addressComponents)||[],a=0;a'+i+""),d.val(i)}}}}$("#country").change()}}function geolocate(){if("undefined"==typeof isSecureContext||!isSecureContext)return!1;navigator.geolocation&&(navigator.geolocation.getCurrentPosition(success,error,{enableHighAccuracy:!0,timeout:1e4}),locationSet=1)}function success(e){var t=e.coords.latitude,o=e.coords.longitude,n=e.coords.accuracy;if(pendingGeoData={lat:t,lng:o,accuracy:n},initAutocomplete(),window.google&&google.maps&&google.maps.Circle)try{var a=new google.maps.Circle({center:{lat:t,lng:o},radius:n});if(pacElementAddress)try{pacElementAddress.locationBias=a.getBounds()}catch(e){}}catch(e){}}function error(){geolocation=null}function combineAddress(){$("#contactFormFieldset #address1").val($("#street_number").val()+" "+$("#route").val()),$("#shippingForm #address1").val($("#street_number").val()+" "+$("#route").val()),$("#shippingAddressForm #address1").val($("#street_number").val()+" "+$("#route").val()),$("#newShippingAddressForm #address1").val($("#street_number").val()+" "+$("#route").val())}function domReady(e){window.jQuery&&jQuery.fn&&(jQuery.fn.ready||jQuery.fn.on)?jQuery(e):"complete"===document.readyState||"interactive"===document.readyState?setTimeout(e,0):document.addEventListener("DOMContentLoaded",e,{once:!0})}domReady(function(){0===locationSet&&geolocate(),$("#autocompleteAddress").on("keyup paste click",function(){0===locationSet&&geolocate()}),$("#street_number, #route").on("change keyup paste click",function(){combineAddress()});try{initAutocomplete()}catch(e){}$("#autocompleteAddress").keyup(function(){null!==autocompleteAddressInputTimeout&&clearTimeout(autocompleteAddressInputTimeout),autocompleteAddressInputTimeout=setTimeout("initAutocomplete()",300)})}),function(){if(Element.prototype.__placesAttachShadowPatched)return;Element.prototype.__placesAttachShadowPatched=!0;const e=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){if("gmp-place-autocomplete"===this.localName||"gmpx-place-autocomplete"===this.localName){const o=e.call(this,{...t,mode:"open"}),n=document.createElement("style");return n.textContent='[part="leading-icon"],[part="trailing-icon"],[part="clear-button"],.clear-button,.autocomplete-icon, button.clear-button,.focus-ring{display:none!important;}\n .clear-button{width:24px!important;height:24px!important;min-width:24px!important;min-height:24px!important;padding:0!important;line-height:24px!important;margin:2px!important;box-shadow:none!important;}\n .clear-button svg{width:16px!important;height:16px!important;}',o.appendChild(n),o}return e.call(this,t)};try{document.querySelectorAll("gmp-place-autocomplete, gmpx-place-autocomplete").forEach(function(e){if(e.shadowRoot&&!e.shadowRoot.__placesStylePatched){var t=document.createElement("style");t.textContent='[part="leading-icon"],[part="trailing-icon"],[part="clear-button"],.clear-button,.focus-ring{display:none!important;}\n .clear-button{width:24px!important;height:24px!important;min-width:24px!important;min-height:24px!important;padding:0!important;line-height:24px!important;margin:2px!important;box-shadow:none!important;}\n .clear-button svg{width:16px!important;height:16px!important;}',e.shadowRoot.appendChild(t),e.shadowRoot.__placesStylePatched=!0}})}catch(e){}}();