1import{S as e,B as t}from"./GlobalStylesStore--z5tmrDj.js";import{d as o}from"./defineElement-Bh-rOTph.js";import{R as s}from"./RetailerPlacesInputEvents-B6elX7G5.js";import{M as l}from"./ModalElementEvent-C2IIP3nm.js";import{u as a}from"./UserCentrics-D8W_hTLS.js";import{l as i}from"./load-script-BgZogJL7.js";import{K as c}from"./keyboard-B--Cwa5y.js";const n=new class extends e{#e=!1;properties(){return{isLoaded:!1}}load(e){if(this.#e||this.isLoaded)return;if(this.#e=!0,void 0!==window.google&&window.google.maps?.places?.PlaceAutocompleteElement)return void(this.isLoaded=!0);window.setupGooglePlacesSearch=()=>{this.isLoaded=!0};i(`https://maps.googleapis.com/maps/api/js?key=${e}&libraries=places&language=de&loading=async&callback=setupGooglePlacesSearch`,null)}};class r extends t{#t=null;#o=null;properties(){return{searchString:"",googleMapsApiKey:"GOOGLE_MAPS_API_KEY",countries:["de"],placeholder:"",ucStore:a,googleMapsStore:n}}connected(){this.#t=this.closest("modal-element"),this.#t?.addEventListener(l.OPEN,(()=>{this.ucStore.hasGoogleMapsConsent&&!this.#o&&this.loadGoogleMaps(),this.focus()}))}watch(){return{searchString:()=>{this.dispatch(s.PLACES_INPUT_CHANGE,{searchString:this.searchString},{bubbles:!0,cancelable:!1,composed:!1})},googleMapsStore:()=>{this.googleMapsStore.isLoaded&&!this.#o&&this.initPlaceAutocomplete({focus:!0})},ucStore:async()=>{this.ucStore.hasGoogleMapsConsent&&this.loadGoogleMaps()}}}events(){return{this:{keydown:{listener:e=>{let{key:t,target:o}=e;t===c.ENTER&&(this.searchString=o.value)},options:{capture:!0}}},'[ref="input"]':{keydown:e=>{let{key:t,target:o}=e;this.#o||t!==c.ENTER||(this.searchString=o.value)}},'[ref="button"]':{click:e=>{this.searchString=this.$refs.input.value}}}}loadGoogleMaps(){this.googleMapsStore.isLoaded?this.initPlaceAutocomplete({focus:!0}):this.googleMapsStore.load(this.googleMapsApiKey)}initPlaceAutocomplete(){let{focus:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.#s(),e&&this.focus()}#s(){this.#o&&this.#o.remove();const e=new google.maps.places.PlaceAutocompleteElement({includedRegionCodes:this.countries,includedPrimaryTypes:["(regions)"]});e.placeholder=this.placeholder,e.addEventListener("gmp-select",(async e=>{let{placePrediction:t}=e;const o=t.toPlace();await o.fetchFields({fields:["formattedAddress","location"]}),this.onPlaceChange(o)})),this.$refs.fallbackInputContainer.style.display="none",this.prepend(e),this.#o=e}onPlaceChange(e){e&&e.location&&(this.place=e,this.searchString=e.formattedAddress)}focus(){const e=this.#o??this.$refs.input;requestAnimationFrame((()=>e?.focus()))}clear(){this.searchString="",this.#o?this.#s():(this.$refs.input.value="",this.$refs.input.focus())}}o("retailer-places-input",r);export{r as default}; 2//# sourceMappingURL=retailer-places-input-uxRiL6a5.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.