import{j as t,v as j,D as g,b6 as N,F as S,J as p,I as u}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e10.js";import{a as b}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e4.js";import{n as C,ae as w,a7 as r,_}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e22.js";import{u as y}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e19.js";import{W as d}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e18.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e8.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e5.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e7.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e6.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e2.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e3.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e9.js";function B(){const{language:a}=y(),{close:c}=C(),{contatos:l,setContatos:m}=w(),{setAutoSaveChatName:x,chatName:e}=r(),[n,h]=b.useState(e.name),f=async()=>{if(await _("contatos")===!0)return;const s=l.filter(i=>i.id!==e.number),o={id:e.number,name:n};s.push(o),d.Utils("contatoSave",o),chrome.runtime.sendMessage({action:"contatoSave",dados:o}),r.setState({chatName:{...e,name:n,number:e.number}}),m(s),c(),u({type:"Success",message:a.contatosNotifiSave,position:"top-right"})},v=async()=>{const s=l.filter(i=>i.id!==e.number),o={id:e.number,name:e.number};d.Utils("contatoSave",o),chrome.runtime.sendMessage({action:"contatoSave",dados:o}),r.setState({chatName:{...e,name:e.number,number:e.number}}),m(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(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:s=>h(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",{className:"lg:tooltip lg:tooltip-top","data-tip":a.contatos_info,children:t.jsx(N,{className:"h-5 w-5"})})]}),t.jsx(S,{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{B as default};
