import{j as e,_ as r,aa as T,T as C,an as M,aE as I,ao as P,z as v,I as z}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e410.js";import{a as t}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e44.js";import{u as p}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e462.js";import{u as w,b as F}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e419.js";import{az as k,b as R,z as L,p as S,q as O,aA as U,av as D}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e423.js";import{W as f}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e418.js";import{b as V}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e459.js";import{e as B}from"./v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e440.js";const W=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e4137.js")),[]));function q(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(W,{})})}const N=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e4138.js")),[]));function H(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(N,{})})}const G=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e4139.js")),[]));function J({setUserLabels:s,userLabels:u}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(G,{setUserLabels:s,userLabels:u})})}const K=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e4140.js")),[]));function Q(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(K,{})})}const X=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e4141.js")),[]));function Y({userId:s}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(X,{userId:s})})}const Z=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_14_b047d88c-9af4-4a49-a965-946ffe7780e4142.js")),[]));function $({userId:s}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(Z,{userId:s})})}function le(){const{language:s}=w(p(a=>({language:a.language}))),{pinChat:u,isPin:g}=k(p(a=>({pinChat:a.pinChat,isPin:a.isPin}))),{getUserAbasTam:h}=R(p(a=>({userTabs:a.userTabs,getUserAbasTam:a.getUserAbasTam}))),x=F(a=>a.isBusiness),m=L(a=>{var n,o;return(o=(n=a.activeChat)==null?void 0:n.id)==null?void 0:o.user}),_=L(a=>{var n,o;return(o=(n=a.activeChat)==null?void 0:n.id)==null?void 0:o._serialized}),A=S(a=>a.open),i=O(a=>a.open),y=async()=>{await D("clear_message")!==!0&&(await f.Msg("showClearMsg")?z({type:"Success",message:s.asMensagensApagasForamRecuperadas,position:"top-right"}):z({type:"Error",message:s.nenhumaMensagemApagadaFoiRecuperada,position:"top-right"}))},[c,b]=t.useState(null);return t.useEffect(()=>{x&&(async()=>{try{const n=await f.Labels("getAllLabels"),o=await f.Utils("getContato",_);if(o==="undefined")return;const E=o.labels.map(d=>n.find(l=>l.hexColor&&l.id===d)).filter(Boolean).map(({id:d,name:l,hexColor:j})=>({id:d,name:l,color:j,hexColor:j}));b(E)}catch(n){console.error(s.erroAoBuscarLabels,n)}})()},[_]),[{id:"init_fluxo",name:s.iniciarUmFluxoParaEsteContato,icon:e.jsx(T,{size:20}),function:a=>i(e.jsx($,{userId:m}),{placement:"bottom"},a.target,15)},{id:"fixar_chat",name:g()?s.desafixarChat:s.fixarChat,icon:e.jsx(C,{className:g()?"!text-[var(--wds-teal-500)]":"",size:20}),function:()=>u()},{id:"show_clean_messages",name:s.exibirMensagensApagadasRecente,icon:e.jsx(U,{size:20,strokeWidth:"1.8"}),function:()=>y()},{id:"traducao_com_IA",name:s.traducaoComIA,icon:e.jsx(B,{size:20}),function:()=>A(e.jsx(q,{}))},{id:"user_tabs",name:s.userTabs,icon:e.jsx(M,{size:20}),tam:h(m),function:a=>i(e.jsx(H,{}),{placement:"bottom"},a.target,15)},{id:"labels",name:s.tags,icon:c&&c.length>0?e.jsx("div",{className:"flex",children:c.map((a,n)=>e.jsx("span",{style:n!==0?{marginLeft:"-1rem"}:null,children:e.jsx(I,{size:24,style:{color:a.color}})},n))}):e.jsx(P,{size:20}),function:a=>i(e.jsx(J,{setUserLabels:b,userLabels:c}),{placement:"bottom"},a.target.parentNode.parentNode,15),disabled:!x},{id:"transferir_atendimento",name:s.transferirAtendimento,icon:e.jsx(v,{size:20}),function:a=>i(e.jsx(Q,{}),{placement:"bottom"},a.target,15)},{id:"close_atendimento",name:s.fimAtendimento_encerrar,icon:e.jsx(V,{size:20}),function:a=>i(e.jsx(Y,{userId:m}),{placement:"bottom"},a.target,15)}]}export{le as R};
