1import{r as i,j as e}from"./vendor-react-DRA7ZGpe.js";import{f as m,ae as a,af as r,ak as T,al as D,am as h,an as S,ao as U,ap as p,aq as A,ar as z,as as I,aj as k}from"./index-BKjvWqUb.js";import{P as E}from"./progress-Cr2nlHex.js";import{C as F}from"./circle-help-DeOpKeH5.js";import{U as W}from"./users-Iqaq464E.js";import{D as L}from"./disc-bbzLr5K-.js";import{T as P}from"./trending-up-DDWax4tS.js";import"./vendor-socketio-Dj7dGIag.js";const o={new_arrival:{label:"New Arrivals",icon:P,color:"bg-green-100 text-green-800",description:"Fresh tracks from record stores"},restock:{label:"Restocks",icon:L,color:"bg-red-100 text-red-800",description:"Back in stock items"},preview:{label:"Previews",icon:U,color:"bg-purple-100 text-purple-800",description:"Upcoming releases and snippets"},festival_id:{label:"Festival IDs",icon:W,color:"bg-orange-100 text-orange-800",description:"Unknown tracks from live sets"},dj_weapon:{label:"DJ Weapons",icon:S,color:"bg-red-100 text-red-800",description:"Secret weapons and exclusives"},unknown:{label:"Unknown",icon:F,color:"bg-[var(--tr-surface-light)] text-[var(--tr-text)]",description:"Uncategorized tracks"}},V=()=>{const[c,j]=i.useState([]),[l,u]=i.useState({newArrivals:0,restocks:0,previews:0,festivalIds:0,djWeapons:0,accounts:[]}),[v,g]=i.useState(!0),[f,N]=i.useState("all");i.useEffect(()=>{b(),y()},[]);const b=async()=>{try{const t=await(await m("/api/tracks/categorized")).json();t.success&&j(t.tracks)}catch(s){console.error("Error fetching categorized tracks:",s)}finally{g(!1)}},y=async()=>{try{const t=await(await m("/api/analytics/today")).json();t.success&&u(t.stats)}catch(s){console.error("Error fetching today stats:",s)}},d=s=>s==="all"?c:c.filter(t=>t.category===s),x=s=>{var t,n;return e.jsx(a,{className:"mb-4",children:e.jsxs(r,{className:"pt-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-lg",children:s.trackName}),e.jsx("p",{className:"text-[var(--tr-text-muted)]",children:s.artist}),s.album&&e.jsx("p",{className:"text-sm text-[var(--tr-text-muted)]",children:s.album})]}),s.category&&e.jsx(k,{className:(t=o[s.category])==null?void 0:t.color,children:(n=o[s.category])==null?void 0:n.label})]}),s.categoryConfidence&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsx("span",{children:"Confidence"}),e.jsxs("span",{children:[Math.round(s.categoryConfidence*100),"%"]})]}),e.jsx(E,{value:s.categoryConfidence*100,className:"h-2"})]}),e.jsxs("div",{className:"flex justify-between items-center text-sm text-[var(--tr-text-muted)]",children:[e.jsxs("span",{children:["@",s.djUsername]}),e.jsx("span",{children:new Date(s.foundDate).toLocaleDateString()})]}),s.categoryIndicators&&s.categoryIndicators.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"text-sm font-medium mb-1",children:"Why this category:"}),e.jsx("ul",{className:"text-xs text-[var(--tr-text-muted)]",children:s.categoryIndicators.slice(0,2).map((w,C)=>e.jsxs("li",{children:["⢠",w]},C))})]}),s.spotifyUrl&&e.jsx("a",{href:s.spotifyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-block mt-3 text-green-600 hover:text-green-800 text-sm font-medium",children:"Listen on Spotify â"})]})},s.id)};return v?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--tr-surface)]"})}):e.jsxs("div",{className:"max-w-7xl mx-auto p-6",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Smart Categorization"}),e.jsx("p",{className:"text-[var(--tr-text-muted)]",children:"Automatically organized music discoveries across the entire ecosystem"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-8",children:[e.jsx(a,{children:e.jsxs(r,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:l.newArrivals}),e.jsx("p",{className:"text-xs text-[var(--tr-text-muted)]",children:"New Arrivals"})]})}),e.jsx(a,{children:e.jsxs(r,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-red-600",children:l.restocks}),e.jsx("p",{className:"text-xs text-[var(--tr-text-muted)]",children:"Restocks"})]})}),e.jsx(a,{children:e.jsxs(r,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-purple-600",children:l.previews}),e.jsx("p",{className:"text-xs text-[var(--tr-text-muted)]",children:"Previews"})]})}),e.jsx(a,{children:e.jsxs(r,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-orange-600",children:l.festivalIds}),e.jsx("p",{className:"text-xs text-[var(--tr-text-muted)]",children:"Festival IDs"})]})}),e.jsx(a,{children:e.jsxs(r,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-red-600",children:l.djWeapons}),e.jsx("p",{className:"text-xs text-[var(--tr-text-muted)]",children:"DJ Weapons"})]})}),e.jsx(a,{children:e.jsxs(r,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-[var(--tr-text-muted)]",children:l.accounts.length}),e.jsx("p",{className:"text-xs text-[var(--tr-text-muted)]",children:"Active Accounts"})]})})]}),e.jsxs(T,{value:f,onValueChange:N,children:[e.jsxs(D,{className:"mb-6",children:[e.jsxs(h,{value:"all",children:["All Tracks (",c.length,")"]}),Object.entries(o).map(([s,t])=>{const n=d(s).length;return n>0?e.jsxs(h,{value:s,children:[t.label," (",n,")"]},s):null})]}),e.jsx(p,{value:"all",children:e.jsx("div",{className:"space-y-4",children:c.length===0?e.jsx(a,{children:e.jsx(r,{className:"pt-6 text-center",children:e.jsx("p",{className:"text-[var(--tr-text-muted)]",children:"No categorized tracks foun
1d"})})}):c.map(x)})}),Object.entries(o).map(([s,t])=>e.jsxs(p,{value:s,children:[e.jsx("div",{className:"mb-4",children:e.jsx(a,{children:e.jsxs(A,{children:[e.jsxs(z,{className:"flex items-center gap-2",children:[e.jsx(t.icon,{className:"w-5 h-5"}),t.label]}),e.jsx(I,{children:t.description})]})})}),e.jsx("div",{className:"space-y-4",children:d(s).map(x)})]},s))]})]})};export{V as SmartCategorizationDashboard};
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.