PageSourceSearch

https://www.yourchandlerdentist.com/build-next/assets/location-search-DnCuxXhm.js

js yourchandlerdentist.com collected 2026-10-04 17:46:31 UTC 6,478 bytes, 1 lines download raw bytes

1import{l as ae}from"./gmaps-BylYYdKs.js";const h={noLocations:"Sorry, no locations were found. Please refine your search and try again.",generic:"Sorry, we were unable to find your current location. Please enter a city or ZIP Code and try again."};function ie(c,w){const C=w&&typeof w=="object"?w:{},O=C.apiKey??"",V=Array.isArray(C.locations)?C.locations:[],a=c.querySelector("input.vs__search"),H=c.querySelector('ul[role="listbox"]'),I=c.querySelector('[role="combobox"]'),u=c.querySelector(".v-select"),D=c.querySelector(".vs__selected-options"),R=c.querySelector(".vs__spinner"),G=c.querySelector("[data-locations-list]"),Y=c.querySelector("[data-use-current-location]"),g=c.querySelector("[data-locations-status]");if(!a||!H||!I||!u||!G)return;const J=a.placeholder;let r=null,j=null,m=null;const A={};let P=null,x=null,l=[],s=-1,F=!1,y=0;async function $(){r||(r=await ae(O),j=new r.maps.places.AutocompleteService,m=new r.maps.Geocoder)}const p=H;function M(){p.innerHTML="",l.forEach((e,t)=>{const n=document.createElement("li");n.setAttribute("role","option"),n.id=`location-finder-option-${t}`,n.className="vs__dropdown-option",n.textContent=e.label,n.addEventListener("mousedown",o=>{o.preventDefault(),Z(e)}),n.addEventListener("mouseover",()=>{s=t,v()}),p.appendChild(n)}),v()}function v(){Array.from(p.children).forEach((t,n)=>{const o=n===s;t.classList.toggle("vs__dropdown-option--highlight",o),t.setAttribute("aria-selected",o?"true":"false")});const e=s>=0?p.children[s]:void 0;e?a.setAttribute("aria-activedescendant",e.id):a.removeAttribute("aria-activedescendant")}function Q(){g&&(l.length===0?g.textContent="No locations found":g.textContent=`${l.length} location${l.length===1?"":"s"} found`)}function f(e){F=e,I.setAttribute("aria-expanded",e?"true":"false"),u.classList.toggle("vs--open",e),p.style.display=e?"":"none",p.style.visibility=e?"visible":"hidden",e||(l=[],s=-1,M(),g&&(g.textContent=""))}function k(e){if(c.querySelectorAll(".vs__selected").forEach(t=>t.remove()),e!==null&&D){const t=document.createElement("span");t.className="vs__selected",t.textContent=e,D.insertBefore(t,a),u.classList.remove("vs--searching"),a.placeholder=""}else a.placeholder=J}function K(e){R&&(R.style.display=e?"":"none"),u.classList.toggle("vs--loading",e)}let E=G;function X(e){const t=e.distance??0;return t.toFixed(1)+" mile"+(Math.round(t)>1?"s":"")}function ee(e,t){const n=document.createElement("div");n.className="locations-list",n.setAttribute("data-locations-list","");const o=document.createElement("p");o.innerHTML=e.length>0?"Your "+t+" nearest locations...":h.noLocations,n.appendChild(o);const i=document.createElement("ul");i.className="locations";for(const d of e){const S=document.createElement("li");S.className="location";const T=document.createElement("header"),q=document.createElement("p");q.className="title",q.innerHTML=d.short_name??"";const z=document.createElement("address");z.innerHTML=d.fullAddress??"",T.appendChild(q),T.appendChild(z);const N=document.createElement("footer"),b=document.createElement("a");b.href=d.uri??"",b.className="cta white outline",b.innerHTML="Visit site";const U=document.createElement("p");U.innerHTML=X(d),N.appendChild(b),N.appendChild(U),S.appendChild(T),S.appendChild(N),i.appendChild(S)}n.appendChild(i),E.replaceWith(n),E=n}function L(e){const t=document.createElement("div");t.className="locations-list",t.setAttribute("data-locations-list","");const n=document.createElement("h2");n.className="h3 error",n.innerHTML=e,t.appendChild(n),E.replaceWith(t),E=t}function B(e){const t=V.map(n=>{const o={...n};return o.distance=r.maps.geometry.spherical.computeDistanceBetween(new r.maps.LatLng(n.position),new r.maps.LatLng(e))*621371e-9,o}).sort((n,o)=>(n.distance??0)-(o.distance??0)).filter(n=>(n.distance??1/0)<=50).splice(0,2);t.length>0?ee(t,t.length):L(h.noLocations)}function W(e){const t=[];return(e??[]).forEach(n=>{Array.isArray(n.types)&&(n.types.indexOf("administrative_area_level_1")>-1||n.types.indexOf("locality")>-1)&&t.push(n.short_name)}),t.length===2?t.join(", "):null}function _(e){const t={lat:typeof e.geometry.location.lat=="function"?e.geometry.location.lat():e.geometry.location.lat,lng:typeof e.geometry.location.lng=="function"?e.geometry.location.lng():e.geometry.location.lng},n=W(e.address_components);k(n),B(t)}function te(e){return new Promise((t,n)=>{j.getPlacePredictions({input:e,componentRestrictions:{country:"us"},types:["(regions)"],language:"en",fields:["address_components","geometry","name"]},(o,i)=>{if(i!==r.maps.places.PlacesServiceStatus.OK||!o){n(new Error(i));return}t(o)})})}async function ne(){const e=a.value;if(e.length===0){f(!1);return}const t=++y;K(!0);try{await $();const n=await te(e);
1if(t!==y)return;l=n.map(o=>{let i=o.description.split(", ").slice(0,-1).join(", ");if(Array.isArray(o.types)&&o.types.length){const d=o.types[0];if(d==="postal_code")i=o.structured_formatting.main_text+" (ZIP Code)";else if(d==="administrative_area_level_1")return null}return{label:i,placeId:o.place_id}}).filter(o=>o!==null),s=-1,M(),Q(),f(a.value.length!==0)}catch{t===y&&(l=[],M(),f(!1))}finally{t===y&&K(!1)}}function Z(e){f(!1),a.value="",k(e.label);const t=n=>{A[e.placeId]=n,_(n)};if(A[e.placeId]){t(A[e.placeId]);return}m.geocode({placeId:e.placeId}).then(({results:n})=>t(n[0])).catch(()=>L(h.generic))}async function oe(){if(await $(),P!==null){_(P);return}const e=()=>{if(x!==null){_(x);return}fetch(`https://www.googleapis.com/geolocation/v1/geolocate?key=${O}`,{method:"POST"}).then(t=>t.json()).then(t=>{t.location&&m.geocode({location:t.location}).then(({results:n})=>{x=n[0],_(n[0])}).catch(()=>L(h.generic))}).catch(()=>L(h.generic))};navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>{const n={lat:t.coords.latitude,lng:t.coords.longitude};m.geocode({location:n}).then(({results:o})=>{if(o[0]){P=o[0];const i=W(o[0].address_components);k(i),B(n)}else e()}).catch(()=>e())},()=>e()):e()}a.addEventListener("input",()=>{ne()}),a.addEventListener("focus",()=>u.classList.add("focused")),a.addEventListener("blur",()=>{u.classList.remove("focused"),f(!1)}),a.addEventListener("keydown",e=>{!F&&e.key!=="Escape"||(e.key==="ArrowDown"?(e.preventDefault(),s=Math.min(s+1,l.length-1),v()):e.key==="ArrowUp"?(e.preventDefault(),s=Math.max(s-1,0),v()):e.key==="Enter"?(e.preventDefault(),s>=0&&l[s]&&Z(l[s])):e.key==="Escape"&&f(!1))}),Y?.addEventListener("click",()=>{oe()})}function ce(){}export{ce as destroy,ie as initialize};

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.