1import{j as e}from"./app-C1iegf7Q.js";import{b as a,H as d,L as l,f as o}from"./inertia-BpyZy4w-.js";import{W as m}from"./whatsapp-digest-output-BLLEplbC.js";import{a as p}from"./admin-layout-BhXWbUlP.js";import{a as u}from"./utils-BiuKVCuu.js";import{A as x}from"./arrow-left-DCX0fhKH.js";/* empty css */import"./check-0O-UND6N.js";import"./createLucideIcon-wqc1LSWg.js";import"./clipboard-DVTW5dV8.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./info-D2ZN_yLm.js";import"./triangle-alert-C7AVwNi-.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./x-DQSeRCcH.js";import"./menu-BR3Nc3Gr.js";import"./users-BCcupCXV.js";import"./folder-open-I72SPUVk.js";import"./pound-sterling-D16GLaAZ.js";import"./book-open-DVFlG_9t.js";const c={completed:"bg-green/10 text-green-ink",running:"bg-amber/12 text-amber-ink",pending:"bg-amber/12 text-amber-ink",failed:"bg-red/10 text-red"},g={completed:"Done",running:"Running",pending:"Queued",failed:"Failed"};function b({digest:s}){const[n,i]=a.useState(!1),t=s.latest_run;function r(){i(!0),o.post(`/admin/assistants/${s.slug}/run`,{},{onFinish:()=>i(!1)})}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-ink",children:s.label}),t&&e.jsx("span",{className:u("rounded-tag px-2 py-0.5 text-2xs font-bold",c[t.status]??"bg-bg-2 text-ink-3"),children:g[t.status]??t.status}),t&&e.jsxs("span",{className:"text-2xs text-ink-3",children:["Week of ",t.week_of_label,t.tokens_used&&` · ${t.tokens_used.toLocaleString()} tokens`]}),e.jsx("button",{type:"button",onClick:r,disabled:n||t?.status==="running",className:"ml-auto rounded-md border border-line px-2.5 py-1 text-2xs font-medium text-ink-2 hover:bg-bg disabled:opacity-40",children:n?"Queuingâ¦":"Run just this one"})]}),t?.status==="completed"&&t.output?e.jsx(m,{output:t.output}):t?.status==="failed"?e.jsxs("div",{className:"rounded-card border border-red/20 bg-red/5 p-4",children:[e.jsx("p",{className:"text-sm font-semibold text-red mb-1",children:"Run failed"}),e.jsx("p",{className:"text-xs text-red/80 font-mono",children:t.error})]}):t?.status==="running"||t?.status==="pending"?e.jsx("div",{className:"rounded-card border border-line bg-white p-6 text-center",children:e.jsx("p",{className:"text-sm text-ink-3",children:"Run in progress. Refresh in a moment."})}):e.jsx("div",{className:"rounded-card border border-line bg-white p-6 text-center",children:e.jsx("p",{className:"text-sm text-ink-3",children:"No runs yet."})})]})}function V({digests:s}){const[n,i]=a.useState(!1);function t(){i(!0),o.post("/admin/assistants/whatsapp/run-all",{},{onFinish:()=>i(!1)})}return e.jsxs(p,{children:[e.jsx(d,{title:"Admin · WhatsApp Digests"}),e.jsxs("div",{className:"px-6 py-7 max-w-3xl",children:[e.jsxs(l,{href:"/admin/assistants",className:"mb-3 inline-flex items-center gap-1.5 text-xs text-ink-3 hover:text-ink",children:[e.jsx(x,{className:"h-3.5 w-3.5"})," All assistants"]}),e.jsxs("div",{className:"mb-6 flex items-baseline gap-3",children:[e.jsx("h1",{className:"text-lg font-semibold text-ink",children:"WhatsApp Community Digests"}),e.jsx("button",{type:"button",onClick:t,disabled:n,className:"ml-auto rounded-md bg-ink px-3 py-1.5 text-xs font-semibold text-white hover:bg-ink/80 disabled:opacity-40",children:n?"Queuingâ¦":"Run all"})]}),e.jsx("p",{className:"mb-6 -mt-4 text-xs text-ink-3",children:"Four independent weekly digests, reviewed together. Each keeps its own schedule and run history â Announcements Friday, Jobs Monday, GTV Tuesday, IFV Wednesday."}),e.jsx("div",{className:"space-y-8",children:s.map(r=>e.jsx(b,{digest:r},r.slug))})]})]})}export{V 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.