1import{f as e,j as t,a1 as a,u as n}from"./index-CpSDEIFT.js";import{c as s}from"./axios-ClGXtqae.js";import{r as i}from"./react-vendor-BR2bEzcq.js";const r="event-templates";function o(t={}){const{selectedGuildId:a}=n(),{data:i,isLoading:o,error:u,refetch:c}=e({queryKey:[r,a,t],queryFn:async({signal:e})=>{const a={};t.eventType&&(a.eventType=t.eventType),t.page&&(a.page=t.page),t.pageSize&&(a.pageSize=t.pageSize);const{data:n}=await s.get("/api/event-templates",{params:a,signal:e,withCredentials:!0});return n},enabled:!!a,staleTime:6e4});return{templates:i?.templates||[],total:i?.pagination?.total||0,isLoading:o,error:u,refetch:c}}function u(t){const{data:a,isLoading:n,error:i}=e({queryKey:[r,"single",t],queryFn:async({signal:e})=>{const{data:a}=await s.get(`/api/event-templates/${t}`,{signal:e,withCredentials:!0});return a},enabled:!!t,staleTime:6e4});return{template:a?.template||null,isLoading:n,error:i}}function c(){const e=t(),n=a({mutationFn:async e=>{const{data:t}=await s.post("/api/event-templates",e,{withCredentials:!0});return t},onSuccess:()=>{e.invalidateQueries({queryKey:[r]})}});return{create:i.useCallback(e=>n.mutateAsync(e),[n]),...n}}function l(){const e=t(),n=a({mutationFn:async({id:e,...t})=>{const{data:a}=await s.put(`/api/event-templates/${e}`,t,{withCredentials:!0});return a},onSuccess:()=>{e.invalidateQueries({queryKey:[r]})}});return{update:i.useCallback(e=>n.mutateAsync(e),[n]),...n}}function p(){const e=t(),n=a({mutationFn:async e=>{const{data:t}=await s.delete(`/api/event-templates/${e}`,{withCredentials:!0});return t},onSuccess:()=>{e.invalidateQueries({queryKey:[r]})}});return{remove:i.useCallback(e=>n.mutateAsync(e),[n]),...n}}function d(){const{data:t,isLoading:a,error:n}=e({queryKey:[r,"presets"],queryFn:async({signal:e})=>{const{data:t}=await s.get("/api/event-templates/presets",{signal:e,withCredentials:!0});return t},staleTime:1/0});return{presets:t?.presets||[],isLoading:a,error:n}}function m(){const e=t(),n=a({mutationFn:async({id:e,name:t})=>{const{data:a}=await s.post(`/api/event-templates/${e}/clone`,{name:t},{withCredentials:!0});return a},onSuccess:()=>e.invalidateQueries({queryKey:[r]})});return{clone:i.useCallback(e=>n.mutateAsync(e),[n]),...n}}export{c as a,l as b,u as c,p as d,m as e,d as f,o as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.