import{d as x,S as f,c as m,a as t,t as g,e as y,b as _,v as k,z as w,r as n,g as h,aa as C,i as V,o as c}from"./index-zfm-9r65.js";import{_ as D}from"./UserSearchPicker.vue_vue_type_script_setup_true_lang-CGEMzAqu.js";const R={class:"h-full overflow-y-auto p-6"},S={class:"space-y-4 rounded-lg border border-slate-800 bg-slate-900/70 p-4"},M={key:0,class:"text-sm text-rose-300"},N={class:"block"},B={class:"space-y-2 rounded-md border border-slate-800 bg-slate-950/60 p-3"},E={class:"flex items-center gap-2 border-t border-slate-800 pt-3"},U=["disabled"],A=["disabled"],I=x({__name:"DirectMessageCreateView",setup($){const i=f(),u=V(),s=n(!1),r=n(null),d=n(""),l=n([]),p=h(()=>i.allServerDomains());async function b(){if(!s.value){if(l.value.length===0){r.value="Select at least one member.";return}s.value=!0,r.value=null;try{const a=l.value.map(o=>C(o)),e=await i.homeClient.createDirectMessageRoom({name:d.value.trim(),memberlist:a});u.push({name:"direct-message-room",params:{roomId:e.id}})}catch(a){r.value=a instanceof Error?a.message:String(a)}finally{s.value=!1}}}function v(){u.push({name:"direct-messages"})}return(a,e)=>(c(),m("section",R,[e[5]||(e[5]=t("header",{class:"mb-4"},[t("p",{class:"text-xs uppercase tracking-wide text-slate-400"},"Direct messages"),t("h1",{class:"mt-1 text-2xl font-semibold text-slate-100"},"Create conversation")],-1)),t("div",S,[r.value?(c(),m("p",M,g(r.value),1)):y("",!0),t("label",N,[e[3]||(e[3]=t("span",{class:"mb-1 block text-xs uppercase tracking-wide text-slate-400"},"Room name",-1)),_(t("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>d.value=o),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",placeholder:"Optional room name"},null,512),[[k,d.value]])]),t("div",B,[e[4]||(e[4]=t("p",{class:"text-xs uppercase tracking-wide text-slate-400"},"Members",-1)),w(D,{modelValue:l.value,"onUpdate:modelValue":e[1]||(e[1]=o=>l.value=o),mode:"dm",multiple:"","server-domains":p.value,disabled:s.value},null,8,["modelValue","server-domains","disabled"])]),t("div",E,[t("button",{type:"button",class:"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 cursor-pointer",disabled:s.value,onClick:e[2]||(e[2]=o=>{b()})}," Create ",8,U),t("button",{type:"button",class:"rounded-md border border-slate-700 px-3 py-2 text-sm text-slate-200 transition hover:bg-slate-800 disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer",disabled:s.value,onClick:v}," Cancel ",8,A)])])]))}});export{I as default};
//# sourceMappingURL=DirectMessageCreateView-BvM88xPm.js.map
