1import{r as d,j as e}from"./index-CrSAl0O9.js";import{u as f}from"./useQuery-KJHLwHlV.js";import{T as b,M as g}from"./tool-shell-BffoZKEF.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"67c9996888e7828aad9494bd098f064211abc8d4"};var t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="484f7385-8253-4fe0-9f08-2fe241e207f9",r._sentryDebugIdIdentifier="sentry-dbid-484f7385-8253-4fe0-9f08-2fe241e207f9")}catch{}})();const u={},x=typeof import.meta<"u"&&u?.VITE_RESOURCES_API_BASE||typeof import.meta<"u"&&u?.VITE_CENSUS_API_BASE||"https://resources.bpmbrands.org";function y(r={}){const t=new URL("/api/public/tools/help-near-me",x);return r.zip&&t.searchParams.set("zip",r.zip),r.category&&t.searchParams.set("category",r.category),r.limit!=null&&t.searchParams.set("limit",String(r.limit)),t.toString()}async function _(r={}){try{const t=await fetch(y(r),{method:"GET",headers:{Accept:"application/json"},signal:r.signal}),s=t.headers.get("content-type")??"";return!t.ok||!s.includes("application/json")?{ok:!1,zip:r.zip??null,category:r.category??null,count:0,results:[],error:t.status===404||s.includes("text/html")?"Help Near Me API is not available â publish Resources, then retry.":`Resources API returned ${t.status}`}:await t.json()}catch(t){return{ok:!1,zip:r.zip??null,category:r.category??null,count:0,results:[],error:t instanceof Error?t.message:"Help Near Me request failed"}}}const N="Public help entry points from Resources â verify hours and eligibility on the official site. Not an eligibility determination.",j=[{value:"free_food",label:"Food"},{value:"housing_help",label:"Housing"},{value:"healthcare",label:"Healthcare"},{value:"mental_health",label:"Mental health"},{value:"childcare",label:"Childcare"},{value:"legal_help",label:"Legal"},{value:"emergency_cash_assistance",label:"Emergency cash"},{value:"utility_assistance",label:"Utilities"},{value:"elder_care",label:"Elder care"},{value:"domestic_violence",label:"Domestic violence"}];function v({embed:r=!1}){const[t,s]=d.useState("10001"),[n,m]=d.useState("free_food"),o=t.replace(/\D/g,"").slice(0,5),l=f({queryKey:["tools","help-near-me",o,n],queryFn:()=>_({zip:o.length===5?o:void 0,category:n,limit:3}),enabled:o.length===5||!!n,staleTime:6e4}),i=l.data?.results??[],c=l.data&&!l.data.ok?l.data.error:null,p=l.data?.hub_url??"https://resources.bpmbrands.org/resources";return e.jsxs(b,{title:"Help Near Me",subtitle:"Top local help locators by ZIP and need â from the Resources hub. Soft-fails when coverage is thin.",embed:r,children:[e.jsxs("div",{className:"flex flex-wrap gap-3 items-end mb-6",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-foreground/60 mb-1",children:"ZIP"}),e.jsx("input",{type:"text",inputMode:"numeric",value:t,onChange:a=>s(a.target.value),maxLength:10,className:"w-36 rounded-md border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-foreground/60 mb-1",children:"Need"}),e.jsx("select",{value:n,onChange:a=>m(a.target.value),className:"rounded-md border border-border bg-background px-3 py-2 text-sm",children:j.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))})]})]}),l.isLoading&&e.jsx("p",{className:"text-sm text-foreground/60",children:"Looking up helpâ¦"}),c&&e.jsx("p",{className:"text-sm text-foreground/60 border border-border/70 rounded-md p-3",children:c}),!l.isLoading&&!c&&i.length===0&&e.jsx("p",{className:"text-sm text-foreground/60",children:"No published help rows matched yet."}),i.length>0&&e.jsx("ol",{className:"space-y-4",children:i.map((a,h)=>e.jsxs("li",{className:"rounded-lg border border-border/70 p-4",children:[e.jsxs("p",{className:"text-xs text-foreground/55",children:["Option ",h+1]}),e.jsx("p",{className:"font-serif text-lg text-primary",children:a.title}),a.organization_name&&e.jsx("p",{className:"text-sm text-foreground/70",children:a.organization_name}),a.description&&e.jsx("p",{className:"mt-1 text-sm text-foreground
1/60 line-clamp-2",children:a.description}),a.url&&e.jsx("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-block text-sm text-primary underline-offset-2 hover:underline",children:"Official site â"})]},a.id))}),e.jsx("p",{className:"mt-4 text-sm",children:e.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline-offset-2 hover:underline",children:"Open full Resources hub"})}),e.jsxs(g,{children:[l.data?.disclaimer??N," Powered by"," ",e.jsx("a",{href:"https://resources.bpmbrands.org/api/public/tools/help-near-me",className:"underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:"Resources Help Near Me"}),"."]})]})}function R(){return e.jsx(e.Fragment,{children:e.jsx("main",{className:"mx-auto max-w-6xl px-5 py-12",children:e.jsx(v,{})})})}export{R as component};
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.