import{j as e}from"./ui-vendor-Cn57k9R1.js";import{r as d}from"./react-vendor-B9tfxWGs.js";import{A as B}from"./ActionDropdown-kc0cC6oU.js";import{d as E,P as U,B as m,e as g,S as M,n as T,T as l,K as D,af as F,o as i,s as q,q as I}from"./index-DT-X9ySe.js";import{I as z}from"./input-DSW3IQ5Z.js";import{C as j}from"./checkbox-s3CrKDPd.js";import{D as f}from"./download-CxKVf-xn.js";import{T as S}from"./trash-2-CN1LVg1V.js";import"./query-vendor-BGnEs3s8.js";import"./charts-vendor-DecUTkfU.js";import"./editor-vendor-BA3QzDsK.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const y=E("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]),o=[{id:"1",email:"john@email.com",name:"John Adeyemi",source:"Contact Form",date:"12 Apr 2026",status:"Subscribed"},{id:"2",email:"grace@email.com",name:"Grace Okafor",source:"Inquiry",date:"11 Apr 2026",status:"Subscribed"},{id:"3",email:"sam@email.com",name:"Samuel Eze",source:"Widget",date:"10 Apr 2026",status:"Subscribed"},{id:"4",email:"funke@email.com",name:"Funke Adebayo",source:"Contact Form",date:"9 Apr 2026",status:"Unsubscribed"},{id:"5",email:"chinedu@email.com",name:"Chinedu Obi",source:"Widget",date:"7 Apr 2026",status:"Subscribed"},{id:"6",email:"ada@email.com",name:"Adaeze Nwankwo",source:"Inquiry",date:"5 Apr 2026",status:"Subscribed"},{id:"7",email:"tunde@email.com",name:"Tunde Bakare",source:"Widget",date:"3 Apr 2026",status:"Subscribed"},{id:"8",email:"blessing@email.com",name:"Blessing Ojo",source:"Contact Form",date:"1 Apr 2026",status:"Subscribed"}],O={"Contact Form":"bg-blue-100 text-blue-700",Inquiry:"bg-primary/10 text-primary",Widget:"bg-success/10 text-success"},X=()=>{const[u,N]=d.useState(""),[t,c]=d.useState([]),[h,v]=d.useState(1),[n,w]=d.useState(10),x=o.filter(s=>{if(u){const r=u.toLowerCase();return s.email.toLowerCase().includes(r)||s.name.toLowerCase().includes(r)}return!0}),b=o.length,C=o.filter(s=>s.status==="Subscribed").length,A=o.filter(s=>s.status==="Unsubscribed").length,k=o.filter(s=>s.date.includes("Apr 2026")).length,P=Math.max(1,Math.ceil(x.length/n)),a=x.slice((h-1)*n,h*n),p=a.length>0&&a.every(s=>t.includes(s.id));return e.jsxs("div",{className:"space-y-6",children:[e.jsx(U,{title:"Newsletter Subscribers",count:b,children:e.jsxs(m,{variant:"outline",className:"font-body",children:[e.jsx(f,{className:"w-4 h-4 mr-1"})," Export All (CSV)"]})}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[{label:"Total",value:b,color:"text-foreground"},{label:"Subscribed",value:C,color:"text-success"},{label:"Unsubscribed",value:A,color:"text-muted-foreground"},{label:"This Month",value:`+${k}`,color:"text-primary"}].map(s=>e.jsxs("div",{className:"bg-card rounded-xl border border-border p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground font-body",children:s.label}),e.jsx("p",{className:g("text-2xl font-bold font-body mt-1",s.color),children:s.value})]},s.label))}),e.jsxs("div",{className:"relative w-[300px]",children:[e.jsx(M,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(z,{placeholder:"Search by email...",value:u,onChange:s=>N(s.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"bg-card rounded-xl border border-border overflow-hidden",children:[t.length>0&&e.jsxs(T,{count:t.length,onClear:()=>c([]),children:[e.jsxs(m,{size:"sm",variant:"outline",className:"font-body",children:[e.jsx(f,{className:"w-3 h-3 mr-1"})," Export Selected"]}),e.jsxs(m,{size:"sm",variant:"outline",className:"font-body",children:[e.jsx(y,{className:"w-3 h-3 mr-1"})," Unsubscribe"]}),e.jsxs(m,{size:"sm",variant:"outline",className:"text-destructive border-destructive/30 font-body",children:[e.jsx(S,{className:"w-3 h-3 mr-1"})," Delete"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"w-10 px-4 py-3",style:{background:"#F4F1EB"},children:e.jsx(j,{checked:p,onCheckedChange:()=>{c(p?t.filter(s=>!a.some(r=>r.id===s)):[...new Set([...t,...a.map(s=>s.id)])])}})}),e.jsx(l,{children:"Email"}),e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Source"}),e.jsx(l,{children:"Subscribed Date"}),e.jsx(l,{children:"Status"}),e.jsx(l,{children:"Actions"})]})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,children:e.jsx(D,{icon:F,title:"No subscribers yet",subtitle:"Subscribers will appear when users opt in via your website"})})}):a.map(s=>e.jsxs("tr",{className:"border-b border-border/50 hover:bg-muted/30 transition-colors duration-150",children:[e.jsx("td",{className:"w-10 px-4 py-3",children:e.jsx(j,{checked:t.includes(s.id),onCheckedChange:()=>c(t.includes(s.id)?t.filter(r=>r!==s.id):[...t,s.id])})}),e.jsx(i,{className:"font-medium text-foreground",children:s.email}),e.jsx(i,{className:"text-muted-foreground",children:s.name}),e.jsx(i,{children:e.jsx("span",{className:g("text-xs px-2 py-1 rounded-full font-medium font-body",O[s.source]),children:s.source})}),e.jsx(i,{className:"text-muted-foreground",children:s.date}),e.jsx(i,{children:q(s.status)}),e.jsx(i,{children:e.jsx(B,{actions:[{label:"Unsubscribe",icon:y},{label:"Delete",icon:S,variant:"destructive"}]})})]},s.id))})]})}),e.jsx(I,{page:h,totalPages:P,perPage:n,onPageChange:v,onPerPageChange:w})]})]})};export{X as default};
