import{r as v,j as e}from"./@radix-B1sy0Lhr.js";import{z as n,v as S,aU as g,d as j,I as y,B as N,aY as b,bd as w,aP as E,w as F,k as I}from"./index-CO6UN3UX.js";import{u as P}from"./update-server-settings-mutation-s7tlHN8s.js";import{t as K}from"./zod-D48zuELD.js";import{h as k}from"./@tanstack-Dwlisomv.js";import{u as q}from"./index.esm-SBF9nn_P.js";import"./@react-router-CHjLNlgw.js";import"./@reactflow-gbyyU3kq.js";const B=n.object({serverName:n.string().min(1)});function G(){var i;const r=v.useId(),{toast:t}=S(),a=k(),{isError:o,isPending:l,data:m}=g({throwOnError:!0}),{mutate:c,isPending:u}=P({onError(s){E(s)&&t({status:"error",emphasis:"subtle",icon:e.jsx(F,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:s.message,rounded:!0})},onSuccess:async()=>{a.invalidateQueries({queryKey:b()}),a.invalidateQueries({queryKey:w()}),t({status:"success",emphasis:"subtle",rounded:!0,description:"Server Settings updated successfully"}),p()}}),{handleSubmit:d,register:x,reset:p,formState:{isValid:f}}=q({resolver:K(B)});function h(s){c({server_name:s.serverName})}return o?null:l?e.jsx(j,{className:"h-[150px] max-w-[600px]"}):e.jsx("div",{className:"w-full max-w-[600px]",children:e.jsxs("form",{className:"space-y-2",onSubmit:d(h),children:[e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("label",{htmlFor:r,className:"text-text-sm",children:"Server Name"}),e.jsx(y,{placeholder:(i=m.body)==null?void 0:i.server_name,...x("serverName"),id:r,className:"w-full"})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{disabled:u||!f,size:"md",intent:"primary",children:"Update"})})]})})}function R(){return e.jsxs(I,{className:"flex flex-col gap-5 p-5",children:[e.jsx("h1",{className:"text-text-xl font-semibold",children:"General"}),e.jsx(G,{})]})}export{R as default};
