import{r as d,j as e,I as j,z as y,Q as I,af as v,q as u}from"./index-Dbk1Plmn.js";import{u as S}from"./use_interpretations-CyFYYw9f.js";import{P as A}from"./page_shell-C0CL85dt.js";import{D as w}from"./data-table-B-cqS3KC.js";import{S as C}from"./source_link-Bg790zHv.js";import{A as b}from"./agent_badge-BZd6ZAh5.js";import{u as P}from"./agent_filter-DUlgHUAb.js";import{O as Q}from"./pagination-BoJeck8D.js";import{s as _,a as k}from"./query_loading-BFETHugg.js";import{Q as D}from"./query_refresh_indicator-1_XqkpX1.js";import"./interpretations-BQOT8hIC.js";import"./chevron-right-L2MnFoxW.js";const o=25;function Z(){var l;const[n,m]=d.useState(""),[s,i]=d.useState(0),r=S({source_id:n||void 0,limit:o,offset:s}),p=[{header:"Source",accessorKey:"source_id",cell:({getValue:t})=>e.jsx(C,{id:t()})},{header:"Status",accessorKey:"status",cell:({getValue:t})=>{const a=t(),x=a==="completed"?"default":a==="failed"?"destructive":"secondary";return e.jsx(v,{variant:x,children:a||"unknown"})}},{header:"Observations Created",accessorKey:"observations_created"},{header:"Created",accessorKey:"created_at",cell:({getValue:t})=>u(t())},{header:"Completed",accessorKey:"completed_at",cell:({getValue:t})=>u(t())},{header:"Agent",id:"agent",cell:({row:t})=>e.jsx(b,{provenance:t.original.provenance??null})}],c=((l=r.data)==null?void 0:l.interpretations)??[],{filterRows:f,AgentFilterControl:g}=P(c),h=f(c);return e.jsxs(A,{title:"Interpretations",description:"AI interpretation runs on sources",actions:k(r)?e.jsx(D,{}):void 0,children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsx(j,{placeholder:"Filter by source ID…",value:n,onChange:t=>{m(t.target.value),i(0)},className:"w-[250px]"}),e.jsx(g,{})]}),_(r)?e.jsx(y,{rows:10,cols:6}):r.error?e.jsx(I,{title:"Could not load interpretations",children:r.error.message}):e.jsxs(e.Fragment,{children:[e.jsx(w,{columns:p,data:h}),r.data&&r.data.interpretations.length>=o&&e.jsx(Q,{offset:s,limit:o,total:r.data.interpretations.length+s+1,onPageChange:i})]})]})}export{Z as default};
