PageSourceSearch

https://river.health/assets/LabLocator-BseoxuPg.js

js river.health collected 2026-10-06 11:01:58 UTC 11,693 bytes, 1 lines download raw bytes

1import{u as N,r as l,j as e}from"./index-wUosW00d.js";import{C as T,N as F,F as B}from"./Footer-C6_lx9GZ.js";import{S,a as C,b as _,c as k,d as m}from"./select-CBsrxgra.js";import{M as v}from"./map-pin-DgZpdy_Z.js";import{L as w}from"./loader-circle-JRj_XMMd.js";import{S as E}from"./search-bk5zZqT4.js";import{H as R}from"./HowItWorksSection-CV7-eyGh.js";import{g as z,c as $}from"./nearbyLabs-VwDR2dUN.js";import"./index-_8k6VigS.js";import"./Combination-NvEYl9IA.js";import"./check-VxvCiAda.js";import"./media-C6gXAthf.js";const A={en:{eyebrow:"Lab Finder",heading:"Let us find a lab near you.",subhead:"Enter your zip code below to see labs in your area.",placeholder:"Enter your zip code here...",miles:s=>`${s} miles`,useLocation:"Use my current location"},es:{eyebrow:"Buscador de laboratorios",heading:"Déjanos encontrar un laboratorio cerca de ti.",subhead:"Ingresa tu código postal abajo para ver laboratorios en tu zona.",placeholder:"Ingresa tu código postal aquí...",miles:s=>`${s} millas`,useLocation:"Usar mi ubicación actual"}},O=({onSearch:s,loading:n,usingLocation:r,onUseLocation:a,currentZipCode:o})=>{const t=N(A),[i,u]=l.useState(""),[c,g]=l.useState("10");l.useEffect(()=>{o&&u(o)},[o]);const h=()=>{s({zipCode:i,radius:parseFloat(c),sortBy:"distance"})},b=d=>{d.key==="Enter"&&h()},y=d=>{g(d),i&&s({zipCode:i,radius:parseFloat(d),sortBy:"distance"})};return e.jsx("section",{className:"bg-background-warm",children:e.jsxs("div",{className:"py-12 sm:py-16 md:py-24 max-w-6xl mx-auto px-4 md:px-6",children:[e.jsxs("div",{className:"mb-12 stagger-children",children:[e.jsx("p",{className:"animate-fade-in-up font-mono text-xs font-medium uppercase tracking-[0.14em] text-brand-accent mb-4",children:t.eyebrow}),e.jsx("h1",{className:"animate-fade-in-up font-serif font-normal text-foreground text-4xl sm:text-5xl md:text-[3.25rem] leading-[1.08] tracking-[-0.02em]",style:{fontVariationSettings:'"SOFT" 50'},children:t.heading}),e.jsx("p",{className:"animate-fade-in-up mt-5 max-w-xl text-lg leading-snug text-muted-foreground",children:t.subhead})]}),e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:hidden",children:[e.jsx("input",{type:"text",value:i,onChange:d=>u(d.target.value),onKeyDown:b,placeholder:t.placeholder,className:"w-full h-12 px-4 input-glow bg-background border-[1.5px] border-border rounded-md focus:outline-none focus:ring-0 text-base"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(S,{value:c,onValueChange:y,children:[e.jsx(C,{className:"h-12! py-3 input-glow border-[1.5px] border-border text-base w-auto gap-1",children:e.jsx(_,{})}),e.jsxs(k,{children:[e.jsx(m,{value:"5",children:t.miles(5)}),e.jsx(m,{value:"10",children:t.miles(10)}),e.jsx(m,{value:"20",children:t.miles(20)}),e.jsx(m,{value:"30",children:t.miles(30)}),e.jsx(m,{value:"50",children:t.miles(50)})]})]}),e.jsx("button",{onClick:a,className:"px-4 py-3 btn-press bg-primary text-primary-foreground rounded-md hover:bg-primary-hover transition-colors flex items-center",title:t.useLocation,children:e.jsx(v,{className:`h-5 w-5 ${r?"animate-pulse":""}`})}),e.jsx("button",{onClick:h,disabled:n,className:"px-6 py-3 bg-primary text-primary-foreground rounded-md hover:bg-primary-hover transition-colors disabled:opacity-50 flex items-center whitespace-nowrap",children:n?e.jsx(w,{className:"h-5 w-5 animate-spin"}):e.jsx(E,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{className:"hidden sm:flex gap-3",children:[e.jsx("input",{type:"text",value:i,onChange:d=>u(d.target.value),onKeyDown:b,placeholder:t.placeholder,className:"flex-1 h-12 px-4 input-glow bg-background border-[1.5px] border-border rounded-md focus:outline-none focus:ring-0 text-base"}),e.jsxs(S,{value:c,onValueChange:y,children:[e.jsx(C,{className:"h-12! py-3 input-glow border-[1.5px] border-border w-auto gap-1",children:e.jsx(_,{})}),e.jsxs(k,{children:[e.jsx(m,{value:"5",children:t.miles(5)}),e.jsx(m,{value:"10",children:t.miles(10)}),e.jsx(m,{value:"20",children:t.miles(20)}),e.jsx(m,{value:"30",children:t.miles(30)}),e.jsx(m,{value:"50",children:t.miles(50)})]})]}),e.jsx("button",{onClick:a,className:"px-4 py-3 btn-press bg-primary text-primary-foreground rounded-md hover:bg-primary-hover transition-colors flex items-center",title:t.useLocation,children:e.jsx(v,{className:`h-5 w-5 ${r?"animate-pulse":""}`})}),e.jsx("button",{onClick:h,disabled:n,className:"px-6 py-3 bg-primary text-primary-foreground rounded-md hover:bg-primary-hover transition-colors disabled:opacity-50 flex items-center",children:n?e.jsx(w,{className:"h-5 w-5 animate-spin"}):e.jsx(E,{className:"h-5 w-5"})})]})]})]})})},U={en:{closest:"Closest",fallbackName:"Lab Testing Location",mi:"mi",less:"Less",details:"Details",phone:"Phone",hours:"Hours"},es:{closest:"Más cercano",fallbackName:"Sede de análisis de laboratorio",mi:"mi",less:"Menos",details:"Detalles",phone:"Teléfono",hours:"Horario"}},D=s=>
1s.split(";").map(n=>{const r=n.trim(),a=r.match(/^([^:]+?):\s*(?=\D)(.+)$/);return a?{label:a[1].trim(),hours:a[2].trim()}:{label:null,hours:r}}),H=({lab:s,index:n})=>{const[r,a]=l.useState(!0),o=N(U),t=n===0;return e.jsxs("div",{className:"animate-fade-in-up card-lift bg-card border border-border rounded-md p-4 sm:p-6 cursor-pointer",onClick:()=>a(!r),children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t&&e.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.08em] bg-brand-accent text-brand-accent-foreground px-2 py-0.5 rounded-full",children:o.closest}),e.jsxs("span",{className:"font-mono text-xs font-medium tabular-nums bg-secondary text-foreground px-2 py-0.5 rounded-full",children:[s.distance_miles," ",o.mi]})]}),e.jsx("h3",{className:"text-base font-semibold text-foreground mb-1",children:s.site_name||o.fallbackName}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.city,", ",s.state]}),e.jsxs("div",{className:"flex items-center mt-3 text-brand-accent",children:[e.jsx(T,{className:`h-4 w-4 transition-transform duration-300 ${r?"rotate-180":""}`}),e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.08em] ml-1",children:r?o.less:o.details})]}),e.jsx("div",{className:`expand-content ${r?"is-open":""}`,children:e.jsx("div",{children:e.jsxs("div",{className:"mt-4 pt-4 border-t border-border space-y-2 text-sm text-muted-foreground break-words",children:[e.jsxs("p",{children:[s.address_line_1,s.address_line_2&&`, ${s.address_line_2}`]}),e.jsxs("p",{children:[s.city,", ",s.state," ",s.zip_code]}),s.phone&&e.jsxs("p",{className:"mt-3",children:[e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.08em] text-tertiary",children:o.phone}),e.jsx("br",{}),e.jsx("a",{href:`tel:${s.phone}`,className:"font-mono tabular-nums text-foreground hover:text-brand-accent hover:underline underline-offset-2",onClick:i=>i.stopPropagation(),children:s.phone})]}),s.hours_of_operation&&e.jsxs("div",{className:"mt-3",children:[e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.08em] text-tertiary",children:o.hours}),e.jsx("div",{className:"mt-1 space-y-1.5",children:D(s.hours_of_operation).map((i,u)=>e.jsxs("div",{children:[i.label&&e.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:i.label}),e.jsx("span",{className:"font-mono tabular-nums text-foreground text-sm block",children:i.hours})]},u))})]})]})})})]})},I={en:{loadingMessages:["Searching for labs near you...","Checking availability in your area...","Finding the closest locations..."],found:s=>`Found ${s} lab${s!==1?"s":""} in your area`,showLess:"Show less",seeAll:"See all",noLabsTitle:"No labs found nearby",noLabsBody:"Try a different zip code or widen your search radius."},es:{loadingMessages:["Buscando laboratorios cerca de ti...","Verificando disponibilidad en tu zona...","Encontrando las sedes más cercanas..."],found:s=>s===1?"Encontramos 1 laboratorio en tu zona":`Encontramos ${s} laboratorios en tu zona`,showLess:"Mostrar menos",seeAll:"Ver todos",noLabsTitle:"No se encontraron laboratorios cerca",noLabsBody:"Prueba con otro código postal o amplía tu radio de búsqueda."}},V=({results:s,loading:n,hasSearched:r})=>{const a=N(I),[o,t]=l.useState(!1),[i,u]=l.useState(0);if(l.useEffect(()=>{if(!n)return;const c=setInterval(()=>{u(g=>(g+1)%a.loadingMessages.length)},2e3);return()=>clearInterval(c)},[n,a.loadingMessages.length]),n)return e.jsx("section",{className:"max-w-6xl mx-auto px-4 md:px-6 py-8",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(w,{className:"animate-spin h-8 w-8 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground transition-opacity duration-300",children:a.loadingMessages[i]})]})});if(!n&&s.length>0){const c=o?s:s.slice(0,3),g=s.length>3;return e.jsxs("section",{className:"max-w-6xl mx-auto px-4 md:px-6 py-12",children:[e.jsxs("div",{className:"mb-6 flex items-baseline gap-2 animate-fade-in-up",children:[e.jsx("p",{className:"text-muted-foreground",children:a.found(s.length)}),g&&e.jsx("button",{onClick:()=>t(!o),className:"text-sm font-medium text-brand-accent underline underline-offset-2 hover:text-brand-accent-hover",children:o?a.showLess:a.seeAll})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6 stagger-grid",children:c.map((h,b)=>e.jsx(H,{lab:h,index:b},h.id))})]})}return!n&&s.length===0&&r?e.jsx("section",{className:"max-w-6xl mx-auto px-4 md:px-6 py-8",children:e.jsxs("div",{className:"text-center py-12 animate-fade-in-up",children:[e.jsx(v,{className:"h-12 w-12 text-tertiary mx-auto mb-4"}),e.jsx("h2",{className:"font-serif font-normal text-foreground text-2xl sm:text-3xl tracking-[-0.015em]",style:{fontVariationSettings:'"SOFT" 50'},children:a.noLabsTitle}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:a.noLabsBody})]})}):null},Z={en:{geolocationUnsupported:"Geolocation is not supported by your browser",currentLocation:"Current Location",locationError:"Unable to get your location. Please search by ZIP code instead."},es:{geolocationUnsupported:"Tu navegador no admite la geolocalización",currentLocation:"Ubicación actual",locationError:"No pudimos obtener tu ubicación. Por favor busca por código postal."}},M=(s,n)=>[...s].sort((r,a)=>n==="distance"?r.distance_miles-a.distance_miles:(r.site_name??"").localeCompare(a.site_name??""));function oe(){const s=N(Z),[n,r]=l.useState([]),[a,o]=l.useState(!1),[t,i]=l.useState(!1),[u,c]=l.useState(!1),[g,h]=l.useState(""),b=async(x,p)=>{try{return(await(await fetch(`https://api.bigdatacloud.net/data/reverse-geocode
1-client?latitude=${x}&longitude=${p}&localityLanguage=en`)).json()).postcode??`${x.toFixed(2)}, ${p.toFixed(2)}`}catch{return s.currentLocation}},y=async({zipCode:x,radius:p,sortBy:j})=>{if(x.trim()){o(!0),i(!1),c(!0);try{const{lat:f,lng:P}=await z(x),{data:{labs:L}}=await $({user_lat:f,user_lng:P,radius_miles:p});r(L?.length?M(L,j):[])}catch(f){console.error("Search error:",f),r([])}finally{o(!1)}}},d=()=>{if(!navigator.geolocation){alert(s.geolocationUnsupported);return}o(!0),i(!0),c(!0),navigator.geolocation.getCurrentPosition(async x=>{try{const{latitude:p,longitude:j}=x.coords;h(await b(p,j));const{data:{labs:f}}=await $({user_lat:p,user_lng:j,radius_miles:10});r(f?.length?M(f,"distance"):[])}catch(p){console.error("Search error:",p),r([])}finally{o(!1)}},x=>{console.error("Location error:",x),o(!1),i(!1),alert(s.locationError)})};return e.jsxs("div",{className:"min-h-screen",children:[e.jsx(F,{}),e.jsx(O,{onSearch:y,loading:a,usingLocation:t,onUseLocation:d,currentZipCode:g}),e.jsx(V,{results:n,loading:a,hasSearched:u}),e.jsx(R,{}),e.jsx(B,{})]})}export{oe as default};

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.