import{r as x,j as r}from"./vendor-react-wBh_31cN.js";import{G as u}from"./index-dNe6i2rS.js";import{t as m}from"./toast-wiGcevcF.js";import{a as d,ag as j}from"./vendor-icons-BUUmD6ht.js";const b=({configName:t,enabled:a,name:o,setValue:e,onToggle:i,isLoading:n,onUpdateSuccess:l})=>{const c=x.useCallback(p=>{p.stopPropagation();const s=!a;i(s).then(()=>{l(),e(`${o}.enabled`,s),m.success(`Monitoring ${t} is ${s?"resumed":"paused"} successfully`)}).catch(()=>{m.error(`Failed to ${s?"resume":"pause"} ${t}`)})},[t,a,o,i,l,e]);return a?r.jsxs(u,{variant:"outline",size:"sm",onClick:c,loading:n,children:[r.jsx(d,{className:"size-3.5"}),"Disable"]}):r.jsxs(u,{size:"sm",onClick:c,loading:n,children:[r.jsx(j,{className:"size-3.5"}),"Enable"]})};export{b as E};
