PageSourceSearch

https://sentinel365.ai/assets/AdminPage-D6hH_93d.js

js sentinel365.ai collected 2026-10-04 01:56:26 UTC 41,009 bytes, 15 lines download raw bytes

1import{r as i,j as e,u as Se}from"./react-vendor-pafHdoJx.js";import{d as u,a as Ne,b as ce,c as y,Y as Pe,M as Z,Z as oe,$ as U,a0 as xe,t as Ie,a1 as Ee,a2 as Oe,s as De}from"./index-Db0fDLGN.js";import{T as Me}from"./perfil-DZ2OrrZB.js";import{L as M,c7 as Te,as as ve,ap as J,l as fe,aT as me,S as se,x as pe,n as Re,B as ue,J as X,U as K,a5 as he,_ as ee,a4 as B,cu as ze,at as Le,P as Fe,aH as $e,c as Ue,am as Be,r as Ve,v as qe,o as _e,ae as Je,al as be,D as Ge,cv as Qe,bw as Xe,ah as Ke,w as He,b5 as ge}from"./ui-vendor-DLXJn6s3.js";import"./map-vendor-Dr8zbd0c.js";import"./firebase-vendor-D3UzkAhn.js";function We(){var k,V,q,f;const[t,S]=i.useState(null),[m,c]=i.useState(null),[L,T]=i.useState(!0),[h,P]=i.useState(!1),[b,R]=i.useState(!1),[I,F]=i.useState(""),[N,p]=i.useState(""),[v,E]=i.useState(""),w=async()=>{T(!0),p("");try{const[r,n]=await Promise.all([u.pisoAnttAtual(),u.pisoAnttPendente().catch(()=>({exists:!1}))]);S(r),c(n)}catch(r){p(r.message)}finally{T(!1)}};i.useEffect(()=>{w()},[]);const a=async()=>{var r;if(confirm(`Aplicar tabela pendente? Isso substituirá a tabela ativa em todas as orgs (afeta floor-guard).
2
3Mudanças: ${((r=m==null?void 0:m.diff)==null?void 0:r.changes)||0}`)){P(!0),p(""),E("");try{const n=await u.pisoAnttApply({fromPendente:!0});E(`Aplicada: ${n.resolution}`),await w()}catch(n){p(n.message)}finally{P(!1)}}},o=async()=>{p(""),E("");let r;try{r=JSON.parse(I)}catch(n){p(`JSON inválido: ${n.message}`);return}if(!r.rates){p('Faltou "rates" no JSON.');return}if(confirm(`Aplicar tabela manual (${r.resolution||"sem resolução"})?`)){P(!0);try{const n=await u.pisoAnttApply(r);E(`Aplicada manualmente: ${n.resolution}`),R(!1),F(""),await w()}catch(n){p(n.message)}finally{P(!1)}}};if(L)return e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(M,{className:"w-5 h-5 text-slate-400 animate-spin"})});const C=t!=null&&t.fetchedAt?Math.floor((Date.now()-t.fetchedAt)/864e5):null;return e.jsxs("div",{className:"card p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Te,{className:"w-5 h-5 text-indigo-400"}),e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Tabela de Piso ANTT (PMPF)"})]}),e.jsxs("button",{onClick:w,disabled:h,className:"btn-ghost text-xs flex items-center gap-1",children:[e.jsx(ve,{className:h?"w-3.5 h-3.5 animate-spin":"w-3.5 h-3.5"}),"Atualizar"]})]}),N&&e.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/30 p-3 text-sm text-red-300",children:N}),v&&e.jsx("div",{className:"rounded-lg bg-emerald-500/10 border border-emerald-500/30 p-3 text-sm text-emerald-300",children:v}),e.jsxs("div",{className:"rounded-lg bg-slate-900/40 border border-slate-700/40 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs uppercase tracking-wider text-slate-300",children:"Ativa"}),e.jsxs("span",{className:"text-xs text-slate-400",children:[t!=null&&t.exists?t.resolution:"Sem tabela",C!=null&&` · ${C} dias`]})]}),(t==null?void 0:t.rates)&&e.jsxs("p",{className:"text-xs text-slate-300 mt-1",children:[Object.keys(t.rates).length," tipos de carga ·"," ","geral[6 eixos] = R$ ",(((k=t.rates.geral)==null?void 0:k[6])??0).toFixed(2),"/km"]})]}),m!=null&&m.exists?e.jsxs("div",{className:"rounded-lg bg-amber-500/5 border border-amber-500/30 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-xs uppercase tracking-wider text-amber-400 font-bold",children:["Pendente — ",((V=m.diff)==null?void 0:V.changes)??0," mudanças"]}),e.jsx("a",{href:m.fonte,target:"_blank",rel:"noreferrer",className:"text-xs text-indigo-400 hover:text-indigo-300",children:"Fonte"})]}),e.jsx("p",{className:"text-xs text-slate-300",children:m.resolution}),((f=(q=m.diff)==null?void 0:q.details)==null?void 0:f.length)>0&&e.jsx("div",{className:"max-h-64 overflow-auto text-[11px] border border-slate-700/40 rounded",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-slate-900/60 sticky top-0",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-1.5",children:"Tipo"}),e.jsx("th",{className:"text-left p-1.5",children:"Eixos"}),e.jsx("th",{className:"text-right p-1.5",children:"Antes"}),e.jsx("th",{className:"text-right p-1.5",children:"Depois"}),e.jsx("th",{className:"text-right p-1.5",children:"Δ%"})]})}),e.jsx("tbody",{children:m.diff.details.slice(0,100).map((r,n)=>e.jsxs("tr",{className:"border-t border-slate-800/40",children:[e.jsx("td",{className:"p-1.5 text-slate-300",children:r.tipoCarga}),e.jsx("td",{className:"p-1.5 text-slate-400",children:r.eixos}),e.jsx("td",{className:"p-1.5 text-right text-slate-500",children:r.antes==null?"—":r.antes.toFixed(4)}),e.jsx("td",{className:"p-1.5 text-right text-slate-200",children:r.depois.toFixed(4)}),e.jsx("td",{className:"p-1.5 text-right "+(r.deltaPct==null?"text-slate-500":r.deltaPct>0?"text-emerald-400":"text-red-400"),children:r.deltaPct==null?"novo":`${r.deltaPct>0?"+":""}${r.deltaPct.toFixed(2)}%`})]},n))})]})}),e.jsxs("button",{onClick:a,disabled:h,className:"btn-primary text-sm flex items-center gap-2",children:[h?e.jsx(M,{className:"w-4 h-4 animate-spin"}):e.jsx(J,{className:"w-4 h-4"}),"Aplicar pendente"]})]}):e.jsxs("div",{className:"text-xs text-slate-500 italic flex items-center gap-2",children:[e.jsx(fe,{className:"w-3.5 h-3.5"}),"Sem atualização pendente do scrape ANTT."]}),e.jsxs("div",{className:"border-t border-slate-800/40 pt-3",children:[e.jsxs("button",{onClick:()=>R(r=>!r),className:"text-xs text-slate-400 hover:text-slate-200 flex items-center gap-1",children:[e.jsx(me,{className:"w-3.5 h-3.5"}),b?"Cancelar upload manual":"Upload manual (PDF/XLSX da ANTT)"]}),b&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Cole JSON com formato: ",'{ "rates": { "geral": { "6": 3.93, ... }, ... }, "resolution": "Resolução X/2027", "fonte": "URL" }']}),e.jsx("textarea",{value:I,onChange:r=>F(r.target.value),placeholder:'{"rates":{"geral":{"6":3.93}},"resolution":"Resolução X/2027"}',rows:8,className:"input w-full text-xs font-mono"}),e.jsxs("button",{onClick:o,disabled:h||!I.trim(),className:"btn-primary text-sm flex items-center gap-2",children:[h?e.jsx(M,{className:"w-4 h-4 animate-spin"}):e.jsx(me,{className:"w-4 h-4"}),"Aplicar manual"]})]})]})]})}
3function _(t){return t.toLocaleString("pt-BR",{style:"currency",currency:"BRL"})}function Ye(t){return t?(t._seconds?new Date(t._seconds*1e3):new Date(t)).toLocaleDateString("pt-BR"):"—"}function Ze(t){return t<=5?"ignicao":t<=15?"estrada":t<=50?"rota":t<=150?"frota":"comando"}const je={Truck:He,TowerControl:Ke,ShoppingCart:Xe,Network:Qe,ShieldCheck:Ge,Package:B};function ds(){const{role:t}=Ne();return t!=="super_admin"?e.jsxs("div",{className:"text-center py-20",children:[e.jsx(se,{className:"w-12 h-12 text-red-400 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-bold text-white mb-2",children:"Acesso Restrito"}),e.jsx("p",{className:"text-slate-400",children:"Esta área é exclusiva para administradores da Sentinel AI."})]}):e.jsx(es,{})}function es(){const{startImpersonation:t,isImpersonating:S}=Ne(),m=Se(),{data:c,loading:L,refetch:T}=ce(()=>u.adminStats(),[]),{data:h,loading:P,refetch:b}=ce(()=>u.adminOrganizations(),[]),[R,I]=i.useState(null),[F,N]=i.useState(null),[p,v]=i.useState(null),[E,w]=i.useState(!1),[a,o]=i.useState({orgName:"",cnpj:"",city:"",state:"",adminEmail:"",adminName:"",vehicleCount:0,pilotEndsAt:"",pilotCriteria:"",profileId:"transportador",variantId:"completo"}),[C,k]=i.useState(!1),[V,q]=i.useState(""),[f,r]=i.useState(null),[n,H]=i.useState(null),[$,G]=i.useState([]),[ae,te]=i.useState(!1),[z,W]=i.useState([]),[le,re]=i.useState(!1),ye=L||P,we=async()=>{if(!(!a.orgName||!a.adminEmail)){k(!0),q("");try{const s=U(a.profileId),l=s!=null&&s.variants?a.variantId:void 0,d=await u.adminProvisionOrg({orgName:a.orgName,cnpj:a.cnpj,city:a.city,state:a.state,adminEmail:a.adminEmail,adminName:a.adminName,vehicleCount:a.vehicleCount,plan:Ze(a.vehicleCount),profileId:a.profileId,variantId:l,pilotEndsAt:a.pilotEndsAt||void 0,pilotCriteria:a.pilotCriteria||void 0});w(!1),o({orgName:"",cnpj:"",city:"",state:"",adminEmail:"",adminName:"",vehicleCount:0,pilotEndsAt:"",pilotCriteria:"",profileId:"transportador",variantId:"completo"}),r(d),b(),T()}catch(s){q(s.message)}finally{k(!1)}}},Ce=[{id:"embarcador",label:"Embarcador",desc:"contrata frete — abre Torre/Pedidos/NF-e"},{id:"transportador",label:"Transportador",desc:"move carga — abre Connect/TMS"},{id:"operador_logistico",label:"Operador logístico",desc:"os dois lados (3PL/fulfillment)"},{id:"gr",label:"Gerenciadora de risco",desc:"opera a malha dos clientes"}],ke=async()=>{if(!(!n||z.length===0)){re(!0);try{await u.adminSetOrgPapeis(n.id,z),b()}catch(s){alert(s.message)}finally{re(!1)}}},[Y,ie]=i.useState(null),ne=async(s,l)=>{if(!n)return;const d=xe(s,l),x=U(s);if(!(!d||!x)&&confirm(`Aplicar o tipo "${x.label}"? Isso liga ${d.modules.length} módulos e ajusta o papel da organização.`)){ie(s);try{const O=await u.adminUpdateEntitlements(n.id,d.modules);await u.adminSetOrgPapeis(n.id,x.papeis),G(O.modules),W(x.papeis),b()}catch(O){alert(O.message)}finally{ie(null)}}},Ae=async()=>{if(n){te(!0);try{const s=await u.adminUpdateEntitlements(n.id,$);G(s.modules),b()}catch(s){alert(s.message)}finally{te(!1)}}};return ye?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(M,{className:"w-8 h-8 text-brand-500 animate-spin"})}):e.jsxs("div",{style:{color:"var(--page-text)"},className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-red-600/15 flex items-center justify-center",children:e.jsx(se,{className:"w-5 h-5 text-red-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--page-text)"},children:"Painel Master"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"Sentinel AI — Administração da Plataforma"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-2 px-4 py-2 bg-brand-600 hover:bg-brand-500 rounded-xl text-sm font-semibold transition-all",children:[e.jsx(pe,{className:"w-4 h-4"}),"Nova Organização"]}),e.jsx("button",{onClick:()=>{b(),T()},className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 transition-colors",children:e.jsx(ve,{className:"w-4 h-4"})})]})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(D,{icon:Re,label:"MRR Total",value:_(c.totalMRRWithAI||c.estimatedMRR),color:"text-green-400"}),e.jsx(D,{icon:ue,label:"Organizações",value:`${c.activeOrganizations??c.totalOrganizations} ativas`,color:"text-brand-400"}),e.jsx(D,{icon:X,label:"Veículos",value:c.totalVehicles??0,color:"text-emerald-400"}),e.jsx(D,{icon:K,label:"Motoristas",value:c.totalActiveDrivers,color:"text-amber-400"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(D,{icon:he,label:"MRR Base",value:_(c.estimatedMRR),color:"text-slate-300"}),e.jsx(D,{icon:ee,label:"Receita IA/mês",value:_(c.aiRevenueThisMonth??0),color:"text-violet-400"}),e.jsx(D,{icon:B,label:"Ações IA/mês",value:c.totalAIActionsThisMonth??0,color:"text-violet-400"}),e.jsx(D,{icon:K,label:"Gestores",value:c.totalActiveManagers,color:"text-amber-400"})]}),c.planDistribution&&e.jsxs("div",{className:"card",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3",children:"Distribuição por Plano"}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[Object.entries(c.planDistribution).map(([s,l])=>e.jsxs("span",{className:"text-xs px-3 py-1.5 rounded-lg bg-slate-800 border border-slate-700 text-slate-300",children:[e.jsx("span",{className:"font-semibold text-white",children:l})," ",s]},s)),c.cycleDistribution&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-700",children:"|"}),e.jsxs("span",{className:"text-xs px-3 py-1.5 rounded-lg bg-blue-500/10 border border-blue-500/20 text-blue-400",children:[c.cycleDistribution.annual??0," anuais"]}),e.jsxs("span",{className:"text-xs px-3 py-1.5 rounded-lg bg-slate-800 border border-slate-700 text-slate-400",children:[c.cycleDistribution.monthly??0," mensais"]})]}),c.suspendedOrganizations>0&&e.jsxs("span",{className:"text-xs px-3 py-1.5 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400",children:[c.suspendedOrganizations," suspensas"]})]})]})]}),e.jsx(We,{}),e.jsxs("div",{className:"card",children:[e.jsxs("h2",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(ue,{className:"w-5 h-5 text-brand-400"}),"Organizações (",(h==null?void 0:h.length)||0,")"]}),e.jsx("div",{className:"space-y-2",children:h==null?void 0:h.map(s=>{var O;const l=R===s.id,d=s.status==="suspended",x=s.mrr??0;return e.jsxs("div",{className:y("border rounded-xl transition-colors",d?"border-red-500/20 bg-red-500/5":"border-slate-700/50"),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer hover:bg-slate-800/30 transition-colors rounded-xl",onClick:()=>I(l?null:s.id),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:y("w-10 h-10 rounded-xl flex items-center justify-center text-sm font-bold",d?"bg-red-500/15 text-red-400":"bg-brand-600/15 text-brand-400"),children:(((O=s.name)==null?void 0:O[0])||"?").toUpperCase()}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold",style:{color:"var(--page-text)"},children:s.name}),d&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-red-500/15 text-red-400",children:"Suspenso"}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-brand-600/15 text-brand-400 border border-brand-500/20",children:s.planLabel||s.plan})]}),e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-muted)"},children:[s.cnpj||"Sem CNPJ"," • Criada em ",Ye(s.createdAt)]})]})]}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-4 text-xs",style:{color:"var(--page-text-secondary)"},children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(K,{className:"w-3 h-3"}),s.activeManagers]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{className:"w-3 h-3"}),s.activeDrivers]}),e.jsxs("span",{className:"font-medium text-emerald-400",children:[_(x),"/mês"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:j=>{j.stopPropagation(),v(p===s.id?null:s.id)},className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 transition-colors",children:e.jsx(ze,{className:"w-4 h-4"})}),p===s.id&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>v(null)}),e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-slate-800 border border-slate-700 rounded-xl shadow-2xl z-50 py-1",children:[e.jsxs("button",{onClick:j=>{j.stopPropagation(),v(null),t(s.id,s.name),m("/dashboard")},className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm text-amber-400 hover:bg-amber-500/10",children:[e.jsx(Le,{className:"w-4 h-4"}),"Acessar como Cliente"]}),e.jsxs("button",{onClick:j=>{var g,Q,de;j.stopPropagation(),v(null),H({id:s.id,name:s.name,plan:s.plan,enabledModules:s.enabledModules||Pe(s.plan)}),G(((g=s.entitlements)==null?void 0:g.modules)||[]),W((de=(Q=s.perfil)==null?void 0:Q.papeis)!=null&&de.length?s.perfil.papeis:s.orgKind==="shipper"?["embarcador"]:s.orgKind==="both"?["embarcador","transportador"]:["transportador"])},className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm text-brand-400 hover:bg-brand-500/10",children:[e.jsx(B,{className:"w-4 h-4"}),"Gerenciar Módulos"]}),e.jsxs("button",{onClick:async j=>{j.stopPropagation(),N(s.id);try{await u.adminGenerateInvoice(s.id),alert("Fatura gerada com sucesso"),b()}catch(g){alert(g.message)}finally{N(null),v(null)}},className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm text-slate-300 hover:bg-slate-700/50",children:[e.jsx(ee,{className:"w-4 h-4"}),"Gerar Fatura"]}),d?e.jsxs("button",{onClick:async j=>{j.stopPropagation(),N(s.id);try{await u.adminActivateOrg(s.id),b()}catch(g){alert(g.message)}finally{N(null),v(null)}},className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm text-emerald-400 hover:bg-emerald-500/10",children:[e.jsx(Fe,{className:"w-4 h-4"}),"Ativar Organização"]}):e.jsxs("button",{onClick:async j=>{if(j.stopPropagation(),!!confirm(`Suspender "${s.name}"? Usuários perderão acesso.`)){N(s.id);try{await u.adminSuspendOrg(s.id),b()}catch(g){alert(g.message)}finally{N(null),v(null)}}},className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm text-red-400 hover:bg-red-500/10",children:[e.jsx($e,{className:"w-4 h-4"}),"Suspender Organização"]}),e.jsxs("button",{onClick:async j=>{if(j.stopPropagation(),!!confirm(`Deletar "${s.name}" (${s.cnpj||"sem CNPJ"})?
4
5Some da lista (soft-delete, o dado é preservado). Use para duplicatas.`)){N(s.id);try{await u.adminDeleteOrg(s.id),b()}catch(g){if(/usu[aá]rio ativo/i.test(g.message||"")&&confirm(`${g.message}
6
7Forçar mesmo assim?`))try{await u.adminDeleteOrg(s.id,!0),b()}catch(Q){alert(Q.message)}else alert(g.message)}finally{N(null),v(null)}}},className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm text-red-400 hover:bg-red-500/10 border-t border-slate-800/50",children:[e.jsx(Ue,{className:"w-4 h-4"}),"Deletar (duplicata)"]})]})]})]}),l?e.jsx(Be,{className:"w-4 h-4 text-slate-500"}):e.jsx(Ve,{className:"w-4 h-4 text-slate-500"})]})]})]}),l&&e.jsxs("div",{className:"px-4 pb-4 border-t border-slate-800/50",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 ga
7p-3 mt-3",children:[e.jsx(A,{label:"Plano",value:s.planLabel||s.plan,icon:qe}),e.jsx(A,{label:"Veículos",value:s.vehicleCount??0,icon:X}),e.jsx(A,{label:"MRR",value:_(x),icon:he}),e.jsx(A,{label:"Ciclo",value:s.billingCycle==="annual"?"Anual":"Mensal",icon:_e}),e.jsx(A,{label:"Pagamento",value:s.paymentMethod==="credit_card"?"Cartão":"Boleto",icon:ee})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mt-3",children:[e.jsx(A,{label:"Gestores",value:s.activeManagers,icon:K}),e.jsx(A,{label:"Motoristas",value:s.activeDrivers,icon:X}),e.jsx(A,{label:"IA usada",value:`${s.aiUsedThisMonth??0}/${s.aiQuota===999999?"∞":s.aiQuota??"—"}`,icon:B}),e.jsx(A,{label:"Excedente IA",value:s.aiOverageEnabled?"Ativado":"Desativado",icon:fe}),e.jsx(A,{label:"Status pgto",value:s.paymentStatus||"—",icon:Je})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsxs("p",{className:"text-xs text-slate-600",children:["ID: ",s.id]}),s.stripeCustomerId&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-violet-500/10 text-violet-400 border border-violet-500/20",children:["Stripe: ",s.stripeCustomerId]})]})]})]},s.id)})})]}),e.jsx(Z,{open:E,onClose:()=>w(!1),title:"Provisionar Nova Organização",description:"Crie a organização e o administrador inicial do cliente",size:"md",children:e.jsxs(e.Fragment,{children:[V&&e.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 rounded-lg bg-red-500/10 border border-red-500/20",children:[e.jsx(be,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-red-300",children:V})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-brand-500/5 border border-brand-500/15",children:[e.jsx("p",{className:"text-xs font-semibold text-brand-400 uppercase tracking-wider mb-3",children:"Dados da Organização"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"Nome da Empresa *"}),e.jsx("input",{type:"text",value:a.orgName,onChange:s=>o({...a,orgName:s.target.value}),placeholder:"Transportadora ABC",className:"input"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"CNPJ"}),e.jsx("input",{type:"text",value:a.cnpj,onChange:s=>o({...a,cnpj:s.target.value}),placeholder:"00.000.000/0001-00",className:"input"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"Cidade"}),e.jsx("input",{type:"text",value:a.city,onChange:s=>o({...a,city:s.target.value}),className:"input"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"UF"}),e.jsx("input",{type:"text",value:a.state,onChange:s=>o({...a,state:s.target.value}),className:"input",maxLength:2})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"Qtd Veículos (opcional)"}),e.jsx("input",{type:"number",value:a.vehicleCount,onChange:s=>o({...a,vehicleCount:Number(s.target.value)}),className:"input",min:0}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"Define só a cota de IA e o plano de cobrança legado."})]})]})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-purple-500/5 border border-purple-500/15",children:[e.jsx("p",{className:"text-xs font-semibold text-purple-400 uppercase tracking-wider mb-2",children:"O que é esta organização?"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:oe.map(s=>{const l=a.profileId===s.id,d=je[s.icon]||B;return e.jsxs("button",{type:"button","aria-pressed":l,onClick:()=>o({...a,profileId:s.id,variantId:s.defaultVariant||"completo"}),className:y("flex items-start gap-2.5 px-3 py-2.5 rounded-lg border text-left transition-colors",l?"border-purple-500 bg-purple-600/10":"border-slate-700/60 hover:bg-slate-800/30"),children:[e.jsx(d,{className:y("w-5 h-5 mt-0.5 shrink-0",l?"text-purple-300":"text-slate-500")}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"text-sm font-semibold text-slate-100 block",children:s.label}),e.jsx("span",{className:"text-[11px] text-slate-400 block leading-snug",children:s.descricao})]})]},s.id)})}),(()=>{const s=U(a.profileId);return s!=null&&s.variants?e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"text-[10px] text-slate-400 font-semibold uppercase tracking-wider mb-1.5",children:"Versão"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.variants.map(l
7=>{const d=a.variantId===l.id;return e.jsxs("button",{type:"button","aria-pressed":d,onClick:()=>o({...a,variantId:l.id}),className:y("px-3 py-2 rounded-lg border text-left transition-colors",d?"border-emerald-500 bg-emerald-600/10":"border-slate-700/60 hover:bg-slate-800/30"),children:[e.jsx("span",{className:"text-xs font-semibold text-slate-100 block",children:l.label}),e.jsx("span",{className:"text-[10px] text-slate-400 block leading-snug",children:l.descricao})]},l.id)})})]}):null})(),(()=>{const s=xe(a.profileId,a.variantId);return s?e.jsxs("div",{className:"mt-3",children:[e.jsxs("p",{className:"text-[10px] text-emerald-400 font-semibold uppercase tracking-wider mb-1.5",children:[s.modules.length," módulos entram ligados automaticamente"]}),e.jsx("div",{className:"space-y-1",children:s.modules.map(l=>{var d,x;return e.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-300",children:[e.jsx(J,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:(d=Ie(l))==null?void 0:d.title.split("(")[0].trim()}),e.jsx("span",{className:"text-[10px] text-slate-500 tabular-nums",children:(x=Me[l])==null?void 0:x.rotulo})]},l)})}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-2",children:"O admin do cliente já recebe o acesso. Módulos avançados ficam disponíveis pra ativação self-service depois."})]}):null})()]}),e.jsxs("div",{className:"p-3 rounded-lg bg-sky-500/5 border border-sky-500/15",children:[e.jsx("p",{className:"text-xs font-semibold text-sky-400 uppercase tracking-wider mb-3",children:"Piloto (opcional)"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"Termina em"}),e.jsx("input",{type:"date",value:a.pilotEndsAt,onChange:s=>o({...a,pilotEndsAt:s.target.value}),className:"input"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"Critérios (1 por linha)"}),e.jsx("textarea",{value:a.pilotCriteria,rows:2,onChange:s=>o({...a,pilotCriteria:s.target.value}),placeholder:`OTD ≥ 90%
8POD ≥ 85%`,className:"input"})]})]}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1.5",children:"Org em piloto não é faturada; critérios aparecem no checklist de ativação."})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-amber-500/5 border border-amber-500/15",children:[e.jsx("p",{className:"text-xs font-semibold text-amber-400 uppercase tracking-wider mb-3",children:"Administrador Inicial"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"Email do Administrador *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ge,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500"}),e.jsx("input",{type:"email",value:a.adminEmail,onChange:s=>o({...a,adminEmail:s.target.value}),placeholder:"[email protected]",className:"input pl-10"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-1 block",children:"Nome do Administrador"}),e.jsx("input",{type:"text",value:a.adminName,onChange:s=>o({...a,adminName:s.target.value}),placeholder:"Nome completo",className:"input"})]}),e.jsx("p",{className:"text-xs",style:{color:"var(--page-text-muted)"},children:"O administrador receberá um email para definir sua senha e acessar a plataforma."})]})]})]}),e.jsxs("div",{className:"flex gap-3 mt-6",children:[e.jsx("button",{onClick:()=>w(!1),className:"flex-1 px-4 py-2.5 rounded-xl border border-slate-700 text-sm text-slate-300 hover:bg-slate-800 transition-colors",children:"Cancelar"}),e.jsxs("button",{onClick:we,disabled:C||!a.orgName||!a.adminEmail,className:"flex-1 px-4 py-2.5 rounded-xl bg-brand-600 hover:bg-brand-500 text-sm font-semibold transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:[C?e.jsx(M,{className:"w-4 h-4 animate-spin"}):e.jsx(pe,{className:"w-4 h-4"}),"Criar Organização"]})]})]})}),e.jsx(Z,{open:!!n,onClose:()=>H(null),title:n?`Módulos — ${n.name}`:"",description:n?"Escolha o tipo — ou ajuste módulos/papel por exceção no avançado":void 0,size:"md",children:n&&e.jsxs(e.Fragment,{children:[(()=>{var d;const s=Ee(z,$),l=s?U(s.id):null;return e.jsxs("div",{className:"p-3 rounded-lg bg-purple-500/5 border border-purple-500/15",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-200",children:"Tipo da organização"}),l&&e.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded-full bg-purple-500/15 border border-purple-500/30 text-purple-300 font-semibold",children:["Tipo atual: ",l.label]})]}),e.jsx("p",{className:"text-[10px] text-slate-500 mb-3",children:'Escolha o que a organização é — liga os módulos elegíveis e acerta o papel de uma vez. Ajustes finos ficam no "Avançado" abaixo.'}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:oe.map(x=>{const O=je[x.icon]||B,j=Y===x.id,g=(s==null?void 0:s.id)===x.id;return e.jsxs("button",{type:"button",disabled:!!Y,onClick:()=>ne(x.id,x.defaultVariant),className:y("flex items-start gap-2.5 px-3 py-2.5 rounded-lg border text-left transition-colors disabled:opacity-50",g?"border-purple-500 bg-purple-600/10":"border-slate-700/60 hover:bg-slate-800/30"),children:[j?e.jsx(M,{className:"w-5 h-5 mt-0.5 shrink-0 text-purple-300 animate-spin"}):e.jsx(O,{className:y("w-5 h-5 mt-0.5 shrink-0",g?"text-purple-300":"text-slate-500")}),e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:"text-sm font-semibold text-slate-100 block flex items-center gap-1.5",children:[x.label,g&&e.jsx(J,{className:"w-3.5 h-3.5 text-purple-300"})]}),e.jsx("span",{className:"text-[11px] text-slate-400 block leading-snug",children:x.descricao})]})]},x.id)})}),((d=U("transportador"))==null?void 0:d.variants)&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Transportador:"}),U("transportador").variants.map(x=>e.jsx("button",{type:"button",disabled:!!Y,onClick:()=>ne("transportador",x.id),className:"text-[10px] px-2 py-1 rounded-lg border border-slate-700/60 text-slate-400 hover:bg-slate-800/30 disabled:opacity-50",children:x.id==="basico"?"Básico (Connect)":"Completo (TMS)"},x.id))]})]})})(),e.jsxs("div",{className:"mt-6 pt-5 border-t border-slate-700/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-slate-200",children:"Módulos do catálogo (avançado)"}),e.jsx("p",{className:"text-[10px] text-slate-500",children:"Ajuste por exceção — o que a organização acessa (navegação + gates de API). Dependências entram sozinhas."})]}),e.jsxs("span",{className:"text-xs text-slate-500",children:[$.length," módulos"]})]}),e.jsx("div",{className:"mt-3 grid grid-cols-1 sm:grid-cols-2 gap-1.5 max-h-72 overflow-y-auto",children:Oe.map(s=>
8{const l=$.includes(s.id);return e.jsxs("button",{type:"button",onClick:()=>G(l?$.filter(d=>d!==s.id):De([...$,s.id])),className:y("flex items-start gap-2 px-2.5 py-2 rounded-lg border text-left transition-colors",l?"border-brand-500 bg-brand-600/10":"border-slate-700/60 hover:bg-slate-800/30"),children:[e.jsx("div",{className:y("w-4 h-4 mt-0.5 rounded flex items-center justify-center border shrink-0",l?"bg-brand-600 border-brand-500":"border-slate-600 bg-slate-800"),children:l&&e.jsx(J,{className:"w-3 h-3 text-white"})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"text-xs font-medium text-slate-200 block truncate",children:s.title}),e.jsxs("span",{className:"text-[10px] text-slate-500",children:[s.id," · ",s.meter,s.status!=="ga"?` · ${s.status}`:""]})]})]},s.id)})}),e.jsxs("button",{onClick:Ae,disabled:ae,className:"mt-3 w-full px-4 py-2.5 rounded-xl bg-cyan-700 hover:bg-cyan-600 text-sm font-semibold transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:[ae&&e.jsx(M,{className:"w-4 h-4 animate-spin"}),"Salvar entitlements"]})]}),e.jsxs("div",{className:"mt-6 pt-5 border-t border-slate-700/50",children:[e.jsxs("div",{className:"mb-1",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-200",children:"Papel (perfil) — avançado"}),e.jsxs("p",{className:"text-[10px] text-slate-500",children:["Quem a organização É — a fonte de verdade dos gates de acesso. Embarcador abre as telas da Torre (Pedidos/NF-e); transportador abre o Connect. Independe dos módulos comprados acima. ",e.jsxs("span",{className:"text-slate-400",children:["O Seller usa o papel",e.jsx("b",{children:" Embarcador"}),' + o módulo Canais — não é um papel à parte; o "Tipo atual" acima já mostra "Seller".']})]})]}),e.jsx("div",{className:"mt-3 grid grid-cols-1 sm:grid-cols-2 gap-1.5",children:Ce.map(s=>{const l=z.includes(s.id);return e.jsxs("button",{type:"button",onClick:()=>W(l?z.filter(d=>d!==s.id):[...z,s.id]),className:y("flex items-start gap-2 px-2.5 py-2 rounded-lg border text-left transition-colors",l?"border-brand-500 bg-brand-600/10":"border-slate-700/60 hover:bg-slate-800/30"),children:[e.jsx("div",{className:y("w-4 h-4 mt-0.5 rounded flex items-center justify-center border shrink-0",l?"bg-brand-600 border-brand-500":"border-slate-600 bg-slate-800"),children:l&&e.jsx(J,{className:"w-3 h-3 text-white"})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"text-xs font-medium text-slate-200 block",children:s.label}),e.jsx("span",{className:"text-[10px] text-slate-500",children:s.desc})]})]},s.id)})}),e.jsxs("button",{onClick:ke,disabled:le||z.length===0,className:"mt-3 w-full px-4 py-2.5 rounded-xl bg-cyan-700 hover:bg-cyan-600 text-sm font-semibold transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:[le&&e.jsx(M,{className:"w-4 h-4 animate-spin"}),"Salvar papel"]})]}),e.jsx("div",{className:"flex gap-3 mt-6",children:e.jsx("button",{onClick:()=>H(null),className:"flex-1 px-4 py-2.5 rounded-xl border border-slate-700 text-sm text-slate-300 hover:bg-slate-800 transition-colors",children:"Fechar"})})]})}),e.jsx(Z,{open:!!f,onClose:()=>r(null),title:"Organização Criada",description:f==null?void 0:f.adminEmail,size:"md",children:f&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"p-3 rounded-lg bg-slate-800 border border-slate-700",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Org ID:"}),e.jsx("p",{className:"text-slate-200 font-mono text-xs break-all",children:f.orgId})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Admin UID:"}),e.jsx("p",{className:"text-slate-200 font-mono text-xs break-all",children:f.adminUid})]})]})}),f.emailSent?e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-emerald-500/10 border border-emerald-500/20",children:[e.jsx(ge,{className:"w-4 h-4 text-emerald-400 mt-0.5 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-emerald-200",children:["Email enviado para ",e.jsx("strong",{children:f.adminEmail})," com instruções para definir a senha."]})]}):f.isNewUser?e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[e.jsx(be,{className:"w-4 h-4 text-amber-400 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-amber-200",children:'Conta criada, mas não foi possível enviar o email. Peça ao admin para usar "Esqueci minha senha" na tela de login.'})]}):e.jsx("p",{className:"text-sm",style:{color:"var(--page-text-secondary)"},children:"O usuário já possuía conta. Ele pode acessar com as credenciais existentes."})]}),e.jsx("button",{onClick:()=>r(null),className:"w-full mt-5 px-4 py-2.5 rounded-xl bg-brand-600 hover:bg-brand-500 text-sm font-semibold transition-all",children:"Entendido"})]})}),e.jsx(ss,{})]})}function ss(){const[t,S]=i.useState(""),[m,c]=i.useState(""),[L,T]=i.useState(!1),[h,P]=i.useState(null),[b,R]=i.useState(!1),[I,F]=i.useState(null),[N,p]=i.useState(""),v=async()=>{var a;R(!0),p(""),P(null);try{const o=await u.adminDriversSearch({query:t,orgId:m.trim()||void 0,includeAll:L});P(o.items||[]),(a=o.items)!=null&&a.length||p("Nenhum driver encontrado.")}catch(o){p("Erro: "+o.message)}finally{R(!1)}},E=async(a,o)=>
8{if(!o){const C=`Arquivar driverId=${a}? Essa ação:
9• Marca SentinelDriverLinks como isDeleted
10• Limpa heartbeats/RTDB
11• Invalida tokens FCM
12• É reversível via SentinelAuditLog
13
14Digite ARQUIVAR para confirmar:`;if(prompt(C)!=="ARQUIVAR"){p("Cancelado.");return}}F(a),p("");try{const C=o?void 0:prompt("Motivo (vai pro audit log):")||"Duplicate cleanup",k=await u.adminDriversArchive({driverId:a,reason:C,dryRun:o});o?p(`PRÉ-VISUALIZAÇÃO:
15${JSON.stringify(k.plan,null,2)}`):(p(`✅ Arquivado. Links: ${k.linksArchived}. Limpou: ${Object.keys(k.rtdbResults||{}).length} paths RTDB.`),await v())}catch(C){p("Erro: "+C.message)}finally{F(null)}},w=a=>a?new Date(a).toLocaleString("pt-BR"):"—";return e.jsxs("div",{className:"card p-5 mt-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(se,{className:"w-5 h-5 text-amber-400"}),e.jsx("h3",{className:"text-base font-bold",style:{color:"var(--page-text)"},children:"Limpar conta duplicada de driver"})]}),e.jsxs("p",{className:"text-xs mb-4",style:{color:"var(--page-text-muted)"},children:["Busca em ",e.jsx("code",{children:"SentinelDriverLinks"})," por nome, e-mail ou driverId. O arquivamento é soft-delete (reversível pelo SentinelAuditLog) e limpa heartbeats/RTDB do driver. Não toca no Firebase Auth."]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-3",children:[e.jsx("input",{className:"px-3 py-2 rounded-lg bg-slate-800 border border-slate-700 text-sm text-slate-100",placeholder:"Nome / e-mail / username (ex: Vanderson)",value:t,onChange:a=>S(a.target.value)}),e.jsx("input",{className:"px-3 py-2 rounded-lg bg-slate-800 border border-slate-700 text-sm text-slate-100",placeholder:"orgId (opcional)",value:m,onChange:a=>c(a.target.value)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-slate-300",children:[e.jsx("input",{type:"checkbox",checked:L,onChange:a=>T(a.target.checked)}),"Incluir já arquivados"]}),e.jsx("button",{onClick:v,disabled:b||t.trim().length<3,className:"ml-auto px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-sm font-semibold text-white disabled:opacity-50",children:b?"Buscando...":"Buscar"})]})]}),N&&e.jsx("pre",{className:"text-xs p-3 rounded-lg mb-3 max-h-64 overflow-auto whitespace-pre-wrap",style:{background:"var(--surface-tertiary)",color:"var(--page-text)"},children:N}),h&&h.length>0&&e.jsx("div",{className:"rounded-lg border border-slate-700/40 overflow-hidden",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"bg-slate-800/50 text-slate-400 uppercase tracking-wider",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-3 py-2",children:"driverId"}),e.jsx("th",{className:"text-left px-3 py-2",children:"Nome / E-mail"}),e.jsx("th",{className:"text-left px-3 py-2",children:"Status"}),e.jsx("th",{className:"text-left px-3 py-2",children:"Último heartbeat"}),e.jsx("th",{className:"text-left px-3 py-2",children:"Token"}),e.jsx("th",{className:"text-right px-3 py-2",children:"Ações"})]})}),e.jsx("tbody",{children:h.map(a=>e.jsxs("tr",{className:"border-t border-slate-800/40",children:[e.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:a.driverId}),e.jsxs("td",{className:"px-3 py-2 text-slate-300",children:[e.jsx("div",{className:"font-medium",children:a.driverName||"—"}),e.jsx("div",{className:"text-[11px] text-slate-500",children:a.driverEmail||"—"}),e.jsxs("div",{className:"text-[10px] text-slate-600",children:["org: ",a.orgId||"—"]})]}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:a.isDeleted?"text-red-400 font-semibold":a.status==="approved"?"text-emerald-400":"text-slate-400",children:a.isDeleted?"arquivado":a.status||"—"})}),e.jsxs("td",{className:"px-3 py-2 text-slate-400",children:[w(a.lastHeartbeatMs),a.isOnline&&e.jsx("span",{className:"ml-1 text-emerald-400",children:"●"})]}),e.jsx("td",{className:"px-3 py-2 text-slate-400",children:a.hasToken?"✓":"—"}),e.jsxs("td",{className:"px-3 py-2 text-right space-x-1.5",children:[e.jsx("button",{onClick:()=>E(a.driverId,!0),disabled:I===a.driverId||a.isDeleted,className:"px-2 py-1 rounded text-[11px] bg-slate-700 hover:bg-slate-600 text-slate-200 disabled:opacity-40",children:"Pré-visualizar"}),e.jsx("button",{onClick:()=>E(a.driverId,!1),disabled:I===a.driverId||a.isDeleted,className:"px-2 py-1 rounded text-[11px] bg-red-600 hover:bg-red-500 text-white disabled:opacity-40",children:I===a.driverId?"...":"Arquivar"})]})]},a.linkDocId))})]})})]})}function D({icon:t,label:S,value:m,color:c}){return e.jsxs("div",{style:{color:"var(--page-text)"},className:"card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium uppercase  tracking-wider",children:S}),e.jsx(t,{className:y("w-4 h-4",c)})]}),e.jsx("p",{className:"text-2xl font-bold",style:{color:"var(--page-text)"},children:m})]})}function A({label:t,value:S,icon:m}){return e.jsxs("div",{style:{color:"var(--page-text)"},className:"p-3 rounded-lg bg-slate-800/30",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(m,{className:"w-3 h-3 text-slate-500"}),e.jsx("span",{className:"text-[10px] text-slate-500 uppercase",children:t})]}),e.jsx("p",{className:"text-sm font-semibold",style:{color:"var(--page-text)"},children:S})]})}export{ds as AdminPage};

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.