1import{r as c,j as u,L as We,ai as He,aj as ve,c1 as Ze}from"./vendor-rEgLgVpk.js";import{I as qe}from"./input-DPe3g1rU.js";import{c as ke}from"./index-4G9MUb21.js";const je="meridian:recent-addresses",Ve=5;function ze(){try{const t=localStorage.getItem(je);if(!t)return[];const r=JSON.parse(t);return Array.isArray(r)?r:[]}catch{return[]}}function Ye(t){if(t?.fullAddress)try{const r=ze(),n=t.fullAddress.toLowerCase().trim(),s=r.filter(i=>i.fullAddress.toLowerCase().trim()!==n),l=[t,...s].slice(0,Ve);localStorage.setItem(je,JSON.stringify(l))}catch{}}const Be={AL:[["350","369"]],AK:[["995","999"]],AZ:[["850","865"]],AR:[["716","729"]],CA:[["900","961"]],CO:[["800","816"]],CT:[["060","069"]],DE:[["197","199"]],FL:[["320","349"]],GA:[["300","319"],["398","399"]],HI:[["967","968"]],ID:[["832","838"]],IL:[["600","629"]],IN:[["460","479"]],IA:[["500","528"]],KS:[["660","679"]],KY:[["400","427"]],LA:[["700","714"]],ME:[["039","049"]],MD:[["206","219"]],MA:[["010","027"],["055","055"]],MI:[["480","499"]],MN:[["550","567"]],MS:[["386","397"]],MO:[["630","658"]],MT:[["590","599"]],NE:[["680","693"]],NV:[["889","898"]],NH:[["030","038"]],NJ:[["070","089"]],NM:[["870","884"]],NY:[["004","005"],["100","149"]],NC:[["270","289"]],ND:[["580","588"]],OH:[["430","459"]],OK:[["730","749"]],OR:[["970","979"]],PA:[["150","196"]],RI:[["028","029"]],SC:[["290","299"]],SD:[["570","577"]],TN:[["370","385"]],TX:[["750","799"],["885","885"]],UT:[["840","847"]],VT:[["050","054"],["056","059"]],VA:[["201","201"],["220","246"]],WA:[["980","994"]],WV:[["247","268"]],WI:[["530","549"]],WY:[["820","831"]],DC:[["200","200"],["202","205"],["569","569"]]};function Ge(t,r){const n=(t||"").trim(),s=(r||"").trim().toUpperCase();if(!n&&!s||!n||!s||!/^\d{5}(-\d{4})?$/.test(n))return!0;const l=n.slice(0,3),i=Be[s];return i?i.some(([h,b])=>l>=h&&l<=b):!1}const Re={alabama:"AL",alaska:"AK",arizona:"AZ",arkansas:"AR",california:"CA",colorado:"CO",connecticut:"CT",delaware:"DE",florida:"FL",georgia:"GA",hawaii:"HI",idaho:"ID",illinois:"IL",indiana:"IN",iowa:"IA",kansas:"KS",kentucky:"KY",louisiana:"LA",maine:"ME",maryland:"MD",massachusetts:"MA",michigan:"MI",minnesota:"MN",mississippi:"MS",missouri:"MO",montana:"MT",nebraska:"NE",nevada:"NV","new hampshire":"NH","new jersey":"NJ","new mexico":"NM","new york":"NY","north carolina":"NC","north dakota":"ND",ohio:"OH",oklahoma:"OK",oregon:"OR",pennsylvania:"PA","rhode island":"RI","south carolina":"SC","south dakota":"SD",tennessee:"TN",texas:"TX",utah:"UT",vermont:"VT",virginia:"VA",washington:"WA","west virginia":"WV",wisconsin:"WI",wyoming:"WY","district of columbia":"DC"},Xe=new Set(Object.values(Re)),Je=/^(st|street|ave|avenue|blvd|boulevard|dr|drive|rd|road|ln|lane|way|pl|place|ct|court|cir|circle|ter|terrace|pkwy|parkway|trl|trail|rdg|ridge|hwy|highway|sq|square|loop|row|aly|alley|mall|run|trc|trace|xing|crossing)$/i;function pe(t){const r=(t||"").trim();if(!r)return null;const n=r.toUpperCase();return n.length===2&&Xe.has(n)?n:Re[r.toLowerCase().replace(/\s+/g," ")]||null}function fe(t){const r=t.trim().replace(/-\s*$/,"").trim(),n=r.match(/^(.*?)\s*(\d{5}(?:-\d{4})?)$/);return n?{zip:n[2],rest:n[1].trim()}:{zip:"",rest:r}}function $e(t,r){const n=Math.min(3,t.length);for(let s=1;s<=n;s++){const l=t.slice(t.length-s).join(" "),i=pe(l);if(i&&Ge(r,i))return{state:i,leftover:t.slice(0,t.length-s).join(" ")}}return{state:"",leftover:t.join(" ")}}function Ne(t){const{zip:r,rest:n}=fe(t);if(!n)return{state:"",zip:r,leftover:""};const s=n.split(/\s+/).filter(Boolean);if(s.length===0)return{state:"",zip:r,leftover:""};const{state:l,leftover:i}=$e(s,r);return{state:l,zip:r,leftover:i}}function Qe(t){const r=t.match(/\b((?:apt\.?|apartment|unit|suite|ste\.?|fl\.?|floor|bldg\.?|building)\s+[a-z0-9][a-z0-9-]*)/i),n=!r&&t.match(/(?<![a-z0-9])(#\s*[a-z0-9][a-z0-9-]*)/i),s=r??n;if(s){const l=s[1].trim(),i=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=t.replace(new RegExp(",?\\s*"+i+"(?:\\s*,)?","i")," ").trim().replace(/\s+/g," ");return{unit:l,stripped:h}}}function et(t){const n=(t||"").replace(/\r\n|\r|\n|\t/g,", ").replace(/,\s*,\s*/g,", ").trim().replace(/,?\s*(United States of America|U\.S\.A\.|U\.S\.|United States?|USA|US)\s*$/i,"").trim();if(!n)return null;let s=n.split(",").map(p=>
1p.trim()).filter(Boolean);if(s.length>3){for(;s.length>2;){const p=s[s.length-1];if(fe(p).zip||pe(p))break;s=s.slice(0,-1)}if(s.length>=2){const p=s[s.length-1],{zip:A,rest:y}=fe(p);if(A&&!y){const k=s[s.length-2].trim();pe(k)&&(s=[...s.slice(0,-2),`${k} ${p}`])}}}let l="",i="",h="",b="";if(s.length>=3){const p=Ne(s[s.length-1]);h=p.state,b=p.zip,i=s[s.length-2],p.leftover&&(i=i?`${i} ${p.leftover}`:p.leftover),l=s.slice(0,s.length-2).join(", ")}else if(s.length===2){const p=Ne(s[1]);h=p.state,b=p.zip,i=p.leftover,l=s[0]}else{const{zip:p,rest:A}=fe(s[0]);if(b=p,!A)return null;const y=A.split(/\s+/).filter(Boolean);if(y.length<2)return null;const k=$e(y,p);h=k.state;const N=(h?k.leftover:A).split(/\s+/).filter(Boolean);if(N.length===0)return!h&&!b?null:{streetAddress:"",city:"",state:h,zipCode:b,fullAddress:n};let x=-1;for(let _=N.length-1;_>=1;_--){const $=N[_].replace(/\.$/,"");if(Je.test($)){x=_;break}}if(x>=0&&x<N.length-1)l=N.slice(0,x+1).join(" "),i=N.slice(x+1).join(" ");else if(x===N.length-1&&h)l=N.join(" "),i="";else{if(!h&&!b)return null;l=N.join(" "),i=""}}if(!h&&!b)return null;const K=Qe(l),me=K?.unit;K&&(l=K.stripped);let ie=n;if(K){const p=K.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");ie=n.replace(new RegExp(",?\\s*"+p+"(?:\\s*,)?","i")," ").trim().replace(/\s+/g," ")}return{streetAddress:l||n,unitNumber:me,city:i,state:h,zipCode:b,fullAddress:ie}}function ne(t){return pe(t)||t}const tt=5e3;let Ae=null;const st=30,ae=new Map;function rt(t){return t.toLowerCase().trim()}function Ue(t,r){if(ae.size>=st){const n=ae.keys().next().value;n!==void 0&&ae.delete(n)}ae.set(t,r)}const G=et;function ut(t){return{street:t.streetAddress||t.fullAddress||"",city:t.city||"",state:(t.state||"").toUpperCase().slice(0,2),zipCode:t.zipCode||""}}const nt=new Set(["chicago","new york","los angeles","houston","phoenix","philadelphia","san antonio","san diego","dallas","austin","jacksonville","fort worth","columbus","charlotte","indianapolis","san francisco","seattle","denver","nashville","oklahoma","portland","las vegas","memphis","louisville","baltimore","milwaukee","albuquerque","tucson","fresno","sacramento","mesa","kansas","atlanta","omaha","colorado","raleigh","miami","minneapolis","tulsa","tampa","arlington","aurora","bakersfield","anaheim","honolulu","santa ana","riverside","corpus christi","pittsburgh","cincinnati","anchorage","stockton","toledo","orlando","newark","greensboro","buffalo","plano","lincoln","henderson","evanston","naperville","joliet","elgin","waukegan","schaumburg","oak park","skokie","berwyn","cicero","brooklyn","queens","bronx","manhattan","pasadena","glendale","scottsdale","tempe","chandler"]);function xe(t){const r=t.toLowerCase().trim();return!!(nt.has(r)||/^[a-z]+$/i.test(r)&&r.length>4)}function Ee(t){if(!t)return"";let r=t.trim();return r=r.replace(/^(?:unit|apt|apartment|suite|ste)[-.\s]*/i,"").trim(),r=r.replace(/^#[-.\s]*/i,"").trim(),r}function ft(t,r){let n=(t||"").trim();const s=Ee(r||"");if(s){const l=ye(n);if(l&&Ee(l).toUpperCase()===s.toUpperCase())return n;const i=n.split(",")[0]||n;if(new RegExp(`(?:unit|apt|apartment|suite|ste|#)\\s*${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(i))return n;const b=n.split(",");b.length>=2?(b[0]=`${b[0].trim()} Unit ${s}`,n=b.join(",")):n=`${n} Unit ${s}`}return n}function pt(t,r){if(!r)return!1;const n=l=>(l||"").trim().toLowerCase().replace(/\s+/g," "),s=n(t);return s?s!==n(r.fullAddress)&&s!==n(r.streetAddress):!0}function ye(t){const r=/\b((?:apt\.?|apartment|unit|suite|ste\.?|fl\.?|floor|bldg\.?|building)\s+[a-z0-9][a-z0-9-]*|#\s*[a-z0-9][a-z0-9-]*)/i,n=t.match(r);if(n){const i=n[1].trim(),h=i.replace(/^(?:apt\.?|apartment|unit|suite|ste\.?|fl\.?|floor|bldg\.?|building|#)\s*/i,"").trim();if(!xe(h))return i}const s=t.match(/^\s*\d+\s+[a-z0-9\s.]+(?:street|st|avenue|ave|boulevard|blvd|drive|dr|road|rd|lane|ln|way|place|pl|court|ct|circle|cir|terrace|ter|parkway|pkwy)\s+([a-z]?\d+[a-z]?|ph\d*|penthouse|\d{1,4}[nsew])\b/i);if(s){const i=s[1];if(!xe(i))return i.toUpperCase()}const l=t.match(/^\s*\d+\s+\S+(?:\s+\S+)*?\s+(\d{1,4}[nsew]|[nsew]\d{1,4}|ph\d*)\s*(?:,|$)/i);if(l){const i=l[1];if(!xe(i))return i.toUpperCase()}return null}const at=/,?\s*(United States of America|U\.S\.A\.|U\.S\.|United States?|USA|US)\s*$/i;function Ie(t){return(t||"").replace(at,"").trim()}function it(t,r,n,s){const l=(t||"").trim();if(!l)return"";const i=[l],h=(r||"").trim();h&&i.push(h);
1const b=[(n||"").trim(),(s||"").trim()].filter(Boolean).join(" ");return b&&i.push(b),i.join(", ")}function ot(t,r,n){return t?!r&&!n?!1:!t.includes(","):!0}function ue(t,r){return(t||"").trim().toLowerCase()!==(r||"").trim().toLowerCase()}function mt({value:t,onChange:r,onAddressSelect:n,onNormalized:s,onSelectionStart:l,placeholder:i="Start typing an address...",className:h,style:b,"data-testid":K,"aria-label":me,apiKey:ie,disabled:p}){const[A,y]=c.useState([]),[k,S]=c.useState(!1),[N,x]=c.useState(!1),[_,$]=c.useState(!1),[W,H]=c.useState(-1),[oe,U]=c.useState(!1),[De,he]=c.useState(!1),[O,le]=c.useState([]),[Z,q]=c.useState(-1),[we,Q]=c.useState(null),ce=c.useRef(null),ee=c.useRef(null),I=c.useRef(null),te=c.useRef(0),D=c.useRef(null),V=c.useRef(0),X=c.useRef(0),J=c.useRef(null),Se=c.useRef(null),M=c.useRef(!1),Me=c.useRef(0);c.useEffect(()=>()=>{I.current&&clearTimeout(I.current),D.current?.abort()},[]),c.useEffect(()=>{const e=a=>{ee.current&&!ee.current.contains(a.target)&&ce.current&&!ce.current.contains(a.target)&&S(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const Ce=c.useCallback(async e=>{const a=++te.current;D.current?.abort();const o=new AbortController;D.current=o;const g=()=>te.current!==a;if(e.length<3){y([]),S(!1),U(!1),x(!1);return}if((e.match(/,/g)||[]).length>=2&&G(e)?.state){y([]),S(!1),U(!1),x(!0),$(!0),Se.current?.(e);return}const j=rt(e),z=ae.get(j);if(z){g()||(U(!1),y(z),S(!0),H(-1),x(!1));return}try{try{const m=await fetch(`/api/mapbox/suggest?q=${encodeURIComponent(e)}`,{signal:AbortSignal.any([o.signal,AbortSignal.timeout(1e4)])});if(g())return;if(!m.ok)throw new Error(`Mapbox suggest failed: ${m.status}`);const C=await m.json();if(g())return;if(C.suggestions&&C.suggestions.length>0){U(!1),y(C.suggestions),S(!0),H(-1),Ue(j,C.suggestions);return}}catch{if(g())return}if(Ae===!1){y([]),U(!0),S(!0);return}{const m=await fetch(`/api/google/places-suggest?q=${encodeURIComponent(e)}`,{signal:AbortSignal.any([o.signal,AbortSignal.timeout(5e3)])});if(g())return;if(m.status===503){let f=null;try{f=await m.json()}catch{}if(g())return;if(f?.available===!1){Ae=!1,y([]),U(!0),S(!0);return}}m.ok&&(Ae=!0);const C=m.ok?await m.json():null;if(g())return;if(C&&C.predictions&&C.predictions.length>0){U(!1);const f=C.predictions.map(w=>{const E=w.description||"",R=E.replace(/,?\s*(United States of America|U\.S\.A\.|U\.S\.|United States?|USA|US)\s*$/i,"").trim().split(",").map(P=>P.trim());let re=R[0]||"",F="",T="",v="";if(w.structured_formatting){re=w.structured_formatting.main_text||re;const L=(w.structured_formatting.secondary_text||"").replace(/,?\s*(United States of America|U\.S\.A\.|U\.S\.|United States?|USA|US)\s*$/i,"").trim().split(",").map(Ke=>Ke.trim());F=L[0]||"";const ge=L[1]||"",be=ge.match(/([A-Z]{2})\s*(\d{5})?/);be?(T=be[1],v=be[2]||""):(T=ge.split(" ")[0]||"",v=ge.split(" ")[1]||"")}else{F=R[1]||"";const P=R[2]||"",L=P.match(/([A-Z]{2})\s*(\d{5})?/);L?(T=L[1],v=L[2]||""):(T=P.split(" ")[0]||"",v=P.split(" ")[1]||"")}return{fullAddress:E,streetAddress:re,city:F,state:T,zipCode:v,coordinates:null,placeId:w.place_id}});Ue(j,f),y(f),S(!0),H(-1);return}y([]),U(!0),S(!0)}}catch{if(g())return;y([]),U(!0),S(!0)}finally{g()||x(!1)}},[ie]),Te=c.useCallback(e=>{he(!1),s?.(!1),le([]),q(-1),V.current++,X.current++,J.current?.abort(),J.current=null,te.current++,D.current?.abort(),D.current=null,e.length>=3&&y(a=>a.filter(o=>o.source!=="recent")),Q(null),r(e),I.current&&clearTimeout(I.current),e.length>=3?x(!0):x(!1),I.current=setTimeout(()=>Ce(e),300)},[r,Ce,s]),Y=c.useCallback(async e=>{V.current++;const a=++X.current;J.current?.abort();const o=new AbortController;J.current=o;const g=e!==void 0?e:t,d=G(g);if(!d){x(!1),$(!1);return}d.state=ne(d.state),S(!1),U(!1),y([]);const j=d.fullAddress||g;let z=!1;if(j)try{const C=await fetch(`/api/mapbox/geocode?address=${encodeURIComponent(j)}&limit=3`,{signal:AbortSignal.any([o.signal,AbortSignal.timeout(1e4)])});if(X.current!==a)return;if(C.ok){const f=await C.json();if(X.current!==a)return;if(Array.isArray(f.candidates)&&f.candidates.length>=2){const w=f.candidates,E=w[0];if(w.slice(1).some(R=>R.city.toLowerCase()!==E.city.toLowerCase()||R.state.toLowerCase()!==E.state.toLowerCase())){x(!1),$(!1),le(w),q(-1);return}}f.coordinates&&(d.coordinates={lat:f.coordinates.lat,lng:f.coordinates.lng}),f.zipCode&&!d.zipCode&&(d.zipCode=f.zipCode),f.streetAddress&&!d.streetAddress&&(d.streetAddress=f.streetAddress),f.city&&!d.city&&(d.city=f.city),f.state&&!d.state&&(d.state=ne(f.state))}else z=!0}catch{if(X.current!==a)return;z=!0}if(x(!1),$(!1),z){Q("Could not verify location â please choose a suggestion or check the address.");return}const m=[];
1if((!d.streetAddress||d.streetAddress.trim().length===0)&&m.push("street"),(!d.city||d.city.trim().length===0)&&m.push("city"),(!d.state||d.state.trim().length===0)&&m.push("state"),(!d.zipCode||d.zipCode.trim().length===0)&&m.push("ZIP code"),m.length>0){Q(`Address is missing: ${m.join(", ")}. Please include a full street address, city, state, and ZIP.`);return}Q(null),s?.(ue(g,d.streetAddress||"")),n(d)},[t,n,s]);Se.current=Y;const de=c.useCallback(e=>{le([]),q(-1),x(!1),$(!1);const a=G(t)||{},o={streetAddress:e.streetAddress||a.streetAddress||"",city:e.city||a.city||"",state:ne(e.state||a.state||""),zipCode:e.zipCode||a.zipCode||"",fullAddress:e.fullAddress||a.fullAddress||"",coordinates:e.coordinates??a.coordinates,unitNumber:a.unitNumber};e.streetAddress&&r(e.streetAddress),s?.(ue(t,o.streetAddress||"")),n(o)},[t,r,n,s]),Pe=c.useCallback(()=>{if(t.length>=3){A.length>0&&S(!0);return}const e=ze();if(e.length===0)return;const a=e.map(o=>({fullAddress:o.fullAddress,streetAddress:o.streetAddress,city:o.city,state:o.state,zipCode:o.zipCode,coordinates:o.coordinates??null,unitNumber:o.unitNumber,source:"recent"}));y(a),S(!0),U(!1),H(-1)},[t,A.length]),se=c.useCallback(async e=>{Me.current=Date.now(),l?.(),I.current&&(clearTimeout(I.current),I.current=null),te.current++,D.current?.abort(),D.current=null;const a=++V.current;X.current++,J.current?.abort(),J.current=null;const o=t,g=e.streetAddress?.trim()?e.streetAddress:e.fullAddress;e.streetAddress?.trim()||console.warn("[AddressAutocomplete] handleSelect: suggestion.streetAddress is empty, falling back to fullAddress",e);let d=Ie(e.fullAddress)||g;if(ot(d,e.city,e.state)){const w=it(g,e.city,e.state,e.zipCode);w&&(d=w)}r(d),S(!1),U(!1),y([]);let j=e.unitNumber,z=g,m=d;const C=ye(o)||ye(e.streetAddress)||void 0;if(C){j||(j=C);const w=C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=B=>B.replace(new RegExp(",?\\s*"+w+"(?:\\s*,)?","i")," ").trim().replace(/\s+/g," ");z=E(z),m=E(m),r(m)}let f={streetAddress:z,unitNumber:j,city:e.city,state:ne(e.state),zipCode:e.zipCode,fullAddress:m,coordinates:e.coordinates||void 0,placeId:e.placeId};if(s?.(ue(o,z)),n(f),e.source!=="recent"&&e.placeId){he(!1);let w=!1;for(let E=0;E<2&&!w;E++){let B=!1;try{const R=new AbortController,re=setTimeout(()=>{B=!0,R.abort()},tt);let F;try{F=await fetch(`/api/places/details?placeId=${encodeURIComponent(e.placeId)}`,{signal:R.signal})}finally{clearTimeout(re)}if(V.current!==a)return;if(!F.ok)throw new Error(`Place details request failed: ${F.status}`);const T=await F.json();if(V.current!==a)return;if(T.success&&T.address){const v=T.address,P=[v.streetNumber,v.streetName].filter(Boolean).join(" ")||e.streetAddress,L=Ie(v.formattedAddress||"")||m;f={streetAddress:P,unitNumber:v.unit||j,city:v.city||e.city,state:ne(v.state||e.state),zipCode:v.zipCode||e.zipCode,fullAddress:L,coordinates:v.coordinates||e.coordinates||void 0,placeId:e.placeId},r(L),s?.(ue(o,P)),n(f),w=!0}}catch(R){if(V.current!==a)return;if(B&&E===0){console.warn("[AddressAutocomplete] Place details timed out, retrying onceâ¦");continue}console.warn("[AddressAutocomplete] Place details fetch failed, using parsed values:",R),B&&he(!0)}}}V.current===a&&f.fullAddress&&Ye(f)},[r,n,s,l,t]),Le=c.useCallback(e=>{if(O.length>0){e.key==="ArrowDown"?(e.preventDefault(),q(a=>Math.min(a+1,O.length-1))):e.key==="ArrowUp"?(e.preventDefault(),q(a=>Math.max(a-1,0))):e.key==="Enter"?(e.preventDefault(),Z>=0&&de(O[Z])):e.key==="Escape"&&(e.preventDefault(),le([]),q(-1),x(!1),$(!1),ce.current?.focus());return}if(e.key==="Enter"&&t.trim().length===0){e.preventDefault(),Q("Please enter a property address.");return}if(e.key==="Enter"&&k&&oe&&A.length===0&&G(t)){e.preventDefault(),Y();return}!k||A.length===0||(e.key==="ArrowDown"?(e.preventDefault(),H(a=>Math.min(a+1,A.length-1))):e.key==="ArrowUp"?(e.preventDefault(),H(a=>Math.max(a-1,0))):e.key==="Enter"?(e.preventDefault(),W>=0?se(A[W]):A.length===1&&se(A[0])):e.key==="Escape"&&S(!1))},[O,Z,de,k,A,W,se,oe,Y,t]),_e=c.useCallback(e=>{const a=e.clipboardData.getData("text");a&&setTimeout(()=>{const o=a.replace(/\r\n|\r|\n|\t/g,", ").replace(/,\s*,\s*/g,", ").trim(),g=G(o);g&&(g.state||g.zipCode)&&(I.current&&(clearTimeout(I.current),I.current=null),te.current++,D.current?.abort(),D.current=null,r(o),x(!0),$(!0),Y(o))},0)},[Y,r]),Oe=k&&(A.length>0||oe)||O.length>0,Fe=O.length>0?Z>=0?`address-disambig-option-${Z}`:void 0:W>=0?`address-option-${W}`:void 0;return u.jsxs("div",{className:"relative",children:[u.jsx(qe,{ref:ce,type:"text",value:t,onChange:e=>Te(e.target.value),onKeyDown:Le,onPaste:_e,onFocus:Pe,placeholder:i,className:h,style:b,"data-testid":K,"aria-label":me,autoComplete:"off",disabled:p,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-expanded":Oe,"aria-controls":"address-suggestion-listbox","aria-activedescendant":Fe}),N&&u.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2","aria-label":_?"Looking up addressâ¦":void 0,role:_?"status":void 0,"aria-live":_?"polite":void 0,children:u.jsx(We,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),De&&u.jsx("p",{className:"mt-1 text-xs text-amber-600","data-testid":"enrichment-timeout-hint",role:"status",children:"Address details unavailable â basic location data was used."}),we&&u.jsx("p",{className:"mt-1 text-xs text-red-600","data-testid":"manual-entry-error",role:"alert","aria-live":"assertive",children:we}),k&&A.length>0&&u.jsxs("div",{ref:ee,id:"address-suggestion-listbox",role:"listbox",className:"absolute left-0 right-0 top-full mt-1 bg-white border border-slate-200 rounded-lg shadow-xl overflow-hidden",style:{zIndex:9999},"data-testid":"address-suggestions",children:[A.every(e=>e.source==="recent")&&u.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-slate-400 border-b border-slate-100 select-none",children:"Recent"}),A.map((e,a)=>u.jsxs("button",{id:`address-option-${a}`,type:"button",role:"option","aria-selected":W===a,className:ke("w-full text-left px-3 py-2.5 flex items-start gap-2.5 transition-colors text-sm",N&&"opacity-50",W
1===a?"bg-slate-100 text-slate-900 font-medium":"hover:bg-slate-50 text-slate-800"),onMouseEnter:()=>H(a),onPointerDown:o=>{o.preventDefault(),M.current=!0,se(e)},onClick:o=>{if(M.current){M.current=!1,o.preventDefault();return}se(e)},"data-testid":`address-suggestion-${a}`,children:[e.source==="recent"?u.jsx(He,{className:"w-4 h-4 mt-0.5 shrink-0 text-slate-400"}):u.jsx(ve,{className:"w-4 h-4 mt-0.5 shrink-0 text-slate-400"}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"font-semibold text-slate-900 truncate",children:e.streetAddress}),u.jsxs("div",{className:"text-xs text-slate-500 truncate",children:[e.city,e.state?`, ${e.state}`:""," ",e.zipCode]})]})]},a))]}),O.length>0&&u.jsxs("div",{ref:ee,role:"listbox","aria-label":"Choose the correct address",className:"absolute left-0 right-0 top-full mt-1 bg-white border border-slate-200 rounded-lg shadow-xl overflow-hidden",style:{zIndex:9999},"data-testid":"address-disambig-card",children:[u.jsx("div",{className:"px-3 py-2 text-xs font-medium text-slate-500 border-b border-slate-100",children:"Which location did you mean?"}),O.map((e,a)=>u.jsxs("button",{id:`address-disambig-option-${a}`,type:"button",role:"option","aria-selected":Z===a,className:ke("w-full text-left px-3 py-2.5 flex items-start gap-2.5 transition-colors text-sm",Z===a?"bg-slate-100 text-slate-900 font-medium":"hover:bg-slate-50 text-slate-800"),onMouseEnter:()=>q(a),onPointerDown:o=>{o.preventDefault(),M.current=!0,de(e)},onClick:o=>{if(M.current){M.current=!1,o.preventDefault();return}de(e)},"data-testid":`address-disambig-option-${a}`,children:[u.jsx(ve,{className:"w-4 h-4 mt-0.5 shrink-0 text-slate-400"}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"font-semibold text-slate-900 truncate",children:e.streetAddress}),u.jsxs("div",{className:"text-xs text-slate-500 truncate",children:[e.city,e.state?`, ${e.state}`:""," ",e.zipCode]})]})]},a))]}),k&&oe&&A.length===0&&t.length>=5&&u.jsxs("div",{ref:ee,className:"absolute left-0 right-0 top-full mt-1 bg-white border border-slate-200 rounded-lg shadow-xl overflow-hidden",style:{zIndex:9999},"data-testid":"address-no-results",children:[u.jsx("div",{className:"px-3 py-2 text-xs text-slate-500 border-b border-slate-100",children:"No matching addresses found"}),G(t)&&u.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2.5 flex items-start gap-2.5 transition-colors text-sm hover:bg-amber-50 text-slate-800",onPointerDown:e=>{e.preventDefault(),M.current=!0,Y()},onClick:e=>{if(M.current){M.current=!1,e.preventDefault();return}Y()},"data-testid":"button-use-address-manually",children:[u.jsx(Ze,{className:"w-4 h-4 mt-0.5 shrink-0 text-amber-500"}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"font-semibold text-slate-900 truncate",children:"Use this address anyway"}),u.jsx("div",{className:"text-xs text-slate-500 truncate",children:(()=>{const e=G(t);return e?`${e.streetAddress}${e.city?`, ${e.city}`:""}${e.state?`, ${e.state}`:""} ${e.zipCode}`.trim():t})()})]})]})]})]})}export{mt as A,Re as U,ft as b,ye as e,ze as g,pt as i,ut as m,Ee as n,et as p,pe as r,Ye as s};
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.