import{j as e}from"./@radix-DAoBbclx.js";import{w as v,bw as S,e as g,I as j,B as y,bA as N,bZ as b,bs as w,x as E,k as F}from"./index-DnCFURX3.js";import{u as I}from"./update-server-settings-mutation-COzvXCyc.js";import{z as n,u as K,t as P}from"./@zod-3snSrKBm.js";import{h as k}from"./@tanstack-2852wz5w.js";import{a as q}from"./@monaco-editor-Di1Jq_O0.js";import"./@elkjs-CmhuJAjY.js";import"./@react-router-BTai9D5g.js";import"./@reactflow-CLotj7HR.js";const B=n.object({serverName:n.string().min(1)});function G(){var i;const r=q.useId(),{toast:t}=v(),a=k(),{isError:o,isPending:l,data:m}=S({throwOnError:!0}),{mutate:c,isPending:u}=I({onError(s){w(s)&&t({status:"error",emphasis:"subtle",icon:e.jsx(E,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:s.message,rounded:!0})},onSuccess:async()=>{a.invalidateQueries({queryKey:N()}),a.invalidateQueries({queryKey:b()}),t({status:"success",emphasis:"subtle",rounded:!0,description:"Server Settings updated successfully"}),p()}}),{handleSubmit:d,register:x,reset:p,formState:{isValid:f}}=K({resolver:P(B)});function h(s){c({server_name:s.serverName})}return o?null:l?e.jsx(g,{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(j,{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(y,{disabled:u||!f,size:"md",intent:"primary",children:"Update"})})]})})}function T(){return e.jsxs(F,{className:"flex flex-col gap-5 p-5",children:[e.jsx("h1",{className:"text-text-xl font-semibold",children:"General"}),e.jsx(G,{})]})}export{T as default};
