import{j as t}from"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89263.js";import{a as b}from"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89262.js";import{q as g,ao as N,z as i,C as S}from"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892625.js";import{u as C}from"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89264.js";import{u as w}from"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892622.js";import{D as y,E as _,bj as M,b1 as I,H as p,I as u}from"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89268.js";import{z as d}from"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89265.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89266.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89269.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892610.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c89267.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c8926.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892620.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892641.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892655.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892656.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892643.js";import"./v_7_4_3_72_6a457bf5-eeae-4570-8821-bd6fa39c892657.js";function Q(){const{language:a}=C(),{close:c}=g(),{contatos:m,setContatos:l}=N(),{setAutoSaveChatName:h,chatName:e}=i(),x=w(s=>s.openWithGetEvents),[n,f]=b.useState(e.name),v=async()=>{if(await S("contatos")===!0)return;const s=m.filter(r=>r.id!==e.number),o={id:e.number,name:n};s.push(o),d.Contact("save",{contactId:o.id,name:o.name,options:{syncAdressBook:!0}}),chrome.runtime.sendMessage({action:"contatoSave",dados:o}),i.setState({chatName:{...e,name:n,number:e.number}}),l(s),c(),u({type:"Success",message:a.contatosNotifiSave,position:"top-right"})},j=async()=>{const s=m.filter(r=>r.id!==e.number),o={id:e.number,name:e.number};d.Contact("remove",o.id),chrome.runtime.sendMessage({action:"contatoSave",dados:o}),i.setState({chatName:{...e,name:e.number,number:e.number}}),l(s),c(),u({type:"Success",message:a.contatosNotifiRM,position:"top-right"})};return t.jsxs("div",{className:"w-[450px] grid gap-4",children:[t.jsx("div",{className:"flex gap-4",children:t.jsx(y,{children:a.contatos_title})}),t.jsx(_,{children:a.contatos_text}),t.jsxs("div",{className:"form-control w-full",children:[t.jsx("label",{className:"label",children:t.jsx("span",{className:"label-text",children:a.contatos_textInp})}),t.jsx("input",{type:"text",value:n,onChange:s=>f(s.target.value),placeholder:a.contatos_placeInp,className:"input input-bordered w-full input-sm"})]}),t.jsxs("div",{className:"flex justify-between cursor-pointer items-center h-9 px-1 py-2 rounded",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs("span",{children:[a.contatos_autoSave," "]}),t.jsx("span",{...x(a.contatos_info,{placement:"top"}),children:t.jsx(M,{className:"h-5 w-5"})})]}),t.jsx(I,{estado:e.autoSave,switchUpdate:()=>h(!e.autoSave),id:"autoSave"})]}),t.jsxs("div",{className:"flex justify-around",children:[t.jsx(p,{name:a.contatos_rm,funcao:j}),t.jsx(p,{name:a.contatos_save,funcao:v})]})]})}export{Q as default};
