import{n as u,u as j,j as s,k as o,B as d,l as m}from"./index-DXI13nSQ.js";import{T as f,a as k,b as x,c as r,d as p,e as n}from"./table-oUi0mGOn.js";import{d as g,e as b}from"./use-background-tasks-BkUIDOxX.js";import{L as N}from"./loader-circle-BS5FFFg-.js";import{R as v}from"./refresh-ccw-BPKXoMZa.js";import{C as w}from"./circle-x-8dhkvHlT.js";import"./react-Cb2sDjhD.js";import"./useQuery-CEwGD94N.js";/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const y=u("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);function H(){const{t:e}=j(["tasks","common"]),t=g(),i=b();async function h(a){if(confirm(e("asks.cancelConfirm",{id:a.slice(0,8)})))try{await i.mutateAsync(a),m.success(e("asks.cancelledToast"))}catch(l){m.error(l?.message??String(l))}}const c=t.data?.pending??[];return s.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-4 p-4",children:[s.jsxs("header",{className:"flex items-center gap-3",children:[s.jsx(y,{className:"h-5 w-5 text-text-dim"}),s.jsx("h1",{className:"text-xl font-semibold",children:e("asks.title")}),s.jsx(o,{variant:"info",children:c.length}),s.jsxs(d,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>void t.refetch(),disabled:t.isFetching,"aria-label":e("actions.refresh",{ns:"common"}),children:[t.isFetching?s.jsx(N,{className:"h-4 w-4 animate-spin"}):s.jsx(v,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:e("asks.refresh")})]})]}),s.jsx("p",{className:"text-sm text-text-dim",children:e("asks.subtitle")}),t.isLoading?s.jsx("div",{className:"h-32 rounded-md bg-surface-2 animate-pulse"}):c.length===0?s.jsx("section",{className:"rounded-md border border-border bg-surface p-6 text-center text-sm text-text-dim",children:e("asks.empty")}):s.jsx("section",{className:"rounded-md border border-border bg-surface",children:s.jsxs(f,{children:[s.jsx(k,{children:s.jsxs(x,{children:[s.jsx(r,{children:e("asks.col.reqId")}),s.jsx(r,{children:e("asks.col.thread")}),s.jsx(r,{children:e("asks.col.question")}),s.jsx(r,{children:e("asks.col.choices")}),s.jsx(r,{children:e("asks.col.age")}),s.jsx(r,{children:e("asks.col.actions")})]})}),s.jsx(p,{children:c.map(a=>s.jsxs(x,{children:[s.jsxs(n,{className:"font-mono text-[11px]",children:[a.reqId.slice(0,8),"…"]}),s.jsxs(n,{className:"font-mono text-[11px]",children:[a.platform,":",a.threadId]}),s.jsx(n,{className:"max-w-md break-words",children:a.question}),s.jsx(n,{children:s.jsx(o,{variant:"outline",children:a.choices})}),s.jsx(n,{className:"text-xs text-text-dim",children:C(a.ageMs,e)}),s.jsx(n,{children:s.jsxs(d,{variant:"ghost",size:"sm",onClick:()=>void h(a.reqId),disabled:i.isPending,className:"text-danger hover:text-danger",children:[s.jsx(w,{className:"h-4 w-4"}),e("asks.cancel")]})})]},a.reqId))})]})})]})}function C(e,t){return e<1e3?t("asks.justNow"):e<6e4?t("asks.seconds",{count:Math.floor(e/1e3)}):e<36e5?t("asks.minutes",{count:Math.floor(e/6e4)}):t("asks.hours",{count:Math.floor(e/36e5)})}export{H as default};
//# sourceMappingURL=asks-BaVT-eFe.js.map
