PageSourceSearch

https://webhunt.ai/assets/search-wsF5YieZ.js

js webhunt.ai collected 2026-10-05 13:57:42 UTC 25,963 bytes, 1 lines download raw bytes

1import{f as Rt,a,u as Tt,i as us,d as t}from"./vendor-query-BTjX_wdR.js";import{c as ds,b7 as ms,b8 as fs,t as hs,ab as ps,b9 as gs,ba as ys,aa as vs,bb as xs,a6 as Ss,bc as bs,bd as Cs,be as ws,bf as Ns,b0 as js,B as T,j as ks,y as re,a3 as Is,l as St,b1 as ye,T as Rs,b2 as Ts,bg as bt,bh as Je,bi as Ps,bj as $s,bk as Os,bl as Ls}from"./index-CkckB97G.js";import{C as Ds}from"./CoachCard-DSIWxS56.js";import{C as Ct,c as wt}from"./card-Bl0YKt70.js";import{B as Es}from"./badge-B76XdfOe.js";import"./switch-B03wjy62.js";import"./select-DJEyjzys.js";import{C as Ms}from"./checkbox-Cr-fEanu.js";import"./slider-B6vFR4Jf.js";import"./label-BC5Vf0jp.js";import{O as Fs,S as Ge}from"./api.schemas-QACckV35.js";import{p as As,S as Nt,a as jt,g as _s}from"./signalFilters-BtBSgOtc.js";import{a as Us}from"./opportunity-B-v7xPAK.js";import{S as Ks,R as qs}from"./ScoreBreakdownPopup-QBgh4whv.js";import{L as Bs}from"./LeadResultCard-D9XQnFTa.js";import{B as Js}from"./BulkUnlockDialog-CQQrPOOB.js";import{L as Gs,I as Qs,a as zs,b as Hs}from"./LeadFilterBar-Dawk4tqj.js";import{c as kt,U as Vs}from"./SignalChipToggle-BXN16k3K.js";import{S as Ws}from"./sliders-horizontal-LCqJYiC3.js";import{U as Ys}from"./upload-DLuLx1EA.js";import"./vendor-clerk-MFyiThSW.js";import"./index-CQ6Yl3Cl.js";import"./index-BdQq_4o_.js";import"./index-CumU6ttZ.js";import"./chevron-down-q2Fwhyaa.js";import"./chevron-up-CUlamNlz.js";import"./triangle-alert-CFNpJoZd.js";import"./megaphone-CVblA2A2.js";import"./cpu-WCAkPrEJ.js";import"./wrench-DsqT0COI.js";import"./mouse-pointer-click-CQmTGbPx.js";import"./paintbrush-MMOT2sU5.js";import"./scroll-area-CvwiT0IH.js";import"./plus-BIIk7D_b.js";import"./score-tiers-BJ6-0B-q.js";import"./BuildWebsiteButton-Fobmy8jO.js";import"./external-link-BdCTuTup.js";import"./arrow-left-d9-jqTCw.js";import"./copy-CBm2EBEc.js";import"./map-pin-CKiCUyxF.js";import"./tag-CMC_Lx4x.js";import"./phone-off-DVME6vxM.js";import"./video-0FEZOHAy.js";import"./building-2-3v8o5r_8.js";import"./file-spreadsheet-DDfkNOuC.js";import"./collapsible-BIO5f4_6.js";import"./index-B26zjrC-.js";import"./info-CSMruxdY.js";import"./funnel-CXTNz3Lj.js";import"./chevrons-up-down-C4N6RP2p.js";const Xs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Zs=ds("circle-plus",Xs);function ea(m){return`${m.city}|${m.state}`}const It=3;function ta({cities:m,categories:j,active:k,onComplete:ne}){const K=Rt(),G=a.useRef(ne);G.current=ne;const q=a.useRef(null),M=a.useRef(0),Q=a.useRef(!1),P=a.useRef(0),z=m.map(ea),H={...z.length>0?{cities:z}:{},...j.length>0?{categories:j}:{}},{data:p}=Tt({queryKey:[...fs(H),"poll"],queryFn:({signal:l})=>ms(H,{signal:l}),enabled:k,refetchInterval:l=>{if(!k)return!1;const oe=l.state.data;return!oe||oe.inProgress||oe.totalJobs===0&&M.current<It?3e3:!1},staleTime:0});return a.useEffect(()=>{if(!k){q.current=null,M.current=0,Q.current=!1,P.current=0;return}if(!(!p||Q.current)){if(p.inProgress){q.current=!0,M.current=0,p.leadsFound>P.current&&(P.current=p.leadsFound,K.invalidateQueries({queryKey:["/api/leads"]}));return}p.totalJobs===0&&q.current===null&&(M.current+=1,M.current<It)||(Q.current=!0,q.current=!1,K.invalidateQueries({queryKey:["/api/leads"]}),K.invalidateQueries({queryKey:["/api/filters"]}),G.current(p.leadsFound))}},[k,p,K]),{inProgress:p?.inProgress??!1,totalJobs:p?.totalJobs??0,completedJobs:p?.completedJobs??0,failedJobs:p?.failedJobs??0,leadsFound:p?.leadsFound??0}}const Qe="search_filter_snapshot",Pt=3;function sa(){try{const m=sessionStorage.getItem(Qe);if(m){const j=JSON.parse(m);if(j.version===Pt)return j}}catch{}return null}function tr(){const{toast:m}=hs(),j=Rt(),{data:k}=ps(),{openUpgrade:ne}=gs(),K=!!k?.active&&(k.plan==="professional"||k.plan==="agency"),{data:G}=Tt({queryKey:["/api/saved-leads/summary"],queryFn:()=>Os("/api/saved-leads/summary")}),q=a.useMemo(()=>new Set((G??[]).map(e=>e.leadId)),[G]),M=ys(),[,Q]=vs(),P=new URLSearchParams(M),z=P.get("hasWebsite"),H=P.get("minScore"),p=P.get("signals"),l=sa(),$t=z!==null?z==="false"?[Fs.no_website]:[]:l?.selectedTiers??[],ze=H?parseInt(H,10):NaN,He=!isNaN(ze)?Math.max(0,Math.min(100,ze)):l?.minScore?.[0]??0,Ve=P.has("signals")?As((p??"").split(",").map(e=>
1e.trim()).filter(Boolean)):l?.selectedSignals??[],[o,ve]=a.useState(l?.selectedCities??[]),[h,xe]=a.useState(l?.selectedStates??[]),[c,ie]=a.useState(l?.selectedCategories??[]),[C,Se]=a.useState($t),[f,be]=a.useState(Ve),[Ot,We]=a.useState(()=>{const e={};for(const s of Nt){const r=jt.filter(n=>n.group===s.group);e[s.group]=r.some(n=>Ve.includes(n.key))}return e});a.useEffect(()=>{We(e=>{const s={...e};for(const r of Nt)jt.filter(i=>i.group===r.group).some(i=>f.includes(i.key))&&(s[r.group]=!0);return s})},[f]);const[$,Ce]=a.useState(l?.verifiedOnly??!1),[O,we]=a.useState(l?.showsReviews??!1),[L,Ne]=a.useState(l?.hideDormant??!1),[D,je]=a.useState(l?.hasPhone??!1),[E,ke]=a.useState(l?.aiCallSafe??!1),[F,Ie]=a.useState(l?.unlockedOnly??!1),[V,Re]=a.useState(l?.search??""),[I,Te]=a.useState([He]),[Lt,Pe]=a.useState([He]),[W,Ye]=a.useState(l?.sort??Ge.score),[A,$e]=a.useState(l?.search??""),[R,Xe]=a.useState(null),Oe="search_selected_ids",[x,B]=a.useState(()=>{try{const e=sessionStorage.getItem(Oe);if(e)return new Set(JSON.parse(e))}catch{}return new Set}),[Ze,et]=a.useState(!1),[Dt,tt]=a.useState(!1),[Et,st]=a.useState(!1),[Mt,at]=a.useState(!1),[Ft,rt]=a.useState(!1),[At,nt]=a.useState(!1),[Y,ot]=a.useState(()=>typeof window>"u"?!0:localStorage.getItem("search_filters_open")!=="false");a.useEffect(()=>{localStorage.setItem("search_filters_open",String(Y))},[Y]),a.useEffect(()=>{const e=new URLSearchParams(window.location.search);f.length>0?e.set("signals",f.join(",")):e.delete("signals");const s=e.toString(),r=`${window.location.pathname}${s?`?${s}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",r)},[f]);const it=o.map(kt),_t={...o.length>0?{cities:it}:{},...h.length>0?{states:h}:{},...c.length>0?{categories:c}:{},...C.length>0?{opportunityTiers:C}:{},...f.length>0?{signals:f}:{},...A?{search:A}:{},minScore:I[0],...$?{verifiedContact:!0}:{},...O?{hasReviews:!0}:{},...L?{hideDormant:!0}:{},...D?{hasPhone:!0}:{},...E?{aiCallSafe:!0}:{},...F?{unlockedOnly:!0}:{}},{data:b}=xs(_t),{data:lt}=Ss(),Ut=bs(),ct=Cs(),{data:ut}=ws({query:{queryKey:Je(),refetchInterval:e=>(e.state.data?.trades??[]).some(s=>s.status==="pending")?1e4:!1}}),Kt=a.useMemo(()=>{const e={};for(const s of ut?.trades??[])e[s.keyword]=s.status;return e},[ut]),{data:qt}=Ns(),Bt=e=>{ct.mutate({data:{keyword:e,cities:o.length>0?o.map(s=>({city:s.city,state:s.state})):null}},{onSuccess:s=>{if(s.matched&&s.category){if(ie(r=>r.includes(s.category)?r:[...r,s.category]),s.pendingCities&&s.pendingCities.length>0){const r=s.pendingCities,n=o.filter(v=>r.some(ge=>ge.city===v.city&&ge.state===v.state));Ee(n.length>0?n:o),Me([s.category]),ee(!0),j.invalidateQueries({queryKey:Je()});const i=n.length===1?`${n[0]?.city}, ${n[0]?.state}`:`${n.length} cities`;m({title:`Discovering "${s.category}"`,description:`Scanning ${i} for results — they'll appear shortly.`})}else m({title:`"${e}" matches ${s.category}`,description:"Added that category to your filters."});return}j.invalidateQueries({queryKey:Ps()}),j.invalidateQueries({queryKey:Je()}),m({title:`Discovering "${e}"`,description:"We're scanning your area for this trade. Results appear under Custom Searches shortly."})},onError:s=>{const r=s?.message??"Discovery failed. Please try again.";m({variant:"destructive",title:"Couldn't discover that trade",description:r})}})},Jt=a.useMemo(()=>{const e=[],s=new Map;for(const r of lt?.categories??[]){const n=r.group||"Other";s.has(n)||(s.set(n,[]),e.push(n)),s.get(n).push(r.label)}return e.map(r=>({group:r,labels:s.get(r)}))},[lt]),Gt=a.useMemo(()=>{const e={};for(const s of b?.categories??[])e[s.name]=s.count;return e},[b]),Qt=a.useMemo(()=>{const e={};for(const s of b?.opportunityTiers??[])e[s.tier]=s.count;return e},[b]),zt=a.useMemo(()=>{const e={};for(const s of b?.signals??[])e[s.key]=s.count;return e},[b]),[Le,dt]=a.useState([]),[X,mt]=a.useState(!1),[Z,ft]=a.useState(null),[De,ee]=a.useState(!1),[_,le]=a.useState(!1),[Ht,Ee]=a.useState([]),[Vt,Me]=a.useState([]),[Fe,ce]=a.useState(!1),g=a.useRef(null),w=a.useRef(null),u=a.useRef(null),y=a.useRef(null),te=a.useRef(!1),Ae=a.useRef(0),ue=a.useRef(0),_e=a.useRef(0),Wt
1=50,de={cities:o.length>0?it:void 0,states:h.length>0?h:void 0,categories:c.length>0?c:void 0,opportunityTiers:C.length>0?C:void 0,signals:f.length>0?f:void 0,search:A||void 0,minScore:I[0],sort:W,verifiedContact:$||void 0,hasReviews:O||void 0,hideDormant:L||void 0,hasPhone:D||void 0,aiCallSafe:E||void 0,unlockedOnly:F||void 0},Yt=()=>{const e={};c.length&&(e.categories=c),o.length&&(e.cities=o.map(i=>({city:i.city,state:i.state}))),h.length&&(e.states=h),C.length&&(e.opportunityTiers=C),f.length&&(e.signals=f),I[0]>0&&(e.minScore=I[0]),$&&(e.verifiedContact=!0),O&&(e.hasReviews=!0),L&&(e.hideDormant=!0),D&&(e.hasPhone=!0),E&&(e.aiCallSafe=!0),A&&(e.search=A);const s=o.length===1?`${o[0].city}, ${o[0].state}`:h.length===1?h[0]:o.length||h.length?"multiple areas":"",n=[c.length===1?c[0]:c.length?`${c.length} categories`:"Businesses",s?`in ${s}`:""].filter(Boolean).join(" ").slice(0,80);try{sessionStorage.setItem("aiCampaignPrefill",JSON.stringify({name:n,criteria:e}))}catch{}Q("/ai-search?new=1")},{data:ht,isLoading:Ue,fetchNextPage:Xt,hasNextPage:Zt,isFetchingNextPage:pt,refetch:me}=us({queryKey:[...bt(de),"infinite"],queryFn:({pageParam:e,signal:s})=>Ls({...de,offset:e,limit:Wt},{signal:s}),initialPageParam:0,getNextPageParam:(e,s)=>{const r=s.reduce((i,v)=>i+v.leads.length,0),n=s[0]?.total??0;return r<n?r:void 0}}),S=(()=>{const e=ht?.pages.flatMap(r=>r.leads)??[],s=new Map(e.map(r=>[r.id,r]));return Array.from(s.values())})(),N=ht?.pages[0]?.total??0;a.useEffect(()=>{_e.current=N},[N]);const U=ta({cities:Ht,categories:Vt,active:De,onComplete:e=>{ee(!1),le(!0),setTimeout(()=>le(!1),600),m({title:"Scan finished — gathering results…"}),te.current=!1,ue.current=0,Ae.current=e;const s=r=>{te.current||(te.current=!0,m({title:r>0?`${r} ${r===1?"lead":"leads"} found`:"No leads found in this area yet"}))};me(),u.current&&clearInterval(u.current),y.current&&clearTimeout(y.current),u.current=setInterval(()=>{me().then(r=>{const n=r.data?.pages[0]?.total??_e.current;n===Ae.current?(ue.current+=1,ue.current>=2&&(u.current&&clearInterval(u.current),u.current=null,y.current&&clearTimeout(y.current),y.current=null,s(n))):(ue.current=0,Ae.current=n)})},5e3),y.current=setTimeout(()=>{u.current&&(clearInterval(u.current),u.current=null),s(_e.current)},6e4)}});a.useEffect(()=>{S.length>0&&Fe&&(g.current&&(clearInterval(g.current),g.current=null),w.current&&(clearTimeout(w.current),w.current=null),ce(!1))},[S.length,Fe]),a.useEffect(()=>()=>{g.current&&clearInterval(g.current),w.current&&clearTimeout(w.current),u.current&&clearInterval(u.current),y.current&&clearTimeout(y.current)},[]),a.useEffect(()=>{try{x.size===0?sessionStorage.removeItem(Oe):sessionStorage.setItem(Oe,JSON.stringify([...x]))}catch{}},[x]),a.useEffect(()=>{try{const e={version:Pt,selectedCities:o,selectedStates:h,selectedCategories:c,selectedTiers:C,selectedSignals:f,verifiedOnly:$,showsReviews:O,hideDormant:L,hasPhone:D,aiCallSafe:E,unlockedOnly:F,search:V,minScore:I,sort:W};sessionStorage.setItem(Qe,JSON.stringify(e))}catch{}},[o,h,c,C,f,$,O,L,D,E,F,V,I,W]);const fe=JSON.stringify(de),gt=a.useRef(fe);a.useEffect(()=>{gt.current!==fe&&(gt.current=fe,B(new Set))},[fe]);const he=a.useMemo(()=>new Map(S.map(e=>[e.id,e])),[S]),pe=a.useMemo(()=>[...x].filter(e=>{const s=he.get(e);return s===void 0||!s.unlocked}),[x,he]),yt=a.useMemo(()=>[...x].filter(e=>{const s=he.get(e);return s!==void 0&&s.unlocked}).length,[x,he]),es=(e,s)=>{B(r=>{const n=new Set(r);return s?n.add(e):n.delete(e),n})},se=()=>B(new Set),Ke=a.useMemo(()=>S.map(e=>e.id),[S]),vt=Ke.length>0&&Ke.every(e=>x.has(e)),ae=x.size>0,xt=()=>{B(new Set(Ke))},ts=async()=>{et(!0);try{const e=await $s(de);B(new Set(e.ids))}catch{m({title:"Couldn't select all results",description:"Please try again.",variant:"destructive"})}finally{et(!1)}},ss=async e=>{if(e.preventDefault(),$e(V),o.length===0)return;ee(!1),le(!1),u.current&&(clearInterval(u.current),u.current=null),y.current&&(clearTimeout(y.current),y.current=null),te.current=!0,mt(!0);const s=[];let r=!1;try{for(let n=0;n<o.length;n++){const i=o[n];ft({current:n+1,total:o.length,city:`${i.city}, ${i.state}`});try{const v=await Ut.mutateAsync({data:{city:i.city,state:i.state,categories:c.length>0?c:void 0}});s.push({city:i.city,state:i.state,leadCount:v.leadCount,timedOut:v.timedOut}),v.timedOut&&(r=!0)}catch{m({title:"Live search failed",description:`Couldn't build ${i.city}, ${i.state}. Continuing with the other cities.`,variant:"destructive"})}}dt(s),r?(Ee([...o]),Me([...c]),ee(!0)):((await me()).data?.pages.flatMap(v=>v.leads)??[]).length===0&&s.every(v=>!v.timedOut)&&(g.current&&clearInterval(g.current),w.current&&clearTimeout(w.current),ce(!0),g.current=setInterval(()=>{me()},5e3),w.current=setTimeout(()=>{g.current&&(clearInterval(g.current),g.current=null),ce(!1)},6e4))}finally{ft(null),mt(!1)}},as=b?.verifiedCount??0,rs=b?.phoneCount??0,ns=b?.totalCount??0,os=b?.unlockedCount??0,is=b?.reviewsCount??0,ls=b?.aiCallSafeCount??0,J=o.map(e=>`${e.city}, ${e.state}`),qe=J.length===0?"":J.length===1?J[0]:J.length===2?J.join(" and "):`${J.length} cities`,Be=()=>{sessionStorage.removeItem(Qe),ve([]),xe([]),ie([]),Se([]),be([]),Re(""),$e(""),Ce(!1),we(!1),Ne(!1),je(!1),ke(!1),Ie(!1),Te([0]),Pe([0]),Ye(Ge.score),dt([]),ee(!1),le(!1),Ee([]),Me([]),g.current&&(clearInterval(g.current),g.current=null),w.current&&(clearTimeout(w.current),w.current=null),ce(!1),u.current&&(clearInterval(u.current),u.current=null),y.current&&(clearTimeout(y.current),y.current=null),te.current=!0,B(new Set)},cs=o.length>0||h.length>0||c.length>0||C.length>0||f.length>0||V!==""||$||O||L||D||E||F||I[0]!==0||W!==Ge.score||Le.length>0,d=[];for(const e of o)d.push({key:`city:${kt(e)}`,label:`${e.city}, ${e.state}`,onRemove:()=>ve(s=>s.filter(r=>!(r.city===e.city&&r.state===e.state)))});for(const e of h)d.push({key:`state:${e}`,label:Vs[e]??e,onRemove:()=>xe(s=>s.filter(r=>r!==e))});for(const e of c)d.push({key:`cat:${e}`,label:e,onRemove:()=>ie(s=>s.filter(r=>r!==e))});for(const e of C)d.push({key:`tier:${e}`,label:Us[e].label,onRemove:()=>Se(s=>s.filter(r=>r!==e))});for(const e of f){const s=_s(e);d.push({key:`signal:${e}`,label:s?.label??e,onRemove:()=>be(r=>r.filter(n=>n!==e))})}return A&&d.push({key:"keyword",label:`“${A}”`,onRemove:()=>{Re(""),$e("")}}),$&&d.push({key:"verified",label:"Verified contact",onRemove:()=>Ce(!1)}),O&&d.push({key:"reviews",label:"Shows reviews",onRemove:()=>we(!1)}),D&&d.push({key:"phone",label:"Phone available",onRemove:()=>je(!1)}),E&&d.push({key:"ai-call-safe",label:"AI call safe",onRemove:()=>ke(!1)}),L&&d.push({key:"dormant",label:"Hide dormant",onRemove:()=>Ne(!1)}),F&&d.push({key:"unlocked",label:"My unlocked",onRemove:()=>Ie(!1)}),I[0]!==0&&d.push({key:"minscore",label:`Min score ${I[0]}`,onRemove:()=>{Te([0]),Pe([0])}}),t.jsxs(js,{children:[t.jsx(Ds,{slug:"search",headline:"Find your next clients",body:"Enter cities and trades, then filter by website strength and Growth Score. Click any card to open a lead's full profile, or select multiple cards to Unlock or Enrich in bulk."}),t.jsxs("div",{className:"p-4 md:p-8 max-w-7xl mx-auto flex flex-col md:flex-row gap-6 animate-in fade-in duration-500",children:[Y&&t.jsx(Gs,{selectedCities:o,setSelectedCities:ve,selectedStates:h,setSelectedStates:xe,selectedCategories:c,setSelectedCategories:ie,selectedTiers:C,setSelectedTiers:Se,selectedSignals:f,setSelectedSignals:be,openGroups:Ot,setOpenGroups:We,verifiedOnly:$,setVerifiedOnly:Ce,showsReviews:O,setShowsReviews:we,hideDormant:L,setHideDormant:Ne,hasPhone:D,setHasPhone:je,aiCallSafe:E,setAiCallSafe:ke,unlockedOnly:F,setUnlockedOnly:Ie,search:V,setSearch:Re,sliderScore:Lt,setSliderScore:Pe,setMinScore:Te,sort:W,setSort:Ye,categoryGroups:Jt,categoryCounts:Gt,tierCounts:Qt,signalCounts:zt,customStatus:Kt,totalCount:ns,verifiedCount:as,reviewsCount:is,phoneCount:rs,aiCallSafeCount:ls,unlockedCount:os,filtersActive:cs,onClearAll:Be,onCollapse:()=>ot(!1),onSubmit:ss,isBuilding:X,onDiscover:Bt,isDiscovering:ct.isPending,canDiscover:qt?.coreClawConfigured??!1,callOutcomeFilter:k?.callOutcomeFilter??!1}),!1,t.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 mb-2","data-tour":"search-bulk",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[!Y&&t.jsxs(T,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ot(!0),children:[t.jsx(Ws,{className:"mr-2 h-4 w-4"})," Filters",d.length>0&&t.jsx("span",{className:"ml-1.5 rounded-full bg-primary/15 px-1.5 text-xs font-semibold text-primary tabular-nums",children:d.length})]}),t.jsx("h1",{className:"text-2xl font-bold tracking-tight truncate",children:"Prospects"})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[t.jsxs(T,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:()=>rt(!0),children:[t.jsx(Ys,{className:"mr-2 h-4 w-4"})," Import Leads"]}),t.jsx("span",{className:"text-sm text-muted-foreground font-medium",children:Ue||X?"Loading...":`${N} found`}),S.length>0&&!Ue&&!X&&t.jsxs("div",{className:"flex items-center gap-1.5 border-l border-border pl-2",children:[t.jsx(Ms,{checked:vt?!0:ae?"indeterminate":!1,onCheckedChange:()=>{ae?se():xt()},"aria-label":ae?"Deselect all":`Select all ${S.length} loaded results`}),t.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground whitespace-nowrap",onClick:()=>{ae?se():xt()},children:ae?"Deselect all":"Select all"})]})]})]}),vt&&S.length<N&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-xs text-muted-foreground",children:[t.jsx(ks,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),t.jsxs("span",{children:[t.jsxs("span",{className:"font-medium text-foreground",children:[S.length," of ",N," shown"]})," ","are selected."]}),t.jsx("button",{type:"button",className:"ml-1 inline-flex items-center gap-1 font-medium text-primary hover:underline disabled:opacity-60 disabled:cursor-not-allowed",onClick:ts,disabled:Ze,children:Ze?t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"h-3 w-3 animate-spin"}),"Selecting…"]}):N>5e3?"Select first 5,000 results":`Select all ${N} results`})]}),!Y&&d.length>0&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[d.map(e=>t.jsxs(Es,{variant:"secondary",className:"flex items-center gap-1 py-1 pl-2.5 pr-1 text-xs",children:[e.label,t.jsx("button",{type:"button",onClick:e.onRemove,className:"ml-0.5 rounded p-0.5 hover:bg-muted-foreground
1/20","aria-label":`Remove ${e.label}`,children:t.jsx(Is,{className:"h-3 w-3"})})]},e.key)),t.jsx(T,{type:"button",variant:"ghost",size:"sm",className:"h-auto px-2 py-1 text-xs text-muted-foreground hover:text-foreground",onClick:Be,children:"Clear all"})]}),X&&t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary/30 bg-primary/5 p-4 text-sm",children:[t.jsx(re,{className:"h-5 w-5 animate-spin text-primary"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium",children:Z?`Gathering businesses in ${Z.city}${Z.total>1?` (${Z.current} of ${Z.total})`:""}`:"Gathering businesses"}),t.jsx("p",{className:"text-muted-foreground",children:"This can take up to 30 seconds per new area."})]})]}),(De||_)&&t.jsx("div",{className:`rounded-lg border border-primary/30 bg-primary/5 p-5 text-sm transition-all duration-500${_?" animate-out fade-out zoom-out-95 duration-500":" animate-in fade-in zoom-in-95 duration-300"}`,children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(re,{className:`h-5 w-5 text-primary mt-0.5 shrink-0${_?"":" animate-spin"}`}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium",children:_?"Scan complete — loading results":`Scanning ${qe||"your area"} for businesses`}),t.jsx("p",{className:"text-muted-foreground mt-0.5",children:_?N>0?`${N} ${N===1?"lead":"leads"} found`:"Results loading…":U.leadsFound>0?`Found ${U.leadsFound} ${U.leadsFound===1?"lead":"leads"} — still scanning…`:"Scanning… leads will appear shortly"}),t.jsx("div",{className:"mt-3 h-1.5 w-full rounded-full bg-primary/20 overflow-hidden",children:_?t.jsx("div",{className:"h-full w-full rounded-full bg-primary transition-all duration-700"}):U.completedJobs>0&&U.totalJobs>0?t.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${Math.round(U.completedJobs/U.totalJobs*100)}%`}}):t.jsx("div",{className:"h-full rounded-full bg-primary animate-scan-indeterminate"})})]})]})}),t.jsx(Ct,{className:"mb-4 border-primary/30 bg-primary/5",children:t.jsxs(wt,{className:"flex flex-col items-start gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"rounded-full bg-primary/10 p-2",children:t.jsx(St,{className:"h-5 w-5 text-primary"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:"Let AI do this search for you"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Turn these filters into a campaign — we'll auto-find, rank, and queue the best leads for your approval."})]})]}),t.jsxs(T,{className:"shrink-0",onClick:Yt,children:[t.jsx(St,{className:"mr-1.5 h-4 w-4"})," Create AI campaign"]})]})}),Ue||X?t.jsx("div",{className:"space-y-4",children:[1,2,3,4].map(e=>t.jsx(Ct,{className:"bg-card",children:t.jsxs(wt,{className:"p-0 flex items-stretch",children:[t.jsx(ye,{className:"h-40 w-48 rounded-none"}),t.jsxs("div",{className:"space-y-3 flex-1 p-6",children:[t.jsx(ye,{className:"h-6 w-1/3"}),t.jsx(ye,{className:"h-4 w-1/4"}),t.jsx(ye,{className:"h-4 w-1/2"})]})]})},e))}):S?.length===0&&!De&&!_?(()=>{const e=Le.length>0,s=Le.reduce((v,ge)=>v+ge.leadCount,0),r=e&&s>0;let n="No leads found",i="Pick at least one city, then search to discover prospects (categories are optional).";return h.length>0&&o.length===0?i="No indexed leads match those states yet. Add a specific city above to scan that area live.":o.length>0&&(r?(n="Hidden by your filters",i=`${s} ${s===1?"opportunity":"opportunities"} exist across ${qe}, but none match your current filters. Try lowering Min Score, turning off Verified Email, or clearing keywords.`):e?(n="No strong opportunities yet",i=`We scanned ${qe} live but didn't surface strong opportunities in these categories. Try a different trade type — smaller operators (handyman, cleaning, lawn care, detailing) tend to have more room to grow online.`):i="No businesses matched here. Try other categories or adjust your filters, then search again."),t.jsxs("div",{className:"text-center py-20 border border-dashed border-border rounded-lg bg-card/50",children:[t.jsx(Rs,{className:"h-10 w-10 text-muted-foreground mx-auto mb-4 opacity-50"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:n}),t.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:i}),Fe&&t.jsxs("p",{className:"text-muted-foreground text-sm mt-3 flex items-center justify-center gap-1.5",children:[t.jsx(re,{className:"h-3.5 w-3.5 animate-spin"}),"Still checking for results…"]}),t.jsx(T,{variant:"outline",className:"mt-4",onClick:Be,children:"Clear all filters"})]})})():t.jsxs("div",{className:"space-y-4",children:[S?.map((e,s)=>t.jsx("div",{...s===0?{"data-tour":"search-lead-card","data-lead-id":String(e.id)}:{},children:t.jsx(Bs,{lead:e,isSaved:q.has(e.id),onOpenReviews:Xe,selectable:!0,selected:x.has(e.id),onToggleSelect:r=>es(e.id,r)})},e.id)),Zt&&t.jsx("div",{className:"flex justify-center pt-2",children:t.jsx(T,{variant:"outline",onClick:()=>Xt(),disabled:pt,children:pt?t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"mr-2 h-4 w-4 animate-spin"})," Loading more..."]}):`Load more (${S.length} of ${N})`})})]})]})]}),x.size>0&&t.jsx("div",{className:"fixed bottom-[calc(4.5rem+env(safe-area-inset-bottom))] left-1/2 z-30 -translate-x-1/2 md:bottom-6",children:t.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-border bg-card/95 px-4 py-2.5 shadow-lg backdrop-blur",children:[t.jsxs("span",{className:"text-sm font-medium",children:[x.size," selected",yt>0&&t.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",pe.length," locked"]})]}),t.jsxs(T,{size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90 font-semibold",disabled:pe.length===0,onClick:()=>tt(!0),title:pe.length===0?"All selected businesses are already unlocked":"Unlock the selected businesses",children:[t.jsx(Ts,{className:"mr-2 h-4 w-4"}),"Unlock"]}),t.jsxs(T,{size:"sm",variant:"outline",className:"font-semibold",onClick:()=>st(!0),title:"Save the selected businesses to a pipeline",children:[t.jsx(Zs,{className:"mr-2 h-4 w-4"}),"Save"]}),t.jsx(T,{size:"sm",variant:"ghost",className:"text-muted-foreground",onClick:se,children:"Clear"})]})}),t.jsx(Js,{open:Dt,onOpenChange:tt,lockedLeadIds:pe,alreadyUnlockedCount:yt,onConfirmed:se}),t.jsx(Ks,{open:Et,onOpenChange:st,leadIds:[...x],onSaved:se}),t.jsx(Qs,{open:Mt,onOpenChange:at}),t.jsx(zs,{open:Ft,onOpenChange:rt,onSelect:e=>{e==="listing"?at(!0):K?nt(!0):ne("leadImport")}}),t.jsx(Hs,{open:At,onOpenChange:nt,onImported:()=>{j.invalidateQueries({queryKey:bt({})})}}),t.jsx(qs,{leadId:R?.id??null,businessName:R?.name??void 0,locked:R?.locked??!1,rating:R?.rating,reviewCount:R?.reviewCount,ownerName:R?.ownerName,ownerConfidence:R?.ownerConfidence,ownerQuote:R?.ownerQuote,open:R!==null,onOpenChange:e=>!e&&Xe(null)})]})}export{tr 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.