import{d as h,S as N,a6 as D,J as E,c as d,a as s,t as f,e as V,b as y,v as S,g as B,r as l,o as u}from"./index-zfm-9r65.js";const C={class:"h-full overflow-y-auto p-6"},U={key:0,class:"text-sm text-slate-400"},F={key:1,class:"text-sm text-rose-300"},M={key:2,class:"space-y-4 rounded-lg border border-slate-800 bg-slate-900/70 p-4"},O={key:0,class:"text-sm text-rose-300"},j={class:"block"},q=["disabled"],A={class:"block"},J=["disabled"],L={class:"flex items-center gap-2 border-t border-slate-800 pt-3"},P=["disabled"],z=h({__name:"ServerSettingsServerView",setup(T){const g=N(),_=D(),c=B(()=>_.canUpdateServerSettings()),b=l(!1),v=l(null),p=l(!1),r=l(null),n=l(""),i=l(""),m=l(""),x=l("");async function k(){b.value=!0,v.value=null;try{const t=await g.client.getServerSettings();n.value=t.name,i.value=t.description,m.value=t.name,x.value=t.description}catch(t){v.value=t instanceof Error?t.message:"Failed to load server settings"}finally{b.value=!1}}async function w(){if(p.value||!c.value)return;const t=n.value.trim(),e=i.value.trim();if(!t){r.value="Name is required.";return}const a={};if(t!==m.value&&(a.name=t),e!==x.value&&(a.description=e),Object.keys(a).length===0){r.value="No changes to save.";return}p.value=!0,r.value=null;try{const o=await g.client.patchServerSettings(a);n.value=o.name,i.value=o.description,m.value=o.name,x.value=o.description}catch(o){r.value=o instanceof Error?o.message:"Failed to save server settings"}finally{p.value=!1}}return E(()=>{k()}),(t,e)=>(u(),d("section",C,[e[5]||(e[5]=s("header",{class:"mb-4"},[s("p",{class:"text-xs uppercase tracking-wide text-slate-400"},"Server settings"),s("h1",{class:"mt-1 text-2xl font-semibold text-slate-100"},"Server")],-1)),b.value?(u(),d("p",U,"Loading server settings...")):v.value?(u(),d("p",F,f(v.value),1)):(u(),d("div",M,[r.value?(u(),d("p",O,f(r.value),1)):V("",!0),s("label",j,[e[3]||(e[3]=s("span",{class:"mb-1 block text-xs uppercase tracking-wide text-slate-400"},"Name",-1)),y(s("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>n.value=a),type:"text",class:"w-full rounded-md border border-slate-700 bg-slate-950 px-3 py-2 text-sm text-slate-100 outline-none focus:border-blue-400 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"Server name",disabled:!c.value},null,8,q),[[S,n.value]])]),s("label",A,[e[4]||(e[4]=s("span",{class:"mb-1 block text-xs uppercase tracking-wide text-slate-400"},"Description",-1)),y(s("textarea",{"onUpdate:modelValue":e[1]||(e[1]=a=>i.value=a),rows:"3",class:"w-full rounded-md border border-slate-700 bg-slate-950 px-3 py-2 text-sm text-slate-100 outline-none focus:border-blue-400 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"Optional description",disabled:!c.value},null,8,J),[[S,i.value]])]),s("div",L,[s("button",{type:"button",class:"cursor-pointer rounded-md border border-blue-400/50 bg-blue-500/20 px-3 py-2 text-sm text-blue-100 transition hover:bg-blue-500/30 disabled:cursor-not-allowed disabled:opacity-50",disabled:p.value||!c.value,onClick:e[2]||(e[2]=a=>{w()})}," Save ",8,P)])]))]))}});export{z as default};
//# sourceMappingURL=ServerSettingsServerView-B7D591Kx.js.map
