import{j as t,y as j,H as g,bk as N,J as S,Q as p,I as u}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b10.js";import{a as b}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b4.js";import{o as C,ai as w,ab as r,a2 as y}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b23.js";import{u as _}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b19.js";import{W as d}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b18.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b8.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b5.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b7.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b6.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b9.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b2.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b3.js";function F(){const{language:e}=_(),{close:c}=C(),{Contacts:l,setContacts:m}=w(),{setAutoSaveChatName:x,chatName:a}=r(),[n,h]=b.useState(a.name),f=async()=>{if(await y("Contacts")===!0)return;const s=l.filter(i=>i.id!==a.number),o={id:a.number,name:n};s.push(o),d.Utils("ContactSave",o),chrome.runtime.sendMessage({action:"ContactSave",dados:o}),r.setState({chatName:{...a,name:n,number:a.number}}),m(s),c(),u({type:"Success",message:e.ContactsNotifiSave,position:"top-right"})},v=async()=>{const s=l.filter(i=>i.id!==a.number),o={id:a.number,name:a.number};d.Utils("ContactSave",o),chrome.runtime.sendMessage({action:"ContactSave",dados:o}),r.setState({chatName:{...a,name:a.number,number:a.number}}),m(s),c(),u({type:"Success",message:e.ContactsNotifiRM,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:e.Contacts_title})}),t.jsx(g,{children:e.Contacts_text}),t.jsxs("div",{className:"form-control w-full",children:[t.jsx("label",{className:"label",children:t.jsx("span",{className:"label-text",children:e.Contacts_textInp})}),t.jsx("input",{type:"text",value:n,onChange:s=>h(s.target.value),placeholder:e.Contacts_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:[e.Contacts_autoSave," "]}),t.jsx("span",{className:"lg:tooltip lg:tooltip-top","data-tip":e.Contacts_info,children:t.jsx(N,{className:"h-5 w-5"})})]}),t.jsx(S,{estado:a.autoSave,switchUpdate:()=>x(!a.autoSave),id:"autoSave"})]}),t.jsxs("div",{className:"flex justify-around",children:[t.jsx(p,{name:e.Contacts_rm,funcao:v}),t.jsx(p,{name:e.Contacts_save,funcao:f})]})]})}export{F as default};
