1import{u as S,a as M,d as _,b as P,R as o,j as s,z,S as I,X as U,w as j,Q as B,L as C}from"./index-DQJD9Ygs.js";function Q(){const{language:a,t:h}=S(),[,k]=M();_({title:"Browse Categories AâZ â Miami-Dade Assistance Programs",description:"Browse Miami-Dade assistance categories from A to Z â food, housing, health, jobs, utilities, and more. Pick a category to see every verified program and how to apply.",canonicalPath:"/az"});const{data:l=[],isLoading:g,isError:w,refetch:E,isFetching:L}=P(),[n,f]=o.useState(""),[u,d]=o.useState(-1),[b,i]=o.useState(!1),N=o.useRef(null),R=o.useRef(null),r=e=>(a==="es"&&e.name_es||e.name_en)??e.name_en,c=o.useMemo(()=>{const e=n.trim().toLowerCase();return e?l.filter(t=>r(t).toLowerCase().includes(e)).slice(0,8):[]},[n,l,a]),x=o.useMemo(()=>{const e=n.trim().toLowerCase();return e?l.filter(t=>r(t).toLowerCase().includes(e)):null},[n,l,a]),y=o.useMemo(()=>{const e=[...l].sort((p,m)=>r(p).toLowerCase().localeCompare(r(m).toLowerCase())),t={};return e.forEach(p=>{const m=(r(p)[0]??"?").toUpperCase();t[m]||(t[m]=[]),t[m].push(p)}),t},[l,a]),v=Object.keys(y).sort(),D=e=>{if(!(!b||c.length===0))if(e.key==="ArrowDown")e.preventDefault(),d(t=>Math.min(t+1,c.length-1));else if(e.key==="ArrowUp")e.preventDefault(),d(t=>Math.max(t-1,0));else if(e.key==="Enter"&&u>=0){e.preventDefault();const t=c[u];t&&A(t)}else e.key==="Escape"&&(i(!1),d(-1))},A=e=>{i(!1),f(""),k(`/search?category=${encodeURIComponent(e.slug)}`)},$=()=>{f(""),d(-1),i(!1),N.current?.focus()};return s.jsxs("div",{className:"bg-slate-50 min-h-screen pb-20",children:[s.jsx("div",{className:"bg-[#0A2540] text-white py-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl text-center",children:[s.jsx("div",{className:"w-14 h-14 bg-[#0E9AA7]/20 text-[#0E9AA7] rounded-2xl flex items-center justify-center mx-auto mb-5",children:s.jsx(z,{className:"w-7 h-7"})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-extrabold mb-3 text-white",children:h("directoryTitle")}),s.jsx("p",{className:"text-lg text-slate-300 max-w-xl mx-auto mb-8",children:h("directorySubtitle")}),s.jsxs("div",{className:"relative max-w-lg mx-auto",role:"search",children:[s.jsx(I,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-slate-400 pointer-events-none"}),s.jsx("input",{ref:N,type:"search",value:n,onChange:e=>{f(e.target.value),d(-1),i(!0)},onFocus:()=>i(!0),onBlur:()=>setTimeout(()=>i(!1),150),onKeyDown:D,placeholder:h("directorySearchPlaceholder"),"aria-label":h("directorySearchPlaceholder"),"aria-autocomplete":"list","aria-expanded":b&&c.length>0,className:"w-full pl-12 pr-10 py-3.5 rounded-2xl text-slate-800 text-base bg-white border-2 border-transparent focus:border-[#0E9AA7] focus:outline-none shadow-md placeholder:text-slate-400"}),n&&s.jsx("button",{onClick:$,className:"absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600","aria-label":"Clear search",children:s.jsx(U,{className:"w-4 h-4"})}),b&&c.length>0&&s.jsx("ul",{ref:R,role:"listbox",className:"absolute top-full mt-2 left-0 right-0 bg-white rounded-xl shadow-xl border border-slate-100 z-50 overflow-hidden",children:c.map((e,t)=>s.jsx("li",{role:"option","aria-selected":t===u,children:s.jsxs("button",{className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-slate-50 transition-colors ${t===u?"bg-[#0E9AA7]/10 text-[#0E9AA7]":"text-slate-800"}`,onMouseDown:()=>A(e),children:[s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center shrink-0 text-xs font-bold",style:{backgroundColor:`${e.color}20`,color:e.color},children:r(e)[0]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-semibold text-sm truncate",children:r(e)}),s.jsxs("p",{className:"text-xs text-slate-400",children:[e.program_count," programs"]})]}),s.jsx(j,{className:"w-3.5 h-3.5 text-slate-300 shrink-0"})]})},e.id))})]})]})}),!n&&s.jsx("div",{className:"bg-white border-b sticky top-16 z-30 shadow-sm",children:s.jsx("div",{className:"container mx-auto px-4 max-w-4xl py-3 flex flex-wrap gap-2",children:v.map(e=>s.jsx("a",{href:`#letter-${e}`,className:"w-9 h-9 flex items-center justify-center rounded-lg text-sm font-bold bg-slate-100 text-[#0A2540] hover:bg-[#0E9AA7] hover:text-white transition-colors",children:e},e))})}),s.jsxs("div",{className:"container mx-auto px-4 max-w-4xl mt-10 space-y-10",children:[!g&&w&&s.jsx(B,{onRetry:()=>E(),isRetrying:L}),g&&s.jsx("div",{className:"space-y-6",children:[1,2,3].map(e=>s.jsx("div",{className:"h-24 bg-white rounded-xl animate-pulse border"},e))}),x!==null&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-slate-500 mb-4",children:x.length===0?a==="es"?"No se encontraron categorÃas.":"No categories found.":`${x.length} ${a==="es"?"categorÃas encontradas":"categories found"}`}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:x.map(e=>s.jsxs(C,{href:`/search?category=${encodeURIComponent(e.slug)}`,className:"flex items-center justify-between bg-white border border-slate-200 hover:border-[#0E9AA7] hover:shadow-sm rounded-xl px-5 py-4 transition-all group",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0 text-sm font-bold",style:{backgroundColor:`${e.color}20`,color:e.color},children:r(e)[0]}),s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-[#0A2540] group-hover:text-[#0E9AA7] transition-colors",children:r(e)}),s.jsxs("p",{className:"text-xs text-slate-500",children:[e.program_count," programs"]})]})]}),s.jsx(j,{className:"w-4 h-4 text-slate-300 group-hover:text-[#0E9AA7] transition-colors shrink-0"})]},e.id))})]}),x===null&&v.map(e=>s.jsxs("section",{id:`letter-${e}`,className:"scroll-mt-32",children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[s.jsx("span",{className:"w-10 h-10 rounded-full bg-[#0A2540] text-white flex items-center justify-center font-extrabold text-lg",children:e}),s.jsx("div",{className:"h-px flex-1 bg-slate-200"})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:y[e].map(t=>s.jsxs(C,{href:`/search?category=${encodeURIComponent(t.slug)}`,className:"flex items-center justify-between bg-white border border-slate-200 hover:border-[#0E9AA7] hover:shadow-sm rounded-xl px-5 py-4 transition-all group",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0 text-sm font-bold",style:{backgroundColor:`${t.color}20`,color:t.color},children:r(t)[0]}),s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-[#0A2540] group-hover:text-[#0E9AA7] transition-colors",children:r(t)}),s.jsxs("p",{className:"text-xs text-slate-500",children:[t.program_count," programs"]})]})]}),s.jsx(j,{className:"w-4 h-4 text-slate-300 group-hover:text-[#0E9AA7] transition-colors shrink-0"})]},t.id))})]},e)),!g&&!w&&l.length===0&&s.jsx("div",{className:"text-center text-slate-500 py-20",children:a==="es"?"No hay categorÃas disponibles.":"No categories available."})]})]})}export{Q 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.