@johpaz/hive-agents 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hive.js +3801 -3154
- package/dist/tool-worker.js +25 -2
- package/dist/ui/assets/{A2UIPage-BOR7GzYi.js → A2UIPage-EDS7lN-K.js} +4 -4
- package/dist/ui/assets/{AgentCreateForm-Btza1Kiv.js → AgentCreateForm-KvhVhAFP.js} +1 -1
- package/dist/ui/assets/AgentDetailPage-B2dCpO92.js +1 -0
- package/dist/ui/assets/{AgentNewPage-DvP05Ap5.js → AgentNewPage-CF2B4dbu.js} +1 -1
- package/dist/ui/assets/AgentsPage-CMvz-CtA.js +10 -0
- package/dist/ui/assets/{ApiClientPage-Cmo0XBwk.js → ApiClientPage-tzzL3rZC.js} +1 -1
- package/dist/ui/assets/{ChannelsPage-C53NCtXi.js → ChannelsPage-fE2vRwup.js} +2 -2
- package/dist/ui/assets/DashboardPage-57SaHnBL.js +6 -0
- package/dist/ui/assets/{LoginPage-CTc-MbtG.js → LoginPage-Fag9Bp5h.js} +1 -1
- package/dist/ui/assets/{LogsPage-D-2DgTQh.js → LogsPage-GVJd_a65.js} +1 -1
- package/dist/ui/assets/{MeetingPage-B8Xb1z_0.js → MeetingPage-TKQu8Nr-.js} +1 -1
- package/dist/ui/assets/{ModelSelector-BcaASPWF.js → ModelSelector-DciHLo7R.js} +1 -1
- package/dist/ui/assets/{NotFound-PUg3gEO0.js → NotFound-D4ZlDVg9.js} +1 -1
- package/dist/ui/assets/{Office3DPage-6bDnybWI.js → Office3DPage-CQnO522l.js} +2 -2
- package/dist/ui/assets/ProvidersPage-BsWFvzqz.js +1 -0
- package/dist/ui/assets/{RecoverPage-UL782VIG.js → RecoverPage-BkdOyljs.js} +1 -1
- package/dist/ui/assets/SettingsPage-D_43Rc2I.js +9 -0
- package/dist/ui/assets/{SetupPage-B_fXVcuJ.js → SetupPage-D6Z3SYZu.js} +1 -1
- package/dist/ui/assets/VoicePage-CCE2EOE9.js +307 -0
- package/dist/ui/assets/{WebChatPage-D8KsJqMf.js → WebChatPage-Dzk3FhiR.js} +4 -4
- package/dist/ui/assets/{conversationsStore-8WwqUOpe.js → conversationsStore-5hf5grlP.js} +1 -1
- package/dist/ui/assets/{core-B_5cyOSV.js → core-p4c5dns5.js} +1 -1
- package/dist/ui/assets/{dialog-DcgGvP2g.js → dialog-DKnsGLwr.js} +1 -1
- package/dist/ui/assets/{dist-js-q7C_AB0j.js → dist-js-CkNhvsFc.js} +1 -1
- package/dist/ui/assets/dist-js-jWCEHSkB.js +1 -0
- package/dist/ui/assets/{index-C5Hhusqq.js → index-mBw9Tl7u.js} +44 -4
- package/dist/ui/assets/useAudioDevices-BYFaA0X-.js +1 -0
- package/dist/ui/assets/{useHiveAgentsModelLoad-IOqfYcrC.js → useHiveAgentsModelLoad-RRQ6-ANC.js} +1 -1
- package/dist/ui/assets/{useProviders-DsFqfiyM.js → useProviders-DXr4pJ57.js} +1 -1
- package/dist/ui/assets/{vendor-router-DP84b3LQ.js → vendor-router-DSMCk-Ka.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/package.json +5 -3
- package/packages/core/src/agent/agent-catalog.ts +2 -2
- package/packages/core/src/agent/compaction.ts +162 -25
- package/packages/core/src/agent/context-compiler.ts +121 -8
- package/packages/core/src/agent/conversation-store.ts +43 -2
- package/packages/core/src/agent/handoff.ts +129 -0
- package/packages/core/src/agent/history-timeline.ts +133 -0
- package/packages/core/src/agent/message-memory.ts +148 -0
- package/packages/core/src/agent/summary-memory.ts +152 -0
- package/packages/core/src/agent/thread-store.ts +4 -0
- package/packages/core/src/config/loader.ts +37 -1
- package/packages/core/src/gateway/realtime/voice-session.ts +19 -0
- package/packages/core/src/storage/collections.ts +3 -0
- package/packages/core/src/tools/a2ui/index.ts +76 -0
- package/packages/core/src/tools/core/index.ts +19 -6
- package/packages/skills/src/bundled-data.generated.ts +756 -756
- package/dist/ui/assets/AgentDetailPage-D435IX8G.js +0 -1
- package/dist/ui/assets/AgentsPage-BT9CssIN.js +0 -10
- package/dist/ui/assets/DashboardPage-DpI54Ot0.js +0 -6
- package/dist/ui/assets/ProvidersPage-CVK-nKxE.js +0 -1
- package/dist/ui/assets/SettingsPage-CHJfutPk.js +0 -9
- package/dist/ui/assets/VoicePage-CdBZrLAm.js +0 -307
- package/dist/ui/assets/dist-js-Dh18rcg9.js +0 -1
- package/dist/ui/assets/useAudioDevices-BO-kUbtK.js +0 -41
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{t as n}from"./vendor-react-kUOwxn0g.js";import{o as r}from"./vendor-query-Dj8xYhQD.js";import{t as i}from"./createLucideIcon-BRaPSYgN.js";import{t as a}from"./activity-C_GS5wrG.js";import{t as o}from"./calendar-B6x9cw-q.js";import{t as s}from"./check-C8pw-7Fx.js";import{t as c}from"./chevron-left-GK4EQOyZ.js";import{t as l}from"./circle-alert-CtDbK2nl.js";import{t as u}from"./circle-check-BKNT2_q6.js";import{n as d,t as f}from"./earth-BJRGJbVn.js";import{t as p}from"./useProviders-DsFqfiyM.js";import{t as m}from"./external-link-6oTH9pUM.js";import{n as h,r as g,t as _}from"./ModelSelector-BcaASPWF.js";import{a as v,i as y,o as b,r as x,s as S}from"./agentCapabilities-CDSfJWhw.js";import{t as C}from"./shield-CIarwBvx.js";import{t as w}from"./sparkles-DVvY6jDT.js";import{t as T}from"./terminal-BEcTK780.js";import{t as ee}from"./zap-DSoX9NDk.js";import{t as E}from"./utils-DEmd_M8c.js";import{c as D,l as O}from"./vendor-router-DP84b3LQ.js";import{C as te,G as k,J as A,O as j,S as M,T as N,W as P,Z as F,_ as I,j as L,k as R,lt as z,ot as B,rt as V,w as ne}from"./index-C5Hhusqq.js";import{t as H}from"./badge-B5AKge1b.js";import{a as U,c as W,i as re,n as G,o as K,r as q,s as ie,t as ae}from"./dialog-DcgGvP2g.js";import{t as J}from"./label-D_fvqJyD.js";import{t as oe}from"./textarea-BgZJFZTX.js";import{i as Y,n as X,o as se,s as ce,t as le}from"./select-v_3QBYrD.js";import{t as ue}from"./switch-ndx8VCpm.js";var Z=i(`BookOpenCheck`,[[`path`,{d:`M12 21V7`,key:`gj6g52`}],[`path`,{d:`m16 12 2 2 4-4`,key:`mdajum`}],[`path`,{d:`M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3`,key:`8arnkb`}]]),de=i(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Q=i(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),fe=i(`Fingerprint`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),pe=i(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),me=i(`PackageOpen`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),he=n(),ge=e(t(),1),$=r();function _e(e){let t=(0,he.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(n,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ve({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:r}=I(),{fetchProviders:i}=te(),{fetchModels:o}=M();(0,ge.useEffect)(()=>{r(),i(),o()},[r,i,o]);let c=t.find(t=>t.id===e),[u,d]=(0,ge.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[f,p]=(0,ge.useState)({isValidating:!1,exists:!1,accessible:!1});(0,ge.useEffect)(()=>{c&&(d({name:c.name||``,description:c.description||``,provider_id:c.provider_id||c.providerId||``,model_id:c.model_id||c.modelId||``,tone:c.tone||``,role:c.role||`coordinator`,enabled:!!c.enabled,headers:``,systemPrompt:c.systemPrompt||``,workspace:c.workspace||``}),c.workspace&&v(c.workspace))},[c]);let v=async e=>{if(!e||e.trim()===``){p({isValidating:!1,exists:!1,accessible:!1});return}p({isValidating:!0,exists:!1,accessible:!1});try{let t=await j(`/api/workspace/validate`,{method:`POST`,body:{path:e}});p({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){p({isValidating:!1,exists:!1,accessible:!1,error:e.message})}};return c?(0,$.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,$.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,$.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,$.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,$.jsx)(_e,{icon:F,className:`h-4 w-4 text-blue-400`})}),(0,$.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(J,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,$.jsx)(P,{id:`name`,value:u.name,onChange:e=>d(t=>({...t,name:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Nombre del nodo`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(J,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,$.jsx)(P,{id:`tone`,value:u.tone,onChange:e=>d(t=>({...t,tone:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Ej: Analítico, Conciso...`})]})]})]}),(0,$.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,$.jsx)(_e,{icon:C,className:`h-4 w-4 text-purple-400`})}),(0,$.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsx)(J,{className:`text-sm font-semibold`,children:`Rol`}),(0,$.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,$.jsxs)(le,{value:u.role,onValueChange:e=>d(t=>({...t,role:e})),children:[(0,$.jsx)(se,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,$.jsx)(ce,{})}),(0,$.jsxs)(X,{className:`bg-zinc-900 border-white/10`,children:[(0,$.jsx)(Y,{value:`coordinator`,children:`Coordinador`}),(0,$.jsx)(Y,{value:`worker`,children:`Worker`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsx)(J,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,$.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,$.jsx)(ue,{checked:u.enabled,onCheckedChange:e=>d(t=>({...t,enabled:e}))})]})]})]}),(0,$.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,$.jsx)(_e,{icon:g,className:`h-4 w-4 text-emerald-400`})}),(0,$.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,$.jsx)(`div`,{className:`space-y-4`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(J,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(P,{id:`workspace`,value:u.workspace,onChange:e=>{d(t=>({...t,workspace:e.target.value})),v(e.target.value)},className:`bg-white/5 border-white/10 focus:border-emerald-500/50 rounded-xl h-11 font-mono text-sm flex-1`,placeholder:`Ej: /home/user/proyectos, D:\\Work`}),u.workspace&&f.exists&&f.accessible&&(0,$.jsx)(k,{type:`button`,variant:`outline`,size:`icon`,onClick:async()=>{if(u.workspace)try{await j(`/api/workspace/open?path=${encodeURIComponent(u.workspace)}`,{method:`GET`})}catch(e){R.fire({icon:`error`,title:e.message})}},className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 h-11 w-11`,title:`Abrir en el explorador`,children:(0,$.jsx)(m,{className:`h-4 w-4`})})]}),(0,$.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),u.workspace&&u.workspace.trim()!==``&&(0,$.jsxs)(`div`,{className:E(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,f.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!f.isValidating&&f.exists&&f.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!f.isValidating&&f.exists&&!f.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!f.isValidating&&!f.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[f.isValidating&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{className:`h-3.5 w-3.5 animate-spin`}),(0,$.jsx)(`span`,{children:`Validando directorio...`})]}),!f.isValidating&&f.exists&&f.accessible&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s,{className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:f.message||`Directorio válido y accesible`})]}),!f.isValidating&&f.exists&&!f.accessible&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:f.message||`Sin permisos de lectura/escritura`})]}),!f.isValidating&&!f.exists&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:f.message||`El directorio no existe`}),!f.error&&(0,$.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(u.workspace)try{await j(`/api/workspace/create`,{method:`POST`,body:{path:u.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await v(u.workspace)}catch(e){R.fire({icon:`error`,title:e.message})}},className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear`})]})]})]})})]})]}),(0,$.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,$.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,$.jsx)(_e,{icon:w,className:`h-4 w-4 text-amber-400`})}),(0,$.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,$.jsxs)(k,{onClick:async()=>{L.show(`Sincronizando configuración del agente...`);try{await n(e,{...u,role:u.role,enabled:+!!u.enabled,workspace:u.workspace||null}),R.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){R.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{L.hide()}},className:`bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl px-6 shadow-[0_4px_15px_rgba(37,99,235,0.3)] transition-all active:scale-95 gap-2`,children:[(0,$.jsx)(_e,{icon:h,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(J,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,$.jsx)(oe,{id:`description`,value:u.description,onChange:e=>d(t=>({...t,description:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-2xl min-h-[80px] resize-none`,placeholder:`Define el propósito general de este nodo...`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,$.jsx)(J,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,$.jsxs)(ae,{children:[(0,$.jsx)(W,{asChild:!0,children:(0,$.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,$.jsxs)(q,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(ie,{className:`text-xl`,children:`Editar System Prompt`}),(0,$.jsx)(re,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,$.jsx)(`div`,{className:`py-2`,children:(0,$.jsx)(oe,{value:u.systemPrompt,onChange:e=>d(t=>({...t,systemPrompt:e.target.value})),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`})}),(0,$.jsx)(U,{children:(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(k,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),u.systemPrompt?(0,$.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4 max-h-[120px] overflow-y-auto custom-scrollbar`,children:(0,$.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:u.systemPrompt})}):(0,$.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,$.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,$.jsx)(_,{selectedProviderId:u.provider_id||void 0,selectedModelId:u.model_id||void 0,onProviderChange:e=>d(t=>({...t,provider_id:e,model_id:``})),onModelChange:e=>d(t=>({...t,model_id:e})),typeFilter:`llm`})]}),(0,$.jsxs)(`div`,{className:`mt-8 p-4 rounded-2xl bg-white/[0.03] border border-white/5 flex items-start gap-4 italic`,children:[(0,$.jsx)(_e,{icon:B,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,$.jsx)(`p`,{className:`text-[11px] text-white/30 leading-relaxed`,children:`Las credenciales de acceso y llaves de cifrado para los headers personalizados se gestionan en una capa segura y no son visibles en texto plano para mantener la integridad de la red.`})]})]})})]})}):(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 rounded-3xl border border-dashed border-white/10 bg-white/5`,children:[(0,$.jsx)(_e,{icon:a,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,$.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]})}function ye(e){let t=(0,he.c)(87),{agent:n}=e,{providers:r}=te(),{models:i}=M(),s=n.role===`coordinator`,c=n.provider_id||n.providerId,l=n.model_id||n.modelId,u=n.created_at||n.createdAt,d;t[0]===u?d=t[1]:(d=u?v(typeof u==`string`?new Date(u):new Date(u*1e3),`PPP`,{locale:y}):`Fecha desconocida`,t[0]=u,t[1]=d);let f=d,m;t[2]!==c||t[3]!==r?(m=r.find(e=>e.id===c)?.name||c,t[2]=c,t[3]=r,t[4]=m):m=t[4];let h=m,g;t[5]!==l||t[6]!==i?(g=i.find(e=>e.id===l)?.name||l,t[5]=l,t[6]=i,t[7]=g):g=t[7];let _=g,x=`hive-card--internal group ${n.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,S;t[8]===n.enabled?S=t[9]:(S=n.enabled&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`absolute -top-24 -right-24 h-64 w-64 bg-blue-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-blue-600/20 transition-all duration-700`}),(0,$.jsx)(`div`,{className:`absolute -bottom-24 -left-24 h-64 w-64 bg-purple-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-purple-600/20 transition-all duration-700`})]}),t[8]=n.enabled,t[9]=S);let C=`hive-icon-wrap--internal ${n.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,w=`h-6 w-6 ${n.enabled?`text-blue-400`:`text-white/20`}`,T;t[10]===w?T=t[11]:(T=(0,$.jsx)(fe,{className:w}),t[10]=w,t[11]=T);let E;t[12]!==C||t[13]!==T?(E=(0,$.jsx)(`div`,{className:C,children:T}),t[12]=C,t[13]=T,t[14]=E):E=t[14];let D=`hive-page-header__label ${!n.enabled&&`text-white/20`}`,O;t[15]===D?O=t[16]:(O=(0,$.jsx)(`span`,{className:D,children:`Identidad de Nodo`}),t[15]=D,t[16]=O);let k;t[17]!==n.enabled||t[18]!==s?(k=s&&(0,$.jsx)(H,{className:`hive-tag--coordinator ${!n.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`}),t[17]=n.enabled,t[18]=s,t[19]=k):k=t[19];let A;t[20]!==O||t[21]!==k?(A=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[O,k]}),t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`text-4xl font-black tracking-tighter ${n.enabled?`text-white`:`text-white/40`}`,N;t[23]!==n.name||t[24]!==j?(N=(0,$.jsx)(`h1`,{className:j,children:n.name}),t[23]=n.name,t[24]=j,t[25]=N):N=t[25];let P;t[26]!==A||t[27]!==N?(P=(0,$.jsxs)(`div`,{children:[A,N]}),t[26]=A,t[27]=N,t[28]=P):P=t[28];let F;t[29]!==P||t[30]!==E?(F=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[E,P]}),t[29]=P,t[30]=E,t[31]=F):F=t[31];let I=`text-lg leading-relaxed max-w-2xl font-light italic ${n.enabled?`text-white/60`:`text-white/20`}`,L=n.description||`Este agente no tiene una descripción definida aún.`,R;t[32]!==I||t[33]!==L?(R=(0,$.jsxs)(`p`,{className:I,children:[`"`,L,`"`]}),t[32]=I,t[33]=L,t[34]=R):R=t[34];let z;t[35]!==F||t[36]!==R?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[F,R]}),t[35]=F,t[36]=R,t[37]=z):z=t[37];let B=n.enabled?`text-blue-400`:`text-white/20`,V;t[38]!==n.enabled||t[39]!==_||t[40]!==h||t[41]!==B?(V=(0,$.jsx)(be,{icon:p,label:`Infraestructura`,value:h,subValue:_,color:B,enabled:n.enabled}),t[38]=n.enabled,t[39]=_,t[40]=h,t[41]=B,t[42]=V):V=t[42];let ne=n.tone||`Neutral`,U=n.enabled?`text-purple-400`:`text-white/20`,W;t[43]!==n.enabled||t[44]!==ne||t[45]!==U?(W=(0,$.jsx)(be,{icon:ee,label:`Personalidad`,value:ne,color:U,enabled:n.enabled}),t[43]=n.enabled,t[44]=ne,t[45]=U,t[46]=W):W=t[46];let re=n.enabled?`text-emerald-400`:`text-white/20`,G;t[47]!==n.enabled||t[48]!==f||t[49]!==re?(G=(0,$.jsx)(be,{icon:o,label:`Desplegado el`,value:f,color:re,enabled:n.enabled}),t[47]=n.enabled,t[48]=f,t[49]=re,t[50]=G):G=t[50];let K;t[51]!==V||t[52]!==W||t[53]!==G?(K=(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[V,W,G]}),t[51]=V,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;t[55]!==z||t[56]!==K?(q=(0,$.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[z,K]}),t[55]=z,t[56]=K,t[57]=q):q=t[57];let ie;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),t[58]=ie):ie=t[58];let ae=n.enabled?n.status:`hibernated`,J;t[59]===ae?J=t[60]:(J=(0,$.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[ie,(0,$.jsx)(b,{status:ae,className:`px-6 py-2 text-sm border-2`})]}),t[59]=ae,t[60]=J);let oe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),t[61]=oe):oe=t[61];let Y;t[62]===n.enabled?Y=t[63]:(Y=n.enabled&&(0,$.jsx)(`div`,{className:`hive-network-fill`}),t[62]=n.enabled,t[63]=Y);let X;t[64]===Y?X=t[65]:(X=(0,$.jsxs)(`div`,{className:`flex-1`,children:[oe,(0,$.jsx)(`div`,{className:`hive-network-track`,children:Y})]}),t[64]=Y,t[65]=X);let se=`h-5 w-5 ${n.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`,ce;t[66]===se?ce=t[67]:(ce=(0,$.jsx)(a,{className:se}),t[66]=se,t[67]=ce);let le;t[68]!==X||t[69]!==ce?(le=(0,$.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[X,ce]}),t[68]=X,t[69]=ce,t[70]=le):le=t[70];let ue;t[71]!==J||t[72]!==le?(ue=(0,$.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[J,le]}),t[71]=J,t[72]=le,t[73]=ue):ue=t[73];let Z;t[74]!==q||t[75]!==ue?(Z=(0,$.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[q,ue]}),t[74]=q,t[75]=ue,t[76]=Z):Z=t[76];let de=`hive-strip--bottom ${!n.enabled&&`opacity-20`}`,Q;t[77]===de?Q=t[78]:(Q=(0,$.jsx)(`div`,{className:de}),t[77]=de,t[78]=Q);let pe;t[79]===n.id?pe=t[80]:(pe=(0,$.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,n.id]}),t[79]=n.id,t[80]=pe);let me;return t[81]!==x||t[82]!==Z||t[83]!==Q||t[84]!==pe||t[85]!==S?(me=(0,$.jsxs)(`div`,{className:x,children:[S,Z,Q,pe]}),t[81]=x,t[82]=Z,t[83]=Q,t[84]=pe,t[85]=S,t[86]=me):me=t[86],me}function be(e){let t=(0,he.c)(21),{icon:n,label:r,value:i,subValue:a,color:o,enabled:s}=e,c=`hive-info-card ${s?`hive-info-card--active`:`hive-info-card--disabled`}`,l=`h-3.5 w-3.5 ${o}`,u;t[0]!==n||t[1]!==l?(u=(0,$.jsx)(n,{className:l}),t[0]=n,t[1]=l,t[2]=u):u=t[2];let d;t[3]===r?d=t[4]:(d=(0,$.jsx)(`span`,{className:`hive-info-card__label`,children:r}),t[3]=r,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[u,d]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p=`hive-info-card__value ${s?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,m;t[8]!==p||t[9]!==i?(m=(0,$.jsx)(`p`,{className:p,children:i}),t[8]=p,t[9]=i,t[10]=m):m=t[10];let h;t[11]!==s||t[12]!==a?(h=a&&(0,$.jsx)(`p`,{className:`hive-info-card__sub ${s?`text-white/40`:`text-white/10`}`,children:a}),t[11]=s,t[12]=a,t[13]=h):h=t[13];let g;t[14]!==m||t[15]!==h?(g=(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[m,h]}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==c||t[18]!==f||t[19]!==g?(_=(0,$.jsxs)(`div`,{className:c,children:[f,g]}),t[17]=c,t[18]=f,t[19]=g,t[20]=_):_=t[20],_}var xe={filesystem:`Archivos`,web:`Web`,cron:`Automatización`,cli:`Terminal`,agents:`Agentes`,canvas:`Canvas`,office:`Office`,mcp:`MCP`,core:`Sistema`};function Se(e){return e.startsWith(`fs_`)?`filesystem`:e.startsWith(`browser_`)||e.startsWith(`web_`)||e===`search_knowledge`?`web`:e.startsWith(`cron`)?`cron`:e.startsWith(`office_`)?`office`:e.startsWith(`mcp`)||e.includes(`_mcp`)?`mcp`:e.startsWith(`canvas_`)||e.startsWith(`a2ui_`)?`canvas`:e.startsWith(`cli_`)?`cli`:e.includes(`agent`)||e.includes(`task_`)||e.includes(`acceptance`)?`agents`:`core`}function Ce(e){return e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function we(e){let t=(0,he.c)(59),{agent:n}=e,{tools:r,isLoading:i,fetchTools:a}=N(),{skills:o,isLoading:s,fetchSkills:c}=ne(),l,u;t[0]!==c||t[1]!==a||t[2]!==o.length||t[3]!==r.length?(l=()=>{r.length===0&&a(),o.length===0&&c()},u=[c,a,o.length,r.length],t[0]=c,t[1]=a,t[2]=o.length,t[3]=r.length,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,ge.useEffect)(l,u);let d;t[6]===n.toolsJson?d=t[7]:(d=x(n.toolsJson),t[6]=n.toolsJson,t[7]=d);let f=d,p;t[8]===n.skillsJson?p=t[9]:(p=x(n.skillsJson),t[8]=n.skillsJson,t[9]=p);let m=p,h;t[10]!==n.minimalTools||t[11]!==n.role?(h=n.role===`coordinator`?n.minimalTools??[]:[],t[10]=n.minimalTools,t[11]=n.role,t[12]=h):h=t[12];let g=h,_;t[13]!==n.minimalSkills||t[14]!==n.role?(_=n.role===`coordinator`?n.minimalSkills??[]:[],t[13]=n.minimalSkills,t[14]=n.role,t[15]=_):_=t[15];let v=_,y;if(t[16]!==g||t[17]!==f||t[18]!==r){let e=new Map;g.forEach(t=>e.set(t,{id:t,source:`base`})),f.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),y=Array.from(e.values()).map(e=>{let t=r.find(t=>t.id===e.id);return{id:e.id,name:t?.name||e.suppliedName||Ce(e.id),description:t?.description||`Capacidad disponible en el loadout operativo de este agente.`,category:t?.category||Se(e.id),available:t?t.enabled&&t.active!==!1:!0,source:e.source}}),t[16]=g,t[17]=f,t[18]=r,t[19]=y}else y=t[19];let b=y,C;if(t[20]!==v||t[21]!==m||t[22]!==o){let e=new Map;v.forEach(t=>e.set(t.id,{id:t.id,suppliedName:t.name,source:`base`})),m.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),C=Array.from(e.values()).map(e=>{let t=o.find(t=>t.id===e.id),n=v.find(t=>t.id===e.id);return{id:e.id,name:t?.name||n?.name||e.suppliedName||Ce(e.id),description:t?.description||n?.description||`Conocimiento operativo incluido en el contexto de este agente.`,category:t?.category||n?.category||`core`,source:e.source}}),t[20]=v,t[21]=m,t[22]=o,t[23]=C}else C=t[23];let w=C,T;t[24]===b?T=t[25]:(T=new Set(b.map(ke)),t[24]=b,t[25]=T);let ee=T.size,E;t[26]!==n.mcpServerIds||t[27]!==n.mcpServers?(E=n.mcpServers??(n.mcpServerIds??[]).map(Oe),t[26]=n.mcpServerIds,t[27]=n.mcpServers,t[28]=E):E=t[28];let D=E,O=i&&r.length===0||s&&o.length===0,te,k;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg border border-emerald-500/20 bg-emerald-500/10`,children:(0,$.jsx)(A,{className:`h-4 w-4 text-emerald-400`})}),k=(0,$.jsx)(`h2`,{className:`text-sm font-black uppercase tracking-[0.12em] text-white/85`,children:`Loadout operativo`}),t[29]=te,t[30]=k):(te=t[29],k=t[30]);let j=n.role===`coordinator`?`Capacidades mínimas del coordinador y asignaciones adicionales`:`Tools y skills asignadas para ejecutar tareas`,M;t[31]===j?M=t[32]:(M=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[te,(0,$.jsxs)(`div`,{children:[k,(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-white/35`,children:j})]})]}),t[31]=j,t[32]=M);let P;t[33]===b.length?P=t[34]:(P=(0,$.jsx)(je,{value:b.length,label:`tools`,color:`text-emerald-400`}),t[33]=b.length,t[34]=P);let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),t[35]=F):F=t[35];let I;t[36]===w.length?I=t[37]:(I=(0,$.jsx)(je,{value:w.length,label:`skills`,color:`text-amber-400`}),t[36]=w.length,t[37]=I);let L;t[38]===D.length?L=t[39]:(L=D.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),(0,$.jsx)(je,{value:D.length,label:`MCP`,color:`text-violet-400`})]}),t[38]=D.length,t[39]=L);let R;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`div`,{className:`hidden h-7 w-px bg-white/[0.08] sm:block`}),t[40]=R):R=t[40];let z;t[41]===ee?z=t[42]:(z=(0,$.jsx)(`div`,{className:`hidden sm:block`,children:(0,$.jsx)(je,{value:ee,label:`categorías`,color:`text-blue-400`})}),t[41]=ee,t[42]=z);let B;t[43]!==P||t[44]!==I||t[45]!==L||t[46]!==z?(B=(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[P,F,I,L,R,z]}),t[43]=P,t[44]=I,t[45]=L,t[46]=z,t[47]=B):B=t[47];let H;t[48]!==M||t[49]!==B?(H=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-white/[0.07] px-5 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[M,B]}),t[48]=M,t[49]=B,t[50]=H):H=t[50];let U;t[51]!==D||t[52]!==O||t[53]!==w||t[54]!==b?(U=O&&b.length===0&&w.length===0&&D.length===0?(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-14 text-xs text-white/35`,children:[(0,$.jsx)(V,{className:`h-4 w-4 animate-spin text-emerald-400`}),`Sincronizando loadout…`]}):b.length===0&&w.length===0&&D.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-5 py-14 text-center`,children:[(0,$.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl border border-dashed border-white/10 bg-white/[0.025]`,children:(0,$.jsx)(me,{className:`h-5 w-5 text-white/20`})}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-semibold text-white/60`,children:`Este agente no tiene capacidades asignadas`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Su loadout operativo está vacío.`})]}):(0,$.jsxs)($.Fragment,{children:[b.length>0&&(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,$.jsx)(A,{className:`h-3.5 w-3.5 text-emerald-400`}),(0,$.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Tools disponibles`})]}),(0,$.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:b.map(De)})]}),D.length>0&&(0,$.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,$.jsx)(S,{className:`h-3.5 w-3.5 text-violet-400`}),(0,$.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Integraciones MCP asignadas`})]}),(0,$.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:D.map(Ee)})]}),w.length>0&&(0,$.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,$.jsx)(Z,{className:`h-3.5 w-3.5 text-amber-400`}),(0,$.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Skills en contexto`})]}),(0,$.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:w.map(Te)})]})]}),t[51]=D,t[52]=O,t[53]=w,t[54]=b,t[55]=U):U=t[55];let W;return t[56]!==H||t[57]!==U?(W=(0,$.jsxs)(`section`,{className:`mb-8 overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/75`,children:[H,U]}),t[56]=H,t[57]=U,t[58]=W):W=t[58],W}function Te(e){return(0,$.jsxs)(`article`,{className:`rounded-xl border border-amber-500/10 bg-amber-500/[0.025] p-3.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-amber-500/15 bg-amber-500/[0.07]`,children:(0,$.jsx)(Z,{className:`h-3.5 w-3.5 text-amber-400`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,$.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-amber-400/65`,children:e.category}),(0,$.jsx)(Ae,{source:e.source})]})]},e.id)}function Ee(e){return(0,$.jsxs)(`article`,{className:`rounded-xl border border-violet-500/15 bg-violet-500/[0.035] p-3.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-violet-500/20 bg-violet-500/[0.08]`,children:(0,$.jsx)(S,{className:`h-3.5 w-3.5 text-violet-300`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,$.jsx)(`span`,{className:`mt-1 h-2 w-2 shrink-0 rounded-full ${e.enabled?`bg-emerald-400`:`bg-white/20`}`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-[10px] leading-4 text-white/30`,children:[`Servidor completo · `,e.toolsCount,` tools sincronizadas`]})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,$.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-violet-300/70`,children:e.status}),(0,$.jsx)(`span`,{className:`rounded bg-violet-500/10 px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider text-violet-200/70`,children:`Persistente`})]})]},e.id)}function De(e){return(0,$.jsxs)(`article`,{className:`group rounded-xl border border-white/[0.07] bg-black/20 p-3.5 transition-colors hover:border-emerald-500/20 hover:bg-emerald-500/[0.025]`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/[0.07] bg-white/[0.035]`,children:(0,$.jsx)(Me(e.category),{className:`h-3.5 w-3.5 text-emerald-400/80`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,$.jsx)(`span`,{title:e.available?`Disponible`:`No disponible`,children:(0,$.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 ${e.available?`text-emerald-400`:`text-white/15`}`})})]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,$.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-emerald-400/65`,children:xe[e.category]||e.category}),(0,$.jsx)(Ae,{source:e.source})]})]},e.id)}function Oe(e){return{id:e,name:e,status:`unknown`,enabled:!0,toolsCount:0}}function ke(e){return e.category}function Ae(e){let t=(0,he.c)(3),{source:n}=e,r=`rounded px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider ${n===`base`?`bg-blue-500/10 text-blue-300/70`:`bg-white/5 text-white/25`}`,i=n===`base`?`Minimal · base`:`Asignada`,a;return t[0]!==r||t[1]!==i?(a=(0,$.jsx)(`span`,{className:r,children:i}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function je(e){let t=(0,he.c)(8),{value:n,label:r,color:i}=e,a=`text-base font-black tabular-nums ${i}`,o;t[0]!==a||t[1]!==n?(o=(0,$.jsx)(`p`,{className:a,children:n}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let s;t[3]===r?s=t[4]:(s=(0,$.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:r}),t[3]=r,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,$.jsxs)(`div`,{className:`text-right`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Me(e){switch(e){case`filesystem`:return Q;case`web`:return f;case`cron`:return de;case`cli`:return T;case`agents`:return z;case`canvas`:return d;case`mcp`:return S;case`office`:return Q;default:return A}}function Ne(){let e=(0,he.c)(25),{id:t}=O(),n=D(),r=t??`unknown`,{agents:i,fetchAgents:o}=I(),s,l;e[0]===o?(s=e[1],l=e[2]):(s=()=>{o()},l=[o],e[0]=o,e[1]=s,e[2]=l),(0,ge.useEffect)(s,l);let u;if(e[3]!==r||e[4]!==i){let t;e[6]===r?t=e[7]:(t=e=>e.id===r,e[6]=r,e[7]=t),u=i.find(t),e[3]=r,e[4]=i,e[5]=u}else u=e[5];let d=u,f;e[8]===n?f=e[9]:(f=()=>n(`/agents`),e[8]=n,e[9]=f);let p,m;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(c,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),m=(0,$.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`}),e[10]=p,e[11]=m):(p=e[10],m=e[11]);let h;e[12]===f?h=e[13]:(h=(0,$.jsxs)(k,{variant:`ghost`,onClick:f,className:`group flex items-center gap-2 text-white/40 hover:text-white hover:bg-white/5 px-4 py-2 rounded-xl transition-colors`,children:[p,m]}),e[12]=f,e[13]=h);let g,_;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(pe,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),_=(0,$.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),e[14]=g,e[15]=_):(g=e[14],_=e[15]);let v;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[g,_,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(a,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]}),e[16]=v):v=e[16];let y;e[17]===h?y=e[18]:(y=(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[h,v]}),e[17]=h,e[18]=y);let b;e[19]!==d||e[20]!==r?(b=d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ye,{agent:d}),(0,$.jsx)(we,{agent:d}),(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,$.jsx)(ve,{agentId:r})})]}):(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,$.jsx)(a,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,$.jsx)(`p`,{className:`text-white/40 max-w-xs mx-auto`,children:`Estamos recuperando la configuración cuántica de este agente desde la base de datos central.`})]})]}),e[19]=d,e[20]=r,e[21]=b):b=e[21];let x;return e[22]!==y||e[23]!==b?(x=(0,$.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,$.jsxs)(`div`,{className:`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 animate-fade-in`,children:[y,b]})}),e[22]=y,e[23]=b,e[24]=x):x=e[24],x}export{Ne as AgentDetailPage};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{_ as n,c as r,d as i,f as a,g as o,h as s,l as c,m as l,p as u,u as d,v as f,y as p}from"./vendor-radix-DUug7irY.js";import{t as m}from"./vendor-react-kUOwxn0g.js";import{o as h}from"./vendor-query-Dj8xYhQD.js";import{t as g}from"./createLucideIcon-BRaPSYgN.js";import{t as ee}from"./activity-C_GS5wrG.js";import{t as _}from"./arrow-up-right-DWzTsCXj.js";import{t as v}from"./calendar-B6x9cw-q.js";import{t as y}from"./check-C8pw-7Fx.js";import{t as b}from"./chevron-right-BupZqrxu.js";import{t as x}from"./useProviders-DsFqfiyM.js";import{t as S}from"./ellipsis-vertical-D7uFJLGh.js";import{t as C}from"./file-text-D5ZJEx3E.js";import{r as w}from"./ModelSelector-BcaASPWF.js";import{t as T}from"./gauge-CEu7PhTW.js";import{t as E}from"./lock-3IApZyVy.js";import{a as D,i as O,n as k,o as A,s as j,t as te}from"./agentCapabilities-CDSfJWhw.js";import{t as ne}from"./pencil-CKritjT_.js";import{t as M}from"./plus-RD44ce15.js";import{t as N}from"./refresh-cw-DtJMHRHO.js";import{t as re}from"./shield-CIarwBvx.js";import{t as P}from"./sparkles-DVvY6jDT.js";import{t as ie}from"./trash-2-D6oziYAK.js";import{t as ae}from"./zap-DSoX9NDk.js";import{t as F}from"./utils-DEmd_M8c.js";import{c as oe}from"./vendor-router-DP84b3LQ.js";import{A as se,C as ce,G as I,J as le,S as ue,_ as de,lt as fe,q as pe}from"./index-C5Hhusqq.js";import{t as L}from"./AgentCreateForm-Btza1Kiv.js";var R=g(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),z=g(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),me=g(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),B=g(`Pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),V=m(),H=e(t(),1),U=h(),W=s,he=p,G=H.forwardRef((e,t)=>{let n=(0,V.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,inset:a,children:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=a&&`pl-8`,c;n[5]!==i||n[6]!==s?(c=F(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent`,s,i),n[5]=i,n[6]=s,n[7]=c):c=n[7];let l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,U.jsx)(b,{className:`ml-auto h-4 w-4`}),n[8]=l):l=n[8];let u;return n[9]!==r||n[10]!==o||n[11]!==t||n[12]!==c?(u=(0,U.jsxs)(f,{ref:t,className:c,...o,children:[r,l]}),n[9]=r,n[10]=o,n[11]=t,n[12]=c,n[13]=u):u=n[13],u});G.displayName=f.displayName;var K=H.forwardRef((e,t)=>{let r=(0,V.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=F(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,U.jsx)(n,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});K.displayName=n.displayName;var ge=H.forwardRef((e,t)=>{let n=(0,V.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,sideOffset:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?4:a,s;n[4]===r?s=n[5]:(s=F(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[4]=r,n[5]=s);let l;return n[6]!==i||n[7]!==t||n[8]!==o||n[9]!==s?(l=(0,U.jsx)(u,{children:(0,U.jsx)(c,{ref:t,sideOffset:o,className:s,...i})}),n[6]=i,n[7]=t,n[8]=o,n[9]=s,n[10]=l):l=n[10],l});ge.displayName=c.displayName;var _e=H.forwardRef((e,t)=>{let n=(0,V.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i&&`pl-8`,s;n[4]!==r||n[5]!==o?(s=F(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,o,r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==a||n[8]!==t||n[9]!==s?(c=(0,U.jsx)(d,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});_e.displayName=d.displayName;var ve=H.forwardRef((e,t)=>{let n=(0,V.c)(14),a,o,s,c;n[0]===e?(a=n[1],o=n[2],s=n[3],c=n[4]):({className:s,children:o,checked:a,...c}=e,n[0]=e,n[1]=a,n[2]=o,n[3]=s,n[4]=c);let l;n[5]===s?l=n[6]:(l=F(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,s),n[5]=s,n[6]=l);let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,U.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(i,{children:(0,U.jsx)(y,{className:`h-4 w-4`})})}),n[7]=u):u=n[7];let d;return n[8]!==a||n[9]!==o||n[10]!==c||n[11]!==t||n[12]!==l?(d=(0,U.jsxs)(r,{ref:t,className:l,checked:a,...c,children:[u,o]}),n[8]=a,n[9]=o,n[10]=c,n[11]=t,n[12]=l,n[13]=d):d=n[13],d});ve.displayName=r.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(12),r,a,o;n[0]===e?(r=n[1],a=n[2],o=n[3]):({className:a,children:r,...o}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o);let s;n[4]===a?s=n[5]:(s=F(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,a),n[4]=a,n[5]=s);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,U.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(i,{children:(0,U.jsx)(z,{className:`h-2 w-2 fill-current`})})}),n[6]=c):c=n[6];let u;return n[7]!==r||n[8]!==o||n[9]!==t||n[10]!==s?(u=(0,U.jsxs)(l,{ref:t,className:s,...o,children:[c,r]}),n[7]=r,n[8]=o,n[9]=t,n[10]=s,n[11]=u):u=n[11],u});q.displayName=l.displayName;var ye=H.forwardRef((e,t)=>{let n=(0,V.c)(11),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({className:r,inset:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s=i&&`pl-8`,c;n[4]!==r||n[5]!==s?(c=F(`px-2 py-1.5 text-sm font-semibold`,s,r),n[4]=r,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,U.jsx)(a,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});ye.displayName=a.displayName;var be=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let s;return n[5]!==i||n[6]!==t||n[7]!==a?(s=(0,U.jsx)(o,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=s):s=n[8],s});be.displayName=o.displayName;var xe=e=>{let t=(0,V.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`ml-auto text-xs tracking-widest opacity-60`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,U.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};xe.displayName=`DropdownMenuShortcut`;function Se(e){if(!e)return null;try{return D(new Date(e),`dd MMM yyyy`,{locale:O})}catch{return null}}function J(e){let t=(0,V.c)(165),{agent:n,onEdit:r}=e,i=oe(),{deleteAgent:a}=de(),{providers:o}=ce(),{models:s}=ue(),c;t[0]!==n.id||t[1]!==i?(c=e=>{e.target.closest(`[role="menuitem"]`)||e.target.closest(`button`)||i(`/agents/${n.id}`)},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l=c,u;t[3]!==n.id||t[4]!==n.name||t[5]!==a?(u=async e=>{if(e.stopPropagation(),(await se.fire({title:`¿Eliminar Agente?`,text:`¿Estás seguro de que deseas eliminar al agente "${n.name}"? Esta acción eliminará permanentemente su configuración.`,icon:`warning`,showCancelButton:!0,confirmButtonText:`Sí, eliminar`,cancelButtonText:`Cancelar`,reverseButtons:!0,background:`#09090b`,color:`#fff`,customClass:{popup:`border border-white/10 rounded-xl`,confirmButton:`bg-red-500 hover:bg-red-600 text-white`,cancelButton:`bg-white/10 hover:bg-white/20 text-white`}})).isConfirmed)try{await a(n.id)}catch(e){console.error(e)}},t[3]=n.id,t[4]=n.name,t[5]=a,t[6]=u):u=t[6];let d=u,f=n.role===`coordinator`,p=n.provider_id||n.providerId,m=n.model_id||n.modelId,h;t[7]!==p||t[8]!==o?(h=o.find(e=>e.id===p)?.name||p,t[7]=p,t[8]=o,t[9]=h):h=t[9];let g=h,_;t[10]!==m||t[11]!==s?(_=s.find(e=>e.id===m)?.name||m,t[10]=m,t[11]=s,t[12]=_):_=t[12];let y=_,b=n.enabled?n.status:`hibernated`,D;t[13]===n?D=t[14]:(D=k(n),t[13]=n,t[14]=D);let O=D.length,j;t[15]===n?j=t[16]:(j=te(n),t[15]=n,t[16]=j);let ne=j.length,M=!!n.systemPrompt,N=n.maxIterations||10,P=n.created_at||n.createdAt,F;t[17]===P?F=t[18]:(F=Se(P),t[17]=P,t[18]=F);let fe=F,pe=`group relative overflow-hidden rounded-2xl border bg-black/40 backdrop-blur-xl transition-all duration-500 cursor-pointer flex flex-col h-full
|
|
2
|
-
${n.enabled?f?`border-purple-500/20 hover:border-purple-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(168,85,247,0.15)]`:`border-white/10 hover:border-blue-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(59,130,246,0.15)]`:`border-white/5 opacity-70 grayscale hover:grayscale-0`}
|
|
3
|
-
`,L;t[19]!==n.id||t[20]!==i?(L=e=>{(e.key===`Enter`||e.key===` `)&&i(`/agents/${n.id}`)},t[19]=n.id,t[20]=i,t[21]=L):L=t[21];let R;t[22]!==n.enabled||t[23]!==f?(R=n.enabled&&(0,U.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent ${f?`via-purple-500/60`:`via-blue-500/50`} to-transparent`}),t[22]=n.enabled,t[23]=f,t[24]=R):R=t[24];let z;t[25]!==n.enabled||t[26]!==f?(z=n.enabled&&(0,U.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-br ${f?`from-purple-500/10 via-transparent to-blue-500/5`:`from-blue-500/10 via-transparent to-purple-500/10`} opacity-0 transition-opacity duration-500 group-hover:opacity-100 pointer-events-none`}),t[25]=n.enabled,t[26]=f,t[27]=z):z=t[27];let H=`w-11 h-11 rounded-xl flex items-center justify-center shrink-0 border transition-colors
|
|
4
|
-
${f?`bg-purple-500/10 border-purple-500/20 group-hover:border-purple-500/40`:`bg-blue-500/10 border-blue-500/20 group-hover:border-blue-500/40`}`,G;t[28]===f?G=t[29]:(G=f?(0,U.jsx)(re,{className:`h-5 w-5 text-purple-400`}):(0,U.jsx)(x,{className:`h-5 w-5 text-blue-400`}),t[28]=f,t[29]=G);let K;t[30]!==H||t[31]!==G?(K=(0,U.jsx)(`div`,{className:H,children:G}),t[30]=H,t[31]=G,t[32]=K):K=t[32];let ve=`text-base font-bold tracking-tight transition-colors truncate ${n.enabled?`text-white/95 group-hover:text-white`:`text-white/40`}`,q;t[33]!==n.name||t[34]!==ve?(q=(0,U.jsx)(`h3`,{className:ve,children:n.name}),t[33]=n.name,t[34]=ve,t[35]=q):q=t[35];let ye=`text-[9px] px-2 py-0.5 rounded-full font-bold uppercase border
|
|
5
|
-
${f?`bg-purple-500/10 text-purple-400 border-purple-500/20`:`bg-blue-500/10 text-blue-400 border-blue-500/20`}`,be=f?`Coordinador`:`Worker`,xe;t[36]!==ye||t[37]!==be?(xe=(0,U.jsx)(`span`,{className:ye,children:be}),t[36]=ye,t[37]=be,t[38]=xe):xe=t[38];let J;t[39]===n.hasHeaders?J=t[40]:(J=n.hasHeaders&&(0,U.jsx)(`span`,{title:`Credenciales Mapeadas`,className:`flex items-center justify-center p-0.5 rounded bg-emerald-500/10 border border-emerald-500/20`,children:(0,U.jsx)(E,{className:`h-2.5 w-2.5 text-emerald-400`})}),t[39]=n.hasHeaders,t[40]=J);let Y;t[41]===n.parentId?Y=t[42]:(Y=n.parentId&&(0,U.jsx)(`span`,{title:`Sub-agente`,className:`flex items-center justify-center p-0.5 rounded bg-amber-500/10 border border-amber-500/20`,children:(0,U.jsx)(me,{className:`h-2.5 w-2.5 text-amber-400`})}),t[41]=n.parentId,t[42]=Y);let X;t[43]!==xe||t[44]!==J||t[45]!==Y?(X=(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5 flex-wrap`,children:[xe,J,Y]}),t[43]=xe,t[44]=J,t[45]=Y,t[46]=X):X=t[46];let Z;t[47]!==q||t[48]!==X?(Z=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[q,X]}),t[47]=q,t[48]=X,t[49]=Z):Z=t[49];let Q;t[50]!==K||t[51]!==Z?(Q=(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[K,Z]}),t[50]=K,t[51]=Z,t[52]=Q):Q=t[52];let Ce;t[53]===b?Ce=t[54]:(Ce=(0,U.jsx)(A,{status:b}),t[53]=b,t[54]=Ce);let we;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,U.jsx)(he,{asChild:!0,children:(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-white/40 hover:text-white hover:bg-white/10 rounded-full transition-colors`,children:(0,U.jsx)(S,{className:`h-4 w-4`})})}),t[55]=we):we=t[55];let $;t[56]!==n||t[57]!==r?($=()=>r?.(n),t[56]=n,t[57]=r,t[58]=$):$=t[58];let Te,Ee;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,U.jsx)(B,{className:`h-4 w-4 text-blue-400`}),Ee=(0,U.jsx)(`span`,{children:`Editar Configuración`}),t[59]=Te,t[60]=Ee):(Te=t[59],Ee=t[60]);let De;t[61]===$?De=t[62]:(De=(0,U.jsxs)(_e,{onClick:$,className:`gap-2 cursor-pointer focus:bg-white/10 focus:text-white rounded-lg px-3 py-2 text-sm transition-colors`,children:[Te,Ee]}),t[61]=$,t[62]=De);let Oe,ke;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,U.jsx)(ie,{className:`h-4 w-4`}),ke=(0,U.jsx)(`span`,{children:`Eliminar Agente`}),t[63]=Oe,t[64]=ke):(Oe=t[63],ke=t[64]);let Ae;t[65]===d?Ae=t[66]:(Ae=(0,U.jsxs)(_e,{onClick:d,className:`gap-2 cursor-pointer focus:bg-red-500/20 focus:text-red-400 rounded-lg px-3 py-2 text-sm text-red-400 transition-colors`,children:[Oe,ke]}),t[65]=d,t[66]=Ae);let je;t[67]!==De||t[68]!==Ae?(je=(0,U.jsxs)(W,{children:[we,(0,U.jsxs)(ge,{align:`end`,className:`w-48 bg-black/90 backdrop-blur-xl border-white/10 text-white p-1 rounded-xl shadow-2xl`,children:[De,Ae]})]}),t[67]=De,t[68]=Ae,t[69]=je):je=t[69];let Me;t[70]!==Ce||t[71]!==je?(Me=(0,U.jsxs)(`div`,{className:`flex flex-col items-end gap-2 shrink-0`,children:[Ce,je]}),t[70]=Ce,t[71]=je,t[72]=Me):Me=t[72];let Ne;t[73]!==Q||t[74]!==Me?(Ne=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3 mb-4`,children:[Q,Me]}),t[73]=Q,t[74]=Me,t[75]=Ne):Ne=t[75];let Pe=n.description||`Sin descripción`,Fe;t[76]===Pe?Fe=t[77]:(Fe=(0,U.jsx)(`p`,{className:`text-xs text-white/50 line-clamp-2 leading-relaxed font-light mb-1`,children:Pe}),t[76]=Pe,t[77]=Fe);let Ie;t[78]!==n.enabled||t[79]!==p||t[80]!==g?(Ie=p&&(0,U.jsxs)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium uppercase tracking-wider flex items-center gap-1.5 border backdrop-blur-md transition-colors
|
|
6
|
-
${n.enabled?`bg-white/5 border-white/10 text-white/80 group-hover:bg-white/10 group-hover:border-white/20`:`bg-transparent border-white/5 text-white/30`}`,children:[(0,U.jsx)(x,{className:`h-3 w-3`}),g]}),t[78]=n.enabled,t[79]=p,t[80]=g,t[81]=Ie):Ie=t[81];let Le;t[82]!==n.enabled||t[83]!==m||t[84]!==y?(Le=m&&(0,U.jsx)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium tracking-wider border backdrop-blur-md transition-colors truncate max-w-[120px]
|
|
7
|
-
${n.enabled?`bg-white/5 border-white/10 text-white/80 group-hover:bg-white/10 group-hover:border-white/20`:`bg-transparent border-white/5 text-white/30`}`,title:y,children:y}),t[82]=n.enabled,t[83]=m,t[84]=y,t[85]=Le):Le=t[85];let Re;t[86]!==n.enabled||t[87]!==n.tone?(Re=n.tone&&(0,U.jsxs)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium uppercase tracking-wider flex items-center gap-1.5 border backdrop-blur-md transition-colors
|
|
8
|
-
${n.enabled?`bg-white/5 border-white/10 text-white/80 group-hover:bg-white/10 group-hover:border-white/20`:`bg-transparent border-white/5 text-white/30`}`,children:[(0,U.jsx)(ee,{className:`h-3 w-3`}),n.tone]}),t[86]=n.enabled,t[87]=n.tone,t[88]=Re):Re=t[88];let ze;t[89]!==n.enabled||t[90]!==n.workspace?(ze=n.workspace&&(0,U.jsxs)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium uppercase tracking-wider flex items-center gap-1.5 border backdrop-blur-md transition-colors
|
|
9
|
-
${n.enabled?`bg-emerald-500/5 border-emerald-500/20 text-emerald-300 group-hover:bg-emerald-500/10 group-hover:border-emerald-500/30`:`bg-transparent border-white/5 text-white/30`}`,title:`Workspace: ${n.workspace}`,children:[(0,U.jsx)(w,{className:`h-3 w-3`}),(0,U.jsx)(`span`,{className:`truncate max-w-[100px]`,children:`Workspace`})]}),t[89]=n.enabled,t[90]=n.workspace,t[91]=ze):ze=t[91];let Be;t[92]!==Ie||t[93]!==Le||t[94]!==Re||t[95]!==ze?(Be=(0,U.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[Ie,Le,Re,ze]}),t[92]=Ie,t[93]=Le,t[94]=Re,t[95]=ze,t[96]=Be):Be=t[96];let Ve;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,U.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,U.jsx)(le,{className:`h-3 w-3 text-emerald-400/70`}),`Tools`]}),t[97]=Ve):Ve=t[97];let He=`text-sm font-semibold font-mono ${n.enabled?`text-white/90`:`text-white/30`}`,Ue;t[98]!==He||t[99]!==O?(Ue=(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[Ve,(0,U.jsx)(`span`,{className:He,children:O})]}),t[98]=He,t[99]=O,t[100]=Ue):Ue=t[100];let We;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,U.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,U.jsx)(ae,{className:`h-3 w-3 text-amber-400/70`}),`Skills`]}),t[101]=We):We=t[101];let Ge=`text-sm font-semibold font-mono ${n.enabled?`text-white/90`:`text-white/30`}`,Ke;t[102]!==ne||t[103]!==Ge?(Ke=(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[We,(0,U.jsx)(`span`,{className:Ge,children:ne})]}),t[102]=ne,t[103]=Ge,t[104]=Ke):Ke=t[104];let qe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,U.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,U.jsx)(C,{className:`h-3 w-3 text-blue-400/70`}),`Prompt`]}),t[105]=qe):qe=t[105];let Je=`text-sm font-bold ${n.enabled?M?`text-emerald-400`:`text-white/30`:`text-white/20`}`,Ye=M?`✓`:`—`,Xe;t[106]!==Je||t[107]!==Ye?(Xe=(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[qe,(0,U.jsx)(`span`,{className:Je,children:Ye})]}),t[106]=Je,t[107]=Ye,t[108]=Xe):Xe=t[108];let Ze;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,U.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,U.jsx)(T,{className:`h-3 w-3 text-purple-400/70`}),`Iters`]}),t[109]=Ze):Ze=t[109];let Qe=`text-sm font-semibold font-mono ${n.enabled?`text-white/90`:`text-white/30`}`,$e;t[110]!==N||t[111]!==Qe?($e=(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[Ze,(0,U.jsx)(`span`,{className:Qe,children:N})]}),t[110]=N,t[111]=Qe,t[112]=$e):$e=t[112];let et;t[113]!==Ue||t[114]!==Ke||t[115]!==Xe||t[116]!==$e?(et=(0,U.jsxs)(`div`,{className:`mt-6 pt-5 border-t border-white/5 grid grid-cols-4 gap-2`,children:[Ue,Ke,Xe,$e]}),t[113]=Ue,t[114]=Ke,t[115]=Xe,t[116]=$e,t[117]=et):et=t[117];let tt;t[118]===n.systemPrompt?tt=t[119]:(tt=n.systemPrompt&&(0,U.jsxs)(`div`,{className:`mt-3 bg-white/[0.02] rounded-lg p-3 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,U.jsxs)(`span`,{className:`text-[10px] font-medium tracking-wider text-white/40 uppercase mb-1.5 flex items-center gap-1.5`,children:[(0,U.jsx)(C,{className:`h-3 w-3 text-blue-400/70`}),`System Prompt`]}),(0,U.jsxs)(`p`,{className:`text-xs text-white/60 font-mono line-clamp-2 leading-relaxed italic`,children:[`"`,n.systemPrompt,`"`]})]}),t[118]=n.systemPrompt,t[119]=tt);let nt;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,U.jsx)(`span`,{className:`text-[10px] font-medium tracking-wider text-white/40 uppercase`,children:`Tareas`}),t[120]=nt):nt=t[120];let rt=`text-sm font-semibold font-mono ${n.enabled?`text-white/90`:`text-white/30`}`,it=n.taskCount||0,at;t[121]!==rt||t[122]!==it?(at=(0,U.jsxs)(`div`,{className:`flex items-center justify-between bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[nt,(0,U.jsx)(`span`,{className:rt,children:it})]}),t[121]=rt,t[122]=it,t[123]=at):at=t[123];let ot;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,U.jsx)(`span`,{className:`text-[10px] font-medium tracking-wider text-white/40 uppercase`,children:`Éxito`}),t[124]=ot):ot=t[124];let st=`text-sm font-semibold font-mono ${n.enabled?`text-emerald-400/90`:`text-white/30`}`,ct=n.successRate||0,lt;t[125]!==st||t[126]!==ct?(lt=(0,U.jsxs)(`div`,{className:`flex items-center justify-between bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[ot,(0,U.jsxs)(`span`,{className:st,children:[ct,`%`]})]}),t[125]=st,t[126]=ct,t[127]=lt):lt=t[127];let ut;t[128]!==at||t[129]!==lt?(ut=(0,U.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:[at,lt]}),t[128]=at,t[129]=lt,t[130]=ut):ut=t[130];let dt=`h-2 w-2 rounded-full ${n.enabled?`bg-blue-400 shadow-[0_0_8px_rgba(96,165,250,0.8)] animate-pulse`:`bg-white/20`}`,ft;t[131]===dt?ft=t[132]:(ft=(0,U.jsx)(`div`,{className:dt}),t[131]=dt,t[132]=ft);let pt=`text-[10px] font-bold tracking-widest uppercase ${n.enabled?`text-blue-400`:`text-white/30`}`,mt=n.enabled?`ACTIVO`:`INACTIVO`,ht;t[133]!==pt||t[134]!==mt?(ht=(0,U.jsx)(`span`,{className:pt,children:mt}),t[133]=pt,t[134]=mt,t[135]=ht):ht=t[135];let gt;t[136]!==ft||t[137]!==ht?(gt=(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ft,ht]}),t[136]=ft,t[137]=ht,t[138]=gt):gt=t[138];let _t;t[139]===fe?_t=t[140]:(_t=fe&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-white/30 font-medium tracking-wider pl-3 border-l border-white/10`,children:[(0,U.jsx)(v,{className:`h-3 w-3`}),fe]}),t[139]=fe,t[140]=_t);let vt;t[141]!==gt||t[142]!==_t?(vt=(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[gt,_t]}),t[141]=gt,t[142]=_t,t[143]=vt):vt=t[143];let yt=`text-xs font-semibold tracking-wide flex items-center gap-1.5 transition-all
|
|
10
|
-
${n.enabled?`text-white/70 group-hover:text-blue-400 translate-x-1 group-hover:translate-x-0`:`text-white/20`}`,bt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,U.jsx)(`span`,{className:`transition-transform group-hover:translate-x-1 opacity-0 group-hover:opacity-100 hidden sm:inline-block`,children:`→`}),t[144]=bt):bt=t[144];let xt;t[145]===yt?xt=t[146]:(xt=(0,U.jsxs)(`div`,{className:yt,children:[`INGRESAR`,bt]}),t[145]=yt,t[146]=xt);let St;t[147]!==vt||t[148]!==xt?(St=(0,U.jsxs)(`div`,{className:`mt-auto pt-5 flex items-center justify-between`,children:[vt,xt]}),t[147]=vt,t[148]=xt,t[149]=St):St=t[149];let Ct;t[150]!==Ne||t[151]!==Fe||t[152]!==Be||t[153]!==et||t[154]!==tt||t[155]!==ut||t[156]!==St?(Ct=(0,U.jsxs)(`div`,{className:`p-5 flex flex-col flex-1 relative z-10`,children:[Ne,Fe,Be,et,tt,ut,St]}),t[150]=Ne,t[151]=Fe,t[152]=Be,t[153]=et,t[154]=tt,t[155]=ut,t[156]=St,t[157]=Ct):Ct=t[157];let wt;return t[158]!==l||t[159]!==L||t[160]!==R||t[161]!==z||t[162]!==Ct||t[163]!==pe?(wt=(0,U.jsxs)(`div`,{role:`button`,tabIndex:0,className:pe,onClick:l,onKeyDown:L,children:[R,z,Ct]}),t[158]=l,t[159]=L,t[160]=R,t[161]=z,t[162]=Ct,t[163]=pe,t[164]=wt):wt=t[164],wt}var Y=Math.sqrt(3),X=82;function Z(e,t){return{x:X*1.5*e,y:X*(Y/2*e+Y*t)}}var Q=[{q:1,r:0},{q:1,r:-1},{q:0,r:-1},{q:-1,r:0},{q:-1,r:1},{q:0,r:1}],Ce=[{q:2,r:0},{q:2,r:-1},{q:2,r:-2},{q:1,r:-2},{q:0,r:-2},{q:-1,r:-1},{q:-2,r:0},{q:-2,r:1},{q:-2,r:2},{q:-1,r:2},{q:0,r:2},{q:1,r:1}];function we(e,t){return t<=0?[]:t>=e.length?e:Array.from({length:t},(n,r)=>e[Math.floor(r*e.length/t)])}var $=`polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)`,Te={active:{bg:`#22c55e22`,dot:`#22c55e`,glow:`0 0 12px #22c55e88`},idle:{bg:`#f59e0b22`,dot:`#f59e0b`,glow:`0 0 12px #f59e0b88`},thinking:{bg:`#6366f122`,dot:`#818cf8`,glow:`0 0 12px #6366f188`},error:{bg:`#ef444422`,dot:`#ef4444`,glow:`0 0 12px #ef444488`},hibernated:{bg:`#1f293700`,dot:`#4b5563`,glow:`none`}};function Ee(e){if(!e)return 0;try{let t=JSON.parse(e);return Array.isArray(t)?t.length:0}catch{return 0}}function De(e){let t=(0,V.c)(85),{agents:n,onEdit:r,selectedId:i,onSelect:a}=e,o=oe(),{deleteAgent:s}=de(),[c,l]=(0,H.useState)(null),u;t[0]===n?u=t[1]:(u=n.find(ke)??n[0],t[0]=n,t[1]=u);let d=u,f;if(t[2]!==n||t[3]!==d?.id){let e;t[5]===d?.id?e=t[6]:(e=e=>e.id!==d?.id,t[5]=d?.id,t[6]=e),f=n.filter(e),t[2]=n,t[3]=d?.id,t[4]=f}else f=t[4];let p=f,m;t[7]!==d||t[8]!==p?(m={coordinator:d,workers:p},t[7]=d,t[8]=p,t[9]=m):m=t[9];let{coordinator:h,workers:g}=m,ee=Math.min(g.length,Q.length),_=Math.min(Math.max(g.length-Q.length,0),Ce.length),v;t[10]!==ee||t[11]!==_?(v=[...we(Q,ee),...we(Ce,_)].map(Oe),t[10]=ee,t[11]=_,t[12]=v):v=t[12];let y=v,b,S,C,w,T,E,D;if(t[13]!==y||t[14]!==h||t[15]!==s||t[16]!==c||t[17]!==o||t[18]!==r||t[19]!==a||t[20]!==i||t[21]!==g){let e=g.slice(0,y.length),n=g.length>6?2:1,u=n===2?700:520,d=n===2?680:500,f=u/2,p=d/2,m=Math.round(164*Y/2),ee=Math.round(124*Y/2),_;t[29]===s?_=t[30]:(_=async(e,t)=>{if(t.stopPropagation(),(await se.fire({title:`¿Eliminar Agente?`,text:`¿Eliminar "${e.name}"?`,icon:`warning`,showCancelButton:!0,confirmButtonText:`Sí, eliminar`,cancelButtonText:`Cancelar`,background:`#09090b`,color:`#fff`})).isConfirmed)try{await s(e.id)}catch(e){console.error(`No se pudo eliminar el agente:`,e)}},t[29]=s,t[30]=_);let v=_,O=h?Te[h.enabled?h.status:`hibernated`]??Te.hibernated:Te.hibernated;S=`w-full overflow-x-auto overflow-y-visible py-3`,C=`relative mx-auto select-none`,t[31]!==d||t[32]!==u?(w={width:u,height:d},t[31]=d,t[32]=u,t[33]=w):w=t[33];let k=f-130,A=p-130;t[34]!==k||t[35]!==A?(T=(0,U.jsx)(`div`,{className:`absolute pointer-events-none rounded-full blur-[80px] opacity-30`,style:{width:260,height:260,left:k,top:A,background:`radial-gradient(circle, rgba(245,158,11,0.6) 0%, transparent 70%)`}}),t[34]=k,t[35]=A,t[36]=T):T=t[36];let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,U.jsx)(`pattern`,{id:`hc-hex`,x:`0`,y:`0`,width:`52`,height:`30`,patternUnits:`userSpaceOnUse`,children:(0,U.jsx)(`polygon`,{points:`26,1 51,15.5 51,29 26,29 1,15.5 1,1`,fill:`none`,stroke:`rgba(255,255,255,0.03)`,strokeWidth:`1`})}),t[37]=j):j=t[37];let te;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,U.jsxs)(`defs`,{children:[j,(0,U.jsxs)(`radialGradient`,{id:`fade-mask`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,U.jsx)(`stop`,{offset:`0%`,stopColor:`white`,stopOpacity:`0.08`}),(0,U.jsx)(`stop`,{offset:`100%`,stopColor:`white`,stopOpacity:`0`})]})]}),t[38]=te):te=t[38];let ne,M;t[39]!==d||t[40]!==u?(ne=(0,U.jsx)(`rect`,{width:u,height:d,fill:`url(#hc-hex)`}),M=(0,U.jsx)(`rect`,{width:u,height:d,fill:`url(#fade-mask)`}),t[39]=d,t[40]=u,t[41]=ne,t[42]=M):(ne=t[41],M=t[42]);let N;t[43]!==y||t[44]!==f||t[45]!==p||t[46]!==c||t[47]!==i?(N=(e,t)=>{let n=y[t],r=c===e.id||i===e.id;return(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`line`,{x1:f,y1:p,x2:f+n.x,y2:p+n.y,stroke:r?`rgba(245,158,11,0.5)`:`rgba(245,158,11,0.12)`,strokeWidth:r?2:1,strokeDasharray:`5 5`,style:{transition:`stroke 0.3s ease, stroke-width 0.3s ease`}}),e.enabled&&(0,U.jsx)(`circle`,{r:`3`,fill:`rgba(245,158,11,0.7)`,children:(0,U.jsx)(`animateMotion`,{dur:`${2.5+t*.4}s`,repeatCount:`indefinite`,path:`M ${f} ${p} L ${f+n.x} ${p+n.y}`})})]},`line-${e.id}`)},t[43]=y,t[44]=f,t[45]=p,t[46]=c,t[47]=i,t[48]=N):N=t[48],E=(0,U.jsxs)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:u,height:d,xmlns:`http://www.w3.org/2000/svg`,children:[te,ne,M,e.map(N)]}),t[49]!==O||t[50]!==h||t[51]!==f||t[52]!==p||t[53]!==o||t[54]!==r||t[55]!==a||t[56]!==i?(D=h&&(0,U.jsxs)(`div`,{className:`absolute z-20 cursor-pointer group outline-none`,style:{left:f-82,top:p-m/2,width:164,height:m},onMouseEnter:()=>l(h.id),onMouseLeave:()=>l(null),children:[(0,U.jsx)(`button`,{type:`button`,className:`absolute inset-0 z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-300/70`,style:{clipPath:$},onClick:()=>a?.(h.id),"aria-label":`Seleccionar ${h.name}`,"aria-pressed":i===h.id}),(0,U.jsx)(`div`,{className:`absolute inset-[-6px] blur-[10px] transition-opacity duration-500 ${i===h.id?`opacity-90`:`opacity-40 group-hover:opacity-80`}`,style:{clipPath:$,background:`rgba(245,158,11,0.5)`}}),(0,U.jsx)(`div`,{className:`absolute inset-0 transition-transform duration-300 ${i===h.id?`scale-105`:`group-hover:scale-105`}`,style:{clipPath:$,background:`rgba(245,158,11,0.55)`},children:(0,U.jsx)(`div`,{className:`absolute inset-[2px]`,style:{clipPath:$,background:`linear-gradient(145deg, #1c1100 0%, #0d0b00 60%, #120d00 100%)`},children:(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-1.5 px-3`,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(re,{className:`h-8 w-8 text-amber-400 drop-shadow-[0_0_8px_rgba(245,158,11,0.8)]`}),(0,U.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full border-2 border-black`,style:{backgroundColor:O.dot,boxShadow:O.glow}})]}),(0,U.jsx)(`span`,{className:`text-[10px] font-black text-amber-300 tracking-[0.12em] text-center leading-tight uppercase line-clamp-2`,children:h.name}),(0,U.jsx)(`span`,{className:`text-[8px] text-amber-500/70 tracking-widest uppercase font-semibold`,children:`Coordinadora`})]})})}),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute -bottom-8 left-1/2 z-30 flex -translate-x-1/2 gap-1 opacity-0 transition-opacity duration-200 group-hover:pointer-events-auto group-hover:opacity-100`,children:[(0,U.jsx)(`button`,{type:`button`,className:`p-1.5 rounded bg-black/80 border border-amber-500/30 text-amber-400 hover:bg-amber-500/20 transition-colors`,onClick:e=>{e.stopPropagation(),r?.(h)},title:`Editar`,children:(0,U.jsx)(B,{className:`h-3 w-3`})}),(0,U.jsx)(`button`,{type:`button`,className:`p-1.5 rounded bg-black/80 border border-white/10 text-white/50 hover:text-white hover:border-white/20 transition-colors`,onClick:e=>{e.stopPropagation(),o(`/agents/${h.id}`)},title:`Ver detalle`,children:(0,U.jsx)(`span`,{className:`text-[9px] px-0.5`,children:`→`})})]})]}),t[49]=O,t[50]=h,t[51]=f,t[52]=p,t[53]=o,t[54]=r,t[55]=a,t[56]=i,t[57]=D):D=t[57];let P;t[58]!==y||t[59]!==f||t[60]!==p||t[61]!==v||t[62]!==c||t[63]!==o||t[64]!==r||t[65]!==a||t[66]!==i?(P=(e,t)=>{let n=y[t],s=f+n.x-62,u=p+n.y-ee/2,d=Te[e.enabled?e.status:`hibernated`]??Te.hibernated,m=Ee(e.toolsJson),h=Ee(e.skillsJson),g=c===e.id,_=i===e.id,b=e.enabled?_?`rgba(245,158,11,0.95)`:g?`rgba(96,165,250,0.9)`:`rgba(59,130,246,0.45)`:`rgba(255,255,255,0.08)`,S=e.enabled?`linear-gradient(145deg, #050d1c 0%, #020912 60%, #040a18 100%)`:`#0a0a0b`;return(0,U.jsxs)(`div`,{className:`absolute z-10 cursor-pointer group outline-none`,style:{left:s,top:u,width:124,height:ee},onMouseEnter:()=>l(e.id),onMouseLeave:()=>l(null),children:[(0,U.jsx)(`button`,{type:`button`,className:`absolute inset-0 z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-300/70`,style:{clipPath:$},onClick:()=>a?.(e.id),"aria-label":`Seleccionar ${e.name}`,"aria-pressed":_}),e.enabled&&(0,U.jsx)(`div`,{className:`absolute inset-[-5px] transition-opacity duration-300 blur-[8px]`,style:{clipPath:$,background:_?`rgba(245,158,11,0.45)`:`rgba(59,130,246,0.35)`,opacity:_?.9:g?.8:.2}}),(0,U.jsx)(`div`,{className:`absolute inset-0 transition-transform duration-300`,style:{clipPath:$,background:b,transform:_?`scale(1.08)`:g?`scale(1.06)`:`scale(1)`},children:(0,U.jsx)(`div`,{className:`absolute inset-[1.5px]`,style:{clipPath:$,background:S},children:(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-1 px-2`,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(x,{className:`h-5 w-5 transition-colors duration-300`,style:{color:_?`#fbbf24`:e.enabled?`#60a5fa`:`#374151`}}),(0,U.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-[#020912]`,style:{backgroundColor:d.dot,boxShadow:d.glow}})]}),(0,U.jsx)(`span`,{className:`text-[8px] font-bold tracking-wide text-center leading-tight uppercase line-clamp-2 transition-colors duration-300`,style:{color:_?`#fde68a`:e.enabled?`#93c5fd`:`#374151`},children:e.name}),(m>0||h>0)&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[m>0&&(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[7px] text-emerald-400/70`,children:[(0,U.jsx)(le,{className:`h-2 w-2`}),m]}),h>0&&(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[7px] text-amber-400/70`,children:[(0,U.jsx)(ae,{className:`h-2 w-2`}),h]})]})]})})}),(0,U.jsx)(`div`,{className:`absolute -bottom-7 left-1/2 -translate-x-1/2 z-30 transition-opacity duration-200`,style:{opacity:+!!g,pointerEvents:g?`auto`:`none`},children:(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,className:`p-1 rounded bg-black/80 border border-blue-500/30 text-blue-400 hover:bg-blue-500/20 transition-colors`,onClick:t=>{t.stopPropagation(),r?.(e)},title:`Editar`,children:(0,U.jsx)(B,{className:`h-2.5 w-2.5`})}),(0,U.jsx)(`button`,{type:`button`,className:`p-1 rounded bg-black/80 border border-white/10 text-white/50 hover:text-white transition-colors`,onClick:t=>{t.stopPropagation(),o(`/agents/${e.id}`)},title:`Ver`,children:(0,U.jsx)(`span`,{className:`text-[8px]`,children:`→`})}),(0,U.jsx)(`button`,{type:`button`,className:`p-1 rounded bg-black/80 border border-red-500/20 text-red-400/60 hover:text-red-400 transition-colors`,onClick:t=>v(e,t),title:`Eliminar`,children:(0,U.jsx)(ie,{className:`h-2.5 w-2.5`})})]})})]},e.id)},t[58]=y,t[59]=f,t[60]=p,t[61]=v,t[62]=c,t[63]=o,t[64]=r,t[65]=a,t[66]=i,t[67]=P):P=t[67],b=e.map(P),t[13]=y,t[14]=h,t[15]=s,t[16]=c,t[17]=o,t[18]=r,t[19]=a,t[20]=i,t[21]=g,t[22]=b,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D}else b=t[22],S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28];let O;t[68]===g.length?O=t[69]:(O=g.length>Q.length+Ce.length&&(0,U.jsxs)(`div`,{className:`absolute bottom-6 right-6 text-[11px] text-white/50 bg-white/5 rounded-full px-3 py-1 border border-white/10 backdrop-blur-sm`,children:[`+`,g.length-Q.length-Ce.length,` agentes en lista`]}),t[68]=g.length,t[69]=O);let k;t[70]!==b||t[71]!==O||t[72]!==C||t[73]!==w||t[74]!==T||t[75]!==E||t[76]!==D?(k=(0,U.jsxs)(`div`,{className:C,style:w,children:[T,E,D,b,O]}),t[70]=b,t[71]=O,t[72]=C,t[73]=w,t[74]=T,t[75]=E,t[76]=D,t[77]=k):k=t[77];let A;t[78]!==o||t[79]!==g?(A=g.length>Q.length+Ce.length&&(0,U.jsx)(`div`,{className:`mt-4 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 max-w-[740px] mx-auto px-4`,children:g.slice(Q.length+Ce.length).map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-white/10 bg-white/[0.03] hover:bg-white/[0.06] transition-colors text-left group`,onClick:()=>o(`/agents/${e.id}`),children:[(0,U.jsx)(x,{className:`h-4 w-4 text-blue-400/60 shrink-0`}),(0,U.jsx)(`span`,{className:`text-xs text-white/60 group-hover:text-white/90 truncate transition-colors`,children:e.name})]},e.id))}),t[78]=o,t[79]=g,t[80]=A):A=t[80];let j;return t[81]!==S||t[82]!==k||t[83]!==A?(j=(0,U.jsxs)(`div`,{className:S,children:[k,A]}),t[81]=S,t[82]=k,t[83]=A,t[84]=j):j=t[84],j}function Oe(e){let{q:t,r:n}=e;return Z(t,n)}function ke(e){return e.role===`coordinator`}function Ae(e){let t=(0,V.c)(16),{agents:n,onEdit:r,selectedId:i,onSelect:a}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,U.jsx)(`div`,{className:`p-4 rounded-full bg-white/5 mb-4`,children:(0,U.jsx)(`div`,{className:`h-10 w-10 border-2 border-dashed border-white/20 rounded-full`})}),(0,U.jsx)(`p`,{className:`hive-label uppercase`,children:`No se detectaron nodos activos`}),(0,U.jsx)(`p`,{className:`text-xs text-white/20 mt-1`,children:`Comienza desplegando un nuevo agente en tu red.`})]}),t[0]=e):e=t[0],e}let o;t[1]!==n||t[2]!==r||t[3]!==a||t[4]!==i?(o=(0,U.jsx)(`div`,{className:`hidden md:block`,children:(0,U.jsx)(De,{agents:n,onEdit:r,selectedId:i,onSelect:a})}),t[1]=n,t[2]=r,t[3]=a,t[4]=i,t[5]=o):o=t[5];let s;if(t[6]!==n||t[7]!==r){let e;t[9]===r?e=t[10]:(e=e=>(0,U.jsx)(J,{agent:e,onEdit:r},e.id),t[9]=r,t[10]=e),s=n.map(e),t[6]=n,t[7]=r,t[8]=s}else s=t[8];let c;t[11]===s?c=t[12]:(c=(0,U.jsx)(`div`,{className:`grid gap-6 sm:grid-cols-2 pb-20 md:hidden`,children:s}),t[11]=s,t[12]=c);let l;return t[13]!==o||t[14]!==c?(l=(0,U.jsxs)(U.Fragment,{children:[o,c]}),t[13]=o,t[14]=c,t[15]=l):l=t[15],l}function je(){let e=(0,V.c)(60),t=oe(),{agents:n,isLoading:r,error:i,fetchAgents:a}=de(),{providers:o,fetchProviders:s}=ce(),{models:c,fetchModels:l}=ue(),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(),[m,h]=(0,H.useState)(),g,ee;e[0]!==a||e[1]!==l||e[2]!==s?(g=()=>{a(),s(),l()},ee=[a,s,l],e[0]=a,e[1]=l,e[2]=s,e[3]=g,e[4]=ee):(g=e[3],ee=e[4]),(0,H.useEffect)(g,ee);let _;e[5]===n?_=e[6]:(_=n.find(Pe)??n[0],e[5]=n,e[6]=_);let v=_,y;e[7]!==n||e[8]!==v||e[9]!==m?(y=n.find(e=>e.id===m)??v,e[7]=n,e[8]=v,e[9]=m,e[10]=y):y=e[10];let b=y,x;e[11]===n?x=e[12]:(x=n.filter(Ne),e[11]=n,e[12]=x);let S=x.length,C;e[13]===n?C=e[14]:(C=n.filter(Me),e[13]=n,e[14]=C);let w=C.length,T;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{p(e),d(!0)},e[15]=T):T=e[15];let E=T,D;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{p(void 0),d(!0)},e[16]=D):D=e[16];let O=D,k;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{d(!1),p(void 0)},e[17]=k):k=e[17];let A=k,te;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_85%_0%,rgba(59,130,246,0.10),transparent_28%),radial-gradient(circle_at_8%_100%,rgba(245,158,11,0.08),transparent_32%)]`}),e[18]=te):te=e[18];let ne;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,U.jsxs)(`div`,{className:`mb-2.5 flex items-center gap-2 text-[9px] font-bold uppercase tracking-[0.24em] text-blue-400`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-blue-400 shadow-[0_0_8px_rgba(96,165,250,0.8)]`}),`Nexo central · configuración de agentes`]}),e[19]=ne):ne=e[19];let re;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,U.jsxs)(`div`,{children:[ne,(0,U.jsxs)(`h1`,{className:`text-3xl font-black tracking-[-0.04em] text-white sm:text-4xl`,children:[`Tu colmena `,(0,U.jsx)(`span`,{className:`text-amber-400`,children:`inteligente`})]}),(0,U.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-6 text-white/45`,children:`Selecciona un nodo para revisar su configuración, ajustar su propósito o entrar a su espacio operativo.`})]}),e[20]=re):re=e[20];let P;e[21]===S?P=e[22]:(P=(0,U.jsx)(Fe,{value:S,label:`activos`,color:`text-emerald-400`}),e[21]=S,e[22]=P);let ie;e[23]===w?ie=e[24]:(ie=(0,U.jsx)(Fe,{value:w,label:`especialistas`,color:`text-blue-400`}),e[23]=w,e[24]=ie);let ae;e[25]!==P||e[26]!==ie?(ae=(0,U.jsxs)(`div`,{className:`hidden items-center gap-4 xl:flex`,children:[P,ie]}),e[25]=P,e[26]=ie,e[27]=ae):ae=e[27];let F;e[28]===a?F=e[29]:(F=()=>a(),e[28]=a,e[29]=F);let se=`h-3.5 w-3.5 text-blue-400 ${r?`animate-spin`:``}`,I;e[30]===se?I=e[31]:(I=(0,U.jsx)(N,{className:se}),e[30]=se,e[31]=I);let le;e[32]!==r||e[33]!==F||e[34]!==I?(le=(0,U.jsxs)(`button`,{type:`button`,onClick:F,disabled:r,className:`flex h-10 items-center gap-2 rounded-lg border border-white/10 bg-white/[0.035] px-3.5 text-xs font-semibold text-white/60 transition-colors hover:border-white/20 hover:bg-white/[0.07] hover:text-white disabled:opacity-50`,children:[I,`Sincronizar`]}),e[32]=r,e[33]=F,e[34]=I,e[35]=le):le=e[35];let R;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,U.jsxs)(`button`,{type:`button`,onClick:O,className:`flex h-10 items-center gap-2 rounded-lg border border-amber-300/40 bg-amber-400 px-4 text-xs font-bold text-[#181108] shadow-[0_0_20px_rgba(245,158,11,0.16)] transition hover:bg-amber-300`,children:[(0,U.jsx)(M,{className:`h-3.5 w-3.5`}),`Desplegar nodo`]}),e[36]=R):R=e[36];let z;e[37]===le?z=e[38]:(z=(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[le,R]}),e[37]=le,e[38]=z);let me;e[39]!==ae||e[40]!==z?(me=(0,U.jsxs)(`header`,{className:`relative overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/80 px-5 py-5 shadow-xl shadow-black/10 sm:px-6`,children:[te,(0,U.jsxs)(`div`,{className:`relative flex flex-col gap-5 lg:flex-row lg:items-end lg:justify-between`,children:[re,(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-3 lg:items-end`,children:[ae,z]})]})]}),e[39]=ae,e[40]=z,e[41]=me):me=e[41];let B;e[42]!==S||e[43]!==n||e[44]!==i||e[45]!==r||e[46]!==c||e[47]!==t||e[48]!==o||e[49]!==b?(B=i?(0,U.jsxs)(`div`,{className:`mt-5 flex items-start gap-3 rounded-xl border border-red-500/20 bg-red-500/[0.07] p-4 text-red-300`,children:[(0,U.jsx)(pe,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-xs font-bold uppercase tracking-wider`,children:`Error de enlace`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-red-300/60`,children:i})]})]}):r&&n.length===0?(0,U.jsxs)(`div`,{className:`mt-5 grid gap-4 lg:grid-cols-[280px_1fr]`,children:[(0,U.jsx)(`div`,{className:`h-[560px] animate-pulse rounded-2xl border border-white/5 bg-white/[0.02]`}),(0,U.jsx)(`div`,{className:`h-[560px] animate-pulse rounded-2xl border border-white/5 bg-white/[0.02]`})]}):n.length===0?(0,U.jsxs)(`div`,{className:`mt-5 flex min-h-[500px] flex-col items-center justify-center rounded-2xl border border-dashed border-white/10 bg-black/20 px-6 text-center`,children:[(0,U.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-2xl border border-amber-500/20 bg-amber-500/10`,children:(0,U.jsx)(fe,{className:`h-7 w-7 text-amber-400`})}),(0,U.jsx)(`h2`,{className:`mt-5 text-lg font-bold text-white`,children:`Colmena inactiva`}),(0,U.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-white/40`,children:`Despliega el primer agente para crear el núcleo de tu red.`}),(0,U.jsxs)(`button`,{type:`button`,onClick:O,className:`mt-6 flex h-10 items-center gap-2 rounded-lg bg-amber-400 px-4 text-xs font-bold text-[#181108]`,children:[(0,U.jsx)(M,{className:`h-4 w-4`}),`Desplegar primer nodo`]})]}):(0,U.jsxs)(`div`,{className:`mt-5 grid items-start gap-4 lg:grid-cols-[290px_minmax(0,1fr)]`,children:[(0,U.jsx)(Ie,{agent:b,providerName:o.find(e=>e.id===(b?.provider_id||b?.providerId))?.name,modelName:c.find(e=>e.id===(b?.model_id||b?.modelId))?.name,totalAgents:n.length,activeCount:S,onEdit:E,onOpen:e=>t(`/agents/${e.id}`)}),(0,U.jsxs)(`section`,{className:`min-w-0 overflow-hidden rounded-2xl border border-white/[0.08] bg-[#080b11]/75 shadow-2xl shadow-black/15`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-white/[0.07] px-4 py-3.5 sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg border border-blue-500/20 bg-blue-500/10`,children:(0,U.jsx)(j,{className:`h-4 w-4 text-blue-400`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-xs font-bold uppercase tracking-[0.14em] text-white/80`,children:`Mapa de la colmena`}),(0,U.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/30`,children:`Haz clic en un hexágono para inspeccionarlo`})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-400`}),`Coordinación`]}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-blue-400`}),`Especialistas`]})]})]}),(0,U.jsxs)(`div`,{className:`relative min-h-[560px] overflow-hidden`,children:[(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_50%_50%,rgba(245,158,11,0.045),transparent_38%)]`}),(0,U.jsx)(Ae,{agents:n,onEdit:E,selectedId:b?.id,onSelect:h})]})]})]}),e[42]=S,e[43]=n,e[44]=i,e[45]=r,e[46]=c,e[47]=t,e[48]=o,e[49]=b,e[50]=B):B=e[50];let W;e[51]!==me||e[52]!==B?(W=(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-[1480px] px-2 py-4 sm:px-4 lg:px-6 lg:py-6`,children:[me,B]}),e[51]=me,e[52]=B,e[53]=W):W=e[53];let he;e[54]!==f||e[55]!==u?(he=u&&(0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-6`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":`Cerrar configuración`,className:`absolute inset-0 cursor-default bg-black/75 backdrop-blur-sm`,onClick:A}),(0,U.jsx)(`div`,{className:`relative max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border border-white/10 bg-[#09090b] shadow-2xl`,children:(0,U.jsx)(L,{initialData:f,onSuccess:A,onCancel:A})})]}),e[54]=f,e[55]=u,e[56]=he):he=e[56];let G;return e[57]!==W||e[58]!==he?(G=(0,U.jsxs)(`div`,{className:`hive-page min-h-full`,children:[W,he]}),e[57]=W,e[58]=he,e[59]=G):G=e[59],G}function Me(e){return e.role===`worker`}function Ne(e){return e.enabled}function Pe(e){return e.role===`coordinator`}function Fe(e){let t=(0,V.c)(8),{value:n,label:r,color:i}=e,a=`text-lg font-black tabular-nums ${i}`,o;t[0]!==a||t[1]!==n?(o=(0,U.jsx)(`span`,{className:a,children:n}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let s;t[3]===r?s=t[4]:(s=(0,U.jsx)(`span`,{className:`text-[9px] font-bold uppercase tracking-wider text-white/25`,children:r}),t[3]=r,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ie(e){let t=(0,V.c)(89),{agent:n,providerName:r,modelName:i,totalAgents:a,activeCount:o,onEdit:s,onOpen:c}=e;if(!n)return null;let l=n.role===`coordinator`,u=n.provider_id||n.providerId,d=n.model_id||n.modelId,f;t[0]===n?f=t[1]:(f=k(n),t[0]=n,t[1]=f);let p=f.length,m;t[2]===n?m=t[3]:(m=te(n),t[2]=n,t[3]=m);let h=m.length,g=`h-1 w-full ${l?`bg-amber-400`:`bg-blue-500`}`,v;t[4]===g?v=t[5]:(v=(0,U.jsx)(`div`,{className:g}),t[4]=g,t[5]=v);let y=`flex h-11 w-11 items-center justify-center rounded-xl border ${l?`border-amber-500/20 bg-amber-500/10 text-amber-400`:`border-blue-500/20 bg-blue-500/10 text-blue-400`}`,b;t[6]===l?b=t[7]:(b=l?(0,U.jsx)(re,{className:`h-5 w-5`}):(0,U.jsx)(R,{className:`h-5 w-5`}),t[6]=l,t[7]=b);let x;t[8]!==y||t[9]!==b?(x=(0,U.jsx)(`div`,{className:y,children:b}),t[8]=y,t[9]=b,t[10]=x):x=t[10];let S=`flex items-center gap-1.5 rounded-full border px-2 py-1 text-[9px] font-bold uppercase tracking-wider ${n.status===`archived`?`border-amber-500/20 bg-amber-500/10 text-amber-400`:n.enabled?`border-emerald-500/20 bg-emerald-500/10 text-emerald-400`:`border-white/10 bg-white/5 text-white/35`}`,C=`h-1.5 w-1.5 rounded-full ${n.status===`archived`?`bg-amber-400`:n.enabled?`bg-emerald-400`:`bg-white/30`}`,T;t[11]===C?T=t[12]:(T=(0,U.jsx)(`span`,{className:C}),t[11]=C,t[12]=T);let E=n.status===`archived`?`Archivado`:n.enabled?`Activo`:`Inactivo`,D;t[13]!==T||t[14]!==E||t[15]!==S?(D=(0,U.jsxs)(`span`,{className:S,children:[T,E]}),t[13]=T,t[14]=E,t[15]=S,t[16]=D):D=t[16];let O;t[17]!==D||t[18]!==x?(O=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[x,D]}),t[17]=D,t[18]=x,t[19]=O):O=t[19];let A=`mt-4 text-[9px] font-bold uppercase tracking-[0.2em] ${l?`text-amber-400`:`text-blue-400`}`,j=l?`Nodo coordinador`:`Nodo especialista`,M;t[20]!==A||t[21]!==j?(M=(0,U.jsx)(`p`,{className:A,children:j}),t[20]=A,t[21]=j,t[22]=M):M=t[22];let N;t[23]===n.name?N=t[24]:(N=(0,U.jsx)(`h2`,{className:`mt-1.5 text-xl font-black leading-tight tracking-tight text-white`,children:n.name}),t[23]=n.name,t[24]=N);let ie=n.description||`Este agente todavía no tiene una descripción de propósito.`,F;t[25]===ie?F=t[26]:(F=(0,U.jsx)(`p`,{className:`mt-2 line-clamp-3 min-h-[54px] text-xs leading-[18px] text-white/40`,children:ie}),t[25]=ie,t[26]=F);let oe=r||u||`Sin proveedor`,se;t[27]===oe?se=t[28]:(se=(0,U.jsx)(Le,{icon:R,label:`Motor`,value:oe}),t[27]=oe,t[28]=se);let ce=i||d||`Sin modelo`,I;t[29]===ce?I=t[30]:(I=(0,U.jsx)(Le,{icon:P,label:`Modelo`,value:ce}),t[29]=ce,t[30]=I);let ue=n.workspace||`Sin asignar`,de=!!n.workspace,fe;t[31]!==ue||t[32]!==de?(fe=(0,U.jsx)(Le,{icon:w,label:`Workspace`,value:ue,mono:de}),t[31]=ue,t[32]=de,t[33]=fe):fe=t[33];let pe;t[34]!==se||t[35]!==I||t[36]!==fe?(pe=(0,U.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[se,I,fe]}),t[34]=se,t[35]=I,t[36]=fe,t[37]=pe):pe=t[37];let L;t[38]===p?L=t[39]:(L=(0,U.jsx)(Re,{icon:le,value:p,label:`Tools`,color:`text-emerald-400`}),t[38]=p,t[39]=L);let z;t[40]===h?z=t[41]:(z=(0,U.jsx)(Re,{icon:ae,value:h,label:`Skills`,color:`text-amber-400`}),t[40]=h,t[41]=z);let me=n.maxIterations||10,B;t[42]===me?B=t[43]:(B=(0,U.jsx)(Re,{icon:ee,value:me,label:`Iters`,color:`text-violet-400`}),t[42]=me,t[43]=B);let H;t[44]!==L||t[45]!==z||t[46]!==B?(H=(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-3 gap-1.5`,children:[L,z,B]}),t[44]=L,t[45]=z,t[46]=B,t[47]=H):H=t[47];let W;t[48]!==n||t[49]!==s?(W=()=>s(n),t[48]=n,t[49]=s,t[50]=W):W=t[50];let he=`flex h-10 items-center justify-center gap-2 rounded-lg text-xs font-bold transition-colors ${l?`bg-amber-400 text-[#181108] hover:bg-amber-300`:`bg-blue-600 text-white hover:bg-blue-500`}`,G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,U.jsx)(ne,{className:`h-3.5 w-3.5`}),t[51]=G):G=t[51];let K;t[52]!==W||t[53]!==he?(K=(0,U.jsxs)(`button`,{type:`button`,onClick:W,className:he,children:[G,`Configurar nodo`]}),t[52]=W,t[53]=he,t[54]=K):K=t[54];let ge;t[55]!==n||t[56]!==c?(ge=()=>c(n),t[55]=n,t[56]=c,t[57]=ge):ge=t[57];let _e;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,U.jsx)(_,{className:`h-3.5 w-3.5`}),t[58]=_e):_e=t[58];let ve;t[59]===ge?ve=t[60]:(ve=(0,U.jsxs)(`button`,{type:`button`,onClick:ge,className:`flex h-10 items-center justify-center gap-2 rounded-lg border border-white/10 bg-white/[0.03] text-xs font-semibold text-white/60 transition-colors hover:bg-white/[0.07] hover:text-white`,children:[`Abrir perfil`,_e]}),t[59]=ge,t[60]=ve);let q;t[61]!==K||t[62]!==ve?(q=(0,U.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[K,ve]}),t[61]=K,t[62]=ve,t[63]=q):q=t[63];let ye;t[64]!==O||t[65]!==M||t[66]!==N||t[67]!==F||t[68]!==pe||t[69]!==H||t[70]!==q?(ye=(0,U.jsxs)(`div`,{className:`p-5`,children:[O,M,N,F,pe,H,q]}),t[64]=O,t[65]=M,t[66]=N,t[67]=F,t[68]=pe,t[69]=H,t[70]=q,t[71]=ye):ye=t[71];let be;t[72]===a?be=t[73]:(be=(0,U.jsx)(`p`,{className:`text-lg font-black tabular-nums text-white`,children:a}),t[72]=a,t[73]=be);let xe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,U.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:`Nodos totales`}),t[74]=xe):xe=t[74];let Se;t[75]===be?Se=t[76]:(Se=(0,U.jsxs)(`div`,{className:`bg-[#0b0e14] px-4 py-3`,children:[be,xe]}),t[75]=be,t[76]=Se);let J;t[77]===o?J=t[78]:(J=(0,U.jsx)(`p`,{className:`text-lg font-black tabular-nums text-emerald-400`,children:o}),t[77]=o,t[78]=J);let Y;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,U.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:`En operación`}),t[79]=Y):Y=t[79];let X;t[80]===J?X=t[81]:(X=(0,U.jsxs)(`div`,{className:`bg-[#0b0e14] px-4 py-3`,children:[J,Y]}),t[80]=J,t[81]=X);let Z;t[82]!==Se||t[83]!==X?(Z=(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-white/[0.07] bg-white/[0.07]`,children:[Se,X]}),t[82]=Se,t[83]=X,t[84]=Z):Z=t[84];let Q;return t[85]!==v||t[86]!==ye||t[87]!==Z?(Q=(0,U.jsxs)(`aside`,{className:`overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/90 lg:sticky lg:top-4`,children:[v,ye,Z]}),t[85]=v,t[86]=ye,t[87]=Z,t[88]=Q):Q=t[88],Q}function Le(e){let t=(0,V.c)(13),{icon:n,label:r,value:i,mono:a}=e,o=a===void 0?!1:a,s;t[0]===n?s=t[1]:(s=(0,U.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 text-white/30`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,U.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:r}),t[2]=r,t[3]=c);let l=`mt-0.5 truncate text-[11px] text-white/65 ${o?`font-mono`:`font-medium`}`,u;t[4]!==l||t[5]!==i?(u=(0,U.jsx)(`p`,{className:l,title:i,children:i}),t[4]=l,t[5]=i,t[6]=u):u=t[6];let d;t[7]!==c||t[8]!==u?(d=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[c,u]}),t[7]=c,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==s||t[11]!==d?(f=(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-white/[0.06] bg-white/[0.025] px-3 py-2.5`,children:[s,d]}),t[10]=s,t[11]=d,t[12]=f):f=t[12],f}function Re(e){let t=(0,V.c)(11),{icon:n,value:r,label:i,color:a}=e,o=`mx-auto h-3.5 w-3.5 ${a}`,s;t[0]!==n||t[1]!==o?(s=(0,U.jsx)(n,{className:o}),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c;t[3]===r?c=t[4]:(c=(0,U.jsx)(`p`,{className:`mt-1 text-sm font-black tabular-nums text-white/80`,children:r}),t[3]=r,t[4]=c);let l;t[5]===i?l=t[6]:(l=(0,U.jsx)(`p`,{className:`text-[7px] font-bold uppercase tracking-wider text-white/25`,children:i}),t[5]=i,t[6]=l);let u;return t[7]!==s||t[8]!==c||t[9]!==l?(u=(0,U.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-black/20 px-2 py-2.5 text-center`,children:[s,c,l]}),t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10],u}export{je as AgentsPage};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,c as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./vendor-charts-K3xcRl0X.js";import{t as f}from"./vendor-react-kUOwxn0g.js";import{i as p,n as m,o as h,t as g}from"./vendor-query-Dj8xYhQD.js";import{t as _}from"./createLucideIcon-BRaPSYgN.js";import{t as v}from"./activity-C_GS5wrG.js";import{t as y}from"./arrow-up-right-DWzTsCXj.js";import{t as b}from"./circle-check-BKNT2_q6.js";import{n as x,t as S}from"./useOfficeModel-BaDn7U-X.js";import{t as C}from"./download-BQXrpH0m.js";import{t as w}from"./external-link-6oTH9pUM.js";import{t as T}from"./gauge-CEu7PhTW.js";import{t as E}from"./info-8ReWzubE.js";import{t as D}from"./zap-DSoX9NDk.js";import{A as O,G as k,H as A,N as j,O as M,Q as ee,_ as N,c as te,ct as ne,d as P,f as re,g as F,h as I,it as ie,l as L,lt as ae,m as R,nt as z,p as B,rt as V,tt as oe,u as H}from"./index-C5Hhusqq.js";import{t as U}from"./badge-B5AKge1b.js";import{a as se,i as W,n as ce,r as le,t as ue}from"./card-mTJ4oZbL.js";var G=_(`DollarSign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),de=_(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),K=_(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),q=_(`MemoryStick`,[[`path`,{d:`M6 19v-3`,key:`1nvgqn`}],[`path`,{d:`M10 19v-3`,key:`iu8nkm`}],[`path`,{d:`M14 19v-3`,key:`kcehxu`}],[`path`,{d:`M18 19v-3`,key:`1vh91z`}],[`path`,{d:`M8 11V9`,key:`63erz4`}],[`path`,{d:`M16 11V9`,key:`fru6f3`}],[`path`,{d:`M12 11V9`,key:`ha00sb`}],[`path`,{d:`M2 15h20`,key:`16ne18`}],[`path`,{d:`M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z`,key:`lhddv3`}]]),fe=_(`TrendingUp`,[[`polyline`,{points:`22 7 13.5 15.5 8.5 10.5 2 17`,key:`126l90`}],[`polyline`,{points:`16 7 22 7 22 13`,key:`kwv8wd`}]]),pe=f(),me=e(r(),1);function J(){let e=(0,pe.c)(19),{agents:t,isLoading:n,error:r,fetchAgents:i,createAgent:a,updateAgent:o,deleteAgent:s}=N(),[c,l]=(0,me.useState)(`all`),u,d;e[0]===i?(u=e[1],d=e[2]):(u=()=>{i()},d=[i],e[0]=i,e[1]=u,e[2]=d),(0,me.useEffect)(u,d);let f;bb0:{if(!Array.isArray(t)){let t;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[3]=t):t=e[3],f=t;break bb0}let n;e[4]!==t||e[5]!==c?(n=c===`all`?t:t.filter(e=>e.status===c),e[4]=t,e[5]=c,e[6]=n):n=e[6],f=n}let p=f,m;e[7]===t?m=e[8]:(m=t||[],e[7]=t,e[8]=m);let h;return e[9]!==a||e[10]!==s||e[11]!==r||e[12]!==i||e[13]!==c||e[14]!==p||e[15]!==n||e[16]!==m||e[17]!==o?(h={agents:p,allAgents:m,filter:c,setFilter:l,createAgent:a,updateAgent:o,deleteAgent:s,isLoading:n,error:r,refreshAgents:i},e[9]=a,e[10]=s,e[11]=r,e[12]=i,e[13]=c,e[14]=p,e[15]=n,e[16]=m,e[17]=o,e[18]=h):h=e[18],h}var Y=h();function he(e){return e<50?`#22c55e`:e<80?`#eab308`:`#ef4444`}function ge(){let e=(0,pe.c)(59),[n,r]=(0,me.useState)(ve),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[0]=o):o=e[0],(0,me.useState)(o);let s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={queryKey:[`system-stats`],queryFn:_e,refetchInterval:5e3},e[1]=s):s=e[1];let{data:l}=m(s),d=(0,me.useRef)(l),f,p;e[2]===l?(f=e[3],p=e[4]):(f=()=>{d.current=l},p=[l],e[2]=l,e[3]=f,e[4]=p),(0,me.useEffect)(f,p);let h,g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=setInterval(()=>{let e=d.current;if(!e)return;let t=new Date().toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});r(n=>[...n,{time:t,msgs:e.recentMessages,rss:e.memory.rss}].slice(-20))},5e3);return()=>clearInterval(e)},g=[],e[5]=h,e[6]=g):(h=e[5],g=e[6]),(0,me.useEffect)(h,g);let _=l?.memory.rss??0,y=l?.memory.heapUsed??0,b=l?.memory.external??0,x=l?.recentMessages??0,S;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(W,{className:`pb-2 bg-gradient-to-r from-primary/5 to-transparent`,children:(0,Y.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Y.jsxs)(se,{className:`text-base flex items-center gap-2`,children:[(0,Y.jsx)(T,{className:`h-4 w-4 text-primary`}),`Monitor del Proceso Hive`]})})}),e[7]=S):S=e[7];let C=`${l?.cpu??0}%`,w=`${l?.cores??1} núcleos disponibles`,E=l?.cpu??0,O;e[8]===E?O=e[9]:(O=he(E),e[8]=E,e[9]=O);let k=Math.min(100,l?.cpu??0),A;e[10]!==O||e[11]!==k||e[12]!==C||e[13]!==w?(A=(0,Y.jsx)(ye,{icon:D,label:`CPU del proceso`,value:C,subValue:w,color:O,progress:k}),e[10]=O,e[11]=k,e[12]=C,e[13]=w,e[14]=A):A=e[14];let j=`${x}`,M=x>0?`#22c55e`:`hsl(var(--muted-foreground))`,ee=Math.min(100,x*10),N;e[15]!==j||e[16]!==M||e[17]!==ee?(N=(0,Y.jsx)(ye,{icon:z,label:`Actividad reciente`,value:j,subValue:`mensajes últimos 5 min`,color:M,progress:ee}),e[15]=j,e[16]=M,e[17]=ee,e[18]=N):N=e[18];let te=`${_} MB`,ne=`Heap JS: ${y} MB usados`,P;e[19]===_?P=e[20]:(P=Math.round(_/1024*100),e[19]=_,e[20]=P);let re=Math.min(100,P),F;e[21]===re?F=e[22]:(F=he(re),e[21]=re,e[22]=F);let I;e[23]===_?I=e[24]:(I=Math.round(_/1024*100),e[23]=_,e[24]=I);let ie=Math.min(100,I),L;e[25]!==te||e[26]!==ne||e[27]!==F||e[28]!==ie?(L=(0,Y.jsx)(ye,{icon:de,label:`Memoria Hive (RSS)`,value:te,subValue:ne,color:F,progress:ie}),e[25]=te,e[26]=ne,e[27]=F,e[28]=ie,e[29]=L):L=e[29];let ae=`${y} MB`,R=`External: ${b} MB`,B;e[30]===y?B=e[31]:(B=Math.round(y/512*100),e[30]=y,e[31]=B);let V=Math.min(100,B),H;e[32]!==ae||e[33]!==R||e[34]!==V?(H=(0,Y.jsx)(ye,{icon:q,label:`Heap JS`,value:ae,subValue:R,color:`#3b82f6`,progress:V}),e[32]=ae,e[33]=R,e[34]=V,e[35]=H):H=e[35];let U=`${l?.connections??0}`,le=Math.min(100,(l?.connections??0)*10),G;e[36]!==U||e[37]!==le?(G=(0,Y.jsx)(ye,{icon:oe,label:`Sesiones WS activas`,value:U,subValue:`conexiones WebSocket`,color:`#a855f7`,progress:le}),e[36]=U,e[37]=le,e[38]=G):G=e[38];let K;e[39]!==A||e[40]!==N||e[41]!==L||e[42]!==H||e[43]!==G?(K=(0,Y.jsxs)(ue,{className:`overflow-hidden border-primary/10`,children:[S,(0,Y.jsxs)(ce,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-5 pt-4`,children:[A,N,L,H,G]})]}),e[39]=A,e[40]=N,e[41]=L,e[42]=H,e[43]=G,e[44]=K):K=e[44];let fe;e[45]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Y.jsx)(v,{className:`h-4 w-4 text-primary`}),e[45]=fe):fe=e[45];let J;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Y.jsx)(`span`,{className:`text-green-400`,children:`Mensajes`}),e[46]=J):J=e[46];let ge;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Y.jsx)(W,{className:`pb-2`,children:(0,Y.jsxs)(se,{className:`text-sm flex items-center gap-2`,children:[fe,`Historial — `,J,` · `,(0,Y.jsx)(`span`,{className:`text-purple-400`,children:`RSS MB`})]})}),e[47]=ge):ge=e[47];let X;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Y.jsxs)(`linearGradient`,{id:`gMsgs`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`5%`,stopColor:`#22c55e`,stopOpacity:.3}),(0,Y.jsx)(`stop`,{offset:`95%`,stopColor:`#22c55e`,stopOpacity:0})]}),e[48]=X):X=e[48];let Z;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,Y.jsxs)(`defs`,{children:[X,(0,Y.jsxs)(`linearGradient`,{id:`gHeap`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`5%`,stopColor:`#8b5cf6`,stopOpacity:.3}),(0,Y.jsx)(`stop`,{offset:`95%`,stopColor:`#8b5cf6`,stopOpacity:0})]})]}),e[49]=Z):Z=e[49];let be;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Y.jsx)(i,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9},interval:`preserveStartEnd`}),e[50]=be):be=e[50];let xe,Q,$;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Y.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9}}),Q=(0,Y.jsx)(t,{type:`monotone`,dataKey:`msgs`,stroke:`#22c55e`,strokeWidth:2,fillOpacity:1,fill:`url(#gMsgs)`,name:`Mensajes`}),$=(0,Y.jsx)(t,{type:`monotone`,dataKey:`rss`,stroke:`#8b5cf6`,strokeWidth:2,fillOpacity:1,fill:`url(#gHeap)`,name:`RSS MB`}),e[51]=xe,e[52]=Q,e[53]=$):(xe=e[51],Q=e[52],$=e[53]);let Se;e[54]===n?Se=e[55]:(Se=(0,Y.jsxs)(ue,{className:`border-primary/10`,children:[ge,(0,Y.jsx)(ce,{className:`h-[160px]`,children:(0,Y.jsx)(a,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(u,{data:n,children:[Z,be,xe,Q,$]})})})]}),e[54]=n,e[55]=Se);let Ce;return e[56]!==K||e[57]!==Se?(Ce=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 mb-4`,children:[K,Se]}),e[56]=K,e[57]=Se,e[58]=Ce):Ce=e[58],Ce}function _e(){return M(`/api/system-stats`)}function ve(){let e=new Date;return Array.from({length:12},(t,n)=>({time:new Date(e.getTime()-(11-n)*5e3).toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),msgs:0,rss:0}))}function ye(e){let t=(0,pe.c)(31),{icon:n,label:r,value:i,subValue:a,color:o,progress:s}=e,c;t[0]===o?c=t[1]:(c={color:o},t[0]=o,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Y.jsx)(n,{className:`h-4 w-4`}),t[2]=n,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,Y.jsx)(`span`,{style:c,children:l}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Y.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:r}),t[7]=r,t[8]=d);let f;t[9]!==u||t[10]!==d?(f=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11];let p;t[12]===o?p=t[13]:(p={color:o},t[12]=o,t[13]=p);let m;t[14]!==p||t[15]!==i?(m=(0,Y.jsx)(`span`,{className:`text-lg font-bold font-mono`,style:p,children:i}),t[14]=p,t[15]=i,t[16]=m):m=t[16];let h;t[17]!==f||t[18]!==m?(h=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[f,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19];let g=`${Math.min(s,100)}%`,_;t[20]!==o||t[21]!==g?(_=(0,Y.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-muted overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:g,backgroundColor:o}})}),t[20]=o,t[21]=g,t[22]=_):_=t[22];let v;t[23]===a?v=t[24]:(v=(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a}),t[23]=a,t[24]=v);let y;t[25]!==_||t[26]!==v?(y=(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[_,v]}),t[25]=_,t[26]=v,t[27]=y):y=t[27];let b;return t[28]!==y||t[29]!==h?(b=(0,Y.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3 space-y-2`,children:[h,y]}),t[28]=y,t[29]=h,t[30]=b):b=t[30],b}function X(e){let t=Math.abs(e),n=e<0?`−`:``;return t>=1e6?`${n}${(t/1e6).toFixed(2)}M`:t>=1e3?`${n}${(t/1e3).toFixed(1)}K`:`${n}${Math.round(t)}`}function Z(e){let t=Math.abs(e),n=e<0?`−`:``;return t>=1?`${n}$${t.toFixed(2)}`:t>=.01?`${n}$${t.toFixed(3)}`:t>0?`${n}$${t.toFixed(5)}`:`$0.00`}function be(e){let t=(0,pe.c)(58),{jev:n}=e,{agents:r}=N(),i;t[0]===r?i=t[1]:(i=e=>r.find(t=>t.id===e)?.name??e,t[0]=r,t[1]=i);let a=i,o=!!n&&n.decisions>0,s=n?n.savedCostUsd-n.costUsd:0,c=n&&n.costUsd>0&&n.savedCostUsd>0?n.savedCostUsd/n.costUsd:null,l=!!n&&n.savedTokens>0&&n.savedCostUsd===0,u,d,f,p;if(t[2]!==o||t[3]!==n||t[4]!==a||t[5]!==s||t[6]!==c){let e=n?Object.entries(n.byAgent).sort(xe).slice(0,5):[];u=`rounded-lg border p-3 ${o?`border-violet-500/30 bg-violet-500/5`:`bg-card/50`}`;let r=`h-3 w-3 ${o?`text-violet-400`:``}`,i;t[11]===r?i=t[12]:(i=(0,Y.jsx)(x,{className:r}),t[11]=r,t[12]=i);let l;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(`span`,{className:`font-medium`,children:`Jev · Plano de decisión`}),t[13]=l):l=t[13];let m;t[14]===i?m=t[15]:(m=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[i,l]}),t[14]=i,t[15]=m);let h;t[16]===c?h=t[17]:(h=c!==null&&(0,Y.jsxs)(`span`,{className:`text-xs font-bold text-violet-300`,children:[`ahorra `,c>=10?Math.round(c):c.toFixed(1),`× lo que cuesta`]}),t[16]=c,t[17]=h),t[18]!==h||t[19]!==m?(d=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,h]}),t[18]=h,t[19]=m,t[20]=d):d=t[20];let g;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Decisiones`}),t[21]=g):g=t[21];let _=`text-lg font-bold ${o?`text-violet-300`:`text-muted-foreground`}`,v;t[22]===n?v=t[23]:(v=n?n.decisions.toLocaleString(`es`):`—`,t[22]=n,t[23]=v);let y;t[24]!==_||t[25]!==v?(y=(0,Y.jsxs)(`div`,{className:`bg-violet-500/5 rounded-md p-2`,children:[g,(0,Y.jsx)(`div`,{className:_,children:v})]}),t[24]=_,t[25]=v,t[26]=y):y=t[26];let b;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Costo Jev`}),t[27]=b):b=t[27];let S;t[28]===n?S=t[29]:(S=n?Z(n.costUsd):`—`,t[28]=n,t[29]=S);let C;t[30]===S?C=t[31]:(C=(0,Y.jsxs)(`div`,{className:`bg-violet-500/5 rounded-md p-2`,children:[b,(0,Y.jsx)(`div`,{className:`text-lg font-bold text-violet-300`,children:S})]}),t[30]=S,t[31]=C);let w;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Tokens ahorrados (modelo principal)`}),t[32]=w):w=t[32];let T=`text-lg font-bold ${n&&n.savedTokens<0?`text-amber-400`:`text-emerald-400`}`,E;t[33]===n?E=t[34]:(E=n?`~${X(n.savedTokens)}`:`—`,t[33]=n,t[34]=E);let D;t[35]!==T||t[36]!==E?(D=(0,Y.jsxs)(`div`,{className:`bg-violet-500/5 rounded-md p-2`,children:[w,(0,Y.jsx)(`div`,{className:T,children:E})]}),t[35]=T,t[36]=E,t[37]=D):D=t[37];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Ahorro neto estimado`}),t[38]=O):O=t[38];let k=`text-lg font-bold ${s<0?`text-amber-400`:`text-emerald-400`}`,A;t[39]!==n||t[40]!==s?(A=n?Z(s):`—`,t[39]=n,t[40]=s,t[41]=A):A=t[41];let j;t[42]!==k||t[43]!==A?(j=(0,Y.jsxs)(`div`,{className:`bg-violet-500/5 rounded-md p-2`,children:[O,(0,Y.jsx)(`div`,{className:k,children:A})]}),t[42]=k,t[43]=A,t[44]=j):j=t[44],t[45]!==y||t[46]!==C||t[47]!==D||t[48]!==j?(f=(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 md:grid-cols-4 gap-3`,children:[y,C,D,j]}),t[45]=y,t[46]=C,t[47]=D,t[48]=j,t[49]=f):f=t[49],p=e.length>0&&(0,Y.jsx)(`div`,{className:`mt-3 pt-3 border-t border-violet-500/20`,children:(0,Y.jsx)(`div`,{className:`rounded-md border border-violet-500/10 overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Y.jsx)(`thead`,{className:`bg-violet-500/5 text-muted-foreground`,children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`text-left p-1.5 font-medium`,children:`Agente`}),(0,Y.jsx)(`th`,{className:`text-right p-1.5 font-medium`,children:`Decisiones`}),(0,Y.jsx)(`th`,{className:`text-right p-1.5 font-medium`,children:`Tokens ahorrados`}),(0,Y.jsx)(`th`,{className:`text-right p-1.5 font-medium`,children:`Ahorro`}),(0,Y.jsx)(`th`,{className:`text-right p-1.5 font-medium`,children:`Costo Jev`})]})}),(0,Y.jsx)(`tbody`,{children:e.map(e=>{let[t,n]=e;return(0,Y.jsxs)(`tr`,{className:`border-t border-violet-500/10`,children:[(0,Y.jsx)(`td`,{className:`p-1.5 font-medium truncate max-w-10rem`,children:a(t)}),(0,Y.jsx)(`td`,{className:`p-1.5 text-right`,children:n.decisions}),(0,Y.jsx)(`td`,{className:`p-1.5 text-right ${n.savedTokens<0?`text-amber-400`:`text-emerald-400`}`,children:X(n.savedTokens)}),(0,Y.jsx)(`td`,{className:`p-1.5 text-right`,children:Z(n.savedCostUsd)}),(0,Y.jsx)(`td`,{className:`p-1.5 text-right text-violet-300`,children:Z(n.costUsd)})]},t)})})]})})}),t[2]=o,t[3]=n,t[4]=a,t[5]=s,t[6]=c,t[7]=u,t[8]=d,t[9]=f,t[10]=p}else u=t[7],d=t[8],f=t[9],p=t[10];let m=o?l?`El modelo principal no tiene tarifa en el catálogo: los tokens ahorrados se valoran en $0.`:`Estimación frente al flujo clásico (caracteres ÷ 4), con la tarifa de entrada del modelo de cada agente.`:`Sin decisiones de Jev en este período. Se activa al guardar una clave de OpenRouter.`,h;t[50]===m?h=t[51]:(h=(0,Y.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground italic`,children:m}),t[50]=m,t[51]=h);let g;return t[52]!==u||t[53]!==d||t[54]!==f||t[55]!==p||t[56]!==h?(g=(0,Y.jsxs)(`div`,{className:u,children:[d,f,p,h]}),t[52]=u,t[53]=d,t[54]=f,t[55]=p,t[56]=h,t[57]=g):g=t[57],g}function xe(e,t){let[,n]=e,[,r]=t;return r.savedTokens-n.savedTokens}var Q={anthropic:`#d97706`,openai:`#10b981`,google:`#3b82f6`,gemini:`#3b82f6`,deepseek:`#8b5cf6`,kimi:`#ec4899`,ollama:`#14b8a6`,openrouter:`#f59e0b`,mistral:`#6366f1`};function $(e){return e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:e.toString()}function Se(e){return e>=1?`$`+e.toFixed(2):e>=.01?`$`+e.toFixed(3):e>0?`$`+e.toFixed(5):`$0.00`}function Ce(e){return e>=10?e.toFixed(1)+`%`:e>=1?e.toFixed(2)+`%`:e>0?e.toFixed(3)+`%`:`0%`}function we(){let e=(0,pe.c)(72),[t,n]=(0,me.useState)(24),r;e[0]===t?r=e[1]:(r={queryKey:[`usage-stats`,t],queryFn:async()=>await M(`/api/usage-stats?hours=${t}`),refetchInterval:6e4},e[0]=t,e[1]=r);let{data:s,isLoading:u}=m(r);if(u&&!s){let t;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(W,{children:(0,Y.jsxs)(se,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(G,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]})}),e[2]=t):t=e[2];let n;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsxs)(ue,{className:`border-primary/10`,children:[t,(0,Y.jsx)(ce,{children:(0,Y.jsx)(`div`,{className:`h-40 flex items-center justify-center text-muted-foreground animate-pulse`,children:`Cargando estadísticas de uso...`})})]}),e[3]=n):n=e[3],n}let f=s&&(s.totalTokens>0||s.totalCostUsd>0),p;e[4]===s?p=e[5]:(p=s?Object.entries(s.byProvider).map(je):[],e[4]=s,e[5]=p);let h=p,g;e[6]===s?g=e[7]:(g=s?Object.entries(s.byModel).slice(0,8).map(Ae):[],e[6]=s,e[7]=g);let _=g,y;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(se,{className:`text-base flex items-center gap-2`,children:[(0,Y.jsx)(G,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]}),(0,Y.jsx)(le,{children:`Tokens consumidos y costos por provider/modelo`})]}),e[8]=y):y=e[8];let b;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=[6,24,168],e[9]=b):b=e[9];let x;e[10]===t?x=e[11]:(x=(0,Y.jsx)(W,{className:`pb-2`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[y,(0,Y.jsx)(`div`,{className:`flex gap-1`,children:b.map(e=>(0,Y.jsx)(`button`,{onClick:()=>n(e),className:`px-2 py-1 text-xs rounded-md transition-colors ${t===e?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`}`,children:e===6?`6h`:e===24?`24h`:`7d`},e))})]})}),e[10]=t,e[11]=x);let S=`rounded-lg border p-3 ${s?.toonSavedTokens?`border-emerald-500/30 bg-emerald-500/5`:`bg-card/50`}`,C=`h-3 w-3 ${s?.toonSavedTokens?`text-emerald-400`:``}`,w;e[12]===C?w=e[13]:(w=(0,Y.jsx)(D,{className:C}),e[12]=C,e[13]=w);let T;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Y.jsx)(`span`,{className:`font-medium`,children:`TOON Optimización de Tokens`}),e[14]=T):T=e[14];let E;e[15]===w?E=e[16]:(E=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[w,T]}),e[15]=w,e[16]=E);let O;e[17]===s?O=e[18]:(O=s?.toonSavingsPercent&&s.toonSavingsPercent>0?(0,Y.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[Ce(s.toonSavingsPercent),` reducción`]}):null,e[17]=s,e[18]=O);let k;e[19]!==E||e[20]!==O?(k=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[E,O]}),e[19]=E,e[20]=O,e[21]=k):k=e[21];let A;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Tokens Ahorrados`}),e[22]=A):A=e[22];let j=`text-lg font-bold ${s?.toonSavedTokens?`text-emerald-400`:`text-muted-foreground`}`,ee;e[23]===s?ee=e[24]:(ee=s?$(s.toonSavedTokens):`—`,e[23]=s,e[24]=ee);let N;e[25]!==j||e[26]!==ee?(N=(0,Y.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[A,(0,Y.jsx)(`div`,{className:j,children:ee})]}),e[25]=j,e[26]=ee,e[27]=N):N=e[27];let te;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Costo Ahorrado`}),e[28]=te):te=e[28];let ne;e[29]===s?ne=e[30]:(ne=s?Se(s.toonSavedCost):`—`,e[29]=s,e[30]=ne);let P;e[31]===ne?P=e[32]:(P=(0,Y.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[te,(0,Y.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:ne})]}),e[31]=ne,e[32]=P);let re;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Bytes Ahorrados`}),e[33]=re):re=e[33];let F;e[34]===s?F=e[35]:(F=s&&s.toonSavedBytes>0?$(s.toonSavedBytes):`—`,e[34]=s,e[35]=F);let I;e[36]===F?I=e[37]:(I=(0,Y.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[re,(0,Y.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:F})]}),e[36]=F,e[37]=I);let ie;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Reducción Bytes`}),e[38]=ie):ie=e[38];let L;e[39]===s?L=e[40]:(L=s?.toonSavedBytesPercent&&s.toonSavedBytesPercent>0?Ce(s.toonSavedBytesPercent):`—`,e[39]=s,e[40]=L);let R;e[41]===L?R=e[42]:(R=(0,Y.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[ie,(0,Y.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:L})]}),e[41]=L,e[42]=R);let z;e[43]!==N||e[44]!==P||e[45]!==I||e[46]!==R?(z=(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 md:grid-cols-4 gap-3`,children:[N,P,I,R]}),e[43]=N,e[44]=P,e[45]=I,e[46]=R,e[47]=z):z=e[47];let B;e[48]===s?B=e[49]:(B=s&&(s.toonJsonTokens>0||s.toonToonTokens>0)&&(0,Y.jsx)(`div`,{className:`mt-3 pt-3 border-t border-emerald-500/20`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`JSON:`}),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:s.toonJsonTokens>0?$(s.toonJsonTokens):`—`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-emerald-400`,children:`TOON:`}),` `,(0,Y.jsx)(`span`,{className:`font-medium text-emerald-400`,children:s.toonToonTokens>0?$(s.toonToonTokens):`—`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]})]}),s?.toonSavingsPercent&&s.toonSavingsPercent>0?(0,Y.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[Ce(s.toonSavingsPercent),` menos tokens`]}):null]})}),e[48]=s,e[49]=B);let V;e[50]===s?V=e[51]:(V=s&&!s.toonSavedTokens&&(0,Y.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground italic`,children:`Sin optimizaciones TOON registradas aún`}),e[50]=s,e[51]=V);let H;e[52]!==k||e[53]!==z||e[54]!==B||e[55]!==V||e[56]!==S?(H=(0,Y.jsxs)(`div`,{className:S,children:[k,z,B,V]}),e[52]=k,e[53]=z,e[54]=B,e[55]=V,e[56]=S,e[57]=H):H=e[57];let U=s?.jev,de;e[58]===U?de=e[59]:(de=(0,Y.jsx)(be,{jev:U}),e[58]=U,e[59]=de);let q;e[60]!==f||e[61]!==_||e[62]!==h||e[63]!==s?(q=f?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,Y.jsx)(G,{className:`h-3 w-3`}),`Costo Total`]}),(0,Y.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:Se(s.totalCostUsd)})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,Y.jsx)(K,{className:`h-3 w-3`}),`Total Tokens`]}),(0,Y.jsx)(`div`,{className:`text-2xl font-bold`,children:$(s.totalTokens)})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,Y.jsx)(fe,{className:`h-3 w-3`}),`Input / Output`]}),(0,Y.jsxs)(`div`,{className:`text-lg font-semibold`,children:[(0,Y.jsx)(`span`,{className:`text-blue-500`,children:$(s.totalInputTokens)}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,Y.jsx)(`span`,{className:`text-purple-500`,children:$(s.totalOutputTokens)})]})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,Y.jsx)(oe,{className:`h-3 w-3`}),`Providers`]}),(0,Y.jsx)(`div`,{className:`text-2xl font-bold`,children:Object.keys(s.byProvider).length})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,Y.jsx)(oe,{className:`h-4 w-4 text-muted-foreground`}),`Por Provider`]}),(0,Y.jsx)(`div`,{className:`h-180px`,children:(0,Y.jsx)(a,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(o,{data:h,layout:`vertical`,children:[(0,Y.jsx)(i,{type:`number`,hide:!0}),(0,Y.jsx)(c,{type:`category`,dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:11},width:70}),(0,Y.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:ke}),(0,Y.jsx)(l,{dataKey:`value`,radius:[0,4,4,0],barSize:16,children:h.map(Oe)})]})})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,Y.jsx)(ae,{className:`h-4 w-4 text-muted-foreground`}),`Por Modelo (Top 8)`]}),(0,Y.jsx)(`div`,{className:`h-180px`,children:(0,Y.jsx)(a,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(o,{data:_,children:[(0,Y.jsx)(i,{dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10},angle:-45,textAnchor:`end`,height:60}),(0,Y.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10}}),(0,Y.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:De,labelFormatter:e=>_.find(t=>t.name===e)?.fullName||e}),(0,Y.jsx)(l,{dataKey:`cost`,radius:[4,4,0,0],children:_.map(Ee)})]})})})]})]}),h.length>0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium mb-2`,children:`Detalle por Provider`}),(0,Y.jsx)(`div`,{className:`rounded-lg border overflow-hidden`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{className:`bg-muted/50`,children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`text-left p-2 font-medium`,children:`Provider`}),(0,Y.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Input`}),(0,Y.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Output`}),(0,Y.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Total`}),(0,Y.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Costo`})]})}),(0,Y.jsx)(`tbody`,{children:Object.entries(s.byProvider).map(Te)})]})})]})]}):(0,Y.jsx)(`div`,{className:`h-32 flex items-center justify-center text-muted-foreground`,children:(0,Y.jsxs)(`div`,{className:`text-center`,children:[(0,Y.jsx)(v,{className:`h-8 w-8 mx-auto mb-2 opacity-50`}),(0,Y.jsx)(`p`,{children:`No hay datos de uso aún`}),(0,Y.jsx)(`p`,{className:`text-xs`,children:`Los tokens se registrarán automáticamente`})]})}),e[60]=f,e[61]=_,e[62]=h,e[63]=s,e[64]=q):q=e[64];let J;e[65]!==H||e[66]!==de||e[67]!==q?(J=(0,Y.jsxs)(ce,{className:`space-y-4`,children:[H,de,q]}),e[65]=H,e[66]=de,e[67]=q,e[68]=J):J=e[68];let he;return e[69]!==J||e[70]!==x?(he=(0,Y.jsxs)(ue,{className:`border-primary/10`,children:[x,J]}),e[69]=J,e[70]=x,e[71]=he):he=e[71],he}function Te(e){let[t,n]=e;return(0,Y.jsxs)(`tr`,{className:`border-t`,children:[(0,Y.jsx)(`td`,{className:`p-2 font-medium`,children:t}),(0,Y.jsx)(`td`,{className:`p-2 text-right text-blue-500`,children:$(n.inputTokens)}),(0,Y.jsx)(`td`,{className:`p-2 text-right text-purple-500`,children:$(n.outputTokens)}),(0,Y.jsx)(`td`,{className:`p-2 text-right`,children:$(n.tokens)}),(0,Y.jsx)(`td`,{className:`p-2 text-right font-medium text-green-500`,children:Se(n.costUsd)})]},t)}function Ee(e){return(0,Y.jsx)(n,{fill:Q[e.fullName.split(`-`)[0]?.toLowerCase()]||`#6b7280`},e.fullName)}function De(e){return Se(e)}function Oe(e){return(0,Y.jsx)(n,{fill:e.color},e.name)}function ke(e,t){return[t===`cost`?Se(e):$(e),t===`cost`?`Costo`:`Tokens`]}function Ae(e){let[t,n]=e;return{name:t.length>20?t.slice(0,18)+`...`:t,tokens:n.tokens,cost:n.costUsd,fullName:t}}function je(e){let[t,n]=e;return{name:t.charAt(0).toUpperCase()+t.slice(1),value:n.tokens,cost:n.costUsd,color:Q[t.toLowerCase()]||`#6b7280`}}function Me(){let e=(0,pe.c)(77),[t,n]=(0,me.useState)(!1),[r,i]=(0,me.useState)(0),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],e[0]=a):a=e[0];let[o,s]=(0,me.useState)(a),c=p(),l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={queryKey:[`version-check`],queryFn:Ie,refetchInterval:3e5,retry:2},e[1]=l):l=e[1];let{data:u}=m(l),d;e[2]===c?d=e[3]:(d=e=>{i(100),e.success?(s(e.instructions||[]),O.fire({title:`¡Actualización Completada!`,text:e.message||`Hive ha sido actualizado exitosamente.`,icon:`success`,confirmButtonText:`Continuar`})):(e.instructions&&s(e.instructions),O.fire({title:`Información de Actualización`,html:`
|
|
2
|
-
<div class="text-left space-y-2">
|
|
3
|
-
${e.error?`<p class="mb-2">${e.error}</p>`:``}
|
|
4
|
-
${e.output?`<pre class="bg-muted p-2 rounded text-xs overflow-auto max-h-40">${e.output}</pre>`:``}
|
|
5
|
-
</div>
|
|
6
|
-
`,icon:e.instructions?`info`:`error`,confirmButtonText:`Entendido`})),setTimeout(()=>{c.invalidateQueries({queryKey:[`version-check`]})},2e3)},e[2]=c,e[3]=d);let f;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{i(0),console.error(`[UpdateChecker] Error:`,e)},e[4]=f):f=e[4];let h;e[5]===d?h=e[6]:(h={mutationFn:Fe,onSuccess:d,onError:f},e[5]=d,e[6]=h);let _=g(h),v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{n(!0)},e[7]=v):v=e[7];let y=v,x;e[8]===_?x=e[9]:(x=()=>{n(!1),i(10),_.mutate();let e=setInterval(()=>{i(t=>t>=90?(clearInterval(e),t):t+10)},500)},e[8]=_,e[9]=x);let S=x,T=Pe,D;e[10]===u?D=e[11]:(D=()=>{if(!u)return null;switch(u.status){case`up-to-date`:return(0,Y.jsxs)(U,{variant:`outline`,className:`flex items-center gap-1 bg-green-500/10 text-green-400 border-green-500/20`,children:[(0,Y.jsx)(b,{className:`h-3 w-3`}),`Actualizado`]});case`update-available`:return(0,Y.jsxs)(U,{className:`flex items-center gap-1 bg-blue-500 text-white border-blue-400 hover:bg-blue-600`,children:[(0,Y.jsx)(ne,{className:`h-3 w-3`}),`v`,u.latest,` disponible`]});case`checking`:return(0,Y.jsxs)(U,{variant:`outline`,className:`flex items-center gap-1`,children:[(0,Y.jsx)(V,{className:`h-3 w-3 animate-spin`}),`Verificando...`]});case`error`:return(0,Y.jsxs)(U,{variant:`destructive`,className:`flex items-center gap-1`,children:[(0,Y.jsx)(ee,{className:`h-3 w-3`}),`Error`]})}},e[10]=u,e[11]=D);let A=D,j=u?.status===`update-available`,M;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(`span`,{className:`hive-label mb-1`,children:`Versión`}),e[12]=M):M=e[12];let N;e[13]===A?N=e[14]:(N=A(),e[13]=A,e[14]=N);let ie;e[15]===u?ie=e[16]:(ie=u&&(0,Y.jsxs)(`span`,{className:`text-xs text-white/40 font-mono`,children:[`v`,u.current,` · `,T(u.installationType)]}),e[15]=u,e[16]=ie);let ae;e[17]!==ie||e[18]!==N?(ae=(0,Y.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[M,(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N,ie]})]}),e[17]=ie,e[18]=N,e[19]=ae):ae=e[19];let z;e[20]!==j||e[21]!==_.isPending||e[22]!==u?(z=j&&(0,Y.jsx)(k,{size:`sm`,onClick:y,disabled:_.isPending,className:`bg-blue-600 hover:bg-blue-700 text-white shadow-lg shadow-blue-500/20`,children:_.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{className:`h-4 w-4 mr-2 animate-spin`}),`Actualizando...`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(C,{className:`h-4 w-4 mr-2`}),`Actualizar a v`,u.latest]})}),e[20]=j,e[21]=_.isPending,e[22]=u,e[23]=z):z=e[23];let oe;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Y.jsxs)(F,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(C,{className:`h-5 w-5 text-blue-500`}),`Actualizar Hive`]}),e[24]=oe):oe=e[24];let se=u?.latest,W;e[25]===se?W=e[26]:(W=(0,Y.jsxs)(`strong`,{children:[`v`,se]}),e[25]=se,e[26]=W);let ce=u?.current,le;e[27]===ce?le=e[28]:(le=(0,Y.jsxs)(`strong`,{children:[`v`,ce]}),e[27]=ce,e[28]=le);let ue;e[29]!==W||e[30]!==le?(ue=(0,Y.jsxs)(`p`,{children:[`Se ha detectado una nueva versión disponible (`,W,`). Tu versión actual es `,le,`.`]}),e[29]=W,e[30]=le,e[31]=ue):ue=e[31];let G;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Y.jsx)(E,{className:`h-4 w-4 text-blue-500 mt-0.5`}),e[32]=G):G=e[32];let de=T(u?.installationType),K;e[33]===de?K=e[34]:(K=(0,Y.jsxs)(`p`,{className:`font-semibold mb-1`,children:[`Tipo de instalación: `,de]}),e[33]=de,e[34]=K);let q;e[35]===u?.installationType?q=e[36]:(q=u?.installationType===`docker`&&(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`Para Docker, deberás ejecutar manualmente los comandos en tu terminal.`}),e[35]=u?.installationType,e[36]=q);let fe;e[37]===u?.installationType?fe=e[38]:(fe=u?.installationType===`binary`&&(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`Para el binario, serás redirigido a GitHub Releases para descargar la nueva versión.`}),e[37]=u?.installationType,e[38]=fe);let J;e[39]===u?.installationType?J=e[40]:(J=(u?.installationType===`npm`||u?.installationType===`bun`)&&(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`La actualización se realizará automáticamente. Deberás reiniciar el gateway después.`}),e[39]=u?.installationType,e[40]=J);let he;e[41]!==K||e[42]!==q||e[43]!==fe||e[44]!==J?(he=(0,Y.jsx)(`div`,{className:`bg-muted p-3 rounded-lg space-y-2`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[G,(0,Y.jsxs)(`div`,{className:`text-sm`,children:[K,q,fe,J]})]})}),e[41]=K,e[42]=q,e[43]=fe,e[44]=J,e[45]=he):he=e[45];let ge;e[46]!==_.isPending||e[47]!==r?(ge=_.isPending&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,Y.jsx)(`span`,{children:`Progreso de actualización...`}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[r,`%`]})]}),(0,Y.jsx)(te,{value:r,className:`h-2`})]}),e[46]=_.isPending,e[47]=r,e[48]=ge):ge=e[48];let _e;e[49]!==ue||e[50]!==he||e[51]!==ge?(_e=(0,Y.jsxs)(I,{children:[oe,(0,Y.jsxs)(B,{className:`space-y-3`,children:[ue,he,ge]})]}),e[49]=ue,e[50]=he,e[51]=ge,e[52]=_e):_e=e[52];let ve;e[53]===_.isPending?ve=e[54]:(ve=(0,Y.jsx)(P,{disabled:_.isPending,children:`Cancelar`}),e[53]=_.isPending,e[54]=ve);let ye;e[55]===_.isPending?ye=e[56]:(ye=_.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{className:`h-4 w-4 mr-2 animate-spin`}),`Actualizando...`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(C,{className:`h-4 w-4 mr-2`}),`Confirmar actualización`]}),e[55]=_.isPending,e[56]=ye);let X;e[57]!==S||e[58]!==ye||e[59]!==_.isPending?(X=(0,Y.jsx)(H,{onClick:S,disabled:_.isPending,className:`bg-blue-600 hover:bg-blue-700`,children:ye}),e[57]=S,e[58]=ye,e[59]=_.isPending,e[60]=X):X=e[60];let Z;e[61]!==ve||e[62]!==X?(Z=(0,Y.jsxs)(R,{children:[ve,X]}),e[61]=ve,e[62]=X,e[63]=Z):Z=e[63];let be;e[64]!==_e||e[65]!==Z?(be=(0,Y.jsxs)(re,{children:[_e,Z]}),e[64]=_e,e[65]=Z,e[66]=be):be=e[66];let xe;e[67]!==t||e[68]!==be?(xe=(0,Y.jsx)(L,{open:t,onOpenChange:n,children:be}),e[67]=t,e[68]=be,e[69]=xe):xe=e[69];let Q;e[70]===o?Q=e[71]:(Q=o.length>0&&(0,Y.jsx)(L,{open:!0,onOpenChange:()=>s([]),children:(0,Y.jsxs)(re,{children:[(0,Y.jsxs)(I,{children:[(0,Y.jsx)(F,{children:`Instrucciones de Actualización`}),(0,Y.jsxs)(B,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{children:`Sigue estos pasos para completar la actualización:`}),(0,Y.jsx)(`ol`,{className:`list-decimal list-inside space-y-2 bg-muted p-4 rounded-lg`,children:o.map(Ne)}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(w,{className:`h-4 w-4 mt-0.5`}),(0,Y.jsx)(`p`,{children:`Después de completar los pasos, recarga esta página para ver la nueva versión.`})]})]})]}),(0,Y.jsx)(R,{children:(0,Y.jsx)(H,{children:`Entendido`})})]})}),e[70]=o,e[71]=Q);let $;return e[72]!==ae||e[73]!==z||e[74]!==xe||e[75]!==Q?($=(0,Y.jsxs)(Y.Fragment,{children:[ae,z,xe,Q]}),e[72]=ae,e[73]=z,e[74]=xe,e[75]=Q,e[76]=$):$=e[76],$}function Ne(e,t){return(0,Y.jsx)(`li`,{className:`text-sm`,children:e},t)}function Pe(e){switch(e){case`docker`:return`Docker`;case`binary`:return`Binario`;case`npm`:return`npm`;case`bun`:return`Bun`;default:return`Desconocida`}}function Fe(){return M(`/api/update`,{method:`POST`,showLoader:`Actualizando Hive...`})}function Ie(){return M(`/api/version`)}function Le(e){let t=(0,pe.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,Y.jsx)(n,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Re={"harmful_count exceeded helpful_count":`más resultados dañinos que útiles en sus verificaciones`};function ze(e){return e?Re[e]??e:`revisión pendiente`}function Be(){let e=(0,pe.c)(106),{status:n}=A(),{allAgents:r}=J(),f=j(nt),p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={queryKey:[`system-stats`],queryFn:tt,refetchInterval:5e3},e[0]=p):p=e[0];let{data:h}=m(p),g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={queryKey:[`activity-stats`],queryFn:et,refetchInterval:6e4},e[1]=g):g=e[1];let{data:_}=m(g),y;e[2]===_?y=e[3]:(y=_===void 0?[]:_,e[2]=_,e[3]=y);let b=y,x;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(x={queryKey:[`agent-proposals`],queryFn:Qe,refetchInterval:3e4},e[4]=x):x=e[4];let{data:C}=m(x),w;e[5]===C?w=e[6]:(w=C===void 0?[]:C,e[5]=C,e[6]=w);let T=w,E;e[7]===r?E=e[8]:(E=r||[],e[7]=r,e[8]=E);let D=E,O;e[9]===D?O=e[10]:(O=D.filter(Ze),e[9]=D,e[10]=O);let{desks:k}=S(O,f),M;e[11]===k?M=e[12]:(M=k.filter(Xe),e[11]=k,e[12]=M);let ee=M.length,N=`${ee} trabajando`,te;e[13]!==D.length||e[14]!==N?(te={label:`Agentes Activos`,value:D.length,icon:ae,color:`text-blue-500`,trend:N},e[13]=D.length,e[14]=N,e[15]=te):te=e[15];let ne=h?.connections??0,P;e[16]===ne?P=e[17]:(P={label:`Sesiones Canvas`,value:ne,icon:ie,color:`text-orange-500`,trend:`Live`},e[16]=ne,e[17]=P);let re;e[18]===b?re=e[19]:(re=b.at(-1)?.count??0,e[18]=b,e[19]=re);let F;e[20]===re?F=e[21]:(F={label:`Mensajes / 1h`,value:re,icon:v,color:`text-green-500`,trend:`Última hora`},e[20]=re,e[21]=F);let I;e[22]!==te||e[23]!==P||e[24]!==F?(I=[te,P,F],e[22]=te,e[23]=P,e[24]=F,e[25]=I):I=e[25];let L=I,R;e[26]===k?R=e[27]:(R=k.filter(Ye),e[26]=k,e[27]=R);let z=R.length,B;e[28]===k?B=e[29]:(B=k.filter(Je),e[28]=k,e[29]=B);let V=B.length,oe;e[30]===k?oe=e[31]:(oe=k.filter(qe),e[30]=k,e[31]=oe);let H=oe.length,U;e[32]===z?U=e[33]:(U={name:`Idle`,value:z,color:`hsl(var(--muted))`},e[32]=z,e[33]=U);let se;e[34]===ee?se=e[35]:(se={name:`Trabajando`,value:ee,color:`hsl(var(--primary))`},e[34]=ee,e[35]=se);let W;e[36]===V?W=e[37]:(W=V>0?[{name:`Atascado`,value:V,color:`#ef4444`}]:[],e[36]=V,e[37]=W);let ce;e[38]===H?ce=e[39]:(ce=H>0?[{name:`Deshabilitado`,value:H,color:`hsl(var(--muted-foreground))`}]:[],e[38]=H,e[39]=ce);let le;e[40]!==U||e[41]!==se||e[42]!==W||e[43]!==ce?(le=[U,se,...W,...ce].filter(Ke),e[40]=U,e[41]=se,e[42]=W,e[43]=ce,e[44]=le):le=e[44];let ue=le,G;e[45]===b?G=e[46]:(G=b.reduce(Ge,0),e[45]=b,e[46]=G);let de=G,K;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Y.jsx)(`div`,{className:`hidden h-24 w-24 shrink-0 items-center justify-center rounded-2xl border border-white/10 bg-white/[0.03] p-2 shadow-[0_0_30px_rgba(59,130,246,0.12)] sm:flex`,children:(0,Y.jsx)(`img`,{src:`/logocolor-dark.png`,alt:`Logo de Hive`,className:`h-full w-full object-contain`})}),e[47]=K):K=e[47];let q;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Y.jsxs)(`div`,{className:`hive-page-header__eyebrow`,children:[(0,Y.jsx)(`div`,{className:`hive-page-header__dot`}),(0,Y.jsx)(`span`,{className:`hive-page-header__label`,children:`SISTEMA OPERATIVO HIVE`})]}),e[48]=q):q=e[48];let fe;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Y.jsxs)(`div`,{className:`relative z-10 flex items-center gap-4`,children:[K,(0,Y.jsxs)(`div`,{children:[q,(0,Y.jsxs)(`h2`,{className:`hive-title-page`,children:[`Centro de `,(0,Y.jsx)(`span`,{className:`hive-title-page__accent`,children:`Control`})]}),(0,Y.jsx)(`p`,{className:`hive-subtitle`,children:`Monitoreo en tiempo real del enjambre y estado de los nodos cognitivos.`})]})]}),e[49]=fe):fe=e[49];let me;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Y.jsx)(`span`,{className:`hive-label mb-1`,children:`Estado Hive`}),e[50]=me):me=e[50];let he=n===`connected`?`hive-status-dot--active`:`hive-status-dot--disabled`,_e;e[51]===he?_e=e[52]:(_e=(0,Y.jsx)(`div`,{className:he}),e[51]=he,e[52]=_e);let ve=n===`connected`?`hive-status-label--active`:`hive-status-label--disabled`,ye=n===`connected`?`EN LÍNEA`:`DESCONECTADO`,X;e[53]!==ve||e[54]!==ye?(X=(0,Y.jsx)(`span`,{className:ve,children:ye}),e[53]=ve,e[54]=ye,e[55]=X):X=e[55];let Z;e[56]!==_e||e[57]!==X?(Z=(0,Y.jsxs)(`div`,{className:`flex flex-col items-end`,children:[me,(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_e,X]})]}),e[56]=_e,e[57]=X,e[58]=Z):Z=e[58];let be,xe;e[59]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Y.jsx)(`div`,{className:`h-10 w-px bg-white/10 hidden sm:block`}),xe=(0,Y.jsx)(Me,{}),e[59]=be,e[60]=xe):(be=e[59],xe=e[60]);let Q;e[61]===Z?Q=e[62]:(Q=(0,Y.jsxs)(`div`,{className:`hive-page-header`,children:[fe,(0,Y.jsxs)(`div`,{className:`flex items-center gap-6 relative z-10`,children:[Z,be,xe]})]}),e[61]=Z,e[62]=Q);let $;e[63]===L?$=e[64]:($=(0,Y.jsx)(`div`,{className:`grid gap-6 sm:grid-cols-2 lg:grid-cols-3 mb-8`,children:L.map(We)}),e[63]=L,e[64]=$);let Se,Ce;e[65]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Y.jsx)(ge,{}),Ce=(0,Y.jsx)(we,{}),e[65]=Se,e[66]=Ce):(Se=e[65],Ce=e[66]);let Te;e[67]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Y.jsx)(`h3`,{className:`hive-title-section`,children:`Actividad del Enjambre`}),e[67]=Te):Te=e[67];let Ee;e[68]===de?Ee=e[69]:(Ee=(0,Y.jsxs)(`div`,{children:[Te,(0,Y.jsxs)(`p`,{className:`text-[10px] text-white/40 uppercase tracking-widest font-bold`,children:[`Últimas 12 horas · `,de,` mensajes`]})]}),e[68]=de,e[69]=Ee);let De;e[70]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Y.jsx)(v,{className:`h-5 w-5 text-blue-500 animate-pulse shadow-blue-glow`}),e[70]=De):De=e[70];let Oe;e[71]===Ee?Oe=e[72]:(Oe=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[Ee,De]}),e[71]=Ee,e[72]=Oe);let ke;e[73]===b?ke=e[74]:(ke=(0,Y.jsx)(`div`,{className:`h-[280px] w-full`,children:b.length>0?(0,Y.jsx)(a,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(u,{data:b,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{id:`colorCount`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.2}),(0,Y.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:0})]})}),(0,Y.jsx)(s,{strokeDasharray:`3 3`,vertical:!1,stroke:`rgba(255,255,255,0.05)`}),(0,Y.jsx)(i,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.3)`,fontSize:10,fontWeight:`bold`}}),(0,Y.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.3)`,fontSize:10,fontWeight:`bold`},allowDecimals:!1}),(0,Y.jsx)(d,{contentStyle:{backgroundColor:`#09090b`,borderRadius:`12px`,border:`1px solid rgba(255,255,255,0.1)`,color:`#fff`},itemStyle:{color:`#3b82f6`},formatter:Ue}),(0,Y.jsx)(t,{type:`monotone`,dataKey:`count`,stroke:`#3b82f6`,strokeWidth:4,fillOpacity:1,fill:`url(#colorCount)`})]})}):(0,Y.jsx)(`div`,{className:`h-full flex items-center justify-center text-white/30 text-sm`,children:`Cargando actividad...`})}),e[73]=b,e[74]=ke);let Ae;e[75]!==Oe||e[76]!==ke?(Ae=(0,Y.jsx)(`div`,{className:`lg:col-span-2 hive-card`,children:(0,Y.jsxs)(`div`,{className:`hive-card-body !pb-0`,children:[Oe,ke]})}),e[75]=Oe,e[76]=ke,e[77]=Ae):Ae=e[77];let je;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Y.jsx)(`h3`,{className:`hive-title-section mb-6`,children:`Salud del Enjambre`}),e[78]=je):je=e[78];let Ne;e[79]===ue?Ne=e[80]:(Ne=(0,Y.jsx)(`div`,{className:`h-[210px]`,children:ue.length>0?(0,Y.jsx)(a,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(o,{data:ue,layout:`vertical`,children:[(0,Y.jsx)(i,{type:`number`,hide:!0,allowDecimals:!1}),(0,Y.jsx)(c,{dataKey:`name`,type:`category`,axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.5)`,fontSize:10,fontWeight:`bold`},width:70}),(0,Y.jsx)(d,{cursor:{fill:`rgba(255,255,255,0.02)`}}),(0,Y.jsx)(l,{dataKey:`value`,radius:[0,8,8,0],barSize:16,children:ue.map(He)})]})}):(0,Y.jsx)(`div`,{className:`h-full flex items-center justify-center text-white/30 text-sm`,children:`Sin agentes configurados`})}),e[79]=ue,e[80]=Ne);let Pe;e[81]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Y.jsx)(`span`,{className:`hive-stat__label`,children:`Necesitan atención`}),e[81]=Pe):Pe=e[81];let Fe;e[82]===T.length?Fe=e[83]:(Fe=T.length>0?{color:`#ef4444`}:void 0,e[82]=T.length,e[83]=Fe);let Ie;e[84]!==T.length||e[85]!==Fe?(Ie=(0,Y.jsxs)(`div`,{className:`hive-stat`,children:[Pe,(0,Y.jsx)(`span`,{className:`hive-stat__value hive-stat__value--active`,style:Fe,children:T.length})]}),e[84]=T.length,e[85]=Fe,e[86]=Ie):Ie=e[86];let Le;e[87]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,Y.jsx)(`span`,{className:`hive-stat__label`,children:`Uptime`}),e[87]=Le):Le=e[87];let Re=h?.uptime??`—`,ze;e[88]===Re?ze=e[89]:(ze=(0,Y.jsxs)(`div`,{className:`hive-stat`,children:[Le,(0,Y.jsx)(`span`,{className:`hive-stat__value hive-stat__value--active`,children:Re})]}),e[88]=Re,e[89]=ze);let Be;e[90]!==Ie||e[91]!==ze?(Be=(0,Y.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-white/5 grid grid-cols-2 gap-4`,children:[Ie,ze]}),e[90]=Ie,e[91]=ze,e[92]=Be):Be=e[92];let $e;e[93]===T?$e=e[94]:($e=T.length>0&&(0,Y.jsx)(`div`,{className:`mt-3 pt-3 border-t border-white/5 space-y-1.5`,children:T.map(Ve)}),e[93]=T,e[94]=$e);let rt;e[95]!==Ne||e[96]!==Be||e[97]!==$e?(rt=(0,Y.jsx)(`div`,{className:`hive-card`,children:(0,Y.jsxs)(`div`,{className:`hive-card-body`,children:[je,Ne,Be,$e]})}),e[95]=Ne,e[96]=Be,e[97]=$e,e[98]=rt):rt=e[98];let it;e[99]!==Ae||e[100]!==rt?(it=(0,Y.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3 mb-8`,children:[Ae,rt]}),e[99]=Ae,e[100]=rt,e[101]=it):it=e[101];let at;return e[102]!==Q||e[103]!==$||e[104]!==it?(at=(0,Y.jsxs)(`div`,{className:`hive-page-container`,children:[Q,$,Se,Ce,it]}),e[102]=Q,e[103]=$,e[104]=it,e[105]=at):at=e[105],at}function Ve(e){return(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-[10px]`,title:e.reason??void 0,children:[(0,Y.jsx)(`span`,{className:`text-red-400`,children:`●`}),(0,Y.jsx)(`span`,{className:`text-white/70 font-bold truncate`,children:e.agentName}),(0,Y.jsxs)(`span`,{className:`text-white/30 truncate`,children:[`— `,ze(e.reason)]})]},e.id)}function He(e){return(0,Y.jsx)(n,{fill:e.color},e.name)}function Ue(e){return[e,`Mensajes`]}function We(e){return(0,Y.jsxs)(`div`,{className:`hive-card hive-card--active group`,children:[(0,Y.jsxs)(`div`,{className:`hive-card-body`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-row items-center justify-between mb-4`,children:[(0,Y.jsx)(`span`,{className:`hive-title-section`,children:e.label}),(0,Y.jsx)(`div`,{className:`p-2 rounded-lg bg-white/5 border border-white/5`,children:(0,Y.jsx)(Le,{icon:e.icon,className:`h-4 w-4 ${e.color}`})})]}),(0,Y.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-3xl font-black text-white group-hover:text-blue-400 transition-colors`,children:e.value}),(0,Y.jsxs)(`p`,{className:`text-[10px] font-bold text-white/30 uppercase tracking-widest mt-1 flex items-center gap-1`,children:[(0,Y.jsx)(y,{className:`h-2.5 w-2.5 text-green-500`}),e.trend]})]}),(0,Y.jsx)(`div`,{className:`h-8 w-8 rounded-full border border-white/5 bg-white/5 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,Y.jsx)(y,{className:`h-4 w-4 text-blue-400`})})]})]}),(0,Y.jsx)(`div`,{className:`hive-strip--bottom`})]},e.label)}function Ge(e,t){return e+t.count}function Ke(e){return e.value>0||e.name===`Idle`}function qe(e){return e.state===`disabled`}function Je(e){return e.state===`stuck`}function Ye(e){return e.state===`idle`}function Xe(e){return e.state===`thinking`||e.state===`tool_call`}function Ze(e){return e.source===`catalog`}function Qe(){return M(`/api/agents/proposals`).then($e)}function $e(e){return e.proposals}function et(){return M(`/api/activity-stats?hours=12`)}function tt(){return M(`/api/system-stats`)}function nt(e){return e.graphNodes}export{Be as DashboardPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{t as n}from"./vendor-react-kUOwxn0g.js";import{o as r}from"./vendor-query-Dj8xYhQD.js";import{t as i}from"./createLucideIcon-BRaPSYgN.js";import{t as a}from"./check-C8pw-7Fx.js";import{t as o}from"./chevron-down-8GjmTjLR.js";import{t as s}from"./chevron-right-BupZqrxu.js";import{t as c}from"./circle-check-BKNT2_q6.js";import{t as l}from"./useProviders-DsFqfiyM.js";import{t as u}from"./download-BQXrpH0m.js";import{n as d,t as f}from"./eye-CxvxtQT5.js";import{n as p,t as m}from"./key-DPkOY-J0.js";import{t as h}from"./lock-open-v0EphssG.js";import{t as g}from"./lock-3IApZyVy.js";import{t as _}from"./mic-CpDU_2as.js";import{t as v}from"./pencil-CKritjT_.js";import{t as y}from"./play-Cwpe4tp6.js";import{t as b}from"./plus-RD44ce15.js";import{t as x}from"./refresh-cw-DtJMHRHO.js";import{t as S}from"./search-z2oZt00P.js";import{t as C}from"./settings-qV3kVkeG.js";import{t as w}from"./square-D5zdNkAY.js";import{t as T}from"./terminal-BEcTK780.js";import{t as E}from"./trash-2-D6oziYAK.js";import{n as D,t as O}from"./wifi-BUJuOcgP.js";import{t as k}from"./utils-DEmd_M8c.js";import{A,C as j,E as M,G as N,O as P,S as F,W as I,b as L,ot as ee,rt as te,tt as ne,y as R}from"./index-C5Hhusqq.js";import{t as z}from"./badge-B5AKge1b.js";import{t as re}from"./scroll-area-CbH8FOo8.js";import{i as B,n as V,r as ie,t as ae}from"./tabs-epu-3Tl4.js";import{c as H,i as U,o as oe,r as W,s as G,t as K}from"./dialog-DcgGvP2g.js";import{t as se}from"./label-D_fvqJyD.js";import{i as q,n as ce,o as le,s as ue,t as de}from"./select-v_3QBYrD.js";import{t as fe}from"./switch-ndx8VCpm.js";import{a as pe,i as me,n as he,r as ge,t as _e}from"./card-mTJ4oZbL.js";var ve=i(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),ye=i(`Package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7`,key:`yx3hmr`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),J=n(),Y=e(t(),1);function be(e=720){let[t,n]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{let t=!1;return P(`/api/usage-stats?hours=${e}`).then(e=>{t||n(e.byProvider??{})}).catch(()=>{t||n(null)}),()=>{t=!0}},[e]),t}function xe(e){return e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Se(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}var X=r();function Ce(e){let t=(0,J.c)(62),{provider:n,onSave:r,onCancel:i}=e,[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(``),[u,p]=(0,Y.useState)(n?.baseUrl||n?.base_url||``),m;t[0]===n?m=t[1]:(m=n?.config?.headers?JSON.stringify(n.config.headers,null,2):``,t[0]=n,t[1]=m);let[h,g]=(0,Y.useState)(m),[_,v]=(0,Y.useState)(n?.num_ctx?String(n.num_ctx):``),y=u||n?.baseUrl||n?.base_url||``,b;t[2]!==y||t[3]!==n?.id?(b=n?.id===`ollama`||y.includes(`localhost`)||y.includes(`127.0.0.1`),t[2]=y,t[3]=n?.id,t[4]=b):b=t[4];let x=b,S=!!n?.has_api_key,C=!!n?.has_headers,w;t[5]!==s||t[6]!==u||t[7]!==h||t[8]!==_||t[9]!==r?(w=()=>{let e;if(h.trim())try{e=JSON.parse(h.trim())}catch{A.fire(`Error`,`JSON de Headers inválido`,`error`);return}r&&r({apiKey:s,baseUrl:u||void 0,headers:e,numCtx:_.trim()?Number(_.trim()):null})},t[5]=s,t[6]=u,t[7]=h,t[8]=_,t[9]=r,t[10]=w):w=t[10];let T=w,E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(se,{className:`hive-label`,children:`API Key`}),t[11]=E):E=t[11];let D;t[12]===S?D=t[13]:(D=S&&(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-bold text-emerald-400`,children:[(0,X.jsx)(c,{className:`h-3 w-3`}),`Configurada`]}),t[12]=S,t[13]=D);let O;t[14]===D?O=t[15]:(O=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[E,D]}),t[14]=D,t[15]=O);let k=a?`text`:`password`,j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>l(e.target.value),t[16]=j):j=t[16];let M=S?`•••••••••••••••• (dejar vacío para conservar)`:`sk-...`,P;t[17]!==s||t[18]!==k||t[19]!==M?(P=(0,X.jsx)(I,{type:k,value:s,onChange:j,placeholder:M,className:`hive-input !h-8 text-xs pr-8`}),t[17]=s,t[18]=k,t[19]=M,t[20]=P):P=t[20];let F;t[21]===a?F=t[22]:(F=(0,X.jsx)(N,{variant:`ghost`,size:`icon`,className:`absolute right-0 top-0 h-8 w-8 text-white/40 hover:text-white`,onClick:()=>o(!a),children:a?(0,X.jsx)(d,{className:`h-3 w-3`}):(0,X.jsx)(f,{className:`h-3 w-3`})}),t[21]=a,t[22]=F);let L;t[23]!==P||t[24]!==F?(L=(0,X.jsxs)(`div`,{className:`relative`,children:[P,F]}),t[23]=P,t[24]=F,t[25]=L):L=t[25];let ee;t[26]!==L||t[27]!==O?(ee=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[O,L]}),t[26]=L,t[27]=O,t[28]=ee):ee=t[28];let te;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsx)(se,{className:`hive-label`,children:`Base URL (opcional)`}),t[29]=te):te=t[29];let ne;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>p(e.target.value),t[30]=ne):ne=t[30];let R;t[31]===u?R=t[32]:(R=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[te,(0,X.jsx)(I,{value:u,onChange:ne,placeholder:`https://api.example.com`,className:`hive-input !h-8 text-xs`})]}),t[31]=u,t[32]=R);let z;t[33]!==x||t[34]!==_?(z=x&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(se,{className:`hive-label`,children:`Context Window (num_ctx)`}),(0,X.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`tokens — por defecto 32 768`})]}),(0,X.jsx)(I,{type:`number`,value:_,onChange:e=>v(e.target.value),placeholder:`8192`,min:512,step:512,className:`hive-input !h-8 text-xs font-mono`}),(0,X.jsx)(`p`,{className:`text-[10px] text-amber-400/60`,children:`Aumenta si ves errores de contexto. Tu modelo soporta hasta 262 144 tokens.`})]}),t[33]=x,t[34]=_,t[35]=z):z=t[35];let re;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,X.jsx)(se,{className:`hive-label`,children:`Custom Headers (JSON)`}),t[36]=re):re=t[36];let B;t[37]===C?B=t[38]:(B=C&&(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-bold text-emerald-400`,children:[(0,X.jsx)(c,{className:`h-3 w-3`}),`Configurados`]}),t[37]=C,t[38]=B);let V;t[39]===B?V=t[40]:(V=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[re,B]}),t[39]=B,t[40]=V);let ie;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>g(e.target.value),t[41]=ie):ie=t[41];let ae=C?`{ ... } (dejar vacío para conservar)`:`{ "x-custom-header": "value" }`,H;t[42]!==h||t[43]!==ae?(H=(0,X.jsx)(`textarea`,{value:h,onChange:ie,placeholder:ae,rows:3,className:`w-full bg-white/5 border border-white/10 rounded-md p-2 text-xs text-white/70 focus:outline-none focus:border-blue-500/50 transition-all font-mono`}),t[42]=h,t[43]=ae,t[44]=H):H=t[44];let U;t[45]!==V||t[46]!==H?(U=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[V,H]}),t[45]=V,t[46]=H,t[47]=U):U=t[47];let oe;t[48]===i?oe=t[49]:(oe=(0,X.jsx)(`button`,{className:`hive-btn hive-btn--form-cancel flex-1`,onClick:i,children:`Cancelar`}),t[48]=i,t[49]=oe);let W;t[50]===T?W=t[51]:(W=(0,X.jsx)(`button`,{className:`hive-btn hive-btn--form-submit flex-1`,onClick:T,children:`Guardar`}),t[50]=T,t[51]=W);let G;t[52]!==oe||t[53]!==W?(G=(0,X.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[oe,W]}),t[52]=oe,t[53]=W,t[54]=G):G=t[54];let K;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,X.jsx)(`p`,{className:`text-[10px] text-white/20 pt-2`,children:`La API key se guarda cifrada en la base de datos.`}),t[55]=K):K=t[55];let q;return t[56]!==ee||t[57]!==R||t[58]!==z||t[59]!==U||t[60]!==G?(q=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[ee,R,z,U,G,K]}),t[56]=ee,t[57]=R,t[58]=z,t[59]=U,t[60]=G,t[61]=q):q=t[61],q}function we(e){let t=e.input_per_1m??e.inputPer1M,n=e.output_per_1m??e.outputPer1M;return typeof t!=`number`||typeof n!=`number`?null:{input:t,output:n}}function Te(e){return e.input===0&&e.output===0}function Ee(e){return e===0?`$0`:e<.01?`$${e.toFixed(3)}`:e<1?`$${e.toFixed(2)}`:`$${e%1==0?e:e.toFixed(2)}`}function De(e){let t=e.map(we).filter(e=>e!==null);if(t.length===0)return null;if(t.every(Te))return{label:`Gratis`,allFree:!0};let n=t.filter(e=>!Te(e));return{label:`desde ${Ee(Math.min(...n.map(e=>e.input)))}/1M`,allFree:!1}}function Oe(e){let t=(0,J.c)(14),{model:n,showContext:r}=e,i=r===void 0?!1:r,a,o,s;if(t[0]!==n||t[1]!==i){let e=we(n),r=n.contextWindow??n.context_window,c;t[5]!==r||t[6]!==i?(c=i&&r?`${r>=1e6?`${(r/1e6).toFixed(r%1e6==0?0:1)}M`:`${Math.round(r/1e3)}K`} ctx`:null,t[5]=r,t[6]=i,t[7]=c):c=t[7],a=c,o=`flex items-center gap-1.5 text-[10px] leading-tight font-mono`,s=e===null?(0,X.jsx)(`span`,{className:`text-white/25`,title:`Este modelo no tiene tarifa en el catálogo: su consumo se contabiliza como $0`,children:`Sin tarifa`}):Te(e)?(0,X.jsx)(`span`,{className:`text-emerald-400/70`,children:`Gratis`}):(0,X.jsxs)(`span`,{className:`text-white/40`,title:`USD por millón de tokens (entrada / salida)`,children:[(0,X.jsx)(`span`,{className:`text-white/55`,children:Ee(e.input)}),(0,X.jsx)(`span`,{className:`text-white/25`,children:` / `}),(0,X.jsx)(`span`,{className:`text-white/55`,children:Ee(e.output)}),(0,X.jsx)(`span`,{className:`text-white/25`,children:` /1M`})]}),t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else a=t[2],o=t[3],s=t[4];let c;t[8]===a?c=t[9]:(c=a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-white/15`,children:`·`}),(0,X.jsx)(`span`,{className:`text-white/30`,children:a})]}),t[8]=a,t[9]=c);let l;return t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,X.jsxs)(`span`,{className:o,children:[s,c]}),t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}var ke=[{value:`llm`,label:`LLM (texto)`},{value:`vision`,label:`Visión`},{value:`stt`,label:`STT (voz → texto)`},{value:`tts`,label:`TTS (texto → voz)`},{value:`embedding`,label:`Embeddings`}],Ae=[`chat`,`code`,`vision`,`reasoning`,`function_calling`,`json_mode`,`streaming`,`transcription`,`tts`,`speech`];function je(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(String):[]}catch{return[]}}function Me(e){let t=e.trim();if(t===``)return null;let n=Number(t);return Number.isFinite(n)&&n>=0?n:null}function Ne({open:e,onOpenChange:t,providerId:n,model:r,onSubmit:i,onOpenGuide:a,isFreeProvider:o}){let s=!!r,[c,l]=(0,Y.useState)(`manual`),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(`llm`),[w,T]=(0,Y.useState)(``),[E,D]=(0,Y.useState)(``),[O,k]=(0,Y.useState)(``),[A,j]=(0,Y.useState)([]),[M,N]=(0,Y.useState)(!1),[F,I]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{if(!e)return;I(null),y(r?r.wire_id??r.id:``),x(r?.name??``),C(r?.model_type??`llm`);let t=r?.contextWindow??r?.context_window;T(t?String(t):``);let n=r?.input_per_1m??r?.inputPer1M,i=r?.output_per_1m??r?.outputPer1M,a=!r&&o?`0`:``;D(typeof n==`number`?String(n):a),k(typeof i==`number`?String(i):a),j(je(r?.capabilities)),l(r?`manual`:`discover`),_(``),d(null),p(null)},[e,r,n,o]),(0,Y.useEffect)(()=>{!e||c!==`discover`||u!==null||m||(h(!0),p(null),P(`/api/providers/${encodeURIComponent(n)}/available-models`).then(e=>d(e.models??[])).catch(e=>p(e.message||`No se pudo consultar el provider.`)).finally(()=>h(!1)))},[e,c,n,u,m]);let L=(0,Y.useMemo)(()=>{if(!u)return[];let e=g.trim().toLowerCase();return e?u.filter(t=>t.wire_id.toLowerCase().includes(e)):u},[u,g]),ee=e=>{y(e.wire_id),x(e.wire_id.split(`/`).pop()||e.wire_id),l(`manual`)},te=e=>{j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ne=async()=>{let e=v.trim();if(!e){I(`El ID del modelo en la API es obligatorio.`);return}let n=Number(w.trim());if(w.trim()&&(!Number.isFinite(n)||n<=0)){I(`El contexto debe ser un número mayor que cero.`);return}N(!0),I(null);try{await i({id:e,name:b.trim()||e,model_type:S,context_window:w.trim()?n:void 0,input_per_1m:Me(E),output_per_1m:Me(O),capabilities:A.length?A:null}),t(!1)}catch(e){I(e.message||`No se pudo guardar el modelo.`)}finally{N(!1)}},R=`w-full bg-white/5 border border-white/10 rounded-md px-2.5 h-8 text-xs text-white/80 placeholder-white/20 focus:outline-none focus:border-blue-500/50 transition-all`,z=`block text-[10px] font-black uppercase tracking-widest text-white/40 mb-1`;return(0,X.jsx)(K,{open:e,onOpenChange:t,children:(0,X.jsxs)(W,{className:`rounded-xl border border-white/10 p-0 overflow-hidden w-[calc(100vw-2rem)] max-w-lg bg-[#09090b]`,children:[(0,X.jsxs)(`div`,{className:`p-5 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,X.jsx)(`div`,{className:`absolute -top-10 -right-10 h-32 w-32 bg-blue-600/10 rounded-full blur-[80px] pointer-events-none`}),(0,X.jsx)(G,{className:`text-lg font-black text-white uppercase tracking-tighter`,children:s?`Editar modelo`:`Nuevo modelo`}),(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(U,{className:`text-xs text-white/40 font-medium mt-0.5`,children:[n,` — los precios alimentan el costo del dashboard.`]}),a&&(0,X.jsx)(`button`,{type:`button`,onClick:a,className:`shrink-0 h-6 px-2 rounded-md bg-white/5 border border-white/10 text-white/50 text-[10px] font-black uppercase tracking-widest hover:text-white hover:bg-white/10 transition-colors`,children:`? Guía`})]})]}),!s&&(0,X.jsx)(`div`,{className:`flex gap-1 px-5 pt-3`,children:[[`discover`,`Descubrir`],[`manual`,`Manual`]].map(([e,t])=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(e),className:`h-7 px-3 rounded-md text-[10px] font-black uppercase tracking-widest border transition-colors ${c===e?`bg-blue-500/15 border-blue-500/30 text-blue-300`:`bg-transparent border-white/10 text-white/35 hover:text-white/70`}`,children:t},e))}),!s&&c===`discover`&&(0,X.jsxs)(`div`,{className:`p-5 space-y-3 max-h-[65vh] overflow-y-auto hive-scroll`,children:[(0,X.jsxs)(`p`,{className:`text-[11px] text-white/40 leading-relaxed`,children:[`Modelos que `,(0,X.jsx)(`span`,{className:`text-white/70`,children:n}),` sirve en este momento. Elegir de acá evita guardar un ID que no existe o que fue retirado — eso no falla al guardar, falla después en plena conversación.`]}),(0,X.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),placeholder:`Buscar modelo…`,className:`${R} font-mono`}),m&&(0,X.jsx)(`p`,{className:`text-[11px] text-white/30 py-4 text-center`,children:`Consultando al provider…`}),f&&(0,X.jsxs)(`div`,{className:`text-[11px] text-amber-400/80 bg-amber-400/10 border border-amber-400/20 rounded-md px-2.5 py-2`,children:[f,(0,X.jsx)(`p`,{className:`text-white/40 mt-1`,children:`Este provider puede no publicar su lista de modelos. Usá la pestaña Manual.`})]}),u&&!m&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`text-[10px] text-white/30`,children:[L.length,` de `,u.length,` modelos`]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5 max-h-72 overflow-y-auto hive-scroll pr-1`,children:[L.map(e=>(0,X.jsxs)(`button`,{type:`button`,disabled:e.already_added,onClick:()=>ee(e),className:`flex items-center justify-between gap-2 text-left rounded-md px-2.5 py-1.5 border transition-colors ${e.already_added?`border-transparent opacity-35 cursor-not-allowed`:`border-transparent hover:bg-white/5 hover:border-white/10`}`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[11px] text-white/70 truncate`,children:e.wire_id}),e.already_added&&(0,X.jsx)(`span`,{className:`shrink-0 text-[9px] font-black uppercase tracking-widest text-emerald-400/70`,children:`ya está`})]},e.id)),L.length===0&&(0,X.jsx)(`p`,{className:`text-[11px] text-white/25 py-3 text-center`,children:`Ningún modelo coincide.`})]})]})]}),(s||c===`manual`)&&(0,X.jsxs)(`div`,{className:`p-5 space-y-3.5 max-h-[65vh] overflow-y-auto hive-scroll`,children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:z,children:`ID en la API *`}),(0,X.jsx)(`input`,{className:`${R} font-mono`,value:v,onChange:e=>y(e.target.value),placeholder:`claude-sonnet-5`}),(0,X.jsx)(`p`,{className:`text-[10px] text-white/25 mt-1`,children:`Tal cual lo espera el provider.`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:z,children:`Nombre visible`}),(0,X.jsx)(`input`,{className:R,value:b,onChange:e=>x(e.target.value),placeholder:`Claude Sonnet 5`})]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:z,children:`Tipo`}),(0,X.jsx)(`select`,{className:R,value:S,onChange:e=>C(e.target.value),children:ke.map(e=>(0,X.jsx)(`option`,{value:e.value,className:`bg-[#09090b]`,children:e.label},e.value))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:z,children:`Contexto (tokens)`}),(0,X.jsx)(`input`,{type:`number`,min:0,className:`${R} font-mono`,value:w,onChange:e=>T(e.target.value),placeholder:`200000`})]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between mb-1`,children:[(0,X.jsx)(`span`,{className:`${z} mb-0`,children:`Costo — USD por millón de tokens`}),(0,X.jsx)(`span`,{className:`text-[10px] text-white/25`,children:`Vacío = sin tarifa`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,X.jsx)(`div`,{children:(0,X.jsx)(`input`,{type:`number`,min:0,step:`0.001`,className:`${R} font-mono`,value:E,onChange:e=>D(e.target.value),placeholder:`Entrada — 3`})}),(0,X.jsx)(`div`,{children:(0,X.jsx)(`input`,{type:`number`,min:0,step:`0.001`,className:`${R} font-mono`,value:O,onChange:e=>k(e.target.value),placeholder:`Salida — 15`})})]}),(0,X.jsxs)(`p`,{className:`text-[10px] text-white/25 mt-1`,children:[`Pon `,(0,X.jsx)(`span`,{className:`font-mono text-white/40`,children:`0`}),` si el endpoint es gratuito: dejarlo vacío marca el modelo como “sin tarifa” y su consumo se contabiliza como $0 sin avisar en el dashboard.`]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:z,children:`Capacidades`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Ae.map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>te(e),className:`text-[10px] font-mono rounded px-2 py-1 leading-none border transition-colors ${A.includes(e)?`bg-blue-500/15 border-blue-500/30 text-blue-300`:`bg-white/5 border-white/10 text-white/30 hover:text-white/60`}`,children:e},e))})]}),F&&(0,X.jsx)(`p`,{className:`text-[11px] text-red-400 bg-red-500/10 border border-red-500/20 rounded-md px-2.5 py-1.5`,children:F})]}),(s||c===`manual`)&&(0,X.jsxs)(`div`,{className:`px-5 py-3 border-t border-white/5 flex items-center justify-end gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:`hive-btn hive-btn--ghost h-8 px-3 text-[10px] font-black uppercase tracking-widest text-white/40`,children:`Cancelar`}),(0,X.jsx)(`button`,{type:`button`,onClick:ne,disabled:M||!v.trim(),className:`h-8 px-3.5 rounded-md bg-blue-500/15 border border-blue-500/30 text-blue-300 text-[10px] font-black uppercase tracking-widest hover:bg-blue-500/25 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:M?`Guardando…`:s?`Guardar`:`Agregar`})]})]})})}var Pe=C,Fe=o,Ie=s,Le=l,Re=b,ze=p,Be=ee,Ve=x,He=v,Ue=E;function We({provider:e,updateProvider:t,onManageModels:n,usage:r,onOpenGuide:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(null),{models:h,toggleModel:g,createModel:_,syncModels:v,deleteModel:y,updateModel:b}=F(),{toggleProvider:x}=j(),S=(0,Y.useMemo)(()=>{let t=h.filter(t=>(t.providerId||t.provider_id)===e.id);return t.length>0?t:e.models||[]},[h,e.id,e.models]),C=S.filter(e=>e.enabled||e.active),w=(0,Y.useMemo)(()=>De(S),[S]),T=n=>{t(e.id,n),o(!1)},E=async t=>{try{await x(e.id,t)}catch(e){console.error(`Failed to toggle provider:`,e)}},D=async(e,t)=>{try{await g(e.id,t)}catch(e){console.error(`Failed to toggle model:`,e)}},O=async()=>{u(!0);try{await v(e.id),c(!0)}catch(e){console.error(`Failed to sync models:`,e)}finally{u(!1)}},k=async t=>{p?.model?await b(p.model.id,t):await _(e.id,t)},A=async e=>{f(e.id);try{await y(e.id)}catch(e){console.error(`Failed to delete model:`,e)}finally{f(null)}},M=!!e.active,N=e.base_url||e.baseUrl,P=e.id===`ollama`||N?.includes(`localhost`)||N?.includes(`127.0.0.1`);return(0,X.jsxs)(`div`,{className:`hive-card group overflow-hidden flex flex-col gap-0 transition-all duration-500 ${M?`hive-card--active`:`opacity-70 grayscale-[0.5] hover:grayscale-0 hover:opacity-100`}`,children:[(0,X.jsx)(`div`,{className:`hive-card-body pb-3`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,X.jsx)(`div`,{className:`shrink-0 h-10 w-10 sm:h-11 sm:w-11 rounded-xl flex items-center justify-center border transition-all duration-500 ${M?`bg-blue-500/10 border-blue-500/30 text-blue-400 shadow-[0_0_16px_rgba(59,130,246,0.15)]`:`bg-white/5 border-white/10 text-white/30`}`,children:(0,X.jsx)(Le,{className:`h-5 w-5`})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 mb-0.5`,children:[(0,X.jsx)(`h3`,{className:`font-black text-white tracking-tight text-base sm:text-lg uppercase leading-none truncate`,children:e.name}),M&&(0,X.jsx)(`div`,{className:`hive-status-dot--active h-1.5 w-1.5 shrink-0`})]}),(0,X.jsx)(`p`,{className:`text-[11px] text-white/35 font-medium leading-none truncate`,children:e.id})]})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,X.jsx)(`span`,{className:`hidden sm:block text-[10px] font-black tracking-widest ${M?`text-blue-400`:`text-white/30`}`,children:M?`ON`:`OFF`}),(0,X.jsx)(fe,{checked:M,onCheckedChange:E,className:`data-[state=checked]:bg-blue-500`})]})]})}),(0,X.jsxs)(`div`,{className:`px-5 pb-3 space-y-2 border-b border-white/5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,X.jsx)(ze,{className:`h-3.5 w-3.5 shrink-0 ${e.has_api_key?`text-emerald-400`:P?`text-amber-400`:`text-white/20`}`}),(0,X.jsx)(`span`,{className:`text-[11px] font-mono truncate`,children:e.masked_api_key?(0,X.jsx)(`span`,{className:`text-white/50`,children:e.masked_api_key}):e.has_api_key?(0,X.jsx)(`span`,{className:`text-white/50`,children:`••••••••••••••••`}):P?(0,X.jsx)(`span`,{className:`text-amber-400/70`,children:`Local — sin API key`}):(0,X.jsx)(`span`,{className:`text-white/25`,children:`Sin API key`})}),e.id===`openrouter`&&e.has_api_key?(0,X.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,{clearApiKey:!0}),className:`ml-auto text-[10px] text-white/40 hover:text-rose-300`,children:`Quitar clave`}):null]}),e.id===`openrouter`&&e.jev?(0,X.jsxs)(`div`,{className:`text-[11px] text-white/50`,title:e.jev.lastError??void 0,children:[e.jev.backend===`kev`?`Kev`:`Jev`,` · `,e.jev.state===`ready`?`activo`:e.jev.state===`fallback`?`usando flujo clásico`:`desactivado`]}):null,N&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,X.jsx)(Be,{className:`h-3.5 w-3.5 shrink-0 text-white/20`}),(0,X.jsx)(`span`,{className:`text-[11px] text-white/40 truncate font-mono`,children:N})]}),P&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,X.jsx)(Le,{className:`h-3.5 w-3.5 shrink-0 text-white/20`}),(0,X.jsxs)(`span`,{className:`text-[11px] text-white/40 font-mono`,children:[`ctx: `,(0,X.jsx)(`span`,{className:e.num_ctx?`text-amber-400/70`:`text-white/25`,children:e.num_ctx?`${e.num_ctx.toLocaleString()} tokens`:`32 768 (default)`})]})]})]}),(0,X.jsxs)(`div`,{className:`px-5 py-3 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 flex-1 text-left text-[10px] font-black uppercase tracking-widest text-white/40 hover:text-white transition-colors`,onClick:()=>c(!s),children:[s?(0,X.jsx)(Fe,{className:`h-3 w-3`}):(0,X.jsx)(Ie,{className:`h-3 w-3`}),`MODELOS`,(0,X.jsxs)(`span`,{className:`hive-tag scale-90 origin-left`,children:[C.length,`/`,S.length]})]}),w&&(0,X.jsx)(`span`,{className:`text-[9px] font-mono font-semibold rounded px-1.5 py-0.5 leading-none whitespace-nowrap border ${w.allFree?`text-emerald-400/80 bg-emerald-400/10 border-emerald-400/20`:`text-white/45 bg-white/5 border-white/10`}`,title:w.allFree?`Todos los modelos de este provider son gratuitos`:`Precio del modelo más barato, en USD por millón de tokens de entrada`,children:w.label}),P&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[9px] font-semibold text-amber-400/70 bg-amber-400/10 border border-amber-400/20 rounded px-1.5 py-0.5 leading-none whitespace-nowrap`,children:`Actualiza modelos locales`}),(0,X.jsx)(`button`,{type:`button`,onClick:O,disabled:l,title:`Sincronizar modelos instalados en Ollama`,className:`h-6 w-6 flex items-center justify-center rounded-md text-white/30 hover:text-amber-400 hover:bg-amber-400/10 disabled:opacity-40 transition-colors`,children:(0,X.jsx)(Ve,{className:`h-3 w-3 ${l?`animate-spin`:``}`})})]})]}),!s&&S.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[S.slice(0,3).map(e=>(0,X.jsx)(`span`,{className:`hive-tag text-[10px] ${e.enabled||e.active?``:`opacity-40`}`,children:e.name.split(`/`).pop()||e.name},e.id)),S.length>3&&(0,X.jsxs)(`span`,{className:`hive-tag text-[10px] text-white/30`,children:[`+`,S.length-3]})]}),s&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`div`,{className:`hive-scroll max-h-44 overflow-y-auto flex flex-col gap-0.5 pr-1`,children:[S.length===0&&(0,X.jsx)(`p`,{className:`text-[11px] text-white/25 py-2 text-center`,children:`Sin modelos configurados`}),S.map(e=>{let t=e.enabled||!!e.active;return(0,X.jsx)(`div`,{className:`rounded-lg transition-colors ${t?`bg-white/5`:`bg-transparent opacity-40`}`,children:(0,X.jsxs)(`div`,{className:`flex items-center justify-between px-2.5 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 mr-2`,children:[(0,X.jsx)(`span`,{className:`block text-[11px] font-medium text-white truncate`,children:e.name}),(0,X.jsx)(Oe,{model:e,showContext:!0})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>m({model:e}),title:`Editar modelo — ID, contexto, costo y capacidades`,className:`h-5 w-5 flex items-center justify-center rounded text-white/25 hover:text-blue-400 hover:bg-blue-400/10 transition-colors`,children:(0,X.jsx)(He,{className:`h-3 w-3`})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>A(e),disabled:d===e.id,title:`Eliminar modelo`,className:`h-5 w-5 flex items-center justify-center rounded text-white/25 hover:text-red-400 hover:bg-red-400/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:(0,X.jsx)(Ue,{className:`h-3 w-3`})}),(0,X.jsx)(fe,{checked:t,onCheckedChange:t=>D(e,t),className:`scale-[0.7] origin-right data-[state=checked]:bg-blue-400 ml-0.5`})]})]})},e.id)})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>m({}),className:`w-full mt-1.5 h-7 flex items-center justify-center gap-1 rounded-md bg-blue-500/10 border border-blue-500/20 text-blue-400 text-[10px] font-black uppercase tracking-wider hover:bg-blue-500/20 transition-colors`,children:[(0,X.jsx)(Re,{className:`h-3 w-3`}),`Agregar modelo`]})]})]}),(0,X.jsxs)(`div`,{className:`px-4 py-3 border-t border-white/5 flex items-center justify-between gap-2 overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`hive-stat shrink-0`,title:`Gasto acumulado en los últimos 30 días`,children:[(0,X.jsx)(`span`,{className:`hive-stat__label`,children:`Gasto 30d`}),(0,X.jsx)(`span`,{className:`hive-stat__value ${r&&r.costUsd>0?`text-amber-400`:`text-white/30`}`,children:r?xe(r.costUsd):`—`})]}),(0,X.jsxs)(`div`,{className:`hive-stat shrink-0`,title:`Tokens consumidos en los últimos 30 días`,children:[(0,X.jsx)(`span`,{className:`hive-stat__label`,children:`Tokens`}),(0,X.jsx)(`span`,{className:`hive-stat__value ${r&&r.tokens>0?`text-white/60`:`text-white/30`}`,children:r?Se(r.tokens):`—`})]}),(0,X.jsxs)(`div`,{className:`hive-stat shrink-0`,children:[(0,X.jsx)(`span`,{className:`hive-stat__label`,children:`Estado`}),(0,X.jsx)(`span`,{className:`hive-stat__value ${M?`text-emerald-400`:`text-white/30`}`,children:M?`Activo`:`Inactivo`})]})]}),(0,X.jsxs)(K,{open:a,onOpenChange:o,children:[(0,X.jsx)(H,{asChild:!0,children:(0,X.jsxs)(`button`,{className:`hive-btn hive-btn--ghost h-8 px-2.5 text-[10px] font-black uppercase tracking-widest text-blue-400 shrink-0 flex items-center gap-1.5`,children:[(0,X.jsx)(Pe,{className:`h-3 w-3`}),(0,X.jsx)(`span`,{children:`CONFIG`})]})}),(0,X.jsxs)(W,{className:`rounded-xl border border-white/10 p-0 overflow-hidden w-[calc(100vw-2rem)] max-w-md bg-[#09090b]`,children:[(0,X.jsxs)(`div`,{className:`p-5 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,X.jsx)(`div`,{className:`absolute -top-10 -right-10 h-32 w-32 bg-blue-600/10 rounded-full blur-[80px] pointer-events-none`}),(0,X.jsx)(G,{className:`text-lg font-black text-white uppercase tracking-tighter`,children:e.name}),(0,X.jsx)(U,{className:`text-xs text-white/40 font-medium mt-0.5`,children:`Autenticación y punto de enlace.`})]}),(0,X.jsx)(`div`,{className:`p-5`,children:(0,X.jsx)(Ce,{provider:e,onSave:T,onCancel:()=>o(!1)})})]})]})]}),(0,X.jsx)(Ne,{open:p!==null,onOpenChange:e=>{e||m(null)},providerId:e.id,model:p?.model,onSubmit:k,onOpenGuide:i,isFreeProvider:w?.allFree??!1}),(0,X.jsx)(`div`,{className:`hive-strip--bottom ${M?``:`opacity-20`}`})]})}function Ge(e){let t=(0,J.c)(24),{onOpenGuide:n}=e,{providers:r,updateProvider:i}=j(),a=be(),o,s,c,l,u;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a){u=r.filter(qe);let e=u.filter(Ke).length;c=`space-y-4`;let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(`h3`,{className:`hive-title-section`,children:`Providers de IA`}),t[9]=d):d=t[9],l=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[d,(0,X.jsxs)(`span`,{className:`hive-tag hive-tag--provider`,children:[e,` activos / `,u.length,` total`]})]}),o=`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4 sm:gap-5`;let f;t[10]!==n||t[11]!==i||t[12]!==a?(f=e=>(0,X.jsx)(We,{provider:e,updateProvider:i,usage:a?.[e.id],onOpenGuide:n},e.id),t[10]=n,t[11]=i,t[12]=a,t[13]=f):f=t[13],s=u.map(f),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8];let d;t[14]===u.length?d=t[15]:(d=u.length===0&&(0,X.jsx)(`div`,{className:`hive-empty-state col-span-full`,children:`No hay providers disponibles.`}),t[14]=u.length,t[15]=d);let f;t[16]!==o||t[17]!==s||t[18]!==d?(f=(0,X.jsxs)(`div`,{className:o,children:[s,d]}),t[16]=o,t[17]=s,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==c||t[21]!==l||t[22]!==f?(p=(0,X.jsxs)(`div`,{className:c,children:[l,f]}),t[20]=c,t[21]=l,t[22]=f,t[23]=p):p=t[23],p}function Ke(e){return e.active}function qe(e){return(e.category??`llm`)===`llm`}function Je(e){let t=(0,J.c)(69),{onSave:n,onCancel:r}=e,[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),[u,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(``),b;t[0]!==m||t[1]!==c?(b=c.toLowerCase()===`ollama`||m.includes(`localhost`)||m.includes(`127.0.0.1`),t[0]=m,t[1]=c,t[2]=b):b=t[2];let x=b,S;t[3]!==u||t[4]!==m||t[5]!==g||t[6]!==x||t[7]!==o||t[8]!==v||t[9]!==n||t[10]!==c?(S=()=>{if(!o.trim()){A.fire(`Error`,`El nombre del provider es requerido`,`error`);return}if(!c){A.fire(`Error`,`Selecciona un tipo de provider`,`error`);return}if(!u.trim()&&!x){A.fire(`Error`,`La API Key es requerida para este provider`,`error`);return}let e;if(g.trim())try{e=JSON.parse(g.trim())}catch{A.fire(`Error`,`JSON de Headers inválido`,`error`);return}n({id:o.trim().toLowerCase().replace(/\s+/g,`-`),name:o.trim(),type:c,apiKey:u.trim()||``,baseUrl:m.trim()||void 0,headers:e,numCtx:v.trim()?Number(v.trim()):null})},t[3]=u,t[4]=m,t[5]=g,t[6]=x,t[7]=o,t[8]=v,t[9]=n,t[10]=c,t[11]=S):S=t[11];let C=S,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(se,{className:`hive-label`,children:`Nombre del Provider`}),t[12]=w):w=t[12];let T;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>s(e.target.value),t[13]=T):T=t[13];let E;t[14]===o?E=t[15]:(E=(0,X.jsx)(I,{value:o,onChange:T,placeholder:`Mi Provider Personalizado`,className:`hive-input !h-8 text-xs`}),t[14]=o,t[15]=E);let D;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,X.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Se usará como identificador interno`}),t[16]=D):D=t[16];let O;t[17]===E?O=t[18]:(O=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[w,E,D]}),t[17]=E,t[18]=O);let k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(se,{className:`hive-label`,children:`Tipo de Provider`}),t[19]=k):k=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>l(e.target.value),t[20]=j):j=t[20];let M;t[21]===c?M=t[22]:(M=(0,X.jsx)(I,{value:c,onChange:j,placeholder:`openai, anthropic, ollama...`,className:`hive-input !h-8 text-xs`}),t[21]=c,t[22]=M);let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Ej: openai, anthropic, ollama, custom...`}),t[23]=N):N=t[23];let P;t[24]===M?P=t[25]:(P=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[k,M,N]}),t[24]=M,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,X.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,X.jsx)(se,{className:`hive-label`,children:`API Key`})}),t[26]=F):F=t[26];let L=i?`text`:`password`,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>p(e.target.value),t[27]=ee):ee=t[27];let te=x?`Opcional para providers locales`:`sk-...`,ne;t[28]!==u||t[29]!==L||t[30]!==te?(ne=(0,X.jsx)(I,{type:L,value:u,onChange:ee,placeholder:te,className:`hive-input !h-8 text-xs pr-8`}),t[28]=u,t[29]=L,t[30]=te,t[31]=ne):ne=t[31];let R;t[32]===i?R=t[33]:(R=()=>a(!i),t[32]=i,t[33]=R);let z;t[34]===i?z=t[35]:(z=i?(0,X.jsx)(d,{className:`h-3 w-3`}):(0,X.jsx)(f,{className:`h-3 w-3`}),t[34]=i,t[35]=z);let re;t[36]!==R||t[37]!==z?(re=(0,X.jsx)(`button`,{type:`button`,onClick:R,className:`absolute right-0 top-0 h-8 w-8 flex items-center justify-center text-white/40 hover:text-white`,children:z}),t[36]=R,t[37]=z,t[38]=re):re=t[38];let B;t[39]!==ne||t[40]!==re?(B=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[F,(0,X.jsxs)(`div`,{className:`relative`,children:[ne,re]})]}),t[39]=ne,t[40]=re,t[41]=B):B=t[41];let V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsx)(se,{className:`hive-label`,children:`Base URL (opcional)`}),t[42]=V):V=t[42];let ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>h(e.target.value),t[43]=ie):ie=t[43];let ae;t[44]===m?ae=t[45]:(ae=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[V,(0,X.jsx)(I,{value:m,onChange:ie,placeholder:`https://api.example.com o http://localhost:11434`,className:`hive-input !h-8 text-xs`})]}),t[44]=m,t[45]=ae);let H;t[46]!==x||t[47]!==v?(H=x&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(se,{className:`hive-label`,children:`Context Window (num_ctx)`}),(0,X.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`tokens — por defecto 32 768`})]}),(0,X.jsx)(I,{type:`number`,value:v,onChange:e=>y(e.target.value),placeholder:`32768`,min:512,step:512,className:`hive-input !h-8 text-xs font-mono`}),(0,X.jsx)(`p`,{className:`text-[10px] text-amber-400/60`,children:`Aumenta si ves errores de contexto.`})]}),t[46]=x,t[47]=v,t[48]=H):H=t[48];let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,X.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,X.jsx)(se,{className:`hive-label`,children:`Custom Headers (JSON)`})}),t[49]=U):U=t[49];let oe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(oe=e=>_(e.target.value),t[50]=oe):oe=t[50];let W;t[51]===g?W=t[52]:(W=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[U,(0,X.jsx)(`textarea`,{value:g,onChange:oe,placeholder:`{ "x-custom-header": "value" }`,rows:3,className:`w-full bg-white/5 border border-white/10 rounded-md p-2 text-xs text-white/70 focus:outline-none focus:border-blue-500/50 transition-all font-mono`})]}),t[51]=g,t[52]=W);let G;t[53]===r?G=t[54]:(G=(0,X.jsx)(`button`,{className:`hive-btn hive-btn--form-cancel flex-1`,onClick:r,children:`Cancelar`}),t[53]=r,t[54]=G);let K;t[55]===C?K=t[56]:(K=(0,X.jsx)(`button`,{className:`hive-btn hive-btn--form-submit flex-1`,onClick:C,children:`Crear Provider`}),t[55]=C,t[56]=K);let q;t[57]!==G||t[58]!==K?(q=(0,X.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[G,K]}),t[57]=G,t[58]=K,t[59]=q):q=t[59];let ce;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,X.jsx)(`p`,{className:`text-[10px] text-white/20 pt-2`,children:`La API key se guarda cifrada en la base de datos.`}),t[60]=ce):ce=t[60];let le;return t[61]!==P||t[62]!==B||t[63]!==ae||t[64]!==H||t[65]!==W||t[66]!==q||t[67]!==O?(le=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[O,P,B,ae,H,W,q,ce]}),t[61]=P,t[62]=B,t[63]=ae,t[64]=H,t[65]=W,t[66]=q,t[67]=O,t[68]=le):le=t[68],le}var Ye={chat:`Chat`,vision:`Vision`,json_mode:`JSON`,function_calling:`Functions`,streaming:`Stream`,embeddings:`Embed`,image_generation:`Imagen`,code:`Codigo`,reasoning:`Razonamiento`,transcription:`STT`,translation:`Traduccion`,tts:`TTS`,speech:`Voz`,high_quality:`HQ`,ocr:`OCR`};function Xe(e){let t=(0,J.c)(8),{capabilities:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let i=r;if(typeof n==`string`)try{let e;t[1]===n?e=t[2]:(e=JSON.parse(n),t[1]=n,t[2]=e),i=e}catch{let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[3]=e):e=t[3],i=e}else Array.isArray(n)&&(i=n);if(i.length===0)return null;let a;t[4]===i?a=t[5]:(a=i.map(Ze),t[4]=i,t[5]=a);let o;return t[6]===a?o=t[7]:(o=(0,X.jsx)(X.Fragment,{children:a}),t[6]=a,t[7]=o),o}function Ze(e){return(0,X.jsx)(z,{variant:`outline`,className:`text-[10px] py-0 h-4`,children:Ye[e]??e},e)}function Qe(e){let t=(0,J.c)(33),{model:n}=e,{toggleModel:r}=F(),i=n.active?``:`opacity-70 bg-muted/30`,a;t[0]===n.name?a=t[1]:(a=(0,X.jsx)(`p`,{className:`text-sm font-semibold`,children:n.name}),t[0]=n.name,t[1]=a);let o=n.providerId||n.provider_id,s;t[2]===o?s=t[3]:(s=(0,X.jsx)(z,{variant:`secondary`,className:`text-[10px]`,children:o}),t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==s?(c=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===n?l=t[8]:(l=(0,X.jsx)(Oe,{model:n,showContext:!0}),t[7]=n,t[8]=l);let u;t[9]===n.capabilities?u=t[10]:(u=(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,children:(0,X.jsx)(Xe,{capabilities:n.capabilities})}),t[9]=n.capabilities,t[10]=u);let d;t[11]!==c||t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[c,l,u]}),t[11]=c,t[12]=l,t[13]=u,t[14]=d):d=t[14];let f=!!n.active,p;t[15]!==n.id||t[16]!==r?(p=e=>r(n.id,e),t[15]=n.id,t[16]=r,t[17]=p):p=t[17];let m;t[18]!==p||t[19]!==f?(m=(0,X.jsx)(fe,{checked:f,onCheckedChange:p}),t[18]=p,t[19]=f,t[20]=m):m=t[20];let h=n.active?`default`:`secondary`,g=n.active?`Activo`:`Inactivo`,_;t[21]!==h||t[22]!==g?(_=(0,X.jsx)(z,{variant:h,className:`text-[10px]`,children:g}),t[21]=h,t[22]=g,t[23]=_):_=t[23];let v;t[24]!==m||t[25]!==_?(v=(0,X.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[m,_]}),t[24]=m,t[25]=_,t[26]=v):v=t[26];let y;t[27]!==v||t[28]!==d?(y=(0,X.jsxs)(he,{className:`flex items-center gap-4 p-3`,children:[d,v]}),t[27]=v,t[28]=d,t[29]=y):y=t[29];let b;return t[30]!==i||t[31]!==y?(b=(0,X.jsx)(_e,{className:i,children:y}),t[30]=i,t[31]=y,t[32]=b):b=t[32],b}function $e(e){if(!e)return[];if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function et(){let e=(0,J.c)(41),{availableModels:t,activeProviders:n}=j(),r=R(rt),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(`all`),c,l;e[0]===r?(c=e[1],l=e[2]):(c=()=>{r(!0)},l=[r],e[0]=r,e[1]=c,e[2]=l),(0,Y.useEffect)(c,l);let u;if(e[3]!==t||e[4]!==i||e[5]!==o){let n;e[7]!==i||e[8]!==o?(n=e=>{let t=$e(e.capabilities),n=t.includes(`vision`)||t.includes(`image_generation`)||t.includes(`ocr`),r=e.name.toLowerCase().includes(i.toLowerCase())||e.id.toLowerCase().includes(i.toLowerCase()),a=o===`all`||e.providerId===o||e.provider_id===o;return n&&r&&a},e[7]=i,e[8]=o,e[9]=n):n=e[9],u=t.filter(n),e[3]=t,e[4]=i,e[5]=o,e[6]=u}else u=e[6];let d=u,p;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Modelos de Imagen / Vision`})}),e[10]=p):p=e[10];let m;e[11]===d.length?m=e[12]:(m=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[p,(0,X.jsx)(z,{variant:`secondary`,children:d.length})]}),e[11]=d.length,e[12]=m);let h;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Estos modelos pueden procesar imagenes y documentos visuales. Si el agente usa uno de estos modelos, las imagenes se envian directamente. Si no, se usa OCR para extraer el texto.`}),e[13]=h):h=e[13];let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(S,{className:`absolute left-2 top-2 h-4 w-4 text-muted-foreground`}),e[14]=g):g=e[14];let _;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>a(e.target.value),e[15]=_):_=e[15];let v;e[16]===i?v=e[17]:(v=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[g,(0,X.jsx)(I,{placeholder:`Buscar modelo...`,className:`h-8 pl-8 text-sm`,value:i,onChange:_})]}),e[16]=i,e[17]=v);let y;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(le,{className:`h-8 w-40 text-sm`,children:(0,X.jsx)(ue,{placeholder:`Provider`})}),e[18]=y):y=e[18];let b;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(q,{value:`all`,children:`Todos`}),e[19]=b):b=e[19];let x;e[20]===n?x=e[21]:(x=n.map(nt),e[20]=n,e[21]=x);let C;e[22]===x?C=e[23]:(C=(0,X.jsxs)(ce,{children:[b,x]}),e[22]=x,e[23]=C);let w;e[24]!==o||e[25]!==C?(w=(0,X.jsxs)(de,{value:o,onValueChange:s,children:[y,C]}),e[24]=o,e[25]=C,e[26]=w):w=e[26];let T;e[27]!==w||e[28]!==v?(T=(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[v,w]}),e[27]=w,e[28]=v,e[29]=T):T=e[29];let E;e[30]===d?E=e[31]:(E=d.map(tt),e[30]=d,e[31]=E);let D;e[32]===d.length?D=e[33]:(D=d.length===0&&(0,X.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,X.jsx)(f,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground`}),(0,X.jsx)(`p`,{children:`No hay modelos con capacidad de vision.`}),(0,X.jsx)(`p`,{className:`text-xs mt-1`,children:`Habilita modelos con capability "vision" en la tab Providers.`})]}),e[32]=d.length,e[33]=D);let O;e[34]!==E||e[35]!==D?(O=(0,X.jsx)(re,{className:`h-[calc(100vh-26rem)]`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[E,D]})}),e[34]=E,e[35]=D,e[36]=O):O=e[36];let k;return e[37]!==T||e[38]!==O||e[39]!==m?(k=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[m,h,T,O]}),e[37]=T,e[38]=O,e[39]=m,e[40]=k):k=e[40],k}function tt(e){return(0,X.jsx)(Qe,{model:e},e.id)}function nt(e){return(0,X.jsx)(q,{value:e.id,children:e.name},e.id)}function rt(e){return e.fetchAll}var it=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`w-full caption-bottom text-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,X.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});it.displayName=`Table`;var at=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});at.displayName=`TableHeader`;var ot=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ot.displayName=`TableBody`;var st=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});st.displayName=`TableFooter`;var ct=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ct.displayName=`TableRow`;var lt=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});lt.displayName=`TableHead`;var ut=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ut.displayName=`TableCell`;var dt=Y.forwardRef((e,t)=>{let n=(0,J.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=k(`mt-4 text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dt.displayName=`TableCaption`;function ft(e){let t=(0,J.c)(40),{open:n,onOpenChange:r}=e,{availableTTSModels:i,fetchAvailableTTSModels:o,downloadTTSModel:s,isDownloadingModel:c,downloadLogs:l}=L(),[d,f]=(0,Y.useState)(!1),p;t[0]===o?p=t[1]:(p=async()=>{f(!0),await o(),f(!1)},t[0]=o,t[1]=p);let m=p,h;t[2]!==m||t[3]!==n?(h=()=>{n&&m()},t[2]=m,t[3]=n,t[4]=h):h=t[4];let g;t[5]===n?g=t[6]:(g=[n],t[5]=n,t[6]=g),(0,Y.useEffect)(h,g);let _;t[7]===s?_=t[8]:(_=async e=>{await s(e)},t[7]=s,t[8]=_);let v=_,y=ht,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(oe,{children:[(0,X.jsx)(G,{className:`flex items-center gap-2`,children:`📦 Gestionar Modelos TTS`}),(0,X.jsx)(U,{children:`Descarga modelos de voz adicionales para Piper TTS. Cada modelo incluye el archivo de voz (.onnx) y su configuración (.json).`})]}),t[9]=b):b=t[9];let S;t[10]===i?S=t[11]:(S=i.filter(mt),t[10]=i,t[11]=S);let C;t[12]!==i.length||t[13]!==S.length?(C=(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsxs)(z,{variant:`outline`,children:[S.length,` / `,i.length,` instalados`]})}),t[12]=i.length,t[13]=S.length,t[14]=C):C=t[14];let w=d||c,T=`h-4 w-4 ${d?`animate-spin`:``}`,E;t[15]===T?E=t[16]:(E=(0,X.jsx)(x,{className:T}),t[15]=T,t[16]=E);let D;t[17]!==m||t[18]!==E||t[19]!==w?(D=(0,X.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:m,disabled:w,className:`gap-2`,children:[E,`Actualizar`]}),t[17]=m,t[18]=E,t[19]=w,t[20]=D):D=t[20];let O;t[21]!==D||t[22]!==C?(O=(0,X.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[C,D]}),t[21]=D,t[22]=C,t[23]=O):O=t[23];let k;t[24]!==i||t[25]!==l||t[26]!==v||t[27]!==c||t[28]!==d?(k=d&&!i.length?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(te,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):i.length===0?(0,X.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No hay modelos disponibles`}):(0,X.jsxs)(it,{children:[(0,X.jsx)(at,{children:(0,X.jsxs)(ct,{children:[(0,X.jsx)(lt,{children:`Modelo`}),(0,X.jsx)(lt,{children:`Idioma`}),(0,X.jsx)(lt,{children:`Calidad`}),(0,X.jsx)(lt,{children:`Tamaño`}),(0,X.jsx)(lt,{children:`Estado`}),(0,X.jsx)(lt,{className:`text-right`,children:`Acciones`})]})}),(0,X.jsx)(ot,{children:i.map(e=>(0,X.jsxs)(ct,{children:[(0,X.jsx)(ut,{className:`font-medium`,children:e.name}),(0,X.jsx)(ut,{children:e.language}),(0,X.jsx)(ut,{children:(0,X.jsx)(z,{className:y(e.quality),children:e.quality})}),(0,X.jsx)(ut,{className:`text-muted-foreground`,children:e.size}),(0,X.jsx)(ut,{children:e.installed?(0,X.jsxs)(z,{className:`bg-green-500/20 text-green-400 border-green-500/30 gap-1`,children:[(0,X.jsx)(a,{className:`h-3 w-3`}),`Instalado`]}):c&&l.some(t=>t.includes(e.name))?(0,X.jsxs)(z,{className:`bg-blue-500/20 text-blue-400 border-blue-500/30 gap-1`,children:[(0,X.jsx)(te,{className:`h-3 w-3 animate-spin`}),`Descargando`]}):(0,X.jsx)(z,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400`,children:`No instalado`})}),(0,X.jsx)(ut,{className:`text-right`,children:e.installed?(0,X.jsxs)(N,{size:`sm`,variant:`ghost`,disabled:!0,className:`gap-2 opacity-50`,children:[(0,X.jsx)(a,{className:`h-4 w-4`}),`Instalado`]}):(0,X.jsxs)(N,{size:`sm`,onClick:()=>v(e.id),disabled:c,className:`gap-2`,children:[(0,X.jsx)(u,{className:`h-4 w-4`}),`Descargar`]})})]},e.id))})]}),t[24]=i,t[25]=l,t[26]=v,t[27]=c,t[28]=d,t[29]=k):k=t[29];let A;t[30]===l?A=t[31]:(A=l.length>0&&(0,X.jsxs)(`div`,{className:`mt-4`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Progreso de descarga:`}),(0,X.jsx)(`div`,{className:`bg-black/40 rounded-md border border-zinc-700/50 p-3 h-32 overflow-y-auto font-mono text-xs text-zinc-300`,children:l.map(pt)})]}),t[30]=l,t[31]=A);let j;t[32]!==O||t[33]!==k||t[34]!==A?(j=(0,X.jsxs)(W,{className:`max-w-3xl max-h-[80vh] overflow-hidden flex flex-col`,children:[b,(0,X.jsxs)(`div`,{className:`flex-1 overflow-auto mt-4`,children:[O,k,A]})]}),t[32]=O,t[33]=k,t[34]=A,t[35]=j):j=t[35];let M;return t[36]!==r||t[37]!==n||t[38]!==j?(M=(0,X.jsx)(K,{open:n,onOpenChange:r,children:j}),t[36]=r,t[37]=n,t[38]=j,t[39]=M):M=t[39],M}function pt(e,t){return(0,X.jsx)(`div`,{className:e.startsWith(`[error]`)?`text-red-400`:e.startsWith(`✓`)?`text-green-400`:``,children:e},t)}function mt(e){return e.installed}function ht(e){switch(e){case`high`:return`bg-green-500/20 text-green-400 border-green-500/30`;case`medium`:return`bg-yellow-500/20 text-yellow-400 border-yellow-500/30`;case`low`:return`bg-zinc-500/20 text-zinc-400 border-zinc-500/30`}}function gt(){let{localTTS:e,fetchLocalTTSStatus:t,installLocalTTS:n,startLocalTTS:r,stopLocalTTS:i}=L(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)([]),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),g=(0,Y.useRef)(null),_=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{t()},[t]),(0,Y.useEffect)(()=>(e.installing?g.current=setInterval(()=>{t(),s&&v()},3e3):g.current&&clearInterval(g.current),()=>{g.current&&clearInterval(g.current)}),[e.installing,s,t]),(0,Y.useEffect)(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[l]);let v=async()=>{try{let e=await P(`/api/tts-local/logs`);d(e.logs),p(e.ttsRoot)}catch{}},b=async()=>{o(!0),c(!0);try{await n(),await v()}finally{o(!1)}},S=async()=>{o(!0);try{await r()}finally{o(!1)}},C=async()=>{o(!0);try{await i()}finally{o(!1)}},E=async()=>{c(e=>!e),s||await v()},{installed:k,running:A,piperExists:j,voiceExists:M,port:F}=e,I=e.installing;return(0,X.jsxs)(_e,{className:`relative overflow-hidden col-span-full ${A?`border-blue-500/30 bg-blue-500/[0.02]`:``}`,children:[(0,X.jsx)(me,{children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between flex-wrap gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-3xl`,children:`🎙️`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(pe,{className:`text-lg flex items-center gap-2`,children:[`Piper TTS`,(0,X.jsx)(z,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-normal border-zinc-600 text-zinc-400`,children:`Local · Offline`})]}),(0,X.jsx)(ge,{className:`text-xs`,children:`TTS sin internet — binario nativo, sin Python, sin Docker. Fallback cuando no hay providers online.`})]})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[I?(0,X.jsxs)(z,{className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30 gap-1`,children:[(0,X.jsx)(x,{className:`h-3 w-3 animate-spin`}),`Instalando…`]}):k?(0,X.jsx)(z,{className:`bg-green-500/20 text-green-400 border-green-500/30`,children:`Instalado`}):(0,X.jsx)(z,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400`,children:`No instalado`}),k&&(A?(0,X.jsxs)(z,{className:`bg-blue-500/20 text-blue-400 border-blue-500/30 gap-1`,children:[(0,X.jsx)(O,{className:`h-3 w-3`}),`Servidor :`,F]}):(0,X.jsxs)(z,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400 gap-1`,children:[(0,X.jsx)(D,{className:`h-3 w-3`}),`Detenido`]}))]})]})}),(0,X.jsxs)(he,{className:`space-y-4`,children:[!k&&!I&&(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 ${j?`text-green-400`:``}`,children:[(0,X.jsx)(`span`,{children:j?`✓`:`○`}),` Binario Piper (~8 MB)`]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 ${M?`text-green-400`:``}`,children:[(0,X.jsx)(`span`,{children:M?`✓`:`○`}),` Voz española (~60 MB)`]})]}),k&&(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Voz: `,(0,X.jsx)(`code`,{className:`text-zinc-300`,children:e.voices?.[0]||`N/A`}),` · Puerto:`,` `,(0,X.jsx)(`code`,{className:`text-zinc-300`,children:F}),` · Configurable con`,` `,(0,X.jsx)(`code`,{className:`text-zinc-300`,children:`TTS_PORT`}),` / `,(0,X.jsx)(`code`,{className:`text-zinc-300`,children:`TTS_VOICE`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!k&&!I&&(0,X.jsxs)(N,{size:`sm`,onClick:b,disabled:a,className:`gap-2`,children:[(0,X.jsx)(u,{className:`h-3.5 w-3.5`}),`Instalar Piper (~68 MB)`]}),I&&(0,X.jsxs)(N,{size:`sm`,disabled:!0,className:`gap-2 opacity-70`,children:[(0,X.jsx)(x,{className:`h-3.5 w-3.5 animate-spin`}),`Descargando…`]}),k&&!A&&(0,X.jsxs)(N,{size:`sm`,onClick:S,disabled:a,className:`gap-2 bg-blue-600 hover:bg-blue-500 text-white`,children:[(0,X.jsx)(y,{className:`h-3.5 w-3.5`}),`Iniciar servidor`]}),A&&(0,X.jsxs)(N,{size:`sm`,variant:`outline`,onClick:C,disabled:a,className:`gap-2 border-red-500/40 text-red-400 hover:bg-red-500/10`,children:[(0,X.jsx)(w,{className:`h-3.5 w-3.5`}),`Detener servidor`]}),k&&(0,X.jsxs)(N,{size:`sm`,variant:`outline`,onClick:()=>h(!0),disabled:a,className:`gap-2`,children:[(0,X.jsx)(ye,{className:`h-3.5 w-3.5`}),`Gestionar modelos`,e.voices&&e.voices.length>0&&(0,X.jsx)(z,{variant:`secondary`,className:`ml-1 text-[10px] px-1`,children:e.voices.length})]}),(0,X.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>t(),title:`Actualizar estado`,className:`text-zinc-400`,children:(0,X.jsx)(x,{className:`h-3.5 w-3.5`})}),(0,X.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:E,className:`gap-1.5 text-zinc-400 text-xs`,children:[(0,X.jsx)(T,{className:`h-3.5 w-3.5`}),s?`Ocultar log`:`Ver log`]})]}),I&&(0,X.jsx)(`p`,{className:`text-xs text-yellow-400/80`,children:`Descargando binario y modelo de voz… puede tardar 1-3 min. El estado se actualiza automáticamente.`}),s&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[f&&(0,X.jsxs)(`p`,{className:`text-[10px] text-zinc-500 font-mono`,children:[`ruta: `,f]}),(0,X.jsx)(`div`,{ref:_,className:`bg-black/40 rounded-md border border-zinc-700/50 p-3 h-40 overflow-y-auto font-mono text-[11px] text-zinc-300 leading-relaxed`,children:l.length===0?(0,X.jsx)(`span`,{className:`text-zinc-600`,children:`Sin registros aún. Inicia la instalación para ver el progreso.`}):l.map((e,t)=>(0,X.jsx)(`div`,{className:e.startsWith(`[stderr]`)||e.startsWith(`[error]`)?`text-red-400`:``,children:e},t))})]}),(0,X.jsx)(ft,{open:m,onOpenChange:h})]})]})}var _t={groq:{logo:`🔴`,consoleUrl:`https://console.groq.com/keys`},elevenlabs:{logo:`🎙️`,consoleUrl:`https://elevenlabs.io/app/settings/api-keys`},openai:{logo:`🟢`,consoleUrl:`https://platform.openai.com/api-keys`},gemini:{logo:`🔵`,consoleUrl:`https://aistudio.google.com/app/apikey`},qwen:{logo:`🟣`,consoleUrl:`https://dashscope.console.aliyun.com/apiKey`},piper:{logo:`🖥️`}};function vt(){let{providers:e,availableModels:t,activeProviders:n}=j(),{voiceProviders:r,configuredVoiceProviders:i,fetchVoiceProviders:o,fetchConfiguredVoiceProviders:s,saveVoiceProviderKey:c}=M(),l=R(e=>e.fetchAll),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(``),[T,E]=(0,Y.useState)(`all`);(0,Y.useEffect)(()=>{o(),s(),l(!0)},[o,s,l]);let D=async e=>{if(f.trim()){y(!0);try{await c(e,f.trim()),await s(),d(null),p(``)}catch(e){console.error(`Failed to save API key:`,e)}finally{y(!1)}}},O=t=>{let n=e.find(e=>e.id===t),r=(n?.models||[]).filter(e=>e.model_type===`stt`||e.model_type===`tts`),i=r.some(e=>e.model_type===`stt`),a=r.some(e=>e.model_type===`tts`),o=r.some(e=>$e(e.capabilities).includes(`local`)),s=_t[t]||{logo:`🔌`};return{name:n?.name||t,description:[i&&`STT (Speech-to-Text)`,a&&`TTS (Text-to-Speech)`].filter(Boolean).join(` / `),logo:s.logo,consoleUrl:s.consoleUrl,noApiKey:o}},k=r.filter(e=>!O(e).noApiKey),A=(0,Y.useMemo)(()=>t.filter(e=>{let t=e.model_type===`stt`||e.model_type===`tts`,n=$e(e.capabilities),r=n.includes(`transcription`)||n.includes(`tts`)||n.includes(`speech`),i=e.name.toLowerCase().includes(C.toLowerCase())||e.id.toLowerCase().includes(C.toLowerCase()),a=T===`all`||e.providerId===T||e.provider_id===T;return(t||r)&&i&&a}),[t,C,T]);return(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Modelos de Voz (STT / TTS)`}),(0,X.jsx)(z,{variant:`secondary`,children:A.length})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[(0,X.jsx)(S,{className:`absolute left-2 top-2 h-4 w-4 text-muted-foreground`}),(0,X.jsx)(I,{placeholder:`Buscar modelo...`,className:`h-8 pl-8 text-sm`,value:C,onChange:e=>w(e.target.value)})]}),(0,X.jsxs)(de,{value:T,onValueChange:E,children:[(0,X.jsx)(le,{className:`h-8 w-40 text-sm`,children:(0,X.jsx)(ue,{placeholder:`Provider`})}),(0,X.jsxs)(ce,{children:[(0,X.jsx)(q,{value:`all`,children:`Todos`}),n.map(e=>(0,X.jsx)(q,{value:e.id,children:e.name},e.id))]})]})]}),(0,X.jsx)(re,{className:`h-60`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[A.map(e=>(0,X.jsx)(Qe,{model:e},e.id)),A.length===0&&(0,X.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,X.jsx)(_,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground`}),(0,X.jsx)(`p`,{children:`No hay modelos de voz disponibles.`})]})]})})]}),(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:`API Keys de Voz`}),(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,X.jsx)(gt,{}),k.map(e=>{let t=O(e),n=i[e]===!0,r=u===e;return(0,X.jsxs)(_e,{className:`relative overflow-hidden ${n?`border-green-500/30 bg-green-500/[0.02]`:``}`,children:[(0,X.jsx)(me,{children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-3xl`,children:t.logo}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(pe,{className:`text-lg`,children:t.name}),(0,X.jsx)(ge,{className:`text-xs`,children:t.description})]})]}),t.noApiKey?(0,X.jsx)(z,{variant:`outline`,className:`bg-zinc-700/40 text-zinc-300 border-zinc-600`,children:`Sin API key`}):n?(0,X.jsxs)(z,{variant:`default`,className:`bg-green-500/20 text-green-400 border-green-500/30`,children:[(0,X.jsx)(a,{className:`h-3 w-3 mr-1`}),`Configurado`]}):(0,X.jsx)(z,{variant:`secondary`,className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30`,children:`Sin configurar`})]})}),(0,X.jsx)(he,{className:`space-y-4`,children:t.noApiKey?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.description}):r?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(se,{htmlFor:`api-key-${e}`,children:`API Key`}),(0,X.jsxs)(`div`,{className:`flex gap-2 mt-1`,children:[(0,X.jsx)(I,{id:`api-key-${e}`,type:b?`text`:`password`,placeholder:`sk-...`,value:f,onChange:e=>p(e.target.value),className:`flex-1 font-mono text-sm`,autoFocus:!0}),(0,X.jsx)(N,{variant:`outline`,size:`icon`,onClick:()=>x(!b),title:b?`Ocultar`:`Mostrar`,children:b?(0,X.jsx)(g,{className:`h-4 w-4`}):(0,X.jsx)(h,{className:`h-4 w-4`})})]})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(N,{size:`sm`,onClick:()=>D(e),disabled:v||!f.trim(),className:`flex-1`,children:v?`Guardando...`:`Guardar`}),(0,X.jsx)(N,{size:`sm`,variant:`outline`,onClick:()=>{d(null),p(``)},children:`Cancelar`})]})]}):(0,X.jsxs)(`div`,{className:`space-y-3`,children:[n?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,X.jsx)(m,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:`API key guardada de forma segura (encriptada)`})]}):(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Necesitas una API key de `,t.name,` para usar esta funcionalidad.`]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[n?(0,X.jsxs)(N,{size:`sm`,variant:`outline`,onClick:()=>{d(e),p(``)},className:`flex-1`,children:[(0,X.jsx)(m,{className:`h-3 w-3 mr-2`}),`Actualizar API Key`]}):(0,X.jsxs)(N,{size:`sm`,onClick:()=>{d(e),p(``)},className:`flex-1`,children:[(0,X.jsx)(m,{className:`h-3 w-3 mr-2`}),`Configurar API Key`]}),t.consoleUrl&&(0,X.jsx)(N,{size:`sm`,variant:`outline`,onClick:()=>window.open(t.consoleUrl,`_blank`),children:`Obtener Key`})]})]})})]},e)})]})]}),(0,X.jsxs)(_e,{children:[(0,X.jsxs)(me,{children:[(0,X.jsx)(pe,{className:`text-lg`,children:`Como funciona?`}),(0,X.jsx)(ge,{children:`Configura las API keys de los providers de voz para habilitar STT y TTS en tus canales.`})]}),(0,X.jsxs)(he,{className:`space-y-4 text-sm text-muted-foreground`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{className:`text-foreground`,children:`STT (Speech-to-Text):`}),` Convierte el audio entrante en texto. Groq Whisper es recomendado por su velocidad.`]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{className:`text-foreground`,children:`TTS (Text-to-Speech):`}),` Convierte las respuestas de texto en audio. ElevenLabs ofrece las voces mas naturales.`]}),(0,X.jsx)(`div`,{className:`pt-2 border-t`,children:(0,X.jsx)(`p`,{className:`text-xs`,children:`Las API keys se guardan encriptadas en la base de datos local de Hive.`})})]})]})]})}var yt=[{id:`configurar`,title:`Configurar un provider`,blurb:`API key, endpoint y activación`},{id:`gratuitos`,title:`Providers gratuitos`,blurb:`Cuáles no cobran por token`},{id:`agregar`,title:`Agregar un modelo`,blurb:`Descubrir vs. cargar a mano`},{id:`ollama`,title:`Modelos de Ollama`,blurb:`Cómo se nombran los modelos locales`},{id:`modelscope`,title:`ModelScope y Qwen`,blurb:`El dominio correcto y los créditos`},{id:`costos`,title:`Cómo se calcula el costo`,blurb:`Precios, «sin tarifa» y el dashboard`}],Z=`text-[12px] leading-relaxed text-white/55`,Q=`text-[11px] font-black uppercase tracking-widest text-white/70 mt-4 mb-1.5 first:mt-0`,$=`font-mono text-[11px] bg-white/5 border border-white/10 rounded px-1 py-0.5 text-white/70`;function bt(e){let t=(0,J.c)(48),{open:n,onOpenChange:r,providers:i,models:a,initialGuide:o}=e,[s,c]=(0,Y.useState)(o??`configurar`),l;if(t[0]!==a||t[1]!==i){let e=new Map;for(let t of a){let n=t.providerId||t.provider_id;n&&(e.has(n)||e.set(n,[]),e.get(n).push(t))}l=[...e.entries()].filter(Ct).map(e=>{let[t]=e;return i.find(e=>e.id===t)?.name||t}).sort(),t[0]=a,t[1]=i,t[2]=l}else l=t[2];let u=l,d;t[3]===i?d=t[4]:(d=i.filter(St),t[3]=i,t[4]=d);let f=d.length,p,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(`div`,{className:`absolute -top-10 -right-10 h-32 w-32 bg-blue-600/10 rounded-full blur-[80px] pointer-events-none`}),m=(0,X.jsx)(G,{className:`text-lg font-black text-white uppercase tracking-tighter`,children:`Guía de providers`}),t[5]=p,t[6]=m):(p=t[5],m=t[6]);let h;t[7]!==f||t[8]!==a.length||t[9]!==i.length?(h=(0,X.jsxs)(`div`,{className:`p-5 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[p,m,(0,X.jsxs)(U,{className:`text-xs text-white/40 font-medium mt-0.5`,children:[i.length,` providers · `,f,` con API key · `,a.length,` modelos`]})]}),t[7]=f,t[8]=a.length,t[9]=i.length,t[10]=h):h=t[10];let g;t[11]===s?g=t[12]:(g=yt.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>c(e.id),className:`text-left rounded-md px-2.5 py-2 transition-colors shrink-0 ${s===e.id?`bg-blue-500/10 border border-blue-500/25`:`border border-transparent hover:bg-white/5`}`,children:[(0,X.jsx)(`span`,{className:`block text-[11px] font-bold ${s===e.id?`text-blue-300`:`text-white/70`}`,children:e.title}),(0,X.jsx)(`span`,{className:`block text-[10px] text-white/30 mt-0.5 whitespace-nowrap sm:whitespace-normal`,children:e.blurb})]},e.id)),t[11]=s,t[12]=g);let _;t[13]===g?_=t[14]:(_=(0,X.jsx)(`nav`,{className:`sm:w-56 shrink-0 border-b sm:border-b-0 sm:border-r border-white/5 p-2 flex sm:flex-col gap-1 overflow-x-auto`,children:g}),t[13]=g,t[14]=_);let v;t[15]===s?v=t[16]:(v=s===`configurar`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:Q,children:`1. Activa el provider`}),(0,X.jsx)(`p`,{className:Z,children:`El switch de la tarjeta activa el provider y, en cascada, sus modelos. Un provider apagado no se ofrece a los agentes aunque tenga la key cargada.`}),(0,X.jsx)(`h4`,{className:Q,children:`2. Carga la API key`}),(0,X.jsxs)(`p`,{className:Z,children:[`Botón `,(0,X.jsx)(`span`,{className:$,children:`CONFIG`}),`. La key se guarda cifrada, separada del resto de la configuración, y nunca se devuelve entera: la tarjeta sólo muestra una versión enmascarada.`]}),(0,X.jsx)(`h4`,{className:Q,children:`3. Endpoint`}),(0,X.jsxs)(`p`,{className:Z,children:[`Cada provider trae su `,(0,X.jsx)(`span`,{className:$,children:`base_url`}),` por defecto. Cámbialo solo si usas un proxy propio o un gateway corporativo. El verificador de key y el descubrimiento de modelos usan ese mismo endpoint, así que apuntar a un proxy funciona de punta a punta.`]}),(0,X.jsx)(`h4`,{className:Q,children:`Providers locales`}),(0,X.jsxs)(`p`,{className:Z,children:[`Ollama y otros en `,(0,X.jsx)(`span`,{className:$,children:`localhost`}),` no necesitan API key. En esos aparece además el campo `,(0,X.jsx)(`span`,{className:$,children:`num_ctx`}),`, que fija el contexto que el servidor local reserva por request.`]})]}),t[15]=s,t[16]=v);let y;t[17]!==u||t[18]!==s?(y=s===`gratuitos`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:Q,children:`Sin costo por token`}),u.length>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:Z,children:`Según el catálogo cargado, estos providers tienen todos sus modelos a precio cero:`}),(0,X.jsx)(`ul`,{className:`mt-2 space-y-1`,children:u.map(xt)}),(0,X.jsx)(`p`,{className:`${Z} mt-3`,children:`Esta lista sale de los precios guardados en la base, así que se actualiza sola cuando cambia el catálogo. Gratis no significa sin límites: suelen tener cuotas de uso por cuenta.`})]}):(0,X.jsx)(`p`,{className:Z,children:`Ningún provider del catálogo actual tiene todos sus modelos a precio cero.`}),(0,X.jsx)(`h4`,{className:Q,children:`Ojo con el $0 engañoso`}),(0,X.jsxs)(`p`,{className:Z,children:[`Un modelo `,(0,X.jsx)(`em`,{children:`sin tarifa cargada`}),` también suma $0 al dashboard, pero no porque sea gratis sino porque falta el dato. En la lista de modelos se distinguen: `,(0,X.jsx)(`span`,{className:$,children:`Gratis`}),` en verde contra `,(0,X.jsx)(`span`,{className:$,children:`Sin tarifa`}),` en gris.`]})]}),t[17]=u,t[18]=s,t[19]=y):y=t[19];let b;t[20]===s?b=t[21]:(b=s===`agregar`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:Q,children:`Descubrir (recomendado)`}),(0,X.jsxs)(`p`,{className:Z,children:[`Trae la lista real de modelos que el provider sirve en este momento y eliges de ahí. Es la forma segura: un ID escrito a mano puede estar mal o haber sido retirado, y eso no falla al guardar — falla mucho después, en plena conversación, con un `,(0,X.jsx)(`span`,{className:$,children:`404`}),` o un`,` `,(0,X.jsx)(`span`,{className:$,children:`410 Gone`}),`.`]}),(0,X.jsx)(`p`,{className:`${Z} mt-2`,children:`Los modelos que ya tienes cargados aparecen marcados para que no los dupliques.`}),(0,X.jsx)(`h4`,{className:Q,children:`Manual`}),(0,X.jsx)(`p`,{className:Z,children:`Para providers que no publican su lista de modelos. Campos:`}),(0,X.jsxs)(`ul`,{className:`${Z} mt-2 space-y-1.5 list-disc pl-4`,children:[(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{className:`text-white/70`,children:`ID en la API`}),` — el nombre exacto que espera el provider.`]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{className:`text-white/70`,children:`Nombre visible`}),` — sólo para la UI.`]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{className:`text-white/70`,children:`Contexto`}),` — tokens de entrada máximos; también decide cuándo se compacta la conversación.`]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{className:`text-white/70`,children:`Costo`}),` — USD por millón de tokens.`]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{className:`text-white/70`,children:`Capacidades`}),` — `,(0,X.jsx)(`span`,{className:$,children:`function_calling`}),` es la que habilita herramientas.`]})]}),(0,X.jsx)(`p`,{className:`${Z} mt-3`,children:`Los modelos que agregues a mano sobreviven a las actualizaciones del catálogo: no se borran al actualizar la lista de modelos que trae Hive.`})]}),t[20]=s,t[21]=b);let x;t[22]===s?x=t[23]:(x=s===`ollama`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:Q,children:`Cómo se llaman`}),(0,X.jsxs)(`p`,{className:Z,children:[`Ollama identifica cada modelo como `,(0,X.jsx)(`span`,{className:$,children:`nombre:tag`}),`, donde el tag es la variante o el tamaño. Ejemplos: `,(0,X.jsx)(`span`,{className:$,children:`llama3.3:8b`}),`,`,` `,(0,X.jsx)(`span`,{className:$,children:`qwen3:14b`}),`, `,(0,X.jsx)(`span`,{className:$,children:`mistral:7b`}),`. Sin tag, Ollama asume `,(0,X.jsx)(`span`,{className:$,children:`:latest`}),`.`]}),(0,X.jsx)(`h4`,{className:Q,children:`No los escribas a mano`}),(0,X.jsxs)(`p`,{className:Z,children:[`El botón de sincronizar de la tarjeta lee los modelos que ya tienes instalados y los carga solo. Si un modelo no aparece, primero bájalo en tu máquina con`,` `,(0,X.jsx)(`span`,{className:$,children:`ollama pull llama3.3:8b`}),` y vuelve a sincronizar.`]}),(0,X.jsx)(`h4`,{className:Q,children:`Contexto`}),(0,X.jsx)(`p`,{className:Z,children:`Los modelos descubiertos entran con contexto 0 porque Ollama no lo reporta en el listado. Editalo con el valor real del modelo: si queda en 0, Hive usa un valor por defecto que puede no corresponder al que tienes cargado.`}),(0,X.jsx)(`h4`,{className:Q,children:`Costo`}),(0,X.jsxs)(`p`,{className:Z,children:[`Corren en tu máquina, así que entran en `,(0,X.jsx)(`span`,{className:$,children:`0`}),`. No consumen presupuesto.`]})]}),t[22]=s,t[23]=x);let S;t[24]===s?S=t[25]:(S=s===`modelscope`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:Q,children:`El error que casi nadie encuentra: .ai vs .cn`}),(0,X.jsxs)(`p`,{className:Z,children:[`ModelScope tiene dos endpoints con `,(0,X.jsx)(`b`,{className:`text-white/70`,children:`cuentas y tokens separados`}),`:`,` `,(0,X.jsx)(`span`,{className:$,children:`api-inference.modelscope.ai`}),` (internacional) y`,` `,(0,X.jsx)(`span`,{className:$,children:`api-inference.modelscope.cn`}),` (China). Un token de uno responde`,` `,(0,X.jsx)(`span`,{className:$,children:`401`}),` en el otro.`]}),(0,X.jsxs)(`p`,{className:`${Z} mt-2`,children:[`Lo confuso: `,(0,X.jsx)(`b`,{className:`text-white/70`,children:`el listado de modelos responde 200 en los dos`}),`, porque es público y no valida la key. El 401 aparece recién al invocar un modelo. Si te pasa eso, no es la key — es el dominio. Hive viene apuntando al internacional (`,(0,X.jsx)(`span`,{className:$,children:`.ai`}),`); cámbialo desde CONFIG si tu cuenta es la china.`]}),(0,X.jsx)(`h4`,{className:Q,children:`ModelScope no es DashScope`}),(0,X.jsxs)(`p`,{className:Z,children:[`Son plataformas distintas de Alibaba, con cuentas y créditos separados. El provider`,` `,(0,X.jsx)(`span`,{className:$,children:`ModelScope Qwen`}),` usa un token de modelscope.cn → Access Tokens. El provider `,(0,X.jsx)(`span`,{className:$,children:`Qwen (Alibaba)`}),` usa una API key de Model Studio / DashScope. Una no sirve para el otro.`]}),(0,X.jsx)(`h4`,{className:Q,children:`Cuota`}),(0,X.jsxs)(`p`,{className:Z,children:[`El endpoint es gratuito dentro de límite: 2000 llamadas por día y hasta 500 por modelo. Por eso sus modelos figuran con costo `,(0,X.jsx)(`span`,{className:$,children:`0`}),`.`]}),(0,X.jsx)(`h4`,{className:Q,children:`Modelos de embajador`}),(0,X.jsxs)(`p`,{className:Z,children:[`Los `,(0,X.jsx)(`span`,{className:$,children:`Qwen-Ambassador/*`}),` (3.7-Plus, 3.7-Max, 3.8-Max) aparecen en el listado para todo el mundo, pero sólo los puede invocar una cuenta del programa de embajadores. Si no eres parte, el provider devuelve un error de autorización al usarlos.`]})]}),t[24]=s,t[25]=S);let C;t[26]===s?C=t[27]:(C=s===`costos`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:Q,children:`De dónde sale el número`}),(0,X.jsx)(`p`,{className:Z,children:`Cada modelo guarda su precio de entrada y de salida en USD por millón de tokens. Cuando un agente responde, se registran los tokens reales de esa llamada y se multiplican por el precio de ese modelo. No hay tabla de precios aparte: lo que ves en la tarjeta es lo mismo que factura el dashboard.`}),(0,X.jsx)(`h4`,{className:Q,children:`Entrada y salida no valen igual`}),(0,X.jsxs)(`p`,{className:Z,children:[`La salida suele costar entre 3 y 6 veces más que la entrada. Por eso se muestran los dos números:`,` `,(0,X.jsx)(`span`,{className:$,children:`$3 / $15`}),` es entrada / salida.`]}),(0,X.jsx)(`h4`,{className:Q,children:`«Sin tarifa» vs. 0`}),(0,X.jsxs)(`p`,{className:Z,children:[`Dejar el precio vacío marca el modelo como sin tarifa y su consumo se cuenta como $0 — lo cual ensucia el total sin avisar. Si el endpoint es realmente gratuito, pon`,` `,(0,X.jsx)(`span`,{className:$,children:`0`}),` explícito.`]}),(0,X.jsx)(`h4`,{className:Q,children:`Gasto por provider`}),(0,X.jsxs)(`p`,{className:Z,children:[`El pie de cada tarjeta muestra el gasto y los tokens de los últimos 30 días de ese provider. Un`,` `,(0,X.jsx)(`span`,{className:$,children:`—`}),` significa que todavía no hay registros de uso.`]})]}),t[26]=s,t[27]=C);let w;t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==v||t[33]!==y?(w=(0,X.jsxs)(`div`,{className:`flex-1 p-5 overflow-y-auto hive-scroll`,children:[v,y,b,x,S,C]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=v,t[33]=y,t[34]=w):w=t[34];let T;t[35]!==w||t[36]!==_?(T=(0,X.jsxs)(`div`,{className:`flex flex-col sm:flex-row max-h-[65vh]`,children:[_,w]}),t[35]=w,t[36]=_,t[37]=T):T=t[37];let E;t[38]===r?E=t[39]:(E=(0,X.jsx)(`div`,{className:`px-5 py-3 border-t border-white/5 flex justify-end`,children:(0,X.jsx)(`button`,{type:`button`,onClick:()=>r(!1),className:`h-8 px-3.5 rounded-md bg-white/5 border border-white/10 text-white/60 text-[10px] font-black uppercase tracking-widest hover:bg-white/10 transition-colors`,children:`Cerrar`})}),t[38]=r,t[39]=E);let D;t[40]!==T||t[41]!==E||t[42]!==h?(D=(0,X.jsxs)(W,{className:`rounded-xl border border-white/10 p-0 overflow-hidden w-[calc(100vw-2rem)] max-w-3xl bg-[#09090b]`,children:[h,T,E]}),t[40]=T,t[41]=E,t[42]=h,t[43]=D):D=t[43];let O;return t[44]!==r||t[45]!==n||t[46]!==D?(O=(0,X.jsx)(K,{open:n,onOpenChange:r,children:D}),t[44]=r,t[45]=n,t[46]=D,t[47]=O):O=t[47],O}function xt(e){return(0,X.jsxs)(`li`,{className:`flex items-center gap-2 text-[12px] text-emerald-400/80`,children:[(0,X.jsx)(`span`,{className:`h-1 w-1 rounded-full bg-emerald-400/60`}),e]},e)}function St(e){return e.has_api_key}function Ct(e){let[,t]=e,n=t.map(we).filter(wt);return n.length>0&&n.every(Te)}function wt(e){return e!==null}var Tt=b,Et=f,Dt=_,Ot=ne,kt=ve;function At(){let e=(0,J.c)(31),{providers:t,createProvider:n}=j(),{models:r}=F(),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(`providers`),u;e[0]===n?u=e[1]:(u=async e=>{try{await n({id:e.id,name:e.name,base_url:e.baseUrl,api_key:e.apiKey,headers:e.headers,num_ctx:e.numCtx}),a(!1)}catch(e){console.error(`Error creating provider:`,e)}},e[0]=n,e[1]=u);let d=u,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,X.jsx)(`div`,{className:`hive-page-header__dot`}),(0,X.jsx)(`span`,{className:`hive-page-header__label`,children:`INFRAESTRUCTURA`})]}),e[2]=f):f=e[2];let p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsxs)(`div`,{children:[f,(0,X.jsxs)(`h2`,{className:`hive-title-page`,children:[`Providers de IA`,(0,X.jsx)(`span`,{className:`hive-title-page__accent`,children:`.`})]})]}),e[3]=p):p=e[3];let m;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>s(!0),e[4]=m):m=e[4];let h;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsxs)(`button`,{type:`button`,onClick:m,className:`hive-btn hive-btn--ghost`,title:`Cómo configurar providers, cuáles son gratis, cómo agregar modelos`,children:[(0,X.jsx)(kt,{className:`mr-1 h-4 w-4`}),`Guía`]}),e[5]=h):h=e[5];let g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{a(e)},e[6]=g):g=e[6];let _;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(H,{asChild:!0,children:(0,X.jsxs)(`button`,{className:`hive-btn hive-btn--primary`,children:[(0,X.jsx)(Tt,{className:`mr-1 h-4 w-4`}),`Añadir Provider`]})}),e[7]=_):_=e[7];let v;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsxs)(oe,{className:`p-6 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,X.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--blue -top-10 -right-10 h-32 w-32 opacity-20`}),(0,X.jsx)(G,{className:`text-xl font-black text-white uppercase tracking-tighter`,children:`Añadir Provider`}),(0,X.jsx)(U,{className:`text-xs text-white/40 font-medium mt-1`,children:`Crea un nuevo provider de IA para tu infraestructura.`})]}),e[8]=v):v=e[8];let y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>a(!1),e[9]=y):y=e[9];let b;e[10]===d?b=e[11]:(b=(0,X.jsxs)(W,{className:`max-w-md`,children:[v,(0,X.jsx)(`div`,{className:`p-6`,children:(0,X.jsx)(Je,{onSave:d,onCancel:y})})]}),e[10]=d,e[11]=b);let x;e[12]!==i||e[13]!==b?(x=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[p,(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,(0,X.jsxs)(K,{open:i,onOpenChange:g,children:[_,b]})]})]}),e[12]=i,e[13]=b,e[14]=x):x=e[14];let S;e[15]!==o||e[16]!==r||e[17]!==t?(S=(0,X.jsx)(bt,{open:o,onOpenChange:s,providers:t,models:r}),e[15]=o,e[16]=r,e[17]=t,e[18]=S):S=e[18];let C;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsxs)(B,{value:`providers`,className:`gap-1.5 text-xs`,children:[(0,X.jsx)(Ot,{className:`h-3.5 w-3.5`}),`Providers`]}),e[19]=C):C=e[19];let w;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsxs)(B,{value:`vision`,className:`gap-1.5 text-xs`,children:[(0,X.jsx)(Et,{className:`h-3.5 w-3.5`}),`Imagen`]}),e[20]=w):w=e[20];let T;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,X.jsxs)(ie,{className:`w-full grid grid-cols-3 h-10`,children:[C,w,(0,X.jsxs)(B,{value:`voice`,className:`gap-1.5 text-xs`,children:[(0,X.jsx)(Dt,{className:`h-3.5 w-3.5`}),`Voz`]})]}),e[21]=T):T=e[21];let E;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(V,{value:`providers`,className:`mt-4`,children:(0,X.jsx)(Ge,{onOpenGuide:()=>s(!0)})}),e[22]=E):E=e[22];let D;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,X.jsx)(V,{value:`vision`,className:`mt-4`,children:(0,X.jsx)(et,{})}),e[23]=D):D=e[23];let O;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(V,{value:`voice`,className:`mt-4`,children:(0,X.jsx)(vt,{})}),e[24]=O):O=e[24];let k;e[25]===c?k=e[26]:(k=(0,X.jsxs)(ae,{value:c,onValueChange:l,className:`w-full`,children:[T,E,D,O]}),e[25]=c,e[26]=k);let A;return e[27]!==x||e[28]!==S||e[29]!==k?(A=(0,X.jsxs)(`div`,{className:`space-y-4 mt-6 sm:mt-10`,children:[x,S,k]}),e[27]=x,e[28]=S,e[29]=k,e[30]=A):A=e[30],A}export{At as ProvidersPage};
|