import{j as e,bH as v,ao as w,Z as N,Q as b,h as y,I as C}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf10.js";import{a as A}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf4.js";import{u as L}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf19.js";import{u as _}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf29.js";import{u as k}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf126.js";import{V as T}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf229.js";import{A as E,L as H}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf5.js";import{b as M}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf152.js";import{a as S}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf109.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf18.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf6.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf8.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf7.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf23.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf9.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf2.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf3.js";function $(){var c,d;const{setViewContatos:n}=k(),{agrupamentos:t,setAgrupamentos:m}=_(),{language:a}=L(),[l,x]=A.useState(0),h=s=>{y({content:e.jsxs(e.Fragment,{children:[" ",a.deseja_deletar," "," ",e.jsx("strong",{style:{color:s.color},children:s.name}),"? "]}),confirmText:a.confirm,submit:()=>{C({type:"Success",message:a.agrupamento_deletado,position:"top-right"});const r=t.filter(i=>i.id!==s.id);m([...r])}})},u=s=>{n({isOpen:!1,type:"edit",content:s})},g=e.jsx("div",{className:"flex flex-col w-[235px] overflow-y-auto overflow-x-hidden ",style:{maxHeight:"calc(100vh - 240px)"},children:t.map((s,r)=>e.jsxs("div",{className:"flex gap-1 items-center border-b border-base-300 cursor-pointer hover:bg-base-300 p-1 px-2 rounded "+(l===r?"!bg-base-300":void 0),onClick:()=>x(r),children:[e.jsx("span",{children:e.jsx(v,{className:"w-5h-5",style:{color:s.color}})}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap w-[150px]",children:s.name}),e.jsxs("span",{className:"flex w-[25px] justify-between",children:[e.jsx("span",{className:"pulse cursor-pointer",onClick:()=>u(s),children:e.jsx(w,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})}),e.jsx("span",{className:"pulse cursor-pointer",onClick:i=>{i.stopPropagation(),h(s)},children:e.jsx(S,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})})]})]},r))}),f=({index:s,key:r,style:i})=>{var p;const o=(p=t[l])==null?void 0:p.chats[s];if(o)return e.jsx("li",{style:i,children:e.jsxs("div",{className:"flex gap-1 items-center px-2",children:[e.jsx(T,{id:o.id}),e.jsx("span",{className:"font-bold text-base overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:o.name}),e.jsx("span",{children:o.id.includes("@")?o.id.split("@")[0]:o.id})]})},o.id)},j=e.jsx("div",{className:"w-full pt-2",children:e.jsx("ul",{className:"gap-2 overflow-y-auto overflow-x-hidden justify-center",style:{maxHeight:"calc(100vh - 240px)",height:"calc(100vh - 240px)",width:"350px"},children:e.jsx(E,{children:({width:s,height:r})=>{var i;return e.jsx(H,{width:s,height:r,rowCount:t[l]?(i=t[l])==null?void 0:i.chats.length:0,rowHeight:25,rowRenderer:f})}})})});return e.jsxs("div",{style:{height:"calc(100vh - 110px)"},children:[e.jsx(N,{children:a.organiza_cts}),e.jsxs("div",{className:"flex gap-2 items-center p-2",children:[e.jsx(b,{children:a.agrupamentos_salvos}),e.jsx("span",{className:"pulse cursor-pointer lg:tooltip lg:tooltip-right","data-tip":a.voltar,onClick:()=>n({isOpen:!1,type:"create",content:[]}),children:e.jsx(M,{className:"w-6 h-6 text-[var(--primaria)]",strokeWidth:1})})]}),e.jsxs("div",{className:"flex pt-4 gap-12",children:[e.jsxs("div",{className:"flex flex-col gap-4 justify-start",children:[e.jsxs("div",{className:"indicator",children:[t.length!==0&&e.jsxs("span",{className:"indicator-item badge bg-[var(--primaria)] text-[var(--letra)] font-medium",children:["+",t.length]}),e.jsx("span",{className:"p-2 text-xl",children:a.agrupamentos_criados})]}),t.length!==0?g:e.jsx("div",{className:"p-4 border-dotted border rounded-lg text-center mt-2 border-[var(--terciaria)]",children:a.nenhum_agrupamento})]}),e.jsx("div",{className:"flex flex-col gap-4 justify-start",children:t.length!==0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"indicator",children:[((c=t[l])==null?void 0:c.chats.length)!==0&&e.jsxs("span",{className:"indicator-item badge bg-[var(--primaria)] text-[var(--letra)] font-medium",children:["+",(d=t[l])==null?void 0:d.chats.length]}),e.jsx("span",{className:"p-2 text-xl",children:a.cts_selecionados})]}),j]}):null})]})]})}export{$ as default};
