1import{r as a,J as j,j as e,x as S,H as x,B as C,a1 as w}from"./index-BACUqBz4.js";import{E as k}from"./EmptyState-CRi2jFBw.js";import{f as c}from"./series-6vDvXsE1.js";function R(){var m;const[p,f]=a.useState([]),[l,g]=a.useState(""),[i,h]=a.useState(null),[n,u]=a.useState(!1);a.useEffect(()=>{j.list().then(r=>f(r.data||[])).catch(()=>{})},[]);function y(){l&&(u(!0),w.summary(l).then(r=>h(r.data)).catch(()=>{}).finally(()=>u(!1)))}const s=i?Object.entries(i.summary||{}).filter(([,r])=>r.type==="numeric"):[],o=i?Object.entries(i.summary||{}).filter(([,r])=>r.type==="text"):[];return e.jsxs(S,{children:[e.jsx(x,{title:e.jsxs(e.Fragment,{children:["Data ",e.jsx(x.Accent,{children:"Summary"})]}),description:"Statistical summary of all columns in your dataset"}),e.jsxs("div",{style:{background:"var(--bg-raised)",borderRadius:12,padding:20,boxShadow:"var(--elev-1)",marginBottom:24,display:"flex",gap:12,alignItems:"flex-end"},children:[e.jsx("div",{style:{flex:1},children:e.jsxs("select",{value:l,onChange:r=>g(r.target.value),style:{width:"100%",padding:"9px 12px",border:"1px solid var(--border-default)",borderRadius:8,fontSize:"0.9rem"},children:[e.jsx("option",{value:"",children:"-- Choose a file --"}),p.map(r=>e.jsx("option",{value:r.id,children:r.filename},r.id))]})}),e.jsx(C,{onClick:y,disabled:!l||n,children:n?"Analysing...":"Summarise"})]}),i&&e.jsxs("div",{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:16,marginBottom:24},children:[["File",i.filename],["Rows",(m=i.rows)==null?void 0:m.toLocaleString()],["Columns",i.columns],["Numeric Cols",s.length]].map(([r,t])=>e.jsxs("div",{style:{background:"linear-gradient(135deg,#0c1446,#06b6d4)",borderRadius:12,padding:16,color:"#fff"},children:[e.jsx("div",{style:{fontSize:"0.75rem",opacity:.7},children:r}),e.jsx("div",{style:{fontWeight:800,fontSize:"1.1rem",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]},r))}),s.length>0&&e.jsxs("div",{style:{background:"var(--bg-raised)",borderRadius:12,boxShadow:"var(--elev-1)",marginBottom:20,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"14px 20px",borderBottom:"1px solid var(--border-subtle)",fontWeight:700,color:"var(--fg-primary)"},children:["Numeric Columns (",s.length,")"]}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"var(--bg-sunken)"},children:["Column","Count","Sum","Mean","Min","Max"].map(r=>e.jsx("th",{style:{padding:"10px 14px",textAlign:r==="Column"?"left":"right",fontWeight:600,color:"var(--fg-secondary)",borderBottom:"1px solid var(--border-default)"},children:r},r))})}),e.jsx("tbody",{children:s.map(([r,t],d)=>e.jsxs("tr",{style:{background:d%2===0?"#fff":"#fafafa"},children:[e.jsx("td",{style:{padding:"9px 14px",fontWeight:600,color:"var(--fg-primary)"},children:r}),[t.count,t.sum,t.mean,t.min,t.max].map((v,b)=>e.jsx("td",{style:{padding:"9px 14px",color:"var(--fg-secondary)",textAlign:"right",fontVariantNumeric:"tabular-nums"},children:c(Number(v))},b))]},r))})]})})]}),o.length>0&&e.jsxs("div",{style:{background:"var(--bg-raised)",borderRadius:12,boxShadow:"var(--elev-1)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"14px 20px",borderBottom:"1px solid var(--border-subtle)",fontWeight:700,color:"var(--fg-primary)"},children:["Categorical Columns (",o.length,")"]}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"var(--bg-sunken)"},children:["Column","Count","Unique Values","Top Values"].map(r=>e.jsx("th",{style:{padding:"10px 14px",textAlign:r==="Count"||r==="Unique Values"?"right":"left",fontWeight:600,color:"var(--fg-secondary)",borderBottom:"1px solid var(--border-default)"},children:r},r))})}),e.jsx("tbody",{children:o.map(([r,t],d)=>e.jsxs("tr",{style:{background:d%2===0?"#fff":"#fafafa"},children:[e.jsx("td",{style:{padding:"9px 14px",fontWeight:600,color:"var(--fg-primary)"},children:r}),e.jsx("td",{style:{padding:"9px 14px",color:"var(--fg-secondary)",textAlign:"right",fontVariantNumeric:"tabular-nums"},children:c(Number(t.count))}),e.jsx("td",{style:{padding:"9px 14px",color:"var(--fg-secondary)",textAlign:"right",fontVariantNumeric:"tabular-nums"},children:c(Number(t.unique))}),e.jsx("td",{style:{padding:"9px 14px",color:"var(--fg-tertiary)",fontSize:"0.8rem"},children:(t.top_values||[]).slice(0,5).join(", ")})]},r))})]})})]})]}),!i&&!n&&e.jsx(k,{title:"No summary yet",description:"Select a file to see its statistical summary"})]})}
1export{R 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.