import{j as t,Q as j,Z as g,ba as N,$ as b,a1 as p,I as u}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf10.js";import{a as S}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf4.js";import{o as C,aD as w,av as c,ar as y}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf23.js";import{u as _}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf19.js";import{W as d}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf18.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-7f2344477fbf5.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf7.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf6.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 D(){const{language:a}=_(),{close:i}=C(),{contatos:m,setContatos:l}=w(),{setAutoSaveChatName:x,chatName:e}=c(),[n,h]=S.useState(e.name),f=async()=>{if(await y("contatos")===!0)return;const o=m.filter(r=>r.id!==e.number),s={id:e.number,name:n};o.push(s),d.Contact("save",{contactId:s.id,name:s.name,options:{syncAdressBook:!0}}),chrome.runtime.sendMessage({action:"contatoSave",dados:s}),c.setState({chatName:{...e,name:n,number:e.number}}),l(o),i(),u({type:"Success",message:a.contatosNotifiSave,position:"top-right"})},v=async()=>{const o=m.filter(r=>r.id!==e.number),s={id:e.number,name:e.number};d.Contact("remove",s.id),chrome.runtime.sendMessage({action:"contatoSave",dados:s}),c.setState({chatName:{...e,name:e.number,number:e.number}}),l(o),i(),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(j,{children:a.contatos_title})}),t.jsx(g,{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:o=>h(o.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",{className:"lg:tooltip lg:tooltip-top","data-tip":a.contatos_info,children:t.jsx(N,{className:"h-5 w-5"})})]}),t.jsx(b,{estado:e.autoSave,switchUpdate:()=>x(!e.autoSave),id:"autoSave"})]}),t.jsxs("div",{className:"flex justify-around",children:[t.jsx(p,{name:a.contatos_rm,funcao:v}),t.jsx(p,{name:a.contatos_save,funcao:f})]})]})}export{D as default};
