import{j as e}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0286.js";import{a as g}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0282.js";import{u as f}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0285.js";import{u as j}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b02837.js";import{u as v}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b028130.js";import{bP as w,ao as N,b,a as y,C,I as A}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0288.js";import{V as L}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b028243.js";import{A as _,L as k}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b02812.js";import{a as T}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b028163.js";import{a as E}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b028115.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0284.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0283.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b02821.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b02820.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b028.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0287.js";function K(){const{setViewContatos:n}=v(),{agrupamentos:a,setAgrupamentos:c}=j(),{language:t}=f(),[o,d]=g.useState(0),p=s=>{C({content:e.jsxs(e.Fragment,{children:[" ",t.deseja_deletar," "," ",e.jsx("strong",{style:{color:s.color},children:s.name}),"? "]}),confirmText:t.confirm,submit:()=>{A({type:"Success",message:t.agrupamento_deletado,position:"top-right"});const r=a.filter(l=>l.id!==s.id);c([...r])}})},m=s=>{n({isOpen:!1,type:"edit",content:s})},x=e.jsx("div",{className:"flex flex-col w-[235px] overflow-y-auto overflow-x-hidden ",style:{maxHeight:"calc(100vh - 240px)"},children:a.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 "+(o===r?"!bg-base-300":void 0),onClick:()=>d(r),children:[e.jsx("span",{children:e.jsx(w,{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:()=>m(s),children:e.jsx(N,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})}),e.jsx("span",{className:"pulse cursor-pointer",onClick:l=>{l.stopPropagation(),p(s)},children:e.jsx(E,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})})]})]},r))}),h=({index:s,key:r,style:l})=>{const i=a[o]?.chats[s];if(i)return e.jsx("li",{style:l,children:e.jsxs("div",{className:"flex gap-1 items-center px-2",children:[e.jsx(L,{id:i.id}),e.jsx("span",{className:"font-bold text-base overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:i.name}),e.jsx("span",{children:i.id.includes("@")?i.id.split("@")[0]:i.id})]})},i.id)},u=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(_,{children:({width:s,height:r})=>e.jsx(k,{width:s,height:r,rowCount:a[o]?a[o]?.chats.length:0,rowHeight:25,rowRenderer:h})})})});return e.jsxs("div",{style:{height:"calc(100vh - 110px)"},children:[e.jsx(b,{children:t.organiza_cts}),e.jsxs("div",{className:"flex gap-2 items-center p-2",children:[e.jsx(y,{children:t.agrupamentos_salvos}),e.jsx("span",{className:"pulse cursor-pointer lg:tooltip lg:tooltip-right","data-tip":t.voltar,onClick:()=>n({isOpen:!1,type:"create",content:[]}),children:e.jsx(T,{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:[a.length!==0&&e.jsxs("span",{className:"indicator-item badge bg-[var(--primaria)] text-[var(--letra)] font-medium",children:["+",a.length]}),e.jsx("span",{className:"p-2 text-xl",children:t.agrupamentos_criados})]}),a.length!==0?x:e.jsx("div",{className:"p-4 border-dotted border rounded-lg text-center mt-2 border-[var(--terciaria)]",children:t.nenhum_agrupamento})]}),e.jsx("div",{className:"flex flex-col gap-4 justify-start",children:a.length!==0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"indicator",children:[a[o]?.chats.length!==0&&e.jsxs("span",{className:"indicator-item badge bg-[var(--primaria)] text-[var(--letra)] font-medium",children:["+",a[o]?.chats.length]}),e.jsx("span",{className:"p-2 text-xl",children:t.cts_selecionados})]}),u]}):null})]})]})}export{K as default};
