import{u,b as m,a as p}from"./query-PJ0ZdjbV.js";import{p as a}from"./index-BSPIaiZU.js";const s="/data-io",o={templates:["data-io","templates"],registry:["data-io","registry"],imports:t=>["data-io","imports",t],import:t=>["data-io","imports",t],exports:t=>["data-io","exports",t],export:t=>["data-io","exports",t]};function c(){return u({queryKey:o.registry,queryFn:()=>a.get(`${s}/imports/registry/`).then(t=>t.data),staleTime:300*1e3})}function l(){return u({queryKey:o.templates,queryFn:()=>a.get(`${s}/templates/`).then(t=>t.data.results)})}function q(){return u({queryKey:o.imports(),queryFn:()=>a.get(`${s}/imports/`).then(t=>t.data)})}function g(t,e=!0){return u({queryKey:o.import(t),queryFn:()=>a.get(`${s}/imports/${t}/`).then(r=>r.data),enabled:!!t&&e,refetchInterval:r=>{var i;const n=(i=r.state.data)==null?void 0:i.status;return n==="pending"||n==="validating"||n==="committing"?2e3:!1}})}function f(){const t=m();return p({mutationFn:e=>a.post(`${s}/imports/`,e,{headers:{"Content-Type":void 0}}).then(r=>r.data),onSuccess:()=>t.invalidateQueries({queryKey:["data-io","imports"]})})}function x(){const t=m();return p({mutationFn:e=>a.post(`${s}/imports/${e}/commit/`).then(r=>r.data),onSuccess:e=>{t.invalidateQueries({queryKey:o.import(e.id)}),t.invalidateQueries({queryKey:["data-io","imports"]})}})}function h(){return u({queryKey:o.exports(),queryFn:()=>a.get(`${s}/exports/`).then(t=>t.data)})}function $(t,e=!0){return u({queryKey:o.export(t),queryFn:()=>a.get(`${s}/exports/${t}/`).then(r=>r.data),enabled:!!t&&e,refetchInterval:r=>{var i;const n=(i=r.state.data)==null?void 0:i.status;return n==="pending"||n==="processing"?2e3:!1}})}function K(){const t=m();return p({mutationFn:e=>a.post(`${s}/exports/`,e).then(r=>r.data),onSuccess:()=>t.invalidateQueries({queryKey:["data-io","exports"]})})}function b(){return p({mutationFn:t=>a.get(`${s}/exports/${t}/download/`,{responseType:"blob"}).then(e=>e.data)})}export{x as a,l as b,f as c,q as d,h as e,K as f,c as g,b as h,$ as i,g as u};
