1import{b as L,r as i,t as w,a as h,j as e,B as f,R as I,T as P}from"./index-Df9RYwwb.js";import{C as D}from"./checkbox-BHQgXlPV.js";import{B as O}from"./badge-J22GgUII.js";import{I as T}from"./input-DjTme8O2.js";import{S as U}from"./search-5QUQvdxV.js";import{R as H}from"./refresh-cw-CMO8x5YM.js";import{C as Q}from"./clock-CauO0FXy.js";import{E as _}from"./external-link-BPMXaBTv.js";import"./Combination-Dr1zqeqq.js";import"./index-MeEx7tY1.js";import"./check-Dkuz6PS5.js";import"./dialog-CCm092Hq.js";import"./index--YHQQRNx.js";import"./x-Dpi4zoMf.js";import"./usePersistFn-3_pBEfWa.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const G=L("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** 7 * @license lucide-react v0.453.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const J=L("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);function b(d){if(!d)return!1;const r=d.toLowerCase();return r.includes("transcript")||r.includes("live stream")}function K(d){if(!d)return"â";const r=Date.now(),m=d.getTime()-r;if(m<=0)return"Ready to retry";const A=Math.floor(m/(1e3*60*60)),o=Math.floor(m%(1e3*60*60)/(1e3*60));return A>0?`in ${A}h ${o}m`:`in ${o}m`}function me(){const[d,r]=i.useState("all"),[m,A]=i.useState(void 0),{data:o,isLoading:F,refetch:V}=w.admin.getFailedVideos.useQuery({failureCategory:d==="all"?void 0:d,channelId:m,limit:500,offset:0}),C=w.admin.requeueFailedVideos.useMutation({onSuccess:s=>{h(`Re-queued ${s.requeued} video${s.requeued!==1?"s":""} for processing`),x(new Set),V()},onError:s=>h(`Error: ${s.message}`)}),v=w.admin.requeueAllRetryable.useMutation({onSuccess:s=>{h(`Re-queued ${s.requeued} retryable video${s.requeued!==1?"s":""}`),x(new Set),V()},onError:s=>h(`Error: ${s.message}`)}),[n,x]=i.useState(new Set),[c,z]=i.useState(""),[p,E]=i.useState("all"),u=o?.rows??[],j=o?.total??0,g=o?.reasonCounts??{},l=i.useMemo(()=>u.filter(s=>{const t=!c||s.title.toLowerCase().includes(c.toLowerCase())||s.channelName.toLowerCase().includes(c.toLowerCase())||(s.ingestionNote??"").toLowerCase().includes(c.toLowerCase()),a=p==="all"||p==="retryable"&&b(s.ingestionNote)||p==="permanent"&&!b(s.ingestionNote);return t&&a}),[u,c,p]),N=i.useMemo(()=>u.filter(s=>b(s.ingestionNote)).length,[u]),S=l.length>0&&l.every(s=>n.has(s.videoId));function M(){x(S?s=>{const t=new Set(s);return l.forEach(a=>t.delete(a.videoId)),t}:s=>{const t=new Set(s);return l.forEach(a=>t.add(a.videoId)),t})}function k(s){x(t=>{const a=new Set(t);return a.has(s)?a.delete(s):a.add(s),a})}function B(){const s=Array.from(n).filter(t=>l.some(a=>a.videoId===t));s.length!==0&&C.mutate({videoIds:s})}const R=i.useMemo(()=>Object.entries(g).sort(([,s],[,t])=>t-s).map(([s,t])=>({cat:s,cnt:t})),[g]),q=i.useMemo(()=>Object.values(g).reduce((s,t)=>s+t,0),[g]);return e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:147",className:"min-h-screen bg-background text-foreground p-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:149",className:"mb-6",children:[e.jsx("h1",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:150",className:"text-2xl font-bold mb-1",children:"Failed Videos"}),e.jsx("p",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:151",className:"text-muted-foreground text-sm",children:"Videos that failed ingestion. Retryable failures (no transcript, live stream) can be re-queued automatically or manually. Permanent failures (0 sightings, too short) require manual review."})]}),!F&&R.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:160",className:"flex flex-wrap gap-2 mb-5",children:[e.jsxs("button",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:161",onClick:()=>r("all"),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${d==="all"?"bg-primary text-primary-foreground border-primary":"bg-card border-border text-muted-foreground hover:border-primary/50"}`,children:["All (",q,")"]}),R.map(({cat:s,cnt:t})=>e.jsxs("button",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:172",onClick:()=>r(s===d?"all":s),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${d===s?"bg-primary text-primary-foreground border-primary":"bg-card border-border text-muted-foreground hover:border-primary/50"}`,children:[s," (",t,")"]},s))]}),e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:188",className:"flex flex-wrap gap-3 mb-5",children:[e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:189",className:"bg-card border border-border rounded-lg px-4 py-2 text-sm",children:[e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:190",className:"text-muted-foreground",children:"Showing: "}),e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:191",className:"font-semibold",children:j}),d!=="all"&&e.jsxs("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:193",className:"text-muted-foreground ml-1",children:["of ",q," total"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:196",className:"bg-card border border-border rounded-lg px-4 py-2 text-sm",children:[e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:197",className:"text-muted-foreground",children:"Retryable: "}),e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:198",className:"font-semibold text-amber-400",children:N})]}),e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:200",className:"bg-card border border-border rounded-lg px-4 py-2 text-sm",children:[e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:201",className:"text-muted-foreground",children:"Selected: "}),e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:202",className:"font-semibold text-blue-400",children:n.size})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:207",className:"flex flex-wrap gap-2 mb-4 items-center",children:[e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:208",className:"relative flex-1 min-w-[200px] max-w-sm",children:[e.jsx(U,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:209",className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(T,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:210",className:"pl-8 h-9",placeholder:"Search title, channel, reasonâ¦",value:c,onChange:s=>
11z(s.target.value)})]}),e.jsx("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:218",className:"flex gap-1",children:["all","retryable","permanent"].map(s=>e.jsx(f,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:220",variant:p===s?"default":"outline",size:"sm",onClick:()=>E(s),className:"capitalize",children:s},s))}),e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:232",className:"flex gap-2 ml-auto",children:[e.jsxs(f,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:233",variant:"outline",size:"sm",onClick:()=>V(),disabled:F,children:[e.jsx(H,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:239",className:"h-4 w-4 mr-1"}),"Refresh"]}),e.jsxs(f,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:242",variant:"outline",size:"sm",onClick:B,disabled:n.size===0||C.isPending,children:[e.jsx(I,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:248",className:"h-4 w-4 mr-1"}),"Re-queue Selected (",n.size,")"]}),e.jsxs(f,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:251",variant:"default",size:"sm",onClick:()=>v.mutate(),disabled:N===0||v.isPending,children:[e.jsx(I,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:257",className:"h-4 w-4 mr-1"}),"Re-queue All Retryable (",N,")"]})]})]}),F?e.jsx("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:265",className:"text-muted-foreground text-sm py-12 text-center",children:"Loadingâ¦"}):l.length===0?e.jsx("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:267",className:"text-muted-foreground text-sm py-12 text-center",children:j===0?"No failed videos â great!":"No results match your filter."}):e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:271",className:"rounded-lg border border-border overflow-hidden",children:[e.jsxs("table",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:272",className:"w-full text-sm",children:[e.jsx("thead",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:273",className:"bg-muted/50",children:e.jsxs("tr",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:274",children:[e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:275",className:"w-10 px-3 py-2 text-left",children:e.jsx("button",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:276",onClick:M,className:"flex items-center",children:S?e.jsx(G,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:278",className:"h-4 w-4 text-primary"}):e.jsx(J,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:280",className:"h-4 w-4 text-muted-foreground"})})}),e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:284",className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Video"}),e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:285",className:"px-3 py-2 text-left font-medium text-muted-foreground w-32",children:"Channel"}),e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:286",className:"px-3 py-2 text-left font-medium text-muted-foreground w-28",children:"Date"}),e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:287",className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Failure Reason"}),e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:288",className:"px-3 py-2 text-center font-medium text-muted-foreground w-20",children:"Retries"}),e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:289",className:"px-3 py-2 text-left font-medium text-muted-foreground w-32",children:"Retry After"}),e.jsx("th",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:290",className:"px-3 py-2 w-10"})]})}),e.jsx("tbody",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:293",children:l.map((s,t)=>{const a=b(s.ingestionNote),$=n.has(s.videoId);return e.jsxs("tr",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:298",className:`border-t border-border transition-colors cursor-pointer ${$?"bg-primary/5":t%2===0?"bg-background":"bg-muted/20"} hover:bg-muted/30`,onClick:()=>k(s.videoId),children:[e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:305",className:"px-3 py-2",children:e.jsx(D,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:306",checked:$,onCheckedChange:()=>k(s.videoId),onClick:y=>y.stopPropagation()})}),e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:312",className:"px-3 py-2",children:e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:313",className:"flex items-center gap-2",children:[s.thumbnailUrl&&e.jsx("img",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:315",src:s.thumbnailUrl,alt:"",className:"w-12 h-8 object-cover rounded shrink-0"}),e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:321",className:"line-clamp-1 font-medium",children:s.title})]})}),e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:324",className:"px-3 py-2 text-muted-foreground truncate max-w-[8rem]",children:s.channelName}),e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:327",className:"px-3 py-2 text-muted-foreground whitespace-nowrap",children:s.approxPubDate??"â"}),e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:330",className:"px-3 py-2",children:e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:331",className:"flex items-center gap-1.5",children:[a?e.jsx(Q,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:333",className:"h-3.5 w-3.5 text-amber-400 shrink-0"}):e.jsx(P,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:335",className:"h-3.5 w-3.5 text-red-400 shrink-0"}),e.jsx("span",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:337",className:`text-xs line-clamp-2 ${a?"text-amber-300":"text-red-300"}`,children:s.ingestionNote??"Unknown"})]})}),e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:342",className:"px-3 py-2 text-center",children:e.jsx(O,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:343",variant:"outline",className:"text-xs",children:s.retryCount})}),e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:347",className:"px-3 py-2 text-xs text-muted-foreground whitespace-nowrap",children:K(s.retryAfter)}),e.jsx("td",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:350",className:"px-3 py-2",children:e.jsx("a",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:351",href:s.url,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"text-muted-foreground hover:text-foreground",children:e.jsx(_,{"data-loc":"client/src/pages/AdminFailedVideos.tsx:358",className:"h-4 w-4"})})})]},s.videoId)})})]}),e.jsxs("div",{"data-loc":"client/src/pages/AdminFailedVideos.tsx:366",className:"px-4 py-2 text-xs text-muted-foreground border-t border-border bg-muted/30",children:["Showing ",l.length," of ",j," failed videos"]})]})]})}export{me 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.