import{d as P,t as z,u as Q,a as W,b as X,e as h,f as _,l as y,o as r,h as k,i as a,j as u,k as s,m as o,w as m,n as v,I as $,F as Y,p as M,C as Z,q as U,s as w,v as D,x as B,y as N,z as ee,A as ae}from"./index-d9d21c11.js";const te={class:"chat-info-dialog"},se={class:"chat-info-dialog__title"},oe={key:0,class:"chat-info-dialog__info"},le={class:"chat-info-dialog__info-content"},ne={class:"chat-info-dialog__name"},ie={class:"chat-info-dialog__text"},ce={class:"chat-info-dialog__body"},de={class:"chat-info-dialog__users"},re={class:"chat-info-dialog__users-toolbar"},ue={class:"chat-info-dialog__users-title"},he={class:"chat-info-dialog__users-list"},_e={key:1,class:"chat-info-dialog__body"},ve={class:"chat-info-dialog__users"},fe={class:"chat-info-dialog__users-toolbar"},pe={class:"chat-info-dialog__users-title"},me={class:"chat-info-dialog__users-list"},ge={class:"chat-info-dialog__actions"},be=P({__name:"chat-info-dialog",props:{chat:{}},emits:["close"],setup(A,{emit:I}){const i=A,{contactList:g}=z(Q()),{user:E}=z(W()),{updateMembers:F}=X(),V=["support@3nweb.com"],l=h(!0),f=h(!1),b=h(""),p=h(""),x=h([]),n=h([]),L=_(()=>g.value.filter(e=>V.includes(e.mail)).map(e=>e.id)),q=_(()=>y.size(i.chat.members)>2),j=_(()=>i.chat.admins.includes(E.value)),S=_(()=>g.value.filter(e=>i.chat.members.includes(e.mail))),G=_(()=>S.value.filter(e=>e.displayName.toLowerCase().includes(b.value.toLowerCase()))),O=_(()=>y.isEqual(x.value.slice().sort(),n.value.slice().sort())),C=()=>I("close"),R=()=>{l.value=!1,f.value=!0,p.value=b.value,n.value=y.cloneDeep(S.value.map(e=>e.id)),x.value=y.cloneDeep(n.value)},T=()=>{l.value||(f.value?(f.value=!1,l.value=!0,p.value=""):l.value=!0)},H=e=>{const t=n.value.indexOf(e);t===-1?n.value.push(e):n.value.splice(t,1)},J=()=>{const e=g.value.reduce((t,c)=>{const{id:d,mail:K}=c;return n.value.includes(d)&&t.push(K),t},[]);F(i.chat,e),C()};return(e,t)=>{const c=ee;return r(),k("div",te,[a("div",se,[u(s(e.$tr("chat.info.dialog.title"))+" ",1),o(c,{round:"",size:"mini",onClick:C},{default:m(()=>[o(v($),{icon:"baseline-close",width:"16",height:"16",color:"#828282"})]),_:1})]),a("div",{class:N(["chat-info-dialog__content",{"chat-info-dialog__content--without-avatar":!l.value}])},[f.value?(r(),k("div",_e,[a("div",ve,[a("div",fe,[a("div",pe,[o(v($),{icon:"round-person-outline",width:"20",height:"20",color:"var(--black-90)"}),u(" "+s(e.$tr("chat.info.dialog.update.members.btn.text")),1)])]),o(D,{value:p.value,"onUpdate:value":t[2]||(t[2]=d=>p.value=d),icon:"round-search",clearable:"",placeholder:e.$tr("chat.info.dialog.search.input.placeholder"),onFocus:t[3]||(t[3]=d=>l.value=!1)},null,8,["value","placeholder"]),a("div",me,[o(B,{"contact-list":v(g),"search-text":p.value,"without-anchor":!0,"selected-contacts":n.value,"non-selectable-contacts":L.value,onSelect:H},null,8,["contact-list","search-text","selected-contacts","non-selectable-contacts"])])])])):(r(),k(Y,{key:0},[l.value?(r(),k("div",oe,[o(Z,{name:v(M)(i.chat),size:"64",shape:q.value?"decagon":"circle"},null,8,["name","shape"]),a("div",le,[a("span",ne,s(v(M)(i.chat)),1),a("span",ie,s(i.chat.members.length)+" "+s(e.$tr("chat.info.dialog.users")),1)])])):U("",!0),a("div",ce,[a("div",de,[a("div",re,[a("div",ue,[o(v($),{icon:"outline-account-circle",width:"20",height:"20",color:"var(--black-90)"}),u(" "+s(e.$tr("chat.info.dialog.users")),1)]),j.value?(r(),w(c,{key:0,type:"primary",text:"",size:"small",onClick:R},{default:m(()=>[u(s(e.$tr("chat.info.dialog.update.members.btn.text")),1)]),_:1})):U("",!0)]),o(D,{value:b.value,"onUpdate:value":t[0]||(t[0]=d=>b.value=d),icon:"round-search",clearable:"",placeholder:e.$tr("chat.info.dialog.search.input.placeholder"),onFocus:t[1]||(t[1]=d=>l.value=!1)},null,8,["value","placeholder"]),a("div",he,[o(B,{"contact-list":G.value,"without-anchor":!0,readonly:!0},null,8,["contact-list"])])])])],64))],2),a("div",ge,[o(c,{class:N({"chat-info-dialog__btn--hidden":l.value}),type:"primary",text:"",size:"small",onClick:T},{default:m(()=>[u(s(e.$tr("chat.info.dialog.btn.back.text")),1)]),_:1},8,["class"]),f.value?(r(),w(c,{key:1,type:"primary",size:"small",disabled:O.value,onClick:J},{default:m(()=>[u(s(e.$tr("chat.info.dialog.btn.update.text")),1)]),_:1},8,["disabled"])):(r(),w(c,{key:0,type:"primary",text:"",size:"small",onClick:C},{default:m(()=>[u(s(e.$tr("chat.info.dialog.btn.close.text")),1)]),_:1}))])])}}});const ke=ae(be,[["__scopeId","data-v-a1842010"]]);export{ke as default};
