import{j as s}from"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d15.js";import{r as m}from"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d1.js";import{ad as w,u as C,n as U,z as y}from"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d123.js";import{u as S}from"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d14.js";import{r as T,al as q,u as E}from"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d17.js";import{U as F}from"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d173.js";import"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d13.js";import"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d19.js";import"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d110.js";import"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d12.js";import"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d18.js";import"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d120.js";import"./v_7_4_3_40_a1f3a86e-ffe7-4e8d-af35-2585c84ec3d16.js";function G(){const{variaveisWA:t}=w(),{userTabs:o,setNewUser:p,setRemoveUser:u}=C(),{language:r}=S(),{close:h}=U(),l=y(e=>e.activeChat?.id),n=l.server==="@lid"?l._serialized:l.user,x=F(),[f,v]=m.useState(""),[c,g]=m.useState([]),j=async e=>{e.chats.find(i=>i.id===n)?u(n,!1,e.id):p(n,e.id)},b=s.jsxs("div",{className:"p-4 flex flex-col gap-2",children:[s.jsx("span",{children:r.emptyAba}),s.jsx(T,{name:r.create,funcao:()=>{h(),x()}})]}),A=s.jsx("div",{className:"p-4 text-center",children:s.jsx("span",{children:r.notFound})}),d=s.jsx(q,{filtragem:e=>{let a=[];o.forEach(i=>{i.tag?.toUpperCase().includes(e.toUpperCase())&&a.push(i)}),g(a),v(e)},placeholder:r.pesquisarAbas,dependenciasADD:[o],btnClear:!0}),N=s.jsx("div",{className:t.modalOptions.content3+"overflow-auto max-w-[350px]",style:{maxHeight:"calc(100vh - 200px)"},children:c.slice().sort((e,a)=>e.tag.localeCompare(a.tag)).map((e,a)=>s.jsx("div",{className:t.listagem.content1+"hoverShadown",children:s.jsx("li",{tabIndex:1,className:t.listagem.content2,"data-animate-dropdown-item":"true",style:{opacity:1},children:s.jsx("label",{htmlFor:"user_tab&"+a,children:s.jsxs("div",{className:t.listagem.content3,children:[s.jsx("div",{className:t.listagem.content4,children:s.jsx(E,{id:"user_tab&"+a,estado:!!e.chats.find(i=>i.id===n),checkedUpdade:()=>{j(e)}})}),s.jsxs("span",{className:t.listagem.content5+" flex",children:[s.jsx("span",{className:"pr-1 overflow-hidden text-ellipsis whitespace-nowrap",children:e.tag}),s.jsx("span",{className:t.aba+"tam-aba bg-[var(--primaria)] !text-[var(--letra)]",children:e.chats.length})]})]})})})},a))});return f.length>0&&c.length===0?s.jsxs("div",{children:[d,A]}):o.length>0?s.jsxs("div",{children:[d,N]}):b}export{G as default};
