import{j as e}from"./@radix-DAoBbclx.js";import{J as l,N as D,O as f,B as i,Q as j,R as g,U as R,K as b,L as d}from"./index-DnCFURX3.js";import{S as c}from"./trash-DsZfFPdX.js";import{D as u,a as h}from"./DeleteAlertDialog-B-lA-7-t.js";import{a as m}from"./@monaco-editor-Di1Jq_O0.js";import{c as w}from"./helper-CKgq8caL.js";import{u as y}from"./delete-run-ldams52s.js";import{u as C}from"./bulk-delete-CtPYv6hb.js";const{ContextProvider:M,useContext:a}=w();function x(){const{setRowSelection:t}=a(),{mutateAsync:s}=y();async function n(r){await s({runId:r})}return C({deleteFn:n,queryKeyToInvalidate:["runs"],setRowSelection:t})}function z({id:t}){const[s,n]=m.useState(!1),{bulkDelete:r}=x();async function o(){await r([t]),n(!1)}return e.jsxs(e.Fragment,{children:[e.jsx(l,{open:s,onOpenChange:n,children:e.jsx(u,{title:"Delete Run",handleDelete:o,children:e.jsxs(h,{children:[e.jsx("p",{children:"Are you sure?"}),e.jsx("p",{children:"This action cannot be undone."})]})})}),e.jsxs(D,{children:[e.jsx(f,{asChild:!0,children:e.jsx(i,{intent:"secondary",emphasis:"minimal",className:"flex aspect-square items-center justify-center p-0",children:e.jsx(j,{className:"h-4 w-4 shrink-0 fill-theme-text-tertiary"})})}),e.jsx(g,{align:"end",sideOffset:7,children:e.jsx(R,{onSelect:()=>n(!0),icon:e.jsx(c,{}),children:"Delete"})})]})]})}function v(){const[t,s]=m.useState(!1),{selectedRowCount:n,selectedRowIDs:r}=a(),{bulkDelete:o}=x();async function p(){await o(r),s(!1)}return e.jsxs(l,{open:t,onOpenChange:s,children:[e.jsx(b,{asChild:!0,children:e.jsxs(i,{className:"rounded-sharp border-y-0 bg-white",size:"md",emphasis:"subtle",intent:"secondary",children:[e.jsx(c,{className:"h-5 w-5 shrink-0 gap-1 fill-neutral-400"}),"Delete"]})}),e.jsx(u,{title:`Delete ${d(n,"Run")}`,handleDelete:p,children:e.jsxs(h,{children:[e.jsx("p",{children:"Are you sure?"}),e.jsx("p",{children:"This action cannot be undone."})]})})]})}function $(){const{selectedRowCount:t}=a();return e.jsxs("div",{className:"flex items-center divide-x divide-theme-border-moderate overflow-hidden rounded-md border border-theme-border-moderate",children:[e.jsx("div",{className:"bg-primary-25 px-2 py-1 font-semibold text-theme-text-brand",children:`${t} ${d(t,"Run")} selected`}),e.jsx(v,{})]})}export{M as R,z as a,$ as b,a as u};
