1import{c as Fe,r as i,b as Ea,aM as Oe,e as h,z as u,j as e,i as Be,U as oe,$ as U,L as ze,K as _a,ay as La,aN as Pa,B as E,A as qa,p as Ra,M as Ta,x as Ia,aO as Da,a9 as ge,_ as le,I as ce,aP as Oa,aQ as Ba,q as za,s as Ga,a5 as Wa,a2 as He}from"./app-CRAwfhea.js";import{M as de}from"./Modal-CMLFY7aQ.js";import{P as Fa}from"./PzEmpty-NTz-8y0a.js";import{a as Ha,b as Qa,c as $a}from"./DevicesModals-AEVn892j.js";import{t as Ua}from"./locale-BJ7r9eqn.js";import"./meta-B_zsCFM9.js";import"./EmbeddedSignupButton-IWgHjO16.js";import"./index-D6qdfaAD.js";const s={rmTitle:{pt:"Remover da equipe",en:"Remove from team",es:"Quitar del equipo"},rmSub1:{pt:"Ação irreversÃvel",en:"Irreversible action",es:"Acción irreversible"},rmSub2:{pt:"não dá pra desfazer",en:"can't be undone",es:"no se puede deshacer"},rmNoticeTitle:{pt:"Tira o acesso na hora",en:"Access is revoked immediately",es:"Quita el acceso al instante"},rmNoticeBody:{pt:"O login é desativado imediatamente e as permissões, páginas e dispositivos liberados para {name} são apagados. As conversas atribuÃdas a ele voltam para a fila. O histórico de mensagens permanece.",en:"The login is disabled immediately and the permissions, pages and devices granted to {name} are deleted. Conversations assigned to them go back to the queue. The message history is kept.",es:"El inicio de sesión se desactiva de inmediato y se eliminan los permisos, las páginas y los dispositivos habilitados para {name}. Las conversaciones asignadas vuelven a la fila. El historial de mensajes se mantiene."},thisMember:{pt:"este membro",en:"this member",es:"este miembro"},typeBefore:{pt:"Digite",en:"Type",es:"Escribe"},typeAfter:{pt:"para confirmar",en:"to confirm",es:"para confirmar"},caseSensitive:{pt:"Diferencia maiúsculas de minúsculas â digite exatamente o nome acima.",en:"Case sensitive â type exactly the name above.",es:"Distingue mayúsculas y minúsculas: escribe exactamente el nombre de arriba."},cancel:{pt:"Cancelar",en:"Cancel",es:"Cancelar"},roleManager:{pt:"Gerente",en:"Manager",es:"Gerente"},roleAgent:{pt:"Atendente",en:"Agent",es:"Agente"},scopeAssigned:{pt:"Só atribuÃdas",en:"Assigned only",es:"Solo asignadas"},scopeQueue:{pt:"AtribuÃdas + fila",en:"Assigned + queue",es:"Asignadas + fila"},scopeAll:{pt:"Todas",en:"All",es:"Todas"},stActive:{pt:"Ativo",en:"Active",es:"Activo"},stPending:{pt:"Convite pendente",en:"Invite pending",es:"Invitación pendiente"},stInactive:{pt:"Inativo",en:"Inactive",es:"Inactivo"},pgChat:{pt:"Chat",en:"Chat",es:"Chat"},pgKanban:{pt:"Kanban",en:"Kanban",es:"Kanban"},pgBroadcast:{pt:"Disparos",en:"Bulk send",es:"EnvÃo masivo"},pgTemplates:{pt:"Templates",en:"Templates",es:"Plantillas"},pgChatbots:{pt:"Chatbots",en:"Chatbots",es:"Chatbots"},pgLaunches:{pt:"Lançamentos",en:"Launches",es:"Lanzamientos"},permManageMembers:{pt:"Gerenciar atendentes",en:"Manage agents",es:"Gestionar agentes"},pgAiAgents:{pt:"Agentes de I.A.",en:"A.I. agents",es:"Agentes de I.A."},pgWebhooks:{pt:"Webhooks",en:"Webhooks",es:"Webhooks"},pgClubs:{pt:"Clubes",en:"Clubs",es:"Clubes"},pgHome:{pt:"Dashboard",en:"Dashboard",es:"Panel"},pgDevices:{pt:"Dispositivos",en:"Devices",es:"Dispositivos"},pgStatus:{pt:"Status",en:"Status",es:"Estados"},pgCalls:{pt:"Chamadas",en:"Calls",es:"Llamadas"},pgBilling:{pt:"Assinatura",en:"Subscription",es:"Suscripción"},permTeamSettings:{pt:"Configurar a equipe",en:"Configure the team",es:"Configurar el equipo"},grpAtendimento:{pt:"Atendimento",en:"Support",es:"Atención"},grpAutomacao:{pt:"Automação",en:"Automation",es:"Automatización"},grpConta:{pt:"Conta e configuração",en:"Account and settings",es:"Cuenta y configuración"},billingWarn:{pt:"Dá acesso ao cartão, à troca de plano e ao cancelamento da assinatura. à a única permissão que o gerente NÃO recebe sozinho â ligue só se for isso mesmo.",en:"Gives access to the card, plan changes and subscription cancellation. It is the only permission a manager does NOT get by default â turn it on only if you mean it.",es:"Da acceso a la tarjeta, al cambio de plan y a la cancelación de la suscripción. Es el único permiso que el gerente NO recibe por sà solo: actÃvalo solo si es lo que quieres."},errLoadTeam:{pt:"Erro ao carregar equipe",en:"Error loading team",es:"Error al cargar el equipo"},errNameEmail:{pt:"Nome e e-mail obrigatórios",en:"Name and email are required",es:"Nombre y correo son obligatorios"},okInviteSent:{pt:"Convite enviado!",en:"Invite sent!",es:"¡Invitación enviada!"},errAddMember:{pt:"Erro ao adicionar membro",en:"Error adding member",es:"Error al añadir el miembro"},okMemberRemoved:{pt:"Membro removido",en:"Member removed",es:"Miembro eliminado"},errRemove:{pt:"Erro ao remover",en:"Error removing",es:"Error al eliminar"},okInviteResent:{pt:"Convite reenviado",en:"Invite resent",es:"Invitación reenviada"},errResend:{pt:"Erro ao reenviar",en:"Error resending",es:"Error al reenviar"},okSettingsSaved:{pt:"Configurações salvas",en:"Settings saved",es:"Configuración guardada"},errSave:{pt:"Erro ao salvar",en:"Error saving",es:"Error al guardar"},errLoadMemberCfg:{pt:"Erro ao carregar config do membro",en:"Error loading member settings",es:"Error al cargar la configuración del miembro"},errGenLink:{pt:"Erro ao gerar link",en:"Error generating link",es:"Error al generar el enlace"},okLinkCopied:{pt:"Link copiado",en:"Link copied",es:"Enlace copiado"},errCopy:{pt:"Não foi possÃvel copiar",en:"Couldn't copy",es:"No se pudo copiar"},errPassMin:{pt:"Senha de no mÃnimo 6 caracteres",en:"Password must be at least 6 characters",es:"La contraseña debe tener al menos 6 caracteres"},okActivated:{pt:"{name} liberado! Envie o e-mail e a senha para ele entrar.",en:"{name} is all set! Send them the email and password so they can sign in.",es:"¡{name} ya tiene acceso! EnvÃale el correo y la contraseña para que entre."},errActivate:{pt:"Erro ao ativar",en:"Error activating",es:"Error al activar"},okMemberSaved:{pt:"Membro configurado",en:"Member configured",es:"Miembro configurado"},capBlockedHasWeb:{pt:"Este atendente só opera números em coexistência, onde quem atende é o WhatsApp Business do aparelho. Marque abaixo um número por QR Code ou Cloud API para liberar.",en:"This agent only operates coexistence numbers, where the phoneâs WhatsApp Business app answers. Select a QR Code or
1Cloud API number below to enable it.",es:"Este agente solo opera números en coexistencia, donde atiende el WhatsApp Business del teléfono. Marca abajo un número por QR Code o Cloud API para habilitarlo."},capBlockedNoWeb:{pt:"A conta não tem nenhum número com chamada de voz â só os conectados por QR Code ou Cloud API têm.",en:"This account has no number with voice calling â only QR Code or Cloud API numbers support it.",es:"La cuenta no tiene ningún número con llamadas de voz: solo los conectados por QR Code o Cloud API."},forbiddenTitle:{pt:"Acesso restrito",en:"Restricted access",es:"Acceso restringido"},forbiddenHint:{pt:"Apenas o dono da conta ou um gerente pode gerenciar a equipe.",en:"Only the account owner or a manager can manage the team.",es:"Solo el propietario de la cuenta o un gerente puede gestionar el equipo."},pageTitle:{pt:"Gestão de Equipe",en:"Team Management",es:"Gestión de Equipo"},pageSub:{pt:"Atendentes, papéis, páginas liberadas e dispositivos por membro",en:"Agents, roles, allowed pages and devices per member",es:"Agentes, roles, páginas habilitadas y dispositivos por miembro"},metrics:{pt:"Métricas",en:"Metrics",es:"Métricas"},activity:{pt:"Atividade",en:"Activity",es:"Actividad"},settings:{pt:"Configurações",en:"Settings",es:"Configuración"},addMember:{pt:"Adicionar membro",en:"Add member",es:"Añadir miembro"},kpiMembers:{pt:"Membros na equipe",en:"Team members",es:"Miembros del equipo"},kpiActive:{pt:"Ativos",en:"Active",es:"Activos"},kpiPending:{pt:"Convites pendentes",en:"Pending invites",es:"Invitaciones pendientes"},kpiManagers:{pt:"Gerentes",en:"Managers",es:"Gerentes"},emptyTitle:{pt:"Nenhum membro ainda",en:"No members yet",es:"Aún no hay miembros"},emptyHint:{pt:"Convide seu primeiro atendente.",en:"Invite your first agent.",es:"Invita a tu primer agente."},resendInvite:{pt:"Reenviar convite",en:"Resend invite",es:"Reenviar invitación"},resend:{pt:"Reenviar",en:"Resend",es:"Reenviar"},configAccess:{pt:"Configurar acesso",en:"Configure access",es:"Configurar acceso"},access:{pt:"Acesso",en:"Access",es:"Acceso"},remove:{pt:"Remover",en:"Remove",es:"Quitar"},footNote1:{pt:'"Dispositivos" são os números de WhatsApp conectados. Em',en:'"Devices" are the connected WhatsApp numbers. In',es:"«Dispositivos» son los números de WhatsApp conectados. En"},footNote2:{pt:"você escolhe quais cada atendente usa.",en:"you choose which ones each agent uses.",es:"eliges cuáles usa cada agente."},fName:{pt:"Nome",en:"Name",es:"Nombre"},fNamePh:{pt:"Nome do atendente",en:"Agent's name",es:"Nombre del agente"},fEmail:{pt:"E-mail",en:"Email",es:"Correo electrónico"},fEmailPh:{pt:"[email protected]",en:"[email protected]",es:"[email protected]"},fRole:{pt:"Papel",en:"Role",es:"Rol"},optManagerFull:{pt:"Gerente (gerencia e atende)",en:"Manager (manages and handles chats)",es:"Gerente (gestiona y atiende)"},fScope:{pt:"Visibilidade de conversas",en:"Conversation visibility",es:"Visibilidad de conversaciones"},fCapacity:{pt:"Conversas simultâneas",en:"Simultaneous conversations",es:"Conversaciones simultáneas"},fCapacityHint:{pt:"0 = sem limite. Acima disso, a distribuição automática para de mandar conversa nova para ele até fechar alguma.",en:"0 = no limit. Above that, auto-assignment stops sending new conversations to them until one closes.",es:"0 = sin lÃmite. Por encima, la asignación automática deja de enviarle conversaciones nuevas hasta que cierre alguna."},onlyManager:{pt:"só gerente",en:"manager only",es:"solo gerente"},managerPagesHint:{pt:"Gerente já vem com tudo, igual ao dono. Desligue o que ele não deve ver. Chatbots, Lançamentos e a gestão de atendentes nunca ficam disponÃveis para Atendente.",en:"A manager starts with everything, like the owner. Switch off what they should not see. Chatbots, Launches and agent management are never available to an Agent.",es:"El gerente empieza con todo, igual que el dueño. Desactiva lo que no deba ver. Chatbots, Lanzamientos y la gestión de agentes nunca están disponibles para un Agente."},roleChangeHint:{pt:"Gerente tem o mesmo acesso do dono. Use os controles ao lado para tirar o que ele não deve ter.",en:"A manager has the same access as the owner. Use the controls beside to remove whatever they should not have.",es:"El gerente tiene el mismo acceso que el dueño. Usa los controles al lado para quitar lo que no deba tener."},fScopeChatKanban:{pt:"Visibilidade de conversas (chat e kanban)",en:"Conversation visibility (chat and kanban)",es:"Visibilidad de conversaciones (chat y kanban)"},optScopeAssigned:{pt:"Só as atribuÃdas a ele",en:"Only the ones assigned to them",es:"Solo las asignadas a él"},optScopeQueue:{pt:"AtribuÃdas + fila não-atribuÃda",en:"Assigned + unassigned queue",es:"Asignadas + fila sin asignar"},optScopeAll:{pt:"Todas as conversas",en:"All conversations",es:"Todas las conversaciones"},pagesLogin:{pt:"O que ele acessa",en:"What they can access",es:"A qué accede"},devicesChat:{pt:"Dispositivos que ele acessa no chat",en:"Devices they can access in the chat",es:"Dispositivos a los que accede en el chat"},noDevicesYet:{pt:"Nenhum dispositivo conectado na conta ainda.",en:"No device connected to this account yet.",es:"Aún no hay ningún dispositivo conectado en la cuenta."},allCheckedNote1:{pt:"Todos marcados = acesso a todos. Você pode mudar depois em",en:"All checked = access to all. You can change it later in",es:"Todos marcados = acceso a todos. Puedes camb
1iarlo después en"},allCheckedNote2:{pt:".",en:".",es:"."},sendInvite:{pt:"Enviar convite",en:"Send invite",es:"Enviar invitación"},teamSettings:{pt:"Configurações da equipe",en:"Team settings",es:"Configuración del equipo"},teamName:{pt:"Nome da equipe",en:"Team name",es:"Nombre del equipo"},teamNamePh:{pt:"Minha equipe",en:"My team",es:"Mi equipo"},assignMode:{pt:"Modo de atribuição de conversas",en:"Conversation assignment mode",es:"Modo de asignación de conversaciones"},optManual:{pt:"Manual â o gestor atribui cada conversa",en:"Manual â the manager assigns each conversation",es:"Manual: el gerente asigna cada conversación"},optRoundRobin:{pt:"RodÃzio â distribui em ordem entre os atendentes",en:"Round robin â distributes in order among agents",es:"Rotación: distribuye en orden entre los agentes"},optLeastOpen:{pt:"Menos ocupado â vai pro atendente com menos conversas abertas",en:"Least busy â goes to the agent with the fewest open conversations",es:"Menos ocupado: va al agente con menos conversaciones abiertas"},save:{pt:"Salvar",en:"Save",es:"Guardar"},accessOf:{pt:"Acesso de {name}",en:"{name}'s access",es:"Acceso de {name}"},grantAccess:{pt:"Liberar acesso",en:"Grant access",es:"Dar acceso"},generating:{pt:"Gerandoâ¦",en:"Generatingâ¦",es:"Generandoâ¦"},genInviteLink:{pt:"Gerar link de convite",en:"Generate invite link",es:"Generar enlace de invitación"},copyLink:{pt:"Copiar link",en:"Copy link",es:"Copiar enlace"},copied:{pt:"Copiado",en:"Copied",es:"Copiado"},copy:{pt:"Copiar",en:"Copy",es:"Copiar"},inviteLinkHint:{pt:"Envie o link para o atendente criar a senha e entrar (vale 72h).",en:"Send the link so the agent can create a password and sign in (valid for 72h).",es:"EnvÃa el enlace para que el agente cree su contraseña y entre (válido 72 h)."},orGrantNow:{pt:"ou libere na hora",en:"or grant access right now",es:"o dale acceso al instante"},passPh:{pt:"Defina uma senha (mÃn. 6)",en:"Set a password (min. 6)",es:"Define una contraseña (mÃn. 6)"},activating:{pt:"Ativandoâ¦",en:"Activatingâ¦",es:"Activandoâ¦"},activate:{pt:"Ativar",en:"Activate",es:"Activar"},activateHint:{pt:"Ativa o acesso na hora; depois é só passar o e-mail e a senha para o atendente.",en:"Grants access right away; then just give the agent the email and password.",es:"Activa el acceso al instante; después solo pasa el correo y la contraseña al agente."},callsNote:{pt:"Ligações só existem nos números conectados por QR Code (WhatsApp e WhatsApp Business). Sem a permissão, o atendente não vê o botão de ligar e nem recebe o toque de chamada recebida.",en:"Calls only exist on numbers connected by QR Code (WhatsApp and WhatsApp Business). Without this permission the agent sees no call button and gets no incoming call ring.",es:"Las llamadas solo existen en los números conectados por QR Code (WhatsApp y WhatsApp Business). Sin el permiso, el agente no ve el botón de llamar ni recibe el tono de llamada entrante."},permPageChat:{pt:"Chat",en:"Chat",es:"Chat"},permPageBroadcast:{pt:"Disparos",en:"Bulk send",es:"EnvÃo masivo"},permKanbanEdit:{pt:"Editar colunas do Kanban",en:"Edit Kanban columns",es:"Editar columnas del Kanban"},permChatCalls:{pt:"Ligar e atender pelo chat",en:"Call and answer from the chat",es:"Llamar y atender desde el chat"},permChatCallsUnassigned:{pt:"Atender fora das conversas dele",en:"Answer outside their conversations",es:"Atender fuera de sus conversaciones"},permChatCallsUnassignedHint:{pt:"Sem isto, ele só atende quem já é conversa dele ou quem ninguém pegou.",en:"Without this, they only answer their own conversations or unclaimed ones.",es:"Sin esto, solo atiende sus propias conversaciones o las que nadie tomó."},devicesUsed:{pt:"Dispositivos (números) que ele usa",en:"Devices (numbers) they use",es:"Dispositivos (números) que usa"},noDevices:{pt:"Nenhum dispositivo conectado na conta.",en:"No device connected to this account.",es:"Ningún dispositivo conectado en la cuenta."},devicesNote:{pt:"Marque os números que este atendente pode operar. Todos marcados = sem restrição.",en:"Check the numbers this agent can operate. All checked = no restriction.",es:"Marca los números que este agente puede operar. Todos marcados = sin restricción."}
1,saveAccess:{pt:"Salvar acesso",en:"Save access",es:"Guardar acceso"}},Qe={manager:s.roleManager,agent:s.roleAgent},$e={assigned:s.scopeAssigned,queue:s.scopeQueue,all:s.scopeAll},Ka={"page.chat":s.permPageChat,"page.kanban":s.pgKanban,"page.broadcast":s.permPageBroadcast,"page.templates":s.pgTemplates,"kanban.edit_columns":s.permKanbanEdit,"chat.calls":s.permChatCalls,"chat.calls_unassigned":s.permChatCallsUnassigned,"page.chatbots":s.pgChatbots,"team.manage_members":s.permManageMembers,"page.ai_agents":s.pgAiAgents,"page.launches":s.pgLaunches,"page.webhooks":s.pgWebhooks,"page.clubs":s.pgClubs,"page.home":s.pgHome,"page.devices":s.pgDevices,"page.status":s.pgStatus,"page.calls":s.pgCalls,"page.billing":s.pgBilling,"team.settings":s.permTeamSettings},Va={atendimento:s.grpAtendimento,automacao:s.grpAutomacao,conta:s.grpConta},Ya={"page.billing":s.billingWarn},Za={web:"Web",coexistence:"Coex",cloud_api:"Cloud"},Ja=l=>Za[l]||"Web",me=(l,t)=>Object.fromEntries([...(l==null?void 0:l.pages)||[],...(l==null?void 0:l.caps)||[]].map(c=>[c.key,t==="manager"?c.managerDefault!==!1:!!c.agentDefault&&!c.managerOnly]));function pe({tone:l="gray",children:t}){const c={green:"bg-green-500/20 text-green-400",yellow:"bg-yellow-500/20 text-yellow-400",red:"bg-red-500/20 text-red-400",gray:"bg-gray-500/20 text-gray-400"};return e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${c[l]}`,children:t})}function K({icon:l,label:t,value:c,tone:f="indigo"}){const y={indigo:"text-indigo-400 bg-indigo-500/10",green:"text-green-400 bg-green-500/10",amber:"text-amber-400 bg-amber-500/10"};return e.jsxs("div",{className:"bg-dark-800 border border-gray-700/50 rounded-xl p-4 flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center shrink-0 ${y[f]}`,children:e.jsx(l,{size:18})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-2xl font-bold text-gray-100 leading-tight tabular-nums",children:c}),e.jsx("div",{className:"text-xs text-gray-400 leading-tight",children:t})]})]})}function Ue({on:l,onClick:t,disabled:c}){return e.jsx("button",{type:"button",onClick:c?void 0:t,disabled:c,className:`relative w-11 h-6 rounded-full transition-colors shrink-0 ${c?"bg-gray-700 cursor-not-allowed opacity-50":l?"bg-indigo-500":"bg-gray-600"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 w-5 h-5 rounded-full transition-transform ${c?"bg-gray-400":"bg-white"} ${l&&!c?"translate-x-5":""}`})})}function Xa({open:l,member:t,busy:c,onClose:f,onConfirm:y}){const{locale:A}=Fe(),m=o=>(o==null?void 0:o[A])||(o==null?void 0:o.en)||(o==null?void 0:o.pt)||"",[j,x]=i.useState("");if(i.useEffect(()=>{l&&x("")},[l]),!t)return null;const v=(t.name||t.email||"").trim(),_=j===v&&v.length>0,L=(v||"?").charAt(0).toUpperCase();return e.jsxs(Ha,{open:l,onClose:f,closeOnBackdrop:!c,children:[e.jsx(Qa,{icon:e.jsx(ge,{}),iconTone:"danger",title:m(s.rmTitle),subtitle:e.jsxs(e.Fragment,{children:[m(s.rmSub1),e.jsx("span",{className:"dvm-sep",children:"·"}),m(s.rmSub2)]}),onClose:f}),e.jsxs("div",{className:"dvm-body",children:[e.jsxs("div",{className:"dvm-preview",children:[e.jsx("div",{className:"dvm-pv-av",children:L}),e.jsxs("div",{className:"dvm-pv-text",children:[e.jsx("div",{className:"dvm-pv-name",children:v||"â"}),e.jsxs("div",{className:"dvm-pv-sub",children:[t.email||"â",e.jsx("span",{className:"dvm-sep",children:"·"}),m(Qe[t.team_role])||t.team_role,e.jsx("span",{className:"dvm-sep",children:"·"}),m($e[t.scope])||t.scope]})]})]}),e.jsxs("div",{className:"dvm-notice err",children:[e.jsxs("div",{className:"dvm-row1",children:[e.jsx(He,{}),e.jsx("span",{className:"dvm-title",children:m(s.rmNoticeTitle)})]}),e.jsx("p",{children:m(s.rmNoticeBody).replace("{name}",v||m(s.thisMember))})]}),e.jsxs("div",{className:"dvm-field",children:[e.jsxs("label",{className:"dvm-lbl",children:[m(s.typeBefore)," ",e.jsx("code",{children:v})," ",m(s.typeAfter)]}
1),e.jsx("input",{className:"dvm-input mono",autoFocus:!0,value:j,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Enter"&&_&&!c&&(y==null||y())},placeholder:v}),e.jsx("div",{className:"dvm-hint",children:m(s.caseSensitive)})]})]}),e.jsxs($a,{children:[e.jsx("div",{className:"dvm-spacer"}),e.jsx("button",{className:"dvm-foot-btn",disabled:c,onClick:f,children:m(s.cancel)}),e.jsxs("button",{className:"dvm-foot-btn danger",disabled:!_||c,onClick:y,children:[c?e.jsx("span",{className:"dvm-spin"}):e.jsx(ge,{}),m(s.rmTitle)]})]})]})}const es=l=>{const t=String(l||"").replace(/\D+/g,"");return t?"+"+t:""};function Ge({s:l,on:t,onToggle:c}){return e.jsxs("label",{className:"flex items-center gap-3 bg-dark-700/40 border border-gray-700/50 rounded-xl px-3 py-2.5 cursor-pointer hover:border-gray-600",children:[l.img_url?e.jsx("img",{src:l.img_url,alt:"",className:"w-10 h-10 rounded-full object-cover shrink-0"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-indigo-500/20 text-indigo-300 flex items-center justify-center text-base font-semibold shrink-0",children:(l.name||"?").trim().charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-sm text-gray-100 font-medium truncate flex items-center gap-2",children:[l.name,e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-500/20 text-indigo-300",children:Ja(l.provider_type)})]}),e.jsx("div",{className:"text-xs text-gray-500",children:es(l.phone)||l.status})]}),e.jsx(Ue,{on:t,onClick:c})]})}function We({grupos:l,itens:t,valorDe:c,onToggle:f,papel:y,bloqueado:A,motivoBloqueio:m,t:j}){const x=t.filter(o=>!o.managerOnly||y==="manager"),v=(l||[]).filter(o=>x.some(g=>(g.group||"conta")===o.key));if(!v.length)return null;const _=o=>x.filter(g=>(g.group||"conta")===o.key),L=o=>_(o).every(g=>g.managerOnly);return e.jsx("div",{className:"space-y-3",children:v.map(o=>e.jsxs("div",{children:[e.jsxs("div",{className:"text-[11px] uppercase tracking-wide text-gray-500 font-semibold mb-1.5 flex items-center gap-1.5 flex-wrap",children:[j(Va[o.key])||o.label,L(o)&&e.jsxs("span",{className:"text-indigo-300/70 normal-case tracking-normal font-normal",children:["· ",j(s.onlyManager)]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-1.5",children:_(o).map(g=>{const C=A?A(g.key):!1,q=Ya[g.key],B=!!c(g.key)&&!C;return e.jsxs("div",{className:"bg-dark-700/50 rounded-lg px-3 py-2",children:[e.jsxs("label",{className:`flex items-center justify-between gap-2 ${C?"cursor-not-allowed":"cursor-pointer"}`,children:[e.jsxs("span",{className:`text-sm leading-snug min-w-0 ${C?"text-gray-500":"text-gray-200"}`,children:[j(Ka[g.key])||g.label,g.managerOnly&&!L(o)&&e.jsx("span",{className:"ml-1.5 text-[10px] uppercase tracking-wide text-indigo-300/70 whitespace-nowrap",children:j(s.onlyManager)})]}),e.jsx(Ue,{on:B,disabled:C,onClick:()=>f(g.key)})]}),q&&B&&!C&&e.jsxs("p",{className:"text-[11px] text-amber-400/90 leading-snug mt-1 flex gap-1.5",children:[e.jsx(He,{size:12,className:"shrink-0 mt-0.5"}),e.jsx("span",{children:j(q)})]}),C&&m&&e.jsx("p",{className:"text-[11px] text-gray-500 leading-snug mt-1",children:m})]},g.key)})})]},o.key))})}function cs(){const{locale:l}=Fe(),t=a=>(a==null?void 0:a[l])||(a==null?void 0:a.en)||(a==null?void 0:a.pt)||"",[c,f]=i.useState(!0),[y,A]=i.useState(!1),[m,j]=i.useState([]),[x,v]=i.useState([]),[_,L]=i.useState(null),{user:o}=Ea(),[g,C]=i.useState(!1),q=g||Oe(o,"team.manage_members"),B=g||Oe(o,"team.settings"),V=a=>q?g?!0:Number(a==null?void 0:a.member_user_id)===Number((o==null?void 0:o.id)||(o==null?void 0:o.userId))?!1:((a==null?void 0:a.team_role)||"agent")==="agent":!1,[Ke,z]=i.useState(!1),[N,R]=i.useState({name:"",email:"",team_role:"agent",scope:"assigned"}),[S,Ve]=i.useState({pages:[],caps:[],groups:[]}),[ue,Y]=i.useState({}),[xe,he]=i.useState(new Set),[ve,G]=i.useState(!1),[Ye,W]=i.useState(!1),[F,Z]=i.useState({name:"",assignment_mode:"round_robin"}),[H,J]=i.useState(null),[be,fe]=i.useState(!1),[Ze,T]=i.useState(!1),[p,Je]=i.useState(null),[X,ye]=i.useState("assigned"),[P,je]=i.useState("agent"),[Xe,Ne]=i.useState([]),[ea,Ce]=i.useState([]),[ke,ee]=i.useState(0),[ae,Ae]=i.useState([]),[se,I]=i.useState([]),[Q,D]=i.useState([]),[te,ne]=i.useState(new Set),[aa,Se]=i.useState(!1),[sa,we]=i.useState(!1),[re,Me]=i.useState(""),[Ee,_e]=i.useState(!1),[Le,$]=i.useState(!1),[ie,Pe]=i.useState(""),[qe,Re]=i.useState(!1),w=i.useCallback(async()=>{var a,n,r;f(!0);try{const[d,k,O,b]=await Promise.all([h.get("/team").catch(()=>({data:null})),h.get("/team/members"),h.get("/team/sessions").catch(()=>({data:[]})),h.get("/team/pages/catalog").catch(()=>({data:null}))]);(a=b.data)!=null&&a.pages&&Ve(b.data),(n=d.data)!=null&&n.team&&(L(d.data.team),Z({n
1ame:d.data.team.name||"",assignment_mode:d.data.team.assignment_mode||"round_robin"}),C(d.data.teamRole==="owner")),j(k.data||[]),v(O.data||[]),A(!1)}catch(d){((r=d.response)==null?void 0:r.status)===403?A(!0):u.error(Ua(s.errLoadTeam))}finally{f(!1)}},[]);i.useEffect(()=>{w()},[w]);const ta=()=>{R({name:"",email:"",team_role:"agent",scope:"assigned"}),Y(me(S,"agent")),he(new Set(x.map(a=>a.session_id))),z(!0)},na=a=>{R(n=>({...n,team_role:a})),Y(me(S,a))},ra=a=>Y(n=>({...n,[a]:!n[a]})),ia=a=>he(n=>{const r=new Set(n);return r.has(a)?r.delete(a):r.add(a),r}),oa=async a=>{var n,r;if(a.preventDefault(),!N.name.trim()||!N.email.trim()){u.error(t(s.errNameEmail));return}G(!0);try{const d=x.map(b=>b.session_id),k=d.filter(b=>xe.has(b)),O=k.length===d.length?[]:k;await h.post("/team/members",{...N,pages:ue,session_ids:O}),u.success(t(s.okInviteSent)),z(!1),w()}catch(d){u.error(((r=(n=d.response)==null?void 0:n.data)==null?void 0:r.error)||t(s.errAddMember))}finally{G(!1)}},la=async()=>{var a,n;if(H){fe(!0);try{await h.delete(`/team/members/${H.id}`),u.success(t(s.okMemberRemoved)),J(null),w()}catch(r){u.error(((n=(a=r.response)==null?void 0:a.data)==null?void 0:n.error)||t(s.errRemove))}finally{fe(!1)}}},ca=async a=>{var n,r;if(a.invite_id)try{await h.post(`/team/invites/${a.invite_id}/resend`),u.success(t(s.okInviteResent))}catch(d){u.error(((r=(n=d.response)==null?void 0:n.data)==null?void 0:r.error)||t(s.errResend))}},da=async()=>{var a,n;G(!0);try{await h.patch("/team",{name:F.name,assignment_mode:F.assignment_mode}),u.success(t(s.okSettingsSaved)),W(!1),w()}catch(r){u.error(((n=(a=r.response)==null?void 0:a.data)==null?void 0:n.error)||t(s.errSave))}finally{G(!1)}},ma=async a=>{Je(a),ye(a.scope),je(a.team_role||"agent"),ee(Number(a.capacity)||0),T(!0),Se(!0),I([]),D([]),Ne([]),Ce([]),Ae([]),ne(new Set),Me(""),$(!1),Pe("");try{const[n,r]=await Promise.all([h.get(`/team/members/${a.id}/pages`),h.get(`/team/members/${a.id}/sessions`)]);I(n.data.pages||[]),D(n.data.caps||[]),Ae(n.data.groups||[]),Ne(n.data.pages||[]),Ce(n.data.caps||[]);const d=r.data.session_ids||[];ne(d.length?new Set(d):new Set(x.map(k=>k.session_id)))}catch{u.error(t(s.errLoadMemberCfg))}finally{Se(!1)}},pa=async()=>{var a,n;if(p){_e(!0);try{const{data:r}=await h.post(`/team/members/${p.id}/invite-link`);Me(r.url),$(!1)}catch(r){u.error(((n=(a=r.response)==null?void 0:a.data)==null?void 0:n.error)||t(s.errGenLink))}finally{_e(!1)}}},ga=async()=>{try{await navigator.clipboard.writeText(re),$(!0),u.success(t(s.okLinkCopied)),setTimeout(()=>$(!1),2500)}catch{u.error(t(s.errCopy))}},ua=async()=>{var a,n;if(p){if(ie.trim().length<6){u.error(t(s.errPassMin));return}Re(!0);try{await h.post(`/team/members/${p.id}/activate`,{password:ie}),u.success(t(s.okActivated).replace("{name}",p.name)),T(!1),w()}catch(r){u.error(((n=(a=r.response)==null?void 0:a.data)==null?void 0:n.error)||t(s.errActivate))}finally{Re(!1)}}},xa=a=>{if(je(a),a===((p==null?void 0:p.team_role)||"agent")){I(Xe),D(ea);return}const n=me(S,a);I(r=>r.map(d=>({...d,enabled:!!n[d.key]}))),D(r=>r.map(d=>({...d,enabled:!!n[d.key]})))},ha=(ae&&ae.length?ae:S.groups)||[],va=Object.fromEntries([...se,...Q].map(a=>[a.key,a])),ba=a=>I(n=>n.map(r=>r.key===a?{...r,enabled:!r.enabled}:r)),fa=a=>D(n=>n.map(r=>r.key===a?{...r,enabled:!r.enabled}:r)),ya=a=>ne(n=>{const r=new Set(n);return r.has(a)?r.delete(a):r.add(a),r}),Te=["web","cloud_api"],ja=x.filter(a=>Te.includes(a.provider_type)&&te.has(a.session_id)),Na=x.some(a=>Te.includes(a.provider_type)),Ie=a=>(a==="chat.calls"||a==="chat.calls_unassigned")&&ja.length===0,Ca=t(Na?s.capBlockedHasWeb:s.capBlockedNoWeb),ka=async()=>{var a,n;if(p){we(!0);try{const r=x.map(M=>M.session_id),d=r.filter(M=>te.has(M)),k=d.length===r.length?[]:d,O=Object.fromEntries([...se,...Q].map(M=>[M.key,Ie(M.key)?!1:!!M.enabled])),b={};X!==p.scope&&(b.scope=X),P!==p.team_role&&(b.team_role=P);const De=Math.max(0,parseInt(ke,10)||0);De!==(Number(p.capacity)||0)&&(b.capacity=De),await Promise.all([Object.keys(b).length?h.patch(`/team/members/${p.id}`,b):Promise.resolve(),h.put(`/team/members/${p.id}/pages`,{pages:O}),h.put(`/team/members/${p.id}/sessions`,{session_ids:k})]),u.success(t(s.okMemberSaved)),T(!1),w()}catch(r){u.error(((n=(a=r.response)==null?void 0:a.data)==null?void 0:n.error)||t(s.errSave))}finally{we(!1)}}},Aa=a=>a==="active"?e.jsx(pe,{tone:"green",children:t(s.stActive)}):a==="pending"?e.jsx(pe,{tone:"yellow",children:t(s.stPending)}):e.jsx(pe,{tone:"red",children:t(s.stInactive)}
1),Sa=m.filter(a=>a.status==="active").length,wa=m.filter(a=>a.status==="pending").length,Ma=m.filter(a=>a.team_role==="manager").length;return c?e.jsx("div",{className:"py-20 flex justify-center",children:e.jsx(Be,{})}):y?e.jsxs("div",{className:"max-w-2xl mx-auto py-16 text-center",children:[e.jsx(oe,{className:"mx-auto text-gray-500 mb-4",size:40}),e.jsx("h2",{className:"text-xl font-bold text-gray-200 mb-2",children:t(s.forbiddenTitle)}),e.jsx("p",{className:"text-gray-400 text-sm",children:t(s.forbiddenHint)})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl bg-indigo-500/10 flex items-center justify-center",children:e.jsx(U,{className:"text-indigo-400",size:22})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-100",children:t(s.pageTitle)}),e.jsx("p",{className:"text-gray-400 text-sm",children:t(s.pageSub)})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(ze,{to:"/dashboard/team/dashboard",className:"px-3 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-dark-700 text-sm flex items-center gap-1.5",children:[e.jsx(_a,{size:15})," ",t(s.metrics)]}),e.jsxs(ze,{to:"/dashboard/team/atividade",className:"px-3 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-dark-700 text-sm flex items-center gap-1.5",children:[e.jsx(La,{size:15})," ",t(s.activity)]}),B&&e.jsxs("button",{onClick:()=>W(!0),className:"px-3 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-dark-700 text-sm flex items-center gap-1.5",children:[e.jsx(Pa,{size:15})," ",t(s.settings)]}),q&&e.jsxs(E,{variant:"primary",onClick:ta,children:[e.jsx(qa,{className:"inline mr-1",size:15})," ",t(s.addMember)]})]})]}),m.length>0&&e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[e.jsx(K,{icon:U,label:t(s.kpiMembers),value:m.length,tone:"indigo"}),e.jsx(K,{icon:Ra,label:t(s.kpiActive),value:Sa,tone:"green"}),e.jsx(K,{icon:Ta,label:t(s.kpiPending),value:wa,tone:"amber"}),e.jsx(K,{icon:oe,label:t(s.kpiManagers),value:Ma,tone:"indigo"})]}),m.length===0?e.jsx("div",{className:"bg-dark-800 border border-gray-700/50 rounded-xl p-6 mb-4",children:e.jsx(Fa,{icon:U,title:t(s.emptyTitle),hint:t(s.emptyHint)})}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4 mb-4",children:m.map(a=>e.jsxs("div",{className:"bg-dark-800 border border-gray-700/50 rounded-xl p-4 flex flex-col gap-3 hover:border-gray-600 transition-colors",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-11 h-11 rounded-full bg-indigo-500/20 text-indigo-300 flex items-center justify-center text-base font-semibold shrink-0",children:(a.name||"?").trim().charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-gray-100 truncate",children:a.name}),e.jsx("div",{className:"text-xs text-gray-500 truncate",children:a.email})]}),Aa(a.status)]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-gray-300 bg-dark-700/60 rounded-lg px-2 py-1",children:[e.jsx(oe,{size:12,className:"text-gray-500"}),t(Qe[a.team_role])||a.team_role]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-gray-300 bg-dark-700/60 rounded-lg px-2 py-1",children:[e.jsx(U,{size:12,className:"text-gray-500"}),t($e[a.scope])||a.scope]})]}),e.jsxs("div",{className:"flex items-center gap-1 pt-2 border-t border-gray-700/40 -mb-1",children:[V(a)&&a.status==="pending"&&a.invite_id&&e.jsxs("button",{onClick:()=>ca(a),className:"flex-1 flex items-center justify-center gap-1.5 text-xs text-gray-300 hover:text-indigo-300 hover:bg-dark-700 rounded-lg py-2",title:t(s.resendInvite),children:[e.jsx(Ia,{size:14})," ",t(s.resend)]}),V(a)&&e.jsxs("button",{onClick:()=>ma(a),className:"flex-1 flex items-center justify-center gap-1.5 text-xs text-gray-300 hover:text-indigo-300 hover:bg-dark-700 rounded-lg py-2",title:t(s.configAccess),children:[e.jsx(Da,{size:14})," ",t(s.access)]}),V(a)&&e.jsx("button",{onClick:()=>J(a),className:"flex items-center justify-center text-gray-400 hover:text-rose-300 hover:bg-dark-700 rounded-lg py-2 px-3",title:t(s.remove),children:e.jsx(ge,{size:14})})]})]},a.id))}),e.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1.5",children:[e.jsx(le,{size:13})," ",t(s.footNote1)," ",e.jsx("b",{className:"text-gray-400",children:t(s.configAccess)})," ",t(s.footNote2)]}),e.jsx(Xa,{open:!!H,member:H,busy:be,onClose:()=>{be||J(null)},onConfirm:la}),e.jsx(de,{open:Ke,onClose:()=>z(!1),title:t(s.addMember),closeOnBackdrop:!1,size:"xl",children:e.jsxs("form",{onSubmit:oa,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsx(ce,{label:t(s.fName),value:N.name,onChange:a=>R(n=>({...n,name:a.target.value})),placeholder:t(s.fNamePh),autoFocus:!0}),e.jsx(ce,{label:t(s.fEmail),type:"email",value:N.email,onChange:a=>R(n=>({...n,email:a.target.value})),placeholder:t(s.fEmailPh)}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:t(s.fRole)}),e.jsxs("select",{value:N.team_role,onChange:a=>na(a.target.value),className:"w-full bg-dark-700 border border-gray-600 rounded-lg px-3 py-2 text-gray-200 text-sm",children:[e.jsx("option",{value:"agent",children:t(s.roleAgent)}),g&&e.jsx("option",{value:"manager",children:t(s.optManagerFull)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:t(s.fScope)}
1),e.jsxs("select",{value:N.scope,onChange:a=>R(n=>({...n,scope:a.target.value})),className:"w-full bg-dark-700 border border-gray-600 rounded-lg px-3 py-2 text-gray-200 text-sm",children:[e.jsx("option",{value:"assigned",children:t(s.optScopeAssigned)}),e.jsx("option",{value:"queue",children:t(s.optScopeQueue)}),e.jsx("option",{value:"all",children:t(s.optScopeAll)})]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-gray-300 font-medium mb-2",children:t(s.pagesLogin)}),e.jsx(We,{grupos:S.groups,itens:[...S.pages||[],...S.caps||[]].filter(a=>a.key!=="chat.calls"&&a.key!=="chat.calls_unassigned"),valorDe:a=>!!ue[a],onToggle:ra,papel:N.team_role,t}),N.team_role==="manager"&&e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:t(s.managerPagesHint)})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-gray-300 font-medium mb-1.5 flex items-center gap-1.5",children:[e.jsx(le,{size:14})," ",t(s.devicesChat)]}),x.length===0?e.jsx("p",{className:"text-xs text-gray-500",children:t(s.noDevicesYet)}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-1.5 max-h-52 overflow-y-auto",children:x.map(a=>e.jsx(Ge,{s:a,on:xe.has(a.session_id),onToggle:()=>ia(a.session_id)},a.session_id))}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[t(s.allCheckedNote1)," ",e.jsx("b",{children:t(s.configAccess)}),t(s.allCheckedNote2)]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>z(!1),children:t(s.cancel)}),e.jsx(E,{type:"submit",variant:"primary",loading:ve,className:"flex-1",children:t(s.sendInvite)})]})]})}),e.jsx(de,{open:Ye,onClose:()=>W(!1),title:t(s.teamSettings),closeOnBackdrop:!1,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(ce,{label:t(s.teamName),value:F.name,onChange:a=>Z(n=>({...n,name:a.target.value})),placeholder:t(s.teamNamePh)}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:t(s.assignMode)}),e.jsxs("select",{value:F.assignment_mode,onChange:a=>Z(n=>({...n,assignment_mode:a.target.value})),className:"w-full bg-dark-700 border border-gray-600 rounded-lg px-3 py-2 text-gray-200 text-sm",children:[e.jsx("option",{value:"manual",children:t(s.optManual)}),e.jsx("option",{value:"round_robin",children:t(s.optRoundRobin)}),e.jsx("option",{value:"least_open",children:t(s.optLeastOpen)})]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>W(!1),children:t(s.cancel)}),e.jsx(E,{type:"button",variant:"primary",loading:ve,className:"flex-1",onClick:da,children:t(s.save)})]})]})}),e.jsx(de,{open:Ze,onClose:()=>T(!1),title:p?t(s.accessOf).replace("{name}",p.name):t(s.access),closeOnBackdrop:!1,size:"xl",children:aa?e.jsx("div",{className:"py-8 flex justify-center",children:e.jsx(Be,{})}):e.jsxs("div",{className:"space-y-5",children:[(p==null?void 0:p.status)!=="active"&&e.jsxs("div",{className:"bg-indigo-500/5 border border-indigo-500/20 rounded-xl p-3.5 space-y-3",children:[e.jsxs("div",{className:"text-sm text-gray-200 font-medium flex items-center gap-1.5",children:[e.jsx(Oa,{size:15,className:"text-indigo-400"})," ",t(s.grantAccess)]}),re?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{readOnly:!0,value:re,onFocus:a=>a.target.select(),className:"flex-1 min-w-0 bg-dark-700 border border-gray-600 rounded-lg px-3 py-2 text-xs text-gray-300"}),e.jsxs("button",{type:"button",onClick:ga,title:t(s.copyLink),className:"shrink-0 flex items-center gap-1.5 text-sm bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg px-3 py-2",children:[Le?e.jsx(za,{size:14}):e.jsx(Ga,{size:14}),t(Le?s.copied:s.copy)]})]}):e.jsxs("button",{type:"button",onClick:pa,disabled:Ee,className:"w-full flex items-center justify-center gap-2 text-sm text-indigo-300 border border-indigo-500/40 hover:bg-indigo-500/10 rounded-lg py-2 disabled:opacity-60",children:[e.jsx(Ba,{size:14})," ",t(Ee?s.generating:s.genInviteLink)]}),e.jsx("p",{className:"text-xs text-gray-500",children:t(s.inviteLinkHint)}),e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-gray-600",children:[e.jsx("span",{className:"flex-1 h-px bg-gray-700/60"}),t(s.orGrantNow),e.jsx("span",{className:"flex-1 h-px bg-gray-700/60"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1 min-w-0",children:[e.jsx(Wa,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500"}),e.jsx("input",{value:ie,onChange:a=>Pe(a.target.value),placeholder:t(s.passPh),className:"w-full bg-dark-700 border border-gray-600 rounded-lg pl-8 pr-3 py-2 text-sm text-gray-200"})]}),e.jsx("button",{type:"button",onClick:ua,disabled:qe,className:"shrink-0 text-sm bg-emerald-600 hover:bg-emerald-500 text-white rounded-lg px-3 py-2 disabled:opacity-60",children:t(qe?s.activating:s.activate)})]}),e.jsx("p",{className:"text-xs text-gray-500",children:t(s.activateHint)})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:t(s.fRole)}),e.jsxs("select",{value:P,onChange:a=>xa(a.target.value),className:"w-full bg-dark-700 border border-gray-600 rounded-lg px-3 py-2 text-gray-200 text-sm",children:[e.jsx("option",{value:"agent",children:t(s.roleAgent)}),e.jsx("option",{value:"manager",children:t(s.optManagerFull)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:t(s.fScope)}),e.jsxs("select",{value:X,onChange:a=>ye(a.target.value),className:"w-full bg-dark-700 border border-gray-600 rounded-lg px-3 py-2 text-gray-200 text-sm",children:[e.jsx("option",{value:"assigned",children:t(s.optScopeAssigned)}),e.jsx("option",{value:"queue",children:t(s.optScopeQueue)}),e.jsx("option",{value:"all",children:t(s.optScopeAll)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:t(s.fCapacity)}),e.jsx("input",{type:"number",min:0,max:999,value:ke,onChange:a=>ee(a.target.value),onBlur:a=>ee(Math.max(0,parseInt(a.target.value,10)||0)),className:"w-full bg-dark-700 border border-gray-600 rounded-lg px-3 py-2 text-gray-200 text-sm"})]})]}),e.jsxs("p",{className:"text-xs text-gray-500 -mt-2",children:[P==="manager"&&(p==null?void 0:p.team_role)!=="manager"?t(s.roleChangeHint)+" ":"",t(s.fCapacityHint)]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-gray-300 font-medium mb-2",children:t(s.pagesLogin)}),e.jsx(We,{grupos:ha,itens:[...se,...Q],valorDe:a=>{var n;return!!((n=va[a])!=null&&n.enabled)},onToggle:a=>Q.some(n=>n.key===a)?fa(a):ba(a),papel:P,bloqueado:Ie,motivoBloqueio:Ca,t}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:t(P==="manager"?s.managerPagesHint:s.callsNote)})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-gray-300 font-medium mb-2 flex items-center gap-1.5",children:[e.jsx(le,{size:14})," ",t(s.devicesUsed)]}),x.length===0?e.jsx("p",{className:"text-xs text-gray-500",children:t(s.noDevices)}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-1.5 max-h-56 overflow-y-auto",children:x.map(a=>e.jsx(Ge,{s:a,on:te.has(a.session_id),onToggle:()=>ya(a.session_id)},a.session_id))}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t(s.devicesNote)})]}),e.jsxs("div",{className:"flex gap-3 pt-1",children:[e.jsx(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>T(!1),children:t(s.cancel)}),e.jsx(E,{type:"button",variant:"primary",loading:sa,className:"flex-1",onClick:ka,children:t(s.saveAcce
1ss)})]})]})})]})}export{cs as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.