1import{o as u,A as S,j as e,aM as T,C as b,G as c,ah as x,$ as z,T as d,S as I,E as p,I as A,a7 as R,aR as v,aB as E,aA as w,U as C}from"./index-dE8a1mPK.js";import{E as L}from"./ErrorState-gVNyx0--.js";import{E as k}from"./EmptyState-BpgfYYCq.js";import{S as q}from"./SegmentedControl-CNEtbfTu.js";import{T as s}from"./Table-5ftamFSf.js";import{I as F}from"./IconArrowRight-Ajq43paw.js";import{I as $}from"./IconRoute-BmxJMQgj.js";import{I as B}from"./IconRobot-wVbiDQ85.js";import"./IconCopy-B63sUmw8.js";import"./Code-YtMEZkZ5.js";import"./get-env-uyVen0u2.js";const h={"reply-guy":{label:"Reply Guy",icon:e.jsx(w,{size:14}),color:"blue"},bait:{label:"Bait",icon:e.jsx(E,{size:14}),color:"cyan"},competitor:{label:"Competitor",icon:e.jsx(v,{size:14}),color:"grape"},"smart-list":{label:"Smart list",icon:e.jsx(B,{size:14}),color:"teal"},sequence:{label:"Sequence",icon:e.jsx($,{size:14}),color:"orange"}};function X(){const[t,j]=u.useState("all"),{data:i,isLoading:g,error:m,refetch:y}=S({queryKey:["loops"],queryFn:()=>C.listLoops(),refetchInterval:6e4}),n=(i==null?void 0:i.loops)||[],f=u.useMemo(()=>t==="all"?n:n.filter(r=>r.kind===t),[n,t]);return g?e.jsx(T,{}):m?e.jsx(L,{error:m,onRetry:()=>y()}):e.jsxs(b,{gap:"md",children:[e.jsxs(c,{gap:"xs",children:[e.jsx(x,{size:22}),e.jsx(z,{order:2,children:"Engagement loops"})]}),e.jsx(d,{c:"dimmed",size:"sm",maw:720,children:"Every active automation polling X or scoring engagers across your account pool â Reply Guy configs, Bait campaigns, Competitor watches, Smart lists, and Sequence campaigns. Click any row to open its detail."}),n.length===0&&e.jsx(k,{icon:e.jsx(x,{size:32,stroke:1.5}),title:"No active loops",description:"You don't have any Reply Guy / Bait / Competitor / Smart list / Sequence running right now. Start one to see it here."}),n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(q,{value:t,onChange:j,data:[{value:"all",label:`All (${n.length})`},...Object.entries((i==null?void 0:i.byKind)||{}).filter(([r,o])=>o>0).map(([r,o])=>{var l;return{value:r,label:`${((l=h[r])==null?void 0:l.label)||r} (${o})`}})],size:"xs"}),e.jsx(I,{children:e.jsxs(s,{verticalSpacing:"xs",children:[e.jsx(s.Thead,{children:e.jsxs(s.Tr,{children:[e.jsx(s.Th,{children:"Loop"}),e.jsx(s.Th,{children:"Status"}),e.jsx(s.Th,{children:"Last run"}),e.jsx(s.Th,{children:"Summary"}),e.jsx(s.Th,{})]})}),e.jsx(s.Tbody,{children:f.map(r=>{const o=h[r.kind]||{};return e.jsxs(s.Tr,{children:[e.jsx(s.Td,{children:e.jsxs(c,{gap:6,children:[e.jsx(p,{variant:"light",color:o.color,leftSection:o.icon,children:o.label}),e.jsx(d,{size:"sm",truncate:!0,children:r.label})]})}),e.jsx(s.Td,{children:e.jsx(p,{size:"sm",variant:"light",color:G(r.status),children:r.status})}),e.jsx(s.Td,{children:e.jsx(d,{size:"xs",c:"dimmed",children:r.lastRunAt?new Date(r.lastRunAt).toLocaleString():"â"})}),e.jsx(s.Td,{children:e.jsx(c,{gap:6,wrap:"wrap",children:Object.entries(r.summary||{}).slice(0,4).map(([l,a])=>a!=null&&a!==""&&a!==0?e.jsxs(p,{size:"xs",variant:"outline",color:"gray",children:[l,": ",typeof a=="object"?JSON.stringify(a):String(a)]},l):null)})}),e.jsx(s.Td,{children:e.jsxs(A,{component:R,to:r.goTo,size:"xs",children:["open ",e.jsx(F,{size:10,style:{verticalAlign:-1}})]})})]},`${r.kind}_${r.id}`)})})]})})]})]})}function G(t){return t==="live"?"green":t==="paused"?"gray":t==="expired"||t==="error"?"red":"gray"}export{X 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.