import{u as l,a as r,b as u}from"./vendor-query-BbgYCJYB.js";import{e as t,d as c}from"./index-BoGb7ncW.js";import{i}from"./vendor-i18n-DzUOdQ2j.js";function y(){return l({queryKey:["channels"],queryFn:()=>t.get("/channels").then(e=>e.data)})}function f(){const e=r();return u({mutationFn:({name:n,data:a})=>t.patch(`/channels/${n}`,a).then(s=>s.data),onSuccess:()=>{e.invalidateQueries({queryKey:["channels"]}),c.success(i.t("channels.saved"))}})}function q(){const e=r();return u({mutationFn:n=>t.post(`/channels/${n}/reload`).then(a=>a.data),onSuccess:()=>{e.invalidateQueries({queryKey:["channels"]}),c.success(i.t("channels.reloaded"))}})}function m(){const e=r();return u({mutationFn:()=>t.post("/channels/reload-all").then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:["channels"]}),c.success(i.t("channels.reloadedAll"))}})}function p(){const e=r();return u({mutationFn:({name:n,enabled:a})=>t.patch(`/channels/${n}`,{enabled:a}).then(s=>s.data),onSuccess:()=>{e.invalidateQueries({queryKey:["channels"]})}})}function Q(){return u({mutationFn:()=>t.post("/channels/weixin/qr/start").then(e=>e.data)})}function x(e){return l({queryKey:["weixin-qr-status",e],queryFn:()=>t.get(`/channels/weixin/qr/status?qrcode_id=${e}`).then(n=>n.data),enabled:!!e,refetchInterval:n=>{var s;const a=(s=n.state.data)==null?void 0:s.status;return a==="confirmed"||a==="expired"?!1:2e3}})}export{f as a,q as b,m as c,p as d,Q as e,x as f,y as u};
