import{u,a as r,b as c,k as b}from"./vendor-query-BbgYCJYB.js";import{d as a,e as t}from"./index-BoGb7ncW.js";import{i}from"./vendor-i18n-DzUOdQ2j.js";function q(){return u({queryKey:["cron","jobs"],queryFn:()=>t.get("/cron/jobs").then(e=>e.data),refetchInterval:3e4})}function j(){const e=r();return c({mutationFn:n=>t.post("/cron/jobs",n).then(s=>s.data),onSuccess:()=>{e.invalidateQueries({queryKey:["cron","jobs"]}),a.success(i.t("cron.created"))}})}function C(){const e=r();return c({mutationFn:({id:n,...s})=>t.put(`/cron/jobs/${n}`,s).then(o=>o.data),onSuccess:()=>{e.invalidateQueries({queryKey:["cron","jobs"]}),a.success(i.t("cron.saved"))}})}function g(){const e=r();return c({mutationFn:n=>t.delete(`/cron/jobs/${n}`).then(s=>s.data),onSuccess:()=>{e.invalidateQueries({queryKey:["cron","jobs"]}),a.success(i.t("cron.deleted"))}})}function v(){const e=r();return c({mutationFn:({id:n,enabled:s})=>t.patch(`/cron/jobs/${n}/enabled`,{enabled:s}).then(o=>o.data),onSuccess:()=>{e.invalidateQueries({queryKey:["cron","jobs"]})}})}function S(e){const n=(e==null?void 0:e.jobId)??null,s=(e==null?void 0:e.search)??null;return u({queryKey:["cron","sessions",{jobId:n,search:s}],queryFn:()=>{const o=new URLSearchParams;n&&o.set("job_id",n),s&&o.set("search",s);const d=o.toString();return t.get(`/cron/sessions${d?`?${d}`:""}`).then(l=>l.data)},placeholderData:b,refetchInterval:15e3})}function F(e){return u({queryKey:["cron","sessions",e,"messages"],queryFn:()=>t.get(`/cron/sessions/${encodeURIComponent(e)}/messages`).then(n=>n.data),enabled:!!e,placeholderData:b,refetchInterval:1e4})}export{j as a,C as b,g as c,v as d,S as e,F as f,q as u};
