1import{r as l,j as e,a as v,I as K}from"./index-BXIYCH34.js";import{u as X,C as Z}from"./useAuth-DRd7ykUu.js";import{S as ee,a as te}from"./site-footer-DpUPRjsr.js";import{C as se}from"./chart-no-axes-column-DZUsYJdu.js";import{C as $}from"./chevron-down-CHEgG9Jw.js";import{C as J}from"./chevron-right-Dysr7DEt.js";import{C as _}from"./circle-alert-HNTYnzEW.js";import{M as re}from"./mfa-credential-manager-B5O91pfu.js";import{D as ae,j as D,d as ie}from"./session-ui-C-POaWMJ.js";import{o as b}from"./proxy-Da6_ogfH.js";import{L as ne}from"./nav-f7zqxAva.js";import{a as G,E as Y}from"./eye-ppzeFDN6.js";import{A as le}from"./index-hr5J3RAn.js";import{U as oe}from"./users-C6gUDcHj.js";import{M as q}from"./mail-CndlgLWQ.js";import{C as de}from"./circle-check-9gsAb6fE.js";import"./useQuery-33O0-TlW.js";import"./useMutation-CaTQ2lDw.js";import"./trash-2-HvslD9GK.js";import"./download-BehACOWp.js";import"./requestTimeout-CGfxqkvX.js";import"./lock-CGjwE0E3.js";import"./clock-CeljP79C.js";function y(d,n){return n===0?"0%":`${Math.round(d/n*100)}%`}function E({title:d,defaultOpen:n=!1,children:u}){const[r,c]=l.useState(n);return e.jsxs("div",{className:"border border-border/30 rounded-lg overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>c(h=>!h),className:"w-full flex items-center justify-between px-4 py-2.5 text-left text-xs font-medium text-muted-foreground uppercase tracking-wide hover:text-foreground hover:bg-muted/20 transition-colors",children:[e.jsx("span",{children:d}),r?e.jsx($,{className:"w-3.5 h-3.5"}):e.jsx(J,{className:"w-3.5 h-3.5"})]}),r&&e.jsx("div",{className:"px-4 py-3 border-t border-border/20",children:u})]})}function ce({authFetch:d}){const[n,u]=l.useState(!1),[r,c]=l.useState(null),[h,w]=l.useState(!1),[p,C]=l.useState(null);l.useEffect(()=>{!n||r||h||(w(!0),C(null),d("/api/admin/members/analytics").then(async s=>{const i=await s.json();if(!s.ok)throw new Error(i.error??"Failed to load analytics");c(i)}).catch(s=>C(s.message||"Failed to load analytics")).finally(()=>w(!1)))},[n,r,h,d]);const x=r?.generationCounts.reduce((s,i)=>s+i.count,0)??0,g=r?.stateCounts.find(s=>s.state==="MT")?.count??0,S=r?.membershipTypeCounts.reduce((s,i)=>s+i.count,0)??0;return e.jsxs("div",{className:"mb-6","data-testid":"panel-directory-analytics",children:[e.jsxs("button",{type:"button",onClick:()=>u(s=>!s),className:"flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground border border-border/40 hover:border-border/70 rounded-lg px-3 py-1.5 transition-colors select-none mb-2","aria-expanded":n,"data-testid":"button-directory-analytics-toggle",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),n?"Hide chapter analytics":"Show chapter analytics",n?e.jsx($,{className:"w-3 h-3"}):e.jsx(J,{className:"w-3 h-3"})]}),n&&e.jsxs("div",{className:"bg-card/40 border border-border/30 rounded-xl p-4 space-y-2",children:[h&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground py-2",children:[e.jsx(v,{className:"w-3.5 h-3.5 animate-spin"})," Loading analyticsâ¦"]}),p&&e.jsxs("div",{className:"flex items-start gap-2 text-xs text-red-400 py-2","data-testid":"text-directory-analytics-error",children:[e.jsx(_,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"})," ",p]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-xs text-muted-foreground/60 pb-1",children:["Aggregate counts of ",e.jsx("strong",{className:"text-muted-foreground",children:"active members"}),". No individual member data is shown here."]}),e.jsx(E,{title:"Generations & Age Bands",defaultOpen:!0,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted-foreground/70",children:[e.jsx("th",{className:"text-left py-1 font-normal",children:"Generation"}),e.jsx("th",{className:"text-left py-1 font-normal",children:"Birth Years"}),e.jsx("th",{className:"text-right py-1 font-normal w-16",children:"Count"}),e.jsx("th",{className:"text-right py-1 font-normal w-12",children:"%"})]})}),e.jsx("tbody",{children:r.generationCounts.map(s=>e.jsxs("tr",{className:"border-t border-border/10",children:[e.jsx("td",{className:"py-1.5",children:s.label}),e.jsx("td",{className:"py-1.5 text-muted-foreground",children:s.label==="Unknown"?"â":`${s.fromYear}â${s.toYear}`}),e.jsx("td",{className:"py-1.5 text-right",children:s.count}),e.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:y(s.count,x)})]},s.label))})]}),e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted-foreground
1/70",children:[e.jsx("th",{className:"text-left py-1 font-normal",children:"Age Band"}),e.jsx("th",{className:"text-right py-1 font-normal w-16",children:"Count"}),e.jsx("th",{className:"text-right py-1 font-normal w-12",children:"%"})]})}),e.jsx("tbody",{children:r.ageBandCounts.map(s=>e.jsxs("tr",{className:"border-t border-border/10",children:[e.jsx("td",{className:"py-1.5",children:s.label}),e.jsx("td",{className:"py-1.5 text-right",children:s.count}),e.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:y(s.count,x)})]},s.label))})]})]})}),e.jsx(E,{title:"Geographic Distribution",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted-foreground/70",children:[e.jsx("th",{className:"text-left py-1 font-normal",children:"State"}),e.jsx("th",{className:"text-right py-1 font-normal w-16",children:"Count"}),e.jsx("th",{className:"text-right py-1 font-normal w-12",children:"%"})]})}),e.jsx("tbody",{children:r.stateCounts.map(s=>e.jsxs("tr",{className:"border-t border-border/10",children:[e.jsx("td",{className:"py-1.5",children:s.state}),e.jsx("td",{className:"py-1.5 text-right",children:s.count}),e.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:y(s.count,x)})]},s.state))})]}),g>0&&e.jsxs("div",{className:"border-l-2 border-primary/30 pl-3 space-y-1 text-xs",children:[e.jsx("p",{className:"text-muted-foreground/80",children:"Continental Divide (Montana members)"}),e.jsxs("p",{children:["West: ",e.jsx("strong",{children:r.divideSideCounts.westOfDivide}),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",y(r.divideSideCounts.westOfDivide,g),")"]}),e.jsx("span",{className:"mx-3"}),"East: ",e.jsx("strong",{children:r.divideSideCounts.eastOfDivide}),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",y(r.divideSideCounts.eastOfDivide,g),")"]})]})]})]})}),e.jsx(E,{title:"Montana Regions",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted-foreground/70",children:[e.jsx("th",{className:"text-left py-1 font-normal",children:"Region"}),e.jsx("th",{className:"text-right py-1 font-normal w-16",children:"Count"}),e.jsx("th",{className:"text-right py-1 font-normal w-12",children:"%"})]})}),e.jsx("tbody",{children:r.montanaRegionCounts.map(s=>e.jsxs("tr",{className:"border-t border-border/10",children:[e.jsx("td",{className:"py-1.5 pr-4",children:s.region}),e.jsx("td",{className:"py-1.5 text-right",children:s.count}),e.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:y(s.count,g||1)})]},s.region))})]})}),e.jsx(E,{title:"Membership Types",children:e.jsx("table",{className:"w-full text-xs",children:e.jsx("tbody",{children:r.membershipTypeCounts.map(s=>e.jsxs("tr",{className:"border-t border-border/10",children:[e.jsx("td",{className:"py-1",children:s.label||s.type}),e.jsx("td",{className:"py-1 text-right text-muted-foreground",children:s.count}),e.jsx("td",{className:"py-1 text-right text-muted-foreground w-12",children:y(s.count,S)})]},s.type))})})})]})]})]})}const me=[{label:"All statuses",value:""},{label:"Active",value:"active"},{label:"Inactive",value:"inactive"},{label:"Lapsed",value:"lapsed"},{label:"Deceased",value:"deceased"},{label:"Life",value:"life"}];function Re(){const[,d]=K(),{isAuthenticated:n,username:u,logout:r,authFetch:c,sessionExpiresAt:h,dailySignOutAt:w}=X(),[p,C]=l.useState(""),[x,g]=l.useState(""),[S,s]=l.useState(!1),[i,T]=l.useState(null),[L,f]=l.useState(null),[Q,M]=l.useState(!1),[R,B]=l.useState(!1),[j,P]=l.useState(!1),[N,A]=l.useState(null),[k,U]=l.useState(!1),[I,F]=l.useState(null);if(l.useEffect(()=>{if(!n){const t=encodeURIComponent("/directory");d(`/login?redirect=${t}`)}},[n,d]),l.useEffect(()=>{if(!n)return;let t=!1;return c("/api/members/my-directory-status").then(a=>a.json()).then(a=>{t||A({memberFound:a.memberFound,directoryOptOut:a.directoryOptOut})}).catch(()=>{t||A({memberFound:!1})}),()=>{t=!0}},[n]),l.useEffect(()=>{if(!n)return;let t=!1;const a=()=>{c("/api/members/directory-config").then(O=>O.ok?O.json():null).then(O=>{t||P(O?.enabled===!0)}).catch(()=>{t||P(!1)})};a();const o=()=>a(),m=()=>{document.visibilityState==="visible"&&a()};return window.addEventListener("focus",o),document.addEventListener("visibilitychange",m),()=>{t=!0,window.removeEventListener("focus",o),document.removeEventListener("visibilitychange",m)}},[n]),!n)return null;async function H(t){U(!0),F(null);try{const a=await c("/api/members/my-directory-status",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({directoryOptOut:t})}),o=await a.json();!a.ok||!o.ok?F(o.error??"Failed to update your listing â please try again."):A({memberFound:!0,directoryOptOut:o.directoryOptOut})}catch{F("Network error â please try again.")}finally{U(!1)}}async function V(t){t.preventDefault();const a=x?`${p.trim()||"all members"} with status ${x}`:p.trim();if(a){s(!0),f(null),T(null);try{const o=await c("/api/members/rodd-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:a})}),m=await o.json();o.ok?T(m):f(m.error??"Search failed. Please try again.")}catch{f("Network error. Please try again.")}finally{s(!1)}}}async function W(){if(!(!i||i.members.length===0||i.members.some(t=>t.id==null))){B(!0);try{const t=i.members.map(m=>m.id).join(","),a=await c(`/api/members/mailto?ids=${encodeURIComponent(t)}`),o=await a.json();
1a.ok&&o.mailtoUrl?window.open(o.mailtoUrl,"_self"):f(o.error??"Failed to build email link.")}catch{f("Network error. Please try again.")}finally{B(!1)}}}async function z(){if(!(!i||i.members.length===0||i.members.some(t=>t.id==null)))try{const t=i.members.map(m=>m.id).join(","),a=await c(`/api/members/mailto?ids=${encodeURIComponent(t)}`),o=await a.json();a.ok&&o.addresses?(await navigator.clipboard.writeText(o.addresses),M(!0),setTimeout(()=>M(!1),2500)):f(o.error??"Failed to copy addresses.")}catch{f("Failed to copy to clipboard.")}}return e.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col",children:[e.jsx(ee,{}),e.jsx("div",{className:"pt-24",children:e.jsx(ae,{sessionExpiresAt:h,dailySignOutAt:w})}),e.jsx("main",{className:"flex-1 pt-4 pb-20 px-4",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx(b.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"mb-10",children:e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap mb-2",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-serif text-4xl font-bold text-foreground mb-2",children:"Member Directory"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Search the roster in plain English. Email results through your own mail client."})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground/70 mt-1",children:[e.jsxs("span",{children:["Signed in as ",e.jsx("span",{className:"text-primary font-medium",children:u})]}),e.jsx("button",{onClick:()=>{r(),d("/login")},title:"Log out",className:"p-1 hover:text-primary transition-colors","data-testid":"button-directory-logout",children:e.jsx(ne,{className:"w-4 h-4"})})]})]})}),e.jsx("div",{className:"mb-5",children:e.jsx(re,{authFetch:c,showRecoveryReadiness:!1,signInPath:"/login",onSessionsRevoked:()=>{r()}})}),N?.memberFound&&e.jsxs(b.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3},className:"flex items-center justify-between gap-4 bg-card/60 border border-border/40 rounded-xl px-5 py-3 mb-5 flex-wrap","data-testid":"panel-my-listing",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[N.directoryOptOut?e.jsx(G,{className:"w-4 h-4 text-amber-400 shrink-0"}):e.jsx(Y,{className:"w-4 h-4 text-emerald-400 shrink-0"}),e.jsxs("span",{className:"text-muted-foreground",children:["Your listing:"," ",e.jsx("span",{className:N.directoryOptOut?"text-amber-400 font-medium":"text-emerald-400 font-medium","data-testid":"text-my-listing-status",children:N.directoryOptOut?"hidden":"visible"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[I&&e.jsx("span",{className:"text-xs text-red-400","data-testid":"text-my-listing-error",children:I}),N.directoryOptOut?e.jsxs("button",{onClick:()=>{H(!1)},disabled:k,className:"flex items-center gap-1.5 px-3.5 py-1.5 text-xs border border-emerald-700/50 text-emerald-400 hover:bg-emerald-950/40 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-restore-my-listing",children:[k?e.jsx(v,{className:"w-3 h-3 animate-spin"}):e.jsx(Y,{className:"w-3 h-3"}),"Restore my listing"]}):e.jsxs("button",{onClick:()=>{H(!0)},disabled:k,className:"flex items-center gap-1.5 px-3.5 py-1.5 text-xs border border-border/50 text-muted-foreground hover:text-foreground hover:border-border/80 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-hide-my-listing",children:[k?e.jsx(v,{className:"w-3 h-3 animate-spin"}):e.jsx(G,{className:"w-3 h-3"}),"Hide my listing"]})]})]}),e.jsx(b.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1},className:"bg-card border border-border/50 rounded-xl p-6 mb-6 shadow-lg",children:e.jsxs("form",{onSubmit:V,className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(D,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground
1/50 pointer-events-none"}),e.jsx("input",{type:"text",value:p,onChange:t=>C(t.target.value),placeholder:'Ask Rodd e.g. "who lives in Flathead county?" or "active life members"',className:"w-full pl-10 pr-4 py-2.5 bg-background border border-border/60 rounded-lg text-foreground placeholder:text-muted-foreground/40 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50 transition-colors text-sm","data-testid":"input-directory-search"})]}),e.jsxs("div",{className:"relative sm:w-44",children:[e.jsx("select",{value:x,onChange:t=>g(t.target.value),className:"w-full appearance-none pl-3.5 pr-8 py-2.5 bg-background border border-border/60 rounded-lg text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50 transition-colors text-sm cursor-pointer","data-testid":"select-directory-status",children:me.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsx($,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 pointer-events-none"})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsx("p",{className:"text-xs text-muted-foreground/50",children:"Ask in plain English â by county, city, region, membership type, or status."}),e.jsxs("button",{type:"submit",disabled:S||!p.trim()&&!x,className:"flex items-center gap-2 px-5 py-2.5 bg-primary text-primary-foreground rounded-lg font-medium text-sm hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-directory-search",children:[S?e.jsx(v,{className:"w-4 h-4 animate-spin"}):e.jsx(ie,{className:"w-4 h-4"}),"Search"]})]})]})}),j&&e.jsx(ce,{authFetch:c}),e.jsxs(le,{mode:"wait",children:[!i&&!L&&e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.35,delay:.15},className:"bg-card/50 border border-border/30 rounded-xl p-6 mb-2","data-testid":"card-directory-howto",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-widest text-muted-foreground/50 mb-5",children:"How it works"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 border border-primary/20 flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(D,{className:"w-3.5 h-3.5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground/90 mb-1",children:"Ask Rodd"}),e.jsxs("p",{className:"text-xs text-muted-foreground/60 leading-relaxed",children:["Search in plain English â by radius, city, county, state, membership type, or status. For example: ",e.jsx("span",{className:"text-muted-foreground/80 italic",children:'"members within 50 miles of Helena"'})," or ",e.jsx("span",{className:"text-muted-foreground/80 italic",children:'"active members west of the divide."'})]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 border border-primary/20 flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(oe,{className:"w-3.5 h-3.5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground/90 mb-1",children:"Review the list"}),e.jsx("p",{className:"text-xs text-muted-foreground/60 leading-relaxed",children:"Matching members appear in a table with name, city, county, and membership type. Refine your search anytime."})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 border border-primary/20 flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(q,{className:"w-3.5 h-3.5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground/90 mb-1",children:"Email the group"}),e.jsxs("p",{className:"text-xs text-muted-foreground/60 leading-relaxed",children:["Click ",e.jsx("span",{className:"text-foreground/70 font-medium",children:"Email this group"})," to open your mail client (Gmail, Outlook, Apple Mail) with every member pre-loaded as BCC â recipients won't see each other's addresses."]})]})]})]})]},"how-it-works"),L&&e.jsxs(b.div,{initial:{opacity:0,y:8}
1,animate:{opacity:1,y:0},exit:{opacity:0},className:"flex items-start gap-3 bg-red-500/10 border border-red-500/20 rounded-xl p-4 mb-6","data-testid":"text-directory-error",children:[e.jsx(_,{className:"w-4 h-4 text-red-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm text-red-400",children:L})]},"error"),i&&e.jsx(b.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.3},children:e.jsxs("div",{className:"bg-card border border-border/50 rounded-xl shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 px-6 py-4 border-b border-border/50 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-sm text-muted-foreground","data-testid":"text-directory-explanation",children:i.answer})]}),i.members.length>0&&i.members.every(t=>t.id!=null)&&e.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{W()},disabled:R,className:"flex items-center gap-1.5 px-3.5 py-1.5 bg-primary/10 border border-primary/30 text-primary rounded-lg text-sm font-medium hover:bg-primary/20 transition-colors disabled:opacity-50","data-testid":"button-directory-email",children:[R?e.jsx(v,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(q,{className:"w-3.5 h-3.5"}),"Email this group"]}),e.jsx("button",{onClick:()=>{z()},className:"flex items-center gap-1.5 px-3.5 py-1.5 bg-muted/30 border border-border/50 text-muted-foreground rounded-lg text-sm hover:bg-muted/50 transition-colors","data-testid":"button-directory-copy",children:Q?e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3.5 h-3.5 text-green-400"}),e.jsx("span",{className:"text-green-400",children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-3.5 h-3.5"}),"Copy addresses"]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground/40 text-right",children:"Opens your mail client · all addresses are BCC â recipients won't see each other"})]})]}),i.members.length===0?e.jsx("div",{className:"text-center py-16 text-muted-foreground/60 text-sm","data-testid":"text-directory-empty",children:"No members matched your search."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-directory-results",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border/30",children:[e.jsx("th",{className:"text-left px-6 py-3 text-xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Name"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-muted-foreground/70 uppercase tracking-wider hidden sm:table-cell",children:"Location"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-muted-foreground/70 uppercase tracking-wider hidden lg:table-cell",children:"Type"}),j&&e.jsxs(e.Fragment,{children:[e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-muted-foreground/70 uppercase tracking-wider hidden md:table-cell",children:"Contact"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-muted-foreground/70 uppercase tracking-wider hidden lg:table-cell",children:"Details"})]}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Status"})]})}),e.jsx("tbody",{children:i.members.map((t,a)=>e.jsxs("tr",{className:`border-b border-border/20 hover:bg-muted/10 transition-colors ${a%2===0?"":"bg-muted/5"}`,"data-testid":"row-directory-member",children:[e.jsx("td",{className:"px-6 py-3 font-medium text-foreground",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{children:[t.firstName," ",t.middleName?`${t.middleName} `:"",t.nickname?`"${t.nickname}" `:"",t.lastName,t.suffix?`, ${t.suffix}`:""]}),j&&t.memberNumber&&e.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["#",t.memberNumber]})]})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground hidden sm:table-cell",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{children:[t.city??"â",t.state?`, ${t.state}`:""]}),j&&(t.address||t.county||t.postalCode)&&e.jsx("span",{className:"text-xs text-muted-foreground
1/60",children:[t.address,t.county?`${t.county} County`:"",t.postalCode].filter(Boolean).join(" ⢠")})]})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground hidden lg:table-cell",children:t.membershipType??"â"}),j&&e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"px-4 py-3 text-muted-foreground hidden md:table-cell",children:e.jsxs("div",{className:"flex flex-col gap-0.5","data-testid":"cell-directory-contact",children:[t.email&&e.jsx("a",{href:`mailto:${t.email}`,className:"hover:text-primary transition-colors",children:t.email}),t.phone&&e.jsx("span",{className:"select-text",children:t.phone}),!t.email&&!t.phone&&"â"]})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground hidden lg:table-cell",children:e.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[t.age&&e.jsxs("span",{children:["Age: ",t.age]}),t.joinDate&&e.jsxs("span",{children:["Joined: ",new Date(t.joinDate).getFullYear()]}),t.spouse&&e.jsxs("span",{children:["Spouse: ",t.spouse]}),!t.age&&!t.joinDate&&!t.spouse&&"â"]})})]}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(xe,{status:t.status})})]},t.id??`${t.firstName}-${t.lastName}-${t.city??""}-${a}`))})]})})]})},"results")]})]})}),e.jsx(te,{})]})}function xe({status:d}){const n=d?.toLowerCase()??"",r={active:{label:"Active",cls:"bg-green-500/15 text-green-400 border-green-500/20"},inactive:{label:"Inactive",cls:"bg-gray-500/15 text-gray-400 border-gray-500/20"},lapsed:{label:"Lapsed",cls:"bg-yellow-500/15 text-yellow-400 border-yellow-500/20"},deceased:{label:"Deceased",cls:"bg-red-500/10 text-red-400/80 border-red-500/15"}}[n]??{label:d??"â",cls:"bg-muted/20 text-muted-foreground border-border/30"};return e.jsx("span",{className:`inline-block text-xs font-medium px-2 py-0.5 rounded-full border ${r.cls}`,children:r.label})}export{Re 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.